This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate mainline
[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#
1dca008a 23# Generated on Fri Aug 17 15:57:38 EET DST 2001 [metaconfig 3.0 PL70]
7f2de2d2 24# (with additional metaconfig patches by perlbug@perl.org)
2304df62 25
283fdd21 26cat >c1$$ <<EOF
2304df62
AD
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
283fdd21 37cat >c2$$ <<EOF
2304df62
AD
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
283fdd21 43true || cat c1$$ c2$$
2304df62
AD
44true || exec sh $0 $argv:q
45
283fdd21 46(exit $?0) || cat c2$$
2304df62 47(exit $?0) || exec sh $0 $argv:q
283fdd21 48rm -f c1$$ c2$$
2304df62 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
6b356c8e
JH
163ccname=''
164ccversion=''
b4eb6b3d
JH
165ccsymbols=''
166cppccsymbols=''
167cppsymbols=''
5440bc8e
JH
168from=''
169run=''
170targetarch=''
171to=''
172usecrosscompile=''
9c839522 173perllibs=''
b4eb6b3d
JH
174dynamic_ext=''
175extensions=''
176known_extensions=''
177nonxs_ext=''
178static_ext=''
179useopcode=''
180useposix=''
6fcddf3b 181extras=''
ecfc5424 182d_bsd=''
40a7a20a 183d_eunice=''
2304df62
AD
184d_xenix=''
185eunicefix=''
186Mcc=''
dfe9444c 187ar=''
2304df62
AD
188awk=''
189bash=''
190bison=''
191byacc=''
192cat=''
193chgrp=''
194chmod=''
195chown=''
ecfc5424 196comm=''
2304df62
AD
197compress=''
198cp=''
199cpio=''
200cpp=''
201csh=''
202date=''
203echo=''
204egrep=''
205emacs=''
206expr=''
207find=''
208flex=''
2304df62 209grep=''
8ff267be 210gzip=''
2304df62
AD
211inews=''
212ksh=''
213less=''
214line=''
215lint=''
216ln=''
217lp=''
218lpr=''
219ls=''
220mail=''
221mailx=''
dfe9444c 222make=''
2304df62
AD
223mkdir=''
224more=''
225mv=''
693762b4 226nm=''
2304df62
AD
227nroff=''
228perl=''
229pg=''
230pmake=''
231pr=''
232rm=''
233rmail=''
234sed=''
235sendmail=''
2304df62
AD
236shar=''
237sleep=''
238smail=''
239sort=''
240submit=''
241tail=''
242tar=''
243tbl=''
693762b4 244tee=''
2304df62
AD
245test=''
246touch=''
247tr=''
248troff=''
249uname=''
250uniq=''
251uuname=''
252vi=''
253zcat=''
8ff267be 254zip=''
b4eb6b3d
JH
255full_ar=''
256full_sed=''
a0d0e21e 257libswanted=''
2304df62
AD
258hint=''
259myuname=''
85e6fe83
LW
260osname=''
261osvers=''
2304df62
AD
262Author=''
263Date=''
264Header=''
265Id=''
266Locker=''
267Log=''
268RCSfile=''
269Revision=''
270Source=''
271State=''
dfe9444c
AD
272_a=''
273_exe=''
274_o=''
4633a7c4
LW
275archobjs=''
276exe_ext=''
277firstmakefile=''
278lib_ext=''
279obj_ext=''
280path_sep=''
b4eb6b3d 281afs=''
a6d26a0d 282afsroot=''
b4eb6b3d
JH
283alignbytes=''
284ansi2knr=''
285archlib=''
286archlibexp=''
287d_archlib=''
288installarchlib=''
289archname=''
290myarchname=''
291d_atolf=''
292d_atoll=''
293baserev=''
294bin=''
295binexp=''
296installbin=''
297bincompat5005=''
298d_bincompat5005=''
299byteorder=''
2304df62 300cc=''
2304df62
AD
301ccflags=''
302cppflags=''
303ldflags=''
304lkflags=''
8e07c86e 305locincpth=''
2304df62 306optimize=''
b4eb6b3d 307cf_email=''
2304df62
AD
308cf_by=''
309cf_time=''
b4eb6b3d 310charsize=''
2304df62 311contains=''
b4eb6b3d 312cpp_stuff=''
2304df62
AD
313cpplast=''
314cppminus=''
315cpprun=''
316cppstdin=''
74cac757 317d__fwalk=''
b4eb6b3d
JH
318d_access=''
319d_accessx=''
320d_alarm=''
321d_attribut=''
322d_bcmp=''
323d_bcopy=''
324d_bzero=''
325d_casti32=''
326castflags=''
327d_castneg=''
328d_chown=''
329d_chroot=''
330d_chsize=''
758a5d79 331d_class=''
b4eb6b3d
JH
332d_closedir=''
333d_void_closedir=''
4e0554ec 334d_cmsghdr_s=''
b4eb6b3d
JH
335d_const=''
336cryptlib=''
337d_crypt=''
338d_csh=''
339full_csh=''
340d_cuserid=''
341d_dbl_dig=''
2ef53570 342d_dbminitproto=''
b4eb6b3d
JH
343d_difftime=''
344d_dlerror=''
a0d0e21e 345d_dlopen=''
b4eb6b3d
JH
346d_dlsymun=''
347d_dosuid=''
348d_suidsafe=''
349d_drand48proto=''
350d_dup2=''
351d_eaccess=''
352d_endgrent=''
353d_endhent=''
354d_endnent=''
355d_endpent=''
356d_endpwent=''
357d_endsent=''
b363b713 358d_fchdir=''
b4eb6b3d
JH
359d_fchmod=''
360d_fchown=''
361d_fcntl=''
9d9004a9 362d_fcntl_can_lock=''
b4eb6b3d
JH
363d_fd_macros=''
364d_fd_set=''
365d_fds_bits=''
366d_fgetpos=''
758a5d79
JH
367d_finite=''
368d_finitel=''
b4eb6b3d
JH
369d_flexfnam=''
370d_flock=''
2ef53570 371d_flockproto=''
b4eb6b3d 372d_fork=''
758a5d79
JH
373d_fp_class=''
374d_fpclass=''
375d_fpclassify=''
376d_fpclassl=''
b4eb6b3d
JH
377d_fpos64_t=''
378d_frexpl=''
379d_fs_data_s=''
380d_fseeko=''
381d_fsetpos=''
382d_fstatfs=''
411ab01c 383d_fsync=''
b4eb6b3d
JH
384d_ftello=''
385d_ftime=''
386d_gettimeod=''
387d_Gconvert=''
388d_getcwd=''
389d_getespwnam=''
390d_getfsstat=''
391d_getgrent=''
392d_getgrps=''
393d_gethbyaddr=''
394d_gethbyname=''
395d_gethent=''
396aphostname=''
397d_gethname=''
398d_phostname=''
399d_uname=''
400d_gethostprotos=''
4e0554ec 401d_getitimer=''
b4eb6b3d
JH
402d_getlogin=''
403d_getmnt=''
404d_getmntent=''
405d_getnbyaddr=''
406d_getnbyname=''
407d_getnent=''
408d_getnetprotos=''
0c0643d0 409d_getpagsz=''
b4eb6b3d
JH
410d_getpent=''
411d_getpgid=''
412d_getpgrp2=''
413d_bsdgetpgrp=''
414d_getpgrp=''
415d_getppid=''
416d_getprior=''
417d_getpbyname=''
418d_getpbynumber=''
419d_getprotoprotos=''
420d_getprpwnam=''
421d_getpwent=''
422d_getsent=''
423d_getservprotos=''
424d_getspnam=''
425d_getsbyname=''
426d_getsbyport=''
a4f3eea9 427d_gnulibc=''
b4eb6b3d
JH
428d_hasmntopt=''
429d_htonl=''
430d_iconv=''
431d_inetaton=''
432d_int64_t=''
433d_isascii=''
758a5d79
JH
434d_isfinite=''
435d_isinf=''
b4eb6b3d
JH
436d_isnan=''
437d_isnanl=''
438d_killpg=''
439d_lchown=''
440d_ldbl_dig=''
441d_link=''
442d_locconv=''
443d_lockf=''
444d_longdbl=''
445longdblsize=''
446d_longlong=''
447longlongsize=''
448d_lseekproto=''
449d_lstat=''
450d_madvise=''
451d_mblen=''
452d_mbstowcs=''
453d_mbtowc=''
454d_memchr=''
455d_memcmp=''
456d_memcpy=''
457d_memmove=''
458d_memset=''
459d_mkdir=''
460d_mkdtemp=''
461d_mkfifo=''
462d_mkstemp=''
463d_mkstemps=''
464d_mktime=''
465d_mmap=''
466mmaptype=''
467d_modfl=''
e67aeab1 468d_modfl_pow32_bug=''
b4eb6b3d
JH
469d_mprotect=''
470d_msg=''
471d_msgctl=''
472d_msgget=''
4e0554ec 473d_msghdr_s=''
b4eb6b3d
JH
474d_msgrcv=''
475d_msgsnd=''
476d_msync=''
477d_munmap=''
478d_nice=''
2765b840 479d_nl_langinfo=''
b4eb6b3d
JH
480d_off64_t=''
481d_open3=''
482d_fpathconf=''
483d_pathconf=''
484d_pause=''
485d_pipe=''
486d_poll=''
2304df62 487d_portable=''
b4eb6b3d
JH
488d_old_pthread_create_joinable=''
489old_pthread_create_joinable=''
d6483fcc 490d_pthread_atfork=''
b4eb6b3d
JH
491d_pthread_yield=''
492d_sched_yield=''
493sched_yield=''
494d_qgcvt=''
495d_readdir=''
496d_rewinddir=''
497d_seekdir=''
498d_telldir=''
499d_readlink=''
4e0554ec
JH
500d_readv=''
501d_recvmsg=''
b4eb6b3d
JH
502d_rename=''
503d_rmdir=''
504d_safebcpy=''
505d_safemcpy=''
506d_sanemcmp=''
ef9f17be 507d_sbrkproto=''
b4eb6b3d
JH
508d_select=''
509d_sem=''
510d_semctl=''
511d_semget=''
512d_semop=''
4e0554ec 513d_sendmsg=''
b4eb6b3d
JH
514d_setegid=''
515d_seteuid=''
516d_setgrent=''
517d_setgrps=''
518d_sethent=''
4e0554ec 519d_setitimer=''
b4eb6b3d
JH
520d_setlinebuf=''
521d_setlocale=''
522d_setnent=''
523d_setpent=''
524d_setpgid=''
525d_setpgrp2=''
526d_bsdsetpgrp=''
527d_setpgrp=''
528d_setprior=''
529d_setproctitle=''
530d_setpwent=''
531d_setregid=''
532d_setresgid=''
533d_setresuid=''
534d_setreuid=''
535d_setrgid=''
536d_setruid=''
537d_setsent=''
538d_setsid=''
539d_setvbuf=''
540d_sfio=''
541usesfio=''
542d_shm=''
543d_shmat=''
544d_shmatprototype=''
545shmattype=''
546d_shmctl=''
547d_shmdt=''
548d_shmget=''
549d_sigaction=''
983dbef6 550d_sigprocmask=''
b4eb6b3d 551d_sigsetjmp=''
49a78c82 552d_sockatmark=''
2ef53570 553d_sockatmarkproto=''
b4eb6b3d
JH
554d_msg_ctrunc=''
555d_msg_dontroute=''
556d_msg_oob=''
557d_msg_peek=''
558d_msg_proxy=''
559d_oldsock=''
560d_scm_rights=''
561d_socket=''
562d_sockpair=''
563sockethdr=''
564socketlib=''
565d_socklen_t=''
566d_socks5_init=''
567d_sqrtl=''
eef837ea 568d_sresgproto=''
640374d0 569d_sresuproto=''
b4eb6b3d
JH
570d_statblks=''
571d_statfs_f_flags=''
572d_statfs_s=''
573d_fstatvfs=''
574d_statvfs=''
575d_stdio_cnt_lval=''
576d_stdio_ptr_lval=''
a7ffa9b9
NC
577d_stdio_ptr_lval_nochange_cnt=''
578d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
579d_stdiobase=''
580d_stdstdio=''
581stdio_base=''
582stdio_bufsiz=''
583stdio_cnt=''
584stdio_filbuf=''
585stdio_ptr=''
586d_index=''
587d_strchr=''
588d_strcoll=''
589d_strctcpy=''
590d_strerrm=''
591d_strerror=''
592d_sysernlst=''
593d_syserrlst=''
b3c85772 594d_strftime=''
b4eb6b3d
JH
595d_strtod=''
596d_strtol=''
597d_strtold=''
598d_strtoll=''
28e5dec8 599d_strtoq=''
b4eb6b3d
JH
600d_strtoul=''
601d_strtoull=''
602d_strtouq=''
603d_strxfrm=''
604d_symlink=''
605d_syscall=''
2ef53570 606d_syscallproto=''
b4eb6b3d
JH
607d_sysconf=''
608d_system=''
609d_tcgetpgrp=''
610d_tcsetpgrp=''
611d_telldirproto=''
612d_time=''
613timetype=''
614clocktype=''
615d_times=''
616d_truncate=''
617d_tzname=''
4e0554ec
JH
618d_u32align=''
619d_ualarm=''
b4eb6b3d
JH
620d_umask=''
621d_semctl_semid_ds=''
622d_semctl_semun=''
623d_union_semun=''
758a5d79 624d_unordered=''
4e0554ec 625d_usleep=''
2ef53570 626d_usleepproto=''
b4eb6b3d
JH
627d_ustat=''
628d_vfork=''
629usevfork=''
630d_voidsig=''
631signal_t=''
632d_volatile=''
633d_charvspr=''
634d_vprintf=''
635d_wait4=''
636d_waitpid=''
637d_wcstombs=''
638d_wctomb=''
4e0554ec 639d_writev=''
b4eb6b3d 640dlext=''
85e6fe83
LW
641cccdlflags=''
642ccdlflags=''
2304df62 643dlsrc=''
232e078e 644ld=''
85e6fe83 645lddlflags=''
2304df62 646usedl=''
b4eb6b3d
JH
647doublesize=''
648ebcdic=''
649fflushNULL=''
650fflushall=''
651fpossize=''
652fpostype=''
5b463ca7 653gccosandvers=''
8a27cf78 654gccversion=''
b4eb6b3d
JH
655gidformat=''
656gidsign=''
657gidsize=''
658gidtype=''
659groupstype=''
660h_fcntl=''
661h_sysfile=''
662i_arpainet=''
663db_hashtype=''
664db_prefixtype=''
640374d0
JH
665db_version_major=''
666db_version_minor=''
667db_version_patch=''
b4eb6b3d
JH
668i_db=''
669i_dbm=''
670i_rpcsvcdbm=''
671d_dirnamlen=''
672direntrytype=''
673i_dirent=''
a0d0e21e 674i_dld=''
b4eb6b3d
JH
675i_dlfcn=''
676i_fcntl=''
677i_float=''
758a5d79
JH
678i_fp=''
679i_fp_class=''
b4eb6b3d
JH
680i_gdbm=''
681d_grpasswd=''
682i_grp=''
683i_iconv=''
684i_ieeefp=''
685i_inttypes=''
2765b840 686i_langinfo=''
b4eb6b3d
JH
687i_libutil=''
688i_limits=''
689i_locale=''
690i_machcthr=''
691i_malloc=''
692i_math=''
693i_memory=''
694i_mntent=''
695i_ndbm=''
696i_netdb=''
697i_neterrno=''
698i_netinettcp=''
699i_niin=''
700i_sysin=''
701i_poll=''
702i_prot=''
703i_pthread=''
704d_pwage=''
705d_pwchange=''
706d_pwclass=''
707d_pwcomment=''
708d_pwexpire=''
709d_pwgecos=''
710d_pwpasswd=''
711d_pwquota=''
712i_pwd=''
713i_sfio=''
714i_shadow=''
715i_socks=''
716i_stddef=''
717i_stdlib=''
718i_string=''
719strings=''
720i_sunmath=''
721i_sysaccess=''
722i_sysdir=''
723i_sysfile=''
724d_voidtty=''
725i_bsdioctl=''
726i_sysfilio=''
727i_sysioctl=''
728i_syssockio=''
729i_syslog=''
730i_sysmman=''
731i_sysmode=''
732i_sysmount=''
733i_sysndir=''
734i_sysparam=''
735i_sysresrc=''
736i_syssecrt=''
737i_sysselct=''
738i_sysstat=''
739i_sysstatfs=''
740i_sysstatvfs=''
741i_systimes=''
742i_systypes=''
743i_sysuio=''
744i_sysun=''
745i_sysutsname=''
746i_sysvfs=''
747i_syswait=''
748i_sgtty=''
749i_termio=''
750i_termios=''
751i_systime=''
752i_systimek=''
753i_time=''
754timeincl=''
755i_unistd=''
756i_ustat=''
757i_utime=''
758i_values=''
759i_stdarg=''
760i_varargs=''
761i_varhdr=''
762i_vfork=''
763inc_version_list=''
764inc_version_list_init=''
765installprefix=''
766installprefixexp=''
767installstyle=''
768installusrbinperl=''
769intsize=''
770longsize=''
771shortsize=''
4b661809 772issymlink=''
2304df62 773libc=''
b4eb6b3d
JH
774ldlibpthname=''
775libperl=''
776shrpenv=''
777useshrplib=''
a0d0e21e 778glibpth=''
2304df62 779libpth=''
8e07c86e 780loclibpth=''
2304df62
AD
781plibpth=''
782xlibpth=''
1cfa4ec7 783ignore_versioned_solibs=''
2304df62 784libs=''
43999f95
JH
785libsdirs=''
786libsfiles=''
787libsfound=''
13b3f787 788libspath=''
85e6fe83 789lns=''
b4eb6b3d
JH
790d_PRIEUldbl=''
791d_PRIFUldbl=''
792d_PRIGUldbl=''
793d_PRIeldbl=''
794d_PRIfldbl=''
795d_PRIgldbl=''
796d_SCNfldbl=''
797sPRIEUldbl=''
798sPRIFUldbl=''
799sPRIGUldbl=''
800sPRIeldbl=''
801sPRIfldbl=''
802sPRIgldbl=''
803sSCNfldbl=''
804lseeksize=''
805lseektype=''
8ff267be 806make_set_make=''
b4eb6b3d
JH
807d_mymalloc=''
808freetype=''
809mallocobj=''
810mallocsrc=''
811malloctype=''
812usemymalloc=''
813installman1dir=''
814man1dir=''
815man1direxp=''
816man1ext=''
817installman3dir=''
818man3dir=''
819man3direxp=''
820man3ext=''
821modetype=''
822multiarch=''
823mydomain=''
824myhostname=''
825phostname=''
2304df62
AD
826c=''
827n=''
b4eb6b3d
JH
828d_eofnblk=''
829eagain=''
830o_nonblock=''
831rd_nodata=''
2cc61e15 832need_va_copy=''
b4eb6b3d
JH
833netdb_hlen_type=''
834netdb_host_type=''
835netdb_name_type=''
836netdb_net_type=''
837groupcat=''
838hostcat=''
839passcat=''
840orderlib=''
841ranlib=''
842d_perl_otherlibdirs=''
843otherlibdirs=''
2304df62
AD
844package=''
845spackage=''
b4eb6b3d
JH
846pager=''
847api_revision=''
848api_subversion=''
849api_version=''
850api_versionstring=''
851patchlevel=''
151e6568 852perl_patchlevel=''
b4eb6b3d
JH
853revision=''
854subversion=''
855version=''
861eb78d 856version_patchlevel_string=''
b4eb6b3d
JH
857perl5=''
858perladmin=''
859perlpath=''
860d_nv_preserves_uv=''
861d_nv_preserves_uv_bits=''
862i16size=''
863i16type=''
864i32size=''
865i32type=''
866i64size=''
867i64type=''
868i8size=''
869i8type=''
870ivsize=''
871ivtype=''
872nvsize=''
873nvtype=''
874u16size=''
875u16type=''
876u32size=''
877u32type=''
878u64size=''
879u64type=''
880u8size=''
881u8type=''
882uvsize=''
883uvtype=''
884ivdformat=''
885nvEUformat=''
886nvFUformat=''
887nvGUformat=''
888nveformat=''
889nvfformat=''
890nvgformat=''
891uvXUformat=''
892uvoformat=''
893uvuformat=''
894uvxformat=''
895pidtype=''
896prefix=''
897prefixexp=''
898installprivlib=''
899privlib=''
900privlibexp=''
901prototype=''
902ptrsize=''
903d_PRIXU64=''
904d_PRId64=''
905d_PRIi64=''
906d_PRIo64=''
907d_PRIu64=''
908d_PRIx64=''
909sPRIXU64=''
910sPRId64=''
911sPRIi64=''
912sPRIo64=''
913sPRIu64=''
914sPRIx64=''
915d_quad=''
916quadkind=''
917quadtype=''
918uquadtype=''
919drand01=''
920randbits=''
921randfunc=''
922randseedtype=''
923seedfunc=''
924installscript=''
925scriptdir=''
926scriptdirexp=''
927selectminbits=''
928selecttype=''
8ff267be 929sh=''
b4eb6b3d
JH
930sig_count=''
931sig_name=''
932sig_name_init=''
933sig_num=''
934sig_num_init=''
76d3c696 935sig_size=''
b4eb6b3d
JH
936installsitearch=''
937sitearch=''
938sitearchexp=''
939installsitebin=''
940sitebin=''
941sitebinexp=''
942installsitelib=''
943sitelib=''
944sitelib_stem=''
945sitelibexp=''
946siteprefix=''
947siteprefixexp=''
948sizesize=''
949sizetype=''
a0d0e21e 950so=''
b4eb6b3d 951socksizetype=''
2304df62
AD
952sharpbang=''
953shsharp=''
954spitshell=''
dfe9444c 955src=''
b4eb6b3d
JH
956ssizetype=''
957startperl=''
2304df62 958startsh=''
b4eb6b3d
JH
959stdchar=''
960d_stdio_stream_array=''
961stdio_stream_array=''
962sysman=''
5ff3f7a4 963trnl=''
b4eb6b3d
JH
964uidformat=''
965uidsign=''
966uidsize=''
967uidtype=''
968archname64=''
969use64bitall=''
970use64bitint=''
971ccflags_uselargefiles=''
972ldflags_uselargefiles=''
973libswanted_uselargefiles=''
974uselargefiles=''
975uselongdouble=''
976usemorebits=''
977usemultiplicity=''
2304df62 978nm_opt=''
40a7a20a 979nm_so_opt=''
2304df62
AD
980runnm=''
981usenm=''
b4eb6b3d 982useperlio=''
29209bc5 983usesocks=''
b4eb6b3d
JH
984d_oldpthreads=''
985use5005threads=''
986useithreads=''
9514c62b 987usereentrant=''
b4eb6b3d 988usethreads=''
2304df62 989incpath=''
2304df62
AD
990mips_type=''
991usrinc=''
b4eb6b3d
JH
992d_vendorarch=''
993installvendorarch=''
994vendorarch=''
995vendorarchexp=''
996d_vendorbin=''
997installvendorbin=''
998vendorbin=''
999vendorbinexp=''
1000d_vendorlib=''
1001installvendorlib=''
1002vendorlib=''
1003vendorlib_stem=''
1004vendorlibexp=''
1005usevendorprefix=''
1006vendorprefix=''
1007vendorprefixexp=''
d56c5707 1008versiononly=''
b4eb6b3d
JH
1009defvoidused=''
1010voidflags=''
1011pm_apiversion=''
1012xs_apiversion=''
3659ebf1
JH
1013yacc=''
1014yaccflags=''
2304df62
AD
1015CONFIG=''
1016
ecfc5424
AD
1017define='define'
1018undef='undef'
1019smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1020rmlist=''
1021
1022: We must find out about Eunice early
1023eunicefix=':'
1024if test -f /etc/unixtovms; then
1025 eunicefix=/etc/unixtovms
1026fi
1027if test -f /etc/unixtovms.exe; then
1028 eunicefix=/etc/unixtovms.exe
1029fi
1030
b4eb6b3d 1031i_whoami=''
6b356c8e
JH
1032ccname=''
1033ccversion=''
9c839522 1034perllibs=''
b4eb6b3d
JH
1035: set useposix=false in your hint file to disable the POSIX extension.
1036useposix=true
1037: set useopcode=false in your hint file to disable the Opcode extension.
1038useopcode=true
dfe9444c 1039: Trailing extension. Override this in a hint file, if needed.
4e2a5f63 1040_exe=''
dfe9444c
AD
1041: Extra object files, if any, needed on this platform.
1042archobjs=''
b4eb6b3d 1043archname=''
ff935051
JH
1044: Possible local include directories to search.
1045: Set locincpth to "" in a hint file to defeat local include searches.
1046locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1047locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1048:
1049: no include file wanted by default
1050inclwanted=''
1051
b4eb6b3d 1052groupstype=''
64615a5e 1053libnames=''
732c9516
JH
1054: change the next line if compiling for Xenix/286 on Xenix/386
1055xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1056: Possible local library directories to search.
1057loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1058loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1059
1060: general looking path for locating libraries
5869b1f1 1061glibpth="/lib /usr/lib $xlibpth"
732c9516 1062glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1063test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1064test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1065
1066: Private path used by Configure to find libraries. Its value
1067: is prepended to libpth. This variable takes care of special
1068: machines, like the mips. Usually, it should be empty.
1069plibpth=''
1070
1cfa4ec7
GS
1071: default library list
1072libswanted=''
921b2963 1073: some systems want to use only the non-versioned libso:s
1cfa4ec7 1074ignore_versioned_solibs=''
b4eb6b3d
JH
1075archname64=''
1076ccflags_uselargefiles=''
1077ldflags_uselargefiles=''
1078libswanted_uselargefiles=''
1079: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1080: set usesocks on the Configure command line to enable socks.
b4eb6b3d 1081: set usethreads on the Configure command line to enable threads.
cd040c5e 1082usereentrant='undef'
b4eb6b3d
JH
1083: full support for void wanted by default
1084defvoidused=15
1085
ecfc5424 1086: List of libraries we want.
693762b4 1087: If anyone needs -lnet, put it in a hint file.
997d70a2 1088libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
69e84d1d 1089libswanted="$libswanted dld ld sun m c cposix posix"
f1066039 1090libswanted="$libswanted ndir dir crypt sec"
0c9177ab 1091libswanted="$libswanted ucb bsd BSD PW x iconv util"
1aef975c 1092: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1093: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1094glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1095glibpth="/usr/shlib $glibpth"
1096: Do not use vfork unless overridden by a hint file.
1097usevfork=false
1098
8ff267be 1099: Find the basic shell for Bourne shell scripts
1100case "$sh" in
1101'')
8ff267be 1102 case "$SYSTYPE" in
1103 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1104 *) xxx='/bin/sh';;
1105 esac
1106 if test -f "$xxx"; then
1107 sh="$xxx"
1108 else
1109 : Build up a list and do a single loop so we can 'break' out.
1110 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1111 for xxx in sh bash ksh pdksh ash; do
1112 for p in $pth; do
1113 try="$try ${p}/${xxx}"
1114 done
1115 done
1116 for xxx in $try; do
1117 if test -f "$xxx"; then
1118 sh="$xxx";
8ff267be 1119 break
1120 elif test -f "$xxx.exe"; then
1121 sh="$xxx";
8ff267be 1122 break
1123 fi
1124 done
1125 fi
1126 ;;
1127esac
1128
1129case "$sh" in
1130'') cat <<EOM >&2
1131$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1132
8ff267be 1133Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1134Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1135we'll try to straighten this all out.
8ff267be 1136EOM
1137 exit 1
1138 ;;
1139esac
1140
760ac839 1141: see if sh knows # comments
73614538 1142if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1143 shsharp=true
1144 spitshell=cat
760ac839
LW
1145 xcat=/bin/cat
1146 test -f $xcat || xcat=/usr/bin/cat
5440bc8e
JH
1147 echo "#!$xcat" >sharp
1148 $eunicefix sharp
1149 chmod +x sharp
1150 ./sharp > today
760ac839 1151 if test -s today; then
760ac839
LW
1152 sharpbang='#!'
1153 else
5440bc8e
JH
1154 echo "#! $xcat" > sharp
1155 $eunicefix sharp
1156 chmod +x sharp
1157 ./sharp > today
760ac839 1158 if test -s today; then
760ac839
LW
1159 sharpbang='#! '
1160 else
760ac839
LW
1161 sharpbang=': use '
1162 fi
1163 fi
1164else
dfe9444c 1165 echo " "
8ff267be 1166 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1167 shsharp=false
1168 cd ..
1169 echo "exec grep -v '^[ ]*#'" >spitshell
1170 chmod +x spitshell
1171 $eunicefix spitshell
1172 spitshell=`pwd`/spitshell
1173 cd UU
1174 echo "I presume that if # doesn't work, #! won't work either!"
1175 sharpbang=': use '
1176fi
5440bc8e 1177rm -f sharp today
760ac839
LW
1178
1179: figure out how to guarantee sh startup
8ff267be 1180case "$startsh" in
1181'') startsh=${sharpbang}${sh} ;;
1182*)
760ac839 1183esac
5440bc8e 1184cat >sharp <<EOSS
760ac839
LW
1185$startsh
1186set abc
1187test "$?abc" != 1
1188EOSS
1189
5440bc8e
JH
1190chmod +x sharp
1191$eunicefix sharp
1192if ./sharp; then
8ff267be 1193 : echo "Yup, it does."
760ac839 1194else
dfe9444c
AD
1195 echo "Hmm... '$startsh' does not guarantee sh startup..."
1196 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1197fi
5440bc8e 1198rm -f sharp
760ac839 1199
aebf16e7
AD
1200
1201: Save command line options in file UU/cmdline.opt for later use in
1202: generating config.sh.
1203cat > cmdline.opt <<EOSH
1204# Configure command line arguments.
1205config_arg0='$0'
1206config_args='$*'
1207config_argc=$#
1208EOSH
1209argn=1
ee45ea83
IZ
1210args_exp=''
1211args_sep=''
aebf16e7
AD
1212for arg in "$@"; do
1213 cat >>cmdline.opt <<EOSH
1214config_arg$argn='$arg'
1215EOSH
ee45ea83
IZ
1216 # Extreme backslashitis: replace each ' by '"'"'
1217 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1218$arg
1219EOC
1220 arg_exp=`cat cmdl.opt`
1221 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1222 argn=`expr $argn + 1`
ee45ea83 1223 args_sep=' '
aebf16e7 1224done
ee45ea83
IZ
1225# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1226# used by ./hints/os2.sh
1227rm -f cmdl.opt
aebf16e7 1228
2304df62
AD
1229: produce awk script to parse command line options
1230cat >options.awk <<'EOF'
1231BEGIN {
02e93a22 1232 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1233
1234 len = length(optstr);
1235 for (i = 1; i <= len; i++) {
1236 c = substr(optstr, i, 1);
1237 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1238 if (a == ":") {
1239 arg[c] = 1;
1240 i++;
1241 }
1242 opt[c] = 1;
1243 }
1244}
1245{
1246 expect = 0;
1247 str = $0;
1248 if (substr(str, 1, 1) != "-") {
1249 printf("'%s'\n", str);
1250 next;
1251 }
1252 len = length($0);
1253 for (i = 2; i <= len; i++) {
1254 c = substr(str, i, 1);
1255 if (!opt[c]) {
1256 printf("-%s\n", substr(str, i));
1257 next;
1258 }
1259 printf("-%s\n", c);
1260 if (arg[c]) {
1261 if (i < len)
1262 printf("'%s'\n", substr(str, i + 1));
1263 else
1264 expect = 1;
1265 next;
1266 }
1267 }
1268}
1269END {
1270 if (expect)
1271 print "?";
1272}
1273EOF
1274
1275: process the command line options
4633a7c4
LW
1276set X `for arg in "$@"; do echo "X$arg"; done |
1277 sed -e s/X// | awk -f options.awk`
2304df62
AD
1278eval "set $*"
1279shift
1280rm -f options.awk
1281
1282: set up default values
1283fastread=''
1284reuseval=false
1285config_sh=''
1286alldone=''
1287error=''
1288silent=''
1289extractsh=''
ecfc5424 1290override=''
16d20bd9 1291knowitall=''
02e93a22 1292rm -f optdef.sh posthint.sh
28757baa 1293cat >optdef.sh <<EOS
1294$startsh
1295EOS
2304df62 1296
dfe9444c 1297
2304df62
AD
1298: option parsing
1299while test $# -gt 0; do
1300 case "$1" in
1301 -d) shift; fastread=yes;;
1302 -e) shift; alldone=cont;;
1303 -f)
1304 shift
1305 cd ..
1306 if test -r "$1"; then
1307 config_sh="$1"
1308 else
a0d0e21e 1309 echo "$me: cannot read config file $1." >&2
2304df62
AD
1310 error=true
1311 fi
1312 cd UU
1313 shift;;
1314 -h) shift; error=true;;
1315 -r) shift; reuseval=true;;
dfe9444c 1316 -s) shift; silent=true; realsilent=true;;
2304df62 1317 -E) shift; alldone=exit;;
16d20bd9 1318 -K) shift; knowitall=true;;
ecfc5424 1319 -O) shift; override=true;;
dfe9444c 1320 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1321 -D)
1322 shift
1323 case "$1" in
1324 *=)
1325 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1326 echo "$me: ignoring -D $1" >&2
1327 ;;
ecfc5424 1328 *=*) echo "$1" | \
1aef975c
AD
1329 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1330 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1331 esac
1332 shift
1333 ;;
1334 -U)
1335 shift
1336 case "$1" in
1aef975c 1337 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1338 *=*)
1339 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1340 echo "$me: ignoring -U $1" >&2
1341 ;;
1aef975c 1342 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1343 esac
1344 shift
1345 ;;
02e93a22
JH
1346 -A)
1347 shift
1348 xxx=''
1349 yyy="$1"
02e93a22 1350 zzz=''
5f83a3e9 1351 uuu=undef
02e93a22 1352 case "$yyy" in
5f83a3e9
JH
1353 *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1354 case "$zzz" in
1355 *:*) zzz='' ;;
1356 *) xxx=append
1357 zzz=" "`echo $yyy|sed 's!^[^=]*=!!'`
1358 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1359 esac
1360 ;;
1361 esac
1362 case "$xxx" in
1363 '') case "$yyy" in
1364 *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1365 yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1366 zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1367 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1368 *) xxx=`echo $yyy|sed 's!:.*!!'`
1369 yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1370 esac
1371 ;;
1372 esac
02e93a22
JH
1373 case "$xxx" in
1374 append)
5f83a3e9 1375 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1376 clear)
5f83a3e9 1377 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1378 define)
1379 case "$zzz" in
1380 '') zzz=define ;;
1381 esac
5f83a3e9 1382 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1383 eval)
5f83a3e9 1384 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1385 prepend)
5f83a3e9 1386 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1387 undef)
1388 case "$zzz" in
1389 '') zzz="$uuu" ;;
1390 esac
5f83a3e9
JH
1391 echo "$yyy=$zzz" >> posthint.sh ;;
1392 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1393 esac
bde6b06b 1394 shift
02e93a22 1395 ;;
dfe9444c 1396 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1397 exit 0;;
2304df62 1398 --) break;;
a0d0e21e 1399 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1400 *) break;;
1401 esac
1402done
1403
1404case "$error" in
1405true)
1406 cat >&2 <<EOM
2afac517 1407Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1408 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1409 -d : use defaults for all answers.
1410 -e : go on without questioning past the production of config.sh.
1411 -f : specify an alternate default configuration file.
1412 -h : print this help message and exit (with an error status).
1413 -r : reuse C symbols value if possible (skips costly nm extraction).
1414 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1415 -D : define symbol to have some value:
1416 -D symbol symbol gets the value 'define'
1417 -D symbol=value symbol gets the value 'value'
2304df62 1418 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1419 -K : do not use unless you know what you are doing.
ecfc5424 1420 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1421 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1422 -U : undefine symbol:
1423 -U symbol symbol gets the value 'undef'
1424 -U symbol= symbol gets completely empty
02e93a22 1425 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1426 -A symbol=value append " "value to symbol
02e93a22
JH
1427 -A append:symbol=value append value to symbol
1428 -A define:symbol=value define symbol to have value
02e93a22
JH
1429 -A clear:symbol define symbol to be ''
1430 -A define:symbol define symbol to be 'define'
1431 -A eval:symbol=value define symbol to be eval of value
1432 -A prepend:symbol=value prepend value to symbol
1433 -A undef:symbol define symbol to be 'undef'
1434 -A undef:symbol= define symbol to be ''
2304df62
AD
1435 -V : print version number and exit (with a zero status).
1436EOM
1437 exit 1
1438 ;;
1439esac
1440
dfe9444c
AD
1441: Sanity checks
1442case "$fastread$alldone" in
1443yescont|yesexit) ;;
1444*)
aaeb8e51
GS
1445 case "$extractsh" in
1446 true) ;;
1447 *)
1448 if test ! -t 0; then
1449 echo "Say 'sh Configure', not 'sh <Configure'"
1450 exit 1
1451 fi
1452 ;;
1453 esac
dfe9444c
AD
1454 ;;
1455esac
1456
2304df62
AD
1457exec 4>&1
1458case "$silent" in
1459true) exec 1>/dev/null;;
1460esac
1461
ecfc5424 1462: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1463touch optdef.sh
1464. ./optdef.sh
02e93a22
JH
1465: create the posthint manipulation script and leave the file out there...
1466touch posthint.sh
a0d0e21e 1467
2304df62 1468: set package name
85e6fe83 1469package=perl5
b4eb6b3d
JH
1470first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1471last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1472case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1473ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1474*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1475esac
2304df62 1476
2304df62
AD
1477: Some greps do not return status, grrr.
1478echo "grimblepritz" >grimble
1479if grep blurfldyick grimble >/dev/null 2>&1 ; then
1480 contains=contains
1481elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1482 contains=grep
1483else
1484 contains=contains
1485fi
1486rm -f grimble
1487: the following should work in any shell
1488case "$contains" in
1489contains*)
1490 echo " "
1491 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1492 cat >contains <<'EOSS'
1493grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1494EOSS
1495chmod +x contains
1496esac
1497
dfe9444c
AD
1498: Find the path to the source tree
1499case "$src" in
1500'') case "$0" in
b233458b
JH
1501 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1502 case "$src" in
1503 /*) ;;
8504afb7 1504 .) ;;
b233458b
JH
1505 *) src=`cd ../$src && pwd` ;;
1506 esac
1507 ;;
dfe9444c
AD
1508 *) src='.';;
1509 esac;;
1510esac
1511case "$src" in
1512'') src=/
1513 rsrc=/
1514 ;;
1515/*) rsrc="$src";;
1516*) rsrc="../$src";;
1517esac
1518if test -f $rsrc/Configure && \
1519 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1520then
1521 : found it, so we are ok.
1522else
1523 rsrc=''
1524 for src in . .. ../.. ../../.. ../../../..; do
1525 if test -f ../$src/Configure && \
1526 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1527 then
1528 rsrc=../$src
1529 break
1530 fi
1531 done
1532fi
1533case "$rsrc" in
1534'')
1535 cat <<EOM >&4
1536
1537Sorry, I can't seem to locate the source dir for $package. Please start
1538Configure with an explicit path -- i.e. /some/path/Configure.
1539
1540EOM
1541 exit 1
1542 ;;
1543../.) rsrc='..';;
1544*)
1545 echo " "
1546 echo "Sources for $package found in \"$src\"." >&4
1547 ;;
1548esac
1549
1550: script used to extract .SH files with variable substitutions
1551cat >extract <<'EOS'
a02608de 1552PERL_CONFIG_SH=true
dfe9444c 1553echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1554if test -f MANIFEST; then
1555 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1556else
1557 echo "(Looking for .SH files under the source directory.)"
1558 set x `(cd $src; find . -name "*.SH" -print)`
1559fi
1560shift
1561case $# in
15620) set x `(cd $src; echo *.SH)`; shift;;
1563esac
1564if test ! -f $src/$1; then
1565 shift
1566fi
1567mkdir_p='
1568name=$1;
1569create="";
1570while test $name; do
1571 if test ! -d "$name"; then
1572 create="$name $create";
1573 name=`echo $name | sed -e "s|^[^/]*$||"`;
1574 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1575 else
1576 name="";
1577 fi;
1578done;
1579for file in $create; do
1580 mkdir $file;
1581done
1582'
1583for file in $*; do
1584 case "$src" in
1585 ".")
1586 case "$file" in
1587 */*)
1588 dir=`expr X$file : 'X\(.*\)/'`
1589 file=`expr X$file : 'X.*/\(.*\)'`
1590 (cd $dir && . ./$file)
1591 ;;
1592 *)
1593 . ./$file
1594 ;;
1595 esac
1596 ;;
1597 *)
1598 case "$file" in
1599 */*)
1600 dir=`expr X$file : 'X\(.*\)/'`
1601 file=`expr X$file : 'X.*/\(.*\)'`
1602 (set x $dir; shift; eval $mkdir_p)
1603 sh <$src/$dir/$file
1604 ;;
1605 *)
1606 sh <$src/$file
1607 ;;
1608 esac
1609 ;;
1610 esac
1611done
1612if test -f $src/config_h.SH; then
1613 if test ! -f config.h; then
1614 : oops, they left it out of MANIFEST, probably, so do it anyway.
1615 . $src/config_h.SH
1616 fi
1617fi
1618EOS
1619
1620: extract files and exit if asked to do so
1621case "$extractsh" in
1622true)
1623 case "$realsilent" in
1624 true) ;;
1625 *) exec 1>&4;;
1626 esac
1627 case "$config_sh" in
1628 '') config_sh='config.sh';;
1629 esac
1630 echo " "
1631 echo "Fetching answers from $config_sh..."
1632 cd ..
1633 . $config_sh
1634 test "$override" && . ./optdef.sh
1635 echo " "
1636 . UU/extract
1637 rm -rf UU
24ccb310 1638 echo "Extraction done."
dfe9444c
AD
1639 exit 0
1640 ;;
1641esac
1642
1643: Eunice requires " " instead of "", can you believe it
1644echo " "
1645: Here we go...
1646echo "Beginning of configuration questions for $package."
1647
1648trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1649
2304df62
AD
1650: first determine how to suppress newline on echo command
1651echo " "
1652echo "Checking echo to see how to suppress newlines..."
1653(echo "hi there\c" ; echo " ") >.echotmp
1654if $contains c .echotmp >/dev/null 2>&1 ; then
1655 echo "...using -n."
1656 n='-n'
1657 c=''
1658else
1659 cat <<'EOM'
1660...using \c
1661EOM
1662 n=''
1663 c='\c'
1664fi
1665echo $n "The star should be here-->$c"
1666echo '*'
1667rm -f .echotmp
1668
1669: Now test for existence of everything in MANIFEST
1670echo " "
dfe9444c 1671if test -f $rsrc/MANIFEST; then
2304df62 1672 echo "First let's make sure your kit is complete. Checking..." >&4
dfe9444c 1673 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
2304df62 1674 rm -f missing
dfe9444c 1675 tmppwd=`pwd`
2304df62 1676 for filelist in x??; do
dfe9444c 1677 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
2304df62
AD
1678 done
1679 if test -s missing; then
1680 cat missing >&4
1681 cat >&4 <<'EOM'
1682
1683THIS PACKAGE SEEMS TO BE INCOMPLETE.
1684
1685You have the option of continuing the configuration process, despite the
1686distinct possibility that your kit is damaged, by typing 'y'es. If you
1687do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1688and contact the author (perlbug@perl.org).
2304df62
AD
1689
1690EOM
1691 echo $n "Continue? [n] $c" >&4
1692 read ans
1693 case "$ans" in
1694 y*)
1695 echo "Continuing..." >&4
1696 rm -f missing
1697 ;;
1698 *)
1699 echo "ABORTING..." >&4
1700 kill $$
1701 ;;
1702 esac
1703 else
dfe9444c 1704 echo "Looks good..."
2304df62
AD
1705 fi
1706else
1707 echo "There is no MANIFEST file. I hope your kit is complete !"
1708fi
1709rm -f missing x??
1710
5ff3f7a4
GS
1711echo " "
1712: Find the appropriate value for a newline for tr
1713if test -n "$DJGPP"; then
1714 trnl='\012'
1715fi
1716if test X"$trnl" = X; then
1717 case "`echo foo|tr '\n' x 2>/dev/null`" in
1718 foox) trnl='\n' ;;
1719 esac
1720fi
1721if test X"$trnl" = X; then
1722 case "`echo foo|tr '\012' x 2>/dev/null`" in
1723 foox) trnl='\012' ;;
1724 esac
1725fi
1726if test X"$trnl" = X; then
1727 cat <<EOM >&2
1728
1729$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1730
1731EOM
1732 exit 1
1733fi
1734
2304df62
AD
1735: compute the number of columns on the terminal for proper question formatting
1736case "$COLUMNS" in
1737'') COLUMNS='80';;
1738esac
1739
1740: set up the echo used in my read
1741myecho="case \"\$xxxm\" in
1742'') echo $n \"\$rp $c\" >&4;;
1743*) case \"\$rp\" in
1744 '') echo $n \"[\$xxxm] $c\";;
1745 *)
1746 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1747 echo \"\$rp\" >&4
1748 echo $n \"[\$xxxm] $c\" >&4
1749 else
1750 echo $n \"\$rp [\$xxxm] $c\" >&4
1751 fi
1752 ;;
1753 esac;;
1754esac"
1755
1756: now set up to do reads with possible shell escape and default assignment
1757cat <<EOSC >myread
28757baa 1758$startsh
2304df62
AD
1759xxxm=\$dflt
1760$myecho
1761ans='!'
1762case "\$fastread" in
1763yes) case "\$dflt" in
1764 '') ;;
1765 *) ans='';
1766 case "\$silent-\$rp" in
1767 true-) ;;
1768 *) echo " " >&4;;
1769 esac;;
1770 esac;;
1771*) case "\$silent" in
1772 true) case "\$rp" in
1773 '') ans='';;
1774 esac;;
1775 esac;;
1776esac
1777while expr "X\$ans" : "X!" >/dev/null; do
1778 read answ
1779 set x \$xxxm
1780 shift
dfe9444c 1781 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1782 case "\$answ" in
dfe9444c
AD
1783 "!")
1784 sh 1>&4
1785 echo " "
1786 $myecho
1787 ;;
1788 !*)
1789 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1790 shift
1791 sh 1>&4 -c "\$*"
1792 echo " "
1793 $myecho
1794 ;;
2304df62
AD
1795 "\$ans")
1796 case "\$ans" in
ecfc5424
AD
1797 \\&*)
1798 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1799 shift
1800 case "\$1" in
1801 -d)
1802 fastread=yes
40a7a20a 1803 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1804 ;;
1805 -*)
40a7a20a 1806 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1807 ;;
1808 esac
1809 $myecho
1810 ans=!
1811 ;;
2304df62
AD
1812 esac;;
1813 *)
1814 case "\$aok" in
1815 y)
1816 echo "*** Substitution done -- please confirm."
1817 xxxm="\$ans"
c9795ab7 1818 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1819 xxxm="\$ans"
1820 ans=!
1821 ;;
1822 *)
1823 echo "*** Error -- try again."
1824 ans=!
1825 ;;
1826 esac
1827 $myecho
1828 ;;
1829 esac
1830 case "\$ans\$xxxm\$nostick" in
1831 '')
1832 ans=!
1833 $myecho
1834 ;;
1835 esac
1836done
1837case "\$ans" in
1838'') ans="\$xxxm";;
1839esac
1840EOSC
1841
1842: create .config dir to save info across Configure sessions
1843test -d ../.config || mkdir ../.config
1844cat >../.config/README <<EOF
1845This directory created by Configure to save information that should
dfe9444c 1846persist across sessions for $package.
2304df62
AD
1847
1848You may safely delete it if you wish.
1849EOF
1850
9507cadf 1851xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 1852case "$usedevel" in
0107c034 1853$define|true|[yY]*) ;;
9507cadf 1854*) case "$xversion" in
0107c034
JH
1855 *[13579])
1856 cat >&4 <<EOH
1857*** WHOA THERE!!! ***
1858
1859 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
1860 The version of this $package distribution is $xversion, that is, odd,
1861 (as opposed to even) and that signifies a development release.
3d5d58b1 1862 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
1863
1864 Do ***NOT*** install this into production use.
1865 Data corruption and crashes are possible.
1866
1867 It is most seriously suggested that you do not continue any further
1868 unless you want to help in developing and debugging Perl.
1869
6adc6a45
JH
1870 If you *still* want to build perl, you can answer 'y' now,
1871 or pass -Dusedevel to Configure.
1872
0107c034
JH
1873EOH
1874 rp='Do you really want to continue?'
1875 dflt='n'
1876 . ./myread
1877 case "$ans" in
8feeef0e
JH
1878 [yY]) echo >&4 "Okay, continuing."
1879 usedevel="$define" ;;
0107c034
JH
1880 *) echo >&4 "Okay, bye."
1881 exit 1
1882 ;;
1883 esac
1884 ;;
1885 esac
1886 ;;
1887esac
8feeef0e
JH
1888case "$usedevel" in
1889$define|true|[yY]*)
1890 case "$versiononly" in
1891 '') versiononly="$define" ;;
1892 esac
1893 case "$installusrbinperl" in
1894 '') installusrbinperl="$undef" ;;
1895 esac
1896 ;;
1897esac
0107c034 1898
2304df62
AD
1899: general instructions
1900needman=true
1901firsttime=true
760ac839 1902user=`(logname) 2>/dev/null`
dfe9444c
AD
1903case "$user" in
1904'') user=`whoami 2>&1`;;
760ac839 1905esac
2304df62
AD
1906if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1907 firsttime=false
1908 echo " "
1909 rp='Would you like to see the instructions?'
1910 dflt=n
1911 . ./myread
1912 case "$ans" in
1913 [yY]*) ;;
1914 *) needman=false;;
1915 esac
1916fi
1917if $needman; then
1918 cat <<EOH
4e2a5f63 1919
2304df62 1920This installation shell script will examine your system and ask you questions
a0d0e21e 1921to determine how the perl5 package should be installed. If you get
2304df62
AD
1922stuck on a question, you may use a ! shell escape to start a subshell or
1923execute a command. Many of the questions will have default answers in square
1924brackets; typing carriage return will give you the default.
1925
1926On some of the questions which ask for file or directory names you are allowed
1927to use the ~name construct to specify the login directory belonging to "name",
1928even if you don't have a shell which knows about that. Questions where this is
1929allowed will be marked "(~name ok)".
1930
1931EOH
1932 rp=''
1933 dflt='Type carriage return to continue'
1934 . ./myread
1935 cat <<'EOH'
1936
1937The prompter used in this script allows you to use shell variables and
1938backticks in your answers. You may use $1, $2, etc... to refer to the words
1939in the default answer, as if the default line was a set of arguments given to a
1940script shell. This means you may also use $* to repeat the whole default line,
1941so you do not have to re-type everything to add something to the default.
1942
1943Everytime there is a substitution, you will have to confirm. If there is an
1944error (e.g. an unmatched backtick), the default answer will remain unchanged
1945and you will be prompted again.
1946
1947If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1948the questions and use the computed defaults (or the previous answers if there
1949was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1950You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1951on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1952
1953EOH
1954 . ./myread
1955 cat <<EOH
1956
1957Much effort has been expended to ensure that this shell script will run on any
1958Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1959Configure and run it again. If you can't run Configure for some reason,
1960you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 1961have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
1962
1963This installation script affects things in two ways:
1964
19651) it may do direct variable substitutions on some of the files included
1966 in this kit.
19672) it builds a config.h file for inclusion in C programs. You may edit
1968 any of these files as the need arises after running this script.
1969
1970If you make a mistake on a question, there is no easy way to back up to it
1971currently. The easiest thing to do is to edit config.sh and rerun all the SH
1972files. Configure will offer to let you do this before it runs the SH files.
1973
1974EOH
1975 dflt='Type carriage return to continue'
1976 . ./myread
1977 case "$firsttime" in
1978 true) echo $user >>../.config/instruct;;
1979 esac
1980fi
1981
2304df62
AD
1982: find out where common programs are
1983echo " "
1984echo "Locating common programs..." >&4
1985cat <<EOSC >loc
1986$startsh
1987case \$# in
19880) exit 1;;
1989esac
1990thing=\$1
1991shift
1992dflt=\$1
1993shift
1994for dir in \$*; do
1995 case "\$thing" in
1996 .)
1997 if test -d \$dir/\$thing; then
1998 echo \$dir
1999 exit 0
2000 fi
2001 ;;
2002 *)
a0d0e21e 2003 for thisthing in \$dir/\$thing; do
ecfc5424 2004 : just loop through to pick last item
a0d0e21e 2005 done
25f94b33 2006 if test -f \$thisthing; then
a0d0e21e 2007 echo \$thisthing
2304df62
AD
2008 exit 0
2009 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2010 if test -n "$DJGPP"; then
2011 echo \$dir/\$thing.exe
2012 else
2013 : on Eunice apparently
2014 echo \$dir/\$thing
2015 fi
2304df62
AD
2016 exit 0
2017 fi
2018 ;;
2019 esac
2020done
2021echo \$dflt
2022exit 1
2023EOSC
2024chmod +x loc
2025$eunicefix loc
2026loclist="
2027awk
2028cat
f8006fac 2029chmod
b4eb6b3d
JH
2030comm
2031cp
2304df62
AD
2032echo
2033expr
2034grep
a0d0e21e 2035ls
dfe9444c 2036make
b4eb6b3d 2037mkdir
2304df62
AD
2038rm
2039sed
b4eb6b3d 2040sort
85e6fe83 2041touch
2304df62 2042tr
b4eb6b3d 2043uniq
2304df62
AD
2044"
2045trylist="
2046Mcc
dfe9444c 2047ar
3659ebf1 2048bison
b4eb6b3d 2049byacc
2304df62 2050cpp
b4eb6b3d 2051csh
2304df62
AD
2052date
2053egrep
8ff267be 2054gzip
b4eb6b3d 2055less
8ff267be 2056ln
b4eb6b3d 2057more
693762b4 2058nm
b4eb6b3d
JH
2059nroff
2060pg
2304df62
AD
2061test
2062uname
8ff267be 2063zip
2304df62 2064"
8e07c86e 2065pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2066pth="$pth /lib /usr/lib"
2067for file in $loclist; do
dfe9444c
AD
2068 eval xxx=\$$file
2069 case "$xxx" in
2070 /*|?:[\\/]*)
2071 if test -f "$xxx"; then
2072 : ok
2073 else
2074 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2075 xxx=`./loc $file $file $pth`
2076 fi
2077 ;;
2078 '') xxx=`./loc $file $file $pth`;;
2079 *) xxx=`./loc $xxx $xxx $pth`;;
2080 esac
2304df62
AD
2081 eval $file=$xxx
2082 eval _$file=$xxx
2083 case "$xxx" in
2084 /*)
2085 echo $file is in $xxx.
2086 ;;
8e07c86e
AD
2087 ?:[\\/]*)
2088 echo $file is in $xxx.
2089 ;;
2304df62 2090 *)
25f94b33
AD
2091 echo "I don't know where '$file' is, and my life depends on it." >&4
2092 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2093 exit 1
2304df62
AD
2094 ;;
2095 esac
2096done
2097echo " "
2098echo "Don't worry if any of the following aren't found..."
2099say=offhand
2100for file in $trylist; do
dfe9444c
AD
2101 eval xxx=\$$file
2102 case "$xxx" in
2103 /*|?:[\\/]*)
2104 if test -f "$xxx"; then
2105 : ok
2106 else
2107 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2108 xxx=`./loc $file $file $pth`
2109 fi
2110 ;;
2111 '') xxx=`./loc $file $file $pth`;;
2112 *) xxx=`./loc $xxx $xxx $pth`;;
2113 esac
2304df62
AD
2114 eval $file=$xxx
2115 eval _$file=$xxx
2116 case "$xxx" in
2117 /*)
2118 echo $file is in $xxx.
2119 ;;
8e07c86e
AD
2120 ?:[\\/]*)
2121 echo $file is in $xxx.
2122 ;;
2304df62
AD
2123 *)
2124 echo "I don't see $file out there, $say."
2125 say=either
2126 ;;
2127 esac
2128done
2129case "$egrep" in
2130egrep)
2131 echo "Substituting grep for egrep."
2132 egrep=$grep
2133 ;;
2134esac
8ff267be 2135case "$ln" in
2136ln)
2137 echo "Substituting cp for ln."
2138 ln=$cp
2139 ;;
2140esac
2304df62
AD
2141case "$test" in
2142test)
2143 echo "Hopefully test is built into your sh."
2144 ;;
2145*)
73614538 2146 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2147 echo "Using the test built into your sh."
2304df62
AD
2148 test=test
2149 _test=test
2150 fi
2151 ;;
2152esac
2153case "$echo" in
2154echo)
2155 echo "Hopefully echo is built into your sh."
2156 ;;
2157'') ;;
2158*)
2159 echo " "
2160echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2161 $echo $n "hi there$c" >foo1
2162 echo $n "hi there$c" >foo2
2163 if cmp foo1 foo2 >/dev/null 2>&1; then
2164 echo "They are compatible. In fact, they may be identical."
2165 else
2166 case "$n" in
2167 '-n') n='' c='\c';;
2168 *) n='-n' c='';;
2169 esac
2170 cat <<FOO
2171They are not compatible! You are probably running ksh on a non-USG system.
2172I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2173have echo built in and we may have to run some Bourne shell scripts. That
2174means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2175
2176FOO
2177 $echo $n "The star should be here-->$c"
2178 $echo "*"
2179 fi
2180 $rm -f foo1 foo2
2181 ;;
2182esac
2183
2573c5f9
JH
2184cat <<EOS >checkcc
2185$startsh
2186EOS
2187cat <<'EOSC' >>checkcc
2188case "$cc" in
2189'') ;;
2190*) $rm -f try try.*
2191 $cat >try.c <<EOM
2192int main(int argc, char *argv[]) {
2193 return 0;
2194}
2195EOM
e4778687 2196 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2197 :
2198 else
2199 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2200 despair=yes
2201 trygcc=yes
2202 case "$cc" in
2203 *gcc*) trygcc=no ;;
2204 esac
2205 case "`$cc -v -c try.c 2>&1`" in
2206 *gcc*) trygcc=no ;;
2207 esac
2208 if $test X"$trygcc" = Xyes; then
2209 if gcc -o try -c try.c; then
2210 echo " "
2211 echo "You seem to have a working gcc, though." >&4
2212 rp="Would you like to use it?"
2213 dflt=y
2214 if $test -f myread; then
2215 . ./myread
2216 else
2217 if $test -f UU/myread; then
2218 . ./UU/myread
2219 else
2220 echo "Cannot find myread, sorry. Aborting." >&2
2221 exit 1
2222 fi
2223 fi
2224 case "$ans" in
e723fc21 2225 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2573c5f9
JH
2226 esac
2227 fi
2228 fi
2229 if $test X"$despair" = Xyes; then
5dd4fbdf
MB
2230 $cat >&4 <<EOM
2231You need to find a working C compiler.
2232Either (purchase and) install the C compiler supplied by your OS vendor,
2233or for a free C compiler try http://gcc.gnu.org/
2234I cannot continue any further, aborting.
2235EOM
2573c5f9
JH
2236 exit 1
2237 fi
2238 fi
2239 $rm -f try try.*
2240 ;;
2241esac
2242EOSC
2243
a0d0e21e
LW
2244: determine whether symbolic links are supported
2245echo " "
2246$touch blurfl
2247if $ln -s blurfl sym > /dev/null 2>&1 ; then
2248 echo "Symbolic links are supported." >&4
2249 lns="$ln -s"
2250else
2251 echo "Symbolic links are NOT supported." >&4
2252 lns="$ln"
2253fi
2254$rm -f blurfl sym
2255
dafca956
JH
2256: determine whether symbolic links are supported
2257echo " "
2258case "$lns" in
2259*"ln -s")
2260 echo "Checking how to test for symbolic links..." >&4
2261 $lns blurfl sym
4b661809 2262 if $test "X$issymlink" = X; then
73614538 2263 sh -c "PATH= test -h sym" >/dev/null 2>&1
5d644a95
MB
2264 if test $? = 0; then
2265 issymlink="test -h"
2266 fi
2267 fi
2268 if $test "X$issymlink" = X; then
73614538 2269 if $test -h >/dev/null 2>&1; then
5d644a95
MB
2270 issymlink="$test -h"
2271 echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2272 fi
dafca956 2273 fi
4b661809 2274 if $test "X$issymlink" = X; then
dafca956 2275 if $test -L sym 2>/dev/null; then
5d644a95 2276 issymlink="$test -L"
dafca956
JH
2277 fi
2278 fi
4b661809 2279 if $test "X$issymlink" != X; then
5d644a95 2280 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2281 else
2282 echo "I do not know how you can test for symbolic links." >&4
2283 fi
2284 $rm -f blurfl sym
2285 ;;
2286*) echo "No symbolic links, so not testing for their testing..." >&4
2287 ;;
2288esac
2289echo " "
2290
2291
2292case "$mksymlinks" in
2293$define|true|[yY]*)
2294 case "$src" in
2295 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2296 exit 1
2297 ;;
4b661809 2298 *) case "$lns:$issymlink" in
7a800fca 2299 *"ln -s:"*"test -"?)
dafca956
JH
2300 echo "Creating the symbolic links..." >&4
2301 echo "(First creating the subdirectories...)" >&4
2302 cd ..
2303 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2304 read directory
2305 test -z "$directory" && break
2306 mkdir -p $directory
2307 done
2308 # Sanity check 1.
2309 if test ! -d t/base; then
2310 echo "Failed to create the subdirectories. Aborting." >&4
2311 exit 1
2312 fi
2313 echo "(Then creating the symlinks...)" >&4
2314 awk '{print $1}' $src/MANIFEST | while true; do
2315 read filename
2316 test -z "$filename" && break
2317 if test -f $filename; then
5d644a95 2318 if $issymlink $filename; then
dafca956
JH
2319 rm -f $filename
2320 fi
2321 fi
2322 if test -f $filename; then
2323 echo "$filename already exists, not symlinking."
2324 else
2325 ln -s $src/$filename $filename
2326 fi
2327 done
2328 # Sanity check 2.
a0d24b8a
JH
2329 if test ! -f t/base/lex.t; then
2330 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2331 exit 1
2332 fi
2333 cd UU
2334 ;;
2335 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2336 ;;
2337 esac
2338 ;;
2339 esac
2340 ;;
2341esac
2342
5440bc8e
JH
2343
2344case "$usecrosscompile" in
2345$define|true|[yY]*)
93bc48fa 2346 $echo "Cross-compiling..."
5440bc8e
JH
2347 croak=''
2348 case "$cc" in
2349 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2350 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2351 ar=$targetarch-ar
2352 # leave out ld, choosing it is more complex
2353 nm=$targetarch-nm
2354 ranlib=$targetarch-ranlib
93bc48fa 2355 $echo 'extern int foo;' > try.c
f8006fac 2356 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2357 shift
2358 if $test $# -gt 0; then
2359 incpth="$incpth $*"
f8006fac
JH
2360 incpth="`$echo $incpth|$sed 's/^ //'`"
2361 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2362 for i in $*; do
f8006fac 2363 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2364 if $test -d $j; then
2365 libpth="$libpth $j"
2366 fi
2367 done
f8006fac
JH
2368 libpth="`$echo $libpth|$sed 's/^ //'`"
2369 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2370 fi
2371 $rm -f try.c
5440bc8e
JH
2372 ;;
2373 esac
2374 case "$targetarch" in
93bc48fa
JH
2375 '') echo "Targetarch not defined." >&4; croak=y ;;
2376 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2377 esac
2378 case "$incpth" in
93bc48fa 2379 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2380 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2381 esac
2382 case "$libpth" in
93bc48fa 2383 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2384 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2385 esac
93bc48fa
JH
2386 case "$usrinc" in
2387 '') for i in $incpth; do
2388 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2389 usrinc=$i
2390 echo "Guessing usrinc $usrinc." >&4
2391 break
2392 fi
2393 done
2394 case "$usrinc" in
2395 '') echo "Usrinc not defined." >&4; croak=y ;;
2396 esac
2397 ;;
2398 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2399 esac
93bc48fa
JH
2400 case "$targethost" in
2401 '') echo "Targethost not defined." >&4; croak=y ;;
2402 *) echo "Using targethost $targethost." >&4
5440bc8e 2403 esac
93bc48fa
JH
2404 locincpth=' '
2405 loclibpth=' '
5440bc8e 2406 case "$croak" in
93bc48fa 2407 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2408 esac
2409 case "$src" in
2410 /*) run=$src/Cross/run
93c0359c 2411 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2412 to=$src/Cross/to
2413 from=$src/Cross/from
2414 ;;
93bc48fa 2415 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2416 run=$pwd/Cross/run
f8006fac 2417 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2418 to=$pwd/Cross/to
2419 from=$pwd/Cross/from
2420 ;;
2421 esac
2422 case "$targetrun" in
2423 '') targetrun=ssh ;;
2424 esac
2425 case "$targetto" in
2426 '') targetto=scp ;;
2427 esac
2428 case "$targetfrom" in
2429 '') targetfrom=scp ;;
2430 esac
2431 run=$run-$targetrun
2432 to=$to-$targetto
2433 from=$from-$targetfrom
93bc48fa
JH
2434 case "$targetdir" in
2435 '') targetdir=/tmp
2436 echo "Guessing targetdir $targetdir." >&4
2437 ;;
2438 esac
5440bc8e 2439 case "$targetuser" in
93bc48fa
JH
2440 '') targetuser=root
2441 echo "Guessing targetuser $targetuser." >&4
2442 ;;
5440bc8e
JH
2443 esac
2444 case "$targetfrom" in
2445 scp) q=-q ;;
2446 *) q='' ;;
2447 esac
2448 case "$targetrun" in
2449 ssh|rsh)
2450 cat >$run <<EOF
2451#!/bin/sh
93c0359c
JH
2452case "\$1" in
2453-cwd)
2454 shift
2455 cwd=\$1
2456 shift
2457 ;;
2458esac
2459case "\$cwd" in
2460'') cwd=$targetdir ;;
2461esac
5440bc8e
JH
2462exe=\$1
2463shift
93c0359c
JH
2464if $test ! -f \$exe.xok; then
2465 $to \$exe
2466 $touch \$exe.xok
2467fi
2468$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2469EOF
2470 ;;
93bc48fa 2471 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2472 exit 1
2473 ;;
2474 esac
93c0359c
JH
2475 case "$targetmkdir" in
2476 */Cross/mkdir)
2477 cat >$targetmkdir <<EOF
2478#!/bin/sh
2479$targetrun -l $targetuser $targethost "mkdir -p \$@"
2480EOF
f8006fac 2481 $chmod a+rx $targetmkdir
93c0359c
JH
2482 ;;
2483 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2484 exit 1
2485 ;;
2486 esac
5440bc8e
JH
2487 case "$targetto" in
2488 scp|rcp)
2489 cat >$to <<EOF
2490#!/bin/sh
2491for f in \$@
2492do
93c0359c
JH
2493 case "\$f" in
2494 /*)
2495 $targetmkdir \`dirname \$f\`
2496 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2497 ;;
2498 *)
2499 $targetmkdir $targetdir/\`dirname \$f\`
2500 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2501 ;;
2502 esac
5440bc8e
JH
2503done
2504exit 0
2505EOF
2506 ;;
2507 cp) cat >$to <<EOF
2508#!/bin/sh
93c0359c
JH
2509for f in \$@
2510do
2511 case "\$f" in
2512 /*)
2513 $mkdir -p $targetdir/\`dirname \$f\`
2514 $cp \$f $targetdir/\$f || exit 1
2515 ;;
2516 *)
2517 $targetmkdir $targetdir/\`dirname \$f\`
2518 $cp \$f $targetdir/\$f || exit 1
2519 ;;
2520 esac
2521done
2522exit 0
5440bc8e
JH
2523EOF
2524 ;;
93bc48fa 2525 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2526 exit 1
2527 ;;
2528 esac
2529 case "$targetfrom" in
2530 scp|rcp)
2531 cat >$from <<EOF
2532#!/bin/sh
2533for f in \$@
2534do
93c0359c 2535 $rm -f \$f
5440bc8e
JH
2536 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2537done
2538exit 0
2539EOF
2540 ;;
2541 cp) cat >$from <<EOF
2542#!/bin/sh
2543for f in \$@
2544do
93c0359c 2545 $rm -f \$f
5440bc8e
JH
2546 cp $targetdir/\$f . || exit 1
2547done
2548exit 0
2549EOF
2550 ;;
93bc48fa 2551 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2552 exit 1
2553 ;;
2554 esac
93bc48fa
JH
2555 if $test ! -f $run; then
2556 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2557 else
f8006fac 2558 $chmod a+rx $run
5440bc8e 2559 fi
93bc48fa
JH
2560 if $test ! -f $to; then
2561 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2562 else
f8006fac 2563 $chmod a+rx $to
5440bc8e 2564 fi
93bc48fa
JH
2565 if $test ! -f $from; then
2566 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2567 else
f8006fac 2568 $chmod a+rx $from
5440bc8e 2569 fi
93bc48fa 2570 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2571 exit 1
2572 fi
2573 cat >&4 <<EOF
f8006fac
JH
2574Using '$run' for remote execution,
2575and '$from' and '$to'
93bc48fa 2576for remote file transfer.
5440bc8e
JH
2577EOF
2578 ;;
2579*) run=''
2580 to=:
2581 from=:
2582 usecrosscompile='undef'
2583 targetarch=''
2584 ;;
2585esac
2586
ecfc5424
AD
2587: see whether [:lower:] and [:upper:] are supported character classes
2588echo " "
ecfc5424
AD
2589case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2590ABYZ)
2591 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2592 up='[:upper:]'
2593 low='[:lower:]'
2594 ;;
28e8609d
JH
2595*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2596 # (0xc9 and 0xd1), therefore that is a nice testing point.
2597 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2598 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2599 ij) up='[A-Z]'
2600 low='[a-z]'
2601 ;;
2602 esac
2603 fi
2604 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2605 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2606 ij) up='A-Z'
2607 low='a-z'
2608 ;;
2609 esac
2610 fi
2611 if test "X$up" = X -o "X$low" = X; then
2612 case "`echo IJ | od -x 2>/dev/null`" in
2613 *C9D1*|*c9d1*)
2614 echo "Hey, this might be EBCDIC." >&4
2615 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2616 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2617 ij) up='[A-IJ-RS-Z]'
2618 low='[a-ij-rs-z]'
2619 ;;
2620 esac
2621 fi
2622 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2623 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2624 ij) up='A-IJ-RS-Z'
2625 low='a-ij-rs-z'
2626 ;;
2627 esac
2628 fi
2629 ;;
2630 esac
2631 fi
2632esac
3eaeeeae 2633case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2634ij)
2635 echo "Using $up and $low to convert case." >&4
2636 ;;
ecfc5424 2637*)
28e8609d
JH
2638 echo "I don't know how to translate letters from upper to lower case." >&4
2639 echo "Your tr is not acting any way I know of." >&4
2640 exit 1
2641 ;;
ecfc5424
AD
2642esac
2643: set up the translation script tr, must be called with ./tr of course
2644cat >tr <<EOSC
2645$startsh
2646case "\$1\$2" in
2647'[A-Z][a-z]') exec $tr '$up' '$low';;
2648'[a-z][A-Z]') exec $tr '$low' '$up';;
2649esac
2650exec $tr "\$@"
2651EOSC
2652chmod +x tr
2653$eunicefix tr
2654
2304df62
AD
2655: Try to determine whether config.sh was made on this system
2656case "$config_sh" in
2657'')
43999f95
JH
2658myuname=`$uname -a 2>/dev/null`
2659$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2660# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2661# because the A-Z/a-z are not consecutive.
a0d0e21e 2662myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2663 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2664newmyuname="$myuname"
2304df62 2665dflt=n
16d20bd9
AD
2666case "$knowitall" in
2667'')
2668 if test -f ../config.sh; then
2669 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2670 eval "`grep myuname= ../config.sh`"
2671 fi
2672 if test "X$myuname" = "X$newmyuname"; then
2673 dflt=y
2674 fi
2304df62 2675 fi
16d20bd9
AD
2676 ;;
2677*) dflt=y;;
2678esac
2304df62
AD
2679
2680: Get old answers from old config file if Configure was run on the
2681: same system, otherwise use the hints.
2682hint=default
2683cd ..
2684if test -f config.sh; then
16d20bd9
AD
2685 echo " "
2686 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2687 . UU/myread
2688 case "$ans" in
f83701cd
AD
2689 n*|N*) echo "OK, I'll ignore it."
2690 mv config.sh config.sh.old
2691 myuname="$newmyuname"
2692 ;;
2304df62 2693 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2694 tmp_n="$n"
2695 tmp_c="$c"
85cad39c 2696 tmp_sh="$sh"
2304df62
AD
2697 . ./config.sh
2698 cp config.sh UU
ecfc5424
AD
2699 n="$tmp_n"
2700 c="$tmp_c"
85cad39c 2701 : Older versions did not always set $sh. Catch re-use of such
2702 : an old config.sh.
2703 case "$sh" in
2704 '') sh="$tmp_sh" ;;
2705 esac
2304df62
AD
2706 hint=previous
2707 ;;
2708 esac
2709fi
2573c5f9 2710. ./UU/checkcc
2304df62
AD
2711if test ! -f config.sh; then
2712 $cat <<EOM
2713
4e2a5f63
AD
2714First time through, eh? I have some defaults handy for some systems
2715that need some extra help getting the Configure answers right:
2304df62
AD
2716
2717EOM
dfe9444c 2718 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2719 dflt=''
2720 : Half the following guesses are probably wrong... If you have better
7f2de2d2 2721 : tests or hints, please send them to perlbug@perl.org
2304df62 2722 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2723 $test -f /irix && osname=irix
85e6fe83
LW
2724 $test -f /xenix && osname=sco_xenix
2725 $test -f /dynix && osname=dynix
2726 $test -f /dnix && osname=dnix
5f05dabc 2727 $test -f /lynx.os && osname=lynxos
2728 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2729 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2730 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2731 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2732 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2733 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2734 $test -d /usr/apollo/bin && osname=apollo
2735 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2736 $test -d /usr/include/minix && osname=minix
e060872b 2737 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2738 osname=machten
4633a7c4 2739 if $test -x /sbin/version; then
dfe9444c 2740 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2741 $sed -e 's/[A-Za-z]$//'`
2742 elif $test -x /usr/etc/version; then
dfe9444c 2743 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2744 $sed -e 's/[A-Za-z]$//'`
2745 else
2746 osvers="$2.$3"
2747 fi
2748 fi
aaacdc8b
GS
2749
2750 $test -f /sys/posix.dll &&
2751 $test -f /usr/bin/what &&
2752 set X `/usr/bin/what /sys/posix.dll` &&
2753 $test "$3" = UWIN &&
2754 osname=uwin &&
2755 osvers="$5"
2756
2304df62
AD
2757 if $test -f $uname; then
2758 set X $myuname
2759 shift
2760
2304df62 2761 case "$5" in
85e6fe83 2762 fps*) osname=fps ;;
2304df62
AD
2763 mips*)
2764 case "$4" in
85e6fe83
LW
2765 umips) osname=umips ;;
2766 *) osname=mips ;;
2304df62 2767 esac;;
85e6fe83
LW
2768 [23]100) osname=mips ;;
2769 next*) osname=next ;;
ecfc5424 2770 i386*)
c6912327
JH
2771 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2772 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2773 osname='sco'
2774 osvers=$tmp
2775 elif $test -f /etc/kconfig; then
ecfc5424 2776 osname=isc
bd628c73 2777 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2778 osvers=4
2779 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2780 osvers=3
2304df62 2781 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2782 osvers=2
ecfc5424
AD
2783 fi
2784 fi
2000072c 2785 tmp=''
ecfc5424 2786 ;;
c4f23d77
AD
2787 pc*)
2788 if test -n "$DJGPP"; then
2789 osname=dos
2790 osvers=djgpp
2791 fi
2792 ;;
2304df62
AD
2793 esac
2794
2795 case "$1" in
a0d0e21e
LW
2796 aix) osname=aix
2797 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2798 case "$tmp" in
1aef975c 2799 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2800 '<3240'|'<>3240') osvers=3.2.0 ;;
2801 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2802 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2803 *) osvers=$tmp;;
a0d0e21e
LW
2804 esac
2805 ;;
aaacdc8b
GS
2806 bsd386) osname=bsd386
2807 osvers=`$uname -r`
2808 ;;
2809 cygwin*) osname=cygwin
2810 osvers="$3"
2811 ;;
23f87696
SZ
2812 *dc.osx) osname=dcosx
2813 osvers="$3"
2814 ;;
a0d0e21e
LW
2815 dnix) osname=dnix
2816 osvers="$3"
2817 ;;
2818 domainos) osname=apollo
2819 osvers="$3"
2820 ;;
2821 dgux) osname=dgux
2822 osvers="$3"
2823 ;;
760ac839 2824 dynixptx*) osname=dynixptx
e58e581d 2825 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2826 ;;
a0d0e21e
LW
2827 freebsd) osname=freebsd
2828 osvers="$3" ;;
2829 genix) osname=genix ;;
2830 hp*) osname=hpux
bfb7748a 2831 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2832 ;;
a78b0d02 2833 irix*) osname=irix
a0d0e21e
LW
2834 case "$3" in
2835 4*) osvers=4 ;;
2836 5*) osvers=5 ;;
ecfc5424 2837 *) osvers="$3" ;;
a0d0e21e
LW
2838 esac
2839 ;;
2840 linux) osname=linux
2841 case "$3" in
a0d0e21e
LW
2842 *) osvers="$3" ;;
2843 esac
2844 ;;
28e8609d
JH
2845 MiNT) osname=mint
2846 ;;
2847 netbsd*) osname=netbsd
ecfc5424
AD
2848 osvers="$3"
2849 ;;
4e81affe
MM
2850 news-os) osvers="$3"
2851 case "$3" in
2852 4*) osname=newsos4 ;;
2853 *) osname=newsos ;;
2854 esac
2855 ;;
aaacdc8b 2856 next*) osname=next ;;
28bb1e2c 2857 nonstop-ux) osname=nonstopux ;;
aaacdc8b
GS
2858 POSIX-BC | posix-bc ) osname=posix-bc
2859 osvers="$3"
a0d0e21e 2860 ;;
ae3afa4e
TH
2861 powerux | power_ux | powermax_os | powermaxos | \
2862 powerunix | power_unix) osname=powerux
2863 osvers="$3"
2864 ;;
aaacdc8b
GS
2865 qnx) osname=qnx
2866 osvers="$4"
2867 ;;
a0d0e21e
LW
2868 solaris) osname=solaris
2869 case "$3" in
2870 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2871 *) osvers="$3" ;;
a0d0e21e
LW
2872 esac
2873 ;;
85e6fe83
LW
2874 sunos) osname=sunos
2875 case "$3" in
85e6fe83
LW
2876 5*) osname=solaris
2877 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2878 *) osvers="$3" ;;
2304df62
AD
2879 esac
2880 ;;
a0d0e21e 2881 titanos) osname=titanos
85e6fe83 2882 case "$3" in
a0d0e21e
LW
2883 1*) osvers=1 ;;
2884 2*) osvers=2 ;;
2885 3*) osvers=3 ;;
2886 4*) osvers=4 ;;
ecfc5424 2887 *) osvers="$3" ;;
2304df62
AD
2888 esac
2889 ;;
85e6fe83 2890 ultrix) osname=ultrix
ecfc5424 2891 osvers="$3"
2304df62 2892 ;;
28757baa 2893 osf1|mls+) case "$5" in
fed7345c
AD
2894 alpha)
2895 osname=dec_osf
2aa76180
JH
2896 osvers=`sizer -v | awk '{print $3}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2897 case "$osvers" in
2898 [1-9].[0-9]*) ;;
2899 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2900 esac
ecfc5424
AD
2901 ;;
2902 hp*) osname=hp_osf1 ;;
2903 mips) osname=mips_osf1 ;;
85e6fe83
LW
2904 esac
2905 ;;
0337d152
BG
2906 unixware) osname=svr5
2907 osvers="$4"
2908 ;;
2909 uts) osname=uts
a0d0e21e
LW
2910 osvers="$3"
2911 ;;
85e6fe83 2912 $2) case "$osname" in
2304df62 2913 *isc*) ;;
a0d0e21e 2914 *freebsd*) ;;
5f05dabc 2915 svr*)
a0d0e21e
LW
2916 : svr4.x or possibly later
2917 case "svr$3" in
2918 ${osname}*)
2919 osname=svr$3
2920 osvers=$4
2921 ;;
2922 esac
2923 case "$osname" in
2924 svr4.0)
2925 : Check for ESIX
2926 if test -f /stand/boot ; then
2927 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2928 if test -n "$INITPROG" -a -f "$INITPROG"; then
2929 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2930 if test -n "$isesix"; then
a0d0e21e
LW
2931 osname=esix4
2932 fi
2933 fi
2934 fi
2935 ;;
2936 esac
2937 ;;
2304df62 2938 *) if test -f /etc/systemid; then
a0d0e21e
LW
2939 osname=sco
2940 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2941 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2942 osvers=$1.$2.$3
c4f23d77 2943 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2944 osvers=$1.$2
c4f23d77 2945 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2946 osvers=$1
2304df62 2947 fi
a0d0e21e
LW
2948 else
2949 case "$osname" in
2950 '') : Still unknown. Probably a generic Sys V.
2951 osname="sysv"
2952 osvers="$3"
2953 ;;
2954 esac
2304df62
AD
2955 fi
2956 ;;
2957 esac
2958 ;;
a0d0e21e
LW
2959 *) case "$osname" in
2960 '') : Still unknown. Probably a generic BSD.
2961 osname="$1"
2962 osvers="$3"
2963 ;;
2964 esac
2965 ;;
2304df62
AD
2966 esac
2967 else
dfe9444c
AD
2968 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2969 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2970 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2971 osname=news_os
2304df62 2972 fi
dfe9444c 2973 $rm -f UU/kernel.what
8e07c86e
AD
2974 elif test -d c:/.; then
2975 set X $myuname
2976 osname=os2
2977 osvers="$5"
2304df62
AD
2978 fi
2979 fi
85e6fe83 2980
5440bc8e
JH
2981 case "$targetarch" in
2982 '') ;;
2983 *) hostarch=$osname
2984 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
2985 osvers=''
2986 ;;
2987 esac
2988
a0d0e21e
LW
2989 : Now look for a hint file osname_osvers, unless one has been
2990 : specified already.
2991 case "$hintfile" in
2992 ''|' ')
1e127011 2993 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 2994 : Also try without trailing minor version numbers.
1e127011
DD
2995 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2996 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2997 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2998 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
2999 case "$file" in
3000 '') dflt=none ;;
3001 *) case "$osvers" in
3002 '') dflt=$file
3003 ;;
dfe9444c 3004 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3005 dflt=$file
dfe9444c 3006 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3007 dflt=$xfile
dfe9444c 3008 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3009 dflt=$xxfile
dfe9444c 3010 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3011 dflt=$xxxfile
dfe9444c 3012 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3013 dflt=$xxxxfile
dfe9444c 3014 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3015 dflt="${osname}"
3016 else
3017 dflt=none
3018 fi
3019 ;;
3020 esac
85e6fe83
LW
3021 ;;
3022 esac
4e2a5f63
AD
3023 if $test -f Policy.sh ; then
3024 case "$dflt" in
3025 *Policy*) ;;
3026 none) dflt="Policy" ;;
3027 *) dflt="Policy $dflt" ;;
3028 esac
3029 fi
85e6fe83 3030 ;;
a0d0e21e 3031 *)
ecfc5424 3032 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3033 ;;
2304df62 3034 esac
1aef975c 3035
4e2a5f63
AD
3036 if $test -f Policy.sh ; then
3037 $cat <<EOM
3038
3039There's also a Policy hint file available, which should make the
3040site-specific (policy) questions easier to answer.
3041EOM
3042
3043 fi
3044
2304df62
AD
3045 $cat <<EOM
3046
3047You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 3048A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 3049is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
3050
3051EOM
4e2a5f63 3052
2304df62 3053 rp="Which of these apply, if any?"
dfe9444c 3054 . UU/myread
85e6fe83
LW
3055 tans=$ans
3056 for file in $tans; do
4e2a5f63
AD
3057 if $test X$file = XPolicy -a -f Policy.sh; then
3058 . Policy.sh
3059 $cat Policy.sh >> UU/config.sh
3060 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3061 . $src/hints/$file.sh
3062 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3063 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3064 : nothing
3065 else
85e6fe83
LW
3066 : Give one chance to correct a possible typo.
3067 echo "$file.sh does not exist"
3068 dflt=$file
3069 rp="hint to use instead?"
dfe9444c 3070 . UU/myread
85e6fe83 3071 for file in $ans; do
dfe9444c
AD
3072 if $test -f "$src/hints/$file.sh"; then
3073 . $src/hints/$file.sh
3074 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3075 elif $test X$ans = X -o X$ans = Xnone ; then
3076 : nothing
3077 else
3078 echo "$file.sh does not exist -- ignored."
3079 fi
3080 done
2304df62
AD
3081 fi
3082 done
85e6fe83 3083
2304df62 3084 hint=recommended
85e6fe83 3085 : Remember our hint file for later.
dfe9444c 3086 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3087 hintfile="$file"
85e6fe83 3088 else
a0d0e21e 3089 hintfile=''
85e6fe83 3090 fi
2304df62
AD
3091fi
3092cd UU
3093;;
3094*)
3095 echo " "
3096 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3097 tmp_n="$n"
3098 tmp_c="$c"
2304df62
AD
3099 cd ..
3100 cp $config_sh config.sh 2>/dev/null
a78b0d02 3101 chmod +w config.sh
2304df62
AD
3102 . ./config.sh
3103 cd UU
3104 cp ../config.sh .
ecfc5424
AD
3105 n="$tmp_n"
3106 c="$tmp_c"
2304df62
AD
3107 hint=previous
3108 ;;
3109esac
1aef975c 3110test "$override" && . ./optdef.sh
2304df62
AD
3111
3112: Restore computed paths
3113for file in $loclist $trylist; do
3114 eval $file="\$_$file"
3115done
3116
85e6fe83 3117cat << EOM
a0d0e21e 3118
85e6fe83 3119Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3120The default value is probably right if the name rings a bell. Otherwise,
3121since spelling matters for me, either accept the default or answer "none"
3122to leave it blank.
a0d0e21e 3123
85e6fe83 3124EOM
85e6fe83 3125case "$osname" in
a0d0e21e 3126 ''|' ')
85e6fe83 3127 case "$hintfile" in
a0d0e21e 3128 ''|' '|none) dflt=none ;;
ecfc5424 3129 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3130 esac
3131 ;;
3132 *) dflt="$osname" ;;
3133esac
3134rp="Operating system name?"
3135. ./myread
3136case "$ans" in
ecfc5424
AD
3137none) osname='' ;;
3138*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3139esac
8ff267be 3140echo " "
3141case "$osvers" in
3142 ''|' ')
3143 case "$hintfile" in
3144 ''|' '|none) dflt=none ;;
3145 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3146 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3147 case "$dflt" in
3148 ''|' ') dflt=none ;;
3149 esac
3150 ;;
3151 esac
3152 ;;
3153 *) dflt="$osvers" ;;
3154esac
3155rp="Operating system version?"
3156. ./myread
3157case "$ans" in
3158none) osvers='' ;;
3159*) osvers="$ans" ;;
3160esac
3161
02e93a22
JH
3162
3163. ./posthint.sh
3164
2304df62 3165: who configured the system
59b83a6f 3166cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 3167cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
3168case "$cf_by" in
3169"")
8ff267be 3170 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
3171 case "$cf_by" in
3172 "") cf_by=unknown ;;
8ff267be 3173 esac ;;
3174esac
2304df62 3175
b4eb6b3d
JH
3176: set up the script used to warn in case of inconsistency
3177cat <<EOS >whoa
3178$startsh
3179EOS
3180cat <<'EOSC' >>whoa
3181dflt=y
3182echo " "
3183echo "*** WHOA THERE!!! ***" >&4
3184echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3185rp=" Keep the $hint value?"
3186. ./myread
3187case "$ans" in
3188y) td=$was; tu=$was;;
3189esac
3190EOSC
3191
3192: function used to set $1 to $val
3193setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3194case "$val$was" in
3195$define$undef) . ./whoa; eval "$var=\$td";;
3196$undef$define) . ./whoa; eval "$var=\$tu";;
3197*) eval "$var=$val";;
3198esac'
3199
3200case "$usethreads" in
3201$define|true|[yY]*) dflt='y';;
3202*) dflt='n';;
3203esac
3204cat <<EOM
3205
3206Perl can be built to take advantage of threads on some systems.
3207To do so, Configure can be run with -Dusethreads.
3208
3209Note that threading is a highly experimental feature, and
3210some known race conditions still remain. If you choose to try
3211it, be very sure to not actually deploy it for production
3212purposes. README.threads has more details, and is required
3213reading if you enable threads.
3214
3215If this doesn't make any sense to you, just accept the default '$dflt'.
3216EOM
3217rp='Build a threading Perl?'
3218. ./myread
3219case "$ans" in
3220y|Y) val="$define" ;;
3221*) val="$undef" ;;
3222esac
3223set usethreads
3224eval $setvar
3225
3226case "$usethreads" in
3227$define)
3228 $cat <<EOM
3229
3230As of 5.5.640, Perl has two different internal threading implementations,
3231the 5.005 version (5005threads) and an interpreter-based version
3232(ithreads) that has one interpreter per thread. Both are very
3233experimental. This arrangement exists to help developers work out
3234which one is better.
3235
3236If you're a casual user, you probably don't want interpreter-threads
3237at this time. There doesn't yet exist a way to create threads from
3238within Perl in this model, i.e., "use Thread;" will NOT work.
3239EOM
3240 : Default to ithreads unless overridden on command line or with
3241 : old config.sh
3242 dflt='y'
3243 case "$use5005threads" in
3244 $define|true|[yY]*) dflt='n';;
3245 esac
3246 case "$useithreads" in
3247 $undef|false|[nN]*) dflt='n';;
3248 esac
3249 rp='Use interpreter-based ithreads?'
3250 . ./myread
3251 case "$ans" in
3252 y|Y) val="$define" ;;
3253 *) val="$undef" ;;
3254 esac
3255 set useithreads
3256 eval $setvar
3257 : Now set use5005threads to the opposite value.
3258 case "$useithreads" in
3259 $define) val="$undef" ;;
3260 *) val="$define" ;;
3261 esac
3262 set use5005threads
3263 eval $setvar
3264 ;;
3265*)
3266 useithreads="$undef"
3267 use5005threads="$undef"
3268 ;;
3269esac
3270
c915ce7f
JH
3271case "$useithreads$use5005threads" in
3272"$define$define")
3273 $cat >&4 <<EOM
3274
3275You cannot have both the ithreads and the 5.005 threads enabled
3276at the same time. Disabling the 5.005 threads since they are
3277much less stable than the ithreads.
3278
3279EOM
3280 use5005threads="$undef"
3281 ;;
3282esac
3283
b4eb6b3d
JH
3284case "$d_oldpthreads" in
3285'') : Configure tests would be welcome here. For now, assume undef.
3286 val="$undef" ;;
3287*) val="$d_oldpthreads" ;;
3288esac
3289set d_oldpthreads
3290eval $setvar
3291
3292
3293case "$usethreads" in
3294"$define"|true|[yY]*)
3295: Look for a hint-file generated 'call-back-unit'. If the
3296: user has specified that a threading perl is to be built,
3297: we may need to set or change some other defaults.
3298 if $test -f usethreads.cbu; then
3299 echo "Your platform has some specific hints for threaded builds, using them..."
3300 . ./usethreads.cbu
3301 else
3302 $cat <<EOM
3303(Your platform doesn't have any specific hints for threaded builds.
3304 Assuming POSIX threads, then.)
3305EOM
3306 fi
3307 ;;
3308esac
3309
3310cat <<EOM
3311
3312Perl can be built so that multiple Perl interpreters can coexist
3313within the same Perl executable.
3314EOM
3315
3316case "$useithreads" in
3317$define)
3318 cat <<EOM
3319This multiple interpreter support is required for interpreter-based threads.
3320EOM
3321 val="$define"
3322 ;;
3323*) case "$usemultiplicity" in
3324 $define|true|[yY]*) dflt='y';;
3325 *) dflt='n';;
3326 esac
3327 echo " "
3328 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3329 rp='Build Perl for multiplicity?'
3330 . ./myread
3331 case "$ans" in
3332 y|Y) val="$define" ;;
3333 *) val="$undef" ;;
3334 esac
3335 ;;
3336esac
3337set usemultiplicity
3338eval $setvar
3339
96056487
JH
3340
3341case "$usemorebits" in
3342"$define"|true|[yY]*)
3343 use64bitint="$define"
3344 uselongdouble="$define"
3345 usemorebits="$define"
3346 ;;
3347*) usemorebits="$undef"
3348 ;;
3349esac
3350
e5e20432
JH
3351: make some quick guesses about what we are up against
3352echo " "
3353$echo $n "Hmm... $c"
3354echo exit 1 >bsd
3355echo exit 1 >usg
3356echo exit 1 >v7
3357echo exit 1 >osf1
3358echo exit 1 >eunice
3359echo exit 1 >xenix
3360echo exit 1 >venix
3361echo exit 1 >os2
3362d_bsd="$undef"
3363$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3364if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3365then
3366 echo "Looks kind of like an OSF/1 system, but we'll see..."
3367 echo exit 0 >osf1
381aa1ff 3368elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3369 xxx=`./loc addbib blurfl $pth`
3370 if $test -f $xxx; then
3371 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3372 echo exit 0 >bsd
3373 echo exit 0 >usg
3374 else
3375 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3376 echo "Looks kind of like an extended USG system, but we'll see..."
3377 else
3378 echo "Looks kind of like a USG system, but we'll see..."
3379 fi
3380 echo exit 0 >usg
3381 fi
3382elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3383 echo "Looks kind of like a BSD system, but we'll see..."
3384 d_bsd="$define"
3385 echo exit 0 >bsd
3386else
3387 echo "Looks kind of like a Version 7 system, but we'll see..."
3388 echo exit 0 >v7
3389fi
3390case "$eunicefix" in
3391*unixtovms*)
3392 $cat <<'EOI'
3393There is, however, a strange, musty smell in the air that reminds me of
3394something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3395EOI
3396 echo exit 0 >eunice
3397 d_eunice="$define"
3398: it so happens the Eunice I know will not run shell scripts in Unix format
3399 ;;
3400*)
3401 echo " "
3402 echo "Congratulations. You aren't running Eunice."
3403 d_eunice="$undef"
3404 ;;
3405esac
3406: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3407: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3408: semicolon as a patch separator
e5e20432
JH
3409case "$p_" in
3410:) ;;
3411*)
3412 $cat <<'EOI'
3413I have the feeling something is not exactly right, however...don't tell me...
3414lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3415(Or you may be running DOS with DJGPP.)
e5e20432
JH
3416EOI
3417 echo exit 0 >os2
3418 ;;
3419esac
3420if test -f /xenix; then
3421 echo "Actually, this looks more like a XENIX system..."
3422 echo exit 0 >xenix
3423 d_xenix="$define"
3424else
3425 echo " "
3426 echo "It's not Xenix..."
3427 d_xenix="$undef"
3428fi
3429chmod +x xenix
3430$eunicefix xenix
3431if test -f /venix; then
3432 echo "Actually, this looks more like a VENIX system..."
3433 echo exit 0 >venix
3434else
3435 echo " "
3436 if ./xenix; then
3437 : null
3438 else
3439 echo "Nor is it Venix..."
3440 fi
3441fi
3442chmod +x bsd usg v7 osf1 eunice xenix venix os2
3443$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3444$rm -f foo
3445
5869b1f1
JH
3446case "$cc" in
3447'') dflt=cc;;
3448*) dflt="$cc";;
3449esac
3450rp="Use which C compiler?"
3451. ./myread
3452cc="$ans"
e5e20432
JH
3453: Look for a hint-file generated 'call-back-unit'. Now that the
3454: user has specified the compiler, we may need to set or change some
3455: other defaults.
3456if $test -f cc.cbu; then
3457 . ./cc.cbu
3458fi
2573c5f9 3459. ./checkcc
8a27cf78 3460
e5e20432
JH
3461echo " "
3462echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 3463$cat >try.c <<EOM
e5e20432
JH
3464#include <stdio.h>
3465int main() {
3466#ifdef __GNUC__
3467#ifdef __VERSION__
3468 printf("%s\n", __VERSION__);
3469#else
3470 printf("%s\n", "1");
3471#endif
3472#endif
3473 exit(0);
3474}
3475EOM
5440bc8e
JH
3476if $cc -o try $ccflags $ldflags try.c; then
3477 gccversion=`$run ./try`
e5e20432
JH
3478 case "$gccversion" in
3479 '') echo "You are not using GNU cc." ;;
fc68435e 3480 *) echo "You are using GNU cc $gccversion."
e723fc21 3481 ccname=gcc
fc68435e 3482 ;;
e5e20432
JH
3483 esac
3484else
3485 echo " "
3486 echo "*** WHOA THERE!!! ***" >&4
3487 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3488 case "$knowitall" in
3489 '')
3490 echo " You'd better start hunting for one and let me know about it." >&4
3491 exit 1
3492 ;;
3493 esac
3494fi
5440bc8e 3495$rm -f try try.*
e5e20432
JH
3496case "$gccversion" in
34971*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3498esac
5b463ca7
KS
3499case "$gccversion" in
3500'') gccosandvers='' ;;
10b4ebb5
JH
3501*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3502 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3503 gccshortvers=''
5b463ca7 3504 case "$gccosandvers" in
02903077
JH
3505 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3506 $osname$osvers) ;; # looking good
5b463ca7
KS
3507 $osname*) cat <<EOM >&4
3508
3509*** WHOA THERE!!! ***
3510
3511 Your gcc has not been compiled for the exact release of
3512 your operating system ($gccosandvers versus $osname$osvers).
3513
3514 In general it is a good idea to keep gcc synchronized with
3515 the operating system because otherwise serious problems
3516 may ensue when trying to compile software, like Perl.
3517
3518 I'm trying to be optimistic here, though, and will continue.
3519 If later during the configuration and build icky compilation
02903077
JH
3520 problems appear (headerfile conflicts being the most common
3521 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3522 your operating system release.
3523
3524EOM
3525 ;;
81575342 3526 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3527 esac
3528 ;;
3529esac
e723fc21
JH
3530case "$ccname" in
3531'') ccname="$cc" ;;
3532esac
e5e20432 3533
640374d0 3534
bd9b35c9
JH
3535: decide how portable to be. Allow command line overrides.
3536case "$d_portable" in
3537"$undef") ;;
3538*) d_portable="$define" ;;
104d25b7 3539esac
85ab1d1d 3540
bd9b35c9
JH
3541: set up shell script to do ~ expansion
3542cat >filexp <<EOSS
3543$startsh
3544: expand filename
3545case "\$1" in
3546 ~/*|~)
3547 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3548 ;;
3549 ~*)
3550 if $test -f /bin/csh; then
3551 /bin/csh -f -c "glob \$1"
3552 failed=\$?
3553 echo ""
3554 exit \$failed
e5e20432 3555 else
bd9b35c9
JH
3556 name=\`$expr x\$1 : '..\([^/]*\)'\`
3557 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3558 if $test ! -d "\$dir"; then
3559 me=\`basename \$0\`
3560 echo "\$me: can't locate home directory for: \$name" >&2
3561 exit 1
3562 fi
3563 case "\$1" in
3564 */*)
3565 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3566 ;;
3567 *)
3568 echo \$dir
e5e20432
JH
3569 ;;
3570 esac
3571 fi
b691c02f 3572 ;;
4633a7c4 3573*)
bd9b35c9 3574 echo \$1
2304df62
AD
3575 ;;
3576esac
4633a7c4
LW
3577EOSS
3578chmod +x filexp
3579$eunicefix filexp
2304df62
AD
3580
3581: now set up to get a file name
28757baa 3582cat <<EOS >getfile
3583$startsh
3584EOS
3585cat <<'EOSC' >>getfile
2304df62
AD
3586tilde=''
3587fullpath=''
3588already=''
3589skip=''
3590none_ok=''
3591exp_file=''
a0d0e21e 3592nopath_ok=''
2304df62
AD
3593orig_rp="$rp"
3594orig_dflt="$dflt"
b233458b
JH
3595case "$gfpth" in
3596'') gfpth='.' ;;
3597esac
2304df62
AD
3598
3599case "$fn" in
ecfc5424 3600*\(*)
381aa1ff 3601 expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
3602 fn=`echo $fn | sed 's/(.*)//'`
3603 ;;
3604esac
3605
3606case "$fn" in
a0d0e21e
LW
3607*:*)
3608 loc_file=`expr $fn : '.*:\(.*\)'`
3609 fn=`expr $fn : '\(.*\):.*'`
3610 ;;
3611esac
3612
3613case "$fn" in
2304df62
AD
3614*~*) tilde=true;;
3615esac
3616case "$fn" in
3617*/*) fullpath=true;;
3618esac
3619case "$fn" in
3620*+*) skip=true;;
3621esac
3622case "$fn" in
3623*n*) none_ok=true;;
3624esac
3625case "$fn" in
3626*e*) exp_file=true;;
3627esac
a0d0e21e
LW
3628case "$fn" in
3629*p*) nopath_ok=true;;
3630esac
2304df62
AD
3631
3632case "$fn" in
3633*f*) type='File';;
3634*d*) type='Directory';;
a0d0e21e 3635*l*) type='Locate';;
2304df62
AD
3636esac
3637
3638what="$type"
3639case "$what" in
3640Locate) what='File';;
3641esac
3642
3643case "$exp_file" in
3644'')
3645 case "$d_portable" in
3646 "$define") ;;
3647 *) exp_file=true;;
3648 esac
3649 ;;
3650esac
3651
3652cd ..
3653while test "$type"; do
3654 redo=''
3655 rp="$orig_rp"
3656 dflt="$orig_dflt"
3657 case "$tilde" in
3658 true) rp="$rp (~name ok)";;
3659 esac
3660 . UU/myread
ecfc5424
AD
3661 if test -f UU/getfile.ok && \
3662 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3663 then
3664 value="$ans"
3665 ansexp="$ans"
3666 break
3667 fi
2304df62
AD
3668 case "$ans" in
3669 none)
3670 value=''
3671 ansexp=''
3672 case "$none_ok" in
3673 true) type='';;
3674 esac
3675 ;;
3676 *)
3677 case "$tilde" in
3678 '') value="$ans"
3679 ansexp="$ans";;
3680 *)
3681 value=`UU/filexp $ans`
3682 case $? in
3683 0)
3684 if test "$ans" != "$value"; then
ecfc5424 3685 echo "(That expands to $value on this system.)"
2304df62
AD
3686 fi
3687 ;;
3688 *) value="$ans";;
3689 esac
3690 ansexp="$value"
3691 case "$exp_file" in
3692 '') value="$ans";;
3693 esac
3694 ;;
3695 esac
3696 case "$fullpath" in
3697 true)
3698 case "$ansexp" in
3699 /*) value="$ansexp" ;;
23da6c43 3700 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
3701 *)
3702 redo=true
3703 case "$already" in
3704 true)
3705 echo "I shall only accept a full path name, as in /bin/ls." >&4
3706 echo "Use a ! shell escape if you wish to check pathnames." >&4
3707 ;;
3708 *)
3709 echo "Please give a full path name, starting with slash." >&4
3710 case "$tilde" in
3711 true)
3712 echo "Note that using ~name is ok provided it expands well." >&4
3713 already=true
3714 ;;
3715 esac
3716 esac
3717 ;;
3718 esac
3719 ;;
3720 esac
3721 case "$redo" in
3722 '')
3723 case "$type" in
3724 File)
b233458b
JH
3725 for fp in $gfpth; do
3726 if test "X$fp" = X.; then
3727 pf="$ansexp"
3728 else
3729 pf="$fp/$ansexp"
3730 fi
3731 if test -f "$pf"; then
3732 type=''
3733 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3734 then
3735 echo "($value is not a plain file, but that's ok.)"
3736 type=''
3737 fi
3738 if test X"$type" = X; then
3739 value="$pf"
3740 break
3741 fi
3742 done
2304df62
AD
3743 ;;
3744 Directory)
b233458b
JH
3745 for fp in $gfpth; do
3746 if test "X$fp" = X.; then
f78bfc9c
JH
3747 dir="$ans"
3748 direxp="$ansexp"
b233458b 3749 else
dd858076 3750 dir="$fp/$ansexp"
f78bfc9c 3751 direxp="$fp/$ansexp"
b233458b 3752 fi
f78bfc9c 3753 if test -d "$direxp"; then
b233458b 3754 type=''
f78bfc9c 3755 value="$dir"
b233458b
JH
3756 break
3757 fi
3758 done
2304df62
AD
3759 ;;
3760 Locate)
40000a8c 3761 if test -d "$ansexp"; then
a0d0e21e
LW
3762 echo "(Looking for $loc_file in directory $value.)"
3763 value="$value/$loc_file"
40000a8c 3764 ansexp="$ansexp/$loc_file"
2304df62 3765 fi
40000a8c 3766 if test -f "$ansexp"; then
2304df62
AD
3767 type=''
3768 fi
a0d0e21e
LW
3769 case "$nopath_ok" in
3770 true) case "$value" in
3771 */*) ;;
3772 *) echo "Assuming $value will be in people's path."
3773 type=''
3774 ;;
3775 esac
3776 ;;
3777 esac
2304df62
AD
3778 ;;
3779 esac
3780
3781 case "$skip" in
3782 true) type='';
3783 esac
3784
3785 case "$type" in
3786 '') ;;
3787 *)
3788 if test "$fastread" = yes; then
3789 dflt=y
3790 else
3791 dflt=n
3792 fi
3793 rp="$what $value doesn't exist. Use that name anyway?"
3794 . UU/myread
3795 dflt=''
3796 case "$ans" in
3797 y*) type='';;
3798 *) echo " ";;
3799 esac
3800 ;;
3801 esac
3802 ;;
3803 esac
3804 ;;
3805 esac
3806done
3807cd UU
3808ans="$value"
3809rp="$orig_rp"
3810dflt="$orig_dflt"
ecfc5424 3811rm -f getfile.ok
b233458b 3812test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3813EOSC
3814
bd9b35c9
JH
3815: What should the include directory be ?
3816echo " "
3817$echo $n "Hmm... $c"
3818dflt='/usr/include'
3819incpath=''
3820mips_type=''
3821if $test -f /bin/mips && /bin/mips; then
3822 echo "Looks like a MIPS system..."
3823 $cat >usr.c <<'EOCP'
3824#ifdef SYSTYPE_BSD43
3825/bsd43
3826#endif
3827EOCP
8a27cf78 3828 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
3829 dflt='/bsd43/usr/include'
3830 incpath='/bsd43'
3831 mips_type='BSD 4.3'
3832 else
3833 mips_type='System V'
3834 fi
3835 $rm -f usr.c usr.out
3836 echo "and you're compiling with the $mips_type compiler and libraries."
3837 xxx_prompt=y
3838 echo "exit 0" >mips
3839else
3840 echo "Doesn't look like a MIPS system."
3841 xxx_prompt=n
3842 echo "exit 1" >mips
3843fi
3844chmod +x mips
3845$eunicefix mips
3846case "$usrinc" in
3847'') ;;
3848*) dflt="$usrinc";;
3849esac
3850case "$xxx_prompt" in
3851y) fn=d/
3852 echo " "
3853 rp='Where are the include files you want to use?'
3854 . ./getfile
3855 usrinc="$ans"
8e07c86e 3856 ;;
bd9b35c9 3857*) usrinc="$dflt"
8e07c86e
AD
3858 ;;
3859esac
2304df62 3860
96056487
JH
3861: see how we invoke the C preprocessor
3862echo " "
3863echo "Now, how can we feed standard input to your C preprocessor..." >&4
3864cat <<'EOT' >testcpp.c
3865#define ABC abc
3866#define XYZ xyz
3867ABC.XYZ
3868EOT
3869cd ..
3870if test ! -f cppstdin; then
3871 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3872 # AIX cc -E doesn't show the absolute headerfile
3873 # locations but we'll cheat by using the -M flag.
3874 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
3875 else
3876 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3877 fi
3878else
3879 echo "Keeping your $hint cppstdin wrapper."
3880fi
3881chmod 755 cppstdin
3882wrapper=`pwd`/cppstdin
3883ok='false'
3884cd UU
3885
3886if $test "X$cppstdin" != "X" && \
3887 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3888 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3889then
3890 echo "You used to use $cppstdin $cppminus so we'll use that again."
3891 case "$cpprun" in
3892 '') echo "But let's see if we can live without a wrapper..." ;;
3893 *)
3894 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3895 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3896 then
3897 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3898 ok='true'
3899 else
3900 echo "(However, $cpprun $cpplast does not work, let's see...)"
3901 fi
3902 ;;
3903 esac
3904else
3905 case "$cppstdin" in
3906 '') ;;
3907 *)
3908 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3909 ;;
3910 esac
3911fi
3912
3913if $ok; then
3914 : nothing
3915elif echo 'Maybe "'"$cc"' -E" will work...'; \
3916 $cc -E <testcpp.c >testcpp.out 2>&1; \
3917 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3918 echo "Yup, it does."
3919 x_cpp="$cc -E"
3920 x_minus='';
3921elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3922 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3923 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3924 echo "Yup, it does."
3925 x_cpp="$cc -E"
3926 x_minus='-';
3927elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3928 $cc -P <testcpp.c >testcpp.out 2>&1; \
3929 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3930 echo "Yipee, that works!"
3931 x_cpp="$cc -P"
3932 x_minus='';
3933elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3934 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3935 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3936 echo "At long last!"
3937 x_cpp="$cc -P"
3938 x_minus='-';
3939elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3940 $cpp <testcpp.c >testcpp.out 2>&1; \
3941 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3942 echo "It works!"
3943 x_cpp="$cpp"
3944 x_minus='';
3945elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3946 $cpp - <testcpp.c >testcpp.out 2>&1; \
3947 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3948 echo "Hooray, it works! I was beginning to wonder."
3949 x_cpp="$cpp"
3950 x_minus='-';
3951elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3952 $wrapper <testcpp.c >testcpp.out 2>&1; \
3953 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3954 x_cpp="$wrapper"
3955 x_minus=''
3956 echo "Eureka!"
3957else
3958 dflt=''
3959 rp="No dice. I can't find a C preprocessor. Name one:"
3960 . ./myread
3961 x_cpp="$ans"
3962 x_minus=''
3963 $x_cpp <testcpp.c >testcpp.out 2>&1
3964 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3965 echo "OK, that will do." >&4
3966 else
3967echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3968 exit 1
3969 fi
3970fi
3971
3972case "$ok" in
3973false)
3974 cppstdin="$x_cpp"
3975 cppminus="$x_minus"
3976 cpprun="$x_cpp"
3977 cpplast="$x_minus"
3978 set X $x_cpp
3979 shift
3980 case "$1" in
3981 "$cpp")
3982 echo "Perhaps can we force $cc -E using a wrapper..."
3983 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3984 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3985 then
3986 echo "Yup, we can."
3987 cppstdin="$wrapper"
3988 cppminus='';
3989 else
3990 echo "Nope, we'll have to live without it..."
3991 fi
3992 ;;
3993 esac
3994 case "$cpprun" in
3995 "$wrapper")
3996 cpprun=''
3997 cpplast=''
3998 ;;
3999 esac
4000 ;;
4001esac
4002
4003case "$cppstdin" in
4004"$wrapper"|'cppstdin') ;;
4005*) $rm -f $wrapper;;
4006esac
4007$rm -f testcpp.c testcpp.out
4008
bd9b35c9
JH
4009: Set private lib path
4010case "$plibpth" in
4011'') if ./mips; then
4012 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4013 fi;;
4014esac
4015case "$libpth" in
4016' ') dlist='';;
4017'') dlist="$loclibpth $plibpth $glibpth";;
4018*) dlist="$libpth";;
4019esac
4020
4021: Now check and see which directories actually exist, avoiding duplicates
4022libpth=''
4023for xxx in $dlist
4024do
4025 if $test -d $xxx; then
4026 case " $libpth " in
4027 *" $xxx "*) ;;
4028 *) libpth="$libpth $xxx";;
4029 esac
4030 fi
4031done
4032$cat <<'EOM'
4033
4034Some systems have incompatible or broken versions of libraries. Among
4035the directories listed in the question below, please remove any you
4036know not to be holding relevant libraries, and add any that are needed.
4037Say "none" for none.
8e07c86e
AD
4038
4039EOM
bd9b35c9
JH
4040case "$libpth" in
4041'') dflt='none';;
8e07c86e 4042*)
bd9b35c9
JH
4043 set X $libpth
4044 shift
4045 dflt=${1+"$@"}
8e07c86e 4046 ;;
a0d0e21e 4047esac
bd9b35c9
JH
4048rp="Directories to use for library searches?"
4049. ./myread
4050case "$ans" in
4051none) libpth=' ';;
4052*) libpth="$ans";;
4053esac
a0d0e21e 4054
bd9b35c9
JH
4055: compute shared library extension
4056case "$so" in
4057'')
4058 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4059 dflt='sl'
dd4e71fd 4060 else
bd9b35c9 4061 dflt='so'
dd4e71fd
JH
4062 fi
4063 ;;
bd9b35c9 4064*) dflt="$so";;
dd4e71fd 4065esac
dd4e71fd
JH
4066$cat <<EOM
4067
bd9b35c9 4068On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4069you want to suppress searching of shared libraries for the remainder
bd9b35c9 4070of this configuration.
dd4e71fd
JH
4071
4072EOM
bd9b35c9
JH
4073rp='What is the file extension used for shared libraries?'
4074. ./myread
4075so="$ans"
dd4e71fd 4076
bd9b35c9
JH
4077: Define several unixisms.
4078: Hints files or command line option can be used to override them.
4079: The convoluted testing is in case hints files set either the old
4080: or the new name.
4081case "$_exe" in
4082'') case "$exe_ext" in
4083 '') ;;
4084 *) _exe="$exe_ext" ;;
dd4e71fd 4085 esac
bd9b35c9 4086 ;;
bfb7748a 4087esac
bd9b35c9
JH
4088case "$_a" in
4089'') case "$lib_ext" in
4090 '') _a='.a';;
4091 *) _a="$lib_ext" ;;
dd4e71fd
JH
4092 esac
4093 ;;
dd4e71fd 4094esac
bd9b35c9
JH
4095case "$_o" in
4096'') case "$obj_ext" in
4097 '') _o='.o';;
4098 *) _o="$obj_ext";;
4099 esac
4100 ;;
4101esac
4102case "$p_" in
4103'') case "$path_sep" in
4104 '') p_=':';;
4105 *) p_="$path_sep";;
4106 esac
4107 ;;
4108esac
4109exe_ext=$_exe
4110lib_ext=$_a
4111obj_ext=$_o
4112path_sep=$p_
dd4e71fd 4113
b4eb6b3d
JH
4114: Which makefile gets called first. This is used by make depend.
4115case "$firstmakefile" in
4116'') firstmakefile='makefile';;
4633a7c4 4117esac
4633a7c4 4118
0f0995ae
JH
4119case "$usesocks" in
4120$define|true|[yY]*) dflt='y';;
4121*) dflt='n';;
4122esac
bd9b35c9 4123cat <<EOM
4633a7c4 4124
bd9b35c9 4125Perl can be built to use the SOCKS proxy protocol library. To do so,
cf829ab0
JH
4126Configure must be run with -Dusesocks. If you use SOCKS you also need
4127to use the PerlIO abstraction layer, this will be implicitly selected.
4633a7c4 4128
0f0995ae 4129If this doesn't make any sense to you, just accept the default '$dflt'.
bd9b35c9 4130EOM
bd9b35c9
JH
4131rp='Build Perl for SOCKS?'
4132. ./myread
4133case "$ans" in
4134y|Y) val="$define" ;;
4135*) val="$undef" ;;
4136esac
4137set usesocks
4138eval $setvar
4139
cf829ab0
JH
4140case "$usesocks" in
4141$define|true|[yY]*) useperlio="$define";;
4142esac
4143
bd9b35c9
JH
4144: Looking for optional libraries
4145echo " "
4146echo "Checking for optional libraries..." >&4
4147case "$libs" in
4148' '|'') dflt='';;
4149*) dflt="$libs";;
4150esac
4151case "$libswanted" in
4152'') libswanted='c_s';;
4153esac
4154case "$usesocks" in
923fc586 4155"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4156esac
68435ea7
JH
4157libsfound=''
4158libsfiles=''
4159libsdirs=''
13b3f787
JH
4160libspath=''
4161for thisdir in $libpth $xlibpth; do
4162 test -d $thisdir && libspath="$libspath $thisdir"
4163done
bd9b35c9 4164for thislib in $libswanted; do
13b3f787 4165 for thisdir in $libspath; do
f7dd4e7f
JH
4166 xxx=''
4167 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4168 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
4169 $test -f "$xxx" && eval $libscheck
4170 $test -f "$xxx" && libstyle=shared
4171 fi
4172 if test ! -f "$xxx"; then
4173 xxx=$thisdir/lib$thislib.$so
4174 $test -f "$xxx" && eval $libscheck
4175 $test -f "$xxx" && libstyle=shared
4176 fi
4177 if test ! -f "$xxx"; then
4178 xxx=$thisdir/lib$thislib$_a
4179 $test -f "$xxx" && eval $libscheck
4180 $test -f "$xxx" && libstyle=static
4181 fi
4182 if test ! -f "$xxx"; then
4183 xxx=$thisdir/$thislib$_a
4184 $test -f "$xxx" && eval $libscheck
4185 $test -f "$xxx" && libstyle=static
4186 fi
4187 if test ! -f "$xxx"; then
4188 xxx=$thisdir/lib${thislib}_s$_a
4189 $test -f "$xxx" && eval $libscheck
4190 $test -f "$xxx" && libstyle=static
09ea5ba9 4191 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4192 fi
4193 if test ! -f "$xxx"; then
4194 xxx=$thisdir/Slib$thislib$_a
4195 $test -f "$xxx" && eval $libscheck
4196 $test -f "$xxx" && libstyle=static
4197 fi
4198 if $test -f "$xxx"; then
43999f95 4199 case "$libstyle" in
f7dd4e7f
JH
4200 shared) echo "Found -l$thislib (shared)." ;;
4201 static) echo "Found -l$thislib." ;;
4202 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4203 esac
bd9b35c9
JH
4204 case " $dflt " in
4205 *"-l$thislib "*);;
f7dd4e7f 4206 *) dflt="$dflt -l$thislib"
43999f95
JH
4207 libsfound="$libsfound $xxx"
4208 yyy=`basename $xxx`
4209 libsfiles="$libsfiles $yyy"
1e127011 4210 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4211 case " $libsdirs " in
4212 *" $yyy "*) ;;
4213 *) libsdirs="$libsdirs $yyy" ;;
4214 esac
4215 ;;
bd9b35c9 4216 esac
f7dd4e7f
JH
4217 break
4218 fi
4219 done
4220 if $test ! -f "$xxx"; then
4221 echo "No -l$thislib."
bd9b35c9
JH
4222 fi
4223done
4224set X $dflt
4225shift
4226dflt="$*"
4227case "$libs" in
4228'') dflt="$dflt";;
4229*) dflt="$libs";;
4230esac
4231case "$dflt" in
4232' '|'') dflt='none';;
4233esac
4633a7c4 4234
bd9b35c9 4235$cat <<EOM
4633a7c4 4236
bd9b35c9
JH
4237In order to compile $package on your machine, a number of libraries
4238are usually needed. Include any other special libraries here as well.
4239Say "none" for none. The default list is almost always right.
8e07c86e 4240EOM
8e07c86e 4241
bd9b35c9
JH
4242echo " "
4243rp="What libraries to use?"
4244. ./myread
4245case "$ans" in
4246none) libs=' ';;
4247*) libs="$ans";;
4248esac
d71b2b6b 4249
bd9b35c9
JH
4250: determine optimization, if desired, or use for debug flag also
4251case "$optimize" in
4252' '|$undef) dflt='none';;
4253'') dflt='-O';;
4254*) dflt="$optimize";;
4255esac
4256$cat <<EOH
d71b2b6b 4257
bd9b35c9
JH
4258By default, $package compiles with the -O flag to use the optimizer.
4259Alternately, you might want to use the symbolic debugger, which uses
4260the -g flag (on traditional Unix systems). Either flag can be
4261specified here. To use neither flag, specify the word "none".
d71b2b6b 4262
bd9b35c9
JH
4263EOH
4264rp="What optimizer/debugger flag should be used?"
4265. ./myread
4266optimize="$ans"
4267case "$optimize" in
4268'none') optimize=" ";;
4269esac
4270
4271dflt=''
4272: We will not override a previous value, but we might want to
4273: augment a hint file
4274case "$hint" in
4275default|recommended)
4276 case "$gccversion" in
4277 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 4278 esac
bd9b35c9
JH
4279 case "$optimize" in
4280 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 4281 esac
bd9b35c9
JH
4282 case "$gccversion" in
4283 2*) if test -d /etc/conf/kconfig.d &&
4284 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4285 then
4286 dflt="$dflt -posix"
4287 fi
f0d04425 4288 ;;
bd9b35c9
JH
4289 esac
4290 case "$gccversion" in
4291 1*) ;;
4292 2.[0-8]*) ;;
4293 ?*) echo " "
4294 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4295 echo 'int main(void) { return 0; }' > gcctest.c
4296 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4297 echo "Yes, it does." 2>&1
4298 case "$ccflags" in
4299 *strict-aliasing*)
4300 echo "Leaving current flags $ccflags alone." 2>&1
4301 ;;
4302 *) dflt="$dflt -fno-strict-aliasing" ;;
4303 esac
4304 else
4305 echo "Nope, it doesn't, but that's ok." 2>&1
4306 fi
f0d04425 4307 ;;
e5e20432
JH
4308 esac
4309 ;;
4310esac
4311
bd9b35c9
JH
4312case "$mips_type" in
4313*BSD*|'') inclwanted="$locincpth $usrinc";;
4314*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4315esac
4316for thisincl in $inclwanted; do
4317 if $test -d $thisincl; then
4318 if $test x$thisincl != x$usrinc; then
4319 case "$dflt" in
422af00a
LC
4320 *" -I$thisincl "*);;
4321 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
4322 esac
4323 fi
4324 fi
4325done
40a7a20a 4326
bd9b35c9
JH
4327inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4328 xxx=true;
4329elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4330 xxx=true;
4331else
4332 xxx=false;
4333fi;
4334if $xxx; then
4335 case "$dflt" in
4336 *$2*);;
4337 *) dflt="$dflt -D$2";;
4338 esac;
4339fi'
40a7a20a 4340
bd9b35c9 4341set signal.h LANGUAGE_C; eval $inctest
40a7a20a 4342
bd9b35c9
JH
4343case "$usesocks" in
4344$define)
4345 ccflags="$ccflags -DSOCKS"
4346 ;;
4347esac
40a7a20a 4348
bd9b35c9
JH
4349case "$hint" in
4350default|recommended) dflt="$ccflags $dflt" ;;
4351*) dflt="$ccflags";;
4352esac
40a7a20a 4353
bd9b35c9
JH
4354case "$dflt" in
4355''|' ') dflt=none;;
4356esac
422af00a 4357
bd9b35c9 4358$cat <<EOH
40a7a20a 4359
bd9b35c9
JH
4360Your C compiler may want other flags. For this question you should include
4361-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4362but you should NOT include libraries or ld flags like -lwhatever. If you
4363want $package to honor its debug switch, you should include -DDEBUGGING here.
4364Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 4365
bd9b35c9 4366To use no flags, specify the word "none".
40a7a20a 4367
bd9b35c9
JH
4368EOH
4369set X $dflt
4370shift
4371dflt=${1+"$@"}
4372rp="Any additional cc flags?"
4373. ./myread
4374case "$ans" in
4375none) ccflags='';;
4376*) ccflags="$ans";;
4377esac
8e07c86e 4378
bd9b35c9 4379: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
4380case "$cppflags" in
4381'') cppflags="$ccflags" ;;
4382*) cppflags="$cppflags $ccflags" ;;
4383esac
bd9b35c9
JH
4384case "$gccversion" in
43851*) cppflags="$cppflags -D__GNUC__"
4633a7c4 4386esac
bd9b35c9
JH
4387case "$mips_type" in
4388'');;
4389*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4390esac
4391case "$cppflags" in
4392'');;
4393*)
4394 echo " "
4395 echo "Let me guess what the preprocessor flags are..." >&4
4396 set X $cppflags
4397 shift
4398 cppflags=''
4399 $cat >cpp.c <<'EOM'
4400#define BLURFL foo
8e07c86e 4401
bd9b35c9
JH
4402BLURFL xx LFRULB
4403EOM
4404 previous=''
4405 for flag in $*
4406 do
4407 case "$flag" in
4408 -*) ftry="$flag";;
4409 *) ftry="$previous $flag";;
4410 esac
4411 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4412 >cpp1.out 2>/dev/null && \
4413 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4414 >cpp2.out 2>/dev/null && \
4415 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4416 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4417 then
4418 cppflags="$cppflags $ftry"
4419 previous=''
4420 else
4421 previous="$flag"
4422 fi
4423 done
4424 set X $cppflags
4425 shift
4426 cppflags=${1+"$@"}
4427 case "$cppflags" in
4428 *-*) echo "They appear to be: $cppflags";;
4429 esac
4430 $rm -f cpp.c cpp?.out
2afac517 4431 ;;
4432esac
8e07c86e 4433
bd9b35c9
JH
4434: flags used in final linking phase
4435case "$ldflags" in
4436'') if ./venix; then
4437 dflt='-i -z'
10a23457 4438 else
bd9b35c9 4439 dflt=''
10a23457 4440 fi
bd9b35c9
JH
4441 case "$ccflags" in
4442 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 4443 esac
bd9b35c9
JH
4444 ;;
4445*) dflt="$ldflags";;
4446esac
4447
4448: Try to guess additional flags to pick up local libraries.
4449for thislibdir in $libpth; do
4450 case " $loclibpth " in
4451 *" $thislibdir "*)
4452 case "$dflt " in
4453 *"-L$thislibdir "*) ;;
4454 *) dflt="$dflt -L$thislibdir" ;;
4455 esac
c4f23d77
AD
4456 ;;
4457 esac
bd9b35c9 4458done
c4f23d77 4459
bd9b35c9
JH
4460case "$dflt" in
4461'') dflt='none' ;;
4462esac
c4f23d77 4463
bd9b35c9
JH
4464$cat <<EOH
4465
4466Your C linker may need flags. For this question you should
4467include -L/whatever and any other flags used by the C linker, but you
4468should NOT include libraries like -lwhatever.
4469
4470Make sure you include the appropriate -L/path flags if your C linker
4471does not normally search all of the directories you specified above,
4472namely
4473 $libpth
4474To use no flags, specify the word "none".
4475
4476EOH
4477
4478rp="Any additional ld flags (NOT including libraries)?"
4479. ./myread
4480case "$ans" in
4481none) ldflags='';;
4482*) ldflags="$ans";;
4483esac
4484rmlist="$rmlist pdp11"
4485
4486: coherency check
4487echo " "
4488echo "Checking your choice of C compiler and flags for coherency..." >&4
4489$cat > try.c <<'EOF'
4490#include <stdio.h>
4491int main() { printf("Ok\n"); exit(0); }
4492EOF
7a282f6d 4493set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
4494shift
4495$cat >try.msg <<'EOM'
4496I've tried to compile and run the following simple program:
4497
4498EOM
4499$cat try.c >> try.msg
4500
4501$cat >> try.msg <<EOM
4502
4503I used the command:
4504
4505 $*
5440bc8e 4506 $run ./try
bd9b35c9
JH
4507
4508and I got the following output:
4509
4510EOM
4511dflt=y
73614538 4512if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5440bc8e
JH
4513 if $sh -c "$run ./try" >>try.msg 2>&1; then
4514 xxx=`$run ./try`
bd9b35c9
JH
4515 case "$xxx" in
4516 "Ok") dflt=n ;;
4517 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4518 case " $libs " in
4519 *" -lsfio "*)
4520 cat >> try.msg <<'EOQS'
4521If $libs contains -lsfio, and sfio is mis-configured, then it
4522sometimes (apparently) runs and exits with a 0 status, but with no
4523output! It may have to do with sfio's use of _exit vs. exit.
4524
4525EOQS
4526 rp="You have a big problem. Shall I abort Configure"
4527 dflt=y
4528 ;;
4529 esac
4530 ;;
4531 esac
4532 else
4533 echo "The program compiled OK, but exited with status $?." >>try.msg
4534 rp="You have a problem. Shall I abort Configure"
4535 dflt=y
4536 fi
4537else
4538 echo "I can't compile the test program." >>try.msg
4539 rp="You have a BIG problem. Shall I abort Configure"
4540 dflt=y
4541fi
4542case "$dflt" in
4543y)
4544 $cat try.msg >&4
4545 case "$knowitall" in
4546 '')
4547 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 4548 ;;
bd9b35c9 4549 *) dflt=n;;
c4f23d77 4550 esac
bd9b35c9
JH
4551 echo " "
4552 . ./myread
4553 case "$ans" in
4554 n*|N*) ;;
4555 *) echo "Ok. Stopping Configure." >&4
4556 exit 1
c4f23d77
AD
4557 ;;
4558 esac
4559 ;;
bd9b35c9 4560n) echo "OK, that should do.";;
c4f23d77 4561esac
bd9b35c9 4562$rm -f try try.* core
c4f23d77 4563
bd9b35c9
JH
4564: define a shorthand compile call
4565compile='
4566mc_file=$1;
4567shift;
08413ebc 4568$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
4569: define a shorthand compile call for compilations that should be ok.
4570compile_ok='
4571mc_file=$1;
4572shift;
7a282f6d 4573$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 4574
b4eb6b3d 4575: check for lengths of integral types
bd9b35c9 4576echo " "
b4eb6b3d
JH
4577case "$intsize" in
4578'')
4579 echo "Checking to see how big your integers are..." >&4
5440bc8e 4580 $cat >try.c <<'EOCP'
bd9b35c9
JH
4581#include <stdio.h>
4582int main()
4583{
b4eb6b3d
JH
4584 printf("intsize=%d;\n", (int)sizeof(int));
4585 printf("longsize=%d;\n", (int)sizeof(long));
4586 printf("shortsize=%d;\n", (int)sizeof(short));
4587 exit(0);
bd9b35c9 4588}
b4eb6b3d 4589EOCP
5440bc8e
JH
4590 set try
4591 if eval $compile_ok && $run ./try > /dev/null; then
4592 eval `$run ./try`
b4eb6b3d
JH
4593 echo "Your integers are $intsize bytes long."
4594 echo "Your long integers are $longsize bytes long."
4595 echo "Your short integers are $shortsize bytes long."
4596 else
4597 $cat >&4 <<EOM
4598!
4599Help! I can't compile and run the intsize test program: please enlighten me!
4600(This is probably a misconfiguration in your system or libraries, and
4601you really ought to fix it. Still, I'll try anyway.)
4602!
bd9b35c9 4603EOM
b4eb6b3d
JH
4604 dflt=4
4605 rp="What is the size of an integer (in bytes)?"
96056487
JH
4606 . ./myread
4607 intsize="$ans"
4608 dflt=$intsize
4609 rp="What is the size of a long integer (in bytes)?"
4610 . ./myread
4611 longsize="$ans"
4612 dflt=2
4613 rp="What is the size of a short integer (in bytes)?"
4614 . ./myread
4615 shortsize="$ans"
b4eb6b3d
JH
4616 fi
4617 ;;
4618esac
96056487 4619$rm -f try try.*
b4eb6b3d 4620
8dfa8df9
JH
4621: check for void type
4622echo " "
4623echo "Checking to see how well your C compiler groks the void type..." >&4
4624case "$voidflags" in
4625'')
4626 $cat >try.c <<'EOCP'
4627#if TRY & 1
4628void sub() {
4629#else
4630sub() {
4631#endif
4632 extern void moo(); /* function returning void */
4633 void (*goo)(); /* ptr to func returning void */
4634#if TRY & 8
4635 void *hue; /* generic ptr */
4636#endif
4637#if TRY & 2
4638 void (*foo[10])();
4639#endif
4640
4641#if TRY & 4
4642 if(goo == moo) {
4643 exit(0);
4644 }
4645#endif
4646 exit(0);
4647}
4648int main() { sub(); }
4649EOCP
4650 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4651 voidflags=$defvoidused
4652 echo "Good. It appears to support void to the level $package wants.">&4
4653 if $contains warning .out >/dev/null 2>&1; then
4654 echo "However, you might get some warnings that look like this:"
4655 $cat .out
4656 fi
4657 else
4658echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4659 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4660 echo "It supports 1..."
4661 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4662 echo "It also supports 2..."
4663 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4664 voidflags=7
4665 echo "And it supports 4 but not 8 definitely."
4666 else
4667 echo "It doesn't support 4..."
4668 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4669 voidflags=11
4670 echo "But it supports 8."
4671 else
4672 voidflags=3
4673 echo "Neither does it support 8."
4674 fi
4675 fi
4676 else
4677 echo "It does not support 2..."
4678 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4679 voidflags=13
4680 echo "But it supports 4 and 8."
4681 else
4682 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4683 voidflags=5
4684 echo "And it supports 4 but has not heard about 8."
4685 else
4686 echo "However it supports 8 but not 4."
4687 fi
4688 fi
4689 fi
4690 else
4691 echo "There is no support at all for void."
4692 voidflags=0
4693 fi
4694 fi
4695esac
4696case "$voidflags" in
4697"$defvoidused") ;;
4698*) $cat >&4 <<'EOM'
4699 Support flag bits are:
4700 1: basic void declarations.
4701 2: arrays of pointers to functions returning void.
4702 4: operations between pointers to and addresses of void functions.
4703 8: generic void pointers.
4704EOM
4705 dflt="$voidflags";
4706 rp="Your void support flags add up to what?"
4707 . ./myread
4708 voidflags="$ans"
4709 ;;
4710esac
4711$rm -f try.* .out
4712
4713: check for length of pointer
4714echo " "
4715case "$ptrsize" in
4716'')
4717 echo "Checking to see how big your pointers are..." >&4
4718 if test "$voidflags" -gt 7; then
4719 echo '#define VOID_PTR char *' > try.c
4720 else
4721 echo '#define VOID_PTR void *' > try.c
4722 fi
4723 $cat >>try.c <<'EOCP'
4724#include <stdio.h>
4725int main()
4726{
4727 printf("%d\n", (int)sizeof(VOID_PTR));
4728 exit(0);
4729}
4730EOCP
4731 set try
4732 if eval $compile_ok; then
5440bc8e 4733 ptrsize=`$run ./try`
8dfa8df9
JH
4734 echo "Your pointers are $ptrsize bytes long."
4735 else
4736 dflt='4'
4737 echo "(I can't seem to compile the test program. Guessing...)" >&4
4738 rp="What is the size of a pointer (in bytes)?"
4739 . ./myread
4740 ptrsize="$ans"
4741 fi
4742 ;;
4743esac
4744$rm -f try.c try
4745
4746: check for long long
4747echo " "
4748echo "Checking to see if you have long long..." >&4
4749echo 'int main() { long long x = 7; return 0; }' > try.c
4750set try
4751if eval $compile; then
4752 val="$define"
4753 echo "You have long long."
4754else
4755 val="$undef"
4756 echo "You do not have long long."
4757fi
4758$rm try.*
4759set d_longlong
4760eval $setvar
4761
4762: check for length of long long
4763case "${d_longlong}${longlongsize}" in
4764$define)
4765 echo " "
4766 echo "Checking to see how big your long longs are..." >&4
4767 $cat >try.c <<'EOCP'
4768#include <stdio.h>
4769int main()
4770{
4771 printf("%d\n", (int)sizeof(long long));
4772 return(0);
4773}
4774EOCP
4775 set try
4776 if eval $compile_ok; then
5440bc8e 4777 longlongsize=`$run ./try`
8dfa8df9
JH
4778 echo "Your long longs are $longlongsize bytes long."
4779 else
4780 dflt='8'
4781 echo " "
4782 echo "(I can't seem to compile the test program. Guessing...)"
4783 rp="What is the size of a long long (in bytes)?"
4784 . ./myread
4785 longlongsize="$ans"
4786 fi
4787 if $test "X$longsize" = "X$longlongsize"; then
4788 echo "(That isn't any different from an ordinary long.)"
4789 fi
4790 ;;
4791esac
4792$rm -f try.* try
4793
4794: determine filename position in cpp output
4795echo " "
4796echo "Computing filename position in cpp output for #include directives..." >&4
4797echo '#include <stdio.h>' > foo.c
4798$cat >fieldn <<EOF
4799$startsh
4800$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4801$grep '^[ ]*#.*stdio\.h' | \
4802while read cline; do
4803 pos=1
4804 set \$cline
4805 while $test \$# -gt 0; do
4806 if $test -r \`echo \$1 | $tr -d '"'\`; then
4807 echo "\$pos"
4808 exit 0
4809 fi
4810 shift
4811 pos=\`expr \$pos + 1\`
4812 done
4813done
4814EOF
4815chmod +x fieldn
4816fieldn=`./fieldn`
4817$rm -f foo.c fieldn
4818case $fieldn in
4819'') pos='???';;
48201) pos=first;;
48212) pos=second;;
48223) pos=third;;
4823*) pos="${fieldn}th";;
4824esac
4825echo "Your cpp writes the filename in the $pos field of the line."
4826
4827: locate header file
4828$cat >findhdr <<EOF
4829$startsh
4830wanted=\$1
4831name=''
4832for usrincdir in $usrinc
4833do
4834 if test -f \$usrincdir/\$wanted; then
4835 echo "\$usrincdir/\$wanted"
4836 exit 0
4837 fi
4838done
4839awkprg='{ print \$$fieldn }'
4840echo "#include <\$wanted>" > foo\$\$.c
4841$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4842$grep "^[ ]*#.*\$wanted" | \
4843while read cline; do
4844 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4845 case "\$name" in
4846 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4847 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4848 *) exit 2;;
4849 esac;
4850done;
4851#
4852# status = 0: grep returned 0 lines, case statement not executed
4853# status = 1: headerfile found
4854# status = 2: while loop executed, no headerfile found
4855#
4856status=\$?
4857$rm -f foo\$\$.c;
4858if test \$status -eq 1; then
4859 exit 0;
4860fi
4861exit 1
4862EOF
4863chmod +x findhdr
4864
4865: define an alternate in-header-list? function
4866inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4867cont=true; xxf="echo \"<\$1> found.\" >&4";
4868case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4869*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4870esac;
4871case $# in 4) instead=instead;; *) instead="at last";; esac;
4872while $test "$cont"; do
4873 xxx=`./findhdr $1`
4874 var=$2; eval "was=\$$2";
4875 if $test "$xxx" && $test -r "$xxx";
4876 then eval $xxf;
4877 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4878 cont="";
4879 else eval $xxnf;
4880 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4881 set $yyy; shift; shift; yyy=$@;
4882 case $# in 0) cont="";;
4883 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4884 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4885 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4886 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4887 esac;
4888done;
4889while $test "$yyy";
4890do set $yyy; var=$2; eval "was=\$$2";
4891 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4892 set $yyy; shift; shift; yyy=$@;
4893done'
4894
4895: see if inttypes.h is available
4896: we want a real compile instead of Inhdr because some systems
4897: have an inttypes.h which includes non-existent headers
4898echo " "
4899$cat >try.c <<EOCP
4900#include <inttypes.h>
4901int main() {
4902 static int32_t foo32 = 0x12345678;
4903}
4904EOCP
4905set try
4906if eval $compile; then
4907 echo "<inttypes.h> found." >&4
4908 val="$define"
4909else
4910 echo "<inttypes.h> NOT found." >&4
4911 val="$undef"
4912fi
4913$rm -f try.c try
4914set i_inttypes
4915eval $setvar
4916
4917: check for int64_t
4918echo " "
4919echo "Checking to see if you have int64_t..." >&4
4920$cat >try.c <<EOCP
4921#include <sys/types.h>
4922#$i_inttypes I_INTTYPES
4923#ifdef I_INTTYPES
4924#include <inttypes.h>
4925#endif
4926int main() { int64_t x = 7; }
4927EOCP
4928set try
4929if eval $compile; then
4930 val="$define"
4931 echo "You have int64_t."
4932else
4933 val="$undef"
4934 echo "You do not have int64_t."
4935fi
4936$rm -f try try.*
4937set d_int64_t
4938eval $setvar
4939
4940
4941echo " "
4942echo "Checking which 64-bit integer type we could use..." >&4
4943
4944case "$intsize" in
49458) val=int
4946 set quadtype
4947 eval $setvar
4948 val='"unsigned int"'
4949 set uquadtype
4950 eval $setvar
4951 quadkind=1
4952 ;;
4953*) case "$longsize" in
4954 8) val=long
4955 set quadtype
4956 eval $setvar
4957 val='"unsigned long"'
4958 set uquadtype
4959 eval $setvar
4960 quadkind=2
4961 ;;
4962 *) case "$d_longlong:$longlongsize" in
4963 define:8)
4964 val='"long long"'
4965 set quadtype
4966 eval $setvar
4967 val='"unsigned long long"'
4968 set uquadtype
4969 eval $setvar
4970 quadkind=3
4971 ;;
4972 *) case "$d_int64_t" in
4973 define)
4974 val=int64_t
4975 set quadtype
4976 eval $setvar
4977 val=uint64_t
4978 set uquadtype
4979 eval $setvar
4980 quadkind=4
4981 ;;
4982 esac
4983 ;;
4984 esac
4985 ;;
4986 esac
4987 ;;
4988esac
4989
4990case "$quadtype" in
4991'') echo "Alas, no 64-bit integer types in sight." >&4
4992 d_quad="$undef"
4993 ;;
4994*) echo "We could use '$quadtype' for 64-bit integers." >&4
4995 d_quad="$define"
4996 ;;
4997esac
4998
b4eb6b3d
JH
4999
5000case "$uselonglong" in
5001"$define"|true|[yY]*)
5002 cat <<EOM >&4
5003
5004*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5005EOM
5006 use64bitint="$define"
5007 ;;
5008esac
5009case "$use64bits" in
5010"$define"|true|[yY]*)
5011 cat <<EOM >&4
5012
5013*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5014EOM
5015 use64bitint="$define"
5016 ;;
5017esac
5018case "$use64bitints" in
5019"$define"|true|[yY]*)
5020 cat <<EOM >&4
5021
5022*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5023EOM
5024 use64bitint="$define"
5025 ;;
5026esac
5027case "$use64bitsint" in
5028"$define"|true|[yY]*)
5029 cat <<EOM >&4
5030
5031*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5032EOM
5033 use64bitint="$define"
5034 ;;
5035esac
5036case "$uselonglongs" in
5037"$define"|true|[yY]*)
5038 cat <<EOM >&4
5039
5040*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5041EOM
5042 use64bitint="$define"
5043 ;;
5044esac
5045case "$use64bitsall" in
5046"$define"|true|[yY]*)
5047 cat <<EOM >&4
5048
5049*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5050EOM
5051 use64bitall="$define"
5052 ;;
5053esac
5054
5055case "$ccflags" in
5056*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5057esac
5058case "$use64bitall" in
5059"$define"|true|[yY]*) use64bitint="$define" ;;
5060esac
5061
5062case "$longsize" in
50638) cat <<EOM
5064
5065You have natively 64-bit long integers.
5066EOM
5067 val="$define"
5068 ;;
5069*) case "$use64bitint" in
5070 "$define"|true|[yY]*) dflt='y';;
5071 *) dflt='n';;
5072 esac
8dfa8df9
JH
5073 case "$d_quad" in
5074 "$define") ;;
5075 *) dflt='n' ;;
5076 esac
b4eb6b3d
JH
5077 cat <<EOM
5078
5079Perl can be built to take advantage of 64-bit integer types
5080on some systems. To do so, Configure can be run with -Duse64bitint.
5081Choosing this option will most probably introduce binary incompatibilities.
5082
5083If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5084(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5085EOM
5086 rp='Try to use 64-bit integers, if available?'
5087 . ./myread
5088 case "$ans" in
5089 [yY]*) val="$define" ;;
5090 *) val="$undef" ;;
5091 esac
5092 ;;
5093esac
5094set use64bitint
5095eval $setvar
5096
5097case "$use64bitall" in
5098"$define"|true|[yY]*) dflt='y' ;;
5099*) case "$longsize" in
5100 8) dflt='y' ;;
5101 *) dflt='n' ;;
5102 esac
5103 ;;
5104esac
5105cat <<EOM
5106
5107You may also choose to try maximal 64-bitness. It means using as much
510864-bitness as possible on the platform. This in turn means even more
5109binary incompatibilities. On the other hand, your platform may not
5110have any more 64-bitness available than what you already have chosen.
5111
5112If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5113(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5114EOM
5115rp='Try to use maximal 64-bit support, if available?'
5116. ./myread
5117case "$ans" in
5118[yY]*) val="$define" ;;
5119*) val="$undef" ;;
5120esac
5121set use64bitall
5122eval $setvar
5123case "$use64bitall" in
5124"$define")
5125 case "$use64bitint" in
5126 "$undef")
5127 cat <<EOM
5128
5129Since you have chosen a maximally 64-bit build, I'm also turning on
5130the use of 64-bit integers.
5131EOM
5132 use64bitint="$define" ;;
5133 esac
5134 ;;
5135esac
5136
8dfa8df9
JH
5137case "$use64bitall" in
5138"$define"|true|[yY]*)
5139 case "$ptrsize" in
5140 4) cat <<EOM >&4
5141
5142*** You have chosen a maximally 64-bit build, but your pointers
5143*** are only 4 bytes wide, disabling maximal 64-bitness.
5144
5145EOM
5146 use64bitall="$undef"
5147 case "$use64bitint" in
5148 "$define"|true|[yY]*) ;;
5149 *) cat <<EOM >&4
5150
5151*** Downgrading from maximal 64-bitness to using 64-bit integers.
5152
5153EOM
5154 use64bitint="$define"
5155 ;;
5156 esac
5157 ;;
5158 esac
5159 ;;
5160esac
5161
b4eb6b3d
JH
5162case "$use64bitint" in
5163"$define"|true|[yY]*)
5164: Look for a hint-file generated 'call-back-unit'. If the
5165: user has specified that a 64-bit perl is to be built,
5166: we may need to set or change some other defaults.
5167 if $test -f use64bitint.cbu; then
5168 echo "Your platform has some specific hints for 64-bit integers, using them..."
5169 . ./use64bitint.cbu
5170 fi
5171 case "$longsize" in
5172 4) case "$archname64" in
5173 '') archname64=64int ;;
5174 esac
5175 ;;
5176 esac
5177 ;;
5178esac
5179
5180case "$use64bitall" in
5181"$define"|true|[yY]*)
5182: Look for a hint-file generated 'call-back-unit'. If the
5183: user has specified that a maximally 64-bit perl is to be built,
5184: we may need to set or change some other defaults.
5185 if $test -f use64bitall.cbu; then
5186 echo "Your platform has some specific hints for 64-bit builds, using them..."
5187 . ./use64bitall.cbu
5188 fi
5189 case "$longsize" in
5190 4) case "$archname64" in
5191 ''|64int) archname64=64all ;;
5192 esac
5193 ;;
5194 esac
5195 ;;
5196esac
5197
5198echo " "
5199echo "Checking for GNU C Library..." >&4
5440bc8e 5200cat >try.c <<EOM
b4eb6b3d
JH
5201#include <stdio.h>
5202int main()
5203{
5204#ifdef __GLIBC__
5205 exit(0);
5206#else
5207 exit(1);
5208#endif
5209}
5210EOM
5440bc8e
JH
5211set try
5212if eval $compile_ok && $run ./try; then
b4eb6b3d
JH
5213 val="$define"
5214 echo "You are using the GNU C Library"
5215else
5216 val="$undef"
5217 echo "You are not using the GNU C Library"
5218fi
5440bc8e 5219$rm -f try try.*
b4eb6b3d
JH
5220set d_gnulibc
5221eval $setvar
5222
5223: see if nm is to be used to determine whether a symbol is defined or not
5224case "$usenm" in
5225'')
5226 dflt=''
c1a7f87b
JH
5227 case "$d_gnulibc" in
5228 "$define")
5229 echo " "
5230 echo "nm probably won't work on the GNU C Library." >&4
5231 dflt=n
bd9b35c9 5232 ;;
c1a7f87b
JH
5233 esac
5234 case "$dflt" in
5235 '')
5236 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5237 echo " "
5238 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
5239 echo "'nm' won't be sufficient on this sytem." >&4
5240 dflt=n
5241 fi
5242 ;;
5243 esac
5244 case "$dflt" in
5245 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5246 if $test $dflt -gt 20; then
5247 dflt=y
5248 else
5249 dflt=n
5250 fi
bd9b35c9
JH
5251 ;;
5252 esac
bd9b35c9
JH
5253 ;;
5254*)
c1a7f87b
JH
5255 case "$usenm" in
5256 true|$define) dflt=y;;
5257 *) dflt=n;;
5258 esac
bd9b35c9
JH
5259 ;;
5260esac
5261$cat <<EOM
5262
c1a7f87b
JH
5263I can use $nm to extract the symbols from your C libraries. This
5264is a time consuming task which may generate huge output on the disk (up
5265to 3 megabytes) but that should make the symbols extraction faster. The
5266alternative is to skip the 'nm' extraction part and to compile a small
5267test program instead to determine whether each symbol is present. If
5268you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5269this may be the best solution.
5270
5271You probably shouldn't let me use 'nm' if you are using the GNU C Library.
bd9b35c9
JH
5272
5273EOM
c1a7f87b
JH
5274rp="Shall I use $nm to extract C symbols from the libraries?"
5275. ./myread
5276case "$ans" in
5277[Nn]*) usenm=false;;
5278*) usenm=true;;
bd9b35c9 5279esac
bd9b35c9 5280
c1a7f87b
JH
5281runnm=$usenm
5282case "$reuseval" in
5283true) runnm=false;;
8e07c86e 5284esac
29209bc5 5285
c1a7f87b
JH
5286: nm options which may be necessary
5287case "$nm_opt" in
5288'') if $test -f /mach_boot; then
5289 nm_opt='' # Mach
5290 elif $test -d /usr/ccs/lib; then
5291 nm_opt='-p' # Solaris (and SunOS?)
5292 elif $test -f /dgux; then
5293 nm_opt='-p' # DG-UX
5294 elif $test -f /lib64/rld; then
5295 nm_opt='-p' # 64-bit Irix
5296 else
5297 nm_opt=''
5298 fi;;
5299esac
bd9b35c9 5300
c1a7f87b
JH
5301: nm options which may be necessary for shared libraries but illegal
5302: for archive libraries. Thank you, Linux.
5303case "$nm_so_opt" in
5304'') case "$myuname" in
5305 *linux*)
5306 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5307 nm_so_opt='--dynamic'
5308 fi
5309 ;;
bd9b35c9 5310 esac
c1a7f87b
JH
5311 ;;
5312esac
8e07c86e 5313
c1a7f87b
JH
5314case "$runnm" in
5315true)
5316: get list of predefined functions in a handy place
5317echo " "
5318case "$libc" in
5319'') libc=unknown
5320 case "$libs" in
5321 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
bd9b35c9 5322 esac
ff935051
JH
5323 ;;
5324esac
c1a7f87b
JH
5325case "$libs" in
5326'') ;;
5327*) for thislib in $libs; do
5328 case "$thislib" in
5329 -lc|-lc_s)
5330 : Handle C library specially below.
5331 ;;
5332 -l*)
5333 thislib=`echo $thislib | $sed -e 's/^-l//'`
5334 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5335 :
5336 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5337 :
5338 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5339 :
5340 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5341 :
5342 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5343 :
5344 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5345 :
5346 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5347 :
5348 else
5349 try=''
5350 fi
5351 libnames="$libnames $try"
5352 ;;
5353 *) libnames="$libnames $thislib" ;;
34d1710f 5354 esac
c1a7f87b 5355 done
4633a7c4
LW
5356 ;;
5357esac
c1a7f87b
JH
5358xxx=normal
5359case "$libc" in
5360unknown)
5361 set /lib/libc.$so
5362 for xxx in $libpth; do
5363 $test -r $1 || set $xxx/libc.$so
5364 : The messy sed command sorts on library version numbers.
5365 $test -r $1 || \
5366 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5367 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5368 h
5369 s/[0-9][0-9]*/0000&/g
5370 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5371 G
5372 s/\n/ /' | \
381aa1ff 5373 $sort | $sed -e 's/^.* //'`
c1a7f87b
JH
5374 eval set \$$#
5375 done
5376 $test -r $1 || set /usr/ccs/lib/libc.$so
5377 $test -r $1 || set /lib/libsys_s$_a
5378 ;;
5379*)
5380 set blurfl
5381 ;;
a4f3eea9 5382esac
c1a7f87b
JH
5383if $test -r "$1"; then
5384 echo "Your (shared) C library seems to be in $1."
5385 libc="$1"
5386elif $test -r /lib/libc && $test -r /lib/clib; then
5387 echo "Your C library seems to be in both /lib/clib and /lib/libc."
5388 xxx=apollo
5389 libc='/lib/clib /lib/libc'
5390 if $test -r /lib/syslib; then
5391 echo "(Your math library is in /lib/syslib.)"
5392 libc="$libc /lib/syslib"
5393 fi
5394elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5395 echo "Your C library seems to be in $libc, as you said before."
5396elif $test -r $incpath/usr/lib/libc$_a; then
5397 libc=$incpath/usr/lib/libc$_a;
5398 echo "Your C library seems to be in $libc. That's fine."
5399elif $test -r /lib/libc$_a; then
5400 libc=/lib/libc$_a;
5401 echo "Your C library seems to be in $libc. You're normal."
5402else
5403 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5404 :
5405 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5406 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5407 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5408 :
5409 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5410 :
5411 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5412 :
5413 else
5414 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5415 fi
5416 if $test -r "$tans"; then
5417 echo "Your C library seems to be in $tans, of all places."
5418 libc=$tans
5419 else
5420 libc='blurfl'
5421 fi
5422fi
5423if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5424 dflt="$libc"
5425 cat <<EOM
a4f3eea9 5426
c1a7f87b
JH
5427If the guess above is wrong (which it might be if you're using a strange
5428compiler, or your machine supports multiple models), you can override it here.
bd9b35c9
JH
5429
5430EOM
a4f3eea9 5431else
c1a7f87b 5432 dflt=''
381aa1ff 5433 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
c1a7f87b
JH
5434 cat >&4 <<EOM
5435I can't seem to find your C library. I've looked in the following places:
a4f3eea9 5436
c1a7f87b
JH
5437EOM
5438 $sed 's/^/ /' libpath
5439 cat <<EOM
29209bc5 5440
c1a7f87b 5441None of these seems to contain your C library. I need to get its name...
a4f3eea9 5442
bd9b35c9 5443EOM
bd9b35c9 5444fi
c1a7f87b
JH
5445fn=f
5446rp='Where is your C library?'
5447. ./getfile
5448libc="$ans"
a4f3eea9 5449
c1a7f87b 5450echo " "
381aa1ff 5451echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
c1a7f87b
JH
5452set X `cat libnames`
5453shift
5454xxx=files
5455case $# in 1) xxx=file; esac
5456echo "Extracting names from the following $xxx for later perusal:" >&4
5457echo " "
5458$sed 's/^/ /' libnames >&4
5459echo " "
5460$echo $n "This may take a while...$c" >&4
a4f3eea9 5461
c1a7f87b
JH
5462for file in $*; do
5463 case $file in
5464 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5465 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 5466 esac
c1a7f87b 5467done >libc.tmp
a4f3eea9 5468
c1a7f87b
JH
5469$echo $n ".$c"
5470$grep fprintf libc.tmp > libc.ptf
5471xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5472xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5473xxx='[ADTSIW]'
5474if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
5475 eval $xscan;\
5476 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5477 eval $xrun
5478elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5479 eval $xscan;\
5480 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5481 eval $xrun
5482elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5483 eval $xscan;\
5484 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5485 eval $xrun
5486elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5487 eval $xscan;\
5488 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5489 eval $xrun
5490elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5491 eval $xscan;\
5492 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5493 eval $xrun
5494elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5495 eval $xscan;\
5496 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5497 eval $xrun
5498elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5499 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
5500 eval $xscan;\
5501 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5502 eval $xrun
5503elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5504 eval $xscan;\
5505 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5506 eval $xrun
5507elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5508 eval $xscan;\
5509 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5510 eval $xrun
5511elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5512 eval $xscan;\
5513 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5514 eval $xrun
5515elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5516 eval $xscan;\
5517 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5518 eval $xrun
5519elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5520 eval $xscan;\
5521 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5522 eval $xrun
5523elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5524 eval $xscan;\
5525 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5526 eval $xrun
5527elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
5528 eval $xscan;\
5529 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5530 eval $xrun
5531else
5532 $nm -p $* 2>/dev/null >libc.tmp
5533 $grep fprintf libc.tmp > libc.ptf
5534 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5535 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5536 then
5537 nm_opt='-p'
5538 eval $xrun
bd9b35c9 5539 else
c1a7f87b
JH
5540 echo " "
5541 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5542 com=''
5543 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5544 for thisname in $libnames $libc; do
5545 $ar t $thisname >>libc.tmp
5546 done
5547 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5548 echo "Ok." >&4
5549 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5550 # Repeat libc to extract forwarders to DLL entries too
5551 for thisname in $libnames $libc; do
5552 $ar tv $thisname >>libc.tmp
5553 # Revision 50 of EMX has bug in $ar.
5554 # it will not extract forwarders to DLL entries
5555 # Use emximp which will extract exactly them.
5556 emximp -o tmp.imp $thisname \
5557 2>/dev/null && \
5558 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5559 < tmp.imp >>libc.tmp
5560 $rm tmp.imp
5561 done
5562 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5563 echo "Ok." >&4
5564 else
5565 echo "$ar didn't seem to work right." >&4
5566 echo "Maybe this is a Cray...trying bld instead..." >&4
5567 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5568 then
5569 for thisname in $libnames; do
5570 bld t $libnames | \
5571 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5572 $ar t $thisname >>libc.tmp
5573 done
5574 echo "Ok." >&4
bd9b35c9 5575 else
c1a7f87b
JH
5576 echo "That didn't work either. Giving up." >&4
5577 exit 1
bd9b35c9 5578 fi
c1a7f87b 5579 fi
a4f3eea9 5580 fi
a4f3eea9 5581fi
c1a7f87b
JH
5582nm_extract="$com"
5583if $test -f /lib/syscalls.exp; then
5584 echo " "
5585 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
a8c676c6 5586 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' /lib/syscalls.exp >>libc.list
c1a7f87b
JH
5587fi
5588;;
5589esac
5590$rm -f libnames libpath
bd9b35c9 5591
c1a7f87b
JH
5592: is a C symbol defined?
5593csym='tlook=$1;
5594case "$3" in
5595-v) tf=libc.tmp; tc=""; tdc="";;
5596-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5597*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5598esac;
5599tx=yes;
5600case "$reuseval-$4" in
5601true-) ;;
5602true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5603esac;
5604case "$tx" in
5605yes)
5606 case "$runnm" in
5607 true)
5608 if $contains $tlook $tf >/dev/null 2>&1;
5609 then tval=true;
5610 else tval=false;
5611 fi;;
5612 *)
5613 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
7a282f6d 5614 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
c1a7f87b
JH
5615 then tval=true;
5616 else tval=false;
5617 fi;
5618 $rm -f t t.c;;
5619 esac;;
5620*)
5621 case "$tval" in
5622 $define) tval=true;;
5623 *) tval=false;;
5624 esac;;
5625esac;
5626eval "$2=$tval"'
bd9b35c9 5627
c1a7f87b
JH
5628: define an is-in-libc? function
5629inlibc='echo " "; td=$define; tu=$undef;
5630sym=$1; var=$2; eval "was=\$$2";
5631tx=yes;
5632case "$reuseval$was" in
5633true) ;;
5634true*) tx=no;;
5635esac;
5636case "$tx" in
5637yes)
5638 set $sym tres -f;
5639 eval $csym;
5640 case "$tres" in
5641 true)
5642 echo "$sym() found." >&4;
5643 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5644 *)
5645 echo "$sym() NOT found." >&4;
5646 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5647 esac;;
bd9b35c9 5648*)
c1a7f87b
JH
5649 case "$was" in
5650 $define) echo "$sym() found." >&4;;
5651 *) echo "$sym() NOT found." >&4;;
5652 esac;;
5653esac'
5654
b4eb6b3d
JH
5655: see if sqrtl exists
5656set sqrtl d_sqrtl
c1a7f87b
JH
5657eval $inlibc
5658
b4eb6b3d
JH
5659case "$ccflags" in
5660*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
c1a7f87b 5661esac
b4eb6b3d
JH
5662
5663case "$uselongdouble" in
5664$define|true|[yY]*) dflt='y';;
5665*) dflt='n';;
5666esac
5667cat <<EOM
5668
5669Perl can be built to take advantage of long doubles which
5670(if available) may give more accuracy and range for floating point numbers.
5671
5672If this doesn't make any sense to you, just accept the default '$dflt'.
5673EOM
5674rp='Try to use long doubles if available?'
c1a7f87b
JH
5675. ./myread
5676case "$ans" in
b4eb6b3d
JH
5677y|Y) val="$define" ;;
5678*) val="$undef" ;;
5679esac
5680set uselongdouble
5681eval $setvar
bfb7748a 5682
b4eb6b3d
JH
5683case "$uselongdouble" in
5684true|[yY]*) uselongdouble="$define" ;;
5685esac
bfb7748a 5686
b4eb6b3d
JH
5687case "$uselongdouble" in
5688$define)
5689: Look for a hint-file generated 'call-back-unit'. If the
5690: user has specified that long doubles should be used,
5691: we may need to set or change some other defaults.
5692 if $test -f uselongdouble.cbu; then
5693 echo "Your platform has some specific hints for long doubles, using them..."
5694 . ./uselongdouble.cbu
5695 else
5696 $cat <<EOM
5697(Your platform doesn't have any specific hints for long doubles.)
c1a7f87b 5698EOM
b4eb6b3d
JH
5699 fi
5700 ;;
5701esac
5702
5703case "$uselongdouble:$d_sqrtl" in
5704$define:$undef)
5705 $cat <<EOM >&4
5706
5707*** You requested the use of long doubles but you do not seem to have
5708*** the mathematic functions for long doubles. I'm disabling the use
5709*** of long doubles.
5710
5711EOM
5712 uselongdouble=$undef
5713 ;;
5714esac
5715
5716: check for length of double
5717echo " "
5718case "$doublesize" in
5719'')
5720 echo "Checking to see how big your double precision numbers are..." >&4
5721 $cat >try.c <<'EOCP'
5722#include <stdio.h>
5723int main()
5724{
5725 printf("%d\n", (int)sizeof(double));
5726 exit(0);
5727}
5728EOCP
5729 set try
5730 if eval $compile_ok; then
5440bc8e 5731 doublesize=`$run ./try`
b4eb6b3d
JH
5732 echo "Your double is $doublesize bytes long."
5733 else
5734 dflt='8'
5735 echo "(I can't seem to compile the test program. Guessing...)"
5736 rp="What is the size of a double precision number (in bytes)?"
5737 . ./myread
5738 doublesize="$ans"
5739 fi
5740 ;;
5741esac
5742$rm -f try.c try
5743
5744: check for long doubles
5745echo " "
5746echo "Checking to see if you have long double..." >&4
5747echo 'int main() { long double x = 7.0; }' > try.c
5748set try
5749if eval $compile; then
5750 val="$define"
5751 echo "You have long double."
5752else
5753 val="$undef"
5754 echo "You do not have long double."
5755fi
5756$rm try.*
5757set d_longdbl
5758eval $setvar
5759
5760: check for length of long double
5761case "${d_longdbl}${longdblsize}" in
5762$define)
5763 echo " "
5764 echo "Checking to see how big your long doubles are..." >&4
5765 $cat >try.c <<'EOCP'
5766#include <stdio.h>
5767int main()
5768{
5769 printf("%d\n", sizeof(long double));
5770}
5771EOCP
5772 set try
5773 set try
5774 if eval $compile; then
5440bc8e 5775 longdblsize=`$run ./try`
b4eb6b3d
JH
5776 echo "Your long doubles are $longdblsize bytes long."
5777 else
5778 dflt='8'
5779 echo " "
5780 echo "(I can't seem to compile the test program. Guessing...)" >&4
5781 rp="What is the size of a long double (in bytes)?"
5782 . ./myread
5783 longdblsize="$ans"
5784 fi
5785 if $test "X$doublesize" = "X$longdblsize"; then
5786 echo "(That isn't any different from an ordinary double.)"
5787 fi
5788 ;;
5789esac
5790$rm -f try.* try
5791
51de783f 5792case "$useperlio" in
5a3a8a02 5793$define|true|[yY]*|'') dflt='y';;
51de783f
JH
5794*) dflt='n';;
5795esac
5796cat <<EOM
5797
5798Previous version of $package used the standard IO mechanisms as
5a3a8a02 5799defined in <stdio.h>. Versions 5.003_02 and later of $package allow
51de783f 5800alternate IO mechanisms via the PerlIO abstraction layer, but the
5a3a8a02
JH
5801stdio mechanism is still available if needed. The abstraction layer
5802can use AT&T's sfio (if you already have sfio installed) or regular stdio.
51de783f
JH
5803Using PerlIO with sfio may cause problems with some extension modules.
5804
5805If this doesn't make any sense to you, just accept the default '$dflt'.
5806EOM
5a3a8a02 5807rp='Use the PerlIO abstraction layer?'
51de783f
JH
5808. ./myread
5809case "$ans" in
5810y|Y)
5811 val="$define"
5a3a8a02 5812 ;;
51de783f
JH
5813*)
5814 echo "Ok, doing things the stdio way."
5815 val="$undef"
5816 ;;
5817esac
5818set useperlio
5819eval $setvar
5820
5821case "$usesocks" in
5822$define|true|[yY]*)
5823 case "$useperlio" in
5824 $define|true|[yY]*) ;;
5825 *) cat >&4 <<EOM
5826
5827You are using the SOCKS proxy protocol library which means that you
5828should also use the PerlIO layer. You may be headed for trouble.
5829
5830EOM
5831 ;;
5832 esac
5833 ;;
5834esac
5835
5836
b4eb6b3d
JH
5837: determine the architecture name
5838echo " "
5839if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5840 tarch=`arch`"-$osname"
5841elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5842 if uname -m > tmparch 2>&1 ; then
5843 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5844 -e 's/$/'"-$osname/" tmparch`
5845 else
5846 tarch="$osname"
5847 fi
5848 $rm -f tmparch
5849else
5850 tarch="$osname"
5851fi
5852case "$myarchname" in
5853''|"$tarch") ;;
5854*)
5855 echo "(Your architecture name used to be $myarchname.)"
5856 archname=''
5857 ;;
5858esac
5440bc8e
JH
5859case "$targetarch" in
5860'') ;;
5861*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5862esac
b4eb6b3d
JH
5863myarchname="$tarch"
5864case "$archname" in
5865'') dflt="$tarch";;
5866*) dflt="$archname";;
5867esac
5868rp='What is your architecture name'
5869. ./myread
5870archname="$ans"
5871case "$usethreads" in
5872$define)
5873 echo "Threads selected." >&4
5874 case "$archname" in
5875 *-thread*) echo "...and architecture name already has -thread." >&4
5876 ;;
5877 *) archname="$archname-thread"
5878 echo "...setting architecture name to $archname." >&4
5879 ;;
5880 esac
5881 ;;
5882esac
5883case "$usemultiplicity" in
5884$define)
5885 echo "Multiplicity selected." >&4
5886 case "$archname" in
5887 *-multi*) echo "...and architecture name already has -multi." >&4
5888 ;;
5889 *) archname="$archname-multi"
5890 echo "...setting architecture name to $archname." >&4
5891 ;;
5892 esac
5893 ;;
5894esac
5895case "$use64bitint$use64bitall" in
5896*"$define"*)
5897 case "$archname64" in
5898 '')
5899 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5900 ;;
5901 *)
5902 case "$use64bitint" in
5903 "$define") echo "64 bit integers selected." >&4 ;;
5904 esac
5905 case "$use64bitall" in
5906 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5907 esac
5908 case "$archname" in
5909 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5910 ;;
5911 *) archname="$archname-$archname64"
5912 echo "...setting architecture name to $archname." >&4
5913 ;;
5914 esac
5915 ;;
5916 esac
5917esac
5918case "$uselongdouble" in
5919$define)
5920 echo "Long doubles selected." >&4
5921 case "$longdblsize" in
5922 $doublesize)
5923 "...but long doubles are equal to doubles, not changing architecture name." >&4
5924 ;;
5925 *)
5926 case "$archname" in
5927 *-ld*) echo "...and architecture name already has -ld." >&4
5928 ;;
5929 *) archname="$archname-ld"
5930 echo "...setting architecture name to $archname." >&4
5931 ;;
5932 esac
5933 ;;
5934 esac
5935 ;;
5936esac
51de783f
JH
5937case "$useperlio" in
5938$define)
5939 echo "Perlio selected." >&4
d46c9a2d
JH
5940 ;;
5941*)
5942 echo "Perlio not selected, using stdio." >&4
51de783f 5943 case "$archname" in
d46c9a2d 5944 *-stdio*) echo "...and architecture name already has -stdio." >&4
51de783f 5945 ;;
d46c9a2d 5946 *) archname="$archname-stdio"
51de783f
JH
5947 echo "...setting architecture name to $archname." >&4
5948 ;;
5949 esac
5950 ;;
5951esac
b4eb6b3d
JH
5952
5953: determine root of directory hierarchy where package will be installed.
5954case "$prefix" in
5955'')
5956 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5957 ;;
5958*)
5959 dflt="$prefix"
5960 ;;
5961esac
5962$cat <<EOM
5963
5964By default, $package will be installed in $dflt/bin, manual pages
5965under $dflt/man, etc..., i.e. with $dflt as prefix for all
5966installation directories. Typically this is something like /usr/local.
5967If you wish to have binaries under /usr/bin but other parts of the
5968installation under /usr/local, that's ok: you will be prompted
5969separately for each of the installation directories, the prefix being
5970only used to set the defaults.
5971
5972EOM
5973fn=d~
5974rp='Installation prefix to use?'
5975. ./getfile
5976oldprefix=''
5977case "$prefix" in
5978'') ;;
5979*)
5980 case "$ans" in
5981 "$prefix") ;;
5982 *) oldprefix="$prefix";;
5983 esac
5984 ;;
5985esac
5986prefix="$ans"
5987prefixexp="$ansexp"
5988
a6d26a0d
JH
5989case "$afsroot" in
5990'') afsroot=/afs ;;
5991*) afsroot=$afsroot ;;
5992esac
5993
b4eb6b3d
JH
5994: is AFS running?
5995echo " "
5996case "$afs" in
5997$define|true) afs=true ;;
5998$undef|false) afs=false ;;
a6d26a0d 5999*) if test -d $afsroot; then
b4eb6b3d
JH
6000 afs=true
6001 else
6002 afs=false
6003 fi
6004 ;;
6005esac
6006if $afs; then
6007 echo "AFS may be running... I'll be extra cautious then..." >&4
6008else
6009 echo "AFS does not seem to be running..." >&4
6010fi
6011
6012: determine installation prefix for where package is to be installed.
6013if $afs; then
6014$cat <<EOM
6015
6016Since you are running AFS, I need to distinguish the directory in which
6017files will reside from the directory in which they are installed (and from
6018which they are presumably copied to the former directory by occult means).
6019
6020EOM
6021 case "$installprefix" in
6022 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6023 *) dflt="$installprefix";;
6024 esac
6025else
6026$cat <<EOM
6027
6028In some special cases, particularly when building $package for distribution,
6029it is convenient to distinguish between the directory in which files should
6030be installed from the directory ($prefix) in which they
6031will eventually reside. For most users, these two directories are the same.
6032
6033EOM
6034 case "$installprefix" in
6035 '') dflt=$prefix ;;
6036 *) dflt=$installprefix;;
6037 esac
6038fi
6039fn=d~
6040rp='What installation prefix should I use for installing files?'
6041. ./getfile
6042installprefix="$ans"
6043installprefixexp="$ansexp"
6044
6045: set the prefixit variable, to compute a suitable default value
6046prefixit='case "$3" in
6047""|none)
6048 case "$oldprefix" in
6049 "") eval "$1=\"\$$2\"";;
6050 *)
6051 case "$3" in
6052 "") eval "$1=";;
6053 none)
6054 eval "tp=\"\$$2\"";
6055 case "$tp" in
6056 ""|" ") eval "$1=\"\$$2\"";;
6057 *) eval "$1=";;
6058 esac;;
6059 esac;;
6060 esac;;
6061*)
6062 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6063 case "$tp" in
6064 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6065 /*-$oldprefix/*|\~*-$oldprefix/*)
6066 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6067 *) eval "$1=\"\$$2\"";;
6068 esac;;
6069esac'
6070
b4eb6b3d
JH
6071: get the patchlevel
6072echo " "
6073echo "Getting the current patchlevel..." >&4
6074if $test -r $rsrc/patchlevel.h;then
6075 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6076 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6077 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6078 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6079 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6080 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
151e6568 6081 perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
b4eb6b3d
JH
6082else
6083 revision=0
6084 patchlevel=0
6085 subversion=0
6086 api_revision=0
6087 api_version=0
6088 api_subversion=0
151e6568
MB
6089 perl_patchlevel=0
6090 $echo "(You do not have patchlevel.h. Eek.)"
b4eb6b3d 6091fi
151e6568
MB
6092if $test -r $rsrc/.patch ; then
6093 if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6094 perl_patchlevel=`cat $rsrc/.patch`
6095 fi
6096fi
861eb78d
AD
6097: Define a handy string here to avoid duplication in myconfig.SH and configpm.
6098version_patchlevel_string="version $patchlevel subversion $subversion"
151e6568 6099case "$perl_patchlevel" in
861eb78d
AD
61000|'') ;;
6101*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
151e6568 6102esac
861eb78d
AD
6103
6104$echo "(You have $package $version_patchlevel_string.)"
6105
b4eb6b3d
JH
6106case "$osname" in
6107dos|vms)
6108 : XXX Should be a Configure test for double-dots in filenames.
6109 version=`echo $revision $patchlevel $subversion | \
6110 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6111 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6112 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6113 ;;
6114*)
6115 version=`echo $revision $patchlevel $subversion | \
6116 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6117 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6118 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6119 ;;
6120esac
6121: Special case the 5.005_xx maintenance series, which used 5.005
6122: without any subversion label as a subdirectory in $sitelib
6123if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6124 api_versionstring='5.005'
6125fi
6126
6127: determine installation style
6128: For now, try to deduce it from prefix unless it is already set.
6129: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6130case "$installstyle" in
6131'') case "$prefix" in
6132 *perl*) dflt='lib';;
6133 *) dflt='lib/perl5' ;;
6134 esac
6135 ;;
6136*) dflt="$installstyle" ;;
6137esac
6138: Probably not worth prompting for this since we prompt for all
6139: the directories individually, and the prompt would be too long and
6140: confusing anyway.
6141installstyle=$dflt
6142
6143: determine where private library files go
6144: Usual default is /usr/local/lib/perl5/$version.
6145: Also allow things like /opt/perl/lib/$version, since
6146: /opt/perl/lib/perl5... would be redundant.
6147: The default "style" setting is made in installstyle.U
6148case "$installstyle" in
6149*lib/perl5*) set dflt privlib lib/$package/$version ;;
6150*) set dflt privlib lib/$version ;;
6151esac
6152eval $prefixit
6153$cat <<EOM
6154
6155There are some auxiliary files for $package that need to be put into a
6156private library directory that is accessible by everyone.
6157
6158EOM
6159fn=d~+
6160rp='Pathname where the private library files will reside?'
6161. ./getfile
6162privlib="$ans"
6163privlibexp="$ansexp"
6164: Change installation prefix, if necessary.
6165if $test X"$prefix" != X"$installprefix"; then
6166 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6167else
6168 installprivlib="$privlibexp"
6169fi
6170
6171: set the prefixup variable, to restore leading tilda escape
6172prefixup='case "$prefixexp" in
6173"$prefix") ;;
6174*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6175esac'
6176
6177: determine where public architecture dependent libraries go
6178set archlib archlib
6179eval $prefixit
6180: privlib default is /usr/local/lib/$package/$version
6181: archlib default is /usr/local/lib/$package/$version/$archname
6182: privlib may have an optional trailing /share.
6183tdflt=`echo $privlib | $sed 's,/share$,,'`
6184tdflt=$tdflt/$archname
6185case "$archlib" in
6186'') dflt=$tdflt
6187 ;;
6188*) dflt="$archlib"
6189 ;;
6190esac
6191$cat <<EOM
6192
6193$spackage contains architecture-dependent library files. If you are
6194sharing libraries in a heterogeneous environment, you might store
6195these files in a separate location. Otherwise, you can just include
6196them with the rest of the public library files.
6197
6198EOM
6199fn=d+~
6200rp='Where do you want to put the public architecture-dependent libraries?'
6201. ./getfile
6202archlib="$ans"
6203archlibexp="$ansexp"
6204if $test X"$archlib" = X"$privlib"; then
6205 d_archlib="$undef"
6206else
6207 d_archlib="$define"
6208fi
6209: Change installation prefix, if necessary.
6210if $test X"$prefix" != X"$installprefix"; then
6211 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6212else
6213 installarchlib="$archlibexp"
6214fi
6215
6216
6217: Binary compatibility with 5.005 is not possible for builds
6218: with advanced features
6219case "$usethreads$usemultiplicity" in
6220*define*)
6221 bincompat5005="$undef"
6222 d_bincompat5005="$undef"
6223 ;;
6224*) $cat <<EOM
6225
6226This version of Perl can be compiled for binary compatibility with 5.005.
6227If you decide to do so, you will be able to continue using most of the
6228extensions that were compiled for Perl 5.005.
6229
6230EOM
6231 case "$bincompat5005$d_bincompat5005" in
6232 *"$undef"*) dflt=n ;;
6233 *) dflt=y ;;
6234 esac
6235 rp='Binary compatibility with Perl 5.005?'
6236 . ./myread
6237 case "$ans" in
6238 y*) val="$define" ;;
6239 *) val="$undef" ;;
6240 esac
6241 set d_bincompat5005
6242 eval $setvar
6243 case "$d_bincompat5005" in
6244 "$define")
6245 bincompat5005="$define"
6246 ;;
6247 *) bincompat5005="$undef"
6248 d_bincompat5005="$undef"
6249 ;;
6250 esac
6251 ;;
6252esac
6253
6254
6255: see if setuid scripts can be secure
6256$cat <<EOM
6257
6258Some kernels have a bug that prevents setuid #! scripts from being
6259secure. Some sites have disabled setuid #! scripts because of this.
6260
6261First let's decide if your kernel supports secure setuid #! scripts.
6262(If setuid #! scripts would be secure but have been disabled anyway,
6263don't say that they are secure if asked.)
6264
6265EOM
6266
6267val="$undef"
6268if $test -d /dev/fd; then
6269 echo "#!$ls" >reflect
6270 chmod +x,u+s reflect
6271 ./reflect >flect 2>&1
6272 if $contains "/dev/fd" flect >/dev/null; then
6273 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6274 val="$define"
6275 else
6276 $cat <<EOM
6277If you are not sure if they are secure, I can check but I'll need a
6278username and password different from the one you are using right now.
6279If you don't have such a username or don't want me to test, simply
6280enter 'none'.
6281
6282EOM
6283 rp='Other username to test security of setuid scripts with?'
6284 dflt='none'
6285 . ./myread
6286 case "$ans" in
6287 n|none)
6288 case "$d_suidsafe" in
6289 '') echo "I'll assume setuid scripts are *not* secure." >&4
6290 dflt=n;;
6291 "$undef")
6292 echo "Well, the $hint value is *not* secure." >&4
6293 dflt=n;;
6294 *) echo "Well, the $hint value *is* secure." >&4
6295 dflt=y;;
6296 esac
c1a7f87b 6297 ;;
b4eb6b3d
JH
6298 *)
6299 $rm -f reflect flect
6300 echo "#!$ls" >reflect
6301 chmod +x,u+s reflect
6302 echo >flect
6303 chmod a+w flect
6304 echo '"su" will (probably) prompt you for '"$ans's password."
6305 su $ans -c './reflect >flect'
6306 if $contains "/dev/fd" flect >/dev/null; then
6307 echo "Okay, it looks like setuid scripts are secure." >&4
6308 dflt=y
6309 else
6310 echo "I don't think setuid scripts are secure." >&4
6311 dflt=n
6312 fi
6313 ;;
6314 esac
6315 rp='Does your kernel have *secure* setuid scripts?'
6316 . ./myread
6317 case "$ans" in
6318 [yY]*) val="$define";;
6319 *) val="$undef";;
6320 esac
6321 fi
6322else
6323 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6324 echo "(That's for file descriptors, not floppy disks.)"
6325 val="$undef"
6326fi
6327set d_suidsafe
6328eval $setvar
6329
6330$rm -f reflect flect
6331
6332: now see if they want to do setuid emulation
6333echo " "
6334val="$undef"
6335case "$d_suidsafe" in
6336"$define")
6337 val="$undef"
6338 echo "No need to emulate SUID scripts since they are secure here." >& 4
6339 ;;
6340*)
6341 $cat <<EOM
6342Some systems have disabled setuid scripts, especially systems where
6343setuid scripts cannot be secure. On systems where setuid scripts have
6344been disabled, the setuid/setgid bits on scripts are currently
6345useless. It is possible for $package to detect those bits and emulate
6346setuid/setgid in a secure fashion. This emulation will only work if
6347setuid scripts have been disabled in your kernel.
6348
6349EOM
6350 case "$d_dosuid" in
6351 "$define") dflt=y ;;
6352 *) dflt=n ;;
6353 esac
6354 rp="Do you want to do setuid/setgid emulation?"
6355 . ./myread
6356 case "$ans" in
6357 [yY]*) val="$define";;
6358 *) val="$undef";;
6359 esac
6360 ;;
6361esac
6362set d_dosuid
6363eval $setvar
6364
b4eb6b3d
JH
6365: see if this is a malloc.h system
6366set malloc.h i_malloc
6367eval $inhdr
6368
6369: see if stdlib is available
6370set stdlib.h i_stdlib
6371eval $inhdr
6372
6373: determine which malloc to compile in
6374echo " "
6375case "$usemymalloc" in
c4163172
JH
6376[yY]*|true|$define) dflt='y' ;;
6377[nN]*|false|$undef) dflt='n' ;;
6378*) case "$ptrsize" in
6379 4) dflt='y' ;;
6380 *) dflt='n' ;;
6381 esac
6382 ;;
8dfa8df9 6383esac
b4eb6b3d
JH
6384rp="Do you wish to attempt to use the malloc that comes with $package?"
6385. ./myread
6386usemymalloc="$ans"
6387case "$ans" in
6388y*|true)
6389 usemymalloc='y'
6390 mallocsrc='malloc.c'
6391 mallocobj="malloc$_o"
6392 d_mymalloc="$define"
6393 case "$libs" in
6394 *-lmalloc*)
6395 : Remove malloc from list of libraries to use
6396 echo "Removing unneeded -lmalloc from library list" >&4
6397 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6398 shift
6399 libs="$*"
6400 echo "libs = $libs" >&4
6401 ;;
6402 esac
6403 ;;
6404*)
6405 usemymalloc='n'
6406 mallocsrc=''
6407 mallocobj=''
6408 d_mymalloc="$undef"
6409 ;;
6410esac
6411
6412: compute the return types of malloc and free
6413echo " "
6414$cat >malloc.c <<END
6415#$i_malloc I_MALLOC
6416#$i_stdlib I_STDLIB
6417#include <stdio.h>
6418#include <sys/types.h>
6419#ifdef I_MALLOC
6420#include <malloc.h>
6421#endif
6422#ifdef I_STDLIB
6423#include <stdlib.h>
6424#endif
6425#ifdef TRY_MALLOC
6426void *malloc();
6427#endif
6428#ifdef TRY_FREE
6429void free();
6430#endif
6431END
6432case "$malloctype" in
6433'')
6434 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6435 malloctype='void *'
6436 else
6437 malloctype='char *'
6438 fi
6439 ;;
6440esac
6441echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6442
6443case "$freetype" in
6444'')
6445 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6446 freetype='void'
6447 else
6448 freetype='int'
6449 fi
6450 ;;
6451esac
6452echo "Your system uses $freetype free(), it would seem." >&4
6453$rm -f malloc.[co]
6454$cat <<EOM
6455
6456After $package is installed, you may wish to install various
6457add-on modules and utilities. Typically, these add-ons will
6458be installed under $prefix with the rest
6459of this package. However, you may wish to install such add-ons
6460elsewhere under a different prefix.
6461
6462If you do not wish to put everything under a single prefix, that's
6463ok. You will be prompted for the individual locations; this siteprefix
6464is only used to suggest the defaults.
6465
6466The default should be fine for most people.
6467
6468EOM
6469fn=d~+
6470rp='Installation prefix to use for add-on modules and utilities?'
6471: XXX Here might be another good place for an installstyle setting.
6472case "$siteprefix" in
6473'') dflt=$prefix ;;
6474*) dflt=$siteprefix ;;
6475esac
6476. ./getfile
6477: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6478oldsiteprefix=''
6479case "$siteprefix" in
6480'') ;;
6481*) case "$ans" in
6482 "$prefix") ;;
6483 *) oldsiteprefix="$prefix";;
6484 esac
6485 ;;
6486esac
6487siteprefix="$ans"
6488siteprefixexp="$ansexp"
6489
6490: determine where site specific libraries go.
6491: Usual default is /usr/local/lib/perl5/site_perl/$version
6492: The default "style" setting is made in installstyle.U
6493: XXX No longer works with Prefixit stuff.
6494prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6495case "$sitelib" in
6496'') case "$installstyle" in
6497 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6498 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6499 esac
6500 ;;
6501*) dflt="$sitelib"
6502 ;;
6503esac
6504$cat <<EOM
6505
6506The installation process will create a directory for
6507site-specific extensions and modules. Most users find it convenient
6508to place all site-specific files in this directory rather than in the
6509main distribution directory.
6510
6511EOM
6512fn=d~+
6513rp='Pathname for the site-specific library files?'
6514. ./getfile
6515sitelib="$ans"
6516sitelibexp="$ansexp"
6517sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6518: Change installation prefix, if necessary.
6519if $test X"$prefix" != X"$installprefix"; then
6520 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6521else
6522 installsitelib="$sitelibexp"
6523fi
6524
6525: determine where site specific architecture-dependent libraries go.
6526: sitelib default is /usr/local/lib/perl5/site_perl/$version
6527: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6528: sitelib may have an optional trailing /share.
6529case "$sitearch" in
6530'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6531 dflt="$dflt/$archname"
6532 ;;
6533*) dflt="$sitearch"
6534 ;;
6535esac
6536set sitearch sitearch none
6537eval $prefixit
6538$cat <<EOM
6539
6540The installation process will also create a directory for
6541architecture-dependent site-specific extensions and modules.
6542
6543EOM
6544fn=d~+
6545rp='Pathname for the site-specific architecture-dependent library files?'
6546. ./getfile
6547sitearch="$ans"
6548sitearchexp="$ansexp"
6549: Change installation prefix, if necessary.
6550if $test X"$prefix" != X"$installprefix"; then
6551 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6552else
6553 installsitearch="$sitearchexp"
6554fi
6555
6556$cat <<EOM
6557
6558The installation process will also create a directory for
6559vendor-supplied add-ons. Vendors who supply perl with their system
6560may find it convenient to place all vendor-supplied files in this
6561directory rather than in the main distribution directory. This will
6562ease upgrades between binary-compatible maintenance versions of perl.
6563
6564Of course you may also use these directories in whatever way you see
6565fit. For example, you might use them to access modules shared over a
6566company-wide network.
6567
6568The default answer should be fine for most people.
6569This causes further questions about vendor add-ons to be skipped
6570and no vendor-specific directories will be configured for perl.
6571
6572EOM
6573rp='Do you want to configure vendor-specific add-on directories?'
6574case "$usevendorprefix" in
6575define|true|[yY]*) dflt=y ;;
6576*) : User may have set vendorprefix directly on Configure command line.
6577 case "$vendorprefix" in
6578 ''|' ') dflt=n ;;
6579 *) dflt=y ;;
6580 esac
6581 ;;
6582esac
6583. ./myread
6584case "$ans" in
6585[yY]*) fn=d~+
6586 rp='Installation prefix to use for vendor-supplied add-ons?'
6587 case "$vendorprefix" in
6588 '') dflt='' ;;
6589 *) dflt=$vendorprefix ;;
6590 esac
6591 . ./getfile
6592 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6593 oldvendorprefix=''
6594 case "$vendorprefix" in
6595 '') ;;
6596 *) case "$ans" in
6597 "$prefix") ;;
6598 *) oldvendorprefix="$prefix";;
6599 esac
6600 ;;
6601 esac
6602 usevendorprefix="$define"
6603 vendorprefix="$ans"
6604 vendorprefixexp="$ansexp"
6605 ;;
6606*) usevendorprefix="$undef"
6607 vendorprefix=''
6608 vendorprefixexp=''
6609 ;;
6610esac
6611
6612case "$vendorprefix" in
6613'') d_vendorlib="$undef"
6614 vendorlib=''
6615 vendorlibexp=''
6616 ;;
6617*) d_vendorlib="$define"
6618 : determine where vendor-supplied modules go.
6619 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6620 case "$vendorlib" in
6621 '')
6622 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6623 case "$installstyle" in
6624 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6625 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6626 esac
6627 ;;
6628 *) dflt="$vendorlib"
6629 ;;
6630 esac
6631 fn=d~+
6632 rp='Pathname for the vendor-supplied library files?'
6633 . ./getfile
6634 vendorlib="$ans"
6635 vendorlibexp="$ansexp"
6636 ;;
6637esac
6638vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6639: Change installation prefix, if necessary.
6640if $test X"$prefix" != X"$installprefix"; then
6641 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6642else
6643 installvendorlib="$vendorlibexp"
6644fi
6645
6646case "$vendorprefix" in
6647'') d_vendorarch="$undef"
6648 vendorarch=''
6649 vendorarchexp=''
6650 ;;
6651*) d_vendorarch="$define"
6652 : determine where vendor-supplied architecture-dependent libraries go.
6653 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6654 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6655 : vendorlib may have an optional trailing /share.
6656 case "$vendorarch" in
6657 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6658 dflt="$dflt/$archname"
6659 ;;
6660 *) dflt="$vendorarch" ;;
6661 esac
6662 fn=d~+
6663 rp='Pathname for vendor-supplied architecture-dependent files?'
6664 . ./getfile
6665 vendorarch="$ans"
6666 vendorarchexp="$ansexp"
6667 ;;
6668esac
6669: Change installation prefix, if necessary.
6670if $test X"$prefix" != X"$installprefix"; then
6671 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6672else
6673 installvendorarch="$vendorarchexp"
6674fi
6675
6676: Final catch-all directories to search
6677$cat <<EOM
6678
6679Lastly, you can have perl look in other directories for extensions and
6680modules in addition to those already specified.
6681These directories will be searched after
6682 $sitearch
6683 $sitelib
6684EOM
6685test X"$vendorlib" != "X" && echo ' ' $vendorlib
6686test X"$vendorarch" != "X" && echo ' ' $vendorarch
6687echo ' '
6688case "$otherlibdirs" in
6689''|' ') dflt='none' ;;
6690*) dflt="$otherlibdirs" ;;
6691esac
6692$cat <<EOM
6693Enter a colon-separated set of extra paths to include in perl's @INC
6694search path, or enter 'none' for no extra paths.
6695
6696EOM
6697
6698rp='Colon-separated list of additional directories for perl to search?'
6699. ./myread
6700case "$ans" in
6701' '|''|none) otherlibdirs=' ' ;;
6702*) otherlibdirs="$ans" ;;
6703esac
6704case "$otherlibdirs" in
6705' ') val=$undef ;;
6706*) val=$define ;;
6707esac
6708set d_perl_otherlibdirs
6709eval $setvar
6710
6711: Cruising for prototypes
6712echo " "
6713echo "Checking out function prototypes..." >&4
6714$cat >prototype.c <<'EOCP'
6715int main(int argc, char *argv[]) {
6716 exit(0);}
6717EOCP
6718if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6719 echo "Your C compiler appears to support function prototypes."
6720 val="$define"
6721else
6722 echo "Your C compiler doesn't seem to understand function prototypes."
6723 val="$undef"
6724fi
6725set prototype
6726eval $setvar
6727$rm -f prototype*
6728
6729case "$prototype" in
6730"$define") ;;
6731*) ansi2knr='ansi2knr'
6732 echo " "
6733 cat <<EOM >&4
6734
6735$me: FATAL ERROR:
6736This version of $package can only be compiled by a compiler that
6737understands function prototypes. Unfortunately, your C compiler
6738 $cc $ccflags
6739doesn't seem to understand them. Sorry about that.
6740
6741If GNU cc is available for your system, perhaps you could try that instead.
6742
6743Eventually, we hope to support building Perl with pre-ANSI compilers.
6744If you would like to help in that effort, please contact <perlbug@perl.org>.
6745
6746Aborting Configure now.
6747EOM
6748 exit 2
6749 ;;
6750esac
6751
6752: determine where public executables go
6753echo " "
6754set dflt bin bin
6755eval $prefixit
6756fn=d~
6757rp='Pathname where the public executables will reside?'
6758. ./getfile
6759if $test "X$ansexp" != "X$binexp"; then
6760 installbin=''
6761fi
6762bin="$ans"
6763binexp="$ansexp"
6764: Change installation prefix, if necessary.
6765: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6766if $test X"$prefix" != X"$installprefix"; then
6767 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6768else
6769 installbin="$binexp"
6770fi
6771
6fcddf3b 6772echo " "
6fcddf3b 6773case "$extras" in
bf35c3f6
JH
6774'') dflt='n';;
6775*) dflt='y';;
6fcddf3b
JH
6776esac
6777cat <<EOM
6778Perl can be built with extra modules or bundles of modules which
6779will be fetched from the CPAN and installed alongside Perl.
6780
6781Notice that you will need access to the CPAN; either via the Internet,
6782or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
6783be asked later to configure the CPAN.pm module which will in turn do
6784the installation of the rest of the extra modules or bundles.)
6785
6786Notice also that if the modules require any external software such as
dd2de242
JH
6787libraries and headers (the libz library and the zlib.h header for the
6788Compress::Zlib module, for example) you MUST have any such software
6789already installed, this configuration process will NOT install such
6790things for you.
6fcddf3b
JH
6791
6792If this doesn't make any sense to you, just accept the default '$dflt'.
6793EOM
dd2de242 6794rp='Install any extra modules (y or n)?'
6fcddf3b
JH
6795. ./myread
6796case "$ans" in
6797y|Y)
6798 cat <<EOM
6799
6800Please list any extra modules or bundles to be installed from CPAN,
6801with spaces between the names. The names can be in any format the
dd2de242
JH
6802'install' command of CPAN.pm will understand. (Answer 'none',
6803without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
6804EOM
6805 rp='Extras?'
6806 dflt="$extras"
6807 . ./myread
6808 extras="$ans"
6809esac
6810case "$extras" in
6811''|'none')
6812 val=''
6813 $rm -f ../extras.lst
6814 ;;
6815*) echo "(Saving the list of extras for later...)"
dd2de242
JH
6816 echo "$extras" > ../extras.lst
6817 val="'$extras'"
6fcddf3b
JH
6818 ;;
6819esac
6820set extras
6821eval $setvar
6822echo " "
6823
b4eb6b3d
JH
6824: Find perl5.005 or later.
6825echo "Looking for a previously installed perl5.005 or later... "
6826case "$perl5" in
a938a3bb 6827'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
b4eb6b3d 6828 : Check if this perl is recent and can load a simple module
a938a3bb 6829 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
b4eb6b3d
JH
6830 perl5=$tdir/perl
6831 break;
a938a3bb
IZ
6832 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6833 perl5=$tdir/perl5
b4eb6b3d
JH
6834 break;
6835 fi
6836 done
6837 ;;
6838*) perl5="$perl5"
6839 ;;
6840esac
6841case "$perl5" in
6842'') echo "None found. That's ok.";;
6843*) echo "Using $perl5." ;;
6844esac
6845
6846: Determine list of previous versions to include in @INC
6847$cat > getverlist <<EOPL
6848#!$perl5 -w
6849use File::Basename;
6850\$api_versionstring = "$api_versionstring";
6851\$version = "$version";
6852\$stem = "$sitelib_stem";
6853\$archname = "$archname";
6854EOPL
6855 $cat >> getverlist <<'EOPL'
6856# Can't have leading @ because metaconfig interprets it as a command!
6857;@inc_version_list=();
6858# XXX Redo to do opendir/readdir?
6859if (-d $stem) {
6860 chdir($stem);
6861 ;@candidates = glob("5.*");
6862}
6863else {
6864 ;@candidates = ();
6865}
6866
6867# XXX ToDo: These comparisons must be reworked when two-digit
6868# subversions come along, so that 5.7.10 compares as greater than
6869# 5.7.3! By that time, hope that 5.6.x is sufficiently
6870# widespread that we can use the built-in version vectors rather
6871# than reinventing them here. For 5.6.0, however, we must
6872# assume this script will likely be run by 5.005_0x. --AD 1/2000.
6873foreach $d (@candidates) {
6874 if ($d lt $version) {
6875 if ($d ge $api_versionstring) {
6876 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6877 }
6878 elsif ($d ge "5.005") {
6879 unshift(@inc_version_list, grep { -d } $d);
6880 }
6881 }
6882 else {
6883 # Skip newer version. I.e. don't look in
6884 # 5.7.0 if we're installing 5.6.1.
6885 }
6886}
6887
6888if (@inc_version_list) {
6889 print join(' ', @inc_version_list);
6890}
6891else {
6892 # Blank space to preserve value for next Configure run.
6893 print " ";
6894}
6895EOPL
6896chmod +x getverlist
6897case "$inc_version_list" in
a938a3bb 6898'') if test -x "$perl5$exe_ext"; then
b4eb6b3d
JH
6899 dflt=`$perl5 getverlist`
6900 else
6901 dflt='none'
6902 fi
6903 ;;
6904$undef) dflt='none' ;;
6d1a7737 6905*) eval dflt=\"$inc_version_list\" ;;
b4eb6b3d
JH
6906esac
6907case "$dflt" in
6908''|' ') dflt=none ;;
6909esac
6910case "$dflt" in
69115.005) case "$bincompat5005" in
6912 $define|true|[yY]*) ;;
6913 *) dflt=none ;;
6914 esac
6915 ;;
6916esac
6917$cat <<'EOM'
6918
6919In order to ease the process of upgrading, this version of perl
6920can be configured to use modules built and installed with earlier
6921versions of perl that were installed under $prefix. Specify here
6922the list of earlier versions that this version of perl should check.
6923If Configure detected no earlier versions of perl installed under
6924$prefix, then the list will be empty. Answer 'none' to tell perl
6925to not search earlier versions.
6926
6927The default should almost always be sensible, so if you're not sure,
6928just accept the default.
6929EOM
6930
6931rp='List of earlier versions to include in @INC?'
6932. ./myread
6933case "$ans" in
6934[Nn]one|''|' ') inc_version_list=' ' ;;
6935*) inc_version_list="$ans" ;;
6936esac
6937case "$inc_version_list" in
6938''|' ')
6939 inc_version_list_init='0';;
6940*) inc_version_list_init=`echo $inc_version_list |
6941 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6942 ;;
6943esac
6944$rm -f getverlist
6945
6946: determine whether to install perl also as /usr/bin/perl
6947
6948echo " "
6949if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6950 $cat <<EOM
6951Many scripts expect perl to be installed as /usr/bin/perl.
6952I can install the perl you are about to compile also as /usr/bin/perl
6953(in addition to $installbin/perl).
6954EOM
6955 case "$installusrbinperl" in
6956 "$undef"|[nN]*) dflt='n';;
6957 *) dflt='y';;
6958 esac
6959 rp="Do you want to install perl as /usr/bin/perl?"
6960 . ./myread
6961 case "$ans" in
6962 [yY]*) val="$define";;
6963 *) val="$undef" ;;
6964 esac
6965else
6966 val="$undef"
6967fi
6968set installusrbinperl
6969eval $setvar
6970
6971: see if dld is available
6972set dld.h i_dld
6973eval $inhdr
6974
6975: see if dlopen exists
6976xxx_runnm="$runnm"
6977runnm=false
6978set dlopen d_dlopen
6979eval $inlibc
6980runnm="$xxx_runnm"
6981
6982: determine which dynamic loading, if any, to compile in
6983echo " "
6984dldir="ext/DynaLoader"
6985case "$usedl" in
6986$define|y|true)
6987 dflt='y'
6988 usedl="$define"
6989 ;;
6990$undef|n|false)
6991 dflt='n'
6992 usedl="$undef"
6993 ;;
6994*)
6995 dflt='n'
6996 case "$d_dlopen" in
6997 $define) dflt='y' ;;
6998 esac
6999 case "$i_dld" in
7000 $define) dflt='y' ;;
7001 esac
7002 : Does a dl_xxx.xs file exist for this operating system
7003 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7004 ;;
7005esac
7006rp="Do you wish to use dynamic loading?"
7007. ./myread
7008usedl="$ans"
7009case "$ans" in
7010y*) usedl="$define"
7011 case "$dlsrc" in
7012 '')
7013 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7014 dflt="$dldir/dl_${osname}.xs"
7015 elif $test "$d_dlopen" = "$define" ; then
7016 dflt="$dldir/dl_dlopen.xs"
7017 elif $test "$i_dld" = "$define" ; then
7018 dflt="$dldir/dl_dld.xs"
7019 else
7020 dflt=''
7021 fi
7022 ;;
7023 *) dflt="$dldir/$dlsrc"
7024 ;;
7025 esac
7026 echo "The following dynamic loading files are available:"
7027 : Can not go over to $dldir because getfile has path hard-coded in.
7028 tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
7029 rp="Source file to use for dynamic loading"
7030 fn="fne"
7031 gfpth="$src"
7032 . ./getfile
7033 usedl="$define"
7034 : emulate basename
7035 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7036
7037 $cat << EOM
7038
7039Some systems may require passing special flags to $cc -c to
7040compile modules that will be used to create a shared library.
7041To use no flags, say "none".
7042
7043EOM
7044 case "$cccdlflags" in
7045 '') case "$gccversion" in
7046 '') case "$osname" in
7047 hpux) dflt='+z' ;;
7048 next) dflt='none' ;;
7049 irix*) dflt='-KPIC' ;;
48bcfe03 7050 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7051 sunos) dflt='-pic' ;;
7052 *) dflt='none' ;;
7053 esac
7054 ;;
7055 *) case "$osname" in
b6cc0f4c 7056 darwin) dflt='none' ;;
48bcfe03 7057 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7058 *) dflt='-fpic' ;;
7059 esac ;;
7060 esac ;;
7061 ' ') dflt='none' ;;
7062 *) dflt="$cccdlflags" ;;
7063 esac
7064 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7065 . ./myread
7066 case "$ans" in
7067 none) cccdlflags=' ' ;;
7068 *) cccdlflags="$ans" ;;
7069 esac
7070
7071 cat << EOM
7072
7073Some systems use ld to create libraries that can be dynamically loaded,
7074while other systems (such as those using ELF) use $cc.
7075
7076EOM
7077 case "$ld" in
7078 '') $cat >try.c <<'EOM'
7079/* Test for whether ELF binaries are produced */
7080#include <fcntl.h>
7081#include <stdlib.h>
7082int main() {
7083 char b[4];
7084 int i = open("a.out",O_RDONLY);
7085 if(i == -1)
7086 exit(1); /* fail */
7087 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7088 exit(0); /* succeed (yes, it's ELF) */
7089 else
7090 exit(1); /* fail */
7091}
7092EOM
5440bc8e 7093 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7094 cat <<EOM
7095You appear to have ELF support. I'll use $cc to build dynamic libraries.
7096EOM
7097 dflt="$cc"
7098 else
7099 echo "I'll use ld to build dynamic libraries."
7100 dflt='ld'
7101 fi
7102 rm -f try.c a.out
7103 ;;
7104 *) dflt="$ld"
7105 ;;
7106 esac
7107
7108 rp="What command should be used to create dynamic libraries?"
7109 . ./myread
7110 ld="$ans"
7111
7112 cat << EOM
7113
7114Some systems may require passing special flags to $ld to create a
7115library that can be dynamically loaded. If your ld flags include
7116-L/other/path options to locate libraries outside your loader's normal
7117search path, you may need to specify those -L options here as well. To
7118use no flags, say "none".
7119
7120EOM
7121 case "$lddlflags" in
7122 '') case "$osname" in
7123 beos) dflt='-nostart' ;;
7124 hpux) dflt='-b';
7125 case "$gccversion" in
7126 '') dflt="$dflt +vnocompatwarnings" ;;
7127 esac
7128 ;;
7129 linux|irix*) dflt='-shared' ;;
7130 next) dflt='none' ;;
7131 solaris) dflt='-G' ;;
7132 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7133 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7134 *) dflt='none' ;;
7135 esac
7136 ;;
7137 *) dflt="$lddlflags" ;;
7138 esac
7139
7140 : Try to guess additional flags to pick up local libraries.
7141 : Be careful not to append to a plain 'none'
7142 case "$dflt" in
7143 none) dflt='' ;;
7144 esac
7145 for thisflag in $ldflags; do
7146 case "$thisflag" in
7147 -L*|-R*)
7148 case " $dflt " in
7149 *" $thisflag "*) ;;
7150 *) dflt="$dflt $thisflag" ;;
7151 esac
7152 ;;
7153 esac
7154 done
7155
7156 case "$dflt" in
7157 ''|' ') dflt='none' ;;
7158 esac
7159
7160 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7161 . ./myread
7162 case "$ans" in
7163 none) lddlflags=' ' ;;
7164 *) lddlflags="$ans" ;;
7165 esac
7166
7167 cat <<EOM
7168
7169Some systems may require passing special flags to $cc to indicate that
7170the resulting executable will use dynamic linking. To use no flags,
7171say "none".
7172
7173EOM
7174 case "$ccdlflags" in
7175 '') case "$osname" in
7176 hpux) dflt='-Wl,-E' ;;
7177 linux) dflt='-rdynamic' ;;
7178 next) dflt='none' ;;
7179 sunos) dflt='none' ;;
7180 *) dflt='none' ;;
7181 esac ;;
7182 ' ') dflt='none' ;;
7183 *) dflt="$ccdlflags" ;;
7184 esac
7185 rp="Any special flags to pass to $cc to use dynamic linking?"
7186 . ./myread
7187 case "$ans" in
7188 none) ccdlflags=' ' ;;
7189 *) ccdlflags="$ans" ;;
7190 esac
7191 ;;
7192*) usedl="$undef"
7193 ld='ld'
7194 dlsrc='dl_none.xs'
7195 lddlflags=''
7196 ccdlflags=''
7197 ;;
7198esac
7199
7200also=''
7201case "$usedl" in
7202$undef)
7203 # No dynamic loading being used, so don't bother even to prompt.
7204 useshrplib='false'
7205 ;;
7206*) case "$useshrplib" in
7207 '') case "$osname" in
48bcfe03 7208 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7209 dflt=y
7210 also='Building a shared libperl is required for dynamic loading to work on your system.'
7211 ;;
7212 next*)
7213 case "$osvers" in
7214 4*) dflt=y
7215 also='Building a shared libperl is needed for MAB support.'
7216 ;;
7217 *) dflt=n
7218 ;;
7219 esac
7220 ;;
7221 *) dflt=n
7222 ;;
7223 esac
7224 ;;
7225 $define|true|[Yy]*)
7226 dflt=y
7227 ;;
7228 *) dflt=n
7229 ;;
7230 esac
7231 $cat << EOM
7232
7233The perl executable is normally obtained by linking perlmain.c with
7234libperl${_a}, any static extensions (usually just DynaLoader), and
7235any other libraries needed on this system (such as -lm, etc.). Since
7236your system supports dynamic loading, it is probably possible to build
7237a shared libperl.$so. If you will have more than one executable linked
7238to libperl.$so, this will significantly reduce the size of each
7239executable, but it may have a noticeable affect on performance. The
7240default is probably sensible for your system.
7241$also
7242
7243EOM
7244 rp="Build a shared libperl.$so (y/n)"
7245 . ./myread
7246 case "$ans" in
7247 true|$define|[Yy]*)
7248 useshrplib='true' ;;
7249 *) useshrplib='false' ;;
7250 esac
7251 ;;
7252esac
7253
7254case "$useshrplib" in
7255true)
7256 case "$libperl" in
7257 '')
7258 # Figure out a good name for libperl.so. Since it gets stored in
7259 # a version-specific architecture-dependent library, the version
7260 # number isn't really that important, except for making cc/ld happy.
7261 #
7262 # A name such as libperl.so.3.1
7263 majmin="libperl.$so.$patchlevel.$subversion"
7264 # A name such as libperl.so.301
7265 majonly=`echo $patchlevel $subversion |
7266 $awk '{printf "%d%02d", $1, $2}'`
7267 majonly=libperl.$so.$majonly
7268 # I'd prefer to keep the os-specific stuff here to a minimum, and
7269 # rely on figuring it out from the naming of libc.
7270 case "${osname}${osvers}" in
7271 next4*)
7272 dflt=libperl.5.$so
7273 # XXX How handle the --version stuff for MAB?
7274 ;;
7275 linux*) # ld won't link with a bare -lperl otherwise.
7276 dflt=libperl.$so
7277 ;;
7278 cygwin*) # include version
7279 dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7280 ;;
7281 *) # Try to guess based on whether libc has major.minor.
7282 case "$libc" in
7283 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7284 *libc.$so.[0-9]*) dflt=$majonly ;;
7285 *) dflt=libperl.$so ;;
7286 esac
7287 ;;
7288 esac
7289 ;;
7290 *) dflt=$libperl
7291 ;;
7292 esac
7293 cat << EOM
7294
7295I need to select a good name for the shared libperl. If your system uses
7296library names with major and minor numbers, then you might want something
7297like $majmin. Alternatively, if your system uses a single version
7298number for shared libraries, then you might want to use $majonly.
7299Or, your system might be quite happy with a simple libperl.$so.
7300
7301Since the shared libperl will get installed into a version-specific
7302architecture-dependent directory, the version number of the shared perl
7303library probably isn't important, so the default should be o.k.
7304
7305EOM
7306 rp='What name do you want to give to the shared libperl?'
7307 . ./myread
7308 libperl=$ans
7309 echo "Ok, I'll use $libperl"
7310 ;;
7311*)
7312 libperl="libperl${_a}"
7313 ;;
7314esac
7315
7316# Detect old use of shrpdir via undocumented Configure -Dshrpdir
7317case "$shrpdir" in
7318'') ;;
7319*) $cat >&4 <<EOM
7320WARNING: Use of the shrpdir variable for the installation location of
7321the shared $libperl is not supported. It was never documented and
7322will not work in this version. Let me (perlbug@perl.org)
7323know of any problems this may cause.
7324
7325EOM
7326 case "$shrpdir" in
7327 "$archlibexp/CORE")
7328 $cat >&4 <<EOM
7329But your current setting of $shrpdir is
7330the default anyway, so it's harmless.
7331EOM
7332 ;;
7333 *)
7334 $cat >&4 <<EOM
7335Further, your current attempted setting of $shrpdir
7336conflicts with the value of $archlibexp/CORE
7337that installperl will use.
7338EOM
7339 ;;
7340 esac
7341 ;;
7342esac
7343
7344# How will the perl executable find the installed shared $libperl?
7345# Add $xxx to ccdlflags.
7346# If we can't figure out a command-line option, use $shrpenv to
7347# set env LD_RUN_PATH. The main perl makefile uses this.
7348shrpdir=$archlibexp/CORE
7349xxx=''
7350tmp_shrpenv=''
7351if "$useshrplib"; then
7352 case "$osname" in
7353 aix)
7354 # We'll set it in Makefile.SH...
7355 ;;
7356 solaris|netbsd)
7357 xxx="-R $shrpdir"
7358 ;;
7359 freebsd)
7360 xxx="-Wl,-R$shrpdir"
7361 ;;
7362 linux|irix*|dec_osf)
7363 xxx="-Wl,-rpath,$shrpdir"
7364 ;;
7365 next)
7366 # next doesn't like the default...
7367 ;;
7368 beos)
7369 # beos doesn't like the default, either.
7370 ;;
7371 hpux*)
7372 # hpux doesn't like the default, either.
7373 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7374 ;;
7375 *)
7376 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7377 ;;
7378 esac
7379 case "$xxx" in
7380 '') ;;
7381 *)
7382 # Only add $xxx if it isn't already in ccdlflags.
7383 case " $ccdlflags " in
7384 *" $xxx "*) ;;
7385 *) ccdlflags="$ccdlflags $xxx"
7386 cat <<EOM >&4
7387
7388Adding $xxx to the flags
7389passed to $ld so that the perl executable will find the
7390installed shared $libperl.
7391
7392EOM
7393 ;;
7394 esac
7395 ;;
7396 esac
7397fi
7398# Fix ccdlflags in AIX for building external extensions.
7399# (For building Perl itself bare -bE:perl.exp is needed,
7400# Makefile.SH takes care of this.)
7401case "$osname" in
7402aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7403esac
7404# Respect a hint or command-line value.
7405case "$shrpenv" in
7406'') shrpenv="$tmp_shrpenv" ;;
7407esac
7408case "$ldlibpthname" in
7409'') ldlibpthname=LD_LIBRARY_PATH ;;
7410none) ldlibpthname='' ;;
7411esac
7412
7413: determine where manual pages are on this system
7414echo " "
7415case "$sysman" in
7416'')
4a0a3829
SD
7417 syspath='/usr/share/man/man1 /usr/man/man1'
7418 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7419 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
7420 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7421 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7422 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7423 sysman=`./loc . /usr/man/man1 $syspath`
7424 ;;
7425esac
7426if $test -d "$sysman"; then
7427 echo "System manual is in $sysman." >&4
7428else
7429 echo "Could not find manual pages in source form." >&4
7430fi
7431
7432: determine where manual pages go
7433set man1dir man1dir none
7434eval $prefixit
7435$cat <<EOM
7436
7437$spackage has manual pages available in source form.
7438EOM
7439case "$nroff" in
7440nroff)
7441 echo "However, you don't have nroff, so they're probably useless to you."
7442 case "$man1dir" in
7443 '') man1dir="none";;
7444 esac;;
7445esac
7446echo "If you don't want the manual sources installed, answer 'none'."
7447case "$man1dir" in
7448' ') dflt=none
7449 ;;
7450'')
4a0a3829
SD
7451 lookpath="$prefixexp/share/man/man1"
7452 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
7453 lookpath="$lookpath $prefixexp/man/p_man/man1"
7454 lookpath="$lookpath $prefixexp/man/u_man/man1"
7455 lookpath="$lookpath $prefixexp/man/man.1"
7456 case "$sysman" in
7457 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7458 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7459 esac
7460 set dflt
7461 eval $prefixup
7462 ;;
7463*) dflt="$man1dir"
7464 ;;
7465esac
7466echo " "
7467fn=dn+~
7468rp="Where do the main $spackage manual pages (source) go?"
7469. ./getfile
7470if $test "X$man1direxp" != "X$ansexp"; then
7471 installman1dir=''
7472fi
7473man1dir="$ans"
7474man1direxp="$ansexp"
7475case "$man1dir" in
7476'') man1dir=' '
7477 installman1dir='';;
7478esac
7479
7480: Change installation prefix, if necessary.
7481if $test X"$prefix" != X"$installprefix"; then
7482 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7483else
7484 installman1dir="$man1direxp"
7485fi
7486
7487: What suffix to use on installed man pages
7488
7489case "$man1dir" in
7490' ')
7491 man1ext='0'
7492 ;;
7493*)
7494 rp="What suffix should be used for the main $spackage man pages?"
7495 case "$man1ext" in
7496 '') case "$man1dir" in
7497 *1) dflt=1 ;;
7498 *1p) dflt=1p ;;
7499 *1pm) dflt=1pm ;;
7500 *l) dflt=l;;
7501 *n) dflt=n;;
7502 *o) dflt=o;;
7503 *p) dflt=p;;
7504 *C) dflt=C;;
7505 *L) dflt=L;;
7506 *L1) dflt=L1;;
7507 *) dflt=1;;
7508 esac
7509 ;;
7510 *) dflt="$man1ext";;
7511 esac
7512 . ./myread
7513 man1ext="$ans"
7514 ;;
7515esac
7516
7517: see if we can have long filenames
7518echo " "
7519first=123456789abcdef
7520$rm -f $first
7521if (echo hi >$first) 2>/dev/null; then
7522 if $test -f 123456789abcde; then
7523 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
7524 val="$undef"
7525 else
7526 echo 'You can have filenames longer than 14 characters.'>&4
7527 val="$define"
7528 fi
7529else
7530 $cat <<'EOM'
7531You can't have filenames longer than 14 chars.
7532You can't even think about them!
7533EOM
7534 val="$undef"
7535fi
7536set d_flexfnam
7537eval $setvar
7538$rm -rf 123456789abcde*
7539
7540: determine where library module manual pages go
7541set man3dir man3dir none
7542eval $prefixit
7543$cat <<EOM
7544
7545$spackage has manual pages for many of the library modules.
7546EOM
7547
7548case "$nroff" in
7549nroff)
7550 $cat <<'EOM'
7551However, you don't have nroff, so they're probably useless to you.
7552EOM
7553 case "$man3dir" in
7554 '') man3dir="none";;
7555 esac;;
7556esac
7557
7558case "$d_flexfnam" in
7559undef)
7560 $cat <<'EOM'
7561However, your system can't handle the long file names like File::Basename.3.
7562EOM
7563 case "$man3dir" in
7564 '') man3dir="none";;
7565 esac;;
7566esac
7567
7568echo "If you don't want the manual sources installed, answer 'none'."
7569prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7570case "$man3dir" in
7571'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7572 if $test -d "$privlib/man/man3"; then
7573 cat <<EOM >&4
7574
7575WARNING: Previous versions of perl installed man3 pages into
7576$privlib/man/man3. This version will suggest a
7577new default of $dflt.
7578EOM
7579 tdflt=$dflt
7580 dflt='n'
7581 rp='Do you wish to preserve the old behavior?(y/n)'
7582 . ./myread
7583 case "$ans" in
7584 y*) dflt="$privlib/man/man3" ;;
7585 *) dflt=$tdflt ;;
7586 esac
7587 fi
7588 ;;
7589*) dflt="$man3dir" ;;
7590esac
7591case "$dflt" in
7592' ') dflt=none ;;
7593esac
7594echo " "
7595fn=dn+~
7596rp="Where do the $package library man pages (source) go?"
7597. ./getfile
7598man3dir="$ans"
7599man3direxp="$ansexp"
7600case "$man3dir" in
7601'') man3dir=' '
7602 installman3dir='';;
7603esac
7604
7605: Change installation prefix, if necessary.
7606if $test X"$prefix" != X"$installprefix"; then
7607 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7608else
7609 installman3dir="$man3direxp"
7610fi
7611
7612: What suffix to use on installed man pages
7613case "$man3dir" in
7614' ')
7615 man3ext='0'
7616 ;;
7617*)
7618 rp="What suffix should be used for the $package library man pages?"
7619 case "$man3ext" in
7620 '') case "$man3dir" in
7621 *3) dflt=3 ;;
7622 *3p) dflt=3p ;;
7623 *3pm) dflt=3pm ;;
7624 *l) dflt=l;;
7625 *n) dflt=n;;
7626 *o) dflt=o;;
7627 *p) dflt=p;;
7628 *C) dflt=C;;
7629 *L) dflt=L;;
7630 *L3) dflt=L3;;
7631 *) dflt=3;;
7632 esac
7633 ;;
7634 *) dflt="$man3ext";;
7635 esac
7636 . ./myread
7637 man3ext="$ans"
7638 ;;
7639esac
7640
7641: see if we have to deal with yellow pages, now NIS.
7642if $test -d /usr/etc/yp || $test -d /etc/yp; then
7643 if $test -f /usr/etc/nibindd; then
7644 echo " "
7645 echo "I'm fairly confident you're on a NeXT."
7646 echo " "
7647 rp='Do you get the hosts file via NetInfo?'
7648 dflt=y
7649 case "$hostcat" in
7650 nidump*) ;;
7651 '') ;;
7652 *) dflt=n;;
7653 esac
7654 . ./myread
7655 case "$ans" in
7656 y*) hostcat='nidump hosts .';;
7657 *) case "$hostcat" in
7658 nidump*) hostcat='';;
7659 esac
7660 ;;
7661 esac
7662 fi
7663 case "$hostcat" in
7664 nidump*) ;;
7665 *)
7666 case "$hostcat" in
7667 *ypcat*) dflt=y;;
7668 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7669 dflt=y
7670 else
7671 dflt=n
7672 fi;;
7673 *) dflt=n;;
7674 esac
7675 echo " "
7676 rp='Are you getting the hosts file via yellow pages?'
7677 . ./myread
7678 case "$ans" in
7679 y*) hostcat='ypcat hosts';;
7680 *) hostcat='cat /etc/hosts';;
7681 esac
7682 ;;
7683 esac
7684fi
7685case "$hostcat" in
7686'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7687esac
7688case "$groupcat" in
7689'') test -f /etc/group && groupcat='cat /etc/group';;
7690esac
7691case "$passcat" in
7692'') test -f /etc/passwd && passcat='cat /etc/passwd';;
7693esac
7694
7695: now get the host name
7696echo " "
7697echo "Figuring out host name..." >&4
7698case "$myhostname" in
7699'') cont=true
7700 echo 'Maybe "hostname" will work...'
73614538 7701 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
7702 myhostname=$tans
7703 phostname=hostname
7704 cont=''
7705 fi
7706 ;;
7707*) cont='';;
7708esac
7709if $test "$cont"; then
7710 if ./xenix; then
7711 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
7712 if tans=`cat /etc/systemid 2>&1` ; then
7713 myhostname=$tans
7714 phostname='cat /etc/systemid'
7715 echo "Whadyaknow. Xenix always was a bit strange..."
7716 cont=''
7717 fi
7718 elif $test -r /etc/systemid; then
7719 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7720 fi
7721fi
7722if $test "$cont"; then
7723 echo 'No, maybe "uuname -l" will work...'
73614538 7724 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
7725 myhostname=$tans
7726 phostname='uuname -l'
7727 else
7728 echo 'Strange. Maybe "uname -n" will work...'
73614538 7729 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
7730 myhostname=$tans
7731 phostname='uname -n'
7732 else
7733 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 7734 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
7735 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7736 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7737 else
7738 case "$myhostname" in
7739 '') echo "Does this machine have an identity crisis or something?"
7740 phostname='';;
7741 *)
7742 echo "Well, you said $myhostname before..."
7743 phostname='echo $myhostname';;
7744 esac
7745 fi
7746 fi
7747 fi
7748fi
7749: you do not want to know about this
7750set $myhostname
7751myhostname=$1
7752
7753: verify guess
7754if $test "$myhostname" ; then
7755 dflt=y
7756 rp='Your host name appears to be "'$myhostname'".'" Right?"
7757 . ./myread
7758 case "$ans" in
7759 y*) ;;
7760 *) myhostname='';;
7761 esac
7762fi
7763
7764: bad guess or no guess
7765while $test "X$myhostname" = X ; do
7766 dflt=''
7767 rp="Please type the (one word) name of your host:"
7768 . ./myread
7769 myhostname="$ans"
7770done
7771
7772: translate upper to lower if necessary
7773case "$myhostname" in
7774*[A-Z]*)
7775 echo "(Normalizing case in your host name)"
7776 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7777 ;;
7778esac
7779
7780case "$myhostname" in
7781*.*)
7782 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7783 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7784 echo "(Trimming domain name from host name--host name is now $myhostname)"
7785 ;;
7786*) case "$mydomain" in
7787 '')
7788 {
7789 test "X$hostcat" = "Xypcat hosts" &&
7790 ypmatch "$myhostname" hosts 2>/dev/null |\
7791 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
7792 $test -s hosts
7793 } || {
7794 test "X$hostcat" != "X" &&
7795 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
7796 /[ ]$myhostname[ . ]/p" > hosts
7797 }
7798 tmp_re="[ . ]"
f08cbdd1
PP
7799 if $test -f hosts; then
7800 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 7801 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
7802 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7803 hosts | $sort | $uniq | \
7804 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7805 case `$echo X$dflt` in
7806 X*\ *) echo "(Several hosts in the database matched hostname)"
7807 dflt=.
7808 ;;
7809 X.) echo "(You do not have fully-qualified names in the hosts database)"
7810 ;;
7811 esac
7812 else
7813 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 7814 dflt=.
f08cbdd1 7815 fi
b4eb6b3d
JH
7816 case "$dflt" in
7817 .)
7818 tans=`./loc resolv.conf X /etc /usr/etc`
7819 if $test -f "$tans"; then
7820 echo "(Attempting domain name extraction from $tans)"
7821 dflt=.`$sed -n -e 's/ / /g' \
7822 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
7823 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7824 case "$dflt" in
7825 .) dflt=.`$sed -n -e 's/ / /g' \
7826 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
7827 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7828 ;;
7829 esac
7830 fi
7831 ;;
7832 esac
7833 case "$dflt" in
7834 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 7835 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
7836 case "$dflt" in
7837 '') dflt='.';;
7838 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7839 esac
7840 ;;
7841 esac
59c9e5d6
PP
7842 case "$dflt$osname" in
7843 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 7844 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
7845 ;;
7846 esac
b4eb6b3d
JH
7847 case "$dflt" in
7848 .) echo "(Lost all hope -- silly guess then)"
7849 dflt='.uucp'
7850 ;;
7851 esac
7852 $rm -f hosts
7853 ;;
7854 *) dflt="$mydomain";;
7855 esac;;
7856esac
7857echo " "
7858rp="What is your domain name?"
7859. ./myread
7860tans="$ans"
7861case "$ans" in
7862'') ;;
7863.*) ;;
7864*) tans=".$tans";;
7865esac
7866mydomain="$tans"
7867
7868: translate upper to lower if necessary
7869case "$mydomain" in
7870*[A-Z]*)
7871 echo "(Normalizing case in your domain name)"
7872 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7873 ;;
7874esac
7875
7876: a little sanity check here
7877case "$phostname" in
7878'') ;;
7879*)
7880 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7881 $myhostname$mydomain|$myhostname) ;;
7882 *)
7883 case "$phostname" in
7884 sed*)
7885 echo "(That doesn't agree with your whoami.h file, by the way.)"
7886 ;;
7887 *)
7888 echo "(That doesn't agree with your $phostname command, by the way.)"
7889 ;;
7890 esac
7891 ;;
7892 esac
7893 ;;
7894esac
7895
7896$cat <<EOM
7897
7898I need to get your e-mail address in Internet format if possible, i.e.
7899something like user@host.domain. Please answer accurately since I have
7900no easy means to double check it. The default value provided below
7901is most probably close to reality but may not be valid from outside
7902your organization...
7903
7904EOM
7905cont=x
7906while test "$cont"; do
7907 case "$cf_email" in
7908 '') dflt="$cf_by@$myhostname$mydomain";;
7909 *) dflt="$cf_email";;
7910 esac
7911 rp='What is your e-mail address?'
7912 . ./myread
7913 cf_email="$ans"
7914 case "$cf_email" in
7915 *@*.*) cont='' ;;
7916 *)
7917 rp='Address does not look like an Internet one. Use it anyway?'
7918 case "$fastread" in
7919 yes) dflt=y ;;
7920 *) dflt=n ;;
7921 esac
7922 . ./myread
7923 case "$ans" in
7924 y*) cont='' ;;
7925 *) echo " " ;;
7926 esac
7927 ;;
7928 esac
7929done
7930
7931$cat <<EOM
7932
7933If you or somebody else will be maintaining perl at your site, please
7934fill in the correct e-mail address here so that they may be contacted
7935if necessary. Currently, the "perlbug" program included with perl
7936will send mail to this address in addition to perlbug@perl.org. You may
7937enter "none" for no administrator.
7938
7939EOM
7940case "$perladmin" in
7941'') dflt="$cf_email";;
7942*) dflt="$perladmin";;
7943esac
7944rp='Perl administrator e-mail address'
7945. ./myread
7946perladmin="$ans"
7947
674912d7
RB
7948: determine whether to only install version-specific parts.
7949echo " "
7950$cat <<EOM
7951Do you want to install only the version-specific parts of the perl
7952distribution? Usually you do *not* want to do this.
7953EOM
7954case "$versiononly" in
7955"$define"|[Yy]*|true) dflt='y' ;;
7956*) dflt='n';
7957esac
7958rp="Do you want to install only the version-specific parts of perl?"
7959. ./myread
7960case "$ans" in
7961[yY]*) val="$define";;
7962*) val="$undef" ;;
7963esac
7964set versiononly
7965eval $setvar
7966
b4eb6b3d
JH
7967: figure out how to guarantee perl startup
7968case "$startperl" in
7969'')
7970 case "$sharpbang" in
7971 *!)
7972 $cat <<EOH
7973
7974I can use the #! construct to start perl on your system. This will
7975make startup of perl scripts faster, but may cause problems if you
7976want to share those scripts and perl is not in a standard place
7977($binexp/perl) on all your platforms. The alternative is to force
7978a shell by starting the script with a single ':' character.
7979
7980EOH
674912d7
RB
7981 case "$versiononly" in
7982 "$define") dflt="$binexp/perl$version";;
7983 *) dflt="$binexp/perl";;
7984 esac
b4eb6b3d
JH
7985 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7986 . ./myread
7987 case "$ans" in
7988 none) startperl=": # use perl";;
7989 *) startperl="#!$ans"
7990 if $test 30 -lt `echo "$ans" | wc -c`; then
7991 $cat >&4 <<EOM
7992
7993WARNING: Some systems limit the #! command to 32 characters.
7994If you experience difficulty running Perl scripts with #!, try
7995installing Perl in a directory with a shorter pathname.
7996
7997EOM
7998 fi ;;
7999 esac
8000 ;;
8001 *) startperl=": # use perl"
8002 ;;
8003 esac
8004 ;;
8005esac
8006echo "I'll use $startperl to start perl scripts."
8007
8008: figure best path for perl in scripts
8009case "$perlpath" in
8010'')
8011 perlpath="$binexp/perl"
8012 case "$startperl" in
8013 *!*) ;;
8014 *)
8015 $cat <<EOH
8016
8017I will use the "eval 'exec'" idiom to start Perl on your system.
8018I can use the full path of your Perl binary for this purpose, but
8019doing so may cause problems if you want to share those scripts and
8020Perl is not always in a standard place ($binexp/perl).
8021
8022EOH
8023 dflt="$binexp/perl"
8024 rp="What path shall I use in \"eval 'exec'\"?"
8025 . ./myread
8026 perlpath="$ans"
8027 ;;
8028 esac
8029 ;;
8030esac
8031case "$startperl" in
8032*!*) ;;
8033*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8034esac
8035
8036: determine where public executable scripts go
8037set scriptdir scriptdir
8038eval $prefixit
8039case "$scriptdir" in
8040'')
8041 dflt="$bin"
8042 : guess some guesses
8043 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8044 $test -d /usr/share/bin && dflt=/usr/share/bin
8045 $test -d /usr/local/script && dflt=/usr/local/script
8046 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8047 $test -d $prefixexp/script && dflt=$prefixexp/script
8048 set dflt
8049 eval $prefixup
8050 ;;
8051*) dflt="$scriptdir"
8052 ;;
8053esac
8054$cat <<EOM
8055
8056Some installations have a separate directory just for executable scripts so
8057that they can mount it across multiple architectures but keep the scripts in
8058one spot. You might, for example, have a subdirectory of /usr/share for this.
8059Or you might just lump your scripts in with all your other executables.
8060
8061EOM
8062fn=d~
8063rp='Where do you keep publicly executable scripts?'
8064. ./getfile
8065if $test "X$ansexp" != "X$scriptdirexp"; then
8066 installscript=''
8067fi
8068scriptdir="$ans"
8069scriptdirexp="$ansexp"
8070: Change installation prefix, if necessary.
8071if $test X"$prefix" != X"$installprefix"; then
8072 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8073else
8074 installscript="$scriptdirexp"
8075fi
8076
8077: determine where add-on public executables go
8078case "$sitebin" in
8079'') dflt=$siteprefix/bin ;;
8080*) dflt=$sitebin ;;
8081esac
8082fn=d~
8083rp='Pathname where the add-on public executables should be installed?'
8084. ./getfile
8085sitebin="$ans"
8086sitebinexp="$ansexp"
8087: Change installation prefix, if necessary.
8088if $test X"$prefix" != X"$installprefix"; then
8089 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8090else
8091 installsitebin="$sitebinexp"
8092fi
8093
96056487
JH
8094: define an is-a-typedef? function
8095typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8096case "$inclist" in
8097"") inclist="sys/types.h";;
8098esac;
8099eval "varval=\$$var";
8100case "$varval" in
8101"")
8102 $rm -f temp.c;
8103 for inc in $inclist; do
8104 echo "#include <$inc>" >>temp.c;
8105 done;
8106 echo "#ifdef $type" >> temp.c;
8107 echo "printf(\"We have $type\");" >> temp.c;
8108 echo "#endif" >> temp.c;
8109 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8110 if $contains $type temp.E >/dev/null 2>&1; then
8111 eval "$var=\$type";
8112 else
8113 eval "$var=\$def";
8114 fi;
8115 $rm -f temp.?;;
8116*) eval "$var=\$varval";;
8117esac'
8118
8119: define an is-a-typedef? function that prompts if the type is not available.
8120typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8121case "$inclist" in
8122"") inclist="sys/types.h";;
8123esac;
8124eval "varval=\$$var";
8125case "$varval" in
8126"")
8127 $rm -f temp.c;
8128 for inc in $inclist; do
8129 echo "#include <$inc>" >>temp.c;
8130 done;
8131 echo "#ifdef $type" >> temp.c;
8132 echo "printf(\"We have $type\");" >> temp.c;
8133 echo "#endif" >> temp.c;
8134 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8135 echo " " ;
8136 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8137 if $contains $type temp.E >/dev/null 2>&1; then
8138 echo "$type found." >&4;
8139 eval "$var=\$type";
8140 else
8141 echo "$type NOT found." >&4;
8142 dflt="$def";
8143 . ./myread ;
8144 eval "$var=\$ans";
8145 fi;
8146 $rm -f temp.?;;
8147*) eval "$var=\$varval";;
8148esac'
8149
8150: see what type lseek is declared as in the kernel
8151rp="What is the type used for lseek's offset on this system?"
8152set off_t lseektype long stdio.h sys/types.h
8153eval $typedef_ask
8154
8155echo " "
8156echo "Checking to see how big your file offsets are..." >&4
8157$cat >try.c <<EOCP
8158#include <sys/types.h>
8159#include <stdio.h>
8160int main()
8161{
8162 printf("%d\n", (int)sizeof($lseektype));
8163 return(0);
8164}
8165EOCP
8166set try
8167if eval $compile_ok; then
8168 lseeksize=`$run ./try`
8169 echo "Your file offsets are $lseeksize bytes long."
8170else
8171 dflt=$longsize
8172 echo " "
8173 echo "(I can't seem to compile the test program. Guessing...)"
8174 rp="What is the size of your file offsets (in bytes)?"
8175 . ./myread
8176 lseeksize="$ans"
8177fi
8178$rm -f try.c try
8179
8180: see what type file positions are declared as in the library
8181rp="What is the type for file position used by fsetpos()?"
8182set fpos_t fpostype long stdio.h sys/types.h
8183eval $typedef_ask
8184
8185echo " "
8186case "$fpostype" in
8187*_t) zzz="$fpostype" ;;
8188*) zzz="fpos_t" ;;
8189esac
8190echo "Checking the size of $zzz..." >&4
8191cat > try.c <<EOCP
8192#include <sys/types.h>
8193#include <stdio.h>
8194int main() {
8195 printf("%d\n", (int)sizeof($fpostype));
8196 exit(0);
8197}
8198EOCP
8199set try
8200if eval $compile_ok; then
8201 yyy=`$run ./try`
8202 case "$yyy" in
8203 '') fpossize=4
8204 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8205 ;;
8206 *) fpossize=$yyy
8207 echo "Your $zzz is $fpossize bytes long."
8208 ;;
8209 esac
8210else
8211 dflt="$longsize"
8212 echo " " >&4
8213 echo "(I can't compile the test program. Guessing...)" >&4
8214 rp="What is the size of your file positions (in bytes)?"
8215 . ./myread
8216 fpossize="$ans"
8217fi
8218
8219
8220
8221# Backward compatibility (uselfs is deprecated).
8222case "$uselfs" in
8223"$define"|true|[yY]*)
8224 cat <<EOM >&4
8225
8226*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8227EOM
8228 uselargefiles="$define"
8229 ;;
8230esac
8231
8232case "$lseeksize:$fpossize" in
82338:8) cat <<EOM
8234
8235You can have files larger than 2 gigabytes.
8236EOM
8237 val="$define" ;;
8238*) case "$uselargefiles" in
8239 "$undef"|false|[nN]*) dflt='n' ;;
8240 *) dflt='y' ;;
8241 esac
8242 cat <<EOM
8243
8244Perl can be built to understand large files (files larger than 2 gigabytes)
8245on some systems. To do so, Configure can be run with -Duselargefiles.
8246
8247If this doesn't make any sense to you, just accept the default '$dflt'.
8248EOM
8249 rp='Try to understand large files, if available?'
8250 . ./myread
8251 case "$ans" in
8252 y|Y) val="$define" ;;
8253 *) val="$undef" ;;
8254 esac
8255 ;;
8256esac
8257set uselargefiles
8258eval $setvar
8259case "$uselargefiles" in
8260"$define")
8261: Look for a hint-file generated 'call-back-unit'. If the
8262: user has specified that a large files perl is to be built,
8263: we may need to set or change some other defaults.
8264 if $test -f uselargefiles.cbu; then
8265 echo "Your platform has some specific hints for large file builds, using them..."
8266 . ./uselargefiles.cbu
8267 echo " "
8268 echo "Rechecking to see how big your file offsets are..." >&4
8269 $cat >try.c <<EOCP
8270#include <sys/types.h>
8271#include <stdio.h>
8272int main()
8273{
8274 printf("%d\n", (int)sizeof($lseektype));
8275 return(0);
8276}
8277EOCP
8278 set try
8279 if eval $compile_ok; then
8280 lseeksize=`$run ./try`
8281 $echo "Your file offsets are now $lseeksize bytes long."
8282 else
8283 dflt="$lseeksize"
8284 echo " "
8285 echo "(I can't seem to compile the test program. Guessing...)"
8286 rp="What is the size of your file offsets (in bytes)?"
8287 . ./myread
8288 lseeksize="$ans"
8289 fi
8290 case "$fpostype" in
8291 *_t) zzz="$fpostype" ;;
8292 *) zzz="fpos_t" ;;
8293 esac
8294 $echo $n "Rechecking the size of $zzz...$c" >&4
8295 $cat > try.c <<EOCP
8296#include <sys/types.h>
8297#include <stdio.h>
8298int main() {
8299 printf("%d\n", (int)sizeof($fpostype));
8300 exit(0);
8301}
8302EOCP
8303 set try
8304 if eval $compile_ok; then
8305 yyy=`$run ./try`
8306 dflt="$lseeksize"
8307 case "$yyy" in
8308 '') echo " "
8309 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8310 ;;
8311 *) fpossize=$yyy
8312 echo " $fpossize bytes." >&4
8313 ;;
8314 esac
8315 else
8316 dflt="$fpossize"
8317 echo " "
8318 echo "(I can't compile the test program. Guessing...)" >&4
8319 rp="What is the size of your file positions (in bytes)?"
8320 . ./myread
8321 fpossize="$ans"
8322 fi
8323 $rm -f try.c try
8324 fi
8325 ;;
8326esac
8327
b4eb6b3d
JH
8328case "$vendorprefix" in
8329'') d_vendorbin="$undef"
8330 vendorbin=''
8331 vendorbinexp=''
8332 ;;
8333*) d_vendorbin="$define"
8334 : determine where vendor-supplied executables go.
8335 case "$vendorbin" in
8336 '') dflt=$vendorprefix/bin ;;
8337 *) dflt="$vendorbin" ;;
8338 esac
8339 fn=d~+
8340 rp='Pathname for the vendor-supplied executables directory?'
8341 . ./getfile
8342 vendorbin="$ans"
8343 vendorbinexp="$ansexp"
8344 ;;
8345esac
8346: Change installation prefix, if necessary.
8347if $test X"$prefix" != X"$installprefix"; then
8348 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8349else
8350 installvendorbin="$vendorbinexp"
8351fi
8352
8353: see if qgcvt exists
8354set qgcvt d_qgcvt
8355eval $inlibc
8356
8357echo " "
8358
8359if $test X"$d_longdbl" = X"$define"; then
8360
8361echo "Checking how to print long doubles..." >&4
8362
8363if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
8364 $cat >try.c <<'EOCP'
8365#include <sys/types.h>
8366#include <stdio.h>
8367int main() {
8368 double d = 123.456;
8369 printf("%.3f\n", d);
8370}
8371EOCP
8372 set try
8373 if eval $compile; then
5440bc8e 8374 yyy=`$run ./try`
b4eb6b3d
JH
8375 case "$yyy" in
8376 123.456)
8377 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
8378 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
8379 echo "We will use %f."
8380 ;;
8381 esac
8382 fi
8383fi
8384
8385if $test X"$sPRIfldbl" = X; then
8386 $cat >try.c <<'EOCP'
8387#include <sys/types.h>
8388#include <stdio.h>
8389int main() {
8390 long double d = 123.456;
2ef53570 8391 printf("%.3Lf\n", d);
b4eb6b3d
JH
8392}
8393EOCP
8394 set try
8395 if eval $compile; then
5440bc8e 8396 yyy=`$run ./try`
b4eb6b3d
JH
8397 case "$yyy" in
8398 123.456)
2ef53570
JH
8399 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8400 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8401 echo "We will use %Lf."
b4eb6b3d
JH
8402 ;;
8403 esac
8404 fi
8405fi
8406
8407if $test X"$sPRIfldbl" = X; then
8408 $cat >try.c <<'EOCP'
8409#include <sys/types.h>
8410#include <stdio.h>
8411int main() {
8412 long double d = 123.456;
2ef53570 8413 printf("%.3llf\n", d);
b4eb6b3d
JH
8414}
8415EOCP
8416 set try
8417 if eval $compile; then
5440bc8e 8418 yyy=`$run ./try`
b4eb6b3d
JH
8419 case "$yyy" in
8420 123.456)
2ef53570
JH
8421 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8422 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8423 echo "We will use %llf."
b4eb6b3d
JH
8424 ;;
8425 esac
8426 fi
8427fi
8428
8429if $test X"$sPRIfldbl" = X; then
8430 $cat >try.c <<'EOCP'
8431#include <sys/types.h>
8432#include <stdio.h>
8433int main() {
8434 long double d = 123.456;
8435 printf("%.3lf\n", d);
8436}
8437EOCP
8438 set try
8439 if eval $compile; then
5440bc8e 8440 yyy=`$run ./try`
b4eb6b3d
JH
8441 case "$yyy" in
8442 123.456)
8443 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8444 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8445 echo "We will use %lf."
8446 ;;
8447 esac
8448 fi
8449fi
8450
8451if $test X"$sPRIfldbl" = X; then
8452 echo "Cannot figure out how to print long doubles." >&4
8453else
8454 sSCNfldbl=$sPRIfldbl # expect consistency
8455fi
8456
8457$rm -f try try.*
8458
8459fi # d_longdbl
8460
8461case "$sPRIfldbl" in
8462'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
8463 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
8464 d_SCNfldbl="$undef";
8465 ;;
8466*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
8467 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
8468 d_SCNfldbl="$define";
8469 ;;
8470esac
8471
8472: Check how to convert floats to strings.
8473echo " "
8474echo "Checking for an efficient way to convert floats to strings."
8475echo " " > try.c
8476case "$uselongdouble" in
8477"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8478esac
8479case "$d_longdbl" in
8480"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8481esac
8482case "$d_PRIgldbl" in
8483"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
8484esac
8485$cat >>try.c <<EOP
8486#ifdef TRY_gconvert
8487#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8488char *myname = "gconvert";
8489#endif
8490#ifdef TRY_gcvt
8491#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8492char *myname = "gcvt";
8493#endif
8494#ifdef TRY_qgcvt
8495#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8496char *myname = "qgcvt";
8497#define DOUBLETYPE long double
8498#endif
8499#ifdef TRY_sprintf
8500#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8501#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8502#else
8503#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8504#endif
8505char *myname = "sprintf";
8506#endif
8507
8508#ifndef DOUBLETYPE
8509#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8510#define DOUBLETYPE long double
8511#else
8512#define DOUBLETYPE double
8513#endif
8514#endif
8515
8516#include <stdio.h>
8517
8518#define I_STDLIB $i_stdlib
8519#ifdef I_STDLIB
8520#include <stdlib.h>
8521#endif
8522
8523int
8524checkit(expect, got)
8525char *expect;
8526char *got;
8527{
8528 if (strcmp(expect, got)) {
8529 printf("%s oddity: Expected %s, got %s\n",
8530 myname, expect, got);
8531 exit(1);
8532 }
8533}
8534
8535int main()
8536{
8537 char buf[64];
8538 buf[63] = '\0';
8539
8540 /* This must be 1st test on (which?) platform */
8541 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8542 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8543 checkit("0.1", buf);
8544
8545 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
8546 checkit("1", buf);
8547
8548 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
8549 checkit("1.1", buf);
8550
8551 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
8552 checkit("1.01", buf);
8553
8554 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
8555 checkit("1.001", buf);
8556
8557 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
8558 checkit("1.0001", buf);
8559
8560 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
8561 checkit("1.00001", buf);
8562
8563 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
8564 checkit("1.000001", buf);
8565
8566 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
8567 checkit("0", buf);
8568
8569 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
8570 checkit("-1", buf);
8571
8572 /* Some Linux gcvt's give 1.e+5 here. */
8573 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
8574 checkit("100000", buf);
8575
8576 /* Some Linux gcvt's give -1.e+5 here. */
8577 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
8578 checkit("-100000", buf);
8579
8580 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
8581 checkit("123.456", buf);
8582
8e2a5ede
SB
8583 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8584 Gconvert((DOUBLETYPE)1e30, 8, 0, buf);
8585 if (strlen(buf) > 5)
8586 checkit("1e+030", buf); /* for Microsoft */
8587 else
8588 checkit("1e+30", buf);
8589
b4eb6b3d
JH
8590 exit(0);
8591}
8592EOP
8593case "$d_Gconvert" in
8594gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8595gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8596sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8597*) xxx_list='gconvert gcvt sprintf' ;;
8598esac
8599
8600case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8601"$define$define$define")
8602 # for long doubles prefer first qgcvt, then sprintf
8603 xxx_list="`echo $xxx_list|sed s/sprintf//`"
8604 xxx_list="sprintf $xxx_list"
8605 case "$d_qgcvt" in
8606 "$define") xxx_list="qgcvt $xxx_list" ;;
8607 esac
8608 ;;
8609esac
8610
8611for xxx_convert in $xxx_list; do
8612 echo "Trying $xxx_convert..."
8613 $rm -f try try$_o
8614 set try -DTRY_$xxx_convert
8615 if eval $compile; then
8616 echo "$xxx_convert() found." >&4
5440bc8e 8617 if $run ./try; then
b4eb6b3d
JH
8618 echo "I'll use $xxx_convert to convert floats into a string." >&4
8619 break;
8620 else
8621 echo "...But $xxx_convert didn't work as I expected."
8622 fi
8623 else
8624 echo "$xxx_convert NOT found." >&4
8625 fi
8626done
8627
8628case "$xxx_convert" in
8629gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8630gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8631qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8632*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8633 "$define$define$define")
8634 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8635 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8636 esac
8637 ;;
8638esac
8639
74cac757
JH
8640: see if _fwalk exists
8641set fwalk d__fwalk
8642eval $inlibc
8643
b4eb6b3d
JH
8644: Initialize h_fcntl
8645h_fcntl=false
8646
8647: Initialize h_sysfile
8648h_sysfile=false
8649
8650: access call always available on UNIX
8651set access d_access
8652eval $inlibc
8653
8654: locate the flags for 'access()'
8655case "$d_access" in
8656"$define")
8657 echo " "
8658 $cat >access.c <<'EOCP'
8659#include <sys/types.h>
8660#ifdef I_FCNTL
8661#include <fcntl.h>
8662#endif
8663#ifdef I_SYS_FILE
8664#include <sys/file.h>
8665#endif
8666#ifdef I_UNISTD
8667#include <unistd.h>
8668#endif
8669int main() {
8670 exit(R_OK);
8671}
8672EOCP
8673 : check sys/file.h first, no particular reason here
8674 if $test `./findhdr sys/file.h` && \
7a282f6d 8675 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
8676 h_sysfile=true;
8677 echo "<sys/file.h> defines the *_OK access constants." >&4
8678 elif $test `./findhdr fcntl.h` && \
7a282f6d 8679 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
8680 h_fcntl=true;
8681 echo "<fcntl.h> defines the *_OK access constants." >&4
8682 elif $test `./findhdr unistd.h` && \
7a282f6d 8683 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
8684 echo "<unistd.h> defines the *_OK access constants." >&4
8685 else
8686 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8687 fi
8688 ;;
8689esac
8690$rm -f access*
8691
8692: see if accessx exists
8693set accessx d_accessx
8694eval $inlibc
8695
8696: see if alarm exists
8697set alarm d_alarm
8698eval $inlibc
8699
8700: see if atolf exists
8701set atolf d_atolf
8702eval $inlibc
8703
8704: see if atoll exists
8705set atoll d_atoll
8706eval $inlibc
8707
8708: Look for GNU-cc style attribute checking
8709echo " "
8710echo "Checking whether your compiler can handle __attribute__ ..." >&4
8711$cat >attrib.c <<'EOCP'
8712#include <stdio.h>
8713void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8714EOCP
8715if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8716 if $contains 'warning' attrib.out >/dev/null 2>&1; then
8717 echo "Your C compiler doesn't fully support __attribute__."
8718 val="$undef"
8719 else
8720 echo "Your C compiler supports __attribute__."
8721 val="$define"
8722 fi
8723else
8724 echo "Your C compiler doesn't seem to understand __attribute__ at all."
8725 val="$undef"
8726fi
8727set d_attribut
8728eval $setvar
8729$rm -f attrib*
8730
8731: see if bcmp exists
8732set bcmp d_bcmp
8733eval $inlibc
8734
8735: see if bcopy exists
8736set bcopy d_bcopy
8737eval $inlibc
8738
8739: see if this is a unistd.h system
8740set unistd.h i_unistd
8741eval $inhdr
8742
8743: see if getpgrp exists
8744set getpgrp d_getpgrp
8745eval $inlibc
8746
8747case "$d_getpgrp" in
8748"$define")
8749 echo " "
8750 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 8751 $cat >try.c <<EOP
b4eb6b3d
JH
8752#$i_unistd I_UNISTD
8753#include <sys/types.h>
8754#ifdef I_UNISTD
8755# include <unistd.h>
8756#endif
8757int main()
8758{
8759 if (getuid() == 0) {
8760 printf("(I see you are running Configure as super-user...)\n");
8761 setuid(1);
8762 }
8763#ifdef TRY_BSD_PGRP
8764 if (getpgrp(1) == 0)
8765 exit(0);
8766#else
8767 if (getpgrp() > 0)
8768 exit(0);
8769#endif
8770 exit(1);
8771}
8772EOP
5440bc8e 8773 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
8774 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8775 val="$define"
5440bc8e 8776 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
8777 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8778 val="$undef"
8779 else
8780 echo "I can't seem to compile and run the test program."
8781 if ./usg; then
8782 xxx="a USG one, i.e. you use getpgrp()."
8783 else
8784 # SVR4 systems can appear rather BSD-ish.
8785 case "$i_unistd" in
8786 $undef)
8787 xxx="a BSD one, i.e. you use getpgrp(pid)."
8788 val="$define"
8789 ;;
8790 $define)
8791 xxx="probably a USG one, i.e. you use getpgrp()."
8792 val="$undef"
8793 ;;
8794 esac
8795 fi
8796 echo "Assuming your getpgrp is $xxx" >&4
8797 fi
8798 ;;
8799*) val="$undef";;
8800esac
8801set d_bsdgetpgrp
8802eval $setvar
5440bc8e 8803$rm -f try try.*
b4eb6b3d
JH
8804
8805: see if setpgrp exists
8806set setpgrp d_setpgrp
8807eval $inlibc
8808
8809case "$d_setpgrp" in
8810"$define")
8811 echo " "
8812 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 8813 $cat >try.c <<EOP
b4eb6b3d
JH
8814#$i_unistd I_UNISTD
8815#include <sys/types.h>
8816#ifdef I_UNISTD
8817# include <unistd.h>
8818#endif
8819int main()
8820{
8821 if (getuid() == 0) {
8822 printf("(I see you are running Configure as super-user...)\n");
8823 setuid(1);
8824 }
8825#ifdef TRY_BSD_PGRP
8826 if (-1 == setpgrp(1, 1))
8827 exit(0);
8828#else
8829 if (setpgrp() != -1)
8830 exit(0);
8831#endif
8832 exit(1);
8833}
8834EOP
5440bc8e 8835 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
8836 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8837 val="$define"
5440bc8e 8838 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
8839 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8840 val="$undef"
8841 else
8842 echo "(I can't seem to compile and run the test program.)"
8843 if ./usg; then
8844 xxx="a USG one, i.e. you use setpgrp()."
8845 else
8846 # SVR4 systems can appear rather BSD-ish.
8847 case "$i_unistd" in
8848 $undef)
8849 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8850 val="$define"
8851 ;;
8852 $define)
8853 xxx="probably a USG one, i.e. you use setpgrp()."
8854 val="$undef"
8855 ;;
8856 esac
8857 fi
8858 echo "Assuming your setpgrp is $xxx" >&4
8859 fi
8860 ;;
8861*) val="$undef";;
8862esac
8863set d_bsdsetpgrp
8864eval $setvar
5440bc8e 8865$rm -f try try.*
b4eb6b3d
JH
8866: see if bzero exists
8867set bzero d_bzero
8868eval $inlibc
8869
8870: see if signal is declared as pointer to function returning int or void
8871echo " "
8872xxx=`./findhdr signal.h`
8873$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8874if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
8875 echo "You have int (*signal())() instead of void." >&4
8876 val="$undef"
8877elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
8878 echo "You have void (*signal())()." >&4
8879 val="$define"
8880elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8881 echo "You have int (*signal())() instead of void." >&4
8882 val="$undef"
8883elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8884 echo "You have void (*signal())()." >&4
8885 val="$define"
8886else
8887 case "$d_voidsig" in
8888 '')
8889 echo "I can't determine whether signal handler returns void or int..." >&4
8890 dflt=void
8891 rp="What type does your signal handler return?"
8892 . ./myread
8893 case "$ans" in
8894 v*) val="$define";;
8895 *) val="$undef";;
8896 esac;;
8897 "$define")
8898 echo "As you already told me, signal handler returns void." >&4
8899 val="$define"
8900 ;;
8901 *) echo "As you already told me, signal handler returns int." >&4
8902 val="$undef"
8903 ;;
8904 esac
8905fi
8906set d_voidsig
8907eval $setvar
8908case "$d_voidsig" in
8909"$define") signal_t="void";;
8910*) signal_t="int";;
8911esac
8912$rm -f $$.tmp
8913
8914: check for ability to cast large floats to 32-bit ints.
8915echo " "
8916echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8917if $test "$intsize" -ge 4; then
8918 xxx=int
8919else
8920 xxx=long
8921fi
8922$cat >try.c <<EOCP
8923#include <stdio.h>
8924#include <sys/types.h>
8925#include <signal.h>
8926$signal_t blech(s) int s; { exit(3); }
8927int main()
8928{
8929 $xxx i32;
8930 double f, g;
8931 int result = 0;
8932 char str[16];
8933 signal(SIGFPE, blech);
8934
8935 /* Don't let compiler optimize the test away. Store the number
8936 in a writable string for gcc to pass to sscanf under HP/UX.
8937 */
8938 sprintf(str, "2147483647");
8939 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8940 g = 10 * f;
8941 i32 = ($xxx) g;
8942
8943 /* x86 processors will probably give 0x8000 0000, which is a
8944 sign change. We don't want that. We want to mimic SPARC
8945 behavior here, which is to preserve the sign and give
8946 back 0x7fff ffff.
8947 */
8948 if (i32 != ($xxx) f)
8949 result |= 1;
8950 exit(result);
8951}
8952EOCP
8953set try
8954if eval $compile_ok; then
5440bc8e 8955 $run ./try
b4eb6b3d
JH
8956 yyy=$?
8957else
8958 echo "(I can't seem to compile the test program--assuming it can't)"
8959 yyy=1
8960fi
8961case "$yyy" in
89620) val="$define"
8963 echo "Yup, it can."
8964 ;;
8965*) val="$undef"
8966 echo "Nope, it can't."
8967 ;;
8968esac
8969set d_casti32
8970eval $setvar
8971$rm -f try try.*
8972
8973: check for ability to cast negative floats to unsigned
8974echo " "
8975echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8976$cat >try.c <<EOCP
8977#include <stdio.h>
8978#include <sys/types.h>
8979#include <signal.h>
8980$signal_t blech(s) int s; { exit(7); }
8981$signal_t blech_in_list(s) int s; { exit(4); }
8982unsigned long dummy_long(p) unsigned long p; { return p; }
8983unsigned int dummy_int(p) unsigned int p; { return p; }
8984unsigned short dummy_short(p) unsigned short p; { return p; }
8985int main()
8986{
8987 double f;
8988 unsigned long along;
8989 unsigned int aint;
8990 unsigned short ashort;
8991 int result = 0;
8992 char str[16];
8993
8994 /* Frustrate gcc-2.7.2's optimizer which failed this test with
8995 a direct f = -123. assignment. gcc-2.8.0 reportedly
8996 optimized the whole file away
8997 */
8998 /* Store the number in a writable string for gcc to pass to
8999 sscanf under HP/UX.
9000 */
9001 sprintf(str, "-123");
9002 sscanf(str, "%lf", &f); /* f = -123.; */
9003
9004 signal(SIGFPE, blech);
9005 along = (unsigned long)f;
9006 aint = (unsigned int)f;
9007 ashort = (unsigned short)f;
9008 if (along != (unsigned long)-123)
9009 result |= 1;
9010 if (aint != (unsigned int)-123)
9011 result |= 1;
9012 if (ashort != (unsigned short)-123)
9013 result |= 1;
9014 sprintf(str, "1073741824.");
9015 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9016 f = f + f;
9017 along = 0;
9018 along = (unsigned long)f;
9019 if (along != 0x80000000)
9020 result |= 2;
9021 f -= 1.;
9022 along = 0;
9023 along = (unsigned long)f;
9024 if (along != 0x7fffffff)
9025 result |= 1;
9026 f += 2.;
9027 along = 0;
9028 along = (unsigned long)f;
9029 if (along != 0x80000001)
9030 result |= 2;
9031 if (result)
9032 exit(result);
9033 signal(SIGFPE, blech_in_list);
9034 sprintf(str, "123.");
9035 sscanf(str, "%lf", &f); /* f = 123.; */
9036 along = dummy_long((unsigned long)f);
9037 aint = dummy_int((unsigned int)f);
9038 ashort = dummy_short((unsigned short)f);
9039 if (along != (unsigned long)123)
9040 result |= 4;
9041 if (aint != (unsigned int)123)
9042 result |= 4;
9043 if (ashort != (unsigned short)123)
9044 result |= 4;
9045 exit(result);
9046
9047}
9048EOCP
9049set try
9050if eval $compile_ok; then
5440bc8e 9051 $run ./try
b4eb6b3d
JH
9052 castflags=$?
9053else
9054 echo "(I can't seem to compile the test program--assuming it can't)"
9055 castflags=7
9056fi
9057case "$castflags" in
90580) val="$define"
9059 echo "Yup, it can."
9060 ;;
9061*) val="$undef"
9062 echo "Nope, it can't."
9063 ;;
9064esac
9065set d_castneg
9066eval $setvar
9067$rm -f try.*
9068
9069: see if vprintf exists
9070echo " "
9071if set vprintf val -f d_vprintf; eval $csym; $val; then
9072 echo 'vprintf() found.' >&4
9073 val="$define"
5440bc8e 9074 $cat >try.c <<'EOF'
b4eb6b3d
JH
9075#include <varargs.h>
9076
9077int main() { xxx("foo"); }
9078
9079xxx(va_alist)
9080va_dcl
9081{
9082 va_list args;
9083 char buf[10];
9084
9085 va_start(args);
9086 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9087}
9088EOF
5440bc8e
JH
9089 set try
9090 if eval $compile && $run ./try; then
b4eb6b3d
JH
9091 echo "Your vsprintf() returns (int)." >&4
9092 val2="$undef"
9093 else
9094 echo "Your vsprintf() returns (char*)." >&4
9095 val2="$define"
9096 fi
9097else
9098 echo 'vprintf() NOT found.' >&4
9099 val="$undef"
9100 val2="$undef"
9101fi
5440bc8e 9102$rm -f try try.*
b4eb6b3d
JH
9103set d_vprintf
9104eval $setvar
9105val=$val2
9106set d_charvspr
9107eval $setvar
9108
9109: see if chown exists
9110set chown d_chown
9111eval $inlibc
9112
9113: see if chroot exists
9114set chroot d_chroot
9115eval $inlibc
9116
9117: see if chsize exists
9118set chsize d_chsize
9119eval $inlibc
9120
758a5d79
JH
9121: see if class exists
9122set class d_class
9123eval $inlibc
9124
4e0554ec
JH
9125hasstruct='varname=$1; struct=$2; shift; shift;
9126while $test $# -ge 2; do
9127 case "$1" in
9128 $define) echo "#include <$2>";;
9129 esac ;
9130 shift 2;
9131done > try.c;
9132echo "int main () { struct $struct foo; }" >> try.c;
9133set try;
9134if eval $compile; then
9135 val="$define";
9136else
9137 val="$undef";
9138fi;
9139set $varname;
9140eval $setvar;
9141$rm -f try.c try.o'
9142
9143: see if sys/types.h has to be included
9144set sys/types.h i_systypes
9145eval $inhdr
9146
9147hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9148while $test $# -ge 2; do
9149 case "$1" in
9150 $define) echo "#include <$2>";;
9151 esac ;
9152 shift 2;
9153done > try.c;
9154echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9155set try;
9156if eval $compile; then
9157 val="$define";
9158else
9159 val="$undef";
9160fi;
9161set $varname;
9162eval $setvar;
9163$rm -f try.c try.o'
9164
9165socketlib=''
9166sockethdr=''
9167: see whether socket exists
9168echo " "
9169$echo $n "Hmm... $c" >&4
9170if set socket val -f d_socket; eval $csym; $val; then
9171 echo "Looks like you have Berkeley networking support." >&4
9172 d_socket="$define"
9173 if set setsockopt val -f; eval $csym; $val; then
9174 d_oldsock="$undef"
9175 else
9176 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9177 d_oldsock="$define"
9178 fi
9179else
9180 if $contains socklib libc.list >/dev/null 2>&1; then
9181 echo "Looks like you have Berkeley networking support." >&4
9182 d_socket="$define"
9183 : we will have to assume that it supports the 4.2 BSD interface
9184 d_oldsock="$undef"
9185 else
9186 echo "You don't have Berkeley networking in libc$_a..." >&4
9187 if test "X$d_socket" = "X$define"; then
9188 echo "...but you seem to believe that you have sockets." >&4
9189 else
9190 for net in net socket
9191 do
9192 if test -f /usr/lib/lib$net$_a; then
9193 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
9194 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9195 if $contains socket libc.list >/dev/null 2>&1; then
9196 d_socket="$define"
9197 socketlib="-l$net"
9198 case "$net" in
9199 net)
9200 echo "...but the Wollongong group seems to have hacked it in." >&4
9201 sockethdr="-I/usr/netinclude"
9202 ;;
9203 esac
9204 echo "Found Berkeley sockets interface in lib$net." >& 4
9205 if $contains setsockopt libc.list >/dev/null 2>&1; then
9206 d_oldsock="$undef"
9207 else
9208 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9209 d_oldsock="$define"
9210 fi
9211 break
9212 fi
9213 fi
9214 done
9215 if test "X$d_socket" != "X$define"; then
9216 echo "or anywhere else I see." >&4
9217 d_socket="$undef"
9218 d_oldsock="$undef"
9219 fi
9220 fi
9221 fi
9222fi
9223
9224: see if socketpair exists
9225set socketpair d_sockpair
9226eval $inlibc
9227
9228
9229echo " "
9230echo "Checking the availability of certain socket constants..." >& 4
9231for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9232 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9233 $cat >try.c <<EOF
9234#include <sys/types.h>
9235#include <sys/socket.h>
9236int main() {
9237 int i = $ENUM;
9238}
9239EOF
9240 val="$undef"
9241 set try; if eval $compile; then
9242 val="$define"
9243 fi
9244 set d_${enum}; eval $setvar
9245 $rm -f try.c try
9246done
9247
9248: see if this is a sys/uio.h system
9249set sys/uio.h i_sysuio
9250eval $inhdr
9251
9252
9253echo " "
9254echo "Checking to see if your system supports struct cmsghdr..." >&4
9255set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9256eval $hasstruct
9257case "$d_cmsghdr_s" in
9258"$define") echo "Yes, it does." ;;
9259*) echo "No, it doesn't." ;;
9260esac
9261
9262
b4eb6b3d
JH
9263: check for const keyword
9264echo " "
9265echo 'Checking to see if your C compiler knows about "const"...' >&4
9266$cat >const.c <<'EOCP'
9267typedef struct spug { int drokk; } spug;
9268int main()
9269{
9270 const char *foo;
9271 const spug y;
9272}
9273EOCP
9274if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9275 val="$define"
9276 echo "Yup, it does."
9277else
9278 val="$undef"
9279 echo "Nope, it doesn't."
9280fi
9281set d_const
9282eval $setvar
9283
9284: see if crypt exists
9285echo " "
9286if set crypt val -f d_crypt; eval $csym; $val; then
9287 echo 'crypt() found.' >&4
9288 val="$define"
9289 cryptlib=''
9290else
9291 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9292 if $test -z "$cryptlib"; then
9293 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9294 else
9295 cryptlib=-lcrypt
9296 fi
9297 if $test -z "$cryptlib"; then
9298 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9299 else
9300 cryptlib=-lcrypt
9301 fi
9302 if $test -z "$cryptlib"; then
9303 cryptlib=`./loc libcrypt$_a "" $libpth`
9304 else
9305 cryptlib=-lcrypt
9306 fi
9307 if $test -z "$cryptlib"; then
9308 echo 'crypt() NOT found.' >&4
9309 val="$undef"
9310 else
9311 val="$define"
9312 fi
9313fi
9314set d_crypt
9315eval $setvar
9316
9317: get csh whereabouts
9318case "$csh" in
9319'csh') val="$undef" ;;
9320*) val="$define" ;;
9321esac
9322set d_csh
9323eval $setvar
9324: Respect a hint or command line value for full_csh.
9325case "$full_csh" in
9326'') full_csh=$csh ;;
9327esac
9328
9329: see if cuserid exists
9330set cuserid d_cuserid
9331eval $inlibc
9332
9333: see if this is a limits.h system
9334set limits.h i_limits
9335eval $inhdr
9336
9337: see if this is a float.h system
9338set float.h i_float
9339eval $inhdr
9340
9341: See if number of significant digits in a double precision number is known
9342echo " "
9343$cat >dbl_dig.c <<EOM
9344#$i_limits I_LIMITS
9345#$i_float I_FLOAT
9346#ifdef I_LIMITS
9347#include <limits.h>
9348#endif
9349#ifdef I_FLOAT
9350#include <float.h>
9351#endif
9352#ifdef DBL_DIG
9353printf("Contains DBL_DIG");
9354#endif
9355EOM
9356$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
9357if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
9358 echo "DBL_DIG found." >&4
9359 val="$define"
9360else
9361 echo "DBL_DIG NOT found." >&4
9362 val="$undef"
9363fi
9364$rm -f dbl_dig.?
9365set d_dbl_dig
9366eval $setvar
9367
2ef53570
JH
9368hasproto='varname=$1; func=$2; shift; shift;
9369while $test $# -ge 2; do
9370 case "$1" in
9371 $define) echo "#include <$2>";;
9372 esac ;
9373 shift 2;
9374done > try.c;
9375$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9376if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9377 echo "$func() prototype found.";
9378 val="$define";
9379else
9380 echo "$func() prototype NOT found.";
9381 val="$undef";
9382fi;
9383set $varname;
9384eval $setvar;
9385$rm -f try.c tryout.c'
9386
9387: see if dbm.h is available
9388: see if dbmclose exists
9389set dbmclose d_dbmclose
9390eval $inlibc
9391
9392case "$d_dbmclose" in
9393$define)
9394 set dbm.h i_dbm
9395 eval $inhdr
9396 case "$i_dbm" in
9397 $define)
9398 val="$undef"
9399 set i_rpcsvcdbm
9400 eval $setvar
9401 ;;
9402 *) set rpcsvc/dbm.h i_rpcsvcdbm
9403 eval $inhdr
9404 ;;
9405 esac
9406 ;;
9407*) echo "We won't be including <dbm.h>"
9408 val="$undef"
9409 set i_dbm
9410 eval $setvar
9411 val="$undef"
9412 set i_rpcsvcdbm
9413 eval $setvar
9414 ;;
9415esac
9416
9417: see if prototype for dbminit is available
9418echo " "
9419set d_dbminitproto dbminit $i_dbm dbm.h
9420eval $hasproto
9421
b4eb6b3d
JH
9422: see if difftime exists
9423set difftime d_difftime
9424eval $inlibc
9425
9426: see if this is a dirent system
9427echo " "
9428if xinc=`./findhdr dirent.h`; $test "$xinc"; then
9429 val="$define"
9430 echo "<dirent.h> found." >&4
9431else
9432 val="$undef"
9433 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
9434 echo "<sys/dir.h> found." >&4
9435 echo " "
9436 else
9437 xinc=`./findhdr sys/ndir.h`
9438 fi
9439 echo "<dirent.h> NOT found." >&4
9440fi
9441set i_dirent
9442eval $setvar
9443
9444: Look for type of directory structure.
9445echo " "
9446$cppstdin $cppflags $cppminus < "$xinc" > try.c
9447
9448case "$direntrytype" in
9449''|' ')
9450 case "$i_dirent" in
9451 $define) guess1='struct dirent' ;;
9452 *) guess1='struct direct' ;;
9453 esac
9454 ;;
9455*) guess1="$direntrytype"
9456 ;;
9457esac
9458
9459case "$guess1" in
9460'struct dirent') guess2='struct direct' ;;
9461*) guess2='struct dirent' ;;
9462esac
9463
9464if $contains "$guess1" try.c >/dev/null 2>&1; then
9465 direntrytype="$guess1"
9466 echo "Your directory entries are $direntrytype." >&4
9467elif $contains "$guess2" try.c >/dev/null 2>&1; then
9468 direntrytype="$guess2"
9469 echo "Your directory entries seem to be $direntrytype." >&4
9470else
9471 echo "I don't recognize your system's directory entries." >&4
9472 rp="What type is used for directory entries on this system?"
9473 dflt="$guess1"
9474 . ./myread
9475 direntrytype="$ans"
9476fi
9477$rm -f try.c
9478
9479
9480: see if the directory entry stores field length
9481echo " "
9482$cppstdin $cppflags $cppminus < "$xinc" > try.c
9483if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9484 echo "Good, your directory entry keeps length information in d_namlen." >&4
9485 val="$define"
9486else
9487 echo "Your directory entry does not know about the d_namlen field." >&4
9488 val="$undef"
9489fi
9490set d_dirnamlen
9491eval $setvar
9492$rm -f try.c
9493
9494: see if dlerror exists
9495xxx_runnm="$runnm"
9496runnm=false
9497set dlerror d_dlerror
9498eval $inlibc
9499runnm="$xxx_runnm"
9500
9501: see if dlfcn is available
9502set dlfcn.h i_dlfcn
9503eval $inhdr
9504
9505case "$usedl" in
9506$define|y|true)
9507 $cat << EOM
9508
9509On a few systems, the dynamically loaded modules that perl generates and uses
9510will need a different extension than shared libs. The default will probably
9511be appropriate.
9512
9513EOM
9514 case "$dlext" in
9515 '') dflt="$so" ;;
9516 *) dflt="$dlext" ;;
9517 esac
9518 rp='What is the extension of dynamically loaded modules'
9519 . ./myread
9520 dlext="$ans"
9521 ;;
9522*)
9523 dlext="none"
9524 ;;
9525esac
9526
9527: Check if dlsym need a leading underscore
9528echo " "
9529val="$undef"
9530
9531case "$dlsrc" in
9532dl_dlopen.xs)
9533 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9534 $cat >dyna.c <<'EOM'
9535fred () { }
9536EOM
9537
9538$cat >fred.c<<EOM
9539
9540#include <stdio.h>
9541#$i_dlfcn I_DLFCN
9542#ifdef I_DLFCN
5440bc8e 9543#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
9544#else
9545#include <sys/types.h>
9546#include <nlist.h>
9547#include <link.h>
9548#endif
9549
9550extern int fred() ;
9551
9552int main()
9553{
9554 void * handle ;
9555 void * symbol ;
9556#ifndef RTLD_LAZY
9557 int mode = 1 ;
9558#else
9559 int mode = RTLD_LAZY ;
9560#endif
9561 handle = dlopen("./dyna.$dlext", mode) ;
9562 if (handle == NULL) {
9563 printf ("1\n") ;
9564 fflush (stdout) ;
9565 exit(0);
9566 }
9567 symbol = dlsym(handle, "fred") ;
9568 if (symbol == NULL) {
9569 /* try putting a leading underscore */
9570 symbol = dlsym(handle, "_fred") ;
9571 if (symbol == NULL) {
9572 printf ("2\n") ;
9573 fflush (stdout) ;
9574 exit(0);
9575 }
9576 printf ("3\n") ;
9577 }
9578 else
9579 printf ("4\n") ;
9580 fflush (stdout) ;
9581 exit(0);
9582}
9583EOM
9584 : Call the object file tmp-dyna.o in case dlext=o.
9585 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
9586 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 9587 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
9588 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
9589 xxx=`$run ./fred`
b4eb6b3d
JH
9590 case $xxx in
9591 1) echo "Test program failed using dlopen." >&4
9592 echo "Perhaps you should not use dynamic loading." >&4;;
9593 2) echo "Test program failed using dlsym." >&4
9594 echo "Perhaps you should not use dynamic loading." >&4;;
9595 3) echo "dlsym needs a leading underscore" >&4
9596 val="$define" ;;
9597 4) echo "dlsym doesn't need a leading underscore." >&4;;
9598 esac
9599 else
9600 echo "I can't compile and run the test program." >&4
9601 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9602 fi
9603 ;;
9604esac
9605
9606$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
9607
9608set d_dlsymun
9609eval $setvar
9610
b4eb6b3d
JH
9611: see if prototype for drand48 is available
9612echo " "
9613set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9614eval $hasproto
9615
9616: see if dup2 exists
9617set dup2 d_dup2
9618eval $inlibc
9619
9620: see if eaccess exists
9621set eaccess d_eaccess
9622eval $inlibc
9623
9624: see if endgrent exists
9625set endgrent d_endgrent
9626eval $inlibc
9627
9628: see if endhostent exists
9629set endhostent d_endhent
9630eval $inlibc
9631
9632: see if endnetent exists
9633set endnetent d_endnent
9634eval $inlibc
9635
9636: see if endprotoent exists
9637set endprotoent d_endpent
9638eval $inlibc
9639
9640: see if endpwent exists
9641set endpwent d_endpwent
9642eval $inlibc
9643
9644: see if endservent exists
9645set endservent d_endsent
9646eval $inlibc
9647
9648: Locate the flags for 'open()'
9649echo " "
5440bc8e 9650$cat >try.c <<'EOCP'
b4eb6b3d
JH
9651#include <sys/types.h>
9652#ifdef I_FCNTL
9653#include <fcntl.h>
9654#endif
9655#ifdef I_SYS_FILE
9656#include <sys/file.h>
9657#endif
9658int main() {
9659 if(O_RDONLY);
9660#ifdef O_TRUNC
9661 exit(0);
9662#else
9663 exit(1);
9664#endif
9665}
9666EOCP
9667: check sys/file.h first to get FREAD on Sun
9668if $test `./findhdr sys/file.h` && \
5440bc8e 9669 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
9670 h_sysfile=true;
9671 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 9672 if $run ./try; then
b4eb6b3d
JH
9673 echo "and you have the 3 argument form of open()." >&4
9674 val="$define"
9675 else
9676 echo "but not the 3 argument form of open(). Oh, well." >&4
9677 val="$undef"
9678 fi
9679elif $test `./findhdr fcntl.h` && \
5440bc8e 9680 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
9681 h_fcntl=true;
9682 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 9683 if $run ./try; then
b4eb6b3d
JH
9684 echo "and you have the 3 argument form of open()." >&4
9685 val="$define"
9686 else
9687 echo "but not the 3 argument form of open(). Oh, well." >&4
9688 val="$undef"
9689 fi
9690else
9691 val="$undef"
9692 echo "I can't find the O_* constant definitions! You got problems." >&4
9693fi
9694set d_open3
9695eval $setvar
5440bc8e 9696$rm -f try try.*
b4eb6b3d
JH
9697
9698: see which of string.h or strings.h is needed
9699echo " "
9700strings=`./findhdr string.h`
9701if $test "$strings" && $test -r "$strings"; then
9702 echo "Using <string.h> instead of <strings.h>." >&4
9703 val="$define"
9704else
9705 val="$undef"
9706 strings=`./findhdr strings.h`
9707 if $test "$strings" && $test -r "$strings"; then
9708 echo "Using <strings.h> instead of <string.h>." >&4
9709 else
9710 echo "No string header found -- You'll surely have problems." >&4
9711 fi
9712fi
9713set i_string
9714eval $setvar
9715case "$i_string" in
9716"$undef") strings=`./findhdr strings.h`;;
9717*) strings=`./findhdr string.h`;;
9718esac
9719
9720: check for non-blocking I/O stuff
9721case "$h_sysfile" in
a0acbdc3
JH
9722true) echo "#include <sys/file.h>" > head.c;;
9723*)
9724 case "$h_fcntl" in
9725 true) echo "#include <fcntl.h>" > head.c;;
9726 *) echo "#include <sys/fcntl.h>" > head.c;;
9727 esac
9728 ;;
b4eb6b3d
JH
9729esac
9730echo " "
9731echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9732case "$o_nonblock" in
9733'')
9734 $cat head.c > try.c
9735 $cat >>try.c <<'EOCP'
9736#include <stdio.h>
80b3ef99 9737#include <stdlib.h>
b4eb6b3d
JH
9738int main() {
9739#ifdef O_NONBLOCK
9740 printf("O_NONBLOCK\n");
9741 exit(0);
9742#endif
9743#ifdef O_NDELAY
9744 printf("O_NDELAY\n");
9745 exit(0);
9746#endif
9747#ifdef FNDELAY
9748 printf("FNDELAY\n");
9749 exit(0);
9750#endif
9751 exit(0);
9752}
9753EOCP
9754 set try
9755 if eval $compile_ok; then
5440bc8e 9756 o_nonblock=`$run ./try`
b4eb6b3d
JH
9757 case "$o_nonblock" in
9758 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9759 *) echo "Seems like we can use $o_nonblock.";;
9760 esac
9761 else
9762 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9763 fi
9764 ;;
9765*) echo "Using $hint value $o_nonblock.";;
9766esac
9767$rm -f try try.* .out core
9768
9769echo " "
9770echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9771case "$eagain" in
9772'')
9773 $cat head.c > try.c
9774 $cat >>try.c <<EOCP
9775#include <errno.h>
9776#include <sys/types.h>
9777#include <signal.h>
9778#include <stdio.h>
80b3ef99 9779#include <stdlib.h>
b4eb6b3d
JH
9780#define MY_O_NONBLOCK $o_nonblock
9781#ifndef errno /* XXX need better Configure test */
9782extern int errno;
9783#endif
9784#$i_unistd I_UNISTD
9785#ifdef I_UNISTD
9786#include <unistd.h>
9787#endif
9788#$i_string I_STRING
9789#ifdef I_STRING
9790#include <string.h>
9791#else
9792#include <strings.h>
9793#endif
9794$signal_t blech(x) int x; { exit(3); }
9795EOCP
9796 $cat >> try.c <<'EOCP'
9797int main()
9798{
9799 int pd[2];
9800 int pu[2];
9801 char buf[1];
9802 char string[100];
9803
9804 pipe(pd); /* Down: child -> parent */
9805 pipe(pu); /* Up: parent -> child */
9806 if (0 != fork()) {
9807 int ret;
9808 close(pd[1]); /* Parent reads from pd[0] */
9809 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 9810#ifdef F_SETFL
b4eb6b3d
JH
9811 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
9812 exit(1);
a0acbdc3
JH
9813#else
9814 exit(4);
9815#endif
b4eb6b3d
JH
9816 signal(SIGALRM, blech);
9817 alarm(5);
9818 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
9819 exit(2);
9820 sprintf(string, "%d\n", ret);
9821 write(2, string, strlen(string));
9822 alarm(0);
9823#ifdef EAGAIN
9824 if (errno == EAGAIN) {
9825 printf("EAGAIN\n");
9826 goto ok;
9827 }
9828#endif
9829#ifdef EWOULDBLOCK
9830 if (errno == EWOULDBLOCK)
9831 printf("EWOULDBLOCK\n");
9832#endif
9833 ok:
9834 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
9835 sleep(2); /* Give it time to close our pipe */
9836 alarm(5);
9837 ret = read(pd[0], buf, 1); /* Should read EOF */
9838 alarm(0);
9839 sprintf(string, "%d\n", ret);
9840 write(3, string, strlen(string));
9841 exit(0);
9842 }
9843
9844 close(pd[0]); /* We write to pd[1] */
9845 close(pu[1]); /* We read from pu[0] */
9846 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
9847 close(pd[1]); /* Pipe pd is now fully closed! */
9848 exit(0); /* Bye bye, thank you for playing! */
9849}
9850EOCP
9851 set try
9852 if eval $compile_ok; then
9853 echo "$startsh" >mtry
5440bc8e 9854 echo "$run ./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
b4eb6b3d
JH
9855 chmod +x mtry
9856 ./mtry >/dev/null 2>&1
9857 case $? in
9858 0) eagain=`$cat try.out`;;
9859 1) echo "Could not perform non-blocking setting!";;
9860 2) echo "I did a successful read() for something that was not there!";;
9861 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 9862 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
9863 *) echo "Something terribly wrong happened during testing.";;
9864 esac
9865 rd_nodata=`$cat try.ret`
9866 echo "A read() system call with no data present returns $rd_nodata."
9867 case "$rd_nodata" in
9868 0|-1) ;;
9869 *)
9870 echo "(That's peculiar, fixing that to be -1.)"
9871 rd_nodata=-1
9872 ;;
9873 esac
9874 case "$eagain" in
9875 '')
9876 echo "Forcing errno EAGAIN on read() with no data available."
9877 eagain=EAGAIN
9878 ;;
9879 *)
9880 echo "Your read() sets errno to $eagain when no data is available."
9881 ;;
9882 esac
9883 status=`$cat try.err`
9884 case "$status" in
9885 0) echo "And it correctly returns 0 to signal EOF.";;
9886 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
9887 *) echo "However, your read() returns '$status' on EOF??";;
9888 esac
9889 val="$define"
9890 if test "$status" = "$rd_nodata"; then
9891 echo "WARNING: you can't distinguish between EOF and no data!"
9892 val="$undef"
9893 fi
9894 else
9895 echo "I can't compile the test program--assuming errno EAGAIN will do."
9896 eagain=EAGAIN
9897 fi
9898 set d_eofnblk
9899 eval $setvar
9900 ;;
9901*)
9902 echo "Using $hint value $eagain."
9903 echo "Your read() returns $rd_nodata when no data is present."
9904 case "$d_eofnblk" in
9905 "$define") echo "And you can see EOF because read() returns 0.";;
9906 "$undef") echo "But you can't see EOF status from read() returned value.";;
9907 *)
9908 echo "(Assuming you can't see EOF status from read anyway.)"
9909 d_eofnblk=$undef
9910 ;;
9911 esac
9912 ;;
9913esac
9914$rm -f try try.* .out core head.c mtry
9915
b363b713
JH
9916: see if fchdir exists
9917set fchdir d_fchdir
9918eval $inlibc
9919
b4eb6b3d
JH
9920: see if fchmod exists
9921set fchmod d_fchmod
9922eval $inlibc
9923
9924: see if fchown exists
9925set fchown d_fchown
9926eval $inlibc
9927
9928: see if this is an fcntl system
9929set fcntl d_fcntl
9930eval $inlibc
9931
9d9004a9
AD
9932echo " "
9933: See if fcntl-based locking works.
832492ee 9934$cat >try.c <<EOCP
9d9004a9
AD
9935#include <stdlib.h>
9936#include <unistd.h>
9937#include <fcntl.h>
832492ee 9938#include <signal.h>
832492ee 9939$signal_t blech(x) int x; { exit(3); }
9d9004a9
AD
9940int main() {
9941#if defined(F_SETLK) && defined(F_SETLKW)
9942 struct flock flock;
9943 int retval, fd;
9944 fd = open("try.c", O_RDONLY);
9945 flock.l_type = F_RDLCK;
9946 flock.l_whence = SEEK_SET;
9947 flock.l_start = flock.l_len = 0;
832492ee
JH
9948 signal(SIGALRM, blech);
9949 alarm(10);
9d9004a9
AD
9950 retval = fcntl(fd, F_SETLK, &flock);
9951 close(fd);
9952 (retval < 0 ? exit(2) : exit(0));
9953#else
9954 exit(2);
9955#endif
9956}
9957EOCP
9958echo "Checking if fcntl-based file locking works... "
9959case "$d_fcntl" in
9960"$define")
9961 set try
9962 if eval $compile_ok; then
5440bc8e 9963 if $run ./try; then
9d9004a9
AD
9964 echo "Yes, it seems to work."
9965 val="$define"
9966 else
9967 echo "Nope, it didn't work."
9968 val="$undef"
832492ee
JH
9969 case "$?" in
9970 3) $cat >&4 <<EOM
9971***
9972*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
9973*** This is (almost) impossible.
9974*** If your NFS lock daemons are not feeling well, something like
9975*** this may happen, please investigate. Cannot continue, aborting.
9976***
9977EOM
9978 exit 1
9979 ;;
9980 esac
9d9004a9
AD
9981 fi
9982 else
9983 echo "I'm unable to compile the test program, so I'll assume not."
9984 val="$undef"
9985 fi
9986 ;;
9987*) val="$undef";
9988 echo "Nope, since you don't even have fcntl()."
9989 ;;
9990esac
9991set d_fcntl_can_lock
9992eval $setvar
9993$rm -f try*
9994
9995
b4eb6b3d
JH
9996: see if sys/select.h has to be included
9997set sys/select.h i_sysselct
9998eval $inhdr
9999
10000: see if we should include time.h, sys/time.h, or both
10001echo " "
10002if test "X$timeincl" = X; then
10003 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10004 $echo $n "I'm now running the test program...$c"
10005 $cat >try.c <<'EOCP'
10006#include <sys/types.h>
10007#ifdef I_TIME
10008#include <time.h>
10009#endif
10010#ifdef I_SYSTIME
10011#ifdef SYSTIMEKERNEL
10012#define KERNEL
10013#endif
10014#include <sys/time.h>
10015#endif
10016#ifdef I_SYSSELECT
10017#include <sys/select.h>
10018#endif
10019int main()
10020{
10021 struct tm foo;
10022#ifdef S_TIMEVAL
10023 struct timeval bar;
10024#endif
10025#ifdef S_TIMEZONE
10026 struct timezone tzp;
10027#endif
10028 if (foo.tm_sec == foo.tm_sec)
10029 exit(0);
10030#ifdef S_TIMEVAL
10031 if (bar.tv_sec == bar.tv_sec)
10032 exit(0);
10033#endif
10034 exit(1);
10035}
10036EOCP
10037 flags=''
10038 for s_timezone in '-DS_TIMEZONE' ''; do
10039 sysselect=''
10040 for s_timeval in '-DS_TIMEVAL' ''; do
10041 for i_systimek in '' '-DSYSTIMEKERNEL'; do
10042 for i_time in '' '-DI_TIME'; do
10043 for i_systime in '-DI_SYSTIME' ''; do
10044 case "$flags" in
10045 '') $echo $n ".$c"
10046 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10047 if eval $compile; then
10048 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10049 shift
10050 flags="$*"
10051 echo " "
10052 $echo $n "Succeeded with $flags$c"
10053 fi
10054 ;;
10055 esac
10056 done
10057 done
10058 done
10059 done
10060 done
10061 timeincl=''
10062 echo " "
10063 case "$flags" in
10064 *SYSTIMEKERNEL*) i_systimek="$define"
10065 timeincl=`./findhdr sys/time.h`
10066 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10067 *) i_systimek="$undef";;
10068 esac
10069 case "$flags" in
10070 *I_TIME*) i_time="$define"
10071 timeincl=`./findhdr time.h`" $timeincl"
10072 echo "We'll include <time.h>." >&4;;
10073 *) i_time="$undef";;
10074 esac
10075 case "$flags" in
10076 *I_SYSTIME*) i_systime="$define"
10077 timeincl=`./findhdr sys/time.h`" $timeincl"
10078 echo "We'll include <sys/time.h>." >&4;;
10079 *) i_systime="$undef";;
10080 esac
10081 $rm -f try.c try
10082fi
10083
10084: check for fd_set items
10085$cat <<EOM
10086
10087Checking to see how well your C compiler handles fd_set and friends ...
10088EOM
5440bc8e 10089$cat >try.c <<EOCP
b4eb6b3d
JH
10090#$i_systime I_SYS_TIME
10091#$i_sysselct I_SYS_SELECT
10092#$d_socket HAS_SOCKET
10093#include <sys/types.h>
10094#ifdef HAS_SOCKET
10095#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
10096#endif
10097#ifdef I_SYS_TIME
10098#include <sys/time.h>
10099#endif
10100#ifdef I_SYS_SELECT
10101#include <sys/select.h>
10102#endif
10103int main() {
10104 fd_set fds;
10105
10106#ifdef TRYBITS
10107 if(fds.fds_bits);
10108#endif
10109
10110#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
10111 exit(0);
10112#else
10113 exit(1);
10114#endif
10115}
10116EOCP
5440bc8e 10117set try -DTRYBITS
b4eb6b3d
JH
10118if eval $compile; then
10119 d_fds_bits="$define"
10120 d_fd_set="$define"
10121 echo "Well, your system knows about the normal fd_set typedef..." >&4
5440bc8e 10122 if $run ./try; then
b4eb6b3d
JH
10123 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
10124 d_fd_macros="$define"
10125 else
10126 $cat >&4 <<'EOM'
10127but not the normal fd_set macros! Gaaack! I'll have to cover for you.
10128EOM
10129 d_fd_macros="$undef"
10130 fi
10131else
10132 $cat <<'EOM'
10133Hmm, your compiler has some difficulty with fd_set. Checking further...
10134EOM
5440bc8e 10135 set try
b4eb6b3d
JH
10136 if eval $compile; then
10137 d_fds_bits="$undef"
10138 d_fd_set="$define"
10139 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 10140 if $run ./try; then
b4eb6b3d
JH
10141 echo "and you have the normal fd_set macros." >&4
10142 d_fd_macros="$define"
10143 else
10144 $cat <<'EOM'
10145but not the normal fd_set macros! Gross! More work for me...
10146EOM
10147 d_fd_macros="$undef"
10148 fi
10149 else
10150 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
10151 d_fd_set="$undef"
10152 d_fds_bits="$undef"
10153 d_fd_macros="$undef"
10154 fi
10155fi
5440bc8e 10156$rm -f try try.*
b4eb6b3d
JH
10157
10158: see if fgetpos exists
10159set fgetpos d_fgetpos
10160eval $inlibc
10161
758a5d79
JH
10162: see if finite exists
10163set finite d_finite
10164eval $inlibc
10165
10166: see if finitel exists
10167set finitel d_finitel
10168eval $inlibc
10169
b4eb6b3d
JH
10170: see if flock exists
10171set flock d_flock
10172eval $inlibc
10173
2ef53570
JH
10174: see if this is a sys/file.h system
10175val=''
10176set sys/file.h val
10177eval $inhdr
10178
10179: do we need to include sys/file.h ?
10180case "$val" in
10181"$define")
10182 echo " "
10183 if $h_sysfile; then
10184 val="$define"
10185 echo "We'll be including <sys/file.h>." >&4
10186 else
10187 val="$undef"
10188 echo "We won't be including <sys/file.h>." >&4
10189 fi
10190 ;;
10191*)
10192 h_sysfile=false
10193 ;;
10194esac
10195set i_sysfile
10196eval $setvar
10197
10198: see if prototype for flock is available
10199echo " "
10200set d_flockproto flock $i_sysfile sys/file.h
10201eval $hasproto
10202
b4eb6b3d
JH
10203: see if fork exists
10204set fork d_fork
10205eval $inlibc
10206
758a5d79
JH
10207: see if fp_class exists
10208set fp_class d_fp_class
10209eval $inlibc
10210
b4eb6b3d
JH
10211: see if pathconf exists
10212set pathconf d_pathconf
10213eval $inlibc
10214
10215: see if fpathconf exists
10216set fpathconf d_fpathconf
10217eval $inlibc
10218
758a5d79
JH
10219: see if fpclass exists
10220set fpclass d_fpclass
10221eval $inlibc
10222
10223: see if fpclassify exists
10224set fpclassify d_fpclassify
10225eval $inlibc
10226
10227: see if fpclassl exists
10228set fpclassl d_fpclassl
10229eval $inlibc
10230
b4eb6b3d
JH
10231
10232: check for fpos64_t
10233echo " "
10234echo "Checking to see if you have fpos64_t..." >&4
10235$cat >try.c <<EOCP
10236#include <stdio.h>
10237int main() { fpos64_t x = 7; }
10238EOCP
10239set try
10240if eval $compile; then
10241 val="$define"
10242 echo "You have fpos64_t."
10243else
10244 val="$undef"
10245 echo "You do not have fpos64_t."
10246 case "$fpossize" in
10247 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
10248 esac
10249fi
10250$rm -f try.* try
10251set d_fpos64_t
10252eval $setvar
10253
10254: see if frexpl exists
10255set frexpl d_frexpl
10256eval $inlibc
10257
b4eb6b3d
JH
10258: see if this is a sys/param system
10259set sys/param.h i_sysparam
10260eval $inhdr
10261
10262: see if this is a sys/mount.h system
10263set sys/mount.h i_sysmount
10264eval $inhdr
10265
b4eb6b3d
JH
10266
10267echo " "
10268echo "Checking to see if your system supports struct fs_data..." >&4
10269set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
10270eval $hasstruct
10271case "$d_fs_data_s" in
10272"$define") echo "Yes, it does." ;;
10273*) echo "No, it doesn't." ;;
10274esac
10275
10276: see if fseeko exists
10277set fseeko d_fseeko
10278eval $inlibc
10279case "$longsize" in
102808) echo "(Your long is 64 bits, so you could use fseek.)" ;;
10281esac
10282
10283: see if fsetpos exists
10284set fsetpos d_fsetpos
10285eval $inlibc
10286
10287
10288: see if fstatfs exists
10289set fstatfs d_fstatfs
10290eval $inlibc
10291
10292
10293: see if statvfs exists
10294set statvfs d_statvfs
10295eval $inlibc
10296
10297: see if fstatvfs exists
10298set fstatvfs d_fstatvfs
10299eval $inlibc
10300
10301
411ab01c
JH
10302: see if fsync exists
10303set fsync d_fsync
10304eval $inlibc
10305
b4eb6b3d
JH
10306: see if ftello exists
10307set ftello d_ftello
10308eval $inlibc
10309case "$longsize" in
103108) echo "(Your long is 64 bits, so you could use ftell.)" ;;
10311esac
10312
10313: see if getcwd exists
10314set getcwd d_getcwd
10315eval $inlibc
10316
10317: see if getespwnam exists
10318set getespwnam d_getespwnam
10319eval $inlibc
10320
10321
10322: see if getfsstat exists
10323set getfsstat d_getfsstat
10324eval $inlibc
10325
10326: see if getgrent exists
10327set getgrent d_getgrent
10328eval $inlibc
10329
10330: see if gethostbyaddr exists
10331set gethostbyaddr d_gethbyaddr
10332eval $inlibc
10333
10334: see if gethostbyname exists
10335set gethostbyname d_gethbyname
10336eval $inlibc
10337
10338: see if gethostent exists
10339set gethostent d_gethent
10340eval $inlibc
10341
10342: see how we will look up host name
10343echo " "
10344call=''
10345if set gethostname val -f d_gethname; eval $csym; $val; then
10346 echo 'gethostname() found.' >&4
10347 d_gethname="$define"
10348 call=gethostname
10349fi
10350if set uname val -f d_uname; eval $csym; $val; then
10351 if ./xenix; then
10352 $cat <<'EOM'
10353uname() was found, but you're running xenix, and older versions of xenix
10354have a broken uname(). If you don't really know whether your xenix is old
10355enough to have a broken system call, use the default answer.
10356
10357EOM
10358 dflt=y
10359 case "$d_uname" in
10360 "$define") dflt=n;;
10361 esac
10362 rp='Is your uname() broken?'
10363 . ./myread
10364 case "$ans" in
10365 n*) d_uname="$define"; call=uname;;
10366 esac
10367 else
10368 echo 'uname() found.' >&4
10369 d_uname="$define"
10370 case "$call" in
10371 '') call=uname ;;
10372 esac
10373 fi
10374fi
10375case "$d_gethname" in
10376'') d_gethname="$undef";;
10377esac
10378case "$d_uname" in
10379'') d_uname="$undef";;
10380esac
10381case "$d_uname$d_gethname" in
10382*define*)
10383 dflt=n
10384 cat <<EOM
10385
10386Every now and then someone has a $call() that lies about the hostname
10387but can't be fixed for political or economic reasons. If you wish, I can
10388pretend $call() isn't there and maybe compute hostname at run-time
10389thanks to the '$phostname' command.
10390
10391EOM
10392 rp="Shall I ignore $call() from now on?"
10393 . ./myread
10394 case "$ans" in
10395 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
10396 esac;;
10397esac
10398case "$phostname" in
10399'') aphostname='';;
10400*) case "$aphostname" in
10401 /*) ;;
10402 *) set X $phostname
10403 shift
10404 file=$1
10405 shift
10406 file=`./loc $file $file $pth`
10407 aphostname=`echo $file $*`
10408 ;;
10409 esac
10410 ;;
10411esac
10412case "$d_uname$d_gethname" in
10413*define*) ;;
10414*)
10415 case "$phostname" in
10416 '')
10417 echo "There will be no way for $package to get your hostname." >&4;;
10418 *)
10419 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
10420 ;;
10421 esac;;
10422esac
10423case "$d_phostname" in
10424'') d_phostname="$undef";;
10425esac
10426
10427: see if this is a netdb.h system
10428set netdb.h i_netdb
10429eval $inhdr
10430
10431: see if prototypes for various gethostxxx netdb.h functions are available
10432echo " "
10433set d_gethostprotos gethostent $i_netdb netdb.h
10434eval $hasproto
10435
4e0554ec
JH
10436: see if getitimer exists
10437set getitimer d_getitimer
10438eval $inlibc
10439
b4eb6b3d
JH
10440: see if getlogin exists
10441set getlogin d_getlogin
10442eval $inlibc
10443
10444: see if getmnt exists
10445set getmnt d_getmnt
10446eval $inlibc
10447
10448: see if getmntent exists
10449set getmntent d_getmntent
10450eval $inlibc
10451
10452: see if getnetbyaddr exists
10453set getnetbyaddr d_getnbyaddr
10454eval $inlibc
10455
10456: see if getnetbyname exists
10457set getnetbyname d_getnbyname
10458eval $inlibc
10459
10460: see if getnetent exists
10461set getnetent d_getnent
10462eval $inlibc
10463
10464: see if prototypes for various getnetxxx netdb.h functions are available
10465echo " "
10466set d_getnetprotos getnetent $i_netdb netdb.h
10467eval $hasproto
10468
0c0643d0
JH
10469: see if getpagesize exists
10470set getpagesize d_getpagsz
10471eval $inlibc
10472
b4eb6b3d
JH
10473
10474: see if getprotobyname exists
10475set getprotobyname d_getpbyname
10476eval $inlibc
10477
10478: see if getprotobynumber exists
10479set getprotobynumber d_getpbynumber
10480eval $inlibc
10481
10482: see if getprotoent exists
10483set getprotoent d_getpent
10484eval $inlibc
10485
10486: see if getpgid exists
10487set getpgid d_getpgid
10488eval $inlibc
10489
10490: see if getpgrp2 exists
10491set getpgrp2 d_getpgrp2
10492eval $inlibc
10493
10494: see if getppid exists
10495set getppid d_getppid
10496eval $inlibc
10497
10498: see if getpriority exists
10499set getpriority d_getprior
10500eval $inlibc
10501
10502: see if prototypes for various getprotoxxx netdb.h functions are available
10503echo " "
10504set d_getprotoprotos getprotoent $i_netdb netdb.h
10505eval $hasproto
10506
10507: see if getprpwnam exists
10508set getprpwnam d_getprpwnam
10509eval $inlibc
10510
10511: see if getpwent exists
10512set getpwent d_getpwent
10513eval $inlibc
10514
10515
10516: see if getservbyname exists
10517set getservbyname d_getsbyname
10518eval $inlibc
10519
10520: see if getservbyport exists
10521set getservbyport d_getsbyport
10522eval $inlibc
10523
10524: see if getservent exists
10525set getservent d_getsent
10526eval $inlibc
10527
10528: see if prototypes for various getservxxx netdb.h functions are available
10529echo " "
10530set d_getservprotos getservent $i_netdb netdb.h
10531eval $hasproto
10532
10533: see if getspnam exists
10534set getspnam d_getspnam
10535eval $inlibc
10536
10537: see if gettimeofday or ftime exists
10538set gettimeofday d_gettimeod
10539eval $inlibc
10540case "$d_gettimeod" in
10541"$undef")
10542 set ftime d_ftime
10543 eval $inlibc
10544 ;;
10545*)
10546 val="$undef"; set d_ftime; eval $setvar
10547 ;;
10548esac
10549case "$d_gettimeod$d_ftime" in
10550"$undef$undef")
10551 echo " "
10552 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10553 ;;
10554esac
10555
10556: see if this is an grp system
10557set grp.h i_grp
10558eval $inhdr
10559
10560case "$i_grp" in
10561$define)
10562 xxx=`./findhdr grp.h`
10563 $cppstdin $cppflags $cppminus < $xxx >$$.h
10564
10565 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10566 val="$define"
10567 else
10568 val="$undef"
10569 fi
10570 set d_grpasswd
10571 eval $setvar
10572
10573 $rm -f $$.h
10574 ;;
10575*)
10576 val="$undef";
10577 set d_grpasswd; eval $setvar
10578 ;;
10579esac
10580
10581: see if hasmntopt exists
10582set hasmntopt d_hasmntopt
10583eval $inlibc
10584
10585: see if this is a netinet/in.h or sys/in.h system
10586set netinet/in.h i_niin sys/in.h i_sysin
10587eval $inhdr
10588
10589: see if arpa/inet.h has to be included
10590set arpa/inet.h i_arpainet
10591eval $inhdr
10592
10593: see if htonl --and friends-- exists
10594val=''
10595set htonl val
10596eval $inlibc
10597
10598: Maybe they are macros.
10599case "$val" in
10600$undef)
10601 $cat >htonl.c <<EOM
10602#include <stdio.h>
10603#include <sys/types.h>
10604#$i_niin I_NETINET_IN
10605#$i_sysin I_SYS_IN
10606#$i_arpainet I_ARPA_INET
10607#ifdef I_NETINET_IN
10608#include <netinet/in.h>
10609#endif
10610#ifdef I_SYS_IN
10611#include <sys/in.h>
10612#endif
10613#ifdef I_ARPA_INET
10614#include <arpa/inet.h>
10615#endif
10616#ifdef htonl
10617printf("Defined as a macro.");
10618#endif
10619EOM
10620 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10621 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10622 val="$define"
10623 echo "But it seems to be defined as a macro." >&4
10624 fi
10625 $rm -f htonl.?
10626 ;;
10627esac
10628set d_htonl
10629eval $setvar
10630
10631: see if iconv exists
10632set iconv d_iconv
10633eval $inlibc
10634
10635: index or strchr
10636echo " "
10637if set index val -f; eval $csym; $val; then
10638 if set strchr val -f d_strchr; eval $csym; $val; then
10639 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10640 val="$define"
10641 vali="$undef"
10642 echo "strchr() found." >&4
10643 else
10644 val="$undef"
10645 vali="$define"
10646 echo "index() found." >&4
10647 fi
10648 else
10649 val="$undef"
10650 vali="$define"
8dfa8df9
JH
10651 echo "index() found." >&4
10652 fi
b4eb6b3d 10653else
8dfa8df9
JH
10654 if set strchr val -f d_strchr; eval $csym; $val; then
10655 val="$define"
10656 vali="$undef"
10657 echo "strchr() found." >&4
10658 else
10659 echo "No index() or strchr() found!" >&4
10660 val="$undef"
10661 vali="$undef"
10662 fi
b4eb6b3d 10663fi
8dfa8df9
JH
10664set d_strchr; eval $setvar
10665val="$vali"
10666set d_index; eval $setvar
10667
10668: check whether inet_aton exists
10669set inet_aton d_inetaton
10670eval $inlibc
b4eb6b3d
JH
10671
10672: Look for isascii
10673echo " "
10674$cat >isascii.c <<'EOCP'
10675#include <stdio.h>
10676#include <ctype.h>
10677int main() {
10678 int c = 'A';
10679 if (isascii(c))
10680 exit(0);
10681 else
10682 exit(1);
10683}
10684EOCP
10685set isascii
10686if eval $compile; then
10687 echo "isascii() found." >&4
10688 val="$define"
10689else
10690 echo "isascii() NOT found." >&4
10691 val="$undef"
10692fi
10693set d_isascii
10694eval $setvar
10695$rm -f isascii*
10696
758a5d79
JH
10697: see if isfinite exists
10698set isfinite d_isfinite
10699eval $inlibc
10700
10701: see if isinf exists
10702set isinf d_isinf
10703eval $inlibc
10704
b4eb6b3d
JH
10705: see if isnan exists
10706set isnan d_isnan
10707eval $inlibc
10708
10709: see if isnanl exists
10710set isnanl d_isnanl
10711eval $inlibc
10712
10713: see if killpg exists
10714set killpg d_killpg
10715eval $inlibc
10716
10717: see if lchown exists
10718echo " "
10719$cat > try.c <<'EOCP'
10720/* System header to define __stub macros and hopefully few prototypes,
10721 which can conflict with char lchown(); below. */
10722#include <assert.h>
10723/* Override any gcc2 internal prototype to avoid an error. */
10724/* We use char because int might match the return type of a gcc2
10725 builtin and then its argument prototype would still apply. */
10726char lchown();
10727int main() {
10728 /* The GNU C library defines this for functions which it implements
10729 to always fail with ENOSYS. Some functions are actually named
10730 something starting with __ and the normal name is an alias. */
10731#if defined (__stub_lchown) || defined (__stub___lchown)
10732choke me
10733#else
10734lchown();
10735#endif
10736; return 0; }
10737EOCP
10738set try
10739if eval $compile; then
10740 $echo "lchown() found." >&4
10741 val="$define"
10742else
10743 $echo "lchown() NOT found." >&4
10744 val="$undef"
10745fi
10746set d_lchown
10747eval $setvar
10748
10749: See if number of significant digits in a double precision number is known
10750echo " "
10751$cat >ldbl_dig.c <<EOM
10752#$i_limits I_LIMITS
10753#$i_float I_FLOAT
10754#ifdef I_LIMITS
10755#include <limits.h>
10756#endif
10757#ifdef I_FLOAT
10758#include <float.h>
10759#endif
10760#ifdef LDBL_DIG
10761printf("Contains LDBL_DIG");
10762#endif
10763EOM
10764$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10765if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10766 echo "LDBL_DIG found." >&4
10767 val="$define"
10768else
10769 echo "LDBL_DIG NOT found." >&4
10770 val="$undef"
10771fi
10772$rm -f ldbl_dig.?
10773set d_ldbl_dig
10774eval $setvar
10775
10776: see if link exists
10777set link d_link
10778eval $inlibc
10779
10780: see if localeconv exists
10781set localeconv d_locconv
10782eval $inlibc
10783
10784: see if lockf exists
10785set lockf d_lockf
10786eval $inlibc
10787
b4eb6b3d
JH
10788: see if prototype for lseek is available
10789echo " "
10790set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10791eval $hasproto
10792
10793: see if lstat exists
10794set lstat d_lstat
10795eval $inlibc
10796
10797: see if madvise exists
10798set madvise d_madvise
10799eval $inlibc
10800
10801: see if mblen exists
10802set mblen d_mblen
10803eval $inlibc
10804
10805: see if mbstowcs exists
10806set mbstowcs d_mbstowcs
10807eval $inlibc
10808
10809: see if mbtowc exists
10810set mbtowc d_mbtowc
10811eval $inlibc
10812
10813: see if memchr exists
10814set memchr d_memchr
10815eval $inlibc
10816
10817: see if memcmp exists
10818set memcmp d_memcmp
10819eval $inlibc
10820
10821: see if memcpy exists
10822set memcpy d_memcpy
10823eval $inlibc
10824
10825: see if memmove exists
10826set memmove d_memmove
10827eval $inlibc
10828
10829: see if memset exists
10830set memset d_memset
10831eval $inlibc
10832
10833: see if mkdir exists
10834set mkdir d_mkdir
10835eval $inlibc
10836
10837: see if mkdtemp exists
10838set mkdtemp d_mkdtemp
10839eval $inlibc
10840
10841: see if mkfifo exists
10842set mkfifo d_mkfifo
10843eval $inlibc
10844
10845: see if mkstemp exists
10846set mkstemp d_mkstemp
10847eval $inlibc
10848
10849: see if mkstemps exists
10850set mkstemps d_mkstemps
10851eval $inlibc
10852
10853: see if mktime exists
10854set mktime d_mktime
10855eval $inlibc
10856
10857: see if this is a sys/mman.h system
10858set sys/mman.h i_sysmman
10859eval $inhdr
10860
10861: see if mmap exists
10862set mmap d_mmap
10863eval $inlibc
10864: see what shmat returns
10865: default to something harmless
10866mmaptype='void *'
10867case "$i_sysmman$d_mmap" in
10868"$define$define")
10869 $cat >mmap.c <<'END'
10870#include <sys/mman.h>
10871void *mmap();
10872END
10873 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10874 mmaptype='void *'
10875 else
10876 mmaptype='caddr_t'
10877 fi
10878 echo "and it returns ($mmaptype)." >&4
10879 ;;
10880esac
10881
10882
10883
10884: see if modfl exists
10885set modfl d_modfl
10886eval $inlibc
10887
e67aeab1
JH
10888d_modfl_pow32_bug="$undef"
10889
2b2cdb4d
HS
10890case "$d_longdbl$d_modfl" in
10891$define$define)
10892 $cat <<EOM
10893Checking to see whether your modfl() is okay for large values...
10894EOM
10895$cat >try.c <<EOCP
10896#include <math.h>
10897#include <stdio.h>
10898int main() {
10899 long double nv = 4294967303.15;
10900 long double v, w;
10901 v = modfl(nv, &w);
10902#ifdef __GLIBC__
10903 printf("glibc");
10904#endif
10905 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
10906 return 0;
10907}
10908EOCP
27f9615e
JH
10909 case "$osname:$gccversion" in
10910 aix:) saveccflags="$ccflags"
10911 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10912 esac
2b2cdb4d
HS
10913 set try
10914 if eval $compile; then
5440bc8e 10915 foo=`$run ./try`
2b2cdb4d
HS
10916 case "$foo" in
10917 *" 4294967303.150000 1.150000 4294967302.000000")
10918 echo >&4 "Your modfl() is broken for large values."
e67aeab1 10919 d_modfl_pow32_bug="$define"
2b2cdb4d
HS
10920 case "$foo" in
10921 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
10922 ;;
10923 esac
10924 ;;
10925 *" 4294967303.150000 0.150000 4294967303.000000")
10926 echo >&4 "Your modfl() seems okay for large values."
10927 ;;
10928 *) echo >&4 "I don't understand your modfl() at all."
10929 d_modfl="$undef"
10930 ;;
10931 esac
10932 $rm -f try.* try core core.try.*
10933 else
10934 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
10935 d_modfl="$undef"
10936 fi
27f9615e 10937 case "$osname:$gccversion" in
abcf653a 10938 aix:) ccflags="$saveccflags" ;; # restore
27f9615e 10939 esac
2b2cdb4d
HS
10940 ;;
10941esac
10942
b4eb6b3d
JH
10943: see if mprotect exists
10944set mprotect d_mprotect
10945eval $inlibc
10946
10947: see if msgctl exists
10948set msgctl d_msgctl
10949eval $inlibc
10950
10951: see if msgget exists
10952set msgget d_msgget
10953eval $inlibc
10954
10955: see if msgsnd exists
10956set msgsnd d_msgsnd
10957eval $inlibc
10958
10959: see if msgrcv exists
10960set msgrcv d_msgrcv
10961eval $inlibc
10962
10963: see how much of the 'msg*(2)' library is present.
10964h_msg=true
10965echo " "
10966case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10967*"$undef"*) h_msg=false;;
10968esac
10969case "$osname" in
10970freebsd)
10971 case "`ipcs 2>&1`" in
10972 "SVID messages"*"not configured"*)
10973 echo "Your $osname does not have the msg*(2) configured." >&4
10974 h_msg=false
10975 val="$undef"
10976 set msgctl d_msgctl
10977 eval $setvar
10978 set msgget d_msgget
10979 eval $setvar
10980 set msgsnd d_msgsnd
10981 eval $setvar
10982 set msgrcv d_msgrcv
10983 eval $setvar
10984 ;;
10985 esac
10986 ;;
10987esac
10988: we could also check for sys/ipc.h ...
10989if $h_msg && $test `./findhdr sys/msg.h`; then
10990 echo "You have the full msg*(2) library." >&4
10991 val="$define"
10992else
10993 echo "You don't have the full msg*(2) library." >&4
10994 val="$undef"
10995fi
10996set d_msg
10997eval $setvar
10998
4e0554ec
JH
10999
11000echo " "
11001echo "Checking to see if your system supports struct msghdr..." >&4
11002set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11003eval $hasstruct
11004case "$d_msghdr_s" in
11005"$define") echo "Yes, it does." ;;
11006*) echo "No, it doesn't." ;;
11007esac
11008
11009
b4eb6b3d
JH
11010: see if msync exists
11011set msync d_msync
11012eval $inlibc
11013
11014: see if munmap exists
11015set munmap d_munmap
11016eval $inlibc
11017
11018: see if nice exists
11019set nice d_nice
11020eval $inlibc
11021
2765b840
JH
11022: see if this is a langinfo.h system
11023set langinfo.h i_langinfo
11024eval $inhdr
11025
11026: see if nl_langinfo exists
11027set nl_langinfo d_nl_langinfo
11028eval $inlibc
11029
b4eb6b3d
JH
11030: check for length of character
11031echo " "
11032case "$charsize" in
11033'')
11034 echo "Checking to see how big your characters are (hey, you never know)..." >&4
11035 $cat >try.c <<'EOCP'
11036#include <stdio.h>
11037int main()
11038{
11039 printf("%d\n", (int)sizeof(char));
11040 exit(0);
11041}
11042EOCP
11043 set try
11044 if eval $compile_ok; then
5440bc8e 11045 dflt=`$run ./try`
b4eb6b3d
JH
11046 else
11047 dflt='1'
11048 echo "(I can't seem to compile the test program. Guessing...)"
11049 fi
11050 ;;
11051*)
11052 dflt="$charsize"
11053 ;;
11054esac
11055rp="What is the size of a character (in bytes)?"
11056. ./myread
11057charsize="$ans"
11058$rm -f try.c try
11059
1d1be0dc
NC
11060: check for volatile keyword
11061echo " "
11062echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11063$cat >try.c <<'EOCP'
11064int main()
11065{
11066 typedef struct _goo_struct goo_struct;
11067 goo_struct * volatile goo = ((goo_struct *)0);
11068 struct _goo_struct {
11069 long long_int;
11070 int reg_int;
11071 char char_var;
11072 };
11073 typedef unsigned short foo_t;
11074 char *volatile foo;
11075 volatile int bar;
11076 volatile foo_t blech;
11077 foo = foo;
11078}
11079EOCP
11080if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11081 val="$define"
11082 echo "Yup, it does."
11083else
11084 val="$undef"
11085 echo "Nope, it doesn't."
11086fi
11087set d_volatile
11088eval $setvar
11089$rm -f try.*
11090
b4eb6b3d
JH
11091
11092echo " "
11093$echo "Choosing the C types to be used for Perl's internal types..." >&4
11094
11095case "$use64bitint:$d_quad:$quadtype" in
11096define:define:?*)
11097 ivtype="$quadtype"
11098 uvtype="$uquadtype"
11099 ivsize=8
11100 uvsize=8
11101 ;;
11102*) ivtype="long"
11103 uvtype="unsigned long"
11104 ivsize=$longsize
11105 uvsize=$longsize
11106 ;;
11107esac
11108
11109case "$uselongdouble:$d_longdbl" in
11110define:define)
11111 nvtype="long double"
11112 nvsize=$longdblsize
11113 ;;
11114*) nvtype=double
11115 nvsize=$doublesize
11116 ;;
11117esac
11118
11119$echo "(IV will be "$ivtype", $ivsize bytes)"
11120$echo "(UV will be "$uvtype", $uvsize bytes)"
11121$echo "(NV will be "$nvtype", $nvsize bytes)"
11122
11123$cat >try.c <<EOCP
11124#$i_inttypes I_INTTYPES
11125#ifdef I_INTTYPES
11126#include <inttypes.h>
11127#endif
11128#include <stdio.h>
11129int main() {
11130#ifdef INT8
11131 int8_t i = INT8_MAX;
11132 uint8_t u = UINT8_MAX;
11133 printf("int8_t\n");
11134#endif
11135#ifdef INT16
11136 int16_t i = INT16_MAX;
11137 uint16_t i = UINT16_MAX;
11138 printf("int16_t\n");
11139#endif
11140#ifdef INT32
11141 int32_t i = INT32_MAX;
11142 uint32_t u = UINT32_MAX;
11143 printf("int32_t\n");
11144#endif
11145}
11146EOCP
11147
11148case "$i8type" in
11149'') case "$charsize" in
11150 1) i8type=char
11151 u8type="unsigned char"
11152 i8size=$charsize
11153 u8size=$charsize
11154 ;;
11155 esac
11156 ;;
11157esac
11158case "$i8type" in
11159'') set try -DINT8
11160 if eval $compile; then
5440bc8e 11161 case "`$run ./try`" in
b4eb6b3d
JH
11162 int8_t) i8type=int8_t
11163 u8type=uint8_t
11164 i8size=1
11165 u8size=1
11166 ;;
11167 esac
11168 fi
11169 ;;
11170esac
11171case "$i8type" in
11172'') if $test $charsize -ge 1; then
11173 i8type=char
11174 u8type="unsigned char"
11175 i8size=$charsize
11176 u8size=$charsize
11177 fi
11178 ;;
11179esac
11180
11181case "$i16type" in
11182'') case "$shortsize" in
11183 2) i16type=short
11184 u16type="unsigned short"
11185 i16size=$shortsize
11186 u16size=$shortsize
11187 ;;
11188 esac
11189 ;;
11190esac
11191case "$i16type" in
11192'') set try -DINT16
11193 if eval $compile; then
5440bc8e 11194 case "`$run ./try`" in
b4eb6b3d
JH
11195 int16_t)
11196 i16type=int16_t
11197 u16type=uint16_t
11198 i16size=2
11199 u16size=2
11200 ;;
11201 esac
11202 fi
11203 ;;
11204esac
11205case "$i16type" in
11206'') if $test $shortsize -ge 2; then
11207 i16type=short
11208 u16type="unsigned short"
11209 i16size=$shortsize
11210 u16size=$shortsize
11211 fi
11212 ;;
11213esac
11214
11215case "$i32type" in
11216'') case "$longsize" in
11217 4) i32type=long
11218 u32type="unsigned long"
11219 i32size=$longsize
11220 u32size=$longsize
11221 ;;
11222 *) case "$intsize" in
11223 4) i32type=int
11224 u32type="unsigned int"
11225 i32size=$intsize
11226 u32size=$intsize
11227 ;;
11228 esac
11229 ;;
11230 esac
11231 ;;
11232esac
11233case "$i32type" in
11234'') set try -DINT32
11235 if eval $compile; then
5440bc8e 11236 case "`$run ./try`" in
b4eb6b3d
JH
11237 int32_t)
11238 i32type=int32_t
11239 u32type=uint32_t
11240 i32size=4
11241 u32size=4
11242 ;;
11243 esac
11244 fi
11245 ;;
11246esac
11247case "$i32type" in
11248'') if $test $intsize -ge 4; then
11249 i32type=int
11250 u32type="unsigned int"
11251 i32size=$intsize
11252 u32size=$intsize
11253 fi
11254 ;;
11255esac
11256
11257case "$i64type" in
11258'') case "$d_quad:$quadtype" in
11259 define:?*)
11260 i64type="$quadtype"
11261 u64type="$uquadtype"
11262 i64size=8
11263 u64size=8
11264 ;;
11265 esac
11266 ;;
11267esac
11268
1d1be0dc
NC
11269$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
11270: volatile so that the compiler has to store it out to memory.
11271if test X"$d_volatile" = X"$define"; then
11272 volatile=volatile
11273fi
b4eb6b3d
JH
11274$cat <<EOP >try.c
11275#include <stdio.h>
1d1be0dc
NC
11276#include <sys/types.h>
11277#include <signal.h>
11278#ifdef SIGFPE
11279$volatile int bletched = 0;
11280$signal_t blech(s) int s; { bletched = 1; }
11281#endif
b4eb6b3d
JH
11282int main() {
11283 $uvtype u = 0;
1d1be0dc 11284 $nvtype d;
b4eb6b3d
JH
11285 int n = 8 * $uvsize;
11286 int i;
1d1be0dc
NC
11287#ifdef SIGFPE
11288 signal(SIGFPE, blech);
11289#endif
11290
b4eb6b3d
JH
11291 for (i = 0; i < n; i++) {
11292 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
11293 d = ($nvtype)u;
11294 if (($uvtype)d != u)
b4eb6b3d 11295 break;
1d1be0dc
NC
11296 if (d <= 0)
11297 break;
11298 d = ($nvtype)(u - 1);
11299 if (($uvtype)d != (u - 1))
11300 break;
11301#ifdef SIGFPE
11302 if (bletched) {
11303 break;
11304#endif
11305 }
b4eb6b3d 11306 }
efd1522b 11307 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
11308 exit(0);
11309}
11310EOP
1d1be0dc
NC
11311set try
11312
11313d_nv_preserves_uv="$undef"
11314if eval $compile; then
5440bc8e 11315 d_nv_preserves_uv_bits="`$run ./try`"
1d1be0dc
NC
11316fi
11317case "$d_nv_preserves_uv_bits" in
11318\-[1-9]*)
11319 d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
11320 $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs." 2>&1
11321 d_nv_preserves_uv="$define"
b4eb6b3d 11322 ;;
1d1be0dc
NC
11323[1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs." 2>&1
11324 d_nv_preserves_uv="$undef" ;;
11325*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
11326 d_nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
11327esac
11328
1d1be0dc
NC
11329$rm -f try.* try
11330
b4eb6b3d
JH
11331
11332: check for off64_t
11333echo " "
11334echo "Checking to see if you have off64_t..." >&4
11335$cat >try.c <<EOCP
11336#include <sys/types.h>
11337#include <unistd.h>
11338int main() { off64_t x = 7; }
11339EOCP
11340set try
11341if eval $compile; then
11342 val="$define"
11343 echo "You have off64_t."
11344else
11345 val="$undef"
11346 echo "You do not have off64_t."
11347 case "$lseeksize" in
11348 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
11349 esac
11350fi
11351$rm -f try.* try
11352set d_off64_t
11353eval $setvar
11354
11355: see if POSIX threads are available
11356set pthread.h i_pthread
11357eval $inhdr
11358
11359
11360
11361
11362: how to create joinable pthreads
11363if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
11364 echo " "
11365 echo "Checking what constant to use for creating joinable pthreads..." >&4
11366 $cat >try.c <<'EOCP'
11367#include <pthread.h>
11368int main() {
11369 int detachstate = JOINABLE;
11370}
11371EOCP
11372 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
11373 if eval $compile; then
11374 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
11375 val="$undef" # Yes, undef.
11376 set d_old_pthread_create_joinable
11377 eval $setvar
11378 val=""
11379 set old_pthread_create_joinable
11380 eval $setvar
11381 else
11382 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
11383 if eval $compile; then
11384 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
11385 val="$define"
11386 set d_old_pthread_create_joinable
11387 eval $setvar
11388 val=PTHREAD_CREATE_UNDETACHED
11389 set old_pthread_create_joinable
11390 eval $setvar
11391 else
11392 set try -DJOINABLE=__UNDETACHED
11393 if eval $compile; then
11394 echo "You seem to use __UNDETACHED." >&4
11395 val="$define"
11396 set d_old_pthread_create_joinable
11397 eval $setvar
11398 val=__UNDETACHED
11399 set old_pthread_create_joinable
11400 eval $setvar
11401 else
11402 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
11403 val="$define"
11404 set d_old_pthread_create_joinable
11405 eval $setvar
11406 val=0
11407 set old_pthread_create_joinable
11408 eval $setvar
11409 fi
11410 fi
11411 fi
11412 $rm -f try try.*
11413else
11414 d_old_pthread_create_joinable="$undef"
11415 old_pthread_create_joinable=""
11416fi
11417
11418: see if pause exists
11419set pause d_pause
11420eval $inlibc
11421
11422: see if pipe exists
11423set pipe d_pipe
11424eval $inlibc
11425
11426: see if poll exists
11427set poll d_poll
11428eval $inlibc
11429
d6483fcc
JH
11430: see if pthread_atfork exists
11431set pthread_atfork d_pthread_atfork
11432eval $inlibc
11433
b4eb6b3d
JH
11434
11435: see whether the various POSIXish _yields exist
11436$cat >try.c <<EOP
11437#include <pthread.h>
11438#include <stdio.h>
11439int main() {
11440#ifdef SCHED_YIELD
11441 sched_yield();
11442#else
11443#ifdef PTHREAD_YIELD
11444 pthread_yield();
11445#else
11446#ifdef PTHREAD_YIELD_NULL
11447 pthread_yield(NULL);
11448#endif
11449#endif
11450#endif
11451}
11452EOP
11453: see if sched_yield exists
11454set try -DSCHED_YIELD
11455if eval $compile; then
11456 val="$define"
11457 sched_yield='sched_yield()'
11458else
11459 val="$undef"
11460fi
11461case "$usethreads" in
11462$define)
11463 case "$val" in
11464 $define) echo 'sched_yield() found.' >&4 ;;
11465 *) echo 'sched_yield() NOT found.' >&4 ;;
11466 esac
11467esac
11468set d_sched_yield
11469eval $setvar
11470
11471: see if pthread_yield exists
11472set try -DPTHREAD_YIELD
11473if eval $compile; then
11474 val="$define"
11475 case "$sched_yield" in
11476 '') sched_yield='pthread_yield()' ;;
11477 esac
11478else
11479 set try -DPTHREAD_YIELD_NULL
11480 if eval $compile; then
11481 val="$define"
11482 case "$sched_yield" in
11483 '') sched_yield='pthread_yield(NULL)' ;;
11484 esac
11485 else
11486 val="$undef"
11487 fi
11488fi
11489case "$usethreads" in
11490$define)
11491 case "$val" in
11492 $define) echo 'pthread_yield() found.' >&4 ;;
11493 *) echo 'pthread_yield() NOT found.' >&4 ;;
11494 esac
11495 ;;
11496esac
11497set d_pthread_yield
11498eval $setvar
11499
11500case "$sched_yield" in
11501'') sched_yield=undef ;;
11502esac
11503
11504$rm -f try try.*
11505
11506: see if this is a pwd.h system
11507set pwd.h i_pwd
11508eval $inhdr
11509
11510case "$i_pwd" in
11511$define)
11512 xxx=`./findhdr pwd.h`
11513 $cppstdin $cppflags $cppminus < $xxx >$$.h
11514
11515 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11516 val="$define"
11517 else
11518 val="$undef"
11519 fi
11520 set d_pwquota
11521 eval $setvar
11522
11523 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11524 val="$define"
11525 else
11526 val="$undef"
11527 fi
11528 set d_pwage
11529 eval $setvar
11530
11531 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11532 val="$define"
11533 else
11534 val="$undef"
11535 fi
11536 set d_pwchange
11537 eval $setvar
11538
11539 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11540 val="$define"
11541 else
11542 val="$undef"
11543 fi
11544 set d_pwclass
11545 eval $setvar
11546
11547 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11548 val="$define"
11549 else
11550 val="$undef"
11551 fi
11552 set d_pwexpire
11553 eval $setvar
11554
11555 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11556 val="$define"
11557 else
11558 val="$undef"
11559 fi
11560 set d_pwcomment
11561 eval $setvar
11562
11563 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11564 val="$define"
11565 else
11566 val="$undef"
11567 fi
11568 set d_pwgecos
11569 eval $setvar
11570
11571 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11572 val="$define"
11573 else
11574 val="$undef"
11575 fi
11576 set d_pwpasswd
11577 eval $setvar
11578
11579 $rm -f $$.h
11580 ;;
11581*)
11582 val="$undef";
11583 set d_pwquota; eval $setvar
11584 set d_pwage; eval $setvar
11585 set d_pwchange; eval $setvar
11586 set d_pwclass; eval $setvar
11587 set d_pwexpire; eval $setvar
11588 set d_pwcomment; eval $setvar
11589 set d_pwgecos; eval $setvar
11590 set d_pwpasswd; eval $setvar
11591 ;;
11592esac
11593
11594: see if readdir and friends exist
11595set readdir d_readdir
11596eval $inlibc
11597set seekdir d_seekdir
11598eval $inlibc
11599set telldir d_telldir
11600eval $inlibc
11601set rewinddir d_rewinddir
11602eval $inlibc
11603
11604: see if readlink exists
11605set readlink d_readlink
11606eval $inlibc
11607
4e0554ec
JH
11608: see if readv exists
11609set readv d_readv
11610eval $inlibc
11611
11612: see if recvmsg exists
11613set recvmsg d_recvmsg
11614eval $inlibc
11615
b4eb6b3d
JH
11616: see if rename exists
11617set rename d_rename
11618eval $inlibc
11619
11620: see if rmdir exists
11621set rmdir d_rmdir
11622eval $inlibc
11623
11624: see if memory.h is available.
11625val=''
11626set memory.h val
11627eval $inhdr
11628
11629: See if it conflicts with string.h
11630case "$val" in
11631$define)
11632 case "$strings" in
11633 '') ;;
11634 *)
11635 $cppstdin $cppflags $cppminus < $strings > mem.h
11636 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11637 echo " "
11638 echo "We won't be including <memory.h>."
11639 val="$undef"
11640 fi
11641 $rm -f mem.h
11642 ;;
11643 esac
11644esac
11645set i_memory
11646eval $setvar
11647
11648: can bcopy handle overlapping blocks?
b6cc3bc4 11649echo " "
b4eb6b3d 11650val="$undef"
b6cc3bc4
AD
11651case "$d_memmove" in
11652"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
11653*) case "$d_bcopy" in
11654 "$define")
11655 echo "Checking to see if bcopy() can do overlapping copies..." >&4
11656 $cat >try.c <<EOCP
b4eb6b3d
JH
11657#$i_memory I_MEMORY
11658#$i_stdlib I_STDLIB
11659#$i_string I_STRING
11660#$i_unistd I_UNISTD
11661EOCP
11662 $cat >>try.c <<'EOCP'
11663#include <stdio.h>
11664#ifdef I_MEMORY
11665# include <memory.h>
11666#endif
11667#ifdef I_STDLIB
11668# include <stdlib.h>
11669#endif
11670#ifdef I_STRING
11671# include <string.h>
11672#else
11673# include <strings.h>
11674#endif
11675#ifdef I_UNISTD
11676# include <unistd.h> /* Needed for NetBSD */
11677#endif
11678int main()
11679{
11680char buf[128], abc[128];
11681char *b;
11682int len;
11683int off;
11684int align;
11685
b6cc3bc4
AD
11686/* Copy "abcde..." string to char abc[] so that gcc doesn't
11687 try to store the string in read-only memory. */
b4eb6b3d
JH
11688bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11689
11690for (align = 7; align >= 0; align--) {
11691 for (len = 36; len; len--) {
11692 b = buf+align;
11693 bcopy(abc, b, len);
11694 for (off = 1; off <= len; off++) {
11695 bcopy(b, b+off, len);
11696 bcopy(b+off, b, len);
11697 if (bcmp(b, abc, len))
11698 exit(1);
11699 }
11700 }
11701}
11702exit(0);
11703}
11704EOCP
b6cc3bc4
AD
11705 set try
11706 if eval $compile_ok; then
11707 if ./try 2>/dev/null; then
11708 echo "Yes, it can."
11709 val="$define"
11710 else
11711 echo "It can't, sorry."
11712 fi
b4eb6b3d 11713 else
b6cc3bc4 11714 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 11715 fi
b6cc3bc4
AD
11716 ;;
11717 esac
11718 $rm -f try.* try core
b4eb6b3d
JH
11719 ;;
11720esac
b4eb6b3d
JH
11721set d_safebcpy
11722eval $setvar
11723
11724: can memcpy handle overlapping blocks?
b6cc3bc4 11725echo " "
b4eb6b3d 11726val="$undef"
b6cc3bc4
AD
11727case "$d_memmove" in
11728"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
11729*) case "$d_memcpy" in
11730 "$define")
11731 echo "Checking to see if memcpy() can do overlapping copies..." >&4
11732 $cat >try.c <<EOCP
b4eb6b3d
JH
11733#$i_memory I_MEMORY
11734#$i_stdlib I_STDLIB
11735#$i_string I_STRING
11736#$i_unistd I_UNISTD
11737EOCP
11738 $cat >>try.c <<'EOCP'
11739#include <stdio.h>
11740#ifdef I_MEMORY
11741# include <memory.h>
11742#endif
11743#ifdef I_STDLIB
11744# include <stdlib.h>
11745#endif
11746#ifdef I_STRING
11747# include <string.h>
11748#else
11749# include <strings.h>
11750#endif
11751#ifdef I_UNISTD
11752# include <unistd.h> /* Needed for NetBSD */
11753#endif
11754int main()
11755{
11756char buf[128], abc[128];
11757char *b;
11758int len;
11759int off;
11760int align;
11761
11762/* Copy "abcde..." string to char abc[] so that gcc doesn't
11763 try to store the string in read-only memory. */
11764memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11765
11766for (align = 7; align >= 0; align--) {
11767 for (len = 36; len; len--) {
11768 b = buf+align;
11769 memcpy(b, abc, len);
11770 for (off = 1; off <= len; off++) {
11771 memcpy(b+off, b, len);
11772 memcpy(b, b+off, len);
11773 if (memcmp(b, abc, len))
11774 exit(1);
11775 }
11776 }
11777}
11778exit(0);
11779}
11780EOCP
b6cc3bc4
AD
11781 set try
11782 if eval $compile_ok; then
11783 if ./try 2>/dev/null; then
11784 echo "Yes, it can."
11785 val="$define"
11786 else
11787 echo "It can't, sorry."
11788 fi
b4eb6b3d 11789 else
b6cc3bc4 11790 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 11791 fi
b6cc3bc4
AD
11792 ;;
11793 esac
11794 $rm -f try.* try core
b4eb6b3d
JH
11795 ;;
11796esac
b4eb6b3d
JH
11797set d_safemcpy
11798eval $setvar
11799
11800: can memcmp be trusted to compare relative magnitude?
11801val="$undef"
11802case "$d_memcmp" in
11803"$define")
11804 echo " "
11805 echo "Checking if your memcmp() can compare relative magnitude..." >&4
11806 $cat >try.c <<EOCP
11807#$i_memory I_MEMORY
11808#$i_stdlib I_STDLIB
11809#$i_string I_STRING
11810#$i_unistd I_UNISTD
11811EOCP
11812 $cat >>try.c <<'EOCP'
11813#include <stdio.h>
11814#ifdef I_MEMORY
11815# include <memory.h>
11816#endif
11817#ifdef I_STDLIB
11818# include <stdlib.h>
11819#endif
11820#ifdef I_STRING
11821# include <string.h>
11822#else
11823# include <strings.h>
11824#endif
11825#ifdef I_UNISTD
11826# include <unistd.h> /* Needed for NetBSD */
11827#endif
11828int main()
11829{
11830char a = -1;
11831char b = 0;
11832if ((a < b) && memcmp(&a, &b, 1) < 0)
11833 exit(1);
11834exit(0);
11835}
11836EOCP
11837 set try
11838 if eval $compile_ok; then
5440bc8e 11839 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
11840 echo "Yes, it can."
11841 val="$define"
11842 else
11843 echo "No, it can't (it uses signed chars)."
11844 fi
11845 else
11846 echo "(I can't compile the test program, so we'll assume not...)"
11847 fi
11848 ;;
11849esac
11850$rm -f try.* try core
11851set d_sanemcmp
11852eval $setvar
11853
ef9f17be
JH
11854: see if prototype for sbrk is available
11855echo " "
11856set d_sbrkproto sbrk $i_unistd unistd.h
11857eval $hasproto
11858
b4eb6b3d
JH
11859: see if select exists
11860set select d_select
11861eval $inlibc
11862
11863: see if semctl exists
11864set semctl d_semctl
11865eval $inlibc
11866
11867: see if semget exists
11868set semget d_semget
11869eval $inlibc
11870
11871: see if semop exists
11872set semop d_semop
11873eval $inlibc
11874
11875: see how much of the 'sem*(2)' library is present.
11876h_sem=true
11877echo " "
11878case "$d_semctl$d_semget$d_semop" in
11879*"$undef"*) h_sem=false;;
11880esac
11881case "$osname" in
11882freebsd)
11883 case "`ipcs 2>&1`" in
11884 "SVID messages"*"not configured"*)
11885 echo "Your $osname does not have the sem*(2) configured." >&4
11886 h_sem=false
11887 val="$undef"
11888 set semctl d_semctl
11889 eval $setvar
11890 set semget d_semget
11891 eval $setvar
11892 set semop d_semop
11893 eval $setvar
11894 ;;
11895 esac
11896 ;;
11897esac
11898: we could also check for sys/ipc.h ...
11899if $h_sem && $test `./findhdr sys/sem.h`; then
11900 echo "You have the full sem*(2) library." >&4
11901 val="$define"
11902else
11903 echo "You don't have the full sem*(2) library." >&4
11904 val="$undef"
11905fi
11906set d_sem
11907eval $setvar
11908
11909: see whether sys/sem.h defines union semun
11910echo " "
11911$cat > try.c <<'END'
11912#include <sys/types.h>
11913#include <sys/ipc.h>
11914#include <sys/sem.h>
11915int main () { union semun semun; semun.buf = 0; }
11916END
11917set try
11918if eval $compile; then
11919 echo "You have union semun in <sys/sem.h>." >&4
11920 val="$define"
11921else
11922 echo "You do not have union semun in <sys/sem.h>." >&4
11923 val="$undef"
11924fi
11925$rm -f try try.c try.h
11926set d_union_semun
11927eval $setvar
11928
11929: see how to do semctl IPC_STAT
11930case "$d_sem" in
11931$define)
11932 : see whether semctl IPC_STAT can use union semun
11933 echo " "
11934 $cat > try.h <<END
11935#ifndef S_IRUSR
11936# ifdef S_IREAD
11937# define S_IRUSR S_IREAD
11938# define S_IWUSR S_IWRITE
11939# define S_IXUSR S_IEXEC
11940# else
11941# define S_IRUSR 0400
11942# define S_IWUSR 0200
11943# define S_IXUSR 0100
11944# endif
11945# define S_IRGRP (S_IRUSR>>3)
11946# define S_IWGRP (S_IWUSR>>3)
11947# define S_IXGRP (S_IXUSR>>3)
11948# define S_IROTH (S_IRUSR>>6)
11949# define S_IWOTH (S_IWUSR>>6)
11950# define S_IXOTH (S_IXUSR>>6)
11951#endif
11952#ifndef S_IRWXU
11953# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11954# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11955# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11956#endif
11957END
11958
11959 $cat > try.c <<END
11960#include <sys/types.h>
11961#include <sys/ipc.h>
11962#include <sys/sem.h>
11963#include <sys/stat.h>
11964#include <stdio.h>
11965#include <errno.h>
11966#include "try.h"
11967#ifndef errno
11968extern int errno;
11969#endif
11970#$d_union_semun HAS_UNION_SEMUN
11971int main() {
11972 union semun
11973#ifndef HAS_UNION_SEMUN
11974 {
11975 int val;
11976 struct semid_ds *buf;
11977 unsigned short *array;
11978 }
11979#endif
11980 arg;
11981 int sem, st;
11982
11983#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11984 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11985 if (sem > -1) {
11986 struct semid_ds argbuf;
11987 arg.buf = &argbuf;
11988# ifdef IPC_STAT
11989 st = semctl(sem, 0, IPC_STAT, arg);
11990 if (st == 0)
11991 printf("semun\n");
11992 else
11993# endif /* IPC_STAT */
11994 printf("semctl IPC_STAT failed: errno = %d\n", errno);
11995# ifdef IPC_RMID
11996 if (semctl(sem, 0, IPC_RMID, arg) != 0)
11997# endif /* IPC_RMID */
11998 printf("semctl IPC_RMID failed: errno = %d\n", errno);
11999 } else
12000#endif /* IPC_PRIVATE && ... */
12001 printf("semget failed: errno = %d\n", errno);
12002 return 0;
12003}
12004END
12005 val="$undef"
12006 set try
12007 if eval $compile; then
5440bc8e 12008 xxx=`$run ./try`
b4eb6b3d
JH
12009 case "$xxx" in
12010 semun) val="$define" ;;
12011 esac
12012 fi
12013 $rm -f try try.c
12014 set d_semctl_semun
12015 eval $setvar
12016 case "$d_semctl_semun" in
12017 $define)
12018 echo "You can use union semun for semctl IPC_STAT." >&4
12019 also='also'
12020 ;;
12021 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
12022 also=''
12023 ;;
12024 esac
12025
12026 : see whether semctl IPC_STAT can use struct semid_ds pointer
12027 $cat > try.c <<'END'
12028#include <sys/types.h>
12029#include <sys/ipc.h>
12030#include <sys/sem.h>
12031#include <sys/stat.h>
12032#include "try.h"
12033#include <stdio.h>
12034#include <errno.h>
12035#ifndef errno
12036extern int errno;
12037#endif
12038int main() {
12039 struct semid_ds arg;
12040 int sem, st;
12041
12042#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
12043 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
12044 if (sem > -1) {
12045# ifdef IPC_STAT
12046 st = semctl(sem, 0, IPC_STAT, &arg);
12047 if (st == 0)
12048 printf("semid_ds\n");
12049 else
12050# endif /* IPC_STAT */
12051 printf("semctl IPC_STAT failed: errno = %d\n", errno);
12052# ifdef IPC_RMID
12053 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
12054# endif /* IPC_RMID */
12055 printf("semctl IPC_RMID failed: errno = %d\n", errno);
12056 } else
12057#endif /* IPC_PRIVATE && ... */
12058 printf("semget failed: errno = %d\n", errno);
12059
12060 return 0;
12061}
12062END
12063 val="$undef"
12064 set try
12065 if eval $compile; then
5440bc8e 12066 xxx=`$run ./try`
b4eb6b3d
JH
12067 case "$xxx" in
12068 semid_ds) val="$define" ;;
12069 esac
12070 fi
12071 $rm -f try try.c
12072 set d_semctl_semid_ds
12073 eval $setvar
12074 case "$d_semctl_semid_ds" in
12075 $define)
12076 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
12077 ;;
12078 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
12079 ;;
12080 esac
12081 $rm -f try.h
12082 ;;
12083*) val="$undef"
12084
12085 # We do not have the full sem*(2) library, so assume we can not
12086 # use either.
12087
12088 set d_semctl_semun
12089 eval $setvar
12090
12091 set d_semctl_semid_ds
12092 eval $setvar
12093 ;;
12094esac
12095
4e0554ec
JH
12096: see if sendmsg exists
12097set sendmsg d_sendmsg
12098eval $inlibc
12099
b4eb6b3d
JH
12100: see if setegid exists
12101set setegid d_setegid
12102eval $inlibc
12103
12104: see if seteuid exists
12105set seteuid d_seteuid
12106eval $inlibc
12107
12108: see if setgrent exists
12109set setgrent d_setgrent
12110eval $inlibc
12111
12112: see if sethostent exists
12113set sethostent d_sethent
12114eval $inlibc
12115
4e0554ec
JH
12116: see if setitimer exists
12117set setitimer d_setitimer
12118eval $inlibc
12119
b4eb6b3d
JH
12120: see if setlinebuf exists
12121set setlinebuf d_setlinebuf
12122eval $inlibc
12123
12124: see if setlocale exists
12125set setlocale d_setlocale
12126eval $inlibc
12127
12128: see if setnetent exists
12129set setnetent d_setnent
12130eval $inlibc
12131
12132: see if setprotoent exists
12133set setprotoent d_setpent
12134eval $inlibc
12135
12136: see if setpgid exists
12137set setpgid d_setpgid
12138eval $inlibc
12139
12140: see if setpgrp2 exists
12141set setpgrp2 d_setpgrp2
12142eval $inlibc
12143
12144: see if setpriority exists
12145set setpriority d_setprior
12146eval $inlibc
12147
12148: see if setproctitle exists
12149set setproctitle d_setproctitle
12150eval $inlibc
12151
12152: see if setpwent exists
12153set setpwent d_setpwent
12154eval $inlibc
12155
12156: see if setregid exists
12157set setregid d_setregid
12158eval $inlibc
12159set setresgid d_setresgid
12160eval $inlibc
12161
12162: see if setreuid exists
12163set setreuid d_setreuid
12164eval $inlibc
12165set setresuid d_setresuid
12166eval $inlibc
12167
12168: see if setrgid exists
12169set setrgid d_setrgid
12170eval $inlibc
12171
12172: see if setruid exists
12173set setruid d_setruid
12174eval $inlibc
12175
12176: see if setservent exists
12177set setservent d_setsent
12178eval $inlibc
12179
12180: see if setsid exists
12181set setsid d_setsid
12182eval $inlibc
12183
12184: see if setvbuf exists
12185set setvbuf d_setvbuf
12186eval $inlibc
12187
12188: see if sfio.h is available
12189set sfio.h i_sfio
12190eval $inhdr
12191
12192
12193: see if sfio library is available
12194case "$i_sfio" in
12195$define)
12196 val=''
12197 set sfreserve val
12198 eval $inlibc
12199 ;;
12200*)
12201 val="$undef"
12202 ;;
12203esac
12204: Ok, but do we want to use it.
12205case "$val" in
12206$define)
12207 case "$usesfio" in
12208 true|$define|[yY]*) dflt='y';;
12209 *) dflt='n';;
12210 esac
12211 echo "$package can use the sfio library, but it is experimental."
12212 case "$useperlio" in
12213 "$undef")
12214 echo "For sfio also the PerlIO abstraction layer is needed."
12215 echo "Earlier you said you wouldn't want that."
12216 ;;
12217 esac
12218 rp="You seem to have sfio available, do you want to try using it?"
12219 . ./myread
12220 case "$ans" in
12221 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
12222 useperlio="$define"
12223 val="$define"
12224 ;;
12225 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
12226 val="$undef"
b4eb6b3d
JH
12227 ;;
12228 esac
12229 ;;
12230*) case "$usesfio" in
12231 true|$define|[yY]*)
12232 echo "Sorry, cannot find sfio on this machine." >&4
12233 echo "Ignoring your setting of usesfio=$usesfio." >&4
12234 val="$undef"
12235 ;;
12236 esac
12237 ;;
12238esac
12239set d_sfio
12240eval $setvar
12241case "$d_sfio" in
12242$define) usesfio='true';;
12243*) usesfio='false';;
12244esac
3659ebf1
JH
12245case "$d_sfio" in
12246$define) ;;
12247*) : Remove sfio from list of libraries to use
7483f793
JH
12248 case "$libs" in
12249 *-lsfio*)
12250 echo "Removing unneeded -lsfio from library list" >&4
12251 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
12252 shift
12253 libs="$*"
12254 echo "libs = $libs" >&4
12255 ;;
12256 esac
3659ebf1
JH
12257;;
12258esac
12259
b4eb6b3d
JH
12260
12261: see if shmctl exists
12262set shmctl d_shmctl
12263eval $inlibc
12264
12265: see if shmget exists
12266set shmget d_shmget
12267eval $inlibc
12268
12269: see if shmat exists
12270set shmat d_shmat
12271eval $inlibc
12272: see what shmat returns
12273case "$d_shmat" in
12274"$define")
12275 $cat >shmat.c <<'END'
12276#include <sys/shm.h>
12277void *shmat();
12278END
12279 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
12280 shmattype='void *'
12281 else
12282 shmattype='char *'
12283 fi
12284 echo "and it returns ($shmattype)." >&4
12285 : see if a prototype for shmat is available
12286 xxx=`./findhdr sys/shm.h`
12287 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
12288 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
12289 val="$define"
12290 else
12291 val="$undef"
12292 fi
12293 $rm -f shmat.[co]
12294 ;;
12295*)
12296 val="$undef"
12297 ;;
12298esac
12299set d_shmatprototype
12300eval $setvar
12301
12302: see if shmdt exists
12303set shmdt d_shmdt
12304eval $inlibc
12305
12306: see how much of the 'shm*(2)' library is present.
12307h_shm=true
12308echo " "
12309case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
12310*"$undef"*) h_shm=false;;
12311esac
12312case "$osname" in
12313freebsd)
12314 case "`ipcs 2>&1`" in
12315 "SVID shared memory"*"not configured"*)
12316 echo "Your $osname does not have the shm*(2) configured." >&4
12317 h_shm=false
12318 val="$undef"
12319 set shmctl d_shmctl
12320 evat $setvar
12321 set shmget d_shmget
12322 evat $setvar
12323 set shmat d_shmat
12324 evat $setvar
12325 set shmdt d_shmdt
12326 evat $setvar
12327 ;;
12328 esac
12329 ;;
12330esac
12331: we could also check for sys/ipc.h ...
12332if $h_shm && $test `./findhdr sys/shm.h`; then
12333 echo "You have the full shm*(2) library." >&4
12334 val="$define"
12335else
12336 echo "You don't have the full shm*(2) library." >&4
12337 val="$undef"
12338fi
12339set d_shm
12340eval $setvar
12341
12342echo " "
12343: see if we have sigaction
12344if set sigaction val -f d_sigaction; eval $csym; $val; then
12345 echo 'sigaction() found.' >&4
12346 $cat > try.c <<'EOP'
12347#include <stdio.h>
12348#include <sys/types.h>
12349#include <signal.h>
12350int main()
12351{
12352 struct sigaction act, oact;
12353 act.sa_flags = 0;
12354 oact.sa_handler = 0;
12355 /* so that act and oact are used */
12356 exit(act.sa_flags == 0 && oact.sa_handler == 0);
12357}
12358EOP
12359 set try
12360 if eval $compile_ok; then
12361 val="$define"
12362 else
12363 echo "But you don't seem to have a useable struct sigaction." >&4
12364 val="$undef"
12365 fi
12366else
12367 echo 'sigaction NOT found.' >&4
12368 val="$undef"
12369fi
12370set d_sigaction; eval $setvar
12371$rm -f try try$_o try.c
12372
983dbef6
JH
12373: see if sigprocmask exists
12374set sigprocmask d_sigprocmask
12375eval $inlibc
12376
b4eb6b3d
JH
12377: see if sigsetjmp exists
12378echo " "
12379case "$d_sigsetjmp" in
12380'')
12381 $cat >try.c <<'EOP'
12382#include <setjmp.h>
12383sigjmp_buf env;
12384int set = 1;
12385int main()
12386{
12387 if (sigsetjmp(env,1))
12388 exit(set);
12389 set = 0;
12390 siglongjmp(env, 1);
12391 exit(1);
12392}
12393EOP
12394 set try
12395 if eval $compile; then
5440bc8e 12396 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
12397 echo "POSIX sigsetjmp found." >&4
12398 val="$define"
12399 else
12400 $cat >&4 <<EOM
12401Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
12402I'll ignore them.
12403EOM
12404 val="$undef"
12405 fi
12406 else
12407 echo "sigsetjmp not found." >&4
12408 val="$undef"
12409 fi
12410 ;;
12411*) val="$d_sigsetjmp"
12412 case "$d_sigsetjmp" in
12413 $define) echo "POSIX sigsetjmp found." >&4;;
12414 $undef) echo "sigsetjmp not found." >&4;;
12415 esac
12416 ;;
12417esac
12418set d_sigsetjmp
12419eval $setvar
12420$rm -f try.c try
12421
49a78c82
JH
12422: see if sockatmark exists
12423set sockatmark d_sockatmark
12424eval $inlibc
12425
2ef53570
JH
12426: see if prototype for sockatmark is available
12427echo " "
12428set d_sockatmarkproto sockatmark $d_socket sys/socket.h
12429eval $hasproto
12430
b4eb6b3d
JH
12431: see if socks5_init exists
12432set socks5_init d_socks5_init
12433eval $inlibc
12434
eef837ea
JH
12435: see if prototype for setresgid is available
12436echo " "
12437set d_sresgproto setresgid $i_unistd unistd.h
12438eval $hasproto
12439
640374d0
JH
12440: see if prototype for setresuid is available
12441echo " "
12442set d_sresuproto setresuid $i_unistd unistd.h
12443eval $hasproto
12444
b4eb6b3d
JH
12445: see if sys/stat.h is available
12446set sys/stat.h i_sysstat
12447eval $inhdr
12448
12449
12450: see if stat knows about block sizes
12451echo " "
12452echo "Checking to see if your struct stat has st_blocks field..." >&4
12453set d_statblks stat st_blocks $i_sysstat sys/stat.h
12454eval $hasfield
12455
12456
12457: see if this is a sys/vfs.h system
12458set sys/vfs.h i_sysvfs
12459eval $inhdr
12460
12461
12462: see if this is a sys/statfs.h system
12463set sys/statfs.h i_sysstatfs
12464eval $inhdr
12465
12466
12467echo " "
12468echo "Checking to see if your system supports struct statfs..." >&4
12469set 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
12470eval $hasstruct
12471case "$d_statfs_s" in
12472"$define") echo "Yes, it does." ;;
12473*) echo "No, it doesn't." ;;
12474esac
12475
12476
12477
12478: see if struct statfs knows about f_flags
12479case "$d_statfs_s" in
12480define)
12481 echo " "
12482 echo "Checking to see if your struct statfs has f_flags field..." >&4
12483 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
12484 eval $hasfield
12485 ;;
12486*) val="$undef"
12487 set d_statfs_f_flags
12488 eval $setvar
12489 ;;
12490esac
12491case "$d_statfs_f_flags" in
12492"$define") echo "Yes, it does." ;;
12493*) echo "No, it doesn't." ;;
12494esac
12495
12496: see if _ptr and _cnt from stdio act std
12497echo " "
80f36755
NC
12498
12499if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12500 echo "(Looks like you have stdio.h from BSD.)"
12501 case "$stdio_ptr" in
12502 '') stdio_ptr='((fp)->_p)'
12503 ptr_lval=$define
12504 ;;
12505 *) ptr_lval=$d_stdio_ptr_lval;;
12506 esac
12507 case "$stdio_cnt" in
12508 '') stdio_cnt='((fp)->_r)'
12509 cnt_lval=$define
12510 ;;
12511 *) cnt_lval=$d_stdio_cnt_lval;;
12512 esac
12513 case "$stdio_base" in
12514 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12515 esac
12516 case "$stdio_bufsiz" in
12517 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12518 esac
12519elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
b4eb6b3d
JH
12520 echo "(Looks like you have stdio.h from Linux.)"
12521 case "$stdio_ptr" in
12522 '') stdio_ptr='((fp)->_IO_read_ptr)'
12523 ptr_lval=$define
12524 ;;
12525 *) ptr_lval=$d_stdio_ptr_lval;;
12526 esac
12527 case "$stdio_cnt" in
12528 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12529 cnt_lval=$undef
12530 ;;
12531 *) cnt_lval=$d_stdio_cnt_lval;;
12532 esac
12533 case "$stdio_base" in
12534 '') stdio_base='((fp)->_IO_read_base)';;
12535 esac
12536 case "$stdio_bufsiz" in
12537 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12538 esac
12539else
12540 case "$stdio_ptr" in
12541 '') stdio_ptr='((fp)->_ptr)'
12542 ptr_lval=$define
12543 ;;
12544 *) ptr_lval=$d_stdio_ptr_lval;;
12545 esac
12546 case "$stdio_cnt" in
12547 '') stdio_cnt='((fp)->_cnt)'
12548 cnt_lval=$define
12549 ;;
12550 *) cnt_lval=$d_stdio_cnt_lval;;
12551 esac
12552 case "$stdio_base" in
12553 '') stdio_base='((fp)->_base)';;
12554 esac
12555 case "$stdio_bufsiz" in
12556 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12557 esac
12558fi
80f36755 12559
b4eb6b3d
JH
12560: test whether _ptr and _cnt really work
12561echo "Checking how std your stdio is..." >&4
12562$cat >try.c <<EOP
12563#include <stdio.h>
12564#define FILE_ptr(fp) $stdio_ptr
12565#define FILE_cnt(fp) $stdio_cnt
12566int main() {
12567 FILE *fp = fopen("try.c", "r");
12568 char c = getc(fp);
12569 if (
12570 18 <= FILE_cnt(fp) &&
12571 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12572 )
12573 exit(0);
12574 exit(1);
12575}
12576EOP
12577val="$undef"
12578set try
5440bc8e
JH
12579if eval $compile && $to try.c; then
12580 if $run ./try; then
b4eb6b3d
JH
12581 echo "Your stdio acts pretty std."
12582 val="$define"
12583 else
12584 echo "Your stdio isn't very std."
12585 fi
12586else
12587 echo "Your stdio doesn't appear very std."
12588fi
12589$rm -f try.c try
12590set d_stdstdio
12591eval $setvar
12592
12593: Can _ptr be used as an lvalue?
12594case "$d_stdstdio$ptr_lval" in
12595$define$define) val=$define ;;
12596*) val=$undef ;;
12597esac
12598set d_stdio_ptr_lval
12599eval $setvar
12600
12601: Can _cnt be used as an lvalue?
12602case "$d_stdstdio$cnt_lval" in
12603$define$define) val=$define ;;
12604*) val=$undef ;;
12605esac
12606set d_stdio_cnt_lval
12607eval $setvar
12608
a7ffa9b9
NC
12609
12610: test whether setting _ptr sets _cnt as a side effect
12611d_stdio_ptr_lval_sets_cnt="$undef"
12612d_stdio_ptr_lval_nochange_cnt="$undef"
12613case "$d_stdio_ptr_lval$d_stdstdio" in
12614$define$define)
12615 echo "Checking to see what happens if we set the stdio ptr..." >&4
12616$cat >try.c <<EOP
12617#include <stdio.h>
12618/* Can we scream? */
12619/* Eat dust sed :-) */
c1d9e6fa 12620/* In the buffer space, no one can hear you scream. */
0bbfc344
JH
12621#define FILE_ptr(fp) $stdio_ptr
12622#define FILE_cnt(fp) $stdio_cnt
c1d9e6fa 12623#include <sys/types.h>
a7ffa9b9
NC
12624int main() {
12625 FILE *fp = fopen("try.c", "r");
c1d9e6fa 12626 int c;
a7ffa9b9
NC
12627 char *ptr;
12628 size_t cnt;
c1d9e6fa
JH
12629 if (!fp) {
12630 puts("Fail even to read");
12631 exit(1);
12632 }
12633 c = getc(fp); /* Read away the first # */
12634 if (c == EOF) {
12635 puts("Fail even to read");
12636 exit(1);
12637 }
a7ffa9b9
NC
12638 if (!(
12639 18 <= FILE_cnt(fp) &&
12640 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12641 )) {
12642 puts("Fail even to read");
12643 exit (1);
12644 }
c1d9e6fa
JH
12645 ptr = (char*) FILE_ptr(fp);
12646 cnt = (size_t)FILE_cnt(fp);
a7ffa9b9 12647
c1d9e6fa 12648 FILE_ptr(fp) += 42;
a7ffa9b9 12649
c1d9e6fa 12650 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
a7ffa9b9
NC
12651 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12652 exit (1);
12653 }
12654 if (FILE_cnt(fp) <= 20) {
12655 printf ("Fail (<20 chars to test)");
12656 exit (1);
12657 }
12658 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12659 puts("Fail compare");
12660 exit (1);
12661 }
12662 if (cnt == FILE_cnt(fp)) {
12663 puts("Pass_unchanged");
12664 exit (0);
12665 }
12666 if (FILE_cnt(fp) == (cnt - 42)) {
12667 puts("Pass_changed");
12668 exit (0);
12669 }
12670 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12671 return 1;
12672
12673}
12674EOP
12675 set try
5440bc8e
JH
12676 if eval $compile && $to try.c; then
12677 case `$run ./try` in
a7ffa9b9 12678 Pass_changed)
2e32dcfe 12679 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
a7ffa9b9
NC
12680 d_stdio_ptr_lval_sets_cnt="$define" ;;
12681 Pass_unchanged)
12682 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12683 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12684 Fail*)
12685 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12686 *)
12687 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12688 esac
12689 else
12690 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12691 fi
12692 $rm -f try.c try
12693 ;;
12694esac
12695
b4eb6b3d
JH
12696: see if _base is also standard
12697val="$undef"
12698case "$d_stdstdio" in
12699$define)
12700 $cat >try.c <<EOP
12701#include <stdio.h>
12702#define FILE_base(fp) $stdio_base
12703#define FILE_bufsiz(fp) $stdio_bufsiz
12704int main() {
12705 FILE *fp = fopen("try.c", "r");
12706 char c = getc(fp);
12707 if (
12708 19 <= FILE_bufsiz(fp) &&
12709 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12710 )
12711 exit(0);
12712 exit(1);
12713}
12714EOP
12715 set try
5440bc8e
JH
12716 if eval $compile && $to try.c; then
12717 if $run ./try; then
b4eb6b3d
JH
12718 echo "And its _base field acts std."
12719 val="$define"
12720 else
12721 echo "But its _base field isn't std."
12722 fi
12723 else
12724 echo "However, it seems to be lacking the _base field."
12725 fi
12726 $rm -f try.c try
12727 ;;
12728esac
12729set d_stdiobase
12730eval $setvar
12731
12732$cat >&4 <<EOM
12733Checking how to access stdio streams by file descriptor number...
12734EOM
12735case "$stdio_stream_array" in
12736'') $cat >try.c <<EOCP
12737#include <stdio.h>
12738int main() {
12739 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12740 printf("yes\n");
12741}
12742EOCP
12743 for s in _iob __iob __sF
12744 do
12745 set try -DSTDIO_STREAM_ARRAY=$s
12746 if eval $compile; then
5440bc8e 12747 case "`$run ./try`" in
b4eb6b3d
JH
12748 yes) stdio_stream_array=$s; break ;;
12749 esac
12750 fi
12751 done
12752 $rm -f try.* try$exe_ext
12753esac
12754case "$stdio_stream_array" in
12755'') $cat >&4 <<EOM
12756I can't figure out how to access stdio streams by file descriptor number.
12757EOM
12758 d_stdio_stream_array="$undef"
12759 ;;
12760*) $cat >&4 <<EOM
12761You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12762EOM
12763 d_stdio_stream_array="$define"
12764 ;;
12765esac
12766
12767: see if strcoll exists
12768set strcoll d_strcoll
12769eval $inlibc
12770
12771: check for structure copying
12772echo " "
12773echo "Checking to see if your C compiler can copy structs..." >&4
12774$cat >try.c <<'EOCP'
12775int main()
12776{
12777 struct blurfl {
12778 int dyick;
12779 } foo, bar;
12780
12781 foo = bar;
12782}
12783EOCP
12784if $cc -c try.c >/dev/null 2>&1 ; then
12785 val="$define"
12786 echo "Yup, it can."
12787else
12788 val="$undef"
12789 echo "Nope, it can't."
12790fi
12791set d_strctcpy
12792eval $setvar
12793$rm -f try.*
12794
12795: see if strerror and/or sys_errlist[] exist
12796echo " "
12797if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12798 if set strerror val -f d_strerror; eval $csym; $val; then
12799 echo 'strerror() found.' >&4
12800 d_strerror="$define"
12801 d_strerrm='strerror(e)'
12802 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12803 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
12804 d_syserrlst="$define"
12805 else
12806 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12807 d_syserrlst="$undef"
12808 fi
12809 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12810 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12811 echo 'strerror() found in string header.' >&4
12812 d_strerror="$define"
12813 d_strerrm='strerror(e)'
12814 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12815 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12816 d_syserrlst="$define"
12817 else
12818 echo "(You don't appear to have any sys_errlist[], how can this be?)"
12819 d_syserrlst="$undef"
12820 fi
12821 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12822 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12823 d_strerror="$undef"
12824 d_syserrlst="$define"
12825 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12826 else
12827 echo 'strerror() and sys_errlist[] NOT found.' >&4
12828 d_strerror="$undef"
12829 d_syserrlst="$undef"
12830 d_strerrm='"unknown"'
12831 fi
12832fi
12833
b3c85772
JH
12834: see if strftime exists
12835set strftime d_strftime
12836eval $inlibc
12837
b4eb6b3d
JH
12838: see if strtod exists
12839set strtod d_strtod
12840eval $inlibc
12841
12842: see if strtol exists
12843set strtol d_strtol
12844eval $inlibc
12845
12846: see if strtold exists
12847set strtold d_strtold
12848eval $inlibc
12849
12850: see if strtoll exists
12851set strtoll d_strtoll
12852eval $inlibc
12853
12854case "$d_longlong-$d_strtoll" in
12855"$define-$define")
12856 $cat <<EOM
12857Checking whether your strtoll() works okay...
12858EOM
12859 $cat >try.c <<'EOCP'
12860#include <errno.h>
12861#ifdef __hpux
12862#define strtoll __strtoll
12863#endif
e75931a7
YST
12864#ifdef __EMX__
12865#define strtoll _strtoll
12866#endif
b4eb6b3d
JH
12867#include <stdio.h>
12868extern long long int strtoll(char *s, char **, int);
12869static int bad = 0;
12870int check(char *s, long long ell, int een) {
12871 long long gll;
12872 errno = 0;
12873 gll = strtoll(s, 0, 10);
12874 if (!((gll == ell) && (errno == een)))
12875 bad++;
12876}
12877int main() {
12878 check(" 1", 1LL, 0);
12879 check(" 0", 0LL, 0);
12880 check("-1", -1LL, 0);
12881 check("-9223372036854775808", -9223372036854775808LL, 0);
12882 check("-9223372036854775808", -9223372036854775808LL, 0);
12883 check(" 9223372036854775807", 9223372036854775807LL, 0);
12884 check("-9223372036854775808", -9223372036854775808LL, 0);
12885 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
12886 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12887 if (!bad)
12888 printf("ok\n");
12889}
12890EOCP
12891 set try
12892 if eval $compile; then
5440bc8e 12893 yyy=`$run ./try`
e75931a7 12894 case "$yyy" in
b4eb6b3d
JH
12895 ok) echo "Your strtoll() seems to be working okay." ;;
12896 *) cat <<EOM >&4
12897Your strtoll() doesn't seem to be working okay.
12898EOM
12899 d_strtoll="$undef"
12900 ;;
69eadf66 12901 esac
e75931a7
YST
12902 else
12903 echo "(I can't seem to compile the test program--assuming it doesn't)"
12904 d_strtoll="$undef"
b4eb6b3d
JH
12905 fi
12906 ;;
12907esac
12908
28e5dec8
JH
12909: see if strtoq exists
12910set strtoq d_strtoq
12911eval $inlibc
12912
b4eb6b3d
JH
12913: see if strtoul exists
12914set strtoul d_strtoul
12915eval $inlibc
12916
d0e6d399
NC
12917case "$d_strtoul" in
12918"$define")
12919 $cat <<EOM
12920Checking whether your strtoul() works okay...
12921EOM
12922 $cat >try.c <<'EOCP'
12923#include <errno.h>
12924#include <stdio.h>
12925extern unsigned long int strtoul(char *s, char **, int);
12926static int bad = 0;
12927void check(char *s, unsigned long eul, int een) {
12928 unsigned long gul;
12929 errno = 0;
12930 gul = strtoul(s, 0, 10);
12931 if (!((gul == eul) && (errno == een)))
12932 bad++;
12933}
12934int main() {
12935 check(" 1", 1L, 0);
12936 check(" 0", 0L, 0);
12937EOCP
12938 case "$longsize" in
12939 8)
12940 $cat >>try.c <<'EOCP'
09c0d2c4
JH
12941 check("18446744073709551615", 18446744073709551615UL, 0);
12942 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 12943#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 12944 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
12945 check("-18446744073709551614", 2, 0);
12946 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
12947 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12948 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 12949#endif
d0e6d399
NC
12950EOCP
12951 ;;
12952 4)
12953 $cat >>try.c <<'EOCP'
12954 check("4294967295", 4294967295UL, 0);
12955 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 12956#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
12957 check("-1", 4294967295UL, 0);
12958 check("-4294967294", 2, 0);
12959 check("-4294967295", 1, 0);
12960 check("-4294967296", 4294967295UL, ERANGE);
12961 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 12962#endif
d0e6d399
NC
12963EOCP
12964 ;;
12965 *)
12966: Should we write these tests to be more portable by sprintf-ing
12967: ~0 and then manipulating that char string as input for strtol?
12968 ;;
12969 esac
12970 $cat >>try.c <<'EOCP'
12971 if (!bad)
12972 printf("ok\n");
12973 return 0;
12974}
12975EOCP
12976 set try
12977 if eval $compile; then
5440bc8e 12978 case "`$run ./try`" in
d0e6d399
NC
12979 ok) echo "Your strtoul() seems to be working okay." ;;
12980 *) cat <<EOM >&4
12981Your strtoul() doesn't seem to be working okay.
12982EOM
12983 d_strtoul="$undef"
12984 ;;
12985 esac
12986 fi
12987 ;;
12988esac
12989
b4eb6b3d
JH
12990: see if strtoull exists
12991set strtoull d_strtoull
12992eval $inlibc
12993
12994case "$d_longlong-$d_strtoull" in
12995"$define-$define")
12996 $cat <<EOM
12997Checking whether your strtoull() works okay...
12998EOM
12999 $cat >try.c <<'EOCP'
13000#include <errno.h>
13001#ifdef __hpux
13002#define strtoull __strtoull
13003#endif
13004#include <stdio.h>
13005extern unsigned long long int strtoull(char *s, char **, int);
13006static int bad = 0;
13007int check(char *s, long long eull, int een) {
13008 long long gull;
13009 errno = 0;
13010 gull = strtoull(s, 0, 10);
13011 if (!((gull == eull) && (errno == een)))
13012 bad++;
13013}
13014int main() {
d0e6d399
NC
13015 check(" 1", 1LL, 0);
13016 check(" 0", 0LL, 0);
13017 check("18446744073709551615", 18446744073709551615ULL, 0);
13018 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 13019#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
13020 check("-1", 18446744073709551615ULL, 0);
13021 check("-18446744073709551614", 2LL, 0);
13022 check("-18446744073709551615", 1LL, 0);
13023 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
13024 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 13025#endif
b4eb6b3d
JH
13026 if (!bad)
13027 printf("ok\n");
13028}
13029EOCP
13030 set try
13031 if eval $compile; then
5440bc8e 13032 case "`$run ./try`" in
b4eb6b3d
JH
13033 ok) echo "Your strtoull() seems to be working okay." ;;
13034 *) cat <<EOM >&4
13035Your strtoull() doesn't seem to be working okay.
13036EOM
13037 d_strtoull="$undef"
13038 ;;
13039 esac
13040 fi
13041 ;;
13042esac
13043
13044: see if strtouq exists
13045set strtouq d_strtouq
13046eval $inlibc
13047
d0e6d399
NC
13048case "$d_strtouq" in
13049"$define")
13050 $cat <<EOM
13051Checking whether your strtouq() works okay...
13052EOM
13053 $cat >try.c <<'EOCP'
13054#include <errno.h>
13055#include <stdio.h>
13056extern unsigned long long int strtouq(char *s, char **, int);
13057static int bad = 0;
13058void check(char *s, unsigned long long eull, int een) {
13059 unsigned long long gull;
13060 errno = 0;
13061 gull = strtouq(s, 0, 10);
13062 if (!((gull == eull) && (errno == een)))
13063 bad++;
13064}
13065int main() {
13066 check(" 1", 1LL, 0);
13067 check(" 0", 0LL, 0);
13068 check("18446744073709551615", 18446744073709551615ULL, 0);
13069 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 13070#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
13071 check("-1", 18446744073709551615ULL, 0);
13072 check("-18446744073709551614", 2LL, 0);
13073 check("-18446744073709551615", 1LL, 0);
13074 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
13075 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 13076#endif
d0e6d399
NC
13077 if (!bad)
13078 printf("ok\n");
13079 return 0;
13080}
13081EOCP
13082 set try
13083 if eval $compile; then
5440bc8e 13084 case "`$run ./try`" in
d0e6d399
NC
13085 ok) echo "Your strtouq() seems to be working okay." ;;
13086 *) cat <<EOM >&4
13087Your strtouq() doesn't seem to be working okay.
13088EOM
13089 d_strtouq="$undef"
13090 ;;
13091 esac
13092 fi
13093 ;;
13094esac
13095
b4eb6b3d
JH
13096: see if strxfrm exists
13097set strxfrm d_strxfrm
13098eval $inlibc
13099
13100: see if symlink exists
13101set symlink d_symlink
13102eval $inlibc
13103
13104: see if syscall exists
13105set syscall d_syscall
13106eval $inlibc
13107
2ef53570
JH
13108: see if prototype for syscall is available
13109echo " "
13110set d_syscallproto syscall $i_unistd unistd.h
13111eval $hasproto
13112
b4eb6b3d
JH
13113: see if sysconf exists
13114set sysconf d_sysconf
13115eval $inlibc
13116
13117: see if system exists
13118set system d_system
13119eval $inlibc
13120
13121: see if tcgetpgrp exists
13122set tcgetpgrp d_tcgetpgrp
13123eval $inlibc
13124
13125: see if tcsetpgrp exists
13126set tcsetpgrp d_tcsetpgrp
13127eval $inlibc
13128
13129: see if prototype for telldir is available
13130echo " "
13131set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
13132eval $hasproto
13133
13134: see if this is a sys/times.h system
13135set sys/times.h i_systimes
13136eval $inhdr
13137
13138: see if times exists
13139echo " "
13140if set times val -f d_times; eval $csym; $val; then
13141 echo 'times() found.' >&4
13142 d_times="$define"
13143 inc=''
13144 case "$i_systimes" in
13145 "$define") inc='sys/times.h';;
13146 esac
13147 rp="What is the type returned by times() on this system?"
13148 set clock_t clocktype long stdio.h sys/types.h $inc
13149 eval $typedef_ask
13150else
13151 echo 'times() NOT found, hope that will do.' >&4
13152 d_times="$undef"
13153 clocktype='int'
13154fi
13155
13156: see if truncate exists
13157set truncate d_truncate
13158eval $inlibc
13159
13160: see if tzname[] exists
13161echo " "
13162if set tzname val -a d_tzname; eval $csym; $val; then
13163 val="$define"
13164 echo 'tzname[] found.' >&4
13165else
13166 val="$undef"
13167 echo 'tzname[] NOT found.' >&4
13168fi
13169set d_tzname
13170eval $setvar
13171
4e0554ec
JH
13172case "$osname" in
13173next|rhapsody|darwin) multiarch="$define" ;;
13174esac
13175case "$multiarch" in
13176''|[nN]*) multiarch="$undef" ;;
13177esac
13178
13179: check for ordering of bytes in a long
13180echo " "
5440bc8e 13181case "$usecrosscompile$multiarch" in
4e0554ec
JH
13182*$define*)
13183 $cat <<EOM
13184You seem to be either cross-compiling or doing a multiarchitecture build,
13185skipping the byteorder check.
13186
13187EOM
5440bc8e 13188 byteorder='ffff'
4e0554ec
JH
13189 ;;
13190*)
13191 case "$byteorder" in
13192 '')
13193 $cat <<'EOM'
13194In the following, larger digits indicate more significance. A big-endian
13195machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
13196little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
13197machines may have weird orders like 3412. A Cray will report 87654321,
13198an Alpha will report 12345678. If the test program works the default is
13199probably right.
13200I'm now running the test program...
13201EOM
13202 $cat >try.c <<'EOCP'
13203#include <stdio.h>
13204int main()
13205{
13206 int i;
13207 union {
13208 unsigned long l;
13209 char c[sizeof(long)];
13210 } u;
13211
13212 if (sizeof(long) > 4)
13213 u.l = (0x08070605L << 32) | 0x04030201L;
13214 else
13215 u.l = 0x04030201L;
13216 for (i = 0; i < sizeof(long); i++)
13217 printf("%c", u.c[i]+'0');
13218 printf("\n");
13219 exit(0);
13220}
13221EOCP
13222 xxx_prompt=y
13223 set try
13224 if eval $compile && ./try > /dev/null; then
5440bc8e 13225 dflt=`$run ./try`
4e0554ec
JH
13226 case "$dflt" in
13227 [1-4][1-4][1-4][1-4]|12345678|87654321)
13228 echo "(The test program ran ok.)"
13229 echo "byteorder=$dflt"
13230 xxx_prompt=n
13231 ;;
13232 ????|????????) echo "(The test program ran ok.)" ;;
13233 *) echo "(The test program didn't run right for some reason.)" ;;
13234 esac
13235 else
13236 dflt='4321'
13237 cat <<'EOM'
13238(I can't seem to compile the test program. Guessing big-endian...)
13239EOM
13240 fi
13241 case "$xxx_prompt" in
13242 y)
13243 rp="What is the order of bytes in a long?"
13244 . ./myread
13245 byteorder="$ans"
13246 ;;
13247 *) byteorder=$dflt
13248 ;;
13249 esac
13250 ;;
13251 esac
13252 $rm -f try.c try
13253 ;;
13254esac
13255
13256
13257$cat <<EOM
13258
13259Checking to see whether you can access character data unalignedly...
13260EOM
13261$cat >try.c <<EOCP
13262#include <stdio.h>
13263#define U32 $u32type
13264#define BYTEORDER $byteorder
13265int main() {
13266#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
13267 U8 buf[] = "\0\0\0\1\0\0\0\0";
13268 U32 *up;
13269 int i;
13270
13271 if (sizeof(U32) != 4) {
13272 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
13273 exit(1);
13274 }
13275
13276 fflush(stdout);
13277
13278 for (i = 0; i < 4; i++) {
13279 up = (U32*)(buf + i);
13280 if (! ((*up == 1 << (8*i)) || /* big-endian */
13281 (*up == 1 << (8*(3-i))) /* little-endian */
13282 )
13283 )
13284 {
13285 printf("read failed (%x)\n", *up);
13286 exit(2);
13287 }
13288 }
13289
13290 /* write test */
13291 for (i = 0; i < 4; i++) {
13292 up = (U32*)(buf + i);
13293 *up = 0xBeef;
13294 if (*up != 0xBeef) {
13295 printf("write failed (%x)\n", *up);
13296 exit(3);
13297 }
13298 }
13299
13300 exit(0);
13301#else
13302 printf("1\n");
13303 exit(1);
13304#endif
13305 return 0;
13306}
13307EOCP
13308set try
13309if eval $compile_ok; then
5440bc8e
JH
13310 echo "(Testing for character data alignment may dump core.)" >&4
13311 $run ./try 2>&1 >/dev/null
4e0554ec
JH
13312 case "$?" in
13313 0) cat >&4 <<EOM
13314You can access character data pretty unalignedly.
13315EOM
13316 d_u32align="$undef"
13317 ;;
13318 *) cat >&4 <<EOM
13319It seems that you must access character data in an aligned manner.
13320EOM
13321 d_u32align="$define"
13322 ;;
13323 esac
13324 $rm -f core core.try.* try.core
13325else
13326 rp='Can you access character data at unaligned addresses?'
13327 dflt='n'
13328 . ./myread
13329 case "$ans" in
13330 [yY]*) d_u32align="$undef" ;;
13331 *) d_u32align="$define" ;;
13332 esac
13333fi
13334
13335: see if ualarm exists
13336set ualarm d_ualarm
13337eval $inlibc
13338
b4eb6b3d
JH
13339: see if umask exists
13340set umask d_umask
13341eval $inlibc
13342
758a5d79
JH
13343: see if unordered exists
13344set unordered d_unordered
13345eval $inlibc
13346
4e0554ec
JH
13347: see if usleep exists
13348set usleep d_usleep
13349eval $inlibc
13350
2ef53570
JH
13351: see if prototype for usleep is available
13352echo " "
13353set d_usleepproto usleep $i_unistd unistd.h
13354eval $hasproto
13355
b4eb6b3d
JH
13356: see if ustat exists
13357set ustat d_ustat
13358eval $inlibc
13359
13360: backward compatibility for d_hvfork
13361if test X$d_hvfork != X; then
13362 d_vfork="$d_hvfork"
13363 d_hvfork=''
13364fi
13365: see if there is a vfork
13366val=''
13367set vfork val
13368eval $inlibc
13369
13370: Ok, but do we want to use it. vfork is reportedly unreliable in
13371: perl on Solaris 2.x, and probably elsewhere.
13372case "$val" in
13373$define)
13374 echo " "
13375 case "$usevfork" in
13376 false) dflt='n';;
13377 *) dflt='y';;
13378 esac
13379 cat <<'EOM'
13380
13381Perl can only use a vfork() that doesn't suffer from strict
13382restrictions on calling functions or modifying global data in
13383the child. For example, glibc-2.1 contains such a vfork()
13384that is unsuitable. If your system provides a proper fork()
13385call, chances are that you do NOT want perl to use vfork().
13386
13387EOM
13388 rp="Do you still want to use vfork()?"
13389 . ./myread
13390 case "$ans" in
13391 y|Y) ;;
13392 *)
13393 echo "Ok, we won't use vfork()."
13394 val="$undef"
13395 ;;
13396 esac
13397 ;;
13398esac
13399set d_vfork
13400eval $setvar
13401case "$d_vfork" in
13402$define) usevfork='true';;
13403*) usevfork='false';;
13404esac
13405
13406: see if this is an sysdir system
13407set sys/dir.h i_sysdir
13408eval $inhdr
13409
13410: see if this is an sysndir system
13411set sys/ndir.h i_sysndir
13412eval $inhdr
13413
13414: see if closedir exists
13415set closedir d_closedir
13416eval $inlibc
13417
13418case "$d_closedir" in
13419"$define")
13420 echo " "
13421 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 13422 cat > try.c <<EOM
b4eb6b3d
JH
13423#$i_dirent I_DIRENT /**/
13424#$i_sysdir I_SYS_DIR /**/
13425#$i_sysndir I_SYS_NDIR /**/
13426#$i_systypes I_SYS_TYPES /**/
13427
13428#if defined(I_SYS_TYPES)
13429#include <sys/types.h>
13430#endif
13431#if defined(I_DIRENT)
13432#include <dirent.h>
13433#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
13434#include <sys/dir.h>
13435#endif
13436#else
13437#ifdef I_SYS_NDIR
13438#include <sys/ndir.h>
13439#else
13440#ifdef I_SYS_DIR
13441#ifdef hp9000s500
13442#include <ndir.h> /* may be wrong in the future */
13443#else
13444#include <sys/dir.h>
13445#endif
13446#endif
13447#endif
13448#endif
13449int main() { return closedir(opendir(".")); }
13450EOM
5440bc8e 13451 set try
b4eb6b3d 13452 if eval $compile_ok; then
5440bc8e 13453 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
13454 echo "Yes, it does."
13455 val="$undef"
13456 else
13457 echo "No, it doesn't."
13458 val="$define"
13459 fi
13460 else
13461 echo "(I can't seem to compile the test program--assuming it doesn't)"
13462 val="$define"
13463 fi
13464 ;;
13465*)
13466 val="$undef";
13467 ;;
13468esac
13469set d_void_closedir
13470eval $setvar
5440bc8e 13471$rm -f try try.*
b4eb6b3d
JH
13472: see if there is a wait4
13473set wait4 d_wait4
13474eval $inlibc
13475
13476: see if waitpid exists
13477set waitpid d_waitpid
13478eval $inlibc
13479
13480: see if wcstombs exists
13481set wcstombs d_wcstombs
13482eval $inlibc
13483
13484: see if wctomb exists
13485set wctomb d_wctomb
13486eval $inlibc
13487
4e0554ec
JH
13488: see if writev exists
13489set writev d_writev
13490eval $inlibc
13491
b4eb6b3d
JH
13492: preserve RCS keywords in files with variable substitution, grrr
13493Date='$Date'
13494Id='$Id'
13495Log='$Log'
13496RCSfile='$RCSfile'
13497Revision='$Revision'
13498
b4eb6b3d
JH
13499: check for alignment requirements
13500echo " "
5440bc8e 13501case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
13502*$define*)
13503 $cat <<EOM
13504You seem to be either cross-compiling or doing a multiarchitecture build,
13505skipping the memory alignment check.
13506
13507EOM
13508 case "$alignbytes" in
13509 '') alignbytes=8 ;;
13510 esac
13511 ;;
13512*)
13513 case "$alignbytes" in
13514 '') echo "Checking alignment constraints..." >&4
13515 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
13516 $cat >try.c <<'EOCP'
13517typedef long double NV;
13518EOCP
13519 else
13520 $cat >try.c <<'EOCP'
13521typedef double NV;
13522EOCP
13523 fi
13524 $cat >>try.c <<'EOCP'
13525#include <stdio.h>
13526struct foobar {
13527 char foo;
13528 NV bar;
13529} try_algn;
13530int main()
13531{
13532 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
13533 return(0);
13534}
13535EOCP
13536 set try
13537 if eval $compile_ok; then
5440bc8e 13538 dflt=`$run ./try`
b4eb6b3d
JH
13539 else
13540 dflt='8'
13541 echo "(I can't seem to compile the test program...)"
13542 fi
13543 ;;
13544 *) dflt="$alignbytes"
13545 ;;
13546 esac
13547 rp="Doubles must be aligned on a how-many-byte boundary?"
13548 . ./myread
13549 alignbytes="$ans"
13550 $rm -f try.c try
13551 ;;
13552esac
13553
13554
13555: set the base revision
13556baserev=5.0
13557
b4eb6b3d
JH
13558: how do we catenate cpp tokens here?
13559echo " "
13560echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
13561$cat >cpp_stuff.c <<'EOCP'
13562#define RCAT(a,b)a/**/b
13563#define ACAT(a,b)a ## b
13564RCAT(Rei,ser)
13565ACAT(Cir,cus)
13566EOCP
13567$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
13568if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
13569 echo "Oh! Smells like ANSI's been here." >&4
13570 echo "We can catify or stringify, separately or together!"
13571 cpp_stuff=42
13572elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
13573 echo "Ah, yes! The good old days!" >&4
13574 echo "However, in the good old days we don't know how to stringify and"
13575 echo "catify at the same time."
13576 cpp_stuff=1
13577else
13578 $cat >&4 <<EOM
13579Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
13580to have to edit the values of CAT[2-5] in config.h...
13581EOM
13582 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
13583fi
13584$rm -f cpp_stuff.*
13585
13586: see if this is a db.h system
13587set db.h i_db
13588eval $inhdr
13589
13590case "$i_db" in
13591$define)
13592 : Check db version.
13593 echo " "
13594 echo "Checking Berkeley DB version ..." >&4
13595 $cat >try.c <<EOCP
13596#$d_const HASCONST
13597#ifndef HASCONST
13598#define const
13599#endif
13600#include <sys/types.h>
13601#include <stdio.h>
13602#include <db.h>
640374d0 13603int main(int argc, char *argv[])
b4eb6b3d
JH
13604{
13605#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
13606 int Major, Minor, Patch ;
13607 unsigned long Version ;
13608 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
13609 if (argc == 2) {
13610 printf("%d %d %d %d %d %d\n",
13611 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
13612 Major, Minor, Patch);
13613 exit(0);
13614 }
13615 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
13616
13617 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13618 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13619 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13620 Major, Minor, Patch) ;
13621
13622 /* check that db.h & libdb are compatible */
13623 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 13624 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
13625 exit(3);
13626 }
13627
640374d0 13628 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
13629
13630 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13631 + DB_VERSION_PATCH ;
13632
13633 /* needs to be >= 2.3.4 */
13634 if (Version < 2003004) {
13635 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 13636 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
13637 exit(2);
13638 }
13639
13640 exit(0);
13641#else
13642#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
13643 if (argc == 2) {
13644 printf("1 0 0\n");
13645 exit(0);
13646 }
13647 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
13648 exit(0); /* DB version < 2: the coast is clear. */
13649#else
13650 exit(1); /* <db.h> not Berkeley DB? */
13651#endif
13652#endif
13653}
13654EOCP
13655 set try
5440bc8e 13656 if eval $compile_ok && $run ./try; then
b4eb6b3d 13657 echo 'Looks OK.' >&4
5440bc8e 13658 set `$run ./try 1`
640374d0
JH
13659 db_version_major=$1
13660 db_version_minor=$2
13661 db_version_patch=$3
b4eb6b3d
JH
13662 else
13663 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
13664 i_db=$undef
13665 case " $libs " in
13666 *"-ldb "*)
13667 : Remove db from list of libraries to use
13668 echo "Removing unusable -ldb from library list" >&4
13669 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13670 shift
13671 libs="$*"
13672 echo "libs = $libs" >&4
13673 ;;
13674 esac
13675 fi
13676 $rm -f try.*
13677 ;;
13678esac
13679
13680case "$i_db" in
13681define)
13682 : Check the return type needed for hash
13683 echo " "
13684 echo "Checking return type needed for hash for Berkeley DB ..." >&4
13685 $cat >try.c <<EOCP
13686#$d_const HASCONST
13687#ifndef HASCONST
13688#define const
13689#endif
13690#include <sys/types.h>
13691#include <db.h>
13692
13693#ifndef DB_VERSION_MAJOR
13694u_int32_t hash_cb (ptr, size)
13695const void *ptr;
13696size_t size;
13697{
13698}
13699HASHINFO info;
13700int main()
13701{
13702 info.hash = hash_cb;
13703}
13704#endif
13705EOCP
13706 if $cc $ccflags -c try.c >try.out 2>&1 ; then
13707 if $contains warning try.out >>/dev/null 2>&1 ; then
13708 db_hashtype='int'
13709 else
13710 db_hashtype='u_int32_t'
13711 fi
13712 else
13713 : XXX Maybe we should just give up here.
13714 db_hashtype=u_int32_t
13715 $cat try.out >&4
13716 echo "Help: I can't seem to compile the db test program." >&4
13717 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13718 fi
13719 $rm -f try.*
13720 echo "Your version of Berkeley DB uses $db_hashtype for hash."
13721 ;;
13722*) db_hashtype=u_int32_t
13723 ;;
13724esac
13725case "$i_db" in
13726define)
13727 : Check the return type needed for prefix
13728 echo " "
13729 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13730 cat >try.c <<EOCP
13731#$d_const HASCONST
13732#ifndef HASCONST
13733#define const
13734#endif
13735#include <sys/types.h>
13736#include <db.h>
13737
13738#ifndef DB_VERSION_MAJOR
13739size_t prefix_cb (key1, key2)
13740const DBT *key1;
13741const DBT *key2;
13742{
13743}
13744BTREEINFO info;
13745int main()
13746{
13747 info.prefix = prefix_cb;
13748}
13749#endif
13750EOCP
13751 if $cc $ccflags -c try.c >try.out 2>&1 ; then
13752 if $contains warning try.out >>/dev/null 2>&1 ; then
13753 db_prefixtype='int'
13754 else
13755 db_prefixtype='size_t'
13756 fi
13757 else
13758 db_prefixtype='size_t'
13759 : XXX Maybe we should just give up here.
13760 $cat try.out >&4
13761 echo "Help: I can't seem to compile the db test program." >&4
13762 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13763 fi
13764 $rm -f try.*
13765 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13766 ;;
13767*) db_prefixtype='size_t'
13768 ;;
13769esac
13770
b4eb6b3d
JH
13771
13772: How can we generate normalized random numbers ?
13773echo " "
13774echo "Looking for a random number function..." >&4
13775case "$randfunc" in
13776'')
13777 if set drand48 val -f; eval $csym; $val; then
13778 dflt="drand48"
13779 echo "Good, found drand48()." >&4
13780 elif set random val -f; eval $csym; $val; then
13781 dflt="random"
13782 echo "OK, found random()." >&4
13783 else
13784 dflt="rand"
13785 echo "Yick, looks like I have to use rand()." >&4
13786 fi
13787 echo " "
13788 ;;
13789*)
13790 dflt="$randfunc"
13791 ;;
13792esac
13793cont=true
13794
13795case "$ccflags" in
13796*-Dmy_rand=*|*-Dmy_srand=*)
13797 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13798 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13799 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13800 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13801 ;;
13802esac
13803
13804while $test "$cont"; do
13805 rp="Use which function to generate random numbers?"
13806 . ./myread
13807 if $test "$ans" = "$dflt"; then
13808 : null
13809 else
13810 randbits=''
13811 fi
13812 randfunc="$ans"
13813 if set $ans val -f; eval $csym; $val; then
13814 cont=''
13815 else
13816 dflt=y
13817 rp="I cannot find function $ans. Use that name anyway?"
13818 . ./myread
13819 dflt=rand
13820 case "$ans" in
13821 [yY]*) cont='';;
13822 esac
13823 fi
13824 case "$cont" in
13825 '')
13826 case "$randfunc" in
13827 drand48)
13828 drand01="drand48()"
13829 seedfunc="srand48"
13830 randbits=48
13831 randseedtype=long
13832 ;;
13833 rand|random)
13834 case "$randbits" in
13835 '')
13836echo "Checking to see how many bits your $randfunc() function produces..." >&4
13837 $cat >try.c <<EOCP
13838#$i_unistd I_UNISTD
13839#$i_stdlib I_STDLIB
13840#include <stdio.h>
13841#ifdef I_UNISTD
13842# include <unistd.h>
13843#endif
13844#ifdef I_STDLIB
13845# include <stdlib.h>
13846#endif
13847int main()
13848{
13849 register int i;
13850 register unsigned long tmp;
13851 register unsigned long max = 0L;
13852
13853 for (i = 1000; i; i--) {
13854 tmp = (unsigned long) $randfunc();
13855 if (tmp > max) max = tmp;
13856 }
13857 for (i = 0; max; i++)
13858 max /= 2;
13859 printf("%d\n",i);
13860}
13861EOCP
13862 set try
13863 if eval $compile_ok; then
13864 dflt=`try`
13865 else
13866 dflt='?'
13867 echo "(I can't seem to compile the test program...)"
13868 fi
13869 ;;
13870 *)
13871 dflt="$randbits"
13872 ;;
13873 esac
13874 rp="How many bits does your $randfunc() function produce?"
13875 . ./myread
13876 randbits="$ans"
13877 $rm -f try.c try
13878 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13879 seedfunc="s$randfunc"
13880 randseedtype=unsigned
13881 ;;
13882 *)
13883 dflt="31"
13884 rp="How many bits does your $randfunc() function produce?"
13885 . ./myread
13886 randbits="$ans"
13887 seedfunc="s$randfunc"
13888 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13889 if set $seedfunc val -f; eval $csym; $val; then
13890 echo "(Using $seedfunc() to seed random generator)"
13891 else
13892 echo "(Warning: no $seedfunc() to seed random generator)"
13893 seedfunc=rand
13894 fi
13895 randseedtype=unsigned
13896 ;;
13897 esac
13898 ;;
13899 esac
13900done
13901
13902echo " "
13903echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 13904$cat >try.c <<'EOM'
b4eb6b3d
JH
13905int main()
13906{
13907 if ('M'==0xd4) return 0;
13908 return 1;
13909}
13910EOM
13911
13912val=$undef
5440bc8e 13913set try
b4eb6b3d 13914if eval $compile_ok; then
5440bc8e 13915 if $run ./try; then
b4eb6b3d
JH
13916 echo "You seem to speak EBCDIC." >&4
13917 val="$define"
13918 else
5440bc8e 13919 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
13920 fi
13921else
13922 echo "I'm unable to compile the test program." >&4
13923 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13924fi
5440bc8e 13925$rm -f try try.*
b4eb6b3d
JH
13926set ebcdic
13927eval $setvar
13928
13929echo " "
13930$cat >&4 <<EOM
13931Checking how to flush all pending stdio output...
13932EOM
13933# I only know how to find the first 32 possibly open files on SunOS.
13934# See also hints/sunos_4_1.sh and util.c --AD
13935case "$osname" in
13936sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13937esac
13938$cat >>try.c <<EOCP
13939#include <stdio.h>
13940#$i_unistd I_UNISTD
13941#ifdef I_UNISTD
13942# include <unistd.h>
13943#endif
13944#$d_sysconf HAS_SYSCONF
13945#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13946#ifdef HAS_STDIO_STREAM_ARRAY
13947# define STDIO_STREAM_ARRAY $stdio_stream_array
13948#endif
13949int main() {
5440bc8e
JH
13950 FILE* p;
13951 unlink("try.out");
13952 p = fopen("try.out", "w");
b4eb6b3d
JH
13953#ifdef TRY_FPUTC
13954 fputc('x', p);
13955#else
13956# ifdef TRY_FPRINTF
13957 fprintf(p, "x");
13958# endif
13959#endif
13960#ifdef TRY_FFLUSH_NULL
13961 fflush(NULL);
13962#endif
13963#ifdef TRY_FFLUSH_ALL
13964 {
13965 long open_max = -1;
13966# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13967 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13968# else
13969# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13970 open_max = sysconf(_SC_OPEN_MAX);
13971# else
13972# ifdef FOPEN_MAX
13973 open_max = FOPEN_MAX;
13974# else
13975# ifdef OPEN_MAX
13976 open_max = OPEN_MAX;
13977# else
13978# ifdef _NFILE
13979 open_max = _NFILE;
13980# endif
13981# endif
13982# endif
13983# endif
13984# endif
13985# ifdef HAS_STDIO_STREAM_ARRAY
13986 if (open_max > 0) {
13987 long i;
13988 for (i = 0; i < open_max; i++)
13989 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13990 STDIO_STREAM_ARRAY[i]._file < open_max &&
13991 STDIO_STREAM_ARRAY[i]._flag)
13992 fflush(&STDIO_STREAM_ARRAY[i]);
13993 }
13994 }
13995# endif
13996#endif
13997 _exit(42);
13998}
13999EOCP
14000: first we have to find out how _not_ to flush
5440bc8e 14001$to try.c
b4eb6b3d
JH
14002if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
14003 output=''
14004 set try -DTRY_FPUTC
14005 if eval $compile; then
fbe73d74 14006 $run ./try 2>/dev/null
28f5ac64 14007 code="$?"
5440bc8e 14008 $from try.out
28f5ac64 14009 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
14010 output=-DTRY_FPUTC
14011 fi
14012 fi
14013 case "$output" in
14014 '')
14015 set try -DTRY_FPRINTF
b4eb6b3d 14016 if eval $compile; then
fbe73d74 14017 $run ./try 2>/dev/null
28f5ac64 14018 code="$?"
5440bc8e 14019 $from try.out
28f5ac64 14020 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
14021 output=-DTRY_FPRINTF
14022 fi
14023 fi
14024 ;;
14025 esac
14026fi
14027: check for fflush NULL behaviour
14028case "$fflushNULL" in
14029'') set try -DTRY_FFLUSH_NULL $output
14030 if eval $compile; then
5440bc8e 14031 $run ./try 2>/dev/null
b4eb6b3d 14032 code="$?"
5440bc8e 14033 $from try.out
b4eb6b3d
JH
14034 if $test -s try.out -a "X$code" = X42; then
14035 fflushNULL="`$cat try.out`"
14036 else
14037 if $test "X$code" != X42; then
14038 $cat >&4 <<EOM
14039(If this test failed, don't worry, we'll try another method shortly.)
14040EOM
14041 fi
14042 fi
14043 fi
14044 $rm -f core try.core core.try.*
14045 case "$fflushNULL" in
14046 x) $cat >&4 <<EOM
14047Your fflush(NULL) works okay for output streams.
14048Let's see if it clobbers input pipes...
14049EOM
14050# As of mid-March 2000 all versions of Solaris appear to have a stdio
14051# bug that improperly flushes the input end of pipes. So we avoid the
14052# autoflush on fork/system/exec support for now. :-(
14053$cat >tryp.c <<EOCP
14054#include <stdio.h>
14055int
14056main(int argc, char **argv)
14057{
14058 char buf[1024];
14059 int i;
14060 char *bp = buf;
14061 while (1) {
14062 while ((i = getc(stdin)) != -1
14063 && (*bp++ = i) != '\n'
14064 && bp < &buf[1024])
14065 /* DO NOTHING */ ;
14066 *bp = '\0';
14067 fprintf(stdout, "%s", buf);
14068 fflush(NULL);
14069 if (i == -1)
14070 return 0;
14071 bp = buf;
14072 }
14073}
14074EOCP
14075 fflushNULL="$define"
14076 set tryp
14077 if eval $compile; then
14078 $rm -f tryp.out
5440bc8e 14079 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
14080 if cmp tryp.c tryp.out >/dev/null 2>&1; then
14081 $cat >&4 <<EOM
14082fflush(NULL) seems to behave okay with input streams.
14083EOM
14084 fflushNULL="$define"
14085 else
14086 $cat >&4 <<EOM
14087Ouch, fflush(NULL) clobbers input pipes! We will not use it.
14088EOM
14089 fflushNULL="$undef"
14090 fi
14091 fi
14092 $rm -f core tryp.c tryp.core core.tryp.*
14093 ;;
14094 '') $cat >&4 <<EOM
14095Your fflush(NULL) isn't working (contrary to ANSI C).
14096EOM
14097 fflushNULL="$undef"
14098 ;;
14099 *) $cat >&4 <<EOM
14100Cannot figure out whether your fflush(NULL) works or not.
14101I'm assuming it doesn't (contrary to ANSI C).
14102EOM
14103 fflushNULL="$undef"
14104 ;;
14105 esac
14106 ;;
14107$define|true|[yY]*)
14108 fflushNULL="$define"
14109 ;;
14110*)
14111 fflushNULL="$undef"
14112 ;;
14113esac
14114: check explicit looping only if NULL did not work, and if the pipe
14115: bug does not show up on an explicit flush too
14116case "$fflushNULL" in
14117"$undef")
14118 $cat >tryp.c <<EOCP
14119#include <stdio.h>
14120int
14121main(int argc, char **argv)
14122{
14123 char buf[1024];
14124 int i;
14125 char *bp = buf;
14126 while (1) {
14127 while ((i = getc(stdin)) != -1
14128 && (*bp++ = i) != '\n'
14129 && bp < &buf[1024])
14130 /* DO NOTHING */ ;
14131 *bp = '\0';
14132 fprintf(stdout, "%s", buf);
14133 fflush(stdin);
14134 if (i == -1)
14135 return 0;
14136 bp = buf;
14137 }
14138}
14139EOCP
14140 set tryp
14141 if eval $compile; then
14142 $rm -f tryp.out
5440bc8e 14143 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
14144 if cmp tryp.c tryp.out >/dev/null 2>&1; then
14145 $cat >&4 <<EOM
14146Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
14147EOM
14148 : now check for fflushall behaviour
14149 case "$fflushall" in
14150 '') set try -DTRY_FFLUSH_ALL $output
14151 if eval $compile; then
14152 $cat >&4 <<EOM
14153(Now testing the other method--but note that this also may fail.)
14154EOM
5440bc8e 14155 $run ./try 2>/dev/null
28f5ac64 14156 code=$?
fbe73d74 14157 $from try.out
28f5ac64 14158 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
14159 fflushall="`$cat try.out`"
14160 fi
14161 fi
14162 $rm -f core try.core core.try.*
14163 case "$fflushall" in
14164 x) $cat >&4 <<EOM
14165Whew. Flushing explicitly all the stdio streams works.
14166EOM
14167 fflushall="$define"
14168 ;;
14169 '') $cat >&4 <<EOM
14170Sigh. Flushing explicitly all the stdio streams doesn't work.
14171EOM
14172 fflushall="$undef"
14173 ;;
14174 *) $cat >&4 <<EOM
14175Cannot figure out whether flushing stdio streams explicitly works or not.
14176I'm assuming it doesn't.
14177EOM
14178 fflushall="$undef"
14179 ;;
14180 esac
14181 ;;
14182 "$define"|true|[yY]*)
14183 fflushall="$define"
14184 ;;
14185 *)
14186 fflushall="$undef"
14187 ;;
14188 esac
14189 else
14190 $cat >&4 <<EOM
14191All is futile. Even fflush(stdin) clobbers input pipes!
14192EOM
14193 fflushall="$undef"
14194 fi
14195 else
14196 fflushall="$undef"
14197 fi
14198 $rm -f core tryp.c tryp.core core.tryp.*
14199 ;;
14200*) fflushall="$undef"
14201 ;;
14202esac
14203
14204case "$fflushNULL$fflushall" in
14205undefundef)
14206 $cat <<EOM
14207OK, I give up. I cannot figure out how to flush pending stdio output.
14208We won't be flushing handles at all before fork/exec/popen.
14209EOM
14210 ;;
14211esac
14212$rm -f try.* try$exe_ext
14213
14214: Store the full pathname to the ar program for use in the C program
14215: Respect a hint or command line value for full_ar.
14216case "$full_ar" in
14217'') full_ar=$ar ;;
14218esac
14219
14220: Store the full pathname to the sed program for use in the C program
14221full_sed=$sed
14222
14223: see what type gids are declared as in the kernel
14224echo " "
14225echo "Looking for the type for group ids returned by getgid()."
14226set gid_t gidtype xxx stdio.h sys/types.h
14227eval $typedef
14228case "$gidtype" in
14229xxx)
14230 xxx=`./findhdr sys/user.h`
14231 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
14232 case $1 in
14233 unsigned) dflt="$1 $2" ;;
14234 *) dflt="$1" ;;
14235 esac
14236 ;;
14237*) dflt="$gidtype";;
14238esac
14239case "$gidtype" in
14240gid_t) echo "gid_t found." ;;
14241*) rp="What is the type for group ids returned by getgid()?"
14242 . ./myread
14243 gidtype="$ans"
14244 ;;
14245esac
14246
14247echo " "
14248case "$gidtype" in
14249*_t) zzz="$gidtype" ;;
14250*) zzz="gid" ;;
14251esac
14252echo "Checking the size of $zzz..." >&4
14253cat > try.c <<EOCP
14254#include <sys/types.h>
14255#include <stdio.h>
14256int main() {
14257 printf("%d\n", (int)sizeof($gidtype));
14258 exit(0);
14259}
14260EOCP
14261set try
14262if eval $compile_ok; then
5440bc8e 14263 yyy=`$run ./try`
b4eb6b3d
JH
14264 case "$yyy" in
14265 '') gidsize=4
14266 echo "(I can't execute the test program--guessing $gidsize.)" >&4
14267 ;;
14268 *) gidsize=$yyy
14269 echo "Your $zzz is $gidsize bytes long."
14270 ;;
14271 esac
14272else
14273 gidsize=4
14274 echo "(I can't compile the test program--guessing $gidsize.)" >&4
14275fi
14276
14277
14278echo " "
14279case "$gidtype" in
14280*_t) zzz="$gidtype" ;;
14281*) zzz="gid" ;;
14282esac
14283echo "Checking the sign of $zzz..." >&4
14284cat > try.c <<EOCP
14285#include <sys/types.h>
14286#include <stdio.h>
14287int main() {
14288 $gidtype foo = -1;
14289 if (foo < 0)
14290 printf("-1\n");
14291 else
14292 printf("1\n");
14293}
14294EOCP
14295set try
14296if eval $compile; then
5440bc8e 14297 yyy=`$run ./try`
b4eb6b3d
JH
14298 case "$yyy" in
14299 '') gidsign=1
14300 echo "(I can't execute the test program--guessing unsigned.)" >&4
14301 ;;
14302 *) gidsign=$yyy
14303 case "$gidsign" in
14304 1) echo "Your $zzz is unsigned." ;;
14305 -1) echo "Your $zzz is signed." ;;
14306 esac
14307 ;;
14308 esac
14309else
14310 gidsign=1
14311 echo "(I can't compile the test program--guessing unsigned.)" >&4
14312fi
14313
14314
14315echo " "
14316
14317if $test X"$quadtype" != X; then
14318
14319echo "Checking how to print 64-bit integers..." >&4
14320
14321if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
14322 $cat >try.c <<'EOCP'
14323#include <sys/types.h>
14324#include <stdio.h>
14325int main() {
14326 int q = 12345678901;
14327 printf("%ld\n", q);
14328}
14329EOCP
14330 set try
14331 if eval $compile; then
5440bc8e 14332 yyy=`$run ./try`
b4eb6b3d
JH
14333 case "$yyy" in
14334 12345678901)
14335 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
14336 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
14337 echo "We will use %d."
14338 ;;
14339 esac
14340 fi
14341fi
14342
14343if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
14344 $cat >try.c <<'EOCP'
14345#include <sys/types.h>
14346#include <stdio.h>
14347int main() {
14348 long q = 12345678901;
14349 printf("%ld\n", q);
14350}
14351EOCP
14352 set try
14353 if eval $compile; then
5440bc8e 14354 yyy=`$run ./try`
b4eb6b3d
JH
14355 case "$yyy" in
14356 12345678901)
14357 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
14358 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
14359 echo "We will use %ld."
14360 ;;
14361 esac
14362 fi
14363fi
14364
14365if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
14366 $cat >try.c <<'EOCP'
14367#include <sys/types.h>
14368#include <inttypes.h>
14369#include <stdio.h>
14370int main() {
14371 int64_t q = 12345678901;
14372 printf("%" PRId64 "\n", q);
14373}
14374EOCP
14375 set try
14376 if eval $compile; then
5440bc8e 14377 yyy=`$run ./try`
b4eb6b3d
JH
14378 case "$yyy" in
14379 12345678901)
14380 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
14381 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
14382 echo "We will use the C9X style."
14383 ;;
14384 esac
14385 fi
14386fi
14387
2ef53570
JH
14388if $test X"$sPRId64" = X -a X"$quadtype" != X; then
14389 $cat >try.c <<EOCP
b4eb6b3d
JH
14390#include <sys/types.h>
14391#include <stdio.h>
14392int main() {
2ef53570
JH
14393 $quadtype q = 12345678901;
14394 printf("%Ld\n", q);
b4eb6b3d
JH
14395}
14396EOCP
14397 set try
14398 if eval $compile; then
5440bc8e 14399 yyy=`$run ./try`
b4eb6b3d
JH
14400 case "$yyy" in
14401 12345678901)
2ef53570
JH
14402 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
14403 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
14404 echo "We will use %Ld."
b4eb6b3d
JH
14405 ;;
14406 esac
14407 fi
14408fi
14409
2ef53570
JH
14410if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
14411 $cat >try.c <<'EOCP'
b4eb6b3d
JH
14412#include <sys/types.h>
14413#include <stdio.h>
14414int main() {
2ef53570
JH
14415 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
14416 printf("%lld\n", q);
b4eb6b3d
JH
14417}
14418EOCP
14419 set try
14420 if eval $compile; then
5440bc8e 14421 yyy=`$run ./try`
b4eb6b3d
JH
14422 case "$yyy" in
14423 12345678901)
2ef53570
JH
14424 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
14425 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
14426 echo "We will use the %lld style."
b4eb6b3d
JH
14427 ;;
14428 esac
14429 fi
14430fi
14431
14432if $test X"$sPRId64" = X -a X"$quadtype" != X; then
14433 $cat >try.c <<EOCP
14434#include <sys/types.h>
14435#include <stdio.h>
14436int main() {
14437 $quadtype q = 12345678901;
14438 printf("%qd\n", q);
14439}
14440EOCP
14441 set try
14442 if eval $compile; then
5440bc8e 14443 yyy=`$run ./try`
b4eb6b3d
JH
14444 case "$yyy" in
14445 12345678901)
14446 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
14447 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
14448 echo "We will use %qd."
14449 ;;
14450 esac
14451 fi
14452fi
14453
14454if $test X"$sPRId64" = X; then
14455 echo "Cannot figure out how to print 64-bit integers." >&4
14456fi
14457
14458$rm -f try try.*
14459
14460fi
14461
14462case "$sPRId64" in
14463'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
14464 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
14465 ;;
14466*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
14467 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
14468 ;;
14469esac
14470
14471
14472echo " "
14473$echo "Checking the format strings to be used for Perl's internal types..." >&4
14474
14475if $test X"$ivsize" = X8; then
14476 ivdformat="$sPRId64"
14477 uvuformat="$sPRIu64"
14478 uvoformat="$sPRIo64"
14479 uvxformat="$sPRIx64"
14480 uvXUformat="$sPRIXU64"
14481else
14482 if $test X"$ivsize" = X"$longsize"; then
14483 ivdformat='"ld"'
14484 uvuformat='"lu"'
14485 uvoformat='"lo"'
14486 uvxformat='"lx"'
14487 uvXUformat='"lX"'
14488 else
14489 if $test X"$ivsize" = X"$intsize"; then
14490 ivdformat='"d"'
14491 uvuformat='"u"'
14492 uvoformat='"o"'
14493 uvxformat='"x"'
14494 uvXUformat='"X"'
14495 else
14496 : far out
14497 if $test X"$ivsize" = X"$shortsize"; then
14498 ivdformat='"hd"'
14499 uvuformat='"hu"'
14500 uvoformat='"ho"'
14501 uvxformat='"hx"'
14502 uvXUformat='"hX"'
14503 fi
14504 fi
14505 fi
14506fi
14507
14508if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
14509 nveformat="$sPRIeldbl"
14510 nvfformat="$sPRIfldbl"
14511 nvgformat="$sPRIgldbl"
14512 nvEUformat="$sPRIEUldbl"
14513 nvFUformat="$sPRIFUldbl"
14514 nvGUformat="$sPRIGUldbl"
14515else
14516 nveformat='"e"'
14517 nvfformat='"f"'
14518 nvgformat='"g"'
14519 nvEUformat='"E"'
14520 nvFUformat='"F"'
14521 nvGUformat='"G"'
14522fi
14523
14524case "$ivdformat" in
14525'') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
14526 exit 1
14527 ;;
14528esac
14529
14530
14531echo " "
14532$echo "Checking the format string to be used for gids..." >&4
14533
14534case "$gidsign" in
14535-1) if $test X"$gidsize" = X"$ivsize"; then
14536 gidformat="$ivdformat"
14537 else
14538 if $test X"$gidsize" = X"$longsize"; then
14539 gidformat='"ld"'
14540 else
14541 if $test X"$gidsize" = X"$intsize"; then
14542 gidformat='"d"'
14543 else
14544 if $test X"$gidsize" = X"$shortsize"; then
14545 gidformat='"hd"'
14546 fi
14547 fi
14548 fi
14549 fi
14550 ;;
14551*) if $test X"$gidsize" = X"$uvsize"; then
14552 gidformat="$uvuformat"
14553 else
14554 if $test X"$gidsize" = X"$longsize"; then
14555 gidformat='"lu"'
14556 else
14557 if $test X"$gidsize" = X"$intsize"; then
14558 gidformat='"u"'
14559 else
14560 if $test X"$gidsize" = X"$shortsize"; then
14561 gidformat='"hu"'
14562 fi
14563 fi
14564 fi
14565 fi
14566 ;;
14567esac
14568
14569: see if getgroups exists
14570set getgroups d_getgrps
14571eval $inlibc
14572
14573: see if setgroups exists
14574set setgroups d_setgrps
14575eval $inlibc
14576
14577
14578: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
14579echo " "
14580case "$d_getgrps$d_setgrps" in
14581*define*)
14582 case "$groupstype" in
14583 '') dflt="$gidtype" ;;
14584 *) dflt="$groupstype" ;;
14585 esac
14586 $cat <<EOM
14587What type of pointer is the second argument to getgroups() and setgroups()?
14588Usually this is the same as group ids, $gidtype, but not always.
14589
14590EOM
14591 rp='What type pointer is the second argument to getgroups() and setgroups()?'
14592 . ./myread
14593 groupstype="$ans"
14594 ;;
14595*) groupstype="$gidtype";;
14596esac
14597
14598echo " "
14599echo "Checking if your $make program sets \$(MAKE)..." >&4
14600case "$make_set_make" in
14601'')
14602 $sed 's/^X //' > testmake.mak << 'EOF'
14603Xall:
14604X @echo 'maketemp="$(MAKE)"'
14605EOF
14606 case "`$make -f testmake.mak 2>/dev/null`" in
14607 *maketemp=*) make_set_make='#' ;;
14608 *) make_set_make="MAKE=$make" ;;
14609 esac
14610 $rm -f testmake.mak
14611 ;;
14612esac
14613case "$make_set_make" in
14614'#') echo "Yup, it does.";;
14615*) echo "Nope, it doesn't.";;
14616esac
14617
14618: see what type is used for mode_t
14619rp="What is the type used for file modes for system calls (e.g. fchmod())?"
14620set mode_t modetype int stdio.h sys/types.h
14621eval $typedef_ask
14622
2cc61e15
DD
14623: see if stdarg is available
14624echo " "
14625if $test `./findhdr stdarg.h`; then
14626 echo "<stdarg.h> found." >&4
14627 valstd="$define"
14628else
14629 echo "<stdarg.h> NOT found." >&4
14630 valstd="$undef"
14631fi
14632
14633: see if varags is available
14634echo " "
14635if $test `./findhdr varargs.h`; then
14636 echo "<varargs.h> found." >&4
14637else
14638 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14639fi
14640
14641: set up the varargs testing programs
14642$cat > varargs.c <<EOP
14643#ifdef I_STDARG
14644#include <stdarg.h>
14645#endif
14646#ifdef I_VARARGS
14647#include <varargs.h>
14648#endif
14649
14650#ifdef I_STDARG
14651int f(char *p, ...)
14652#else
14653int f(va_alist)
14654va_dcl
14655#endif
14656{
14657 va_list ap;
14658#ifndef I_STDARG
14659 char *p;
14660#endif
14661#ifdef I_STDARG
14662 va_start(ap,p);
14663#else
14664 va_start(ap);
14665 p = va_arg(ap, char *);
14666#endif
14667 va_end(ap);
14668}
14669EOP
14670$cat > varargs <<EOP
14671$startsh
14672if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14673 echo "true"
14674else
14675 echo "false"
14676fi
14677$rm -f varargs$_o
14678EOP
14679chmod +x varargs
14680
14681: now check which varargs header should be included
14682echo " "
14683i_varhdr=''
14684case "$valstd" in
14685"$define")
14686 if `./varargs I_STDARG`; then
14687 val='stdarg.h'
14688 elif `./varargs I_VARARGS`; then
14689 val='varargs.h'
14690 fi
14691 ;;
14692*)
14693 if `./varargs I_VARARGS`; then
14694 val='varargs.h'
14695 fi
14696 ;;
14697esac
14698case "$val" in
14699'')
14700echo "I could not find the definition for va_dcl... You have problems..." >&4
14701 val="$undef"; set i_stdarg; eval $setvar
14702 val="$undef"; set i_varargs; eval $setvar
14703 ;;
14704*)
14705 set i_varhdr
14706 eval $setvar
14707 case "$i_varhdr" in
14708 stdarg.h)
14709 val="$define"; set i_stdarg; eval $setvar
14710 val="$undef"; set i_varargs; eval $setvar
14711 ;;
14712 varargs.h)
14713 val="$undef"; set i_stdarg; eval $setvar
14714 val="$define"; set i_varargs; eval $setvar
14715 ;;
14716 esac
14717 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14718esac
14719$rm -f varargs*
14720
14721: see if we need va_copy
14722echo " "
14723case "$i_stdarg" in
14724"$define")
14725 $cat >try.c <<EOCP
14726#include <stdarg.h>
14727#include <stdio.h>
85c8a686
DD
14728#$i_stdlib I_STDLIB
14729#ifdef I_STDLIB
14730#include <stdlib.h>
14731#endif
14732#include <signal.h>
2cc61e15
DD
14733
14734int
14735ivfprintf(FILE *f, const char *fmt, va_list *valp)
14736{
14737 return vfprintf(f, fmt, *valp);
14738}
14739
14740int
14741myvfprintf(FILE *f, const char *fmt, va_list val)
14742{
14743 return ivfprintf(f, fmt, &val);
14744}
14745
14746int
14747myprintf(char *fmt, ...)
14748{
14749 va_list val;
14750 va_start(val, fmt);
14751 return myvfprintf(stdout, fmt, val);
14752}
14753
14754int
14755main(int ac, char **av)
14756{
85c8a686
DD
14757 signal(SIGSEGV, exit);
14758
2cc61e15
DD
14759 myprintf("%s%cs all right, then\n", "that", '\'');
14760 exit(0);
14761}
14762EOCP
14763 set try
5440bc8e
JH
14764 if eval $compile && $run ./try 2>&1 >/dev/null; then
14765 case "`$run ./try`" in
2cc61e15
DD
14766 "that's all right, then")
14767 okay=yes
14768 ;;
14769 esac
14770 fi
14771 case "$okay" in
14772 yes) echo "It seems that you don't need va_copy()." >&4
14773 need_va_copy="$undef"
14774 ;;
14775 *) echo "It seems that va_copy() or similar will be needed." >&4
14776 need_va_copy="$define"
14777 ;;
14778 esac
14779 $rm -f try.* core core.* *.core *.core.*
14780 ;;
14781*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14782 ;;
14783esac
14784
b4eb6b3d
JH
14785: define a fucntion to check prototypes
14786$cat > protochk <<EOSH
14787$startsh
14788cc="$cc"
14789optimize="$optimize"
14790ccflags="$ccflags"
14791prototype="$prototype"
14792define="$define"
14793rm=$rm
14794EOSH
14795
14796$cat >> protochk <<'EOSH'
14797
14798$rm -f try.c
14799foo="$1"
14800shift
14801while test $# -ge 2; do
14802 case "$1" in
14803 $define) echo "#include <$2>" >> try.c ;;
14804 literal) echo "$2" >> try.c ;;
14805 esac
14806 shift 2
14807done
14808test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
14809cat >> try.c <<'EOCP'
14810#ifdef CAN_PROTOTYPE
14811#define _(args) args
14812#else
14813#define _(args) ()
14814#endif
14815EOCP
14816echo "$foo" >> try.c
14817echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14818$cc $optimize $ccflags -c try.c > /dev/null 2>&1
14819status=$?
14820$rm -f try.[co]
14821exit $status
14822EOSH
14823chmod +x protochk
14824$eunicefix protochk
14825
14826: see what type is used for size_t
14827rp="What is the type used for the length parameter for string functions?"
14828set size_t sizetype 'unsigned int' stdio.h sys/types.h
14829eval $typedef_ask
14830
14831: check for type of arguments to gethostbyaddr.
14832if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14833 case "$d_gethbyaddr" in
14834 $define)
14835 $cat <<EOM
14836
14837Checking to see what type of arguments are accepted by gethostbyaddr().
14838EOM
14839 hdrs="$define sys/types.h
14840 $d_socket sys/socket.h
14841 $i_niin netinet/in.h
14842 $i_netdb netdb.h
14843 $i_unistd unistd.h"
14844 : The first arg can 'char *' or 'void *'
14845 : The second arg is some of integral type
14846 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14847 for yyy in size_t long int; do
14848 case "$netdb_host_type" in
14849 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14850 if ./protochk "$try" $hdrs; then
14851 echo "Your system accepts $xxx for the first arg."
14852 echo "...and $yyy for the second arg."
14853 netdb_host_type="$xxx"
14854 netdb_hlen_type="$yyy"
14855 fi
14856 ;;
14857 esac
14858 done
14859 done
14860 : In case none of those worked, prompt the user.
14861 case "$netdb_host_type" in
14862 '') rp='What is the type for the 1st argument to gethostbyaddr?'
14863 dflt='char *'
14864 . ./myread
14865 netdb_host_type=$ans
14866 rp='What is the type for the 2nd argument to gethostbyaddr?'
14867 dflt="$sizetype"
14868 . ./myread
14869 netdb_hlen_type=$ans
14870 ;;
14871 esac
14872 ;;
14873 *) : no gethostbyaddr, so pick harmless defaults
14874 netdb_host_type='char *'
14875 netdb_hlen_type="$sizetype"
14876 ;;
14877 esac
14878 # Remove the "const" if needed. -- but then we'll have a
14879 # prototype clash!
14880 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14881fi
14882
14883: check for type of argument to gethostbyname.
14884if test "X$netdb_name_type" = X ; then
14885 case "$d_gethbyname" in
14886 $define)
14887 $cat <<EOM
14888
14889Checking to see what type of argument is accepted by gethostbyname().
14890EOM
14891 hdrs="$define sys/types.h
14892 $d_socket sys/socket.h
14893 $i_niin netinet/in.h
14894 $i_netdb netdb.h
14895 $i_unistd unistd.h"
14896 for xxx in "const char *" "char *"; do
14897 case "$netdb_name_type" in
14898 '') try="extern struct hostent *gethostbyname($xxx);"
14899 if ./protochk "$try" $hdrs; then
14900 echo "Your system accepts $xxx."
14901 netdb_name_type="$xxx"
14902 fi
14903 ;;
14904 esac
14905 done
14906 : In case none of those worked, prompt the user.
14907 case "$netdb_name_type" in
14908 '') rp='What is the type for the 1st argument to gethostbyname?'
14909 dflt='char *'
14910 . ./myread
14911 netdb_name_type=$ans
14912 ;;
14913 esac
14914 ;;
14915 *) : no gethostbyname, so pick harmless default
14916 netdb_name_type='char *'
14917 ;;
14918 esac
14919fi
14920
14921: check for type of 1st argument to getnetbyaddr.
14922if test "X$netdb_net_type" = X ; then
14923 case "$d_getnbyaddr" in
14924 $define)
14925 $cat <<EOM
14926
14927Checking to see what type of 1st argument is accepted by getnetbyaddr().
14928EOM
14929 hdrs="$define sys/types.h
14930 $d_socket sys/socket.h
14931 $i_niin netinet/in.h
14932 $i_netdb netdb.h
14933 $i_unistd unistd.h"
14934 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14935 case "$netdb_net_type" in
14936 '') try="extern struct netent *getnetbyaddr($xxx, int);"
14937 if ./protochk "$try" $hdrs; then
14938 echo "Your system accepts $xxx."
14939 netdb_net_type="$xxx"
14940 fi
14941 ;;
14942 esac
14943 done
14944 : In case none of those worked, prompt the user.
14945 case "$netdb_net_type" in
14946 '') rp='What is the type for the 1st argument to getnetbyaddr?'
14947 dflt='long'
14948 . ./myread
14949 netdb_net_type=$ans
14950 ;;
14951 esac
14952 ;;
14953 *) : no getnetbyaddr, so pick harmless default
14954 netdb_net_type='long'
14955 ;;
14956 esac
14957fi
14958: locate the preferred pager for this system
14959case "$pager" in
14960'')
14961 dflt=''
14962 case "$pg" in
14963 /*) dflt=$pg;;
14964 [a-zA-Z]:/*) dflt=$pg;;
14965 esac
14966 case "$more" in
14967 /*) dflt=$more;;
14968 [a-zA-Z]:/*) dflt=$more;;
14969 esac
14970 case "$less" in
14971 /*) dflt=$less;;
14972 [a-zA-Z]:/*) dflt=$less;;
14973 esac
14974 case "$dflt" in
14975 '') dflt=/usr/ucb/more;;
14976 esac
14977 ;;
14978*) dflt="$pager";;
14979esac
14980echo " "
14981fn=f/
14982rp='What pager is used on your system?'
14983. ./getfile
14984pager="$ans"
14985
14986: see what type pids are declared as in the kernel
14987rp="What is the type of process ids on this system?"
14988set pid_t pidtype int stdio.h sys/types.h
14989eval $typedef_ask
14990
14991: Find earliest binary compatible site_perl subdirectory perl can use.
14992case "$bincompat5005" in
14993"$define") xs_apiversion='5.005' ;;
14994*) xs_apiversion=$version ;; # The current site_perl version.
14995esac
14996: Find earliest pure perl site_perl subdirectory perl can use.
14997: The versioned directories started at 5.005.
14998pm_apiversion='5.005'
14999
b4eb6b3d
JH
15000: see if ar generates random libraries by itself
15001echo " "
15002echo "Checking how to generate random libraries on your machine..." >&4
15003echo 'int bar1() { return bar2(); }' > bar1.c
15004echo 'int bar2() { return 2; }' > bar2.c
15005$cat > foo.c <<'EOP'
15006int main() { printf("%d\n", bar1()); exit(0); }
15007EOP
15008$cc $ccflags -c bar1.c >/dev/null 2>&1
15009$cc $ccflags -c bar2.c >/dev/null 2>&1
15010$cc $ccflags -c foo.c >/dev/null 2>&1
15011$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 15012if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 15013 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
15014 echo "$ar appears to generate random libraries itself."
15015 orderlib=false
15016 ranlib=":"
15017elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 15018 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 15019 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
15020 echo "a table of contents needs to be added with '$ar ts'."
15021 orderlib=false
15022 ranlib="$ar ts"
15023else
15024 case "$ranlib" in
15025 :) ranlib='';;
15026 '')
15027 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
15028 $test -f $ranlib || ranlib=''
15029 ;;
15030 esac
15031 if $test -n "$ranlib"; then
15032 echo "your system has '$ranlib'; we'll use that."
15033 orderlib=false
15034 else
15035 echo "your system doesn't seem to support random libraries"
15036 echo "so we'll use lorder and tsort to order the libraries."
15037 orderlib=true
15038 ranlib=":"
15039 fi
15040fi
15041$rm -f foo* bar*
15042
15043: check for type of arguments to select.
15044case "$selecttype" in
15045'') case "$d_select" in
15046 $define)
15047 echo " "
15048 $cat <<EOM
15049Checking to see what type of arguments are accepted by select().
15050EOM
15051 hdrs="$define sys/types.h
15052 $i_systime sys/time.h
15053 $i_sysselct sys/select.h
15054 $d_socket sys/socket.h"
15055 : The first arg can be int, unsigned, or size_t
15056 : The last arg may or may not be 'const'
15057 val=''
15058 : void pointer has been seen but using that
15059 : breaks the selectminbits test
15060 for xxx in 'fd_set *' 'int *'; do
15061 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
15062 for tmo in 'struct timeval *' 'const struct timeval *'; do
15063 case "$val" in
15064 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
15065 if ./protochk "$try" $hdrs; then
15066 echo "Your system accepts $xxx."
15067 val="$xxx"
15068 fi
15069 ;;
15070 esac
15071 done
15072 done
15073 done
15074 case "$val" in
15075 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
15076 case "$d_fd_set" in
15077 $define) dflt="fd_set *" ;;
15078 *) dflt="int *" ;;
15079 esac
15080 . ./myread
15081 val=$ans
15082 ;;
15083 esac
15084 selecttype="$val"
15085 ;;
15086 *) : no select, so pick a harmless default
15087 selecttype='int *'
15088 ;;
15089 esac
15090 ;;
15091esac
15092
15093: check for the select 'width'
15094case "$selectminbits" in
15095'') case "$d_select" in
15096 $define)
15097 $cat <<EOM
15098
15099Checking to see on how many bits at a time your select() operates...
15100EOM
15101 $cat >try.c <<EOCP
15102#include <sys/types.h>
15103#$i_time I_TIME
15104#$i_systime I_SYS_TIME
15105#$i_systimek I_SYS_TIME_KERNEL
15106#ifdef I_TIME
15107# include <time.h>
15108#endif
15109#ifdef I_SYS_TIME
15110# ifdef I_SYS_TIME_KERNEL
15111# define KERNEL
15112# endif
15113# include <sys/time.h>
15114# ifdef I_SYS_TIME_KERNEL
15115# undef KERNEL
15116# endif
15117#endif
15118#$i_sysselct I_SYS_SELECT
15119#ifdef I_SYS_SELECT
15120#include <sys/select.h>
15121#endif
15122#$d_socket HAS_SOCKET
15123#ifdef HAS_SOCKET
15124# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
15125#endif
15126#include <stdio.h>
15127$selecttype b;
15128#define S sizeof(*(b))
15129#define MINBITS 64
15130#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
15131#define NBITS (NBYTES * 8)
15132int main() {
15133 char s[NBYTES];
15134 struct timeval t;
15135 int i;
15136 FILE* fp;
15137 int fd;
15138
15139 fclose(stdin);
15140 fp = fopen("try.c", "r");
15141 if (fp == 0)
15142 exit(1);
15143 fd = fileno(fp);
15144 if (fd < 0)
15145 exit(2);
15146 b = ($selecttype)s;
15147 for (i = 0; i < NBITS; i++)
15148 FD_SET(i, b);
15149 t.tv_sec = 0;
15150 t.tv_usec = 0;
15151 select(fd + 1, b, 0, 0, &t);
15152 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
15153 printf("%d\n", i + 1);
15154 return 0;
15155}
15156EOCP
15157 set try
15158 if eval $compile_ok; then
5440bc8e 15159 selectminbits=`$run ./try`
b4eb6b3d
JH
15160 case "$selectminbits" in
15161 '') cat >&4 <<EOM
15162Cannot figure out on how many bits at a time your select() operates.
15163I'll play safe and guess it is 32 bits.
15164EOM
15165 selectminbits=32
15166 bits="32 bits"
15167 ;;
15168 1) bits="1 bit" ;;
15169 *) bits="$selectminbits bits" ;;
15170 esac
15171 echo "Your select() operates on $bits at a time." >&4
15172 else
15173 rp='What is the minimum number of bits your select() operates on?'
15174 case "$byteorder" in
15175 1234|12345678) dflt=32 ;;
15176 *) dflt=1 ;;
15177 esac
15178 . ./myread
15179 val=$ans
15180 selectminbits="$val"
15181 fi
15182 $rm -f try.* try
15183 ;;
15184 *) : no select, so pick a harmless default
15185 selectminbits='32'
15186 ;;
15187 esac
15188 ;;
15189esac
15190
15191: Trace out the files included by signal.h, then look for SIGxxx names.
15192: Remove SIGARRAYSIZE used by HPUX.
15193: Remove SIGSTKSIZE used by Linux.
15194: Remove SIGSTKSZ used by Posix.
15195: Remove SIGTYP void lines used by OS2.
15196: Some cpps, like os390, dont give the file name anywhere
15197if [ "X$fieldn" = X ]; then
15198 : Just make some guesses. We check them later.
15199 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
15200else
15201 xxx=`echo '#include <signal.h>' |
15202 $cppstdin $cppminus $cppflags 2>/dev/null |
15203 $grep '^[ ]*#.*include' |
a938a3bb 15204 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
15205fi
15206: Check this list of files to be sure we have parsed the cpp output ok.
15207: This will also avoid potentially non-existent files, such
15208: as ../foo/bar.h
15209xxxfiles=''
15210for xx in $xxx /dev/null ; do
15211 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
15212done
15213: If we have found no files, at least try signal.h
15214case "$xxxfiles" in
15215'') xxxfiles=`./findhdr signal.h` ;;
15216esac
15217xxx=`awk '
15218$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
15219 print substr($2, 4, 20)
15220}
15221$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
15222 print substr($3, 4, 20)
15223}' $xxxfiles`
15224: Append some common names just in case the awk scan failed.
15225xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
15226xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
15227xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
15228xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
15229xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
15230
15231: generate a few handy files for later
15232$cat > signal.c <<'EOCP'
15233#include <sys/types.h>
15234#include <signal.h>
15235#include <stdio.h>
15236int main() {
15237
15238/* Strange style to avoid deeply-nested #if/#else/#endif */
15239#ifndef NSIG
15240# ifdef _NSIG
15241# define NSIG (_NSIG)
15242# endif
15243#endif
15244
15245#ifndef NSIG
15246# ifdef SIGMAX
15247# define NSIG (SIGMAX+1)
15248# endif
15249#endif
15250
15251#ifndef NSIG
15252# ifdef SIG_MAX
15253# define NSIG (SIG_MAX+1)
15254# endif
15255#endif
15256
15257#ifndef NSIG
15258# ifdef MAXSIG
15259# define NSIG (MAXSIG+1)
15260# endif
15261#endif
15262
15263#ifndef NSIG
15264# ifdef MAX_SIG
15265# define NSIG (MAX_SIG+1)
15266# endif
15267#endif
15268
15269#ifndef NSIG
15270# ifdef SIGARRAYSIZE
15271# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
15272# endif
15273#endif
15274
15275#ifndef NSIG
15276# ifdef _sys_nsig
15277# define NSIG (_sys_nsig) /* Solaris 2.5 */
15278# endif
15279#endif
15280
15281/* Default to some arbitrary number that's big enough to get most
15282 of the common signals.
15283*/
15284#ifndef NSIG
15285# define NSIG 50
15286#endif
15287
15288printf("NSIG %d\n", NSIG);
15289
15290#ifndef JUST_NSIG
15291
15292EOCP
15293
15294echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
15295{
15296 printf "#ifdef SIG"; printf $1; printf "\n"
15297 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
15298 printf $1; printf ");\n"
15299 printf "#endif\n"
15300}
15301END {
15302 printf "#endif /* JUST_NSIG */\n";
15303 printf "exit(0);\n}\n";
15304}
15305' >>signal.c
15306$cat >signal.awk <<'EOP'
15307BEGIN { ndups = 0 }
15308$1 ~ /^NSIG$/ { nsig = $2 }
15309($1 !~ /^NSIG$/) && (NF == 2) {
15310 if ($2 > maxsig) { maxsig = $2 }
15311 if (sig_name[$2]) {
15312 dup_name[ndups] = $1
15313 dup_num[ndups] = $2
15314 ndups++
15315 }
15316 else {
15317 sig_name[$2] = $1
15318 sig_num[$2] = $2
15319 }
15320}
15321END {
15322 if (nsig == 0) {
15323 nsig = maxsig + 1
15324 }
15325 printf("NSIG %d\n", nsig);
15326 for (n = 1; n < nsig; n++) {
15327 if (sig_name[n]) {
15328 printf("%s %d\n", sig_name[n], sig_num[n])
15329 }
15330 else {
15331 printf("NUM%d %d\n", n, n)
15332 }
15333 }
15334 for (n = 0; n < ndups; n++) {
15335 printf("%s %d\n", dup_name[n], dup_num[n])
15336 }
15337}
15338EOP
15339$cat >signal_cmd <<EOS
15340$startsh
15341if $test -s signal.lst; then
15342 echo "Using your existing signal.lst file"
15343 exit 0
15344fi
15345xxx="$xxx"
15346EOS
15347$cat >>signal_cmd <<'EOS'
15348
15349set signal
15350if eval $compile_ok; then
5440bc8e 15351 $run ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
15352else
15353 echo "(I can't seem be able to compile the whole test program)" >&4
15354 echo "(I'll try it in little pieces.)" >&4
15355 set signal -DJUST_NSIG
15356 if eval $compile_ok; then
5440bc8e 15357 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
15358 $cat signal.nsg
15359 else
15360 echo "I can't seem to figure out how many signals you have." >&4
15361 echo "Guessing 50." >&4
15362 echo 'NSIG 50' > signal.nsg
15363 fi
15364 : Now look at all the signal names, one at a time.
15365 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
15366 $cat > signal.c <<EOCP
15367#include <sys/types.h>
15368#include <signal.h>
15369#include <stdio.h>
15370int main() {
15371printf("$xx %d\n", SIG${xx});
15372return 0;
15373}
15374EOCP
15375 set signal
15376 if eval $compile; then
15377 echo "SIG${xx} found."
5440bc8e 15378 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
15379 else
15380 echo "SIG${xx} NOT found."
15381 fi
15382 done
15383 if $test -s signal.ls1; then
15384 $cat signal.nsg signal.ls1 |
15385 $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
15386 fi
15387
15388fi
15389if $test -s signal.lst; then
15390 :
15391else
15392 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
15393 echo 'kill -l' >signal
15394 set X `csh -f <signal`
15395 $rm -f signal
15396 shift
15397 case $# in
15398 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
15399 esac
15400 echo $@ | $tr ' ' $trnl | \
15401 $awk '{ printf "%s %d\n", $1, ++s; }
15402 END { printf "NSIG %d\n", ++s }' >signal.lst
15403fi
15404$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
15405EOS
15406chmod a+x signal_cmd
15407$eunicefix signal_cmd
15408
15409: generate list of signal names
15410echo " "
15411case "$sig_name_init" in
15412'') doinit=yes ;;
15413*) case "$sig_num_init" in
15414 ''|*,*) doinit=yes ;;
15415 esac ;;
15416esac
15417case "$doinit" in
15418yes)
15419 echo "Generating a list of signal names and numbers..." >&4
15420 . ./signal_cmd
15421 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
15422 sig_name=`$awk 'BEGIN { printf "ZERO " }
15423 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
15424 sig_num=`$awk 'BEGIN { printf "0 " }
15425 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
15426 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
15427 !/^NSIG/ { printf "\"%s\", ", $1 }
15428 END { printf "0\n" }' signal.lst`
15429 sig_num_init=`$awk 'BEGIN { printf "0, " }
15430 !/^NSIG/ { printf "%d, ", $2}
15431 END { printf "0\n"}' signal.lst`
15432 ;;
15433esac
15434echo "The following $sig_count signals are available:"
15435echo " "
15436echo $sig_name | $awk \
15437'BEGIN { linelen = 0 }
15438{
15439 for (i = 1; i <= NF; i++) {
15440 name = "SIG" $i " "
15441 linelen = linelen + length(name)
15442 if (linelen > 70) {
15443 printf "\n"
15444 linelen = length(name)
15445 }
15446 printf "%s", name
15447 }
15448 printf "\n"
15449}'
76d3c696 15450sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
15451$rm -f signal signal.c signal.awk signal.lst signal_cmd
15452
15453echo " "
15454case "$sizetype" in
15455*_t) zzz="$sizetype" ;;
15456*) zzz="filesize" ;;
15457esac
15458echo "Checking the size of $zzz..." >&4
15459cat > try.c <<EOCP
15460#include <sys/types.h>
15461#include <stdio.h>
15462int main() {
15463 printf("%d\n", (int)sizeof($sizetype));
15464 exit(0);
15465}
15466EOCP
15467set try
15468if eval $compile_ok; then
5440bc8e 15469 yyy=`$run ./try`
b4eb6b3d
JH
15470 case "$yyy" in
15471 '') sizesize=4
15472 echo "(I can't execute the test program--guessing $sizesize.)" >&4
15473 ;;
15474 *) sizesize=$yyy
15475 echo "Your $zzz size is $sizesize bytes."
15476 ;;
15477 esac
15478else
15479 sizesize=4
15480 echo "(I can't compile the test program--guessing $sizesize.)" >&4
15481fi
15482
15483
15484: check for socklen_t
15485echo " "
15486echo "Checking to see if you have socklen_t..." >&4
15487$cat >try.c <<EOCP
15488#include <sys/types.h>
15489#$d_socket HAS_SOCKET
15490#ifdef HAS_SOCKET
15491#include <sys/socket.h>
15492#endif
15493int main() { socklen_t x = 16; }
15494EOCP
15495set try
15496if eval $compile; then
15497 val="$define"
15498 echo "You have socklen_t."
15499else
15500 val="$undef"
15501 echo "You do not have socklen_t."
15502 case "$sizetype" in
15503 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
15504 esac
15505fi
15506$rm -f try try.*
15507set d_socklen_t
15508eval $setvar
15509
a7710f8d
JH
15510: see if this is a socks.h system
15511set socks.h i_socks
15512eval $inhdr
15513
b4eb6b3d
JH
15514: check for type of the size argument to socket calls
15515case "$d_socket" in
15516"$define")
15517 $cat <<EOM
15518
15519Checking to see what type is the last argument of accept().
15520EOM
b4eb6b3d
JH
15521 yyy=''
15522 case "$d_socklen_t" in
15523 "$define") yyy="$yyy socklen_t"
15524 esac
15525 yyy="$yyy $sizetype int long unsigned"
15526 for xxx in $yyy; do
15527 case "$socksizetype" in
15528 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
15529 case "$usesocks" in
15530 "$define")
15531 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
15532 echo "Your system accepts '$xxx *' for the last argument of accept()."
15533 socksizetype="$xxx"
15534 fi
15535 ;;
15536 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
15537 echo "Your system accepts '$xxx *' for the last argument of accept()."
15538 socksizetype="$xxx"
15539 fi
15540 ;;
15541 esac
b4eb6b3d
JH
15542 ;;
15543 esac
15544 done
15545: In case none of those worked, prompt the user.
15546 case "$socksizetype" in
15547 '') rp='What is the type for socket address structure sizes?'
15548 dflt='int'
15549 . ./myread
15550 socksizetype=$ans
15551 ;;
15552 esac
15553 ;;
15554*) : no sockets, so pick relatively harmless default
15555 socksizetype='int'
15556 ;;
15557esac
15558
15559: see what type is used for signed size_t
15560set ssize_t ssizetype int stdio.h sys/types.h
15561eval $typedef
15562dflt="$ssizetype"
5440bc8e 15563$cat > try.c <<EOM
b4eb6b3d
JH
15564#include <stdio.h>
15565#include <sys/types.h>
15566#define Size_t $sizetype
15567#define SSize_t $dflt
15568int main()
15569{
15570 if (sizeof(Size_t) == sizeof(SSize_t))
15571 printf("$dflt\n");
15572 else if (sizeof(Size_t) == sizeof(int))
15573 printf("int\n");
15574 else
15575 printf("long\n");
15576 exit(0);
15577}
15578EOM
15579echo " "
5440bc8e
JH
15580set try
15581if eval $compile_ok && $run ./try > /dev/null; then
15582 ssizetype=`$run ./try`
b4eb6b3d
JH
15583 echo "I'll be using $ssizetype for functions returning a byte count." >&4
15584else
15585 $cat >&4 <<EOM
15586Help! I can't compile and run the ssize_t test program: please enlighten me!
15587(This is probably a misconfiguration in your system or libraries, and
15588you really ought to fix it. Still, I'll try anyway.)
15589
15590I need a type that is the same size as $sizetype, but is guaranteed to
15591be signed. Common values are ssize_t, int and long.
15592
15593EOM
15594 rp="What signed type is the same size as $sizetype?"
15595 . ./myread
15596 ssizetype="$ans"
15597fi
5440bc8e 15598$rm -f try try.*
b4eb6b3d
JH
15599
15600: see what type of char stdio uses.
15601echo " "
aa517f50
JH
15602echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
15603if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
15604 echo "Your stdio uses unsigned chars." >&4
15605 stdchar="unsigned char"
15606else
aa517f50
JH
15607 echo "Your stdio uses signed chars." >&4
15608 stdchar="char"
b4eb6b3d 15609fi
aa517f50
JH
15610$rm -f stdioh
15611
15612
b4eb6b3d
JH
15613
15614: see if time exists
15615echo " "
15616if test "X$d_time" = X -o X"$timetype" = X; then
15617 if set time val -f d_time; eval $csym; $val; then
15618 echo 'time() found.' >&4
15619 val="$define"
15620 rp="What is the type returned by time() on this system?"
15621 set time_t timetype long stdio.h sys/types.h
15622 eval $typedef_ask
15623 else
15624 echo 'time() not found, hope that will do.' >&4
15625 val="$undef"
15626 timetype='int';
15627 fi
15628 set d_time
15629 eval $setvar
15630fi
15631
15632: see what type uids are declared as in the kernel
15633echo " "
15634echo "Looking for the type for user ids returned by getuid()."
15635set uid_t uidtype xxx stdio.h sys/types.h
15636eval $typedef
15637case "$uidtype" in
15638xxx)
15639 xxx=`./findhdr sys/user.h`
15640 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15641 case $1 in
15642 unsigned) dflt="$1 $2" ;;
15643 *) dflt="$1" ;;
15644 esac
15645 ;;
15646*) dflt="$uidtype";;
15647esac
15648case "$uidtype" in
15649uid_t) echo "uid_t found." ;;
15650*) rp="What is the type for user ids returned by getuid()?"
15651 . ./myread
15652 uidtype="$ans"
15653 ;;
15654esac
15655
15656echo " "
15657case "$uidtype" in
15658*_t) zzz="$uidtype" ;;
15659*) zzz="uid" ;;
15660esac
15661echo "Checking the size of $zzz..." >&4
15662cat > try.c <<EOCP
15663#include <sys/types.h>
15664#include <stdio.h>
15665int main() {
15666 printf("%d\n", (int)sizeof($uidtype));
15667 exit(0);
15668}
15669EOCP
15670set try
15671if eval $compile_ok; then
5440bc8e 15672 yyy=`$run ./try`
b4eb6b3d
JH
15673 case "$yyy" in
15674 '') uidsize=4
15675 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15676 ;;
15677 *) uidsize=$yyy
15678 echo "Your $zzz is $uidsize bytes long."
15679 ;;
15680 esac
15681else
15682 uidsize=4
15683 echo "(I can't compile the test program--guessing $uidsize.)" >&4
15684fi
15685
15686echo " "
15687case "$uidtype" in
15688*_t) zzz="$uidtype" ;;
15689*) zzz="uid" ;;
15690esac
15691echo "Checking the sign of $zzz..." >&4
15692cat > try.c <<EOCP
15693#include <sys/types.h>
15694#include <stdio.h>
15695int main() {
15696 $uidtype foo = -1;
15697 if (foo < 0)
15698 printf("-1\n");
15699 else
15700 printf("1\n");
15701}
15702EOCP
15703set try
15704if eval $compile; then
5440bc8e 15705 yyy=`$run ./try`
b4eb6b3d
JH
15706 case "$yyy" in
15707 '') uidsign=1
15708 echo "(I can't execute the test program--guessing unsigned.)" >&4
15709 ;;
15710 *) uidsign=$yyy
15711 case "$uidsign" in
15712 1) echo "Your $zzz is unsigned." ;;
15713 -1) echo "Your $zzz is signed." ;;
15714 esac
15715 ;;
15716 esac
15717else
15718 uidsign=1
15719 echo "(I can't compile the test program--guessing unsigned.)" >&4
15720fi
15721
15722
15723
15724echo " "
15725$echo "Checking the format string to be used for uids..." >&4
15726
15727case "$uidsign" in
15728-1) if $test X"$uidsize" = X"$ivsize"; then
15729 uidformat="$ivdformat"
15730 else
15731 if $test X"$uidsize" = X"$longsize"; then
15732 uidformat='"ld"'
15733 else
15734 if $test X"$uidsize" = X"$intsize"; then
15735 uidformat='"d"'
15736 else
15737 if $test X"$uidsize" = X"$shortsize"; then
15738 uidformat='"hd"'
15739 fi
15740 fi
15741 fi
15742 fi
15743 ;;
15744*) if $test X"$uidsize" = X"$uvsize"; then
15745 uidformat="$uvuformat"
15746 else
15747 if $test X"$uidsize" = X"$longsize"; then
15748 uidformat='"lu"'
15749 else
15750 if $test X"$uidsize" = X"$intsize"; then
15751 uidformat='"u"'
15752 else
15753 if $test X"$uidsize" = X"$shortsize"; then
15754 uidformat='"hu"'
15755 fi
15756 fi
15757 fi
15758 fi
15759 ;;
15760esac
15761
3659ebf1
JH
15762: determine compiler compiler
15763case "$yacc" in
15764'')
15765 dflt=yacc;;
15766*)
15767 dflt="$yacc";;
15768esac
15769echo " "
15770comp='yacc'
15771if $test -f "$byacc"; then
15772 dflt="$byacc"
15773 comp="byacc or $comp"
15774fi
15775if $test -f "$bison"; then
15776 comp="$comp or bison -y"
15777fi
15778rp="Which compiler compiler ($comp) shall I use?"
15779. ./myread
15780yacc="$ans"
15781case "$yacc" in
15782*bis*)
15783 case "$yacc" in
15784 *-y*) ;;
15785 *)
15786 yacc="$yacc -y"
15787 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15788 ;;
15789 esac
15790 ;;
15791esac
15792
b4eb6b3d
JH
15793: see if fcntl.h is there
15794val=''
15795set fcntl.h val
15796eval $inhdr
15797
15798: see if we can include fcntl.h
15799case "$val" in
15800"$define")
15801 echo " "
15802 if $h_fcntl; then
15803 val="$define"
15804 echo "We'll be including <fcntl.h>." >&4
15805 else
15806 val="$undef"
15807 if $h_sysfile; then
15808 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15809 else
15810 echo "We won't be including <fcntl.h>." >&4
15811 fi
15812 fi
15813 ;;
15814*)
15815 h_fcntl=false
15816 val="$undef"
15817 ;;
15818esac
15819set i_fcntl
15820eval $setvar
15821
758a5d79
JH
15822: see if this is a fp.h system
15823set fp.h i_fp
15824eval $inhdr
15825
15826: see if this is a fp_class.h system
15827set fp_class.h i_fp_class
15828eval $inhdr
15829
b4eb6b3d
JH
15830: see if this is a iconv.h system
15831set iconv.h i_iconv
15832eval $inhdr
15833
15834: see if this is a ieeefp.h system
15835set ieeefp.h i_ieeefp
15836eval $inhdr
15837
15838: see if this is a libutil.h system
15839set libutil.h i_libutil
15840eval $inhdr
15841
15842: see if locale.h is available
15843set locale.h i_locale
15844eval $inhdr
15845
15846: see if mach cthreads are available
15847if test "X$usethreads" = "X$define"; then
15848 set mach/cthreads.h i_machcthr
15849 eval $inhdr
15850else
15851 i_machcthr="$undef"
15852fi
15853
15854
15855
15856: see if this is a math.h system
15857set math.h i_math
15858eval $inhdr
15859
15860: see if this is a mntent.h system
15861set mntent.h i_mntent
15862eval $inhdr
15863
15864: see if ndbm.h is available
15865set ndbm.h t_ndbm
15866eval $inhdr
15867case "$t_ndbm" in
15868$define)
15869 : see if dbm_open exists
15870 set dbm_open d_dbm_open
15871 eval $inlibc
15872 case "$d_dbm_open" in
15873 $undef)
15874 t_ndbm="$undef"
15875 echo "We won't be including <ndbm.h>"
15876 ;;
15877 esac
15878 ;;
15879esac
15880val="$t_ndbm"
15881set i_ndbm
15882eval $setvar
15883
15884: see if net/errno.h is available
15885val=''
15886set net/errno.h val
15887eval $inhdr
15888
15889: Unfortunately, it causes problems on some systems. Arrgh.
15890case "$val" in
15891$define)
15892 cat > try.c <<'EOM'
15893#include <stdio.h>
15894#include <errno.h>
15895#include <net/errno.h>
15896int func()
15897{
15898 return ENOTSOCK;
15899}
15900EOM
15901 if $cc $ccflags -c try.c >/dev/null 2>&1; then
15902 echo "We'll be including <net/errno.h>." >&4
15903 else
15904 echo "We won't be including <net/errno.h>." >&4
15905 val="$undef"
15906 fi
15907 $rm -f try.* try
15908 ;;
15909esac
15910set i_neterrno
15911eval $setvar
15912
15913: see if netinet/tcp.h is available
15914set netinet/tcp.h i_netinettcp
15915eval $inhdr
15916
15917: see if this is a poll.h system
15918set poll.h i_poll
15919eval $inhdr
15920
15921: see if this is a prot.h system
15922set prot.h i_prot
15923eval $inhdr
15924
15925echo " "
15926$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
15927$cat <<'EOSH' > Cppsym.know
15928a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15929AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
d46c9a2d
JH
15930alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15931ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15932BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
15933BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15934bull c cadmus clipper CMU COFF COMPILER_VERSION
15935concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15936CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15937Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15938FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15939GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15940H3050R H3050RX hbullx20 hcx host_mips
15941hp200 hp300 hp700 HP700 hp800 hp9000
15942hp9000s200 hp9000s300 hp9000s400 hp9000s500
15943hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15944i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 15945IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
15946INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15947LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15948LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15949Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15950LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15951M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15952M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15953M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15954MATH_HAS_NO_SIDE_EFFECTS
15955mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15956mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15957mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15958MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15959mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15960NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 15961news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
15962ns32016 ns32332 ns32k nsc32000
15963OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15964pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15965pc532 pdp11 PGC PIC plexus PORTAR posix
15966POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15967POSIX_C_SOURCE POSIX_SOURCE POWER
15968PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 15969riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
15970SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15971sony sony_news sonyrisc sparc sparclite spectrum
15972stardent stdc STDC_EXT stratos sun sun3 sun386
15973Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15974SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15975SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15976sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 15977TM3200 TM5400 TM5600
b4eb6b3d
JH
15978tower tower32 tower32_200 tower32_600 tower32_700
15979tower32_800 tower32_850 tss
15980u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15981ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15982unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15983Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15984XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15985XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15986z8000
15987EOSH
15988# Maybe put other stuff here too.
15989cat <<EOSH >>Cppsym.know
15990$osname
15991EOSH
15992./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15993./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15994$cat Cppsym.know > Cppsym.c
381aa1ff 15995$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
15996$rm -f Cppsym.a Cppsym.b Cppsym.c
15997cat <<EOSH > Cppsym
15998$startsh
15999if $test \$# -gt 0; then
16000 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
16001 if $test -s Cppsym.got; then
16002 $rm -f Cppsym.got
16003 exit 0
16004 fi
16005 $rm -f Cppsym.got
16006 exit 1
16007else
16008 $tr " " "$trnl" | ./Cppsym.try
16009 exit 0
16010fi
16011EOSH
16012chmod +x Cppsym
16013$eunicefix Cppsym
16014cat <<EOSH > Cppsym.try
16015$startsh
16016cat <<'EOCP' > try.c
16017#include <stdio.h>
16018int main() {
16019EOCP
16020$awk \\
16021EOSH
16022cat <<'EOSH' >> Cppsym.try
16023'length($1) > 0 {
2ef53570
JH
16024 printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
16025 printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
16026 printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
16027 printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
b4eb6b3d 16028}' >> try.c
2ef53570 16029echo 'return 0;}' >> try.c
b4eb6b3d
JH
16030EOSH
16031cat <<EOSH >> Cppsym.try
16032ccflags="$ccflags"
16033case "$osname-$gccversion" in
16034irix-) ccflags="\$ccflags -woff 1178" ;;
16035os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
16036esac
5440bc8e 16037$cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
b4eb6b3d
JH
16038EOSH
16039chmod +x Cppsym.try
16040$eunicefix Cppsym.try
16041./Cppsym < Cppsym.know > Cppsym.true
16042: now check the C compiler for additional symbols
16043postprocess_cc_v=''
16044case "$osname" in
16045aix) postprocess_cc_v="|$tr , ' '" ;;
16046esac
16047$cat >ccsym <<EOS
16048$startsh
16049$cat >tmp.c <<EOF
16050extern int foo;
16051EOF
16052for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
16053do
16054 case "\$i" in
16055 -D*) echo "\$i" | $sed 's/^-D//';;
16056 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
16057 esac
16058done
16059$rm -f try.c
16060EOS
16061postprocess_cc_v=''
16062chmod +x ccsym
16063$eunicefix ccsym
16064./ccsym > ccsym1.raw
16065if $test -s ccsym1.raw; then
16066 $sort ccsym1.raw | $uniq >ccsym.raw
16067else
16068 mv ccsym1.raw ccsym.raw
16069fi
16070
16071$awk '/\=/ { print $0; next }
16072 { print $0"=1" }' ccsym.raw >ccsym.list
16073$awk '/\=/ { print $0; next }
16074 { print $0"=1" }' Cppsym.true >ccsym.true
16075$comm -13 ccsym.true ccsym.list >ccsym.own
16076$comm -12 ccsym.true ccsym.list >ccsym.com
16077$comm -23 ccsym.true ccsym.list >ccsym.cpp
16078also=''
16079if $test -z ccsym.raw; then
16080 echo "Your C compiler doesn't seem to define any symbols!" >&4
16081 echo " "
16082 echo "However, your C preprocessor defines the following symbols:"
16083 $cat Cppsym.true
16084 ccsymbols=''
16085 cppsymbols=`$cat Cppsym.true`
16086 cppsymbols=`echo $cppsymbols`
16087 cppccsymbols="$cppsymbols"
16088else
16089 if $test -s ccsym.com; then
16090 echo "Your C compiler and pre-processor define these symbols:"
16091 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
16092 also='also '
16093 symbols='ones'
16094 cppccsymbols=`$cat ccsym.com`
16095 cppccsymbols=`echo $cppccsymbols`
16096 $test "$silent" || sleep 1
16097 fi
16098 if $test -s ccsym.cpp; then
16099 $test "$also" && echo " "
16100 echo "Your C pre-processor ${also}defines the following symbols:"
16101 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
16102 also='further '
16103 cppsymbols=`$cat ccsym.cpp`
16104 cppsymbols=`echo $cppsymbols`
16105 $test "$silent" || sleep 1
16106 fi
16107 if $test -s ccsym.own; then
16108 $test "$also" && echo " "
16109 echo "Your C compiler ${also}defines the following cpp symbols:"
16110 $sed -e 's/\(..*\)=1/\1/' ccsym.own
16111 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
16112 ccsymbols=`$cat ccsym.own`
16113 ccsymbols=`echo $ccsymbols`
16114 $test "$silent" || sleep 1
16115 fi
16116fi
b4eb6b3d
JH
16117
16118: see if this is a termio system
16119val="$undef"
16120val2="$undef"
16121val3="$undef"
16122if $test `./findhdr termios.h`; then
16123 set tcsetattr i_termios
16124 eval $inlibc
16125 val3="$i_termios"
16126fi
16127echo " "
16128case "$val3" in
16129"$define") echo "You have POSIX termios.h... good!" >&4;;
16130*) if ./Cppsym pyr; then
16131 case "`/bin/universe`" in
16132 ucb) if $test `./findhdr sgtty.h`; then
16133 val2="$define"
16134 echo "<sgtty.h> found." >&4
16135 else
16136 echo "System is pyramid with BSD universe."
16137 echo "<sgtty.h> not found--you could have problems." >&4
16138 fi;;
16139 *) if $test `./findhdr termio.h`; then
16140 val="$define"
16141 echo "<termio.h> found." >&4
16142 else
16143 echo "System is pyramid with USG universe."
16144 echo "<termio.h> not found--you could have problems." >&4
16145 fi;;
16146 esac
16147 elif ./usg; then
16148 if $test `./findhdr termio.h`; then
16149 echo "<termio.h> found." >&4
16150 val="$define"
16151 elif $test `./findhdr sgtty.h`; then
16152 echo "<sgtty.h> found." >&4
16153 val2="$define"
16154 else
16155echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
16156 fi
16157 else
16158 if $test `./findhdr sgtty.h`; then
16159 echo "<sgtty.h> found." >&4
16160 val2="$define"
16161 elif $test `./findhdr termio.h`; then
16162 echo "<termio.h> found." >&4
16163 val="$define"
16164 else
16165echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
16166 fi
16167 fi;;
16168esac
16169set i_termio; eval $setvar
16170val=$val2; set i_sgtty; eval $setvar
16171val=$val3; set i_termios; eval $setvar
16172
16173: see if this is a shadow.h system
16174set shadow.h i_shadow
16175eval $inhdr
16176
b4eb6b3d
JH
16177: see if stddef is available
16178set stddef.h i_stddef
16179eval $inhdr
923fc586 16180
b4eb6b3d
JH
16181: see if this is a sunmath.h system
16182set sunmath.h i_sunmath
16183eval $inhdr
5f80c64f 16184
b4eb6b3d
JH
16185: see if sys/access.h is available
16186set sys/access.h i_sysaccess
16187eval $inhdr
16188
16189: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
16190set sys/filio.h i_sysfilio
16191eval $inhdr
16192echo " "
16193if $test `./findhdr sys/ioctl.h`; then
16194 val="$define"
16195 echo '<sys/ioctl.h> found.' >&4
16196else
16197 val="$undef"
16198 if $test $i_sysfilio = "$define"; then
16199 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 16200 else
b4eb6b3d
JH
16201 $test $i_sgtty = "$define" && xxx="sgtty.h"
16202 $test $i_termio = "$define" && xxx="termio.h"
16203 $test $i_termios = "$define" && xxx="termios.h"
16204echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
16205 fi
16206fi
16207set i_sysioctl
16208eval $setvar
16209
49a78c82
JH
16210: see if socket ioctl defs are in sys/sockio.h
16211echo " "
16212xxx=`./findhdr sys/sockio.h`
16213if $test "$xxx"; then
16214 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
16215 val="$define"
16216 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
16217 else
16218 val="$undef"
16219 echo "No socket ioctls found in <sys/sockio.h>." >&4
16220 fi
16221else
16222 val="$undef"
16223 $cat <<EOM
16224<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
16225EOM
16226fi
16227set i_syssockio
16228eval $setvar
16229
b4eb6b3d
JH
16230
16231: see if this is a syslog.h system
16232set syslog.h i_syslog
16233eval $inhdr
16234
16235
16236: see if this is a sys/mode.h system
16237set sys/mode.h i_sysmode
16238eval $inhdr
16239
16240: see if sys/resource.h has to be included
16241set sys/resource.h i_sysresrc
16242eval $inhdr
16243
16244: see if sys/security.h is available
16245set sys/security.h i_syssecrt
16246eval $inhdr
16247
16248: see if this is a sys/statvfs.h system
16249set sys/statvfs.h i_sysstatvfs
16250eval $inhdr
16251
b4eb6b3d
JH
16252: see if this is a sys/un.h system
16253set sys/un.h i_sysun
16254eval $inhdr
16255
16256
16257: see if this is a sys/utsname.h system
16258set sys/utsname.h i_sysutsname
16259eval $inhdr
16260
16261: see if this is a syswait system
16262set sys/wait.h i_syswait
16263eval $inhdr
16264
16265: see if this is a ustat.h system
16266set ustat.h i_ustat
16267eval $inhdr
16268
16269: see if this is an utime system
16270set utime.h i_utime
16271eval $inhdr
16272
16273: see if this is a values.h system
16274set values.h i_values
16275eval $inhdr
16276
16277: see if this is a vfork system
16278case "$d_vfork" in
16279"$define")
16280 set vfork.h i_vfork
16281 eval $inhdr
16282 ;;
16283*)
16284 i_vfork="$undef"
16285 ;;
16286esac
16287
16288: see if gdbm.h is available
16289set gdbm.h t_gdbm
16290eval $inhdr
16291case "$t_gdbm" in
16292$define)
16293 : see if gdbm_open exists
16294 set gdbm_open d_gdbm_open
16295 eval $inlibc
16296 case "$d_gdbm_open" in
16297 $undef)
16298 t_gdbm="$undef"
16299 echo "We won't be including <gdbm.h>"
5f80c64f 16300 ;;
b4eb6b3d
JH
16301 esac
16302 ;;
16303esac
16304val="$t_gdbm"
16305set i_gdbm
16306eval $setvar
16307
16308echo " "
16309echo "Looking for extensions..." >&4
16310: If we are using the old config.sh, known_extensions may contain
16311: old or inaccurate or duplicate values.
16312known_extensions=''
16313nonxs_extensions=''
16314: We do not use find because it might not be available.
16315: We do not just use MANIFEST because the user may have dropped
16316: some additional extensions into the source tree and expect them
16317: to be built.
16318
16319: Function to recursively find available extensions, ignoring DynaLoader
16320: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
16321find_extensions='
16322 for xxx in *; do
16323 case "$xxx" in
16324 DynaLoader|dynaload) ;;
16325 *)
16326 if $test -f $xxx/$xxx.xs; then
16327 known_extensions="$known_extensions $1$xxx";
16328 elif $test -f $xxx/Makefile.PL; then
16329 nonxs_extensions="$nonxs_extensions $1$xxx";
16330 else
16331 if $test -d $xxx -a $# -lt 10; then
16332 set $1$xxx/ $*;
16333 cd $xxx;
16334 eval $find_extensions;
16335 cd ..;
16336 shift;
16337 fi;
16338 fi
16339 ;;
16340 esac;
16341 done'
16342tdir=`pwd`
16343cd $rsrc/ext
16344set X
16345shift
16346eval $find_extensions
16347set X $nonxs_extensions
16348shift
16349nonxs_extensions="$*"
16350set X $known_extensions
16351shift
16352known_extensions="$*"
16353cd $tdir
16354
16355: Now see which are supported on this system.
16356avail_ext=''
16357for xxx in $known_extensions ; do
16358 case "$xxx" in
16359 DB_File|db_file)
16360 case "$i_db" in
16361 $define) avail_ext="$avail_ext $xxx" ;;
16362 esac
16363 ;;
16364 GDBM_File|gdbm_fil)
16365 case "$i_gdbm" in
16366 $define) avail_ext="$avail_ext $xxx" ;;
16367 esac
16368 ;;
1d59c593 16369 I18N/Langinfo|i18n_lan)
4bbcc6e8
JH
16370 case "$i_langinfo$d_nl_langinfo" in
16371 $define$define) avail_ext="$avail_ext $xxx" ;;
16372 esac
16373 ;;
b4eb6b3d
JH
16374 NDBM_File|ndbm_fil)
16375 case "$i_ndbm" in
16376 $define)
16377 case "$osname-$use64bitint" in
252f4fb1 16378 cygwin-*|hpux-define)
b4eb6b3d
JH
16379 case "$libs" in
16380 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
16381 esac
16382 ;;
16383 *) avail_ext="$avail_ext $xxx" ;;
16384 esac
16385 ;;
16386 esac
16387 ;;
16388 ODBM_File|odbm_fil)
16389 case "${i_dbm}${i_rpcsvcdbm}" in
16390 *"${define}"*)
16391 case "$osname-$use64bitint" in
252f4fb1 16392 cygwin-*|hpux-define)
b4eb6b3d
JH
16393 case "$libs" in
16394 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
16395 esac
16396 ;;
16397 *) avail_ext="$avail_ext $xxx" ;;
16398 esac
16399 ;;
16400 esac
16401 ;;
16402 POSIX|posix)
16403 case "$useposix" in
16404 true|define|y) avail_ext="$avail_ext $xxx" ;;
16405 esac
16406 ;;
16407 Opcode|opcode)
16408 case "$useopcode" in
16409 true|define|y) avail_ext="$avail_ext $xxx" ;;
16410 esac
16411 ;;
16412 Socket|socket)
16413 case "$d_socket" in
16414 true|$define|y) avail_ext="$avail_ext $xxx" ;;
16415 esac
16416 ;;
16417 Sys/Syslog|sys/syslog)
16418 : XXX syslog requires socket
16419 case "$d_socket" in
16420 true|$define|y) avail_ext="$avail_ext $xxx" ;;
16421 esac
16422 ;;
16423 Thread|thread)
b00ec89b
AB
16424 case "$usethreads" in
16425 true|$define|y)
16426 case "$useithreads" in
16427 $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
16428 esac
b4eb6b3d
JH
16429 esac
16430 ;;
1dca008a
JH
16431 threads)
16432 case "$usethreads" in
16433 true|$define|y)
16434 case "$useithreads" in
16435 $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
16436 esac
16437 esac
16438 ;;
b4eb6b3d
JH
16439 IPC/SysV|ipc/sysv)
16440 : XXX Do we need a useipcsysv variable here
16441 case "${d_msg}${d_sem}${d_shm}" in
16442 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
16443 esac
16444 ;;
16445 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
16446 ;;
16447 esac
b4eb6b3d 16448done
5f80c64f 16449
b4eb6b3d
JH
16450set X $avail_ext
16451shift
16452avail_ext="$*"
5f80c64f 16453
b4eb6b3d
JH
16454: Now see which nonxs extensions are supported on this system.
16455: For now assume all are.
16456nonxs_ext=''
16457for xxx in $nonxs_extensions ; do
16458 case "$xxx" in
16459 *) nonxs_ext="$nonxs_ext $xxx"
16460 ;;
16461 esac
16462done
5f80c64f 16463
b4eb6b3d
JH
16464set X $nonxs_ext
16465shift
16466nonxs_ext="$*"
16467
16468case $usedl in
16469$define)
16470 $cat <<EOM
16471A number of extensions are supplied with $package. You may choose to
16472compile these extensions for dynamic loading (the default), compile
16473them into the $package executable (static loading), or not include
16474them at all. Answer "none" to include no extensions.
16475Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
16476
16477EOM
b4eb6b3d
JH
16478 case "$dynamic_ext" in
16479 '') dflt="$avail_ext" ;;
16480 *) dflt="$dynamic_ext"
16481 # Perhaps we are reusing an old out-of-date config.sh.
16482 case "$hint" in
16483 previous)
16484 if test X"$dynamic_ext" != X"$avail_ext"; then
16485 $cat <<EOM
16486NOTICE: Your previous config.sh list may be incorrect.
16487The extensions now available to you are
16488 ${avail_ext}
16489but the default list from your previous config.sh is
16490 ${dynamic_ext}
9c839522 16491
b4eb6b3d
JH
16492EOM
16493 fi
9c839522
PM
16494 ;;
16495 esac
b4eb6b3d
JH
16496 ;;
16497 esac
5f80c64f 16498 case "$dflt" in
b4eb6b3d
JH
16499 '') dflt=none;;
16500 esac
16501 rp="What extensions do you wish to load dynamically?"
16502 . ./myread
16503 case "$ans" in
16504 none) dynamic_ext=' ' ;;
16505 *) dynamic_ext="$ans" ;;
5f80c64f 16506 esac
5f80c64f 16507
b4eb6b3d
JH
16508 case "$static_ext" in
16509 '')
16510 : Exclude those already listed in dynamic linking
16511 dflt=''
16512 for xxx in $avail_ext; do
16513 case " $dynamic_ext " in
16514 *" $xxx "*) ;;
16515 *) dflt="$dflt $xxx" ;;
16516 esac
16517 done
16518 set X $dflt
16519 shift
16520 dflt="$*"
16521 ;;
16522 *) dflt="$static_ext"
16523 ;;
16524 esac
9c839522 16525
b4eb6b3d
JH
16526 case "$dflt" in
16527 '') dflt=none;;
16528 esac
16529 rp="What extensions do you wish to load statically?"
16530 . ./myread
16531 case "$ans" in
16532 none) static_ext=' ' ;;
16533 *) static_ext="$ans" ;;
16534 esac
16535 ;;
16536*)
16537 $cat <<EOM
16538A number of extensions are supplied with $package. Answer "none"
16539to include no extensions.
16540Note that DynaLoader is always built and need not be mentioned here.
9c839522 16541
b4eb6b3d
JH
16542EOM
16543 case "$static_ext" in
16544 '') dflt="$avail_ext" ;;
16545 *) dflt="$static_ext"
16546 # Perhaps we are reusing an old out-of-date config.sh.
16547 case "$hint" in
16548 previous)
16549 if test X"$static_ext" != X"$avail_ext"; then
16550 $cat <<EOM
16551NOTICE: Your previous config.sh list may be incorrect.
16552The extensions now available to you are
16553 ${avail_ext}
16554but the default list from your previous config.sh is
16555 ${static_ext}
5f80c64f
JH
16556
16557EOM
b4eb6b3d
JH
16558 fi
16559 ;;
16560 esac
16561 ;;
16562 esac
16563 : Exclude those that are not xs extensions
16564 case "$dflt" in
16565 '') dflt=none;;
16566 esac
16567 rp="What extensions do you wish to include?"
16568 . ./myread
16569 case "$ans" in
16570 none) static_ext=' ' ;;
16571 *) static_ext="$ans" ;;
16572 esac
16573 ;;
5f80c64f
JH
16574esac
16575
b4eb6b3d
JH
16576set X $dynamic_ext $static_ext $nonxs_ext
16577shift
16578extensions="$*"
16579
9c839522
PM
16580: Remove libraries needed only for extensions
16581: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
16582: The exception is SunOS 4.x, which needs them.
16583case "${osname}X${osvers}" in
16584sunos*X4*)
16585 perllibs="$libs"
16586 ;;
16587*) case "$usedl" in
16588 $define|true|[yY]*)
16589 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
16590 shift
16591 perllibs="$*"
16592 ;;
16593 *) perllibs="$libs"
16594 ;;
16595 esac
16596 ;;
9c839522 16597esac
5f80c64f
JH
16598
16599: Remove build directory name from cppstdin so it can be used from
16600: either the present location or the final installed location.
16601echo " "
16602: Get out of the UU directory to get correct path name.
16603cd ..
16604case "$cppstdin" in
16605`pwd`/cppstdin)
16606 echo "Stripping down cppstdin path name"
16607 cppstdin=cppstdin
16608 ;;
16609esac
16610cd UU
16611
16612: end of configuration questions
16613echo " "
16614echo "End of configuration questions."
16615echo " "
16616
16617: back to where it started
16618if test -d ../UU; then
16619 cd ..
16620fi
16621
16622: configuration may be patched via a 'config.over' file
16623if $test -f config.over; then
16624 echo " "
16625 dflt=y
16626 rp='I see a config.over file. Do you wish to load it?'
16627 . UU/myread
16628 case "$ans" in
16629 n*) echo "OK, I'll ignore it.";;
16630 *) . ./config.over
16631 echo "Configuration override changes have been loaded."
16632 ;;
16633 esac
16634fi
16635
16636: in case they want portability, strip down executable paths
16637case "$d_portable" in
16638"$define")
16639 echo " "
16640 echo "Stripping down executable paths..." >&4
16641 for file in $loclist $trylist; do
534ac15a
JH
16642 eval temp=\$$file
16643 eval $file=`basename $temp`
5f80c64f
JH
16644 done
16645 ;;
16646esac
16647
16648: create config.sh file
16649echo " "
16650echo "Creating config.sh..." >&4
16651$spitshell <<EOT >config.sh
16652$startsh
16653#
16654# This file was produced by running the Configure script. It holds all the
16655# definitions figured out by Configure. Should you modify one of these values,
16656# do not forget to propagate your changes by running "Configure -der". You may
16657# instead choose to run each of the .SH files by yourself, or "Configure -S".
16658#
16659
16660# Package name : $package
16661# Source directory : $src
16662# Configuration time: $cf_time
16663# Configured by : $cf_by
16664# Target system : $myuname
16665
16666Author='$Author'
16667Date='$Date'
16668Header='$Header'
16669Id='$Id'
16670Locker='$Locker'
16671Log='$Log'
16672Mcc='$Mcc'
16673RCSfile='$RCSfile'
16674Revision='$Revision'
16675Source='$Source'
16676State='$State'
16677_a='$_a'
16678_exe='$_exe'
16679_o='$_o'
b4eb6b3d 16680afs='$afs'
a6d26a0d 16681afsroot='$afsroot'
b4eb6b3d
JH
16682alignbytes='$alignbytes'
16683ansi2knr='$ansi2knr'
16684aphostname='$aphostname'
16685api_revision='$api_revision'
16686api_subversion='$api_subversion'
16687api_version='$api_version'
16688api_versionstring='$api_versionstring'
5f80c64f 16689ar='$ar'
b4eb6b3d
JH
16690archlib='$archlib'
16691archlibexp='$archlibexp'
16692archname64='$archname64'
16693archname='$archname'
5f80c64f
JH
16694archobjs='$archobjs'
16695awk='$awk'
b4eb6b3d 16696baserev='$baserev'
5f80c64f 16697bash='$bash'
b4eb6b3d
JH
16698bin='$bin'
16699bincompat5005='$bincompat5005'
16700binexp='$binexp'
5f80c64f
JH
16701bison='$bison'
16702byacc='$byacc'
b4eb6b3d 16703byteorder='$byteorder'
5f80c64f 16704c='$c'
b4eb6b3d 16705castflags='$castflags'
5f80c64f
JH
16706cat='$cat'
16707cc='$cc'
16708cccdlflags='$cccdlflags'
16709ccdlflags='$ccdlflags'
16710ccflags='$ccflags'
b4eb6b3d 16711ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 16712ccname='$ccname'
b4eb6b3d 16713ccsymbols='$ccsymbols'
6b356c8e 16714ccversion='$ccversion'
5f80c64f 16715cf_by='$cf_by'
b4eb6b3d 16716cf_email='$cf_email'
5f80c64f 16717cf_time='$cf_time'
b4eb6b3d 16718charsize='$charsize'
5f80c64f
JH
16719chgrp='$chgrp'
16720chmod='$chmod'
16721chown='$chown'
b4eb6b3d 16722clocktype='$clocktype'
5f80c64f
JH
16723comm='$comm'
16724compress='$compress'
16725contains='$contains'
16726cp='$cp'
16727cpio='$cpio'
16728cpp='$cpp'
b4eb6b3d
JH
16729cpp_stuff='$cpp_stuff'
16730cppccsymbols='$cppccsymbols'
5f80c64f
JH
16731cppflags='$cppflags'
16732cpplast='$cpplast'
16733cppminus='$cppminus'
16734cpprun='$cpprun'
16735cppstdin='$cppstdin'
b4eb6b3d 16736cppsymbols='$cppsymbols'
b4eb6b3d 16737cryptlib='$cryptlib'
5f80c64f 16738csh='$csh'
b4eb6b3d
JH
16739d_Gconvert='$d_Gconvert'
16740d_PRIEUldbl='$d_PRIEUldbl'
16741d_PRIFUldbl='$d_PRIFUldbl'
16742d_PRIGUldbl='$d_PRIGUldbl'
16743d_PRIXU64='$d_PRIXU64'
16744d_PRId64='$d_PRId64'
16745d_PRIeldbl='$d_PRIeldbl'
16746d_PRIfldbl='$d_PRIfldbl'
16747d_PRIgldbl='$d_PRIgldbl'
16748d_PRIi64='$d_PRIi64'
16749d_PRIo64='$d_PRIo64'
16750d_PRIu64='$d_PRIu64'
16751d_PRIx64='$d_PRIx64'
16752d_SCNfldbl='$d_SCNfldbl'
74cac757 16753d__fwalk='$d__fwalk'
b4eb6b3d
JH
16754d_access='$d_access'
16755d_accessx='$d_accessx'
16756d_alarm='$d_alarm'
16757d_archlib='$d_archlib'
16758d_atolf='$d_atolf'
16759d_atoll='$d_atoll'
16760d_attribut='$d_attribut'
16761d_bcmp='$d_bcmp'
16762d_bcopy='$d_bcopy'
16763d_bincompat5005='$d_bincompat5005'
5f80c64f 16764d_bsd='$d_bsd'
b4eb6b3d
JH
16765d_bsdgetpgrp='$d_bsdgetpgrp'
16766d_bsdsetpgrp='$d_bsdsetpgrp'
16767d_bzero='$d_bzero'
16768d_casti32='$d_casti32'
16769d_castneg='$d_castneg'
16770d_charvspr='$d_charvspr'
16771d_chown='$d_chown'
16772d_chroot='$d_chroot'
16773d_chsize='$d_chsize'
758a5d79 16774d_class='$d_class'
b4eb6b3d 16775d_closedir='$d_closedir'
4e0554ec 16776d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d
JH
16777d_const='$d_const'
16778d_crypt='$d_crypt'
16779d_csh='$d_csh'
16780d_cuserid='$d_cuserid'
16781d_dbl_dig='$d_dbl_dig'
2ef53570 16782d_dbminitproto='$d_dbminitproto'
b4eb6b3d
JH
16783d_difftime='$d_difftime'
16784d_dirnamlen='$d_dirnamlen'
16785d_dlerror='$d_dlerror'
5f80c64f 16786d_dlopen='$d_dlopen'
b4eb6b3d
JH
16787d_dlsymun='$d_dlsymun'
16788d_dosuid='$d_dosuid'
16789d_drand48proto='$d_drand48proto'
16790d_dup2='$d_dup2'
16791d_eaccess='$d_eaccess'
16792d_endgrent='$d_endgrent'
16793d_endhent='$d_endhent'
16794d_endnent='$d_endnent'
16795d_endpent='$d_endpent'
16796d_endpwent='$d_endpwent'
16797d_endsent='$d_endsent'
16798d_eofnblk='$d_eofnblk'
5f80c64f 16799d_eunice='$d_eunice'
b363b713 16800d_fchdir='$d_fchdir'
b4eb6b3d
JH
16801d_fchmod='$d_fchmod'
16802d_fchown='$d_fchown'
16803d_fcntl='$d_fcntl'
9d9004a9 16804d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
16805d_fd_macros='$d_fd_macros'
16806d_fd_set='$d_fd_set'
16807d_fds_bits='$d_fds_bits'
16808d_fgetpos='$d_fgetpos'
758a5d79
JH
16809d_finite='$d_finite'
16810d_finitel='$d_finitel'
b4eb6b3d
JH
16811d_flexfnam='$d_flexfnam'
16812d_flock='$d_flock'
2ef53570 16813d_flockproto='$d_flockproto'
b4eb6b3d 16814d_fork='$d_fork'
758a5d79 16815d_fp_class='$d_fp_class'
b4eb6b3d 16816d_fpathconf='$d_fpathconf'
758a5d79
JH
16817d_fpclass='$d_fpclass'
16818d_fpclassify='$d_fpclassify'
16819d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
16820d_fpos64_t='$d_fpos64_t'
16821d_frexpl='$d_frexpl'
16822d_fs_data_s='$d_fs_data_s'
16823d_fseeko='$d_fseeko'
16824d_fsetpos='$d_fsetpos'
16825d_fstatfs='$d_fstatfs'
16826d_fstatvfs='$d_fstatvfs'
411ab01c 16827d_fsync='$d_fsync'
b4eb6b3d
JH
16828d_ftello='$d_ftello'
16829d_ftime='$d_ftime'
16830d_getcwd='$d_getcwd'
16831d_getespwnam='$d_getespwnam'
16832d_getfsstat='$d_getfsstat'
16833d_getgrent='$d_getgrent'
16834d_getgrps='$d_getgrps'
16835d_gethbyaddr='$d_gethbyaddr'
16836d_gethbyname='$d_gethbyname'
16837d_gethent='$d_gethent'
16838d_gethname='$d_gethname'
16839d_gethostprotos='$d_gethostprotos'
4e0554ec 16840d_getitimer='$d_getitimer'
b4eb6b3d
JH
16841d_getlogin='$d_getlogin'
16842d_getmnt='$d_getmnt'
16843d_getmntent='$d_getmntent'
16844d_getnbyaddr='$d_getnbyaddr'
16845d_getnbyname='$d_getnbyname'
16846d_getnent='$d_getnent'
16847d_getnetprotos='$d_getnetprotos'
0c0643d0 16848d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
16849d_getpbyname='$d_getpbyname'
16850d_getpbynumber='$d_getpbynumber'
16851d_getpent='$d_getpent'
16852d_getpgid='$d_getpgid'
16853d_getpgrp2='$d_getpgrp2'
16854d_getpgrp='$d_getpgrp'
16855d_getppid='$d_getppid'
16856d_getprior='$d_getprior'
16857d_getprotoprotos='$d_getprotoprotos'
16858d_getprpwnam='$d_getprpwnam'
16859d_getpwent='$d_getpwent'
16860d_getsbyname='$d_getsbyname'
16861d_getsbyport='$d_getsbyport'
16862d_getsent='$d_getsent'
16863d_getservprotos='$d_getservprotos'
16864d_getspnam='$d_getspnam'
16865d_gettimeod='$d_gettimeod'
5f80c64f 16866d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
16867d_grpasswd='$d_grpasswd'
16868d_hasmntopt='$d_hasmntopt'
16869d_htonl='$d_htonl'
16870d_iconv='$d_iconv'
16871d_index='$d_index'
16872d_inetaton='$d_inetaton'
16873d_int64_t='$d_int64_t'
16874d_isascii='$d_isascii'
758a5d79
JH
16875d_isfinite='$d_isfinite'
16876d_isinf='$d_isinf'
b4eb6b3d
JH
16877d_isnan='$d_isnan'
16878d_isnanl='$d_isnanl'
16879d_killpg='$d_killpg'
16880d_lchown='$d_lchown'
16881d_ldbl_dig='$d_ldbl_dig'
16882d_link='$d_link'
16883d_locconv='$d_locconv'
16884d_lockf='$d_lockf'
16885d_longdbl='$d_longdbl'
16886d_longlong='$d_longlong'
16887d_lseekproto='$d_lseekproto'
16888d_lstat='$d_lstat'
16889d_madvise='$d_madvise'
16890d_mblen='$d_mblen'
16891d_mbstowcs='$d_mbstowcs'
16892d_mbtowc='$d_mbtowc'
16893d_memchr='$d_memchr'
16894d_memcmp='$d_memcmp'
16895d_memcpy='$d_memcpy'
16896d_memmove='$d_memmove'
16897d_memset='$d_memset'
16898d_mkdir='$d_mkdir'
16899d_mkdtemp='$d_mkdtemp'
16900d_mkfifo='$d_mkfifo'
16901d_mkstemp='$d_mkstemp'
16902d_mkstemps='$d_mkstemps'
16903d_mktime='$d_mktime'
16904d_mmap='$d_mmap'
16905d_modfl='$d_modfl'
e67aeab1 16906d_modfl_pow32_bug='$d_modfl_pow32_bug'
b4eb6b3d
JH
16907d_mprotect='$d_mprotect'
16908d_msg='$d_msg'
16909d_msg_ctrunc='$d_msg_ctrunc'
16910d_msg_dontroute='$d_msg_dontroute'
16911d_msg_oob='$d_msg_oob'
16912d_msg_peek='$d_msg_peek'
16913d_msg_proxy='$d_msg_proxy'
16914d_msgctl='$d_msgctl'
16915d_msgget='$d_msgget'
4e0554ec 16916d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
16917d_msgrcv='$d_msgrcv'
16918d_msgsnd='$d_msgsnd'
16919d_msync='$d_msync'
16920d_munmap='$d_munmap'
16921d_mymalloc='$d_mymalloc'
16922d_nice='$d_nice'
2765b840 16923d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d
JH
16924d_nv_preserves_uv='$d_nv_preserves_uv'
16925d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16926d_off64_t='$d_off64_t'
16927d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16928d_oldpthreads='$d_oldpthreads'
16929d_oldsock='$d_oldsock'
16930d_open3='$d_open3'
16931d_pathconf='$d_pathconf'
16932d_pause='$d_pause'
16933d_perl_otherlibdirs='$d_perl_otherlibdirs'
16934d_phostname='$d_phostname'
16935d_pipe='$d_pipe'
16936d_poll='$d_poll'
5f80c64f 16937d_portable='$d_portable'
d6483fcc 16938d_pthread_atfork='$d_pthread_atfork'
b4eb6b3d
JH
16939d_pthread_yield='$d_pthread_yield'
16940d_pwage='$d_pwage'
16941d_pwchange='$d_pwchange'
16942d_pwclass='$d_pwclass'
16943d_pwcomment='$d_pwcomment'
16944d_pwexpire='$d_pwexpire'
16945d_pwgecos='$d_pwgecos'
16946d_pwpasswd='$d_pwpasswd'
16947d_pwquota='$d_pwquota'
16948d_qgcvt='$d_qgcvt'
16949d_quad='$d_quad'
16950d_readdir='$d_readdir'
16951d_readlink='$d_readlink'
4e0554ec
JH
16952d_readv='$d_readv'
16953d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
16954d_rename='$d_rename'
16955d_rewinddir='$d_rewinddir'
16956d_rmdir='$d_rmdir'
16957d_safebcpy='$d_safebcpy'
16958d_safemcpy='$d_safemcpy'
16959d_sanemcmp='$d_sanemcmp'
ef9f17be 16960d_sbrkproto='$d_sbrkproto'
b4eb6b3d
JH
16961d_sched_yield='$d_sched_yield'
16962d_scm_rights='$d_scm_rights'
16963d_seekdir='$d_seekdir'
16964d_select='$d_select'
16965d_sem='$d_sem'
16966d_semctl='$d_semctl'
16967d_semctl_semid_ds='$d_semctl_semid_ds'
16968d_semctl_semun='$d_semctl_semun'
16969d_semget='$d_semget'
16970d_semop='$d_semop'
4e0554ec 16971d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
16972d_setegid='$d_setegid'
16973d_seteuid='$d_seteuid'
16974d_setgrent='$d_setgrent'
16975d_setgrps='$d_setgrps'
16976d_sethent='$d_sethent'
4e0554ec 16977d_setitimer='$d_setitimer'
b4eb6b3d
JH
16978d_setlinebuf='$d_setlinebuf'
16979d_setlocale='$d_setlocale'
16980d_setnent='$d_setnent'
16981d_setpent='$d_setpent'
16982d_setpgid='$d_setpgid'
16983d_setpgrp2='$d_setpgrp2'
16984d_setpgrp='$d_setpgrp'
16985d_setprior='$d_setprior'
16986d_setproctitle='$d_setproctitle'
16987d_setpwent='$d_setpwent'
16988d_setregid='$d_setregid'
16989d_setresgid='$d_setresgid'
16990d_setresuid='$d_setresuid'
16991d_setreuid='$d_setreuid'
16992d_setrgid='$d_setrgid'
16993d_setruid='$d_setruid'
16994d_setsent='$d_setsent'
16995d_setsid='$d_setsid'
16996d_setvbuf='$d_setvbuf'
16997d_sfio='$d_sfio'
16998d_shm='$d_shm'
16999d_shmat='$d_shmat'
17000d_shmatprototype='$d_shmatprototype'
17001d_shmctl='$d_shmctl'
17002d_shmdt='$d_shmdt'
17003d_shmget='$d_shmget'
17004d_sigaction='$d_sigaction'
983dbef6 17005d_sigprocmask='$d_sigprocmask'
b4eb6b3d 17006d_sigsetjmp='$d_sigsetjmp'
49a78c82 17007d_sockatmark='$d_sockatmark'
2ef53570 17008d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
17009d_socket='$d_socket'
17010d_socklen_t='$d_socklen_t'
17011d_sockpair='$d_sockpair'
17012d_socks5_init='$d_socks5_init'
17013d_sqrtl='$d_sqrtl'
eef837ea 17014d_sresgproto='$d_sresgproto'
640374d0 17015d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
17016d_statblks='$d_statblks'
17017d_statfs_f_flags='$d_statfs_f_flags'
17018d_statfs_s='$d_statfs_s'
17019d_statvfs='$d_statvfs'
17020d_stdio_cnt_lval='$d_stdio_cnt_lval'
17021d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
17022d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
17023d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
17024d_stdio_stream_array='$d_stdio_stream_array'
17025d_stdiobase='$d_stdiobase'
17026d_stdstdio='$d_stdstdio'
17027d_strchr='$d_strchr'
17028d_strcoll='$d_strcoll'
17029d_strctcpy='$d_strctcpy'
17030d_strerrm='$d_strerrm'
17031d_strerror='$d_strerror'
b3c85772 17032d_strftime='$d_strftime'
b4eb6b3d
JH
17033d_strtod='$d_strtod'
17034d_strtol='$d_strtol'
17035d_strtold='$d_strtold'
17036d_strtoll='$d_strtoll'
28e5dec8 17037d_strtoq='$d_strtoq'
b4eb6b3d
JH
17038d_strtoul='$d_strtoul'
17039d_strtoull='$d_strtoull'
17040d_strtouq='$d_strtouq'
17041d_strxfrm='$d_strxfrm'
17042d_suidsafe='$d_suidsafe'
17043d_symlink='$d_symlink'
17044d_syscall='$d_syscall'
2ef53570 17045d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
17046d_sysconf='$d_sysconf'
17047d_sysernlst='$d_sysernlst'
17048d_syserrlst='$d_syserrlst'
17049d_system='$d_system'
17050d_tcgetpgrp='$d_tcgetpgrp'
17051d_tcsetpgrp='$d_tcsetpgrp'
17052d_telldir='$d_telldir'
17053d_telldirproto='$d_telldirproto'
17054d_time='$d_time'
17055d_times='$d_times'
17056d_truncate='$d_truncate'
17057d_tzname='$d_tzname'
4e0554ec
JH
17058d_u32align='$d_u32align'
17059d_ualarm='$d_ualarm'
b4eb6b3d
JH
17060d_umask='$d_umask'
17061d_uname='$d_uname'
17062d_union_semun='$d_union_semun'
758a5d79 17063d_unordered='$d_unordered'
4e0554ec 17064d_usleep='$d_usleep'
2ef53570 17065d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
17066d_ustat='$d_ustat'
17067d_vendorarch='$d_vendorarch'
17068d_vendorbin='$d_vendorbin'
17069d_vendorlib='$d_vendorlib'
17070d_vfork='$d_vfork'
17071d_void_closedir='$d_void_closedir'
17072d_voidsig='$d_voidsig'
17073d_voidtty='$d_voidtty'
17074d_volatile='$d_volatile'
17075d_vprintf='$d_vprintf'
17076d_wait4='$d_wait4'
17077d_waitpid='$d_waitpid'
17078d_wcstombs='$d_wcstombs'
17079d_wctomb='$d_wctomb'
4e0554ec 17080d_writev='$d_writev'
5f80c64f
JH
17081d_xenix='$d_xenix'
17082date='$date'
b4eb6b3d
JH
17083db_hashtype='$db_hashtype'
17084db_prefixtype='$db_prefixtype'
640374d0
JH
17085db_version_major='$db_version_major'
17086db_version_minor='$db_version_minor'
17087db_version_patch='$db_version_patch'
b4eb6b3d
JH
17088defvoidused='$defvoidused'
17089direntrytype='$direntrytype'
17090dlext='$dlext'
5f80c64f 17091dlsrc='$dlsrc'
b4eb6b3d
JH
17092doublesize='$doublesize'
17093drand01='$drand01'
17094dynamic_ext='$dynamic_ext'
17095eagain='$eagain'
17096ebcdic='$ebcdic'
5f80c64f
JH
17097echo='$echo'
17098egrep='$egrep'
17099emacs='$emacs'
17100eunicefix='$eunicefix'
17101exe_ext='$exe_ext'
17102expr='$expr'
b4eb6b3d 17103extensions='$extensions'
6fcddf3b 17104extras='$extras'
b4eb6b3d
JH
17105fflushNULL='$fflushNULL'
17106fflushall='$fflushall'
5f80c64f
JH
17107find='$find'
17108firstmakefile='$firstmakefile'
17109flex='$flex'
b4eb6b3d
JH
17110fpossize='$fpossize'
17111fpostype='$fpostype'
17112freetype='$freetype'
5440bc8e 17113from='$from'
b4eb6b3d
JH
17114full_ar='$full_ar'
17115full_csh='$full_csh'
17116full_sed='$full_sed'
5b463ca7 17117gccosandvers='$gccosandvers'
5f80c64f 17118gccversion='$gccversion'
b4eb6b3d
JH
17119gidformat='$gidformat'
17120gidsign='$gidsign'
17121gidsize='$gidsize'
17122gidtype='$gidtype'
5f80c64f
JH
17123glibpth='$glibpth'
17124grep='$grep'
b4eb6b3d
JH
17125groupcat='$groupcat'
17126groupstype='$groupstype'
5f80c64f 17127gzip='$gzip'
b4eb6b3d
JH
17128h_fcntl='$h_fcntl'
17129h_sysfile='$h_sysfile'
5f80c64f 17130hint='$hint'
b4eb6b3d
JH
17131hostcat='$hostcat'
17132i16size='$i16size'
17133i16type='$i16type'
17134i32size='$i32size'
17135i32type='$i32type'
17136i64size='$i64size'
17137i64type='$i64type'
17138i8size='$i8size'
17139i8type='$i8type'
17140i_arpainet='$i_arpainet'
17141i_bsdioctl='$i_bsdioctl'
17142i_db='$i_db'
17143i_dbm='$i_dbm'
17144i_dirent='$i_dirent'
5f80c64f 17145i_dld='$i_dld'
b4eb6b3d
JH
17146i_dlfcn='$i_dlfcn'
17147i_fcntl='$i_fcntl'
17148i_float='$i_float'
758a5d79
JH
17149i_fp='$i_fp'
17150i_fp_class='$i_fp_class'
b4eb6b3d
JH
17151i_gdbm='$i_gdbm'
17152i_grp='$i_grp'
17153i_iconv='$i_iconv'
17154i_ieeefp='$i_ieeefp'
17155i_inttypes='$i_inttypes'
2765b840 17156i_langinfo='$i_langinfo'
b4eb6b3d
JH
17157i_libutil='$i_libutil'
17158i_limits='$i_limits'
17159i_locale='$i_locale'
17160i_machcthr='$i_machcthr'
17161i_malloc='$i_malloc'
17162i_math='$i_math'
17163i_memory='$i_memory'
17164i_mntent='$i_mntent'
17165i_ndbm='$i_ndbm'
17166i_netdb='$i_netdb'
17167i_neterrno='$i_neterrno'
17168i_netinettcp='$i_netinettcp'
17169i_niin='$i_niin'
17170i_poll='$i_poll'
17171i_prot='$i_prot'
17172i_pthread='$i_pthread'
17173i_pwd='$i_pwd'
17174i_rpcsvcdbm='$i_rpcsvcdbm'
17175i_sfio='$i_sfio'
17176i_sgtty='$i_sgtty'
17177i_shadow='$i_shadow'
17178i_socks='$i_socks'
17179i_stdarg='$i_stdarg'
17180i_stddef='$i_stddef'
17181i_stdlib='$i_stdlib'
17182i_string='$i_string'
17183i_sunmath='$i_sunmath'
17184i_sysaccess='$i_sysaccess'
17185i_sysdir='$i_sysdir'
17186i_sysfile='$i_sysfile'
17187i_sysfilio='$i_sysfilio'
17188i_sysin='$i_sysin'
17189i_sysioctl='$i_sysioctl'
17190i_syslog='$i_syslog'
17191i_sysmman='$i_sysmman'
17192i_sysmode='$i_sysmode'
17193i_sysmount='$i_sysmount'
17194i_sysndir='$i_sysndir'
17195i_sysparam='$i_sysparam'
17196i_sysresrc='$i_sysresrc'
17197i_syssecrt='$i_syssecrt'
17198i_sysselct='$i_sysselct'
17199i_syssockio='$i_syssockio'
17200i_sysstat='$i_sysstat'
17201i_sysstatfs='$i_sysstatfs'
17202i_sysstatvfs='$i_sysstatvfs'
17203i_systime='$i_systime'
17204i_systimek='$i_systimek'
17205i_systimes='$i_systimes'
17206i_systypes='$i_systypes'
17207i_sysuio='$i_sysuio'
17208i_sysun='$i_sysun'
17209i_sysutsname='$i_sysutsname'
17210i_sysvfs='$i_sysvfs'
17211i_syswait='$i_syswait'
17212i_termio='$i_termio'
17213i_termios='$i_termios'
17214i_time='$i_time'
17215i_unistd='$i_unistd'
17216i_ustat='$i_ustat'
17217i_utime='$i_utime'
17218i_values='$i_values'
17219i_varargs='$i_varargs'
17220i_varhdr='$i_varhdr'
17221i_vfork='$i_vfork'
5f80c64f 17222ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
17223inc_version_list='$inc_version_list'
17224inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
17225incpath='$incpath'
17226inews='$inews'
b4eb6b3d
JH
17227installarchlib='$installarchlib'
17228installbin='$installbin'
17229installman1dir='$installman1dir'
17230installman3dir='$installman3dir'
17231installprefix='$installprefix'
17232installprefixexp='$installprefixexp'
17233installprivlib='$installprivlib'
17234installscript='$installscript'
17235installsitearch='$installsitearch'
17236installsitebin='$installsitebin'
17237installsitelib='$installsitelib'
17238installstyle='$installstyle'
17239installusrbinperl='$installusrbinperl'
17240installvendorarch='$installvendorarch'
17241installvendorbin='$installvendorbin'
17242installvendorlib='$installvendorlib'
17243intsize='$intsize'
4b661809 17244issymlink='$issymlink'
b4eb6b3d
JH
17245ivdformat='$ivdformat'
17246ivsize='$ivsize'
17247ivtype='$ivtype'
17248known_extensions='$known_extensions'
5f80c64f 17249ksh='$ksh'
5f80c64f
JH
17250ld='$ld'
17251lddlflags='$lddlflags'
17252ldflags='$ldflags'
b4eb6b3d
JH
17253ldflags_uselargefiles='$ldflags_uselargefiles'
17254ldlibpthname='$ldlibpthname'
5f80c64f
JH
17255less='$less'
17256lib_ext='$lib_ext'
17257libc='$libc'
b4eb6b3d 17258libperl='$libperl'
5f80c64f
JH
17259libpth='$libpth'
17260libs='$libs'
43999f95
JH
17261libsdirs='$libsdirs'
17262libsfiles='$libsfiles'
17263libsfound='$libsfound'
13b3f787 17264libspath='$libspath'
5f80c64f 17265libswanted='$libswanted'
b4eb6b3d 17266libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
17267line='$line'
17268lint='$lint'
17269lkflags='$lkflags'
17270ln='$ln'
17271lns='$lns'
17272locincpth='$locincpth'
17273loclibpth='$loclibpth'
b4eb6b3d
JH
17274longdblsize='$longdblsize'
17275longlongsize='$longlongsize'
17276longsize='$longsize'
5f80c64f
JH
17277lp='$lp'
17278lpr='$lpr'
17279ls='$ls'
b4eb6b3d
JH
17280lseeksize='$lseeksize'
17281lseektype='$lseektype'
5f80c64f
JH
17282mail='$mail'
17283mailx='$mailx'
17284make='$make'
17285make_set_make='$make_set_make'
b4eb6b3d
JH
17286mallocobj='$mallocobj'
17287mallocsrc='$mallocsrc'
17288malloctype='$malloctype'
17289man1dir='$man1dir'
17290man1direxp='$man1direxp'
17291man1ext='$man1ext'
17292man3dir='$man3dir'
17293man3direxp='$man3direxp'
17294man3ext='$man3ext'
5f80c64f
JH
17295mips_type='$mips_type'
17296mkdir='$mkdir'
b4eb6b3d
JH
17297mmaptype='$mmaptype'
17298modetype='$modetype'
5f80c64f 17299more='$more'
b4eb6b3d 17300multiarch='$multiarch'
5f80c64f 17301mv='$mv'
b4eb6b3d
JH
17302myarchname='$myarchname'
17303mydomain='$mydomain'
17304myhostname='$myhostname'
5f80c64f
JH
17305myuname='$myuname'
17306n='$n'
2cc61e15 17307need_va_copy='$need_va_copy'
b4eb6b3d
JH
17308netdb_hlen_type='$netdb_hlen_type'
17309netdb_host_type='$netdb_host_type'
17310netdb_name_type='$netdb_name_type'
17311netdb_net_type='$netdb_net_type'
5f80c64f
JH
17312nm='$nm'
17313nm_opt='$nm_opt'
17314nm_so_opt='$nm_so_opt'
b4eb6b3d 17315nonxs_ext='$nonxs_ext'
5f80c64f 17316nroff='$nroff'
b4eb6b3d
JH
17317nvEUformat='$nvEUformat'
17318nvFUformat='$nvFUformat'
17319nvGUformat='$nvGUformat'
17320nveformat='$nveformat'
17321nvfformat='$nvfformat'
17322nvgformat='$nvgformat'
17323nvsize='$nvsize'
17324nvtype='$nvtype'
17325o_nonblock='$o_nonblock'
5f80c64f 17326obj_ext='$obj_ext'
b4eb6b3d 17327old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 17328optimize='$optimize'
b4eb6b3d 17329orderlib='$orderlib'
5f80c64f
JH
17330osname='$osname'
17331osvers='$osvers'
b4eb6b3d 17332otherlibdirs='$otherlibdirs'
5f80c64f 17333package='$package'
b4eb6b3d
JH
17334pager='$pager'
17335passcat='$passcat'
17336patchlevel='$patchlevel'
5f80c64f 17337path_sep='$path_sep'
b4eb6b3d 17338perl5='$perl5'
5f80c64f 17339perl='$perl'
151e6568 17340perl_patchlevel='$perl_patchlevel'
b4eb6b3d 17341perladmin='$perladmin'
9c839522 17342perllibs='$perllibs'
b4eb6b3d 17343perlpath='$perlpath'
5f80c64f 17344pg='$pg'
b4eb6b3d
JH
17345phostname='$phostname'
17346pidtype='$pidtype'
5f80c64f 17347plibpth='$plibpth'
b4eb6b3d 17348pm_apiversion='$pm_apiversion'
5f80c64f
JH
17349pmake='$pmake'
17350pr='$pr'
b4eb6b3d
JH
17351prefix='$prefix'
17352prefixexp='$prefixexp'
17353privlib='$privlib'
17354privlibexp='$privlibexp'
17355prototype='$prototype'
17356ptrsize='$ptrsize'
17357quadkind='$quadkind'
17358quadtype='$quadtype'
17359randbits='$randbits'
17360randfunc='$randfunc'
17361randseedtype='$randseedtype'
17362ranlib='$ranlib'
17363rd_nodata='$rd_nodata'
17364revision='$revision'
5f80c64f
JH
17365rm='$rm'
17366rmail='$rmail'
5440bc8e 17367run='$run'
5f80c64f 17368runnm='$runnm'
b4eb6b3d
JH
17369sPRIEUldbl='$sPRIEUldbl'
17370sPRIFUldbl='$sPRIFUldbl'
17371sPRIGUldbl='$sPRIGUldbl'
17372sPRIXU64='$sPRIXU64'
17373sPRId64='$sPRId64'
17374sPRIeldbl='$sPRIeldbl'
17375sPRIfldbl='$sPRIfldbl'
17376sPRIgldbl='$sPRIgldbl'
17377sPRIi64='$sPRIi64'
17378sPRIo64='$sPRIo64'
17379sPRIu64='$sPRIu64'
17380sPRIx64='$sPRIx64'
17381sSCNfldbl='$sSCNfldbl'
17382sched_yield='$sched_yield'
17383scriptdir='$scriptdir'
17384scriptdirexp='$scriptdirexp'
5f80c64f 17385sed='$sed'
b4eb6b3d
JH
17386seedfunc='$seedfunc'
17387selectminbits='$selectminbits'
17388selecttype='$selecttype'
5f80c64f
JH
17389sendmail='$sendmail'
17390sh='$sh'
17391shar='$shar'
17392sharpbang='$sharpbang'
b4eb6b3d
JH
17393shmattype='$shmattype'
17394shortsize='$shortsize'
17395shrpenv='$shrpenv'
5f80c64f 17396shsharp='$shsharp'
b4eb6b3d
JH
17397sig_count='$sig_count'
17398sig_name='$sig_name'
17399sig_name_init='$sig_name_init'
17400sig_num='$sig_num'
17401sig_num_init='$sig_num_init'
76d3c696 17402sig_size='$sig_size'
b4eb6b3d
JH
17403signal_t='$signal_t'
17404sitearch='$sitearch'
17405sitearchexp='$sitearchexp'
17406sitebin='$sitebin'
17407sitebinexp='$sitebinexp'
17408sitelib='$sitelib'
17409sitelib_stem='$sitelib_stem'
17410sitelibexp='$sitelibexp'
17411siteprefix='$siteprefix'
17412siteprefixexp='$siteprefixexp'
17413sizesize='$sizesize'
17414sizetype='$sizetype'
5f80c64f
JH
17415sleep='$sleep'
17416smail='$smail'
5f80c64f 17417so='$so'
b4eb6b3d
JH
17418sockethdr='$sockethdr'
17419socketlib='$socketlib'
17420socksizetype='$socksizetype'
5f80c64f
JH
17421sort='$sort'
17422spackage='$spackage'
17423spitshell='$spitshell'
5f80c64f 17424src='$src'
b4eb6b3d
JH
17425ssizetype='$ssizetype'
17426startperl='$startperl'
5f80c64f 17427startsh='$startsh'
b4eb6b3d
JH
17428static_ext='$static_ext'
17429stdchar='$stdchar'
17430stdio_base='$stdio_base'
17431stdio_bufsiz='$stdio_bufsiz'
17432stdio_cnt='$stdio_cnt'
17433stdio_filbuf='$stdio_filbuf'
17434stdio_ptr='$stdio_ptr'
17435stdio_stream_array='$stdio_stream_array'
17436strings='$strings'
5f80c64f 17437submit='$submit'
b4eb6b3d
JH
17438subversion='$subversion'
17439sysman='$sysman'
5f80c64f
JH
17440tail='$tail'
17441tar='$tar'
5440bc8e 17442targetarch='$targetarch'
5f80c64f
JH
17443tbl='$tbl'
17444tee='$tee'
17445test='$test'
b4eb6b3d
JH
17446timeincl='$timeincl'
17447timetype='$timetype'
5440bc8e 17448to='$to'
5f80c64f
JH
17449touch='$touch'
17450tr='$tr'
17451trnl='$trnl'
17452troff='$troff'
b4eb6b3d
JH
17453u16size='$u16size'
17454u16type='$u16type'
17455u32size='$u32size'
17456u32type='$u32type'
17457u64size='$u64size'
17458u64type='$u64type'
17459u8size='$u8size'
17460u8type='$u8type'
17461uidformat='$uidformat'
17462uidsign='$uidsign'
17463uidsize='$uidsize'
17464uidtype='$uidtype'
5f80c64f
JH
17465uname='$uname'
17466uniq='$uniq'
b4eb6b3d
JH
17467uquadtype='$uquadtype'
17468use5005threads='$use5005threads'
17469use64bitall='$use64bitall'
17470use64bitint='$use64bitint'
5440bc8e 17471usecrosscompile='$usecrosscompile'
5f80c64f 17472usedl='$usedl'
b4eb6b3d
JH
17473useithreads='$useithreads'
17474uselargefiles='$uselargefiles'
17475uselongdouble='$uselongdouble'
17476usemorebits='$usemorebits'
17477usemultiplicity='$usemultiplicity'
17478usemymalloc='$usemymalloc'
5f80c64f 17479usenm='$usenm'
b4eb6b3d
JH
17480useopcode='$useopcode'
17481useperlio='$useperlio'
17482useposix='$useposix'
9514c62b 17483usereentrant='$usereentrant'
b4eb6b3d
JH
17484usesfio='$usesfio'
17485useshrplib='$useshrplib'
29209bc5 17486usesocks='$usesocks'
b4eb6b3d
JH
17487usethreads='$usethreads'
17488usevendorprefix='$usevendorprefix'
17489usevfork='$usevfork'
5f80c64f
JH
17490usrinc='$usrinc'
17491uuname='$uuname'
b4eb6b3d
JH
17492uvXUformat='$uvXUformat'
17493uvoformat='$uvoformat'
17494uvsize='$uvsize'
17495uvtype='$uvtype'
17496uvuformat='$uvuformat'
17497uvxformat='$uvxformat'
17498vendorarch='$vendorarch'
17499vendorarchexp='$vendorarchexp'
17500vendorbin='$vendorbin'
17501vendorbinexp='$vendorbinexp'
17502vendorlib='$vendorlib'
17503vendorlib_stem='$vendorlib_stem'
17504vendorlibexp='$vendorlibexp'
17505vendorprefix='$vendorprefix'
17506vendorprefixexp='$vendorprefixexp'
17507version='$version'
861eb78d 17508version_patchlevel_string='$version_patchlevel_string'
d56c5707 17509versiononly='$versiononly'
5f80c64f 17510vi='$vi'
b4eb6b3d 17511voidflags='$voidflags'
5f80c64f 17512xlibpth='$xlibpth'
b4eb6b3d 17513xs_apiversion='$xs_apiversion'
3659ebf1
JH
17514yacc='$yacc'
17515yaccflags='$yaccflags'
5f80c64f
JH
17516zcat='$zcat'
17517zip='$zip'
17518EOT
17519
17520: Add in command line options if available
17521$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
17522
17523: add special variables
17524$test -f $src/patchlevel.h && \
d00b958f 17525awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 17526echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 17527echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
17528
17529: propagate old symbols
17530if $test -f UU/config.sh; then
381aa1ff 17531 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 17532 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 17533 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
17534 set X `cat UU/oldsyms`
17535 shift
17536 case $# in
17537 0) ;;
17538 *)
17539 cat <<EOM
17540Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
17541EOM
17542 echo "# Variables propagated from previous config.sh file." >>config.sh
17543 for sym in `cat UU/oldsyms`; do
17544 echo " Propagating $hint variable "'$'"$sym..."
17545 eval 'tmp="$'"${sym}"'"'
17546 echo "$tmp" | \
17547 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
17548 done
17549 ;;
17550 esac
17551fi
17552
17553: Finish up by extracting the .SH files
17554case "$alldone" in
17555exit)
17556 $rm -rf UU
24ccb310 17557 echo "Extraction done."
5f80c64f
JH
17558 exit 0
17559 ;;
17560cont)
17561 ;;
17562'')
17563 dflt=''
17564 nostick=true
17565 $cat <<EOM
17566
17567If you'd like to make any changes to the config.sh file before I begin
17568to configure things, do it as a shell escape now (e.g. !vi config.sh).
17569
17570EOM
17571 rp="Press return or use a shell escape to edit config.sh:"
17572 . UU/myread
17573 nostick=''
17574 case "$ans" in
17575 '') ;;
17576 *) : in case they cannot read
17577 sh 1>&4 -c "$ans";;
17578 esac
17579 ;;
17580esac
17581
17582: if this fails, just run all the .SH files by hand
17583. ./config.sh
17584
17585echo " "
17586exec 1>&4
a43e8593 17587pwd=`pwd`
5f80c64f 17588. ./UU/extract
a43e8593 17589cd $pwd
5f80c64f
JH
17590
17591if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
17592 dflt=y
17593 case "$silent" in
17594 true) ;;
17595 *)
17596 $cat <<EOM
17597
17598Now you need to generate make dependencies by running "$make depend".
17599You might prefer to run it in background: "$make depend > makedepend.out &"
17600It can take a while, so you might not want to run it right now.
17601
17602EOM
17603 ;;
17604 esac
17605 rp="Run $make depend now?"
17606 . UU/myread
17607 case "$ans" in
17608 y*)
3d5d58b1 17609 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
17610 ;;
17611 *)
17612 echo "You must run '$make depend' then '$make'."
17613 ;;
17614 esac
17615elif test -f [Mm]akefile; then
17616 echo " "
17617 echo "Now you must run a $make."
17618else
24ccb310 17619 echo "Configure done."
5f80c64f
JH
17620fi
17621
17622if $test -f Policy.sh; then
17623 $cat <<EOM
17624
17625If you compile $package on a different machine or from a different object
17626directory, copy the Policy.sh file from this object directory to the
17627new one before you run Configure -- this will help you with most of
17628the policy defaults.
17629
17630EOM
17631fi
17632if $test -f config.msg; then
17633 echo "Hmm. I also noted the following information while running:"
17634 echo " "
17635 $cat config.msg >&4
17636 $rm -f config.msg
17637fi
17638$rm -f kit*isdone ark*isdone
17639$rm -rf UU
17640
17641: End of Configure
17642