This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate Memoize 0.64. Few tweaks were required in
[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#
a43e8593 23# Generated on Sat Jun 16 19:06:04 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=''
ecfc5424 181d_bsd=''
40a7a20a 182d_eunice=''
2304df62
AD
183d_xenix=''
184eunicefix=''
185Mcc=''
dfe9444c 186ar=''
2304df62
AD
187awk=''
188bash=''
189bison=''
190byacc=''
191cat=''
192chgrp=''
193chmod=''
194chown=''
ecfc5424 195comm=''
2304df62
AD
196compress=''
197cp=''
198cpio=''
199cpp=''
200csh=''
201date=''
202echo=''
203egrep=''
204emacs=''
205expr=''
206find=''
207flex=''
2304df62 208grep=''
8ff267be 209gzip=''
2304df62
AD
210inews=''
211ksh=''
212less=''
213line=''
214lint=''
215ln=''
216lp=''
217lpr=''
218ls=''
219mail=''
220mailx=''
dfe9444c 221make=''
2304df62
AD
222mkdir=''
223more=''
224mv=''
693762b4 225nm=''
2304df62
AD
226nroff=''
227perl=''
228pg=''
229pmake=''
230pr=''
231rm=''
232rmail=''
233sed=''
234sendmail=''
2304df62
AD
235shar=''
236sleep=''
237smail=''
238sort=''
239submit=''
240tail=''
241tar=''
242tbl=''
693762b4 243tee=''
2304df62
AD
244test=''
245touch=''
246tr=''
247troff=''
248uname=''
249uniq=''
250uuname=''
251vi=''
252zcat=''
8ff267be 253zip=''
b4eb6b3d
JH
254full_ar=''
255full_sed=''
a0d0e21e 256libswanted=''
2304df62
AD
257hint=''
258myuname=''
85e6fe83
LW
259osname=''
260osvers=''
2304df62
AD
261Author=''
262Date=''
263Header=''
264Id=''
265Locker=''
266Log=''
267RCSfile=''
268Revision=''
269Source=''
270State=''
dfe9444c
AD
271_a=''
272_exe=''
273_o=''
4633a7c4
LW
274archobjs=''
275exe_ext=''
276firstmakefile=''
277lib_ext=''
278obj_ext=''
279path_sep=''
b4eb6b3d 280afs=''
a6d26a0d 281afsroot=''
b4eb6b3d
JH
282alignbytes=''
283ansi2knr=''
284archlib=''
285archlibexp=''
286d_archlib=''
287installarchlib=''
288archname=''
289myarchname=''
290d_atolf=''
291d_atoll=''
292baserev=''
293bin=''
294binexp=''
295installbin=''
296bincompat5005=''
297d_bincompat5005=''
298byteorder=''
2304df62 299cc=''
2304df62
AD
300ccflags=''
301cppflags=''
302ldflags=''
303lkflags=''
8e07c86e 304locincpth=''
2304df62 305optimize=''
b4eb6b3d 306cf_email=''
2304df62
AD
307cf_by=''
308cf_time=''
b4eb6b3d 309charsize=''
2304df62 310contains=''
b4eb6b3d 311cpp_stuff=''
2304df62
AD
312cpplast=''
313cppminus=''
314cpprun=''
315cppstdin=''
74cac757 316d__fwalk=''
b4eb6b3d
JH
317d_access=''
318d_accessx=''
319d_alarm=''
320d_attribut=''
321d_bcmp=''
322d_bcopy=''
323d_bzero=''
324d_casti32=''
325castflags=''
326d_castneg=''
327d_chown=''
328d_chroot=''
329d_chsize=''
330d_closedir=''
331d_void_closedir=''
4e0554ec 332d_cmsghdr_s=''
b4eb6b3d
JH
333d_const=''
334cryptlib=''
335d_crypt=''
336d_csh=''
337full_csh=''
338d_cuserid=''
339d_dbl_dig=''
2ef53570 340d_dbminitproto=''
b4eb6b3d
JH
341d_difftime=''
342d_dlerror=''
a0d0e21e 343d_dlopen=''
b4eb6b3d
JH
344d_dlsymun=''
345d_dosuid=''
346d_suidsafe=''
347d_drand48proto=''
348d_dup2=''
349d_eaccess=''
350d_endgrent=''
351d_endhent=''
352d_endnent=''
353d_endpent=''
354d_endpwent=''
355d_endsent=''
356d_fchmod=''
357d_fchown=''
358d_fcntl=''
9d9004a9 359d_fcntl_can_lock=''
b4eb6b3d
JH
360d_fd_macros=''
361d_fd_set=''
362d_fds_bits=''
363d_fgetpos=''
364d_flexfnam=''
365d_flock=''
2ef53570 366d_flockproto=''
b4eb6b3d
JH
367d_fork=''
368d_fpos64_t=''
369d_frexpl=''
370d_fs_data_s=''
371d_fseeko=''
372d_fsetpos=''
373d_fstatfs=''
411ab01c 374d_fsync=''
b4eb6b3d
JH
375d_ftello=''
376d_ftime=''
377d_gettimeod=''
378d_Gconvert=''
379d_getcwd=''
380d_getespwnam=''
381d_getfsstat=''
382d_getgrent=''
383d_getgrps=''
384d_gethbyaddr=''
385d_gethbyname=''
386d_gethent=''
387aphostname=''
388d_gethname=''
389d_phostname=''
390d_uname=''
391d_gethostprotos=''
4e0554ec 392d_getitimer=''
b4eb6b3d
JH
393d_getlogin=''
394d_getmnt=''
395d_getmntent=''
396d_getnbyaddr=''
397d_getnbyname=''
398d_getnent=''
399d_getnetprotos=''
0c0643d0 400d_getpagsz=''
b4eb6b3d
JH
401d_getpent=''
402d_getpgid=''
403d_getpgrp2=''
404d_bsdgetpgrp=''
405d_getpgrp=''
406d_getppid=''
407d_getprior=''
408d_getpbyname=''
409d_getpbynumber=''
410d_getprotoprotos=''
411d_getprpwnam=''
412d_getpwent=''
413d_getsent=''
414d_getservprotos=''
415d_getspnam=''
416d_getsbyname=''
417d_getsbyport=''
a4f3eea9 418d_gnulibc=''
b4eb6b3d
JH
419d_hasmntopt=''
420d_htonl=''
421d_iconv=''
422d_inetaton=''
423d_int64_t=''
424d_isascii=''
425d_isnan=''
426d_isnanl=''
427d_killpg=''
428d_lchown=''
429d_ldbl_dig=''
430d_link=''
431d_locconv=''
432d_lockf=''
433d_longdbl=''
434longdblsize=''
435d_longlong=''
436longlongsize=''
437d_lseekproto=''
438d_lstat=''
439d_madvise=''
440d_mblen=''
441d_mbstowcs=''
442d_mbtowc=''
443d_memchr=''
444d_memcmp=''
445d_memcpy=''
446d_memmove=''
447d_memset=''
448d_mkdir=''
449d_mkdtemp=''
450d_mkfifo=''
451d_mkstemp=''
452d_mkstemps=''
453d_mktime=''
454d_mmap=''
455mmaptype=''
456d_modfl=''
e67aeab1 457d_modfl_pow32_bug=''
b4eb6b3d
JH
458d_mprotect=''
459d_msg=''
460d_msgctl=''
461d_msgget=''
4e0554ec 462d_msghdr_s=''
b4eb6b3d
JH
463d_msgrcv=''
464d_msgsnd=''
465d_msync=''
466d_munmap=''
467d_nice=''
468d_off64_t=''
469d_open3=''
470d_fpathconf=''
471d_pathconf=''
472d_pause=''
473d_pipe=''
474d_poll=''
2304df62 475d_portable=''
b4eb6b3d
JH
476d_old_pthread_create_joinable=''
477old_pthread_create_joinable=''
478d_pthread_yield=''
479d_sched_yield=''
480sched_yield=''
481d_qgcvt=''
482d_readdir=''
483d_rewinddir=''
484d_seekdir=''
485d_telldir=''
486d_readlink=''
4e0554ec 487d_readv=''
640374d0 488d_realpath=''
4e0554ec 489d_recvmsg=''
b4eb6b3d
JH
490d_rename=''
491d_rmdir=''
492d_safebcpy=''
493d_safemcpy=''
494d_sanemcmp=''
ef9f17be 495d_sbrkproto=''
b4eb6b3d
JH
496d_select=''
497d_sem=''
498d_semctl=''
499d_semget=''
500d_semop=''
4e0554ec 501d_sendmsg=''
b4eb6b3d
JH
502d_setegid=''
503d_seteuid=''
504d_setgrent=''
505d_setgrps=''
506d_sethent=''
4e0554ec 507d_setitimer=''
b4eb6b3d
JH
508d_setlinebuf=''
509d_setlocale=''
510d_setnent=''
511d_setpent=''
512d_setpgid=''
513d_setpgrp2=''
514d_bsdsetpgrp=''
515d_setpgrp=''
516d_setprior=''
517d_setproctitle=''
518d_setpwent=''
519d_setregid=''
520d_setresgid=''
521d_setresuid=''
522d_setreuid=''
523d_setrgid=''
524d_setruid=''
525d_setsent=''
526d_setsid=''
527d_setvbuf=''
528d_sfio=''
529usesfio=''
530d_shm=''
531d_shmat=''
532d_shmatprototype=''
533shmattype=''
534d_shmctl=''
535d_shmdt=''
536d_shmget=''
537d_sigaction=''
983dbef6 538d_sigprocmask=''
b4eb6b3d 539d_sigsetjmp=''
49a78c82 540d_sockatmark=''
2ef53570 541d_sockatmarkproto=''
b4eb6b3d
JH
542d_msg_ctrunc=''
543d_msg_dontroute=''
544d_msg_oob=''
545d_msg_peek=''
546d_msg_proxy=''
547d_oldsock=''
548d_scm_rights=''
549d_socket=''
550d_sockpair=''
551sockethdr=''
552socketlib=''
553d_socklen_t=''
554d_socks5_init=''
555d_sqrtl=''
eef837ea 556d_sresgproto=''
640374d0 557d_sresuproto=''
b4eb6b3d
JH
558d_statblks=''
559d_statfs_f_flags=''
560d_statfs_s=''
561d_fstatvfs=''
562d_statvfs=''
563d_stdio_cnt_lval=''
564d_stdio_ptr_lval=''
a7ffa9b9
NC
565d_stdio_ptr_lval_nochange_cnt=''
566d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
567d_stdiobase=''
568d_stdstdio=''
569stdio_base=''
570stdio_bufsiz=''
571stdio_cnt=''
572stdio_filbuf=''
573stdio_ptr=''
574d_index=''
575d_strchr=''
576d_strcoll=''
577d_strctcpy=''
578d_strerrm=''
579d_strerror=''
580d_sysernlst=''
581d_syserrlst=''
b3c85772 582d_strftime=''
b4eb6b3d
JH
583d_strtod=''
584d_strtol=''
585d_strtold=''
586d_strtoll=''
28e5dec8 587d_strtoq=''
b4eb6b3d
JH
588d_strtoul=''
589d_strtoull=''
590d_strtouq=''
591d_strxfrm=''
592d_symlink=''
593d_syscall=''
2ef53570 594d_syscallproto=''
b4eb6b3d
JH
595d_sysconf=''
596d_system=''
597d_tcgetpgrp=''
598d_tcsetpgrp=''
599d_telldirproto=''
600d_time=''
601timetype=''
602clocktype=''
603d_times=''
604d_truncate=''
605d_tzname=''
4e0554ec
JH
606d_u32align=''
607d_ualarm=''
b4eb6b3d
JH
608d_umask=''
609d_semctl_semid_ds=''
610d_semctl_semun=''
611d_union_semun=''
4e0554ec 612d_usleep=''
2ef53570 613d_usleepproto=''
b4eb6b3d
JH
614d_ustat=''
615d_vfork=''
616usevfork=''
617d_voidsig=''
618signal_t=''
619d_volatile=''
620d_charvspr=''
621d_vprintf=''
622d_wait4=''
623d_waitpid=''
624d_wcstombs=''
625d_wctomb=''
4e0554ec 626d_writev=''
b4eb6b3d 627dlext=''
85e6fe83
LW
628cccdlflags=''
629ccdlflags=''
2304df62 630dlsrc=''
232e078e 631ld=''
85e6fe83 632lddlflags=''
2304df62 633usedl=''
b4eb6b3d
JH
634doublesize=''
635ebcdic=''
636fflushNULL=''
637fflushall=''
638fpossize=''
639fpostype=''
5b463ca7 640gccosandvers=''
8a27cf78 641gccversion=''
b4eb6b3d
JH
642gidformat=''
643gidsign=''
644gidsize=''
645gidtype=''
646groupstype=''
647h_fcntl=''
648h_sysfile=''
649i_arpainet=''
650db_hashtype=''
651db_prefixtype=''
640374d0
JH
652db_version_major=''
653db_version_minor=''
654db_version_patch=''
b4eb6b3d
JH
655i_db=''
656i_dbm=''
657i_rpcsvcdbm=''
658d_dirnamlen=''
659direntrytype=''
660i_dirent=''
a0d0e21e 661i_dld=''
b4eb6b3d
JH
662i_dlfcn=''
663i_fcntl=''
664i_float=''
665i_gdbm=''
666d_grpasswd=''
667i_grp=''
668i_iconv=''
669i_ieeefp=''
670i_inttypes=''
671i_libutil=''
672i_limits=''
673i_locale=''
674i_machcthr=''
675i_malloc=''
676i_math=''
677i_memory=''
678i_mntent=''
679i_ndbm=''
680i_netdb=''
681i_neterrno=''
682i_netinettcp=''
683i_niin=''
684i_sysin=''
685i_poll=''
686i_prot=''
687i_pthread=''
688d_pwage=''
689d_pwchange=''
690d_pwclass=''
691d_pwcomment=''
692d_pwexpire=''
693d_pwgecos=''
694d_pwpasswd=''
695d_pwquota=''
696i_pwd=''
697i_sfio=''
698i_shadow=''
699i_socks=''
700i_stddef=''
701i_stdlib=''
702i_string=''
703strings=''
704i_sunmath=''
705i_sysaccess=''
706i_sysdir=''
707i_sysfile=''
708d_voidtty=''
709i_bsdioctl=''
710i_sysfilio=''
711i_sysioctl=''
712i_syssockio=''
713i_syslog=''
714i_sysmman=''
715i_sysmode=''
716i_sysmount=''
717i_sysndir=''
718i_sysparam=''
719i_sysresrc=''
720i_syssecrt=''
721i_sysselct=''
722i_sysstat=''
723i_sysstatfs=''
724i_sysstatvfs=''
725i_systimes=''
726i_systypes=''
727i_sysuio=''
728i_sysun=''
729i_sysutsname=''
730i_sysvfs=''
731i_syswait=''
732i_sgtty=''
733i_termio=''
734i_termios=''
735i_systime=''
736i_systimek=''
737i_time=''
738timeincl=''
739i_unistd=''
740i_ustat=''
741i_utime=''
742i_values=''
743i_stdarg=''
744i_varargs=''
745i_varhdr=''
746i_vfork=''
747inc_version_list=''
748inc_version_list_init=''
749installprefix=''
750installprefixexp=''
751installstyle=''
752installusrbinperl=''
753intsize=''
754longsize=''
755shortsize=''
4b661809 756issymlink=''
2304df62 757libc=''
b4eb6b3d
JH
758ldlibpthname=''
759libperl=''
760shrpenv=''
761useshrplib=''
a0d0e21e 762glibpth=''
2304df62 763libpth=''
8e07c86e 764loclibpth=''
2304df62
AD
765plibpth=''
766xlibpth=''
1cfa4ec7 767ignore_versioned_solibs=''
2304df62 768libs=''
43999f95
JH
769libsdirs=''
770libsfiles=''
771libsfound=''
13b3f787 772libspath=''
85e6fe83 773lns=''
b4eb6b3d
JH
774d_PRIEUldbl=''
775d_PRIFUldbl=''
776d_PRIGUldbl=''
777d_PRIeldbl=''
778d_PRIfldbl=''
779d_PRIgldbl=''
780d_SCNfldbl=''
781sPRIEUldbl=''
782sPRIFUldbl=''
783sPRIGUldbl=''
784sPRIeldbl=''
785sPRIfldbl=''
786sPRIgldbl=''
787sSCNfldbl=''
788lseeksize=''
789lseektype=''
8ff267be 790make_set_make=''
b4eb6b3d
JH
791d_mymalloc=''
792freetype=''
793mallocobj=''
794mallocsrc=''
795malloctype=''
796usemymalloc=''
797installman1dir=''
798man1dir=''
799man1direxp=''
800man1ext=''
801installman3dir=''
802man3dir=''
803man3direxp=''
804man3ext=''
805modetype=''
806multiarch=''
807mydomain=''
808myhostname=''
809phostname=''
2304df62
AD
810c=''
811n=''
b4eb6b3d
JH
812d_eofnblk=''
813eagain=''
814o_nonblock=''
815rd_nodata=''
2cc61e15 816need_va_copy=''
b4eb6b3d
JH
817netdb_hlen_type=''
818netdb_host_type=''
819netdb_name_type=''
820netdb_net_type=''
821groupcat=''
822hostcat=''
823passcat=''
824orderlib=''
825ranlib=''
826d_perl_otherlibdirs=''
827otherlibdirs=''
2304df62
AD
828package=''
829spackage=''
b4eb6b3d
JH
830pager=''
831api_revision=''
832api_subversion=''
833api_version=''
834api_versionstring=''
835patchlevel=''
151e6568 836perl_patchlevel=''
b4eb6b3d
JH
837revision=''
838subversion=''
839version=''
840perl5=''
841perladmin=''
842perlpath=''
843d_nv_preserves_uv=''
844d_nv_preserves_uv_bits=''
845i16size=''
846i16type=''
847i32size=''
848i32type=''
849i64size=''
850i64type=''
851i8size=''
852i8type=''
853ivsize=''
854ivtype=''
855nvsize=''
856nvtype=''
857u16size=''
858u16type=''
859u32size=''
860u32type=''
861u64size=''
862u64type=''
863u8size=''
864u8type=''
865uvsize=''
866uvtype=''
867ivdformat=''
868nvEUformat=''
869nvFUformat=''
870nvGUformat=''
871nveformat=''
872nvfformat=''
873nvgformat=''
874uvXUformat=''
875uvoformat=''
876uvuformat=''
877uvxformat=''
878pidtype=''
879prefix=''
880prefixexp=''
881installprivlib=''
882privlib=''
883privlibexp=''
884prototype=''
885ptrsize=''
886d_PRIXU64=''
887d_PRId64=''
888d_PRIi64=''
889d_PRIo64=''
890d_PRIu64=''
891d_PRIx64=''
892sPRIXU64=''
893sPRId64=''
894sPRIi64=''
895sPRIo64=''
896sPRIu64=''
897sPRIx64=''
898d_quad=''
899quadkind=''
900quadtype=''
901uquadtype=''
902drand01=''
903randbits=''
904randfunc=''
905randseedtype=''
906seedfunc=''
907installscript=''
908scriptdir=''
909scriptdirexp=''
910selectminbits=''
911selecttype=''
8ff267be 912sh=''
b4eb6b3d
JH
913sig_count=''
914sig_name=''
915sig_name_init=''
916sig_num=''
917sig_num_init=''
76d3c696 918sig_size=''
b4eb6b3d
JH
919installsitearch=''
920sitearch=''
921sitearchexp=''
922installsitebin=''
923sitebin=''
924sitebinexp=''
925installsitelib=''
926sitelib=''
927sitelib_stem=''
928sitelibexp=''
929siteprefix=''
930siteprefixexp=''
931sizesize=''
932sizetype=''
a0d0e21e 933so=''
b4eb6b3d 934socksizetype=''
2304df62
AD
935sharpbang=''
936shsharp=''
937spitshell=''
dfe9444c 938src=''
b4eb6b3d
JH
939ssizetype=''
940startperl=''
2304df62 941startsh=''
b4eb6b3d
JH
942stdchar=''
943d_stdio_stream_array=''
944stdio_stream_array=''
945sysman=''
5ff3f7a4 946trnl=''
b4eb6b3d
JH
947uidformat=''
948uidsign=''
949uidsize=''
950uidtype=''
951archname64=''
952use64bitall=''
953use64bitint=''
954ccflags_uselargefiles=''
955ldflags_uselargefiles=''
956libswanted_uselargefiles=''
957uselargefiles=''
958uselongdouble=''
959usemorebits=''
960usemultiplicity=''
2304df62 961nm_opt=''
40a7a20a 962nm_so_opt=''
2304df62
AD
963runnm=''
964usenm=''
b4eb6b3d 965useperlio=''
29209bc5 966usesocks=''
b4eb6b3d
JH
967d_oldpthreads=''
968use5005threads=''
969useithreads=''
9514c62b 970usereentrant=''
b4eb6b3d 971usethreads=''
2304df62 972incpath=''
2304df62
AD
973mips_type=''
974usrinc=''
b4eb6b3d
JH
975d_vendorarch=''
976installvendorarch=''
977vendorarch=''
978vendorarchexp=''
979d_vendorbin=''
980installvendorbin=''
981vendorbin=''
982vendorbinexp=''
983d_vendorlib=''
984installvendorlib=''
985vendorlib=''
986vendorlib_stem=''
987vendorlibexp=''
988usevendorprefix=''
989vendorprefix=''
990vendorprefixexp=''
d56c5707 991versiononly=''
b4eb6b3d
JH
992defvoidused=''
993voidflags=''
994pm_apiversion=''
995xs_apiversion=''
3659ebf1
JH
996yacc=''
997yaccflags=''
2304df62
AD
998CONFIG=''
999
ecfc5424
AD
1000define='define'
1001undef='undef'
1002smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1003rmlist=''
1004
1005: We must find out about Eunice early
1006eunicefix=':'
1007if test -f /etc/unixtovms; then
1008 eunicefix=/etc/unixtovms
1009fi
1010if test -f /etc/unixtovms.exe; then
1011 eunicefix=/etc/unixtovms.exe
1012fi
1013
b4eb6b3d 1014i_whoami=''
6b356c8e
JH
1015ccname=''
1016ccversion=''
9c839522 1017perllibs=''
b4eb6b3d
JH
1018: set useposix=false in your hint file to disable the POSIX extension.
1019useposix=true
1020: set useopcode=false in your hint file to disable the Opcode extension.
1021useopcode=true
dfe9444c 1022: Trailing extension. Override this in a hint file, if needed.
4e2a5f63 1023_exe=''
dfe9444c
AD
1024: Extra object files, if any, needed on this platform.
1025archobjs=''
b4eb6b3d 1026archname=''
ff935051
JH
1027: Possible local include directories to search.
1028: Set locincpth to "" in a hint file to defeat local include searches.
1029locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1030locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1031:
1032: no include file wanted by default
1033inclwanted=''
1034
b4eb6b3d 1035groupstype=''
64615a5e 1036libnames=''
732c9516
JH
1037: change the next line if compiling for Xenix/286 on Xenix/386
1038xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1039: Possible local library directories to search.
1040loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1041loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1042
1043: general looking path for locating libraries
5869b1f1 1044glibpth="/lib /usr/lib $xlibpth"
732c9516 1045glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1046test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1047test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1048
1049: Private path used by Configure to find libraries. Its value
1050: is prepended to libpth. This variable takes care of special
1051: machines, like the mips. Usually, it should be empty.
1052plibpth=''
1053
1cfa4ec7
GS
1054: default library list
1055libswanted=''
921b2963 1056: some systems want to use only the non-versioned libso:s
1cfa4ec7 1057ignore_versioned_solibs=''
b4eb6b3d
JH
1058archname64=''
1059ccflags_uselargefiles=''
1060ldflags_uselargefiles=''
1061libswanted_uselargefiles=''
1062: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1063: set usesocks on the Configure command line to enable socks.
b4eb6b3d 1064: set usethreads on the Configure command line to enable threads.
cd040c5e 1065usereentrant='undef'
b4eb6b3d
JH
1066: full support for void wanted by default
1067defvoidused=15
1068
ecfc5424 1069: List of libraries we want.
693762b4 1070: If anyone needs -lnet, put it in a hint file.
997d70a2 1071libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
69e84d1d 1072libswanted="$libswanted dld ld sun m c cposix posix"
f1066039 1073libswanted="$libswanted ndir dir crypt sec"
0c9177ab 1074libswanted="$libswanted ucb bsd BSD PW x iconv util"
1aef975c 1075: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1076: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1077glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1078glibpth="/usr/shlib $glibpth"
1079: Do not use vfork unless overridden by a hint file.
1080usevfork=false
1081
8ff267be 1082: Find the basic shell for Bourne shell scripts
1083case "$sh" in
1084'')
8ff267be 1085 case "$SYSTYPE" in
1086 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1087 *) xxx='/bin/sh';;
1088 esac
1089 if test -f "$xxx"; then
1090 sh="$xxx"
1091 else
1092 : Build up a list and do a single loop so we can 'break' out.
1093 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1094 for xxx in sh bash ksh pdksh ash; do
1095 for p in $pth; do
1096 try="$try ${p}/${xxx}"
1097 done
1098 done
1099 for xxx in $try; do
1100 if test -f "$xxx"; then
1101 sh="$xxx";
8ff267be 1102 break
1103 elif test -f "$xxx.exe"; then
1104 sh="$xxx";
8ff267be 1105 break
1106 fi
1107 done
1108 fi
1109 ;;
1110esac
1111
1112case "$sh" in
1113'') cat <<EOM >&2
1114$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1115
8ff267be 1116Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1117Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1118we'll try to straighten this all out.
8ff267be 1119EOM
1120 exit 1
1121 ;;
1122esac
1123
760ac839 1124: see if sh knows # comments
73614538 1125if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1126 shsharp=true
1127 spitshell=cat
760ac839
LW
1128 xcat=/bin/cat
1129 test -f $xcat || xcat=/usr/bin/cat
5440bc8e
JH
1130 echo "#!$xcat" >sharp
1131 $eunicefix sharp
1132 chmod +x sharp
1133 ./sharp > today
760ac839 1134 if test -s today; then
760ac839
LW
1135 sharpbang='#!'
1136 else
5440bc8e
JH
1137 echo "#! $xcat" > sharp
1138 $eunicefix sharp
1139 chmod +x sharp
1140 ./sharp > today
760ac839 1141 if test -s today; then
760ac839
LW
1142 sharpbang='#! '
1143 else
760ac839
LW
1144 sharpbang=': use '
1145 fi
1146 fi
1147else
dfe9444c 1148 echo " "
8ff267be 1149 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1150 shsharp=false
1151 cd ..
1152 echo "exec grep -v '^[ ]*#'" >spitshell
1153 chmod +x spitshell
1154 $eunicefix spitshell
1155 spitshell=`pwd`/spitshell
1156 cd UU
1157 echo "I presume that if # doesn't work, #! won't work either!"
1158 sharpbang=': use '
1159fi
5440bc8e 1160rm -f sharp today
760ac839
LW
1161
1162: figure out how to guarantee sh startup
8ff267be 1163case "$startsh" in
1164'') startsh=${sharpbang}${sh} ;;
1165*)
760ac839 1166esac
5440bc8e 1167cat >sharp <<EOSS
760ac839
LW
1168$startsh
1169set abc
1170test "$?abc" != 1
1171EOSS
1172
5440bc8e
JH
1173chmod +x sharp
1174$eunicefix sharp
1175if ./sharp; then
8ff267be 1176 : echo "Yup, it does."
760ac839 1177else
dfe9444c
AD
1178 echo "Hmm... '$startsh' does not guarantee sh startup..."
1179 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1180fi
5440bc8e 1181rm -f sharp
760ac839 1182
aebf16e7
AD
1183
1184: Save command line options in file UU/cmdline.opt for later use in
1185: generating config.sh.
1186cat > cmdline.opt <<EOSH
1187# Configure command line arguments.
1188config_arg0='$0'
1189config_args='$*'
1190config_argc=$#
1191EOSH
1192argn=1
1193for arg in "$@"; do
1194 cat >>cmdline.opt <<EOSH
1195config_arg$argn='$arg'
1196EOSH
1197 argn=`expr $argn + 1`
1198done
1199
2304df62
AD
1200: produce awk script to parse command line options
1201cat >options.awk <<'EOF'
1202BEGIN {
02e93a22 1203 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1204
1205 len = length(optstr);
1206 for (i = 1; i <= len; i++) {
1207 c = substr(optstr, i, 1);
1208 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1209 if (a == ":") {
1210 arg[c] = 1;
1211 i++;
1212 }
1213 opt[c] = 1;
1214 }
1215}
1216{
1217 expect = 0;
1218 str = $0;
1219 if (substr(str, 1, 1) != "-") {
1220 printf("'%s'\n", str);
1221 next;
1222 }
1223 len = length($0);
1224 for (i = 2; i <= len; i++) {
1225 c = substr(str, i, 1);
1226 if (!opt[c]) {
1227 printf("-%s\n", substr(str, i));
1228 next;
1229 }
1230 printf("-%s\n", c);
1231 if (arg[c]) {
1232 if (i < len)
1233 printf("'%s'\n", substr(str, i + 1));
1234 else
1235 expect = 1;
1236 next;
1237 }
1238 }
1239}
1240END {
1241 if (expect)
1242 print "?";
1243}
1244EOF
1245
1246: process the command line options
4633a7c4
LW
1247set X `for arg in "$@"; do echo "X$arg"; done |
1248 sed -e s/X// | awk -f options.awk`
2304df62
AD
1249eval "set $*"
1250shift
1251rm -f options.awk
1252
1253: set up default values
1254fastread=''
1255reuseval=false
1256config_sh=''
1257alldone=''
1258error=''
1259silent=''
1260extractsh=''
ecfc5424 1261override=''
16d20bd9 1262knowitall=''
02e93a22 1263rm -f optdef.sh posthint.sh
28757baa 1264cat >optdef.sh <<EOS
1265$startsh
1266EOS
2304df62 1267
dfe9444c 1268
2304df62
AD
1269: option parsing
1270while test $# -gt 0; do
1271 case "$1" in
1272 -d) shift; fastread=yes;;
1273 -e) shift; alldone=cont;;
1274 -f)
1275 shift
1276 cd ..
1277 if test -r "$1"; then
1278 config_sh="$1"
1279 else
a0d0e21e 1280 echo "$me: cannot read config file $1." >&2
2304df62
AD
1281 error=true
1282 fi
1283 cd UU
1284 shift;;
1285 -h) shift; error=true;;
1286 -r) shift; reuseval=true;;
dfe9444c 1287 -s) shift; silent=true; realsilent=true;;
2304df62 1288 -E) shift; alldone=exit;;
16d20bd9 1289 -K) shift; knowitall=true;;
ecfc5424 1290 -O) shift; override=true;;
dfe9444c 1291 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1292 -D)
1293 shift
1294 case "$1" in
1295 *=)
1296 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1297 echo "$me: ignoring -D $1" >&2
1298 ;;
ecfc5424 1299 *=*) echo "$1" | \
1aef975c
AD
1300 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1301 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1302 esac
1303 shift
1304 ;;
1305 -U)
1306 shift
1307 case "$1" in
1aef975c 1308 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1309 *=*)
1310 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1311 echo "$me: ignoring -U $1" >&2
1312 ;;
1aef975c 1313 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1314 esac
1315 shift
1316 ;;
02e93a22
JH
1317 -A)
1318 shift
1319 xxx=''
1320 yyy="$1"
02e93a22 1321 zzz=''
5f83a3e9 1322 uuu=undef
02e93a22 1323 case "$yyy" in
5f83a3e9
JH
1324 *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1325 case "$zzz" in
1326 *:*) zzz='' ;;
1327 *) xxx=append
1328 zzz=" "`echo $yyy|sed 's!^[^=]*=!!'`
1329 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1330 esac
1331 ;;
1332 esac
1333 case "$xxx" in
1334 '') case "$yyy" in
1335 *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1336 yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1337 zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1338 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1339 *) xxx=`echo $yyy|sed 's!:.*!!'`
1340 yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1341 esac
1342 ;;
1343 esac
02e93a22
JH
1344 case "$xxx" in
1345 append)
5f83a3e9 1346 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1347 clear)
5f83a3e9 1348 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1349 define)
1350 case "$zzz" in
1351 '') zzz=define ;;
1352 esac
5f83a3e9 1353 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1354 eval)
5f83a3e9 1355 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1356 prepend)
5f83a3e9 1357 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1358 undef)
1359 case "$zzz" in
1360 '') zzz="$uuu" ;;
1361 esac
5f83a3e9
JH
1362 echo "$yyy=$zzz" >> posthint.sh ;;
1363 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1364 esac
bde6b06b 1365 shift
02e93a22 1366 ;;
dfe9444c 1367 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1368 exit 0;;
2304df62 1369 --) break;;
a0d0e21e 1370 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1371 *) break;;
1372 esac
1373done
1374
1375case "$error" in
1376true)
1377 cat >&2 <<EOM
2afac517 1378Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1379 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1380 -d : use defaults for all answers.
1381 -e : go on without questioning past the production of config.sh.
1382 -f : specify an alternate default configuration file.
1383 -h : print this help message and exit (with an error status).
1384 -r : reuse C symbols value if possible (skips costly nm extraction).
1385 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1386 -D : define symbol to have some value:
1387 -D symbol symbol gets the value 'define'
1388 -D symbol=value symbol gets the value 'value'
2304df62 1389 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1390 -K : do not use unless you know what you are doing.
ecfc5424 1391 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1392 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1393 -U : undefine symbol:
1394 -U symbol symbol gets the value 'undef'
1395 -U symbol= symbol gets completely empty
02e93a22 1396 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1397 -A symbol=value append " "value to symbol
02e93a22
JH
1398 -A append:symbol=value append value to symbol
1399 -A define:symbol=value define symbol to have value
02e93a22
JH
1400 -A clear:symbol define symbol to be ''
1401 -A define:symbol define symbol to be 'define'
1402 -A eval:symbol=value define symbol to be eval of value
1403 -A prepend:symbol=value prepend value to symbol
1404 -A undef:symbol define symbol to be 'undef'
1405 -A undef:symbol= define symbol to be ''
2304df62
AD
1406 -V : print version number and exit (with a zero status).
1407EOM
1408 exit 1
1409 ;;
1410esac
1411
dfe9444c
AD
1412: Sanity checks
1413case "$fastread$alldone" in
1414yescont|yesexit) ;;
1415*)
aaeb8e51
GS
1416 case "$extractsh" in
1417 true) ;;
1418 *)
1419 if test ! -t 0; then
1420 echo "Say 'sh Configure', not 'sh <Configure'"
1421 exit 1
1422 fi
1423 ;;
1424 esac
dfe9444c
AD
1425 ;;
1426esac
1427
2304df62
AD
1428exec 4>&1
1429case "$silent" in
1430true) exec 1>/dev/null;;
1431esac
1432
ecfc5424 1433: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1434touch optdef.sh
1435. ./optdef.sh
02e93a22
JH
1436: create the posthint manipulation script and leave the file out there...
1437touch posthint.sh
a0d0e21e 1438
2304df62 1439: set package name
85e6fe83 1440package=perl5
b4eb6b3d
JH
1441first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1442last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1443case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1444ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1445*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1446esac
2304df62 1447
2304df62
AD
1448: Some greps do not return status, grrr.
1449echo "grimblepritz" >grimble
1450if grep blurfldyick grimble >/dev/null 2>&1 ; then
1451 contains=contains
1452elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1453 contains=grep
1454else
1455 contains=contains
1456fi
1457rm -f grimble
1458: the following should work in any shell
1459case "$contains" in
1460contains*)
1461 echo " "
1462 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1463 cat >contains <<'EOSS'
1464grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1465EOSS
1466chmod +x contains
1467esac
1468
dfe9444c
AD
1469: Find the path to the source tree
1470case "$src" in
1471'') case "$0" in
b233458b
JH
1472 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1473 case "$src" in
1474 /*) ;;
8504afb7 1475 .) ;;
b233458b
JH
1476 *) src=`cd ../$src && pwd` ;;
1477 esac
1478 ;;
dfe9444c
AD
1479 *) src='.';;
1480 esac;;
1481esac
1482case "$src" in
1483'') src=/
1484 rsrc=/
1485 ;;
1486/*) rsrc="$src";;
1487*) rsrc="../$src";;
1488esac
1489if test -f $rsrc/Configure && \
1490 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1491then
1492 : found it, so we are ok.
1493else
1494 rsrc=''
1495 for src in . .. ../.. ../../.. ../../../..; do
1496 if test -f ../$src/Configure && \
1497 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1498 then
1499 rsrc=../$src
1500 break
1501 fi
1502 done
1503fi
1504case "$rsrc" in
1505'')
1506 cat <<EOM >&4
1507
1508Sorry, I can't seem to locate the source dir for $package. Please start
1509Configure with an explicit path -- i.e. /some/path/Configure.
1510
1511EOM
1512 exit 1
1513 ;;
1514../.) rsrc='..';;
1515*)
1516 echo " "
1517 echo "Sources for $package found in \"$src\"." >&4
1518 ;;
1519esac
1520
1521: script used to extract .SH files with variable substitutions
1522cat >extract <<'EOS'
a02608de 1523PERL_CONFIG_SH=true
dfe9444c 1524echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1525if test -f MANIFEST; then
1526 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1527else
1528 echo "(Looking for .SH files under the source directory.)"
1529 set x `(cd $src; find . -name "*.SH" -print)`
1530fi
1531shift
1532case $# in
15330) set x `(cd $src; echo *.SH)`; shift;;
1534esac
1535if test ! -f $src/$1; then
1536 shift
1537fi
1538mkdir_p='
1539name=$1;
1540create="";
1541while test $name; do
1542 if test ! -d "$name"; then
1543 create="$name $create";
1544 name=`echo $name | sed -e "s|^[^/]*$||"`;
1545 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1546 else
1547 name="";
1548 fi;
1549done;
1550for file in $create; do
1551 mkdir $file;
1552done
1553'
1554for file in $*; do
1555 case "$src" in
1556 ".")
1557 case "$file" in
1558 */*)
1559 dir=`expr X$file : 'X\(.*\)/'`
1560 file=`expr X$file : 'X.*/\(.*\)'`
1561 (cd $dir && . ./$file)
1562 ;;
1563 *)
1564 . ./$file
1565 ;;
1566 esac
1567 ;;
1568 *)
1569 case "$file" in
1570 */*)
1571 dir=`expr X$file : 'X\(.*\)/'`
1572 file=`expr X$file : 'X.*/\(.*\)'`
1573 (set x $dir; shift; eval $mkdir_p)
1574 sh <$src/$dir/$file
1575 ;;
1576 *)
1577 sh <$src/$file
1578 ;;
1579 esac
1580 ;;
1581 esac
1582done
1583if test -f $src/config_h.SH; then
1584 if test ! -f config.h; then
1585 : oops, they left it out of MANIFEST, probably, so do it anyway.
1586 . $src/config_h.SH
1587 fi
1588fi
1589EOS
1590
1591: extract files and exit if asked to do so
1592case "$extractsh" in
1593true)
1594 case "$realsilent" in
1595 true) ;;
1596 *) exec 1>&4;;
1597 esac
1598 case "$config_sh" in
1599 '') config_sh='config.sh';;
1600 esac
1601 echo " "
1602 echo "Fetching answers from $config_sh..."
1603 cd ..
1604 . $config_sh
1605 test "$override" && . ./optdef.sh
1606 echo " "
1607 . UU/extract
1608 rm -rf UU
24ccb310 1609 echo "Extraction done."
dfe9444c
AD
1610 exit 0
1611 ;;
1612esac
1613
1614: Eunice requires " " instead of "", can you believe it
1615echo " "
1616: Here we go...
1617echo "Beginning of configuration questions for $package."
1618
1619trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1620
2304df62
AD
1621: first determine how to suppress newline on echo command
1622echo " "
1623echo "Checking echo to see how to suppress newlines..."
1624(echo "hi there\c" ; echo " ") >.echotmp
1625if $contains c .echotmp >/dev/null 2>&1 ; then
1626 echo "...using -n."
1627 n='-n'
1628 c=''
1629else
1630 cat <<'EOM'
1631...using \c
1632EOM
1633 n=''
1634 c='\c'
1635fi
1636echo $n "The star should be here-->$c"
1637echo '*'
1638rm -f .echotmp
1639
1640: Now test for existence of everything in MANIFEST
1641echo " "
dfe9444c 1642if test -f $rsrc/MANIFEST; then
2304df62 1643 echo "First let's make sure your kit is complete. Checking..." >&4
dfe9444c 1644 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
2304df62 1645 rm -f missing
dfe9444c 1646 tmppwd=`pwd`
2304df62 1647 for filelist in x??; do
dfe9444c 1648 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
2304df62
AD
1649 done
1650 if test -s missing; then
1651 cat missing >&4
1652 cat >&4 <<'EOM'
1653
1654THIS PACKAGE SEEMS TO BE INCOMPLETE.
1655
1656You have the option of continuing the configuration process, despite the
1657distinct possibility that your kit is damaged, by typing 'y'es. If you
1658do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1659and contact the author (perlbug@perl.org).
2304df62
AD
1660
1661EOM
1662 echo $n "Continue? [n] $c" >&4
1663 read ans
1664 case "$ans" in
1665 y*)
1666 echo "Continuing..." >&4
1667 rm -f missing
1668 ;;
1669 *)
1670 echo "ABORTING..." >&4
1671 kill $$
1672 ;;
1673 esac
1674 else
dfe9444c 1675 echo "Looks good..."
2304df62
AD
1676 fi
1677else
1678 echo "There is no MANIFEST file. I hope your kit is complete !"
1679fi
1680rm -f missing x??
1681
5ff3f7a4
GS
1682echo " "
1683: Find the appropriate value for a newline for tr
1684if test -n "$DJGPP"; then
1685 trnl='\012'
1686fi
1687if test X"$trnl" = X; then
1688 case "`echo foo|tr '\n' x 2>/dev/null`" in
1689 foox) trnl='\n' ;;
1690 esac
1691fi
1692if test X"$trnl" = X; then
1693 case "`echo foo|tr '\012' x 2>/dev/null`" in
1694 foox) trnl='\012' ;;
1695 esac
1696fi
1697if test X"$trnl" = X; then
1698 cat <<EOM >&2
1699
1700$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1701
1702EOM
1703 exit 1
1704fi
1705
2304df62
AD
1706: compute the number of columns on the terminal for proper question formatting
1707case "$COLUMNS" in
1708'') COLUMNS='80';;
1709esac
1710
1711: set up the echo used in my read
1712myecho="case \"\$xxxm\" in
1713'') echo $n \"\$rp $c\" >&4;;
1714*) case \"\$rp\" in
1715 '') echo $n \"[\$xxxm] $c\";;
1716 *)
1717 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1718 echo \"\$rp\" >&4
1719 echo $n \"[\$xxxm] $c\" >&4
1720 else
1721 echo $n \"\$rp [\$xxxm] $c\" >&4
1722 fi
1723 ;;
1724 esac;;
1725esac"
1726
1727: now set up to do reads with possible shell escape and default assignment
1728cat <<EOSC >myread
28757baa 1729$startsh
2304df62
AD
1730xxxm=\$dflt
1731$myecho
1732ans='!'
1733case "\$fastread" in
1734yes) case "\$dflt" in
1735 '') ;;
1736 *) ans='';
1737 case "\$silent-\$rp" in
1738 true-) ;;
1739 *) echo " " >&4;;
1740 esac;;
1741 esac;;
1742*) case "\$silent" in
1743 true) case "\$rp" in
1744 '') ans='';;
1745 esac;;
1746 esac;;
1747esac
1748while expr "X\$ans" : "X!" >/dev/null; do
1749 read answ
1750 set x \$xxxm
1751 shift
dfe9444c 1752 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1753 case "\$answ" in
dfe9444c
AD
1754 "!")
1755 sh 1>&4
1756 echo " "
1757 $myecho
1758 ;;
1759 !*)
1760 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1761 shift
1762 sh 1>&4 -c "\$*"
1763 echo " "
1764 $myecho
1765 ;;
2304df62
AD
1766 "\$ans")
1767 case "\$ans" in
ecfc5424
AD
1768 \\&*)
1769 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1770 shift
1771 case "\$1" in
1772 -d)
1773 fastread=yes
40a7a20a 1774 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1775 ;;
1776 -*)
40a7a20a 1777 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1778 ;;
1779 esac
1780 $myecho
1781 ans=!
1782 ;;
2304df62
AD
1783 esac;;
1784 *)
1785 case "\$aok" in
1786 y)
1787 echo "*** Substitution done -- please confirm."
1788 xxxm="\$ans"
c9795ab7 1789 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1790 xxxm="\$ans"
1791 ans=!
1792 ;;
1793 *)
1794 echo "*** Error -- try again."
1795 ans=!
1796 ;;
1797 esac
1798 $myecho
1799 ;;
1800 esac
1801 case "\$ans\$xxxm\$nostick" in
1802 '')
1803 ans=!
1804 $myecho
1805 ;;
1806 esac
1807done
1808case "\$ans" in
1809'') ans="\$xxxm";;
1810esac
1811EOSC
1812
1813: create .config dir to save info across Configure sessions
1814test -d ../.config || mkdir ../.config
1815cat >../.config/README <<EOF
1816This directory created by Configure to save information that should
dfe9444c 1817persist across sessions for $package.
2304df62
AD
1818
1819You may safely delete it if you wish.
1820EOF
1821
9507cadf 1822xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 1823case "$usedevel" in
0107c034 1824$define|true|[yY]*) ;;
9507cadf 1825*) case "$xversion" in
0107c034
JH
1826 *[13579])
1827 cat >&4 <<EOH
1828*** WHOA THERE!!! ***
1829
1830 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
1831 The version of this $package distribution is $xversion, that is, odd,
1832 (as opposed to even) and that signifies a development release.
3d5d58b1 1833 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
1834
1835 Do ***NOT*** install this into production use.
1836 Data corruption and crashes are possible.
1837
1838 It is most seriously suggested that you do not continue any further
1839 unless you want to help in developing and debugging Perl.
1840
6adc6a45
JH
1841 If you *still* want to build perl, you can answer 'y' now,
1842 or pass -Dusedevel to Configure.
1843
0107c034
JH
1844EOH
1845 rp='Do you really want to continue?'
1846 dflt='n'
1847 . ./myread
1848 case "$ans" in
8feeef0e
JH
1849 [yY]) echo >&4 "Okay, continuing."
1850 usedevel="$define" ;;
0107c034
JH
1851 *) echo >&4 "Okay, bye."
1852 exit 1
1853 ;;
1854 esac
1855 ;;
1856 esac
1857 ;;
1858esac
8feeef0e
JH
1859case "$usedevel" in
1860$define|true|[yY]*)
1861 case "$versiononly" in
1862 '') versiononly="$define" ;;
1863 esac
1864 case "$installusrbinperl" in
1865 '') installusrbinperl="$undef" ;;
1866 esac
1867 ;;
1868esac
0107c034 1869
2304df62
AD
1870: general instructions
1871needman=true
1872firsttime=true
760ac839 1873user=`(logname) 2>/dev/null`
dfe9444c
AD
1874case "$user" in
1875'') user=`whoami 2>&1`;;
760ac839 1876esac
2304df62
AD
1877if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1878 firsttime=false
1879 echo " "
1880 rp='Would you like to see the instructions?'
1881 dflt=n
1882 . ./myread
1883 case "$ans" in
1884 [yY]*) ;;
1885 *) needman=false;;
1886 esac
1887fi
1888if $needman; then
1889 cat <<EOH
4e2a5f63 1890
2304df62 1891This installation shell script will examine your system and ask you questions
a0d0e21e 1892to determine how the perl5 package should be installed. If you get
2304df62
AD
1893stuck on a question, you may use a ! shell escape to start a subshell or
1894execute a command. Many of the questions will have default answers in square
1895brackets; typing carriage return will give you the default.
1896
1897On some of the questions which ask for file or directory names you are allowed
1898to use the ~name construct to specify the login directory belonging to "name",
1899even if you don't have a shell which knows about that. Questions where this is
1900allowed will be marked "(~name ok)".
1901
1902EOH
1903 rp=''
1904 dflt='Type carriage return to continue'
1905 . ./myread
1906 cat <<'EOH'
1907
1908The prompter used in this script allows you to use shell variables and
1909backticks in your answers. You may use $1, $2, etc... to refer to the words
1910in the default answer, as if the default line was a set of arguments given to a
1911script shell. This means you may also use $* to repeat the whole default line,
1912so you do not have to re-type everything to add something to the default.
1913
1914Everytime there is a substitution, you will have to confirm. If there is an
1915error (e.g. an unmatched backtick), the default answer will remain unchanged
1916and you will be prompted again.
1917
1918If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1919the questions and use the computed defaults (or the previous answers if there
1920was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1921You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1922on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1923
1924EOH
1925 . ./myread
1926 cat <<EOH
1927
1928Much effort has been expended to ensure that this shell script will run on any
1929Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1930Configure and run it again. If you can't run Configure for some reason,
1931you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 1932have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
1933
1934This installation script affects things in two ways:
1935
19361) it may do direct variable substitutions on some of the files included
1937 in this kit.
19382) it builds a config.h file for inclusion in C programs. You may edit
1939 any of these files as the need arises after running this script.
1940
1941If you make a mistake on a question, there is no easy way to back up to it
1942currently. The easiest thing to do is to edit config.sh and rerun all the SH
1943files. Configure will offer to let you do this before it runs the SH files.
1944
1945EOH
1946 dflt='Type carriage return to continue'
1947 . ./myread
1948 case "$firsttime" in
1949 true) echo $user >>../.config/instruct;;
1950 esac
1951fi
1952
2304df62
AD
1953: find out where common programs are
1954echo " "
1955echo "Locating common programs..." >&4
1956cat <<EOSC >loc
1957$startsh
1958case \$# in
19590) exit 1;;
1960esac
1961thing=\$1
1962shift
1963dflt=\$1
1964shift
1965for dir in \$*; do
1966 case "\$thing" in
1967 .)
1968 if test -d \$dir/\$thing; then
1969 echo \$dir
1970 exit 0
1971 fi
1972 ;;
1973 *)
a0d0e21e 1974 for thisthing in \$dir/\$thing; do
ecfc5424 1975 : just loop through to pick last item
a0d0e21e 1976 done
25f94b33 1977 if test -f \$thisthing; then
a0d0e21e 1978 echo \$thisthing
2304df62
AD
1979 exit 0
1980 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
1981 if test -n "$DJGPP"; then
1982 echo \$dir/\$thing.exe
1983 else
1984 : on Eunice apparently
1985 echo \$dir/\$thing
1986 fi
2304df62
AD
1987 exit 0
1988 fi
1989 ;;
1990 esac
1991done
1992echo \$dflt
1993exit 1
1994EOSC
1995chmod +x loc
1996$eunicefix loc
1997loclist="
1998awk
1999cat
b4eb6b3d
JH
2000comm
2001cp
2304df62
AD
2002echo
2003expr
2004grep
a0d0e21e 2005ls
dfe9444c 2006make
b4eb6b3d 2007mkdir
2304df62
AD
2008rm
2009sed
b4eb6b3d 2010sort
85e6fe83 2011touch
2304df62 2012tr
b4eb6b3d 2013uniq
2304df62
AD
2014"
2015trylist="
2016Mcc
dfe9444c 2017ar
3659ebf1 2018bison
b4eb6b3d 2019byacc
2304df62 2020cpp
b4eb6b3d 2021csh
2304df62
AD
2022date
2023egrep
8ff267be 2024gzip
b4eb6b3d 2025less
8ff267be 2026ln
b4eb6b3d 2027more
693762b4 2028nm
b4eb6b3d
JH
2029nroff
2030pg
2304df62
AD
2031test
2032uname
8ff267be 2033zip
2304df62 2034"
8e07c86e 2035pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2036pth="$pth /lib /usr/lib"
2037for file in $loclist; do
dfe9444c
AD
2038 eval xxx=\$$file
2039 case "$xxx" in
2040 /*|?:[\\/]*)
2041 if test -f "$xxx"; then
2042 : ok
2043 else
2044 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2045 xxx=`./loc $file $file $pth`
2046 fi
2047 ;;
2048 '') xxx=`./loc $file $file $pth`;;
2049 *) xxx=`./loc $xxx $xxx $pth`;;
2050 esac
2304df62
AD
2051 eval $file=$xxx
2052 eval _$file=$xxx
2053 case "$xxx" in
2054 /*)
2055 echo $file is in $xxx.
2056 ;;
8e07c86e
AD
2057 ?:[\\/]*)
2058 echo $file is in $xxx.
2059 ;;
2304df62 2060 *)
25f94b33
AD
2061 echo "I don't know where '$file' is, and my life depends on it." >&4
2062 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2063 exit 1
2304df62
AD
2064 ;;
2065 esac
2066done
2067echo " "
2068echo "Don't worry if any of the following aren't found..."
2069say=offhand
2070for file in $trylist; do
dfe9444c
AD
2071 eval xxx=\$$file
2072 case "$xxx" in
2073 /*|?:[\\/]*)
2074 if test -f "$xxx"; then
2075 : ok
2076 else
2077 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2078 xxx=`./loc $file $file $pth`
2079 fi
2080 ;;
2081 '') xxx=`./loc $file $file $pth`;;
2082 *) xxx=`./loc $xxx $xxx $pth`;;
2083 esac
2304df62
AD
2084 eval $file=$xxx
2085 eval _$file=$xxx
2086 case "$xxx" in
2087 /*)
2088 echo $file is in $xxx.
2089 ;;
8e07c86e
AD
2090 ?:[\\/]*)
2091 echo $file is in $xxx.
2092 ;;
2304df62
AD
2093 *)
2094 echo "I don't see $file out there, $say."
2095 say=either
2096 ;;
2097 esac
2098done
2099case "$egrep" in
2100egrep)
2101 echo "Substituting grep for egrep."
2102 egrep=$grep
2103 ;;
2104esac
8ff267be 2105case "$ln" in
2106ln)
2107 echo "Substituting cp for ln."
2108 ln=$cp
2109 ;;
2110esac
2304df62
AD
2111case "$test" in
2112test)
2113 echo "Hopefully test is built into your sh."
2114 ;;
2115*)
73614538 2116 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2117 echo "Using the test built into your sh."
2304df62
AD
2118 test=test
2119 _test=test
2120 fi
2121 ;;
2122esac
2123case "$echo" in
2124echo)
2125 echo "Hopefully echo is built into your sh."
2126 ;;
2127'') ;;
2128*)
2129 echo " "
2130echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2131 $echo $n "hi there$c" >foo1
2132 echo $n "hi there$c" >foo2
2133 if cmp foo1 foo2 >/dev/null 2>&1; then
2134 echo "They are compatible. In fact, they may be identical."
2135 else
2136 case "$n" in
2137 '-n') n='' c='\c';;
2138 *) n='-n' c='';;
2139 esac
2140 cat <<FOO
2141They are not compatible! You are probably running ksh on a non-USG system.
2142I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2143have echo built in and we may have to run some Bourne shell scripts. That
2144means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2145
2146FOO
2147 $echo $n "The star should be here-->$c"
2148 $echo "*"
2149 fi
2150 $rm -f foo1 foo2
2151 ;;
2152esac
2153
2573c5f9
JH
2154cat <<EOS >checkcc
2155$startsh
2156EOS
2157cat <<'EOSC' >>checkcc
2158case "$cc" in
2159'') ;;
2160*) $rm -f try try.*
2161 $cat >try.c <<EOM
2162int main(int argc, char *argv[]) {
2163 return 0;
2164}
2165EOM
e4778687 2166 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2167 :
2168 else
2169 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2170 despair=yes
2171 trygcc=yes
2172 case "$cc" in
2173 *gcc*) trygcc=no ;;
2174 esac
2175 case "`$cc -v -c try.c 2>&1`" in
2176 *gcc*) trygcc=no ;;
2177 esac
2178 if $test X"$trygcc" = Xyes; then
2179 if gcc -o try -c try.c; then
2180 echo " "
2181 echo "You seem to have a working gcc, though." >&4
2182 rp="Would you like to use it?"
2183 dflt=y
2184 if $test -f myread; then
2185 . ./myread
2186 else
2187 if $test -f UU/myread; then
2188 . ./UU/myread
2189 else
2190 echo "Cannot find myread, sorry. Aborting." >&2
2191 exit 1
2192 fi
2193 fi
2194 case "$ans" in
e723fc21 2195 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2573c5f9
JH
2196 esac
2197 fi
2198 fi
2199 if $test X"$despair" = Xyes; then
5dd4fbdf
MB
2200 $cat >&4 <<EOM
2201You need to find a working C compiler.
2202Either (purchase and) install the C compiler supplied by your OS vendor,
2203or for a free C compiler try http://gcc.gnu.org/
2204I cannot continue any further, aborting.
2205EOM
2573c5f9
JH
2206 exit 1
2207 fi
2208 fi
2209 $rm -f try try.*
2210 ;;
2211esac
2212EOSC
2213
a0d0e21e
LW
2214: determine whether symbolic links are supported
2215echo " "
2216$touch blurfl
2217if $ln -s blurfl sym > /dev/null 2>&1 ; then
2218 echo "Symbolic links are supported." >&4
2219 lns="$ln -s"
2220else
2221 echo "Symbolic links are NOT supported." >&4
2222 lns="$ln"
2223fi
2224$rm -f blurfl sym
2225
dafca956
JH
2226: determine whether symbolic links are supported
2227echo " "
2228case "$lns" in
2229*"ln -s")
2230 echo "Checking how to test for symbolic links..." >&4
2231 $lns blurfl sym
4b661809 2232 if $test "X$issymlink" = X; then
73614538 2233 sh -c "PATH= test -h sym" >/dev/null 2>&1
5d644a95
MB
2234 if test $? = 0; then
2235 issymlink="test -h"
2236 fi
2237 fi
2238 if $test "X$issymlink" = X; then
73614538 2239 if $test -h >/dev/null 2>&1; then
5d644a95
MB
2240 issymlink="$test -h"
2241 echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2242 fi
dafca956 2243 fi
4b661809 2244 if $test "X$issymlink" = X; then
dafca956 2245 if $test -L sym 2>/dev/null; then
5d644a95 2246 issymlink="$test -L"
dafca956
JH
2247 fi
2248 fi
4b661809 2249 if $test "X$issymlink" != X; then
5d644a95 2250 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2251 else
2252 echo "I do not know how you can test for symbolic links." >&4
2253 fi
2254 $rm -f blurfl sym
2255 ;;
2256*) echo "No symbolic links, so not testing for their testing..." >&4
2257 ;;
2258esac
2259echo " "
2260
2261
2262case "$mksymlinks" in
2263$define|true|[yY]*)
2264 case "$src" in
2265 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2266 exit 1
2267 ;;
4b661809 2268 *) case "$lns:$issymlink" in
7a800fca 2269 *"ln -s:"*"test -"?)
dafca956
JH
2270 echo "Creating the symbolic links..." >&4
2271 echo "(First creating the subdirectories...)" >&4
2272 cd ..
2273 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2274 read directory
2275 test -z "$directory" && break
2276 mkdir -p $directory
2277 done
2278 # Sanity check 1.
2279 if test ! -d t/base; then
2280 echo "Failed to create the subdirectories. Aborting." >&4
2281 exit 1
2282 fi
2283 echo "(Then creating the symlinks...)" >&4
2284 awk '{print $1}' $src/MANIFEST | while true; do
2285 read filename
2286 test -z "$filename" && break
2287 if test -f $filename; then
5d644a95 2288 if $issymlink $filename; then
dafca956
JH
2289 rm -f $filename
2290 fi
2291 fi
2292 if test -f $filename; then
2293 echo "$filename already exists, not symlinking."
2294 else
2295 ln -s $src/$filename $filename
2296 fi
2297 done
2298 # Sanity check 2.
2299 if test ! -f t/base/commonsense.t; then
2300 echo "Failed to create the symlinks. Aborting." >&4
2301 exit 1
2302 fi
2303 cd UU
2304 ;;
2305 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2306 ;;
2307 esac
2308 ;;
2309 esac
2310 ;;
2311esac
2312
5440bc8e
JH
2313
2314case "$usecrosscompile" in
2315$define|true|[yY]*)
2316 croak=''
2317 case "$cc" in
2318 *-*-gcc) # A cross-compiling gcc, probably.
2319 targetarch=`echo $cc|sed 's/-gcc$//'`
2320 ar=$targetarch-ar
2321 # leave out ld, choosing it is more complex
2322 nm=$targetarch-nm
2323 ranlib=$targetarch-ranlib
2324 ;;
2325 esac
2326 case "$targetarch" in
2327 '') echo "Cross-compiling: you should define targetarch." >&4; croak=y ;;
2328 esac
2329 case "$usrinc" in
2330 '') echo "Cross-compiling: you should define usrinc." >&4; croak=y ;;
2331 esac
2332 case "$incpth" in
2333 '') echo "Cross-compiling: you should define incpth." >&4; croak=y ;;
2334 esac
2335 case "$libpth" in
2336 '') echo "Cross-compiling: you should define libpth." >&4; croak=y ;;
2337 esac
2338 case "$targethost" in
2339 '') echo "Cross-compiling: targethost not defined." >&4; croak=y ;;
2340 esac
2341 case "$targetdir" in
2342 '') echo "Cross compiling: targetdir not defined." >&4; croak=y ;;
2343 esac
2344 locincpth=''
2345 loclibpth=''
2346 case "$croak" in
2347 y) exit 1 ;;
2348 esac
2349 case "$src" in
2350 /*) run=$src/Cross/run
2351 to=$src/Cross/to
2352 from=$src/Cross/from
2353 ;;
2354 *) pwd=`test -f ../Configure & cd ..; pwd`
2355 run=$pwd/Cross/run
2356 to=$pwd/Cross/to
2357 from=$pwd/Cross/from
2358 ;;
2359 esac
2360 case "$targetrun" in
2361 '') targetrun=ssh ;;
2362 esac
2363 case "$targetto" in
2364 '') targetto=scp ;;
2365 esac
2366 case "$targetfrom" in
2367 '') targetfrom=scp ;;
2368 esac
2369 run=$run-$targetrun
2370 to=$to-$targetto
2371 from=$from-$targetfrom
2372 case "$targetuser" in
2373 '') targetuser=root ;;
2374 esac
2375 case "$targetfrom" in
2376 scp) q=-q ;;
2377 *) q='' ;;
2378 esac
2379 case "$targetrun" in
2380 ssh|rsh)
2381 cat >$run <<EOF
2382#!/bin/sh
2383exe=\$1
2384shift
2385$to \$exe
2386$targetrun -l $targetuser $targethost "cd $targetdir && ./\$exe \$@"
2387EOF
2388 ;;
2389 *) echo "Cross-compiling: unknown targetrun '$targetrun'" >&4
2390 exit 1
2391 ;;
2392 esac
2393 case "$targetto" in
2394 scp|rcp)
2395 cat >$to <<EOF
2396#!/bin/sh
2397for f in \$@
2398do
2399 $targetto $q \$f $targetuser@$targethost:$targetdir/. || exit 1
2400done
2401exit 0
2402EOF
2403 ;;
2404 cp) cat >$to <<EOF
2405#!/bin/sh
2406cp \$@ $targetdir/.
2407EOF
2408 ;;
2409 *) echo "Cross-compiling: unknown targetto '$targetto'" >&4
2410 exit 1
2411 ;;
2412 esac
2413 case "$targetfrom" in
2414 scp|rcp)
2415 cat >$from <<EOF
2416#!/bin/sh
2417for f in \$@
2418do
2419 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2420done
2421exit 0
2422EOF
2423 ;;
2424 cp) cat >$from <<EOF
2425#!/bin/sh
2426for f in \$@
2427do
2428 cp $targetdir/\$f . || exit 1
2429done
2430exit 0
2431EOF
2432 ;;
2433 *) echo "Cross-compiling: unknown targetfrom '$targetfrom'" >&4
2434 exit 1
2435 ;;
2436 esac
2437 if test ! -f $run; then
2438 echo "Cross-compiling: target 'run' script '$run' not found." >&4
2439 else
2440 chmod a+rx $run
2441 fi
2442 if test ! -f $to; then
2443 echo "Cross-compiling: target 'to' script '$to' not found." >&4
2444 else
2445 chmod a+rx $to
2446 fi
2447 if test ! -f $from; then
2448 echo "Cross-compiling: target 'from' script '$from' not found." >&4
2449 else
2450 chmod a+rx $from
2451 fi
2452 if test ! -f $run -o ! -f $to -o ! -f $from; then
2453 exit 1
2454 fi
2455 cat >&4 <<EOF
2456Cross-compiling: Using
2457 $run-ssh
2458 $to-ssh
2459 $from-ssh
2460EOF
2461 ;;
2462*) run=''
2463 to=:
2464 from=:
2465 usecrosscompile='undef'
2466 targetarch=''
2467 ;;
2468esac
2469
ecfc5424
AD
2470: see whether [:lower:] and [:upper:] are supported character classes
2471echo " "
ecfc5424
AD
2472case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2473ABYZ)
2474 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2475 up='[:upper:]'
2476 low='[:lower:]'
2477 ;;
28e8609d
JH
2478*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2479 # (0xc9 and 0xd1), therefore that is a nice testing point.
2480 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2481 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2482 ij) up='[A-Z]'
2483 low='[a-z]'
2484 ;;
2485 esac
2486 fi
2487 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2488 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2489 ij) up='A-Z'
2490 low='a-z'
2491 ;;
2492 esac
2493 fi
2494 if test "X$up" = X -o "X$low" = X; then
2495 case "`echo IJ | od -x 2>/dev/null`" in
2496 *C9D1*|*c9d1*)
2497 echo "Hey, this might be EBCDIC." >&4
2498 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2499 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2500 ij) up='[A-IJ-RS-Z]'
2501 low='[a-ij-rs-z]'
2502 ;;
2503 esac
2504 fi
2505 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2506 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2507 ij) up='A-IJ-RS-Z'
2508 low='a-ij-rs-z'
2509 ;;
2510 esac
2511 fi
2512 ;;
2513 esac
2514 fi
2515esac
3eaeeeae 2516case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2517ij)
2518 echo "Using $up and $low to convert case." >&4
2519 ;;
ecfc5424 2520*)
28e8609d
JH
2521 echo "I don't know how to translate letters from upper to lower case." >&4
2522 echo "Your tr is not acting any way I know of." >&4
2523 exit 1
2524 ;;
ecfc5424
AD
2525esac
2526: set up the translation script tr, must be called with ./tr of course
2527cat >tr <<EOSC
2528$startsh
2529case "\$1\$2" in
2530'[A-Z][a-z]') exec $tr '$up' '$low';;
2531'[a-z][A-Z]') exec $tr '$low' '$up';;
2532esac
2533exec $tr "\$@"
2534EOSC
2535chmod +x tr
2536$eunicefix tr
2537
2304df62
AD
2538: Try to determine whether config.sh was made on this system
2539case "$config_sh" in
2540'')
43999f95
JH
2541myuname=`$uname -a 2>/dev/null`
2542$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2543# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2544# because the A-Z/a-z are not consecutive.
a0d0e21e 2545myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2546 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2547newmyuname="$myuname"
2304df62 2548dflt=n
16d20bd9
AD
2549case "$knowitall" in
2550'')
2551 if test -f ../config.sh; then
2552 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2553 eval "`grep myuname= ../config.sh`"
2554 fi
2555 if test "X$myuname" = "X$newmyuname"; then
2556 dflt=y
2557 fi
2304df62 2558 fi
16d20bd9
AD
2559 ;;
2560*) dflt=y;;
2561esac
2304df62
AD
2562
2563: Get old answers from old config file if Configure was run on the
2564: same system, otherwise use the hints.
2565hint=default
2566cd ..
2567if test -f config.sh; then
16d20bd9
AD
2568 echo " "
2569 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2570 . UU/myread
2571 case "$ans" in
f83701cd
AD
2572 n*|N*) echo "OK, I'll ignore it."
2573 mv config.sh config.sh.old
2574 myuname="$newmyuname"
2575 ;;
2304df62 2576 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2577 tmp_n="$n"
2578 tmp_c="$c"
85cad39c 2579 tmp_sh="$sh"
2304df62
AD
2580 . ./config.sh
2581 cp config.sh UU
ecfc5424
AD
2582 n="$tmp_n"
2583 c="$tmp_c"
85cad39c 2584 : Older versions did not always set $sh. Catch re-use of such
2585 : an old config.sh.
2586 case "$sh" in
2587 '') sh="$tmp_sh" ;;
2588 esac
2304df62
AD
2589 hint=previous
2590 ;;
2591 esac
2592fi
2573c5f9 2593. ./UU/checkcc
2304df62
AD
2594if test ! -f config.sh; then
2595 $cat <<EOM
2596
4e2a5f63
AD
2597First time through, eh? I have some defaults handy for some systems
2598that need some extra help getting the Configure answers right:
2304df62
AD
2599
2600EOM
dfe9444c 2601 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2602 dflt=''
2603 : Half the following guesses are probably wrong... If you have better
7f2de2d2 2604 : tests or hints, please send them to perlbug@perl.org
2304df62 2605 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2606 $test -f /irix && osname=irix
85e6fe83
LW
2607 $test -f /xenix && osname=sco_xenix
2608 $test -f /dynix && osname=dynix
2609 $test -f /dnix && osname=dnix
5f05dabc 2610 $test -f /lynx.os && osname=lynxos
2611 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2612 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2613 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2614 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2615 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2616 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2617 $test -d /usr/apollo/bin && osname=apollo
2618 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2619 $test -d /usr/include/minix && osname=minix
e060872b 2620 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2621 osname=machten
4633a7c4 2622 if $test -x /sbin/version; then
dfe9444c 2623 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2624 $sed -e 's/[A-Za-z]$//'`
2625 elif $test -x /usr/etc/version; then
dfe9444c 2626 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2627 $sed -e 's/[A-Za-z]$//'`
2628 else
2629 osvers="$2.$3"
2630 fi
2631 fi
aaacdc8b
GS
2632
2633 $test -f /sys/posix.dll &&
2634 $test -f /usr/bin/what &&
2635 set X `/usr/bin/what /sys/posix.dll` &&
2636 $test "$3" = UWIN &&
2637 osname=uwin &&
2638 osvers="$5"
2639
2304df62
AD
2640 if $test -f $uname; then
2641 set X $myuname
2642 shift
2643
2304df62 2644 case "$5" in
85e6fe83 2645 fps*) osname=fps ;;
2304df62
AD
2646 mips*)
2647 case "$4" in
85e6fe83
LW
2648 umips) osname=umips ;;
2649 *) osname=mips ;;
2304df62 2650 esac;;
85e6fe83
LW
2651 [23]100) osname=mips ;;
2652 next*) osname=next ;;
ecfc5424 2653 i386*)
c6912327
JH
2654 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2655 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2656 osname='sco'
2657 osvers=$tmp
2658 elif $test -f /etc/kconfig; then
ecfc5424 2659 osname=isc
bd628c73 2660 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2661 osvers=4
2662 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2663 osvers=3
2304df62 2664 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2665 osvers=2
ecfc5424
AD
2666 fi
2667 fi
2000072c 2668 tmp=''
ecfc5424 2669 ;;
c4f23d77
AD
2670 pc*)
2671 if test -n "$DJGPP"; then
2672 osname=dos
2673 osvers=djgpp
2674 fi
2675 ;;
2304df62
AD
2676 esac
2677
2678 case "$1" in
a0d0e21e
LW
2679 aix) osname=aix
2680 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2681 case "$tmp" in
1aef975c 2682 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2683 '<3240'|'<>3240') osvers=3.2.0 ;;
2684 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2685 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2686 *) osvers=$tmp;;
a0d0e21e
LW
2687 esac
2688 ;;
aaacdc8b
GS
2689 bsd386) osname=bsd386
2690 osvers=`$uname -r`
2691 ;;
2692 cygwin*) osname=cygwin
2693 osvers="$3"
2694 ;;
23f87696
SZ
2695 *dc.osx) osname=dcosx
2696 osvers="$3"
2697 ;;
a0d0e21e
LW
2698 dnix) osname=dnix
2699 osvers="$3"
2700 ;;
2701 domainos) osname=apollo
2702 osvers="$3"
2703 ;;
2704 dgux) osname=dgux
2705 osvers="$3"
2706 ;;
760ac839 2707 dynixptx*) osname=dynixptx
e58e581d 2708 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2709 ;;
a0d0e21e
LW
2710 freebsd) osname=freebsd
2711 osvers="$3" ;;
2712 genix) osname=genix ;;
2713 hp*) osname=hpux
bfb7748a 2714 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2715 ;;
a78b0d02 2716 irix*) osname=irix
a0d0e21e
LW
2717 case "$3" in
2718 4*) osvers=4 ;;
2719 5*) osvers=5 ;;
ecfc5424 2720 *) osvers="$3" ;;
a0d0e21e
LW
2721 esac
2722 ;;
2723 linux) osname=linux
2724 case "$3" in
a0d0e21e
LW
2725 *) osvers="$3" ;;
2726 esac
2727 ;;
28e8609d
JH
2728 MiNT) osname=mint
2729 ;;
2730 netbsd*) osname=netbsd
ecfc5424
AD
2731 osvers="$3"
2732 ;;
4e81affe
MM
2733 news-os) osvers="$3"
2734 case "$3" in
2735 4*) osname=newsos4 ;;
2736 *) osname=newsos ;;
2737 esac
2738 ;;
aaacdc8b 2739 next*) osname=next ;;
28bb1e2c 2740 nonstop-ux) osname=nonstopux ;;
aaacdc8b
GS
2741 POSIX-BC | posix-bc ) osname=posix-bc
2742 osvers="$3"
a0d0e21e 2743 ;;
ae3afa4e
TH
2744 powerux | power_ux | powermax_os | powermaxos | \
2745 powerunix | power_unix) osname=powerux
2746 osvers="$3"
2747 ;;
aaacdc8b
GS
2748 qnx) osname=qnx
2749 osvers="$4"
2750 ;;
a0d0e21e
LW
2751 solaris) osname=solaris
2752 case "$3" in
2753 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2754 *) osvers="$3" ;;
a0d0e21e
LW
2755 esac
2756 ;;
85e6fe83
LW
2757 sunos) osname=sunos
2758 case "$3" in
85e6fe83
LW
2759 5*) osname=solaris
2760 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2761 *) osvers="$3" ;;
2304df62
AD
2762 esac
2763 ;;
a0d0e21e 2764 titanos) osname=titanos
85e6fe83 2765 case "$3" in
a0d0e21e
LW
2766 1*) osvers=1 ;;
2767 2*) osvers=2 ;;
2768 3*) osvers=3 ;;
2769 4*) osvers=4 ;;
ecfc5424 2770 *) osvers="$3" ;;
2304df62
AD
2771 esac
2772 ;;
85e6fe83 2773 ultrix) osname=ultrix
ecfc5424 2774 osvers="$3"
2304df62 2775 ;;
28757baa 2776 osf1|mls+) case "$5" in
fed7345c
AD
2777 alpha)
2778 osname=dec_osf
2aa76180
JH
2779 osvers=`sizer -v | awk '{print $3}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2780 case "$osvers" in
2781 [1-9].[0-9]*) ;;
2782 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2783 esac
ecfc5424
AD
2784 ;;
2785 hp*) osname=hp_osf1 ;;
2786 mips) osname=mips_osf1 ;;
85e6fe83
LW
2787 esac
2788 ;;
0337d152
BG
2789 unixware) osname=svr5
2790 osvers="$4"
2791 ;;
2792 uts) osname=uts
a0d0e21e
LW
2793 osvers="$3"
2794 ;;
85e6fe83 2795 $2) case "$osname" in
2304df62 2796 *isc*) ;;
a0d0e21e 2797 *freebsd*) ;;
5f05dabc 2798 svr*)
a0d0e21e
LW
2799 : svr4.x or possibly later
2800 case "svr$3" in
2801 ${osname}*)
2802 osname=svr$3
2803 osvers=$4
2804 ;;
2805 esac
2806 case "$osname" in
2807 svr4.0)
2808 : Check for ESIX
2809 if test -f /stand/boot ; then
2810 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2811 if test -n "$INITPROG" -a -f "$INITPROG"; then
2812 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2813 if test -n "$isesix"; then
a0d0e21e
LW
2814 osname=esix4
2815 fi
2816 fi
2817 fi
2818 ;;
2819 esac
2820 ;;
2304df62 2821 *) if test -f /etc/systemid; then
a0d0e21e
LW
2822 osname=sco
2823 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2824 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2825 osvers=$1.$2.$3
c4f23d77 2826 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2827 osvers=$1.$2
c4f23d77 2828 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2829 osvers=$1
2304df62 2830 fi
a0d0e21e
LW
2831 else
2832 case "$osname" in
2833 '') : Still unknown. Probably a generic Sys V.
2834 osname="sysv"
2835 osvers="$3"
2836 ;;
2837 esac
2304df62
AD
2838 fi
2839 ;;
2840 esac
2841 ;;
a0d0e21e
LW
2842 *) case "$osname" in
2843 '') : Still unknown. Probably a generic BSD.
2844 osname="$1"
2845 osvers="$3"
2846 ;;
2847 esac
2848 ;;
2304df62
AD
2849 esac
2850 else
dfe9444c
AD
2851 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2852 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2853 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2854 osname=news_os
2304df62 2855 fi
dfe9444c 2856 $rm -f UU/kernel.what
8e07c86e
AD
2857 elif test -d c:/.; then
2858 set X $myuname
2859 osname=os2
2860 osvers="$5"
2304df62
AD
2861 fi
2862 fi
85e6fe83 2863
5440bc8e
JH
2864 case "$targetarch" in
2865 '') ;;
2866 *) hostarch=$osname
2867 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
2868 osvers=''
2869 ;;
2870 esac
2871
a0d0e21e
LW
2872 : Now look for a hint file osname_osvers, unless one has been
2873 : specified already.
2874 case "$hintfile" in
2875 ''|' ')
1e127011 2876 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 2877 : Also try without trailing minor version numbers.
1e127011
DD
2878 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2879 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2880 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2881 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
2882 case "$file" in
2883 '') dflt=none ;;
2884 *) case "$osvers" in
2885 '') dflt=$file
2886 ;;
dfe9444c 2887 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 2888 dflt=$file
dfe9444c 2889 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 2890 dflt=$xfile
dfe9444c 2891 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 2892 dflt=$xxfile
dfe9444c 2893 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 2894 dflt=$xxxfile
dfe9444c 2895 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 2896 dflt=$xxxxfile
dfe9444c 2897 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
2898 dflt="${osname}"
2899 else
2900 dflt=none
2901 fi
2902 ;;
2903 esac
85e6fe83
LW
2904 ;;
2905 esac
4e2a5f63
AD
2906 if $test -f Policy.sh ; then
2907 case "$dflt" in
2908 *Policy*) ;;
2909 none) dflt="Policy" ;;
2910 *) dflt="Policy $dflt" ;;
2911 esac
2912 fi
85e6fe83 2913 ;;
a0d0e21e 2914 *)
ecfc5424 2915 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 2916 ;;
2304df62 2917 esac
1aef975c 2918
4e2a5f63
AD
2919 if $test -f Policy.sh ; then
2920 $cat <<EOM
2921
2922There's also a Policy hint file available, which should make the
2923site-specific (policy) questions easier to answer.
2924EOM
2925
2926 fi
2927
2304df62
AD
2928 $cat <<EOM
2929
2930You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 2931A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 2932is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
2933
2934EOM
4e2a5f63 2935
2304df62 2936 rp="Which of these apply, if any?"
dfe9444c 2937 . UU/myread
85e6fe83
LW
2938 tans=$ans
2939 for file in $tans; do
4e2a5f63
AD
2940 if $test X$file = XPolicy -a -f Policy.sh; then
2941 . Policy.sh
2942 $cat Policy.sh >> UU/config.sh
2943 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
2944 . $src/hints/$file.sh
2945 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 2946 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
2947 : nothing
2948 else
85e6fe83
LW
2949 : Give one chance to correct a possible typo.
2950 echo "$file.sh does not exist"
2951 dflt=$file
2952 rp="hint to use instead?"
dfe9444c 2953 . UU/myread
85e6fe83 2954 for file in $ans; do
dfe9444c
AD
2955 if $test -f "$src/hints/$file.sh"; then
2956 . $src/hints/$file.sh
2957 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
2958 elif $test X$ans = X -o X$ans = Xnone ; then
2959 : nothing
2960 else
2961 echo "$file.sh does not exist -- ignored."
2962 fi
2963 done
2304df62
AD
2964 fi
2965 done
85e6fe83 2966
2304df62 2967 hint=recommended
85e6fe83 2968 : Remember our hint file for later.
dfe9444c 2969 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 2970 hintfile="$file"
85e6fe83 2971 else
a0d0e21e 2972 hintfile=''
85e6fe83 2973 fi
2304df62
AD
2974fi
2975cd UU
2976;;
2977*)
2978 echo " "
2979 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
2980 tmp_n="$n"
2981 tmp_c="$c"
2304df62
AD
2982 cd ..
2983 cp $config_sh config.sh 2>/dev/null
a78b0d02 2984 chmod +w config.sh
2304df62
AD
2985 . ./config.sh
2986 cd UU
2987 cp ../config.sh .
ecfc5424
AD
2988 n="$tmp_n"
2989 c="$tmp_c"
2304df62
AD
2990 hint=previous
2991 ;;
2992esac
1aef975c 2993test "$override" && . ./optdef.sh
2304df62
AD
2994
2995: Restore computed paths
2996for file in $loclist $trylist; do
2997 eval $file="\$_$file"
2998done
2999
85e6fe83 3000cat << EOM
a0d0e21e 3001
85e6fe83 3002Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3003The default value is probably right if the name rings a bell. Otherwise,
3004since spelling matters for me, either accept the default or answer "none"
3005to leave it blank.
a0d0e21e 3006
85e6fe83 3007EOM
85e6fe83 3008case "$osname" in
a0d0e21e 3009 ''|' ')
85e6fe83 3010 case "$hintfile" in
a0d0e21e 3011 ''|' '|none) dflt=none ;;
ecfc5424 3012 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3013 esac
3014 ;;
3015 *) dflt="$osname" ;;
3016esac
3017rp="Operating system name?"
3018. ./myread
3019case "$ans" in
ecfc5424
AD
3020none) osname='' ;;
3021*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3022esac
8ff267be 3023echo " "
3024case "$osvers" in
3025 ''|' ')
3026 case "$hintfile" in
3027 ''|' '|none) dflt=none ;;
3028 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3029 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3030 case "$dflt" in
3031 ''|' ') dflt=none ;;
3032 esac
3033 ;;
3034 esac
3035 ;;
3036 *) dflt="$osvers" ;;
3037esac
3038rp="Operating system version?"
3039. ./myread
3040case "$ans" in
3041none) osvers='' ;;
3042*) osvers="$ans" ;;
3043esac
3044
02e93a22
JH
3045
3046. ./posthint.sh
3047
2304df62 3048: who configured the system
59b83a6f 3049cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 3050cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
3051case "$cf_by" in
3052"")
8ff267be 3053 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
3054 case "$cf_by" in
3055 "") cf_by=unknown ;;
8ff267be 3056 esac ;;
3057esac
2304df62 3058
b4eb6b3d
JH
3059: set up the script used to warn in case of inconsistency
3060cat <<EOS >whoa
3061$startsh
3062EOS
3063cat <<'EOSC' >>whoa
3064dflt=y
3065echo " "
3066echo "*** WHOA THERE!!! ***" >&4
3067echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3068rp=" Keep the $hint value?"
3069. ./myread
3070case "$ans" in
3071y) td=$was; tu=$was;;
3072esac
3073EOSC
3074
3075: function used to set $1 to $val
3076setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3077case "$val$was" in
3078$define$undef) . ./whoa; eval "$var=\$td";;
3079$undef$define) . ./whoa; eval "$var=\$tu";;
3080*) eval "$var=$val";;
3081esac'
3082
3083case "$usethreads" in
3084$define|true|[yY]*) dflt='y';;
3085*) dflt='n';;
3086esac
3087cat <<EOM
3088
3089Perl can be built to take advantage of threads on some systems.
3090To do so, Configure can be run with -Dusethreads.
3091
3092Note that threading is a highly experimental feature, and
3093some known race conditions still remain. If you choose to try
3094it, be very sure to not actually deploy it for production
3095purposes. README.threads has more details, and is required
3096reading if you enable threads.
3097
3098If this doesn't make any sense to you, just accept the default '$dflt'.
3099EOM
3100rp='Build a threading Perl?'
3101. ./myread
3102case "$ans" in
3103y|Y) val="$define" ;;
3104*) val="$undef" ;;
3105esac
3106set usethreads
3107eval $setvar
3108
3109case "$usethreads" in
3110$define)
3111 $cat <<EOM
3112
3113As of 5.5.640, Perl has two different internal threading implementations,
3114the 5.005 version (5005threads) and an interpreter-based version
3115(ithreads) that has one interpreter per thread. Both are very
3116experimental. This arrangement exists to help developers work out
3117which one is better.
3118
3119If you're a casual user, you probably don't want interpreter-threads
3120at this time. There doesn't yet exist a way to create threads from
3121within Perl in this model, i.e., "use Thread;" will NOT work.
3122EOM
3123 : Default to ithreads unless overridden on command line or with
3124 : old config.sh
3125 dflt='y'
3126 case "$use5005threads" in
3127 $define|true|[yY]*) dflt='n';;
3128 esac
3129 case "$useithreads" in
3130 $undef|false|[nN]*) dflt='n';;
3131 esac
3132 rp='Use interpreter-based ithreads?'
3133 . ./myread
3134 case "$ans" in
3135 y|Y) val="$define" ;;
3136 *) val="$undef" ;;
3137 esac
3138 set useithreads
3139 eval $setvar
3140 : Now set use5005threads to the opposite value.
3141 case "$useithreads" in
3142 $define) val="$undef" ;;
3143 *) val="$define" ;;
3144 esac
3145 set use5005threads
3146 eval $setvar
3147 ;;
3148*)
3149 useithreads="$undef"
3150 use5005threads="$undef"
3151 ;;
3152esac
3153
c915ce7f
JH
3154case "$useithreads$use5005threads" in
3155"$define$define")
3156 $cat >&4 <<EOM
3157
3158You cannot have both the ithreads and the 5.005 threads enabled
3159at the same time. Disabling the 5.005 threads since they are
3160much less stable than the ithreads.
3161
3162EOM
3163 use5005threads="$undef"
3164 ;;
3165esac
3166
b4eb6b3d
JH
3167case "$d_oldpthreads" in
3168'') : Configure tests would be welcome here. For now, assume undef.
3169 val="$undef" ;;
3170*) val="$d_oldpthreads" ;;
3171esac
3172set d_oldpthreads
3173eval $setvar
3174
3175
3176case "$usethreads" in
3177"$define"|true|[yY]*)
3178: Look for a hint-file generated 'call-back-unit'. If the
3179: user has specified that a threading perl is to be built,
3180: we may need to set or change some other defaults.
3181 if $test -f usethreads.cbu; then
3182 echo "Your platform has some specific hints for threaded builds, using them..."
3183 . ./usethreads.cbu
3184 else
3185 $cat <<EOM
3186(Your platform doesn't have any specific hints for threaded builds.
3187 Assuming POSIX threads, then.)
3188EOM
3189 fi
3190 ;;
3191esac
3192
3193cat <<EOM
3194
3195Perl can be built so that multiple Perl interpreters can coexist
3196within the same Perl executable.
3197EOM
3198
3199case "$useithreads" in
3200$define)
3201 cat <<EOM
3202This multiple interpreter support is required for interpreter-based threads.
3203EOM
3204 val="$define"
3205 ;;
3206*) case "$usemultiplicity" in
3207 $define|true|[yY]*) dflt='y';;
3208 *) dflt='n';;
3209 esac
3210 echo " "
3211 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3212 rp='Build Perl for multiplicity?'
3213 . ./myread
3214 case "$ans" in
3215 y|Y) val="$define" ;;
3216 *) val="$undef" ;;
3217 esac
3218 ;;
3219esac
3220set usemultiplicity
3221eval $setvar
3222
e5e20432
JH
3223: make some quick guesses about what we are up against
3224echo " "
3225$echo $n "Hmm... $c"
3226echo exit 1 >bsd
3227echo exit 1 >usg
3228echo exit 1 >v7
3229echo exit 1 >osf1
3230echo exit 1 >eunice
3231echo exit 1 >xenix
3232echo exit 1 >venix
3233echo exit 1 >os2
3234d_bsd="$undef"
3235$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3236if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3237then
3238 echo "Looks kind of like an OSF/1 system, but we'll see..."
3239 echo exit 0 >osf1
381aa1ff 3240elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3241 xxx=`./loc addbib blurfl $pth`
3242 if $test -f $xxx; then
3243 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3244 echo exit 0 >bsd
3245 echo exit 0 >usg
3246 else
3247 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3248 echo "Looks kind of like an extended USG system, but we'll see..."
3249 else
3250 echo "Looks kind of like a USG system, but we'll see..."
3251 fi
3252 echo exit 0 >usg
3253 fi
3254elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3255 echo "Looks kind of like a BSD system, but we'll see..."
3256 d_bsd="$define"
3257 echo exit 0 >bsd
3258else
3259 echo "Looks kind of like a Version 7 system, but we'll see..."
3260 echo exit 0 >v7
3261fi
3262case "$eunicefix" in
3263*unixtovms*)
3264 $cat <<'EOI'
3265There is, however, a strange, musty smell in the air that reminds me of
3266something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3267EOI
3268 echo exit 0 >eunice
3269 d_eunice="$define"
3270: it so happens the Eunice I know will not run shell scripts in Unix format
3271 ;;
3272*)
3273 echo " "
3274 echo "Congratulations. You aren't running Eunice."
3275 d_eunice="$undef"
3276 ;;
3277esac
3278: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3279: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3280: semicolon as a patch separator
e5e20432
JH
3281case "$p_" in
3282:) ;;
3283*)
3284 $cat <<'EOI'
3285I have the feeling something is not exactly right, however...don't tell me...
3286lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3287(Or you may be running DOS with DJGPP.)
e5e20432
JH
3288EOI
3289 echo exit 0 >os2
3290 ;;
3291esac
3292if test -f /xenix; then
3293 echo "Actually, this looks more like a XENIX system..."
3294 echo exit 0 >xenix
3295 d_xenix="$define"
3296else
3297 echo " "
3298 echo "It's not Xenix..."
3299 d_xenix="$undef"
3300fi
3301chmod +x xenix
3302$eunicefix xenix
3303if test -f /venix; then
3304 echo "Actually, this looks more like a VENIX system..."
3305 echo exit 0 >venix
3306else
3307 echo " "
3308 if ./xenix; then
3309 : null
3310 else
3311 echo "Nor is it Venix..."
3312 fi
3313fi
3314chmod +x bsd usg v7 osf1 eunice xenix venix os2
3315$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3316$rm -f foo
3317
5869b1f1
JH
3318case "$cc" in
3319'') dflt=cc;;
3320*) dflt="$cc";;
3321esac
3322rp="Use which C compiler?"
3323. ./myread
3324cc="$ans"
e5e20432
JH
3325: Look for a hint-file generated 'call-back-unit'. Now that the
3326: user has specified the compiler, we may need to set or change some
3327: other defaults.
3328if $test -f cc.cbu; then
3329 . ./cc.cbu
3330fi
2573c5f9 3331. ./checkcc
8a27cf78 3332
e5e20432
JH
3333echo " "
3334echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 3335$cat >try.c <<EOM
e5e20432
JH
3336#include <stdio.h>
3337int main() {
3338#ifdef __GNUC__
3339#ifdef __VERSION__
3340 printf("%s\n", __VERSION__);
3341#else
3342 printf("%s\n", "1");
3343#endif
3344#endif
3345 exit(0);
3346}
3347EOM
5440bc8e
JH
3348if $cc -o try $ccflags $ldflags try.c; then
3349 gccversion=`$run ./try`
e5e20432
JH
3350 case "$gccversion" in
3351 '') echo "You are not using GNU cc." ;;
fc68435e 3352 *) echo "You are using GNU cc $gccversion."
e723fc21 3353 ccname=gcc
fc68435e 3354 ;;
e5e20432
JH
3355 esac
3356else
3357 echo " "
3358 echo "*** WHOA THERE!!! ***" >&4
3359 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3360 case "$knowitall" in
3361 '')
3362 echo " You'd better start hunting for one and let me know about it." >&4
3363 exit 1
3364 ;;
3365 esac
3366fi
5440bc8e 3367$rm -f try try.*
e5e20432
JH
3368case "$gccversion" in
33691*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3370esac
5b463ca7
KS
3371case "$gccversion" in
3372'') gccosandvers='' ;;
10b4ebb5
JH
3373*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3374 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3375 gccshortvers=''
5b463ca7 3376 case "$gccosandvers" in
02903077
JH
3377 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3378 $osname$osvers) ;; # looking good
5b463ca7
KS
3379 $osname*) cat <<EOM >&4
3380
3381*** WHOA THERE!!! ***
3382
3383 Your gcc has not been compiled for the exact release of
3384 your operating system ($gccosandvers versus $osname$osvers).
3385
3386 In general it is a good idea to keep gcc synchronized with
3387 the operating system because otherwise serious problems
3388 may ensue when trying to compile software, like Perl.
3389
3390 I'm trying to be optimistic here, though, and will continue.
3391 If later during the configuration and build icky compilation
02903077
JH
3392 problems appear (headerfile conflicts being the most common
3393 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3394 your operating system release.
3395
3396EOM
3397 ;;
81575342 3398 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3399 esac
3400 ;;
3401esac
e723fc21
JH
3402case "$ccname" in
3403'') ccname="$cc" ;;
3404esac
e5e20432 3405
640374d0
JH
3406case "$gccversion" in
3407'') ;;
3408*) case "$ccflags" in
3409 *-Wall*) ;;
a126002e 3410 *) ccflags="$ccflags -Wall" ;;
640374d0
JH
3411 esac
3412 ;;
3413esac
3414
8a27cf78
JH
3415: see how we invoke the C preprocessor
3416echo " "
3417echo "Now, how can we feed standard input to your C preprocessor..." >&4
3418cat <<'EOT' >testcpp.c
3419#define ABC abc
3420#define XYZ xyz
3421ABC.XYZ
3422EOT
3423cd ..
3424if test ! -f cppstdin; then
3425 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3426 # AIX cc -E doesn't show the absolute headerfile
3427 # locations but we'll cheat by using the -M flag.
3428 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
3429 else
3430 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3431 fi
3432else
3433 echo "Keeping your $hint cppstdin wrapper."
3434fi
3435chmod 755 cppstdin
3436wrapper=`pwd`/cppstdin
3437ok='false'
3438cd UU
3439
3440if $test "X$cppstdin" != "X" && \
3441 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3442 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3443then
3444 echo "You used to use $cppstdin $cppminus so we'll use that again."
3445 case "$cpprun" in
3446 '') echo "But let's see if we can live without a wrapper..." ;;
3447 *)
3448 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3449 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3450 then
3451 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3452 ok='true'
3453 else
3454 echo "(However, $cpprun $cpplast does not work, let's see...)"
3455 fi
3456 ;;
3457 esac
3458else
3459 case "$cppstdin" in
3460 '') ;;
3461 *)
3462 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3463 ;;
3464 esac
3465fi
3466
3467if $ok; then
3468 : nothing
3469elif echo 'Maybe "'"$cc"' -E" will work...'; \
3470 $cc -E <testcpp.c >testcpp.out 2>&1; \
3471 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3472 echo "Yup, it does."
3473 x_cpp="$cc -E"
3474 x_minus='';
3475elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3476 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3477 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3478 echo "Yup, it does."
3479 x_cpp="$cc -E"
3480 x_minus='-';
3481elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3482 $cc -P <testcpp.c >testcpp.out 2>&1; \
3483 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3484 echo "Yipee, that works!"
3485 x_cpp="$cc -P"
3486 x_minus='';
3487elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3488 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3489 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3490 echo "At long last!"
3491 x_cpp="$cc -P"
3492 x_minus='-';
3493elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3494 $cpp <testcpp.c >testcpp.out 2>&1; \
3495 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3496 echo "It works!"
3497 x_cpp="$cpp"
3498 x_minus='';
3499elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3500 $cpp - <testcpp.c >testcpp.out 2>&1; \
3501 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3502 echo "Hooray, it works! I was beginning to wonder."
3503 x_cpp="$cpp"
3504 x_minus='-';
3505elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3506 $wrapper <testcpp.c >testcpp.out 2>&1; \
3507 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3508 x_cpp="$wrapper"
3509 x_minus=''
3510 echo "Eureka!"
3511else
3512 dflt=''
3513 rp="No dice. I can't find a C preprocessor. Name one:"
3514 . ./myread
3515 x_cpp="$ans"
3516 x_minus=''
3517 $x_cpp <testcpp.c >testcpp.out 2>&1
3518 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3519 echo "OK, that will do." >&4
3520 else
3521echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3522 exit 1
3523 fi
3524fi
3525
3526case "$ok" in
3527false)
3528 cppstdin="$x_cpp"
3529 cppminus="$x_minus"
3530 cpprun="$x_cpp"
3531 cpplast="$x_minus"
3532 set X $x_cpp
3533 shift
3534 case "$1" in
3535 "$cpp")
3536 echo "Perhaps can we force $cc -E using a wrapper..."
3537 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3538 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3539 then
3540 echo "Yup, we can."
3541 cppstdin="$wrapper"
3542 cppminus='';
3543 else
3544 echo "Nope, we'll have to live without it..."
3545 fi
3546 ;;
3547 esac
3548 case "$cpprun" in
3549 "$wrapper")
3550 cpprun=''
3551 cpplast=''
3552 ;;
3553 esac
3554 ;;
3555esac
3556
3557case "$cppstdin" in
3558"$wrapper"|'cppstdin') ;;
3559*) $rm -f $wrapper;;
3560esac
3561$rm -f testcpp.c testcpp.out
3562
bd9b35c9
JH
3563: decide how portable to be. Allow command line overrides.
3564case "$d_portable" in
3565"$undef") ;;
3566*) d_portable="$define" ;;
104d25b7 3567esac
85ab1d1d 3568
bd9b35c9
JH
3569: set up shell script to do ~ expansion
3570cat >filexp <<EOSS
3571$startsh
3572: expand filename
3573case "\$1" in
3574 ~/*|~)
3575 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3576 ;;
3577 ~*)
3578 if $test -f /bin/csh; then
3579 /bin/csh -f -c "glob \$1"
3580 failed=\$?
3581 echo ""
3582 exit \$failed
e5e20432 3583 else
bd9b35c9
JH
3584 name=\`$expr x\$1 : '..\([^/]*\)'\`
3585 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3586 if $test ! -d "\$dir"; then
3587 me=\`basename \$0\`
3588 echo "\$me: can't locate home directory for: \$name" >&2
3589 exit 1
3590 fi
3591 case "\$1" in
3592 */*)
3593 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3594 ;;
3595 *)
3596 echo \$dir
e5e20432
JH
3597 ;;
3598 esac
3599 fi
b691c02f 3600 ;;
4633a7c4 3601*)
bd9b35c9 3602 echo \$1
2304df62
AD
3603 ;;
3604esac
4633a7c4
LW
3605EOSS
3606chmod +x filexp
3607$eunicefix filexp
2304df62
AD
3608
3609: now set up to get a file name
28757baa 3610cat <<EOS >getfile
3611$startsh
3612EOS
3613cat <<'EOSC' >>getfile
2304df62
AD
3614tilde=''
3615fullpath=''
3616already=''
3617skip=''
3618none_ok=''
3619exp_file=''
a0d0e21e 3620nopath_ok=''
2304df62
AD
3621orig_rp="$rp"
3622orig_dflt="$dflt"
b233458b
JH
3623case "$gfpth" in
3624'') gfpth='.' ;;
3625esac
2304df62
AD
3626
3627case "$fn" in
ecfc5424 3628*\(*)
381aa1ff 3629 expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
3630 fn=`echo $fn | sed 's/(.*)//'`
3631 ;;
3632esac
3633
3634case "$fn" in
a0d0e21e
LW
3635*:*)
3636 loc_file=`expr $fn : '.*:\(.*\)'`
3637 fn=`expr $fn : '\(.*\):.*'`
3638 ;;
3639esac
3640
3641case "$fn" in
2304df62
AD
3642*~*) tilde=true;;
3643esac
3644case "$fn" in
3645*/*) fullpath=true;;
3646esac
3647case "$fn" in
3648*+*) skip=true;;
3649esac
3650case "$fn" in
3651*n*) none_ok=true;;
3652esac
3653case "$fn" in
3654*e*) exp_file=true;;
3655esac
a0d0e21e
LW
3656case "$fn" in
3657*p*) nopath_ok=true;;
3658esac
2304df62
AD
3659
3660case "$fn" in
3661*f*) type='File';;
3662*d*) type='Directory';;
a0d0e21e 3663*l*) type='Locate';;
2304df62
AD
3664esac
3665
3666what="$type"
3667case "$what" in
3668Locate) what='File';;
3669esac
3670
3671case "$exp_file" in
3672'')
3673 case "$d_portable" in
3674 "$define") ;;
3675 *) exp_file=true;;
3676 esac
3677 ;;
3678esac
3679
3680cd ..
3681while test "$type"; do
3682 redo=''
3683 rp="$orig_rp"
3684 dflt="$orig_dflt"
3685 case "$tilde" in
3686 true) rp="$rp (~name ok)";;
3687 esac
3688 . UU/myread
ecfc5424
AD
3689 if test -f UU/getfile.ok && \
3690 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3691 then
3692 value="$ans"
3693 ansexp="$ans"
3694 break
3695 fi
2304df62
AD
3696 case "$ans" in
3697 none)
3698 value=''
3699 ansexp=''
3700 case "$none_ok" in
3701 true) type='';;
3702 esac
3703 ;;
3704 *)
3705 case "$tilde" in
3706 '') value="$ans"
3707 ansexp="$ans";;
3708 *)
3709 value=`UU/filexp $ans`
3710 case $? in
3711 0)
3712 if test "$ans" != "$value"; then
ecfc5424 3713 echo "(That expands to $value on this system.)"
2304df62
AD
3714 fi
3715 ;;
3716 *) value="$ans";;
3717 esac
3718 ansexp="$value"
3719 case "$exp_file" in
3720 '') value="$ans";;
3721 esac
3722 ;;
3723 esac
3724 case "$fullpath" in
3725 true)
3726 case "$ansexp" in
3727 /*) value="$ansexp" ;;
23da6c43 3728 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
3729 *)
3730 redo=true
3731 case "$already" in
3732 true)
3733 echo "I shall only accept a full path name, as in /bin/ls." >&4
3734 echo "Use a ! shell escape if you wish to check pathnames." >&4
3735 ;;
3736 *)
3737 echo "Please give a full path name, starting with slash." >&4
3738 case "$tilde" in
3739 true)
3740 echo "Note that using ~name is ok provided it expands well." >&4
3741 already=true
3742 ;;
3743 esac
3744 esac
3745 ;;
3746 esac
3747 ;;
3748 esac
3749 case "$redo" in
3750 '')
3751 case "$type" in
3752 File)
b233458b
JH
3753 for fp in $gfpth; do
3754 if test "X$fp" = X.; then
3755 pf="$ansexp"
3756 else
3757 pf="$fp/$ansexp"
3758 fi
3759 if test -f "$pf"; then
3760 type=''
3761 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3762 then
3763 echo "($value is not a plain file, but that's ok.)"
3764 type=''
3765 fi
3766 if test X"$type" = X; then
3767 value="$pf"
3768 break
3769 fi
3770 done
2304df62
AD
3771 ;;
3772 Directory)
b233458b
JH
3773 for fp in $gfpth; do
3774 if test "X$fp" = X.; then
f78bfc9c
JH
3775 dir="$ans"
3776 direxp="$ansexp"
b233458b 3777 else
dd858076 3778 dir="$fp/$ansexp"
f78bfc9c 3779 direxp="$fp/$ansexp"
b233458b 3780 fi
f78bfc9c 3781 if test -d "$direxp"; then
b233458b 3782 type=''
f78bfc9c 3783 value="$dir"
b233458b
JH
3784 break
3785 fi
3786 done
2304df62
AD
3787 ;;
3788 Locate)
40000a8c 3789 if test -d "$ansexp"; then
a0d0e21e
LW
3790 echo "(Looking for $loc_file in directory $value.)"
3791 value="$value/$loc_file"
40000a8c 3792 ansexp="$ansexp/$loc_file"
2304df62 3793 fi
40000a8c 3794 if test -f "$ansexp"; then
2304df62
AD
3795 type=''
3796 fi
a0d0e21e
LW
3797 case "$nopath_ok" in
3798 true) case "$value" in
3799 */*) ;;
3800 *) echo "Assuming $value will be in people's path."
3801 type=''
3802 ;;
3803 esac
3804 ;;
3805 esac
2304df62
AD
3806 ;;
3807 esac
3808
3809 case "$skip" in
3810 true) type='';
3811 esac
3812
3813 case "$type" in
3814 '') ;;
3815 *)
3816 if test "$fastread" = yes; then
3817 dflt=y
3818 else
3819 dflt=n
3820 fi
3821 rp="$what $value doesn't exist. Use that name anyway?"
3822 . UU/myread
3823 dflt=''
3824 case "$ans" in
3825 y*) type='';;
3826 *) echo " ";;
3827 esac
3828 ;;
3829 esac
3830 ;;
3831 esac
3832 ;;
3833 esac
3834done
3835cd UU
3836ans="$value"
3837rp="$orig_rp"
3838dflt="$orig_dflt"
ecfc5424 3839rm -f getfile.ok
b233458b 3840test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3841EOSC
3842
bd9b35c9
JH
3843: What should the include directory be ?
3844echo " "
3845$echo $n "Hmm... $c"
3846dflt='/usr/include'
3847incpath=''
3848mips_type=''
3849if $test -f /bin/mips && /bin/mips; then
3850 echo "Looks like a MIPS system..."
3851 $cat >usr.c <<'EOCP'
3852#ifdef SYSTYPE_BSD43
3853/bsd43
3854#endif
3855EOCP
8a27cf78 3856 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
3857 dflt='/bsd43/usr/include'
3858 incpath='/bsd43'
3859 mips_type='BSD 4.3'
3860 else
3861 mips_type='System V'
3862 fi
3863 $rm -f usr.c usr.out
3864 echo "and you're compiling with the $mips_type compiler and libraries."
3865 xxx_prompt=y
3866 echo "exit 0" >mips
3867else
3868 echo "Doesn't look like a MIPS system."
3869 xxx_prompt=n
3870 echo "exit 1" >mips
3871fi
3872chmod +x mips
3873$eunicefix mips
3874case "$usrinc" in
3875'') ;;
3876*) dflt="$usrinc";;
3877esac
3878case "$xxx_prompt" in
3879y) fn=d/
3880 echo " "
3881 rp='Where are the include files you want to use?'
3882 . ./getfile
3883 usrinc="$ans"
8e07c86e 3884 ;;
bd9b35c9 3885*) usrinc="$dflt"
8e07c86e
AD
3886 ;;
3887esac
2304df62 3888
bd9b35c9
JH
3889: Set private lib path
3890case "$plibpth" in
3891'') if ./mips; then
3892 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3893 fi;;
3894esac
3895case "$libpth" in
3896' ') dlist='';;
3897'') dlist="$loclibpth $plibpth $glibpth";;
3898*) dlist="$libpth";;
3899esac
3900
3901: Now check and see which directories actually exist, avoiding duplicates
3902libpth=''
3903for xxx in $dlist
3904do
3905 if $test -d $xxx; then
3906 case " $libpth " in
3907 *" $xxx "*) ;;
3908 *) libpth="$libpth $xxx";;
3909 esac
3910 fi
3911done
3912$cat <<'EOM'
3913
3914Some systems have incompatible or broken versions of libraries. Among
3915the directories listed in the question below, please remove any you
3916know not to be holding relevant libraries, and add any that are needed.
3917Say "none" for none.
8e07c86e
AD
3918
3919EOM
bd9b35c9
JH
3920case "$libpth" in
3921'') dflt='none';;
8e07c86e 3922*)
bd9b35c9
JH
3923 set X $libpth
3924 shift
3925 dflt=${1+"$@"}
8e07c86e 3926 ;;
a0d0e21e 3927esac
bd9b35c9
JH
3928rp="Directories to use for library searches?"
3929. ./myread
3930case "$ans" in
3931none) libpth=' ';;
3932*) libpth="$ans";;
3933esac
a0d0e21e 3934
bd9b35c9
JH
3935: compute shared library extension
3936case "$so" in
3937'')
3938 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3939 dflt='sl'
dd4e71fd 3940 else
bd9b35c9 3941 dflt='so'
dd4e71fd
JH
3942 fi
3943 ;;
bd9b35c9 3944*) dflt="$so";;
dd4e71fd 3945esac
dd4e71fd
JH
3946$cat <<EOM
3947
bd9b35c9 3948On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 3949you want to suppress searching of shared libraries for the remainder
bd9b35c9 3950of this configuration.
dd4e71fd
JH
3951
3952EOM
bd9b35c9
JH
3953rp='What is the file extension used for shared libraries?'
3954. ./myread
3955so="$ans"
dd4e71fd 3956
bd9b35c9
JH
3957: Define several unixisms.
3958: Hints files or command line option can be used to override them.
3959: The convoluted testing is in case hints files set either the old
3960: or the new name.
3961case "$_exe" in
3962'') case "$exe_ext" in
3963 '') ;;
3964 *) _exe="$exe_ext" ;;
dd4e71fd 3965 esac
bd9b35c9 3966 ;;
bfb7748a 3967esac
bd9b35c9
JH
3968case "$_a" in
3969'') case "$lib_ext" in
3970 '') _a='.a';;
3971 *) _a="$lib_ext" ;;
dd4e71fd
JH
3972 esac
3973 ;;
dd4e71fd 3974esac
bd9b35c9
JH
3975case "$_o" in
3976'') case "$obj_ext" in
3977 '') _o='.o';;
3978 *) _o="$obj_ext";;
3979 esac
3980 ;;
3981esac
3982case "$p_" in
3983'') case "$path_sep" in
3984 '') p_=':';;
3985 *) p_="$path_sep";;
3986 esac
3987 ;;
3988esac
3989exe_ext=$_exe
3990lib_ext=$_a
3991obj_ext=$_o
3992path_sep=$p_
dd4e71fd 3993
b4eb6b3d
JH
3994: Which makefile gets called first. This is used by make depend.
3995case "$firstmakefile" in
3996'') firstmakefile='makefile';;
4633a7c4 3997esac
4633a7c4 3998
0f0995ae
JH
3999case "$usesocks" in
4000$define|true|[yY]*) dflt='y';;
4001*) dflt='n';;
4002esac
bd9b35c9 4003cat <<EOM
4633a7c4 4004
bd9b35c9 4005Perl can be built to use the SOCKS proxy protocol library. To do so,
cf829ab0
JH
4006Configure must be run with -Dusesocks. If you use SOCKS you also need
4007to use the PerlIO abstraction layer, this will be implicitly selected.
4633a7c4 4008
0f0995ae 4009If this doesn't make any sense to you, just accept the default '$dflt'.
bd9b35c9 4010EOM
bd9b35c9
JH
4011rp='Build Perl for SOCKS?'
4012. ./myread
4013case "$ans" in
4014y|Y) val="$define" ;;
4015*) val="$undef" ;;
4016esac
4017set usesocks
4018eval $setvar
4019
cf829ab0
JH
4020case "$usesocks" in
4021$define|true|[yY]*) useperlio="$define";;
4022esac
4023
bd9b35c9
JH
4024: Looking for optional libraries
4025echo " "
4026echo "Checking for optional libraries..." >&4
4027case "$libs" in
4028' '|'') dflt='';;
4029*) dflt="$libs";;
4030esac
4031case "$libswanted" in
4032'') libswanted='c_s';;
4033esac
4034case "$usesocks" in
923fc586 4035"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4036esac
68435ea7
JH
4037libsfound=''
4038libsfiles=''
4039libsdirs=''
13b3f787
JH
4040libspath=''
4041for thisdir in $libpth $xlibpth; do
4042 test -d $thisdir && libspath="$libspath $thisdir"
4043done
bd9b35c9 4044for thislib in $libswanted; do
13b3f787 4045 for thisdir in $libspath; do
f7dd4e7f
JH
4046 xxx=''
4047 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4048 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
4049 $test -f "$xxx" && eval $libscheck
4050 $test -f "$xxx" && libstyle=shared
4051 fi
4052 if test ! -f "$xxx"; then
4053 xxx=$thisdir/lib$thislib.$so
4054 $test -f "$xxx" && eval $libscheck
4055 $test -f "$xxx" && libstyle=shared
4056 fi
4057 if test ! -f "$xxx"; then
4058 xxx=$thisdir/lib$thislib$_a
4059 $test -f "$xxx" && eval $libscheck
4060 $test -f "$xxx" && libstyle=static
4061 fi
4062 if test ! -f "$xxx"; then
4063 xxx=$thisdir/$thislib$_a
4064 $test -f "$xxx" && eval $libscheck
4065 $test -f "$xxx" && libstyle=static
4066 fi
4067 if test ! -f "$xxx"; then
4068 xxx=$thisdir/lib${thislib}_s$_a
4069 $test -f "$xxx" && eval $libscheck
4070 $test -f "$xxx" && libstyle=static
09ea5ba9 4071 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4072 fi
4073 if test ! -f "$xxx"; then
4074 xxx=$thisdir/Slib$thislib$_a
4075 $test -f "$xxx" && eval $libscheck
4076 $test -f "$xxx" && libstyle=static
4077 fi
4078 if $test -f "$xxx"; then
43999f95 4079 case "$libstyle" in
f7dd4e7f
JH
4080 shared) echo "Found -l$thislib (shared)." ;;
4081 static) echo "Found -l$thislib." ;;
4082 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4083 esac
bd9b35c9
JH
4084 case " $dflt " in
4085 *"-l$thislib "*);;
f7dd4e7f 4086 *) dflt="$dflt -l$thislib"
43999f95
JH
4087 libsfound="$libsfound $xxx"
4088 yyy=`basename $xxx`
4089 libsfiles="$libsfiles $yyy"
1e127011 4090 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4091 case " $libsdirs " in
4092 *" $yyy "*) ;;
4093 *) libsdirs="$libsdirs $yyy" ;;
4094 esac
4095 ;;
bd9b35c9 4096 esac
f7dd4e7f
JH
4097 break
4098 fi
4099 done
4100 if $test ! -f "$xxx"; then
4101 echo "No -l$thislib."
bd9b35c9
JH
4102 fi
4103done
4104set X $dflt
4105shift
4106dflt="$*"
4107case "$libs" in
4108'') dflt="$dflt";;
4109*) dflt="$libs";;
4110esac
4111case "$dflt" in
4112' '|'') dflt='none';;
4113esac
4633a7c4 4114
bd9b35c9 4115$cat <<EOM
4633a7c4 4116
bd9b35c9
JH
4117In order to compile $package on your machine, a number of libraries
4118are usually needed. Include any other special libraries here as well.
4119Say "none" for none. The default list is almost always right.
8e07c86e 4120EOM
8e07c86e 4121
bd9b35c9
JH
4122echo " "
4123rp="What libraries to use?"
4124. ./myread
4125case "$ans" in
4126none) libs=' ';;
4127*) libs="$ans";;
4128esac
d71b2b6b 4129
bd9b35c9
JH
4130: determine optimization, if desired, or use for debug flag also
4131case "$optimize" in
4132' '|$undef) dflt='none';;
4133'') dflt='-O';;
4134*) dflt="$optimize";;
4135esac
4136$cat <<EOH
d71b2b6b 4137
bd9b35c9
JH
4138By default, $package compiles with the -O flag to use the optimizer.
4139Alternately, you might want to use the symbolic debugger, which uses
4140the -g flag (on traditional Unix systems). Either flag can be
4141specified here. To use neither flag, specify the word "none".
d71b2b6b 4142
bd9b35c9
JH
4143EOH
4144rp="What optimizer/debugger flag should be used?"
4145. ./myread
4146optimize="$ans"
4147case "$optimize" in
4148'none') optimize=" ";;
4149esac
4150
4151dflt=''
4152: We will not override a previous value, but we might want to
4153: augment a hint file
4154case "$hint" in
4155default|recommended)
4156 case "$gccversion" in
4157 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 4158 esac
bd9b35c9
JH
4159 case "$optimize" in
4160 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 4161 esac
bd9b35c9
JH
4162 case "$gccversion" in
4163 2*) if test -d /etc/conf/kconfig.d &&
4164 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4165 then
4166 dflt="$dflt -posix"
4167 fi
f0d04425 4168 ;;
bd9b35c9
JH
4169 esac
4170 case "$gccversion" in
4171 1*) ;;
4172 2.[0-8]*) ;;
4173 ?*) echo " "
4174 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4175 echo 'int main(void) { return 0; }' > gcctest.c
4176 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4177 echo "Yes, it does." 2>&1
4178 case "$ccflags" in
4179 *strict-aliasing*)
4180 echo "Leaving current flags $ccflags alone." 2>&1
4181 ;;
4182 *) dflt="$dflt -fno-strict-aliasing" ;;
4183 esac
4184 else
4185 echo "Nope, it doesn't, but that's ok." 2>&1
4186 fi
f0d04425 4187 ;;
e5e20432
JH
4188 esac
4189 ;;
4190esac
4191
bd9b35c9
JH
4192case "$mips_type" in
4193*BSD*|'') inclwanted="$locincpth $usrinc";;
4194*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4195esac
4196for thisincl in $inclwanted; do
4197 if $test -d $thisincl; then
4198 if $test x$thisincl != x$usrinc; then
4199 case "$dflt" in
422af00a
LC
4200 *" -I$thisincl "*);;
4201 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
4202 esac
4203 fi
4204 fi
4205done
40a7a20a 4206
bd9b35c9
JH
4207inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4208 xxx=true;
4209elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4210 xxx=true;
4211else
4212 xxx=false;
4213fi;
4214if $xxx; then
4215 case "$dflt" in
4216 *$2*);;
4217 *) dflt="$dflt -D$2";;
4218 esac;
4219fi'
40a7a20a 4220
bd9b35c9 4221set signal.h LANGUAGE_C; eval $inctest
40a7a20a 4222
bd9b35c9
JH
4223case "$usesocks" in
4224$define)
4225 ccflags="$ccflags -DSOCKS"
4226 ;;
4227esac
40a7a20a 4228
bd9b35c9
JH
4229case "$hint" in
4230default|recommended) dflt="$ccflags $dflt" ;;
4231*) dflt="$ccflags";;
4232esac
40a7a20a 4233
bd9b35c9
JH
4234case "$dflt" in
4235''|' ') dflt=none;;
4236esac
422af00a 4237
bd9b35c9 4238$cat <<EOH
40a7a20a 4239
bd9b35c9
JH
4240Your C compiler may want other flags. For this question you should include
4241-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4242but you should NOT include libraries or ld flags like -lwhatever. If you
4243want $package to honor its debug switch, you should include -DDEBUGGING here.
4244Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 4245
bd9b35c9 4246To use no flags, specify the word "none".
40a7a20a 4247
bd9b35c9
JH
4248EOH
4249set X $dflt
4250shift
4251dflt=${1+"$@"}
4252rp="Any additional cc flags?"
4253. ./myread
4254case "$ans" in
4255none) ccflags='';;
4256*) ccflags="$ans";;
4257esac
8e07c86e 4258
bd9b35c9 4259: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
4260case "$cppflags" in
4261'') cppflags="$ccflags" ;;
4262*) cppflags="$cppflags $ccflags" ;;
4263esac
bd9b35c9
JH
4264case "$gccversion" in
42651*) cppflags="$cppflags -D__GNUC__"
4633a7c4 4266esac
bd9b35c9
JH
4267case "$mips_type" in
4268'');;
4269*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4270esac
4271case "$cppflags" in
4272'');;
4273*)
4274 echo " "
4275 echo "Let me guess what the preprocessor flags are..." >&4
4276 set X $cppflags
4277 shift
4278 cppflags=''
4279 $cat >cpp.c <<'EOM'
4280#define BLURFL foo
8e07c86e 4281
bd9b35c9
JH
4282BLURFL xx LFRULB
4283EOM
4284 previous=''
4285 for flag in $*
4286 do
4287 case "$flag" in
4288 -*) ftry="$flag";;
4289 *) ftry="$previous $flag";;
4290 esac
4291 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4292 >cpp1.out 2>/dev/null && \
4293 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4294 >cpp2.out 2>/dev/null && \
4295 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4296 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4297 then
4298 cppflags="$cppflags $ftry"
4299 previous=''
4300 else
4301 previous="$flag"
4302 fi
4303 done
4304 set X $cppflags
4305 shift
4306 cppflags=${1+"$@"}
4307 case "$cppflags" in
4308 *-*) echo "They appear to be: $cppflags";;
4309 esac
4310 $rm -f cpp.c cpp?.out
2afac517 4311 ;;
4312esac
8e07c86e 4313
bd9b35c9
JH
4314: flags used in final linking phase
4315case "$ldflags" in
4316'') if ./venix; then
4317 dflt='-i -z'
10a23457 4318 else
bd9b35c9 4319 dflt=''
10a23457 4320 fi
bd9b35c9
JH
4321 case "$ccflags" in
4322 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 4323 esac
bd9b35c9
JH
4324 ;;
4325*) dflt="$ldflags";;
4326esac
4327
4328: Try to guess additional flags to pick up local libraries.
4329for thislibdir in $libpth; do
4330 case " $loclibpth " in
4331 *" $thislibdir "*)
4332 case "$dflt " in
4333 *"-L$thislibdir "*) ;;
4334 *) dflt="$dflt -L$thislibdir" ;;
4335 esac
c4f23d77
AD
4336 ;;
4337 esac
bd9b35c9 4338done
c4f23d77 4339
bd9b35c9
JH
4340case "$dflt" in
4341'') dflt='none' ;;
4342esac
c4f23d77 4343
bd9b35c9
JH
4344$cat <<EOH
4345
4346Your C linker may need flags. For this question you should
4347include -L/whatever and any other flags used by the C linker, but you
4348should NOT include libraries like -lwhatever.
4349
4350Make sure you include the appropriate -L/path flags if your C linker
4351does not normally search all of the directories you specified above,
4352namely
4353 $libpth
4354To use no flags, specify the word "none".
4355
4356EOH
4357
4358rp="Any additional ld flags (NOT including libraries)?"
4359. ./myread
4360case "$ans" in
4361none) ldflags='';;
4362*) ldflags="$ans";;
4363esac
4364rmlist="$rmlist pdp11"
4365
4366: coherency check
4367echo " "
4368echo "Checking your choice of C compiler and flags for coherency..." >&4
4369$cat > try.c <<'EOF'
4370#include <stdio.h>
4371int main() { printf("Ok\n"); exit(0); }
4372EOF
7a282f6d 4373set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
4374shift
4375$cat >try.msg <<'EOM'
4376I've tried to compile and run the following simple program:
4377
4378EOM
4379$cat try.c >> try.msg
4380
4381$cat >> try.msg <<EOM
4382
4383I used the command:
4384
4385 $*
5440bc8e 4386 $run ./try
bd9b35c9
JH
4387
4388and I got the following output:
4389
4390EOM
4391dflt=y
73614538 4392if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5440bc8e
JH
4393 if $sh -c "$run ./try" >>try.msg 2>&1; then
4394 xxx=`$run ./try`
bd9b35c9
JH
4395 case "$xxx" in
4396 "Ok") dflt=n ;;
4397 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4398 case " $libs " in
4399 *" -lsfio "*)
4400 cat >> try.msg <<'EOQS'
4401If $libs contains -lsfio, and sfio is mis-configured, then it
4402sometimes (apparently) runs and exits with a 0 status, but with no
4403output! It may have to do with sfio's use of _exit vs. exit.
4404
4405EOQS
4406 rp="You have a big problem. Shall I abort Configure"
4407 dflt=y
4408 ;;
4409 esac
4410 ;;
4411 esac
4412 else
4413 echo "The program compiled OK, but exited with status $?." >>try.msg
4414 rp="You have a problem. Shall I abort Configure"
4415 dflt=y
4416 fi
4417else
4418 echo "I can't compile the test program." >>try.msg
4419 rp="You have a BIG problem. Shall I abort Configure"
4420 dflt=y
4421fi
4422case "$dflt" in
4423y)
4424 $cat try.msg >&4
4425 case "$knowitall" in
4426 '')
4427 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 4428 ;;
bd9b35c9 4429 *) dflt=n;;
c4f23d77 4430 esac
bd9b35c9
JH
4431 echo " "
4432 . ./myread
4433 case "$ans" in
4434 n*|N*) ;;
4435 *) echo "Ok. Stopping Configure." >&4
4436 exit 1
c4f23d77
AD
4437 ;;
4438 esac
4439 ;;
bd9b35c9 4440n) echo "OK, that should do.";;
c4f23d77 4441esac
bd9b35c9 4442$rm -f try try.* core
c4f23d77 4443
b4eb6b3d
JH
4444: define an is-a-typedef? function
4445typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4446case "$inclist" in
4447"") inclist="sys/types.h";;
4448esac;
4449eval "varval=\$$var";
4450case "$varval" in
4451"")
4452 $rm -f temp.c;
4453 for inc in $inclist; do
4454 echo "#include <$inc>" >>temp.c;
4455 done;
4456 echo "#ifdef $type" >> temp.c;
4457 echo "printf(\"We have $type\");" >> temp.c;
4458 echo "#endif" >> temp.c;
4459 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4460 if $contains $type temp.E >/dev/null 2>&1; then
4461 eval "$var=\$type";
4462 else
4463 eval "$var=\$def";
4464 fi;
4465 $rm -f temp.?;;
4466*) eval "$var=\$varval";;
4467esac'
4468
4469: define an is-a-typedef? function that prompts if the type is not available.
4470typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4471case "$inclist" in
4472"") inclist="sys/types.h";;
4473esac;
4474eval "varval=\$$var";
4475case "$varval" in
4476"")
4477 $rm -f temp.c;
4478 for inc in $inclist; do
4479 echo "#include <$inc>" >>temp.c;
4480 done;
4481 echo "#ifdef $type" >> temp.c;
4482 echo "printf(\"We have $type\");" >> temp.c;
4483 echo "#endif" >> temp.c;
4484 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4485 echo " " ;
4486 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4487 if $contains $type temp.E >/dev/null 2>&1; then
4488 echo "$type found." >&4;
4489 eval "$var=\$type";
4490 else
4491 echo "$type NOT found." >&4;
4492 dflt="$def";
4493 . ./myread ;
4494 eval "$var=\$ans";
4495 fi;
4496 $rm -f temp.?;;
4497*) eval "$var=\$varval";;
4498esac'
4499
bd9b35c9
JH
4500: define a shorthand compile call
4501compile='
4502mc_file=$1;
4503shift;
08413ebc 4504$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
4505: define a shorthand compile call for compilations that should be ok.
4506compile_ok='
4507mc_file=$1;
4508shift;
7a282f6d 4509$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 4510
b4eb6b3d 4511: check for lengths of integral types
bd9b35c9 4512echo " "
b4eb6b3d
JH
4513case "$intsize" in
4514'')
4515 echo "Checking to see how big your integers are..." >&4
5440bc8e 4516 $cat >try.c <<'EOCP'
bd9b35c9
JH
4517#include <stdio.h>
4518int main()
4519{
b4eb6b3d
JH
4520 printf("intsize=%d;\n", (int)sizeof(int));
4521 printf("longsize=%d;\n", (int)sizeof(long));
4522 printf("shortsize=%d;\n", (int)sizeof(short));
4523 exit(0);
bd9b35c9 4524}
b4eb6b3d 4525EOCP
5440bc8e
JH
4526 set try
4527 if eval $compile_ok && $run ./try > /dev/null; then
4528 eval `$run ./try`
b4eb6b3d
JH
4529 echo "Your integers are $intsize bytes long."
4530 echo "Your long integers are $longsize bytes long."
4531 echo "Your short integers are $shortsize bytes long."
4532 else
4533 $cat >&4 <<EOM
4534!
4535Help! I can't compile and run the intsize test program: please enlighten me!
4536(This is probably a misconfiguration in your system or libraries, and
4537you really ought to fix it. Still, I'll try anyway.)
4538!
bd9b35c9 4539EOM
b4eb6b3d
JH
4540 dflt=4
4541 rp="What is the size of an integer (in bytes)?"
4542 . ./myread
4543 intsize="$ans"
4544 dflt=$intsize
4545 rp="What is the size of a long integer (in bytes)?"
4546 . ./myread
4547 longsize="$ans"
4548 dflt=2
4549 rp="What is the size of a short integer (in bytes)?"
4550 . ./myread
4551 shortsize="$ans"
4552 fi
4553 ;;
4554esac
5440bc8e 4555$rm -f try try.*
c1a7f87b 4556
b4eb6b3d
JH
4557: see what type lseek is declared as in the kernel
4558rp="What is the type used for lseek's offset on this system?"
4559set off_t lseektype long stdio.h sys/types.h
4560eval $typedef_ask
4561
4562echo " "
4563echo "Checking to see how big your file offsets are..." >&4
4564$cat >try.c <<EOCP
4565#include <sys/types.h>
4566#include <stdio.h>
4567int main()
4568{
4569 printf("%d\n", (int)sizeof($lseektype));
4570 return(0);
4571}
4572EOCP
4573set try
4574if eval $compile_ok; then
5440bc8e 4575 lseeksize=`$run ./try`
b4eb6b3d
JH
4576 echo "Your file offsets are $lseeksize bytes long."
4577else
4578 dflt=$longsize
4579 echo " "
4580 echo "(I can't seem to compile the test program. Guessing...)"
4581 rp="What is the size of your file offsets (in bytes)?"
4582 . ./myread
4583 lseeksize="$ans"
4584fi
4585$rm -f try.c try
4586
4587: see what type file positions are declared as in the library
4588rp="What is the type for file position used by fsetpos()?"
4589set fpos_t fpostype long stdio.h sys/types.h
4590eval $typedef_ask
4591
4592echo " "
4593case "$fpostype" in
4594*_t) zzz="$fpostype" ;;
4595*) zzz="fpos_t" ;;
4596esac
4597echo "Checking the size of $zzz..." >&4
4598cat > try.c <<EOCP
4599#include <sys/types.h>
4600#include <stdio.h>
4601int main() {
4602 printf("%d\n", (int)sizeof($fpostype));
4603 exit(0);
4604}
4605EOCP
4606set try
4607if eval $compile_ok; then
5440bc8e 4608 yyy=`$run ./try`
b4eb6b3d
JH
4609 case "$yyy" in
4610 '') fpossize=4
4611 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4612 ;;
4613 *) fpossize=$yyy
4614 echo "Your $zzz is $fpossize bytes long."
4615 ;;
4616 esac
4617else
4618 dflt="$longsize"
4619 echo " " >&4
4620 echo "(I can't compile the test program. Guessing...)" >&4
4621 rp="What is the size of your file positions (in bytes)?"
4622 . ./myread
4623 fpossize="$ans"
4624fi
4625
4626
4627
4628# Backward compatibility (uselfs is deprecated).
4629case "$uselfs" in
4630"$define"|true|[yY]*)
4631 cat <<EOM >&4
4632
4633*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4634EOM
4635 uselargefiles="$define"
4636 ;;
4637esac
4638
4639case "$lseeksize:$fpossize" in
46408:8) cat <<EOM
4641
4642You can have files larger than 2 gigabytes.
4643EOM
4644 val="$define" ;;
4645*) case "$uselargefiles" in
4646 "$undef"|false|[nN]*) dflt='n' ;;
4647 *) dflt='y' ;;
4648 esac
4649 cat <<EOM
4650
4651Perl can be built to understand large files (files larger than 2 gigabytes)
4652on some systems. To do so, Configure can be run with -Duselargefiles.
4653
4654If this doesn't make any sense to you, just accept the default '$dflt'.
4655EOM
4656 rp='Try to understand large files, if available?'
4657 . ./myread
4658 case "$ans" in
4659 y|Y) val="$define" ;;
4660 *) val="$undef" ;;
4661 esac
4662 ;;
4663esac
4664set uselargefiles
4665eval $setvar
4666case "$uselargefiles" in
4667"$define")
4668: Look for a hint-file generated 'call-back-unit'. If the
4669: user has specified that a large files perl is to be built,
4670: we may need to set or change some other defaults.
4671 if $test -f uselargefiles.cbu; then
4672 echo "Your platform has some specific hints for large file builds, using them..."
4673 . ./uselargefiles.cbu
4674 echo " "
4675 echo "Rechecking to see how big your file offsets are..." >&4
4676 $cat >try.c <<EOCP
4677#include <sys/types.h>
4678#include <stdio.h>
4679int main()
4680{
4681 printf("%d\n", (int)sizeof($lseektype));
4682 return(0);
4683}
4684EOCP
4685 set try
4686 if eval $compile_ok; then
5440bc8e 4687 lseeksize=`$run ./try`
b4eb6b3d
JH
4688 $echo "Your file offsets are now $lseeksize bytes long."
4689 else
4690 dflt="$lseeksize"
4691 echo " "
4692 echo "(I can't seem to compile the test program. Guessing...)"
4693 rp="What is the size of your file offsets (in bytes)?"
4694 . ./myread
4695 lseeksize="$ans"
4696 fi
4697 case "$fpostype" in
4698 *_t) zzz="$fpostype" ;;
4699 *) zzz="fpos_t" ;;
4700 esac
4701 $echo $n "Rechecking the size of $zzz...$c" >&4
4702 $cat > try.c <<EOCP
4703#include <sys/types.h>
4704#include <stdio.h>
4705int main() {
4706 printf("%d\n", (int)sizeof($fpostype));
4707 exit(0);
4708}
4709EOCP
4710 set try
4711 if eval $compile_ok; then
5440bc8e 4712 yyy=`$run ./try`
b4eb6b3d
JH
4713 dflt="$lseeksize"
4714 case "$yyy" in
4715 '') echo " "
4716 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4717 ;;
4718 *) fpossize=$yyy
4719 echo " $fpossize bytes." >&4
4720 ;;
4721 esac
4722 else
4723 dflt="$fpossize"
4724 echo " "
4725 echo "(I can't compile the test program. Guessing...)" >&4
4726 rp="What is the size of your file positions (in bytes)?"
4727 . ./myread
4728 fpossize="$ans"
4729 fi
4730 $rm -f try.c try
4731 fi
4732 ;;
4733esac
4734
4735
4736case "$usemorebits" in
4737"$define"|true|[yY]*)
4738 use64bitint="$define"
4739 uselongdouble="$define"
4740 usemorebits="$define"
4741 ;;
4742*) usemorebits="$undef"
4743 ;;
4744esac
4745
8dfa8df9
JH
4746: check for void type
4747echo " "
4748echo "Checking to see how well your C compiler groks the void type..." >&4
4749case "$voidflags" in
4750'')
4751 $cat >try.c <<'EOCP'
4752#if TRY & 1
4753void sub() {
4754#else
4755sub() {
4756#endif
4757 extern void moo(); /* function returning void */
4758 void (*goo)(); /* ptr to func returning void */
4759#if TRY & 8
4760 void *hue; /* generic ptr */
4761#endif
4762#if TRY & 2
4763 void (*foo[10])();
4764#endif
4765
4766#if TRY & 4
4767 if(goo == moo) {
4768 exit(0);
4769 }
4770#endif
4771 exit(0);
4772}
4773int main() { sub(); }
4774EOCP
4775 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4776 voidflags=$defvoidused
4777 echo "Good. It appears to support void to the level $package wants.">&4
4778 if $contains warning .out >/dev/null 2>&1; then
4779 echo "However, you might get some warnings that look like this:"
4780 $cat .out
4781 fi
4782 else
4783echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4784 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4785 echo "It supports 1..."
4786 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4787 echo "It also supports 2..."
4788 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4789 voidflags=7
4790 echo "And it supports 4 but not 8 definitely."
4791 else
4792 echo "It doesn't support 4..."
4793 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4794 voidflags=11
4795 echo "But it supports 8."
4796 else
4797 voidflags=3
4798 echo "Neither does it support 8."
4799 fi
4800 fi
4801 else
4802 echo "It does not support 2..."
4803 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4804 voidflags=13
4805 echo "But it supports 4 and 8."
4806 else
4807 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4808 voidflags=5
4809 echo "And it supports 4 but has not heard about 8."
4810 else
4811 echo "However it supports 8 but not 4."
4812 fi
4813 fi
4814 fi
4815 else
4816 echo "There is no support at all for void."
4817 voidflags=0
4818 fi
4819 fi
4820esac
4821case "$voidflags" in
4822"$defvoidused") ;;
4823*) $cat >&4 <<'EOM'
4824 Support flag bits are:
4825 1: basic void declarations.
4826 2: arrays of pointers to functions returning void.
4827 4: operations between pointers to and addresses of void functions.
4828 8: generic void pointers.
4829EOM
4830 dflt="$voidflags";
4831 rp="Your void support flags add up to what?"
4832 . ./myread
4833 voidflags="$ans"
4834 ;;
4835esac
4836$rm -f try.* .out
4837
4838: check for length of pointer
4839echo " "
4840case "$ptrsize" in
4841'')
4842 echo "Checking to see how big your pointers are..." >&4
4843 if test "$voidflags" -gt 7; then
4844 echo '#define VOID_PTR char *' > try.c
4845 else
4846 echo '#define VOID_PTR void *' > try.c
4847 fi
4848 $cat >>try.c <<'EOCP'
4849#include <stdio.h>
4850int main()
4851{
4852 printf("%d\n", (int)sizeof(VOID_PTR));
4853 exit(0);
4854}
4855EOCP
4856 set try
4857 if eval $compile_ok; then
5440bc8e 4858 ptrsize=`$run ./try`
8dfa8df9
JH
4859 echo "Your pointers are $ptrsize bytes long."
4860 else
4861 dflt='4'
4862 echo "(I can't seem to compile the test program. Guessing...)" >&4
4863 rp="What is the size of a pointer (in bytes)?"
4864 . ./myread
4865 ptrsize="$ans"
4866 fi
4867 ;;
4868esac
4869$rm -f try.c try
4870
4871: check for long long
4872echo " "
4873echo "Checking to see if you have long long..." >&4
4874echo 'int main() { long long x = 7; return 0; }' > try.c
4875set try
4876if eval $compile; then
4877 val="$define"
4878 echo "You have long long."
4879else
4880 val="$undef"
4881 echo "You do not have long long."
4882fi
4883$rm try.*
4884set d_longlong
4885eval $setvar
4886
4887: check for length of long long
4888case "${d_longlong}${longlongsize}" in
4889$define)
4890 echo " "
4891 echo "Checking to see how big your long longs are..." >&4
4892 $cat >try.c <<'EOCP'
4893#include <stdio.h>
4894int main()
4895{
4896 printf("%d\n", (int)sizeof(long long));
4897 return(0);
4898}
4899EOCP
4900 set try
4901 if eval $compile_ok; then
5440bc8e 4902 longlongsize=`$run ./try`
8dfa8df9
JH
4903 echo "Your long longs are $longlongsize bytes long."
4904 else
4905 dflt='8'
4906 echo " "
4907 echo "(I can't seem to compile the test program. Guessing...)"
4908 rp="What is the size of a long long (in bytes)?"
4909 . ./myread
4910 longlongsize="$ans"
4911 fi
4912 if $test "X$longsize" = "X$longlongsize"; then
4913 echo "(That isn't any different from an ordinary long.)"
4914 fi
4915 ;;
4916esac
4917$rm -f try.* try
4918
4919: determine filename position in cpp output
4920echo " "
4921echo "Computing filename position in cpp output for #include directives..." >&4
4922echo '#include <stdio.h>' > foo.c
4923$cat >fieldn <<EOF
4924$startsh
4925$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4926$grep '^[ ]*#.*stdio\.h' | \
4927while read cline; do
4928 pos=1
4929 set \$cline
4930 while $test \$# -gt 0; do
4931 if $test -r \`echo \$1 | $tr -d '"'\`; then
4932 echo "\$pos"
4933 exit 0
4934 fi
4935 shift
4936 pos=\`expr \$pos + 1\`
4937 done
4938done
4939EOF
4940chmod +x fieldn
4941fieldn=`./fieldn`
4942$rm -f foo.c fieldn
4943case $fieldn in
4944'') pos='???';;
49451) pos=first;;
49462) pos=second;;
49473) pos=third;;
4948*) pos="${fieldn}th";;
4949esac
4950echo "Your cpp writes the filename in the $pos field of the line."
4951
4952: locate header file
4953$cat >findhdr <<EOF
4954$startsh
4955wanted=\$1
4956name=''
4957for usrincdir in $usrinc
4958do
4959 if test -f \$usrincdir/\$wanted; then
4960 echo "\$usrincdir/\$wanted"
4961 exit 0
4962 fi
4963done
4964awkprg='{ print \$$fieldn }'
4965echo "#include <\$wanted>" > foo\$\$.c
4966$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4967$grep "^[ ]*#.*\$wanted" | \
4968while read cline; do
4969 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4970 case "\$name" in
4971 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4972 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4973 *) exit 2;;
4974 esac;
4975done;
4976#
4977# status = 0: grep returned 0 lines, case statement not executed
4978# status = 1: headerfile found
4979# status = 2: while loop executed, no headerfile found
4980#
4981status=\$?
4982$rm -f foo\$\$.c;
4983if test \$status -eq 1; then
4984 exit 0;
4985fi
4986exit 1
4987EOF
4988chmod +x findhdr
4989
4990: define an alternate in-header-list? function
4991inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4992cont=true; xxf="echo \"<\$1> found.\" >&4";
4993case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4994*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4995esac;
4996case $# in 4) instead=instead;; *) instead="at last";; esac;
4997while $test "$cont"; do
4998 xxx=`./findhdr $1`
4999 var=$2; eval "was=\$$2";
5000 if $test "$xxx" && $test -r "$xxx";
5001 then eval $xxf;
5002 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5003 cont="";
5004 else eval $xxnf;
5005 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5006 set $yyy; shift; shift; yyy=$@;
5007 case $# in 0) cont="";;
5008 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5009 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5010 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5011 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5012 esac;
5013done;
5014while $test "$yyy";
5015do set $yyy; var=$2; eval "was=\$$2";
5016 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5017 set $yyy; shift; shift; yyy=$@;
5018done'
5019
5020: see if inttypes.h is available
5021: we want a real compile instead of Inhdr because some systems
5022: have an inttypes.h which includes non-existent headers
5023echo " "
5024$cat >try.c <<EOCP
5025#include <inttypes.h>
5026int main() {
5027 static int32_t foo32 = 0x12345678;
5028}
5029EOCP
5030set try
5031if eval $compile; then
5032 echo "<inttypes.h> found." >&4
5033 val="$define"
5034else
5035 echo "<inttypes.h> NOT found." >&4
5036 val="$undef"
5037fi
5038$rm -f try.c try
5039set i_inttypes
5040eval $setvar
5041
5042: check for int64_t
5043echo " "
5044echo "Checking to see if you have int64_t..." >&4
5045$cat >try.c <<EOCP
5046#include <sys/types.h>
5047#$i_inttypes I_INTTYPES
5048#ifdef I_INTTYPES
5049#include <inttypes.h>
5050#endif
5051int main() { int64_t x = 7; }
5052EOCP
5053set try
5054if eval $compile; then
5055 val="$define"
5056 echo "You have int64_t."
5057else
5058 val="$undef"
5059 echo "You do not have int64_t."
5060fi
5061$rm -f try try.*
5062set d_int64_t
5063eval $setvar
5064
5065
5066echo " "
5067echo "Checking which 64-bit integer type we could use..." >&4
5068
5069case "$intsize" in
50708) val=int
5071 set quadtype
5072 eval $setvar
5073 val='"unsigned int"'
5074 set uquadtype
5075 eval $setvar
5076 quadkind=1
5077 ;;
5078*) case "$longsize" in
5079 8) val=long
5080 set quadtype
5081 eval $setvar
5082 val='"unsigned long"'
5083 set uquadtype
5084 eval $setvar
5085 quadkind=2
5086 ;;
5087 *) case "$d_longlong:$longlongsize" in
5088 define:8)
5089 val='"long long"'
5090 set quadtype
5091 eval $setvar
5092 val='"unsigned long long"'
5093 set uquadtype
5094 eval $setvar
5095 quadkind=3
5096 ;;
5097 *) case "$d_int64_t" in
5098 define)
5099 val=int64_t
5100 set quadtype
5101 eval $setvar
5102 val=uint64_t
5103 set uquadtype
5104 eval $setvar
5105 quadkind=4
5106 ;;
5107 esac
5108 ;;
5109 esac
5110 ;;
5111 esac
5112 ;;
5113esac
5114
5115case "$quadtype" in
5116'') echo "Alas, no 64-bit integer types in sight." >&4
5117 d_quad="$undef"
5118 ;;
5119*) echo "We could use '$quadtype' for 64-bit integers." >&4
5120 d_quad="$define"
5121 ;;
5122esac
5123
b4eb6b3d
JH
5124
5125case "$uselonglong" in
5126"$define"|true|[yY]*)
5127 cat <<EOM >&4
5128
5129*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5130EOM
5131 use64bitint="$define"
5132 ;;
5133esac
5134case "$use64bits" in
5135"$define"|true|[yY]*)
5136 cat <<EOM >&4
5137
5138*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5139EOM
5140 use64bitint="$define"
5141 ;;
5142esac
5143case "$use64bitints" in
5144"$define"|true|[yY]*)
5145 cat <<EOM >&4
5146
5147*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5148EOM
5149 use64bitint="$define"
5150 ;;
5151esac
5152case "$use64bitsint" in
5153"$define"|true|[yY]*)
5154 cat <<EOM >&4
5155
5156*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5157EOM
5158 use64bitint="$define"
5159 ;;
5160esac
5161case "$uselonglongs" in
5162"$define"|true|[yY]*)
5163 cat <<EOM >&4
5164
5165*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5166EOM
5167 use64bitint="$define"
5168 ;;
5169esac
5170case "$use64bitsall" in
5171"$define"|true|[yY]*)
5172 cat <<EOM >&4
5173
5174*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5175EOM
5176 use64bitall="$define"
5177 ;;
5178esac
5179
5180case "$ccflags" in
5181*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5182esac
5183case "$use64bitall" in
5184"$define"|true|[yY]*) use64bitint="$define" ;;
5185esac
5186
5187case "$longsize" in
51888) cat <<EOM
5189
5190You have natively 64-bit long integers.
5191EOM
5192 val="$define"
5193 ;;
5194*) case "$use64bitint" in
5195 "$define"|true|[yY]*) dflt='y';;
5196 *) dflt='n';;
5197 esac
8dfa8df9
JH
5198 case "$d_quad" in
5199 "$define") ;;
5200 *) dflt='n' ;;
5201 esac
b4eb6b3d
JH
5202 cat <<EOM
5203
5204Perl can be built to take advantage of 64-bit integer types
5205on some systems. To do so, Configure can be run with -Duse64bitint.
5206Choosing this option will most probably introduce binary incompatibilities.
5207
5208If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5209(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5210EOM
5211 rp='Try to use 64-bit integers, if available?'
5212 . ./myread
5213 case "$ans" in
5214 [yY]*) val="$define" ;;
5215 *) val="$undef" ;;
5216 esac
5217 ;;
5218esac
5219set use64bitint
5220eval $setvar
5221
5222case "$use64bitall" in
5223"$define"|true|[yY]*) dflt='y' ;;
5224*) case "$longsize" in
5225 8) dflt='y' ;;
5226 *) dflt='n' ;;
5227 esac
5228 ;;
5229esac
5230cat <<EOM
5231
5232You may also choose to try maximal 64-bitness. It means using as much
523364-bitness as possible on the platform. This in turn means even more
5234binary incompatibilities. On the other hand, your platform may not
5235have any more 64-bitness available than what you already have chosen.
5236
5237If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5238(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5239EOM
5240rp='Try to use maximal 64-bit support, if available?'
5241. ./myread
5242case "$ans" in
5243[yY]*) val="$define" ;;
5244*) val="$undef" ;;
5245esac
5246set use64bitall
5247eval $setvar
5248case "$use64bitall" in
5249"$define")
5250 case "$use64bitint" in
5251 "$undef")
5252 cat <<EOM
5253
5254Since you have chosen a maximally 64-bit build, I'm also turning on
5255the use of 64-bit integers.
5256EOM
5257 use64bitint="$define" ;;
5258 esac
5259 ;;
5260esac
5261
8dfa8df9
JH
5262case "$use64bitall" in
5263"$define"|true|[yY]*)
5264 case "$ptrsize" in
5265 4) cat <<EOM >&4
5266
5267*** You have chosen a maximally 64-bit build, but your pointers
5268*** are only 4 bytes wide, disabling maximal 64-bitness.
5269
5270EOM
5271 use64bitall="$undef"
5272 case "$use64bitint" in
5273 "$define"|true|[yY]*) ;;
5274 *) cat <<EOM >&4
5275
5276*** Downgrading from maximal 64-bitness to using 64-bit integers.
5277
5278EOM
5279 use64bitint="$define"
5280 ;;
5281 esac
5282 ;;
5283 esac
5284 ;;
5285esac
5286
b4eb6b3d
JH
5287case "$use64bitint" in
5288"$define"|true|[yY]*)
5289: Look for a hint-file generated 'call-back-unit'. If the
5290: user has specified that a 64-bit perl is to be built,
5291: we may need to set or change some other defaults.
5292 if $test -f use64bitint.cbu; then
5293 echo "Your platform has some specific hints for 64-bit integers, using them..."
5294 . ./use64bitint.cbu
5295 fi
5296 case "$longsize" in
5297 4) case "$archname64" in
5298 '') archname64=64int ;;
5299 esac
5300 ;;
5301 esac
5302 ;;
5303esac
5304
5305case "$use64bitall" in
5306"$define"|true|[yY]*)
5307: Look for a hint-file generated 'call-back-unit'. If the
5308: user has specified that a maximally 64-bit perl is to be built,
5309: we may need to set or change some other defaults.
5310 if $test -f use64bitall.cbu; then
5311 echo "Your platform has some specific hints for 64-bit builds, using them..."
5312 . ./use64bitall.cbu
5313 fi
5314 case "$longsize" in
5315 4) case "$archname64" in
5316 ''|64int) archname64=64all ;;
5317 esac
5318 ;;
5319 esac
5320 ;;
5321esac
5322
5323echo " "
5324echo "Checking for GNU C Library..." >&4
5440bc8e 5325cat >try.c <<EOM
b4eb6b3d
JH
5326#include <stdio.h>
5327int main()
5328{
5329#ifdef __GLIBC__
5330 exit(0);
5331#else
5332 exit(1);
5333#endif
5334}
5335EOM
5440bc8e
JH
5336set try
5337if eval $compile_ok && $run ./try; then
b4eb6b3d
JH
5338 val="$define"
5339 echo "You are using the GNU C Library"
5340else
5341 val="$undef"
5342 echo "You are not using the GNU C Library"
5343fi
5440bc8e 5344$rm -f try try.*
b4eb6b3d
JH
5345set d_gnulibc
5346eval $setvar
5347
5348: see if nm is to be used to determine whether a symbol is defined or not
5349case "$usenm" in
5350'')
5351 dflt=''
c1a7f87b
JH
5352 case "$d_gnulibc" in
5353 "$define")
5354 echo " "
5355 echo "nm probably won't work on the GNU C Library." >&4
5356 dflt=n
bd9b35c9 5357 ;;
c1a7f87b
JH
5358 esac
5359 case "$dflt" in
5360 '')
5361 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5362 echo " "
5363 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
5364 echo "'nm' won't be sufficient on this sytem." >&4
5365 dflt=n
5366 fi
5367 ;;
5368 esac
5369 case "$dflt" in
5370 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5371 if $test $dflt -gt 20; then
5372 dflt=y
5373 else
5374 dflt=n
5375 fi
bd9b35c9
JH
5376 ;;
5377 esac
bd9b35c9
JH
5378 ;;
5379*)
c1a7f87b
JH
5380 case "$usenm" in
5381 true|$define) dflt=y;;
5382 *) dflt=n;;
5383 esac
bd9b35c9
JH
5384 ;;
5385esac
5386$cat <<EOM
5387
c1a7f87b
JH
5388I can use $nm to extract the symbols from your C libraries. This
5389is a time consuming task which may generate huge output on the disk (up
5390to 3 megabytes) but that should make the symbols extraction faster. The
5391alternative is to skip the 'nm' extraction part and to compile a small
5392test program instead to determine whether each symbol is present. If
5393you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5394this may be the best solution.
5395
5396You probably shouldn't let me use 'nm' if you are using the GNU C Library.
bd9b35c9
JH
5397
5398EOM
c1a7f87b
JH
5399rp="Shall I use $nm to extract C symbols from the libraries?"
5400. ./myread
5401case "$ans" in
5402[Nn]*) usenm=false;;
5403*) usenm=true;;
bd9b35c9 5404esac
bd9b35c9 5405
c1a7f87b
JH
5406runnm=$usenm
5407case "$reuseval" in
5408true) runnm=false;;
8e07c86e 5409esac
29209bc5 5410
c1a7f87b
JH
5411: nm options which may be necessary
5412case "$nm_opt" in
5413'') if $test -f /mach_boot; then
5414 nm_opt='' # Mach
5415 elif $test -d /usr/ccs/lib; then
5416 nm_opt='-p' # Solaris (and SunOS?)
5417 elif $test -f /dgux; then
5418 nm_opt='-p' # DG-UX
5419 elif $test -f /lib64/rld; then
5420 nm_opt='-p' # 64-bit Irix
5421 else
5422 nm_opt=''
5423 fi;;
5424esac
bd9b35c9 5425
c1a7f87b
JH
5426: nm options which may be necessary for shared libraries but illegal
5427: for archive libraries. Thank you, Linux.
5428case "$nm_so_opt" in
5429'') case "$myuname" in
5430 *linux*)
5431 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5432 nm_so_opt='--dynamic'
5433 fi
5434 ;;
bd9b35c9 5435 esac
c1a7f87b
JH
5436 ;;
5437esac
8e07c86e 5438
c1a7f87b
JH
5439case "$runnm" in
5440true)
5441: get list of predefined functions in a handy place
5442echo " "
5443case "$libc" in
5444'') libc=unknown
5445 case "$libs" in
5446 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
bd9b35c9 5447 esac
ff935051
JH
5448 ;;
5449esac
c1a7f87b
JH
5450case "$libs" in
5451'') ;;
5452*) for thislib in $libs; do
5453 case "$thislib" in
5454 -lc|-lc_s)
5455 : Handle C library specially below.
5456 ;;
5457 -l*)
5458 thislib=`echo $thislib | $sed -e 's/^-l//'`
5459 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5460 :
5461 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5462 :
5463 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5464 :
5465 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5466 :
5467 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5468 :
5469 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5470 :
5471 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5472 :
5473 else
5474 try=''
5475 fi
5476 libnames="$libnames $try"
5477 ;;
5478 *) libnames="$libnames $thislib" ;;
34d1710f 5479 esac
c1a7f87b 5480 done
4633a7c4
LW
5481 ;;
5482esac
c1a7f87b
JH
5483xxx=normal
5484case "$libc" in
5485unknown)
5486 set /lib/libc.$so
5487 for xxx in $libpth; do
5488 $test -r $1 || set $xxx/libc.$so
5489 : The messy sed command sorts on library version numbers.
5490 $test -r $1 || \
5491 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5492 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5493 h
5494 s/[0-9][0-9]*/0000&/g
5495 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5496 G
5497 s/\n/ /' | \
381aa1ff 5498 $sort | $sed -e 's/^.* //'`
c1a7f87b
JH
5499 eval set \$$#
5500 done
5501 $test -r $1 || set /usr/ccs/lib/libc.$so
5502 $test -r $1 || set /lib/libsys_s$_a
5503 ;;
5504*)
5505 set blurfl
5506 ;;
a4f3eea9 5507esac
c1a7f87b
JH
5508if $test -r "$1"; then
5509 echo "Your (shared) C library seems to be in $1."
5510 libc="$1"
5511elif $test -r /lib/libc && $test -r /lib/clib; then
5512 echo "Your C library seems to be in both /lib/clib and /lib/libc."
5513 xxx=apollo
5514 libc='/lib/clib /lib/libc'
5515 if $test -r /lib/syslib; then
5516 echo "(Your math library is in /lib/syslib.)"
5517 libc="$libc /lib/syslib"
5518 fi
5519elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5520 echo "Your C library seems to be in $libc, as you said before."
5521elif $test -r $incpath/usr/lib/libc$_a; then
5522 libc=$incpath/usr/lib/libc$_a;
5523 echo "Your C library seems to be in $libc. That's fine."
5524elif $test -r /lib/libc$_a; then
5525 libc=/lib/libc$_a;
5526 echo "Your C library seems to be in $libc. You're normal."
5527else
5528 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5529 :
5530 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5531 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5532 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5533 :
5534 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5535 :
5536 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5537 :
5538 else
5539 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5540 fi
5541 if $test -r "$tans"; then
5542 echo "Your C library seems to be in $tans, of all places."
5543 libc=$tans
5544 else
5545 libc='blurfl'
5546 fi
5547fi
5548if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5549 dflt="$libc"
5550 cat <<EOM
a4f3eea9 5551
c1a7f87b
JH
5552If the guess above is wrong (which it might be if you're using a strange
5553compiler, or your machine supports multiple models), you can override it here.
bd9b35c9
JH
5554
5555EOM
a4f3eea9 5556else
c1a7f87b 5557 dflt=''
381aa1ff 5558 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
c1a7f87b
JH
5559 cat >&4 <<EOM
5560I can't seem to find your C library. I've looked in the following places:
a4f3eea9 5561
c1a7f87b
JH
5562EOM
5563 $sed 's/^/ /' libpath
5564 cat <<EOM
29209bc5 5565
c1a7f87b 5566None of these seems to contain your C library. I need to get its name...
a4f3eea9 5567
bd9b35c9 5568EOM
bd9b35c9 5569fi
c1a7f87b
JH
5570fn=f
5571rp='Where is your C library?'
5572. ./getfile
5573libc="$ans"
a4f3eea9 5574
c1a7f87b 5575echo " "
381aa1ff 5576echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
c1a7f87b
JH
5577set X `cat libnames`
5578shift
5579xxx=files
5580case $# in 1) xxx=file; esac
5581echo "Extracting names from the following $xxx for later perusal:" >&4
5582echo " "
5583$sed 's/^/ /' libnames >&4
5584echo " "
5585$echo $n "This may take a while...$c" >&4
a4f3eea9 5586
c1a7f87b
JH
5587for file in $*; do
5588 case $file in
5589 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5590 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 5591 esac
c1a7f87b 5592done >libc.tmp
a4f3eea9 5593
c1a7f87b
JH
5594$echo $n ".$c"
5595$grep fprintf libc.tmp > libc.ptf
5596xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5597xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5598xxx='[ADTSIW]'
5599if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
5600 eval $xscan;\
5601 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5602 eval $xrun
5603elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5604 eval $xscan;\
5605 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5606 eval $xrun
5607elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5608 eval $xscan;\
5609 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5610 eval $xrun
5611elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5612 eval $xscan;\
5613 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5614 eval $xrun
5615elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5616 eval $xscan;\
5617 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5618 eval $xrun
5619elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5620 eval $xscan;\
5621 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5622 eval $xrun
5623elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5624 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
5625 eval $xscan;\
5626 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5627 eval $xrun
5628elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5629 eval $xscan;\
5630 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5631 eval $xrun
5632elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5633 eval $xscan;\
5634 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5635 eval $xrun
5636elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5637 eval $xscan;\
5638 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5639 eval $xrun
5640elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5641 eval $xscan;\
5642 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5643 eval $xrun
5644elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5645 eval $xscan;\
5646 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5647 eval $xrun
5648elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5649 eval $xscan;\
5650 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5651 eval $xrun
5652elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
5653 eval $xscan;\
5654 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5655 eval $xrun
5656else
5657 $nm -p $* 2>/dev/null >libc.tmp
5658 $grep fprintf libc.tmp > libc.ptf
5659 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5660 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5661 then
5662 nm_opt='-p'
5663 eval $xrun
bd9b35c9 5664 else
c1a7f87b
JH
5665 echo " "
5666 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5667 com=''
5668 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5669 for thisname in $libnames $libc; do
5670 $ar t $thisname >>libc.tmp
5671 done
5672 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5673 echo "Ok." >&4
5674 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5675 # Repeat libc to extract forwarders to DLL entries too
5676 for thisname in $libnames $libc; do
5677 $ar tv $thisname >>libc.tmp
5678 # Revision 50 of EMX has bug in $ar.
5679 # it will not extract forwarders to DLL entries
5680 # Use emximp which will extract exactly them.
5681 emximp -o tmp.imp $thisname \
5682 2>/dev/null && \
5683 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5684 < tmp.imp >>libc.tmp
5685 $rm tmp.imp
5686 done
5687 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5688 echo "Ok." >&4
5689 else
5690 echo "$ar didn't seem to work right." >&4
5691 echo "Maybe this is a Cray...trying bld instead..." >&4
5692 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5693 then
5694 for thisname in $libnames; do
5695 bld t $libnames | \
5696 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5697 $ar t $thisname >>libc.tmp
5698 done
5699 echo "Ok." >&4
bd9b35c9 5700 else
c1a7f87b
JH
5701 echo "That didn't work either. Giving up." >&4
5702 exit 1
bd9b35c9 5703 fi
c1a7f87b 5704 fi
a4f3eea9 5705 fi
a4f3eea9 5706fi
c1a7f87b
JH
5707nm_extract="$com"
5708if $test -f /lib/syscalls.exp; then
5709 echo " "
5710 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5711 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5712fi
5713;;
5714esac
5715$rm -f libnames libpath
bd9b35c9 5716
c1a7f87b
JH
5717: is a C symbol defined?
5718csym='tlook=$1;
5719case "$3" in
5720-v) tf=libc.tmp; tc=""; tdc="";;
5721-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5722*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5723esac;
5724tx=yes;
5725case "$reuseval-$4" in
5726true-) ;;
5727true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5728esac;
5729case "$tx" in
5730yes)
5731 case "$runnm" in
5732 true)
5733 if $contains $tlook $tf >/dev/null 2>&1;
5734 then tval=true;
5735 else tval=false;
5736 fi;;
5737 *)
5738 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
7a282f6d 5739 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
c1a7f87b
JH
5740 then tval=true;
5741 else tval=false;
5742 fi;
5743 $rm -f t t.c;;
5744 esac;;
5745*)
5746 case "$tval" in
5747 $define) tval=true;;
5748 *) tval=false;;
5749 esac;;
5750esac;
5751eval "$2=$tval"'
bd9b35c9 5752
c1a7f87b
JH
5753: define an is-in-libc? function
5754inlibc='echo " "; td=$define; tu=$undef;
5755sym=$1; var=$2; eval "was=\$$2";
5756tx=yes;
5757case "$reuseval$was" in
5758true) ;;
5759true*) tx=no;;
5760esac;
5761case "$tx" in
5762yes)
5763 set $sym tres -f;
5764 eval $csym;
5765 case "$tres" in
5766 true)
5767 echo "$sym() found." >&4;
5768 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5769 *)
5770 echo "$sym() NOT found." >&4;
5771 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5772 esac;;
bd9b35c9 5773*)
c1a7f87b
JH
5774 case "$was" in
5775 $define) echo "$sym() found." >&4;;
5776 *) echo "$sym() NOT found." >&4;;
5777 esac;;
5778esac'
5779
b4eb6b3d
JH
5780: see if sqrtl exists
5781set sqrtl d_sqrtl
c1a7f87b
JH
5782eval $inlibc
5783
b4eb6b3d
JH
5784case "$ccflags" in
5785*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
c1a7f87b 5786esac
b4eb6b3d
JH
5787
5788case "$uselongdouble" in
5789$define|true|[yY]*) dflt='y';;
5790*) dflt='n';;
5791esac
5792cat <<EOM
5793
5794Perl can be built to take advantage of long doubles which
5795(if available) may give more accuracy and range for floating point numbers.
5796
5797If this doesn't make any sense to you, just accept the default '$dflt'.
5798EOM
5799rp='Try to use long doubles if available?'
c1a7f87b
JH
5800. ./myread
5801case "$ans" in
b4eb6b3d
JH
5802y|Y) val="$define" ;;
5803*) val="$undef" ;;
5804esac
5805set uselongdouble
5806eval $setvar
bfb7748a 5807
b4eb6b3d
JH
5808case "$uselongdouble" in
5809true|[yY]*) uselongdouble="$define" ;;
5810esac
bfb7748a 5811
b4eb6b3d
JH
5812case "$uselongdouble" in
5813$define)
5814: Look for a hint-file generated 'call-back-unit'. If the
5815: user has specified that long doubles should be used,
5816: we may need to set or change some other defaults.
5817 if $test -f uselongdouble.cbu; then
5818 echo "Your platform has some specific hints for long doubles, using them..."
5819 . ./uselongdouble.cbu
5820 else
5821 $cat <<EOM
5822(Your platform doesn't have any specific hints for long doubles.)
c1a7f87b 5823EOM
b4eb6b3d
JH
5824 fi
5825 ;;
5826esac
5827
5828case "$uselongdouble:$d_sqrtl" in
5829$define:$undef)
5830 $cat <<EOM >&4
5831
5832*** You requested the use of long doubles but you do not seem to have
5833*** the mathematic functions for long doubles. I'm disabling the use
5834*** of long doubles.
5835
5836EOM
5837 uselongdouble=$undef
5838 ;;
5839esac
5840
5841: check for length of double
5842echo " "
5843case "$doublesize" in
5844'')
5845 echo "Checking to see how big your double precision numbers are..." >&4
5846 $cat >try.c <<'EOCP'
5847#include <stdio.h>
5848int main()
5849{
5850 printf("%d\n", (int)sizeof(double));
5851 exit(0);
5852}
5853EOCP
5854 set try
5855 if eval $compile_ok; then
5440bc8e 5856 doublesize=`$run ./try`
b4eb6b3d
JH
5857 echo "Your double is $doublesize bytes long."
5858 else
5859 dflt='8'
5860 echo "(I can't seem to compile the test program. Guessing...)"
5861 rp="What is the size of a double precision number (in bytes)?"
5862 . ./myread
5863 doublesize="$ans"
5864 fi
5865 ;;
5866esac
5867$rm -f try.c try
5868
5869: check for long doubles
5870echo " "
5871echo "Checking to see if you have long double..." >&4
5872echo 'int main() { long double x = 7.0; }' > try.c
5873set try
5874if eval $compile; then
5875 val="$define"
5876 echo "You have long double."
5877else
5878 val="$undef"
5879 echo "You do not have long double."
5880fi
5881$rm try.*
5882set d_longdbl
5883eval $setvar
5884
5885: check for length of long double
5886case "${d_longdbl}${longdblsize}" in
5887$define)
5888 echo " "
5889 echo "Checking to see how big your long doubles are..." >&4
5890 $cat >try.c <<'EOCP'
5891#include <stdio.h>
5892int main()
5893{
5894 printf("%d\n", sizeof(long double));
5895}
5896EOCP
5897 set try
5898 set try
5899 if eval $compile; then
5440bc8e 5900 longdblsize=`$run ./try`
b4eb6b3d
JH
5901 echo "Your long doubles are $longdblsize bytes long."
5902 else
5903 dflt='8'
5904 echo " "
5905 echo "(I can't seem to compile the test program. Guessing...)" >&4
5906 rp="What is the size of a long double (in bytes)?"
5907 . ./myread
5908 longdblsize="$ans"
5909 fi
5910 if $test "X$doublesize" = "X$longdblsize"; then
5911 echo "(That isn't any different from an ordinary double.)"
5912 fi
5913 ;;
5914esac
5915$rm -f try.* try
5916
51de783f 5917case "$useperlio" in
5a3a8a02 5918$define|true|[yY]*|'') dflt='y';;
51de783f
JH
5919*) dflt='n';;
5920esac
5921cat <<EOM
5922
5923Previous version of $package used the standard IO mechanisms as
5a3a8a02 5924defined in <stdio.h>. Versions 5.003_02 and later of $package allow
51de783f 5925alternate IO mechanisms via the PerlIO abstraction layer, but the
5a3a8a02
JH
5926stdio mechanism is still available if needed. The abstraction layer
5927can use AT&T's sfio (if you already have sfio installed) or regular stdio.
51de783f
JH
5928Using PerlIO with sfio may cause problems with some extension modules.
5929
5930If this doesn't make any sense to you, just accept the default '$dflt'.
5931EOM
5a3a8a02 5932rp='Use the PerlIO abstraction layer?'
51de783f
JH
5933. ./myread
5934case "$ans" in
5935y|Y)
5936 val="$define"
5a3a8a02 5937 ;;
51de783f
JH
5938*)
5939 echo "Ok, doing things the stdio way."
5940 val="$undef"
5941 ;;
5942esac
5943set useperlio
5944eval $setvar
5945
5946case "$usesocks" in
5947$define|true|[yY]*)
5948 case "$useperlio" in
5949 $define|true|[yY]*) ;;
5950 *) cat >&4 <<EOM
5951
5952You are using the SOCKS proxy protocol library which means that you
5953should also use the PerlIO layer. You may be headed for trouble.
5954
5955EOM
5956 ;;
5957 esac
5958 ;;
5959esac
5960
5961
b4eb6b3d
JH
5962: determine the architecture name
5963echo " "
5964if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5965 tarch=`arch`"-$osname"
5966elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5967 if uname -m > tmparch 2>&1 ; then
5968 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5969 -e 's/$/'"-$osname/" tmparch`
5970 else
5971 tarch="$osname"
5972 fi
5973 $rm -f tmparch
5974else
5975 tarch="$osname"
5976fi
5977case "$myarchname" in
5978''|"$tarch") ;;
5979*)
5980 echo "(Your architecture name used to be $myarchname.)"
5981 archname=''
5982 ;;
5983esac
5440bc8e
JH
5984case "$targetarch" in
5985'') ;;
5986*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5987esac
b4eb6b3d
JH
5988myarchname="$tarch"
5989case "$archname" in
5990'') dflt="$tarch";;
5991*) dflt="$archname";;
5992esac
5993rp='What is your architecture name'
5994. ./myread
5995archname="$ans"
5996case "$usethreads" in
5997$define)
5998 echo "Threads selected." >&4
5999 case "$archname" in
6000 *-thread*) echo "...and architecture name already has -thread." >&4
6001 ;;
6002 *) archname="$archname-thread"
6003 echo "...setting architecture name to $archname." >&4
6004 ;;
6005 esac
6006 ;;
6007esac
6008case "$usemultiplicity" in
6009$define)
6010 echo "Multiplicity selected." >&4
6011 case "$archname" in
6012 *-multi*) echo "...and architecture name already has -multi." >&4
6013 ;;
6014 *) archname="$archname-multi"
6015 echo "...setting architecture name to $archname." >&4
6016 ;;
6017 esac
6018 ;;
6019esac
6020case "$use64bitint$use64bitall" in
6021*"$define"*)
6022 case "$archname64" in
6023 '')
6024 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6025 ;;
6026 *)
6027 case "$use64bitint" in
6028 "$define") echo "64 bit integers selected." >&4 ;;
6029 esac
6030 case "$use64bitall" in
6031 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6032 esac
6033 case "$archname" in
6034 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6035 ;;
6036 *) archname="$archname-$archname64"
6037 echo "...setting architecture name to $archname." >&4
6038 ;;
6039 esac
6040 ;;
6041 esac
6042esac
6043case "$uselongdouble" in
6044$define)
6045 echo "Long doubles selected." >&4
6046 case "$longdblsize" in
6047 $doublesize)
6048 "...but long doubles are equal to doubles, not changing architecture name." >&4
6049 ;;
6050 *)
6051 case "$archname" in
6052 *-ld*) echo "...and architecture name already has -ld." >&4
6053 ;;
6054 *) archname="$archname-ld"
6055 echo "...setting architecture name to $archname." >&4
6056 ;;
6057 esac
6058 ;;
6059 esac
6060 ;;
6061esac
51de783f
JH
6062case "$useperlio" in
6063$define)
6064 echo "Perlio selected." >&4
d46c9a2d
JH
6065 ;;
6066*)
6067 echo "Perlio not selected, using stdio." >&4
51de783f 6068 case "$archname" in
d46c9a2d 6069 *-stdio*) echo "...and architecture name already has -stdio." >&4
51de783f 6070 ;;
d46c9a2d 6071 *) archname="$archname-stdio"
51de783f
JH
6072 echo "...setting architecture name to $archname." >&4
6073 ;;
6074 esac
6075 ;;
6076esac
b4eb6b3d
JH
6077
6078: determine root of directory hierarchy where package will be installed.
6079case "$prefix" in
6080'')
6081 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6082 ;;
6083*)
6084 dflt="$prefix"
6085 ;;
6086esac
6087$cat <<EOM
6088
6089By default, $package will be installed in $dflt/bin, manual pages
6090under $dflt/man, etc..., i.e. with $dflt as prefix for all
6091installation directories. Typically this is something like /usr/local.
6092If you wish to have binaries under /usr/bin but other parts of the
6093installation under /usr/local, that's ok: you will be prompted
6094separately for each of the installation directories, the prefix being
6095only used to set the defaults.
6096
6097EOM
6098fn=d~
6099rp='Installation prefix to use?'
6100. ./getfile
6101oldprefix=''
6102case "$prefix" in
6103'') ;;
6104*)
6105 case "$ans" in
6106 "$prefix") ;;
6107 *) oldprefix="$prefix";;
6108 esac
6109 ;;
6110esac
6111prefix="$ans"
6112prefixexp="$ansexp"
6113
a6d26a0d
JH
6114case "$afsroot" in
6115'') afsroot=/afs ;;
6116*) afsroot=$afsroot ;;
6117esac
6118
b4eb6b3d
JH
6119: is AFS running?
6120echo " "
6121case "$afs" in
6122$define|true) afs=true ;;
6123$undef|false) afs=false ;;
a6d26a0d 6124*) if test -d $afsroot; then
b4eb6b3d
JH
6125 afs=true
6126 else
6127 afs=false
6128 fi
6129 ;;
6130esac
6131if $afs; then
6132 echo "AFS may be running... I'll be extra cautious then..." >&4
6133else
6134 echo "AFS does not seem to be running..." >&4
6135fi
6136
6137: determine installation prefix for where package is to be installed.
6138if $afs; then
6139$cat <<EOM
6140
6141Since you are running AFS, I need to distinguish the directory in which
6142files will reside from the directory in which they are installed (and from
6143which they are presumably copied to the former directory by occult means).
6144
6145EOM
6146 case "$installprefix" in
6147 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6148 *) dflt="$installprefix";;
6149 esac
6150else
6151$cat <<EOM
6152
6153In some special cases, particularly when building $package for distribution,
6154it is convenient to distinguish between the directory in which files should
6155be installed from the directory ($prefix) in which they
6156will eventually reside. For most users, these two directories are the same.
6157
6158EOM
6159 case "$installprefix" in
6160 '') dflt=$prefix ;;
6161 *) dflt=$installprefix;;
6162 esac
6163fi
6164fn=d~
6165rp='What installation prefix should I use for installing files?'
6166. ./getfile
6167installprefix="$ans"
6168installprefixexp="$ansexp"
6169
6170: set the prefixit variable, to compute a suitable default value
6171prefixit='case "$3" in
6172""|none)
6173 case "$oldprefix" in
6174 "") eval "$1=\"\$$2\"";;
6175 *)
6176 case "$3" in
6177 "") eval "$1=";;
6178 none)
6179 eval "tp=\"\$$2\"";
6180 case "$tp" in
6181 ""|" ") eval "$1=\"\$$2\"";;
6182 *) eval "$1=";;
6183 esac;;
6184 esac;;
6185 esac;;
6186*)
6187 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6188 case "$tp" in
6189 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6190 /*-$oldprefix/*|\~*-$oldprefix/*)
6191 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6192 *) eval "$1=\"\$$2\"";;
6193 esac;;
6194esac'
6195
6196
6197: get the patchlevel
6198echo " "
6199echo "Getting the current patchlevel..." >&4
6200if $test -r $rsrc/patchlevel.h;then
6201 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6202 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6203 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6204 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6205 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6206 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
151e6568 6207 perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
b4eb6b3d
JH
6208else
6209 revision=0
6210 patchlevel=0
6211 subversion=0
6212 api_revision=0
6213 api_version=0
6214 api_subversion=0
151e6568
MB
6215 perl_patchlevel=0
6216 $echo "(You do not have patchlevel.h. Eek.)"
b4eb6b3d 6217fi
151e6568
MB
6218if $test -r $rsrc/.patch ; then
6219 if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6220 perl_patchlevel=`cat $rsrc/.patch`
6221 fi
6222fi
6223case "$perl_patchlevel" in
62240) ;;
6225'') $echo "(You have $package version $patchlevel subversion $subversion.)" ;;
6226*) $echo "(You have $package version $patchlevel subversion $subversion patchlevel $perl_patchlevel.)" ;;
6227esac
b4eb6b3d
JH
6228case "$osname" in
6229dos|vms)
6230 : XXX Should be a Configure test for double-dots in filenames.
6231 version=`echo $revision $patchlevel $subversion | \
6232 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6233 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6234 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6235 ;;
6236*)
6237 version=`echo $revision $patchlevel $subversion | \
6238 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6239 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6240 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6241 ;;
6242esac
6243: Special case the 5.005_xx maintenance series, which used 5.005
6244: without any subversion label as a subdirectory in $sitelib
6245if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6246 api_versionstring='5.005'
6247fi
6248
6249: determine installation style
6250: For now, try to deduce it from prefix unless it is already set.
6251: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6252case "$installstyle" in
6253'') case "$prefix" in
6254 *perl*) dflt='lib';;
6255 *) dflt='lib/perl5' ;;
6256 esac
6257 ;;
6258*) dflt="$installstyle" ;;
6259esac
6260: Probably not worth prompting for this since we prompt for all
6261: the directories individually, and the prompt would be too long and
6262: confusing anyway.
6263installstyle=$dflt
6264
6265: determine where private library files go
6266: Usual default is /usr/local/lib/perl5/$version.
6267: Also allow things like /opt/perl/lib/$version, since
6268: /opt/perl/lib/perl5... would be redundant.
6269: The default "style" setting is made in installstyle.U
6270case "$installstyle" in
6271*lib/perl5*) set dflt privlib lib/$package/$version ;;
6272*) set dflt privlib lib/$version ;;
6273esac
6274eval $prefixit
6275$cat <<EOM
6276
6277There are some auxiliary files for $package that need to be put into a
6278private library directory that is accessible by everyone.
6279
6280EOM
6281fn=d~+
6282rp='Pathname where the private library files will reside?'
6283. ./getfile
6284privlib="$ans"
6285privlibexp="$ansexp"
6286: Change installation prefix, if necessary.
6287if $test X"$prefix" != X"$installprefix"; then
6288 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6289else
6290 installprivlib="$privlibexp"
6291fi
6292
6293: set the prefixup variable, to restore leading tilda escape
6294prefixup='case "$prefixexp" in
6295"$prefix") ;;
6296*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6297esac'
6298
6299: determine where public architecture dependent libraries go
6300set archlib archlib
6301eval $prefixit
6302: privlib default is /usr/local/lib/$package/$version
6303: archlib default is /usr/local/lib/$package/$version/$archname
6304: privlib may have an optional trailing /share.
6305tdflt=`echo $privlib | $sed 's,/share$,,'`
6306tdflt=$tdflt/$archname
6307case "$archlib" in
6308'') dflt=$tdflt
6309 ;;
6310*) dflt="$archlib"
6311 ;;
6312esac
6313$cat <<EOM
6314
6315$spackage contains architecture-dependent library files. If you are
6316sharing libraries in a heterogeneous environment, you might store
6317these files in a separate location. Otherwise, you can just include
6318them with the rest of the public library files.
6319
6320EOM
6321fn=d+~
6322rp='Where do you want to put the public architecture-dependent libraries?'
6323. ./getfile
6324archlib="$ans"
6325archlibexp="$ansexp"
6326if $test X"$archlib" = X"$privlib"; then
6327 d_archlib="$undef"
6328else
6329 d_archlib="$define"
6330fi
6331: Change installation prefix, if necessary.
6332if $test X"$prefix" != X"$installprefix"; then
6333 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6334else
6335 installarchlib="$archlibexp"
6336fi
6337
6338
6339: Binary compatibility with 5.005 is not possible for builds
6340: with advanced features
6341case "$usethreads$usemultiplicity" in
6342*define*)
6343 bincompat5005="$undef"
6344 d_bincompat5005="$undef"
6345 ;;
6346*) $cat <<EOM
6347
6348This version of Perl can be compiled for binary compatibility with 5.005.
6349If you decide to do so, you will be able to continue using most of the
6350extensions that were compiled for Perl 5.005.
6351
6352EOM
6353 case "$bincompat5005$d_bincompat5005" in
6354 *"$undef"*) dflt=n ;;
6355 *) dflt=y ;;
6356 esac
6357 rp='Binary compatibility with Perl 5.005?'
6358 . ./myread
6359 case "$ans" in
6360 y*) val="$define" ;;
6361 *) val="$undef" ;;
6362 esac
6363 set d_bincompat5005
6364 eval $setvar
6365 case "$d_bincompat5005" in
6366 "$define")
6367 bincompat5005="$define"
6368 ;;
6369 *) bincompat5005="$undef"
6370 d_bincompat5005="$undef"
6371 ;;
6372 esac
6373 ;;
6374esac
6375
6376
6377: see if setuid scripts can be secure
6378$cat <<EOM
6379
6380Some kernels have a bug that prevents setuid #! scripts from being
6381secure. Some sites have disabled setuid #! scripts because of this.
6382
6383First let's decide if your kernel supports secure setuid #! scripts.
6384(If setuid #! scripts would be secure but have been disabled anyway,
6385don't say that they are secure if asked.)
6386
6387EOM
6388
6389val="$undef"
6390if $test -d /dev/fd; then
6391 echo "#!$ls" >reflect
6392 chmod +x,u+s reflect
6393 ./reflect >flect 2>&1
6394 if $contains "/dev/fd" flect >/dev/null; then
6395 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6396 val="$define"
6397 else
6398 $cat <<EOM
6399If you are not sure if they are secure, I can check but I'll need a
6400username and password different from the one you are using right now.
6401If you don't have such a username or don't want me to test, simply
6402enter 'none'.
6403
6404EOM
6405 rp='Other username to test security of setuid scripts with?'
6406 dflt='none'
6407 . ./myread
6408 case "$ans" in
6409 n|none)
6410 case "$d_suidsafe" in
6411 '') echo "I'll assume setuid scripts are *not* secure." >&4
6412 dflt=n;;
6413 "$undef")
6414 echo "Well, the $hint value is *not* secure." >&4
6415 dflt=n;;
6416 *) echo "Well, the $hint value *is* secure." >&4
6417 dflt=y;;
6418 esac
c1a7f87b 6419 ;;
b4eb6b3d
JH
6420 *)
6421 $rm -f reflect flect
6422 echo "#!$ls" >reflect
6423 chmod +x,u+s reflect
6424 echo >flect
6425 chmod a+w flect
6426 echo '"su" will (probably) prompt you for '"$ans's password."
6427 su $ans -c './reflect >flect'
6428 if $contains "/dev/fd" flect >/dev/null; then
6429 echo "Okay, it looks like setuid scripts are secure." >&4
6430 dflt=y
6431 else
6432 echo "I don't think setuid scripts are secure." >&4
6433 dflt=n
6434 fi
6435 ;;
6436 esac
6437 rp='Does your kernel have *secure* setuid scripts?'
6438 . ./myread
6439 case "$ans" in
6440 [yY]*) val="$define";;
6441 *) val="$undef";;
6442 esac
6443 fi
6444else
6445 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6446 echo "(That's for file descriptors, not floppy disks.)"
6447 val="$undef"
6448fi
6449set d_suidsafe
6450eval $setvar
6451
6452$rm -f reflect flect
6453
6454: now see if they want to do setuid emulation
6455echo " "
6456val="$undef"
6457case "$d_suidsafe" in
6458"$define")
6459 val="$undef"
6460 echo "No need to emulate SUID scripts since they are secure here." >& 4
6461 ;;
6462*)
6463 $cat <<EOM
6464Some systems have disabled setuid scripts, especially systems where
6465setuid scripts cannot be secure. On systems where setuid scripts have
6466been disabled, the setuid/setgid bits on scripts are currently
6467useless. It is possible for $package to detect those bits and emulate
6468setuid/setgid in a secure fashion. This emulation will only work if
6469setuid scripts have been disabled in your kernel.
6470
6471EOM
6472 case "$d_dosuid" in
6473 "$define") dflt=y ;;
6474 *) dflt=n ;;
6475 esac
6476 rp="Do you want to do setuid/setgid emulation?"
6477 . ./myread
6478 case "$ans" in
6479 [yY]*) val="$define";;
6480 *) val="$undef";;
6481 esac
6482 ;;
6483esac
6484set d_dosuid
6485eval $setvar
6486
b4eb6b3d
JH
6487: see if this is a malloc.h system
6488set malloc.h i_malloc
6489eval $inhdr
6490
6491: see if stdlib is available
6492set stdlib.h i_stdlib
6493eval $inhdr
6494
6495: determine which malloc to compile in
6496echo " "
6497case "$usemymalloc" in
c4163172
JH
6498[yY]*|true|$define) dflt='y' ;;
6499[nN]*|false|$undef) dflt='n' ;;
6500*) case "$ptrsize" in
6501 4) dflt='y' ;;
6502 *) dflt='n' ;;
6503 esac
6504 ;;
8dfa8df9 6505esac
b4eb6b3d
JH
6506rp="Do you wish to attempt to use the malloc that comes with $package?"
6507. ./myread
6508usemymalloc="$ans"
6509case "$ans" in
6510y*|true)
6511 usemymalloc='y'
6512 mallocsrc='malloc.c'
6513 mallocobj="malloc$_o"
6514 d_mymalloc="$define"
6515 case "$libs" in
6516 *-lmalloc*)
6517 : Remove malloc from list of libraries to use
6518 echo "Removing unneeded -lmalloc from library list" >&4
6519 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6520 shift
6521 libs="$*"
6522 echo "libs = $libs" >&4
6523 ;;
6524 esac
6525 ;;
6526*)
6527 usemymalloc='n'
6528 mallocsrc=''
6529 mallocobj=''
6530 d_mymalloc="$undef"
6531 ;;
6532esac
6533
6534: compute the return types of malloc and free
6535echo " "
6536$cat >malloc.c <<END
6537#$i_malloc I_MALLOC
6538#$i_stdlib I_STDLIB
6539#include <stdio.h>
6540#include <sys/types.h>
6541#ifdef I_MALLOC
6542#include <malloc.h>
6543#endif
6544#ifdef I_STDLIB
6545#include <stdlib.h>
6546#endif
6547#ifdef TRY_MALLOC
6548void *malloc();
6549#endif
6550#ifdef TRY_FREE
6551void free();
6552#endif
6553END
6554case "$malloctype" in
6555'')
6556 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6557 malloctype='void *'
6558 else
6559 malloctype='char *'
6560 fi
6561 ;;
6562esac
6563echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6564
6565case "$freetype" in
6566'')
6567 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6568 freetype='void'
6569 else
6570 freetype='int'
6571 fi
6572 ;;
6573esac
6574echo "Your system uses $freetype free(), it would seem." >&4
6575$rm -f malloc.[co]
6576$cat <<EOM
6577
6578After $package is installed, you may wish to install various
6579add-on modules and utilities. Typically, these add-ons will
6580be installed under $prefix with the rest
6581of this package. However, you may wish to install such add-ons
6582elsewhere under a different prefix.
6583
6584If you do not wish to put everything under a single prefix, that's
6585ok. You will be prompted for the individual locations; this siteprefix
6586is only used to suggest the defaults.
6587
6588The default should be fine for most people.
6589
6590EOM
6591fn=d~+
6592rp='Installation prefix to use for add-on modules and utilities?'
6593: XXX Here might be another good place for an installstyle setting.
6594case "$siteprefix" in
6595'') dflt=$prefix ;;
6596*) dflt=$siteprefix ;;
6597esac
6598. ./getfile
6599: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6600oldsiteprefix=''
6601case "$siteprefix" in
6602'') ;;
6603*) case "$ans" in
6604 "$prefix") ;;
6605 *) oldsiteprefix="$prefix";;
6606 esac
6607 ;;
6608esac
6609siteprefix="$ans"
6610siteprefixexp="$ansexp"
6611
6612: determine where site specific libraries go.
6613: Usual default is /usr/local/lib/perl5/site_perl/$version
6614: The default "style" setting is made in installstyle.U
6615: XXX No longer works with Prefixit stuff.
6616prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6617case "$sitelib" in
6618'') case "$installstyle" in
6619 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6620 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6621 esac
6622 ;;
6623*) dflt="$sitelib"
6624 ;;
6625esac
6626$cat <<EOM
6627
6628The installation process will create a directory for
6629site-specific extensions and modules. Most users find it convenient
6630to place all site-specific files in this directory rather than in the
6631main distribution directory.
6632
6633EOM
6634fn=d~+
6635rp='Pathname for the site-specific library files?'
6636. ./getfile
6637sitelib="$ans"
6638sitelibexp="$ansexp"
6639sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6640: Change installation prefix, if necessary.
6641if $test X"$prefix" != X"$installprefix"; then
6642 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6643else
6644 installsitelib="$sitelibexp"
6645fi
6646
6647: determine where site specific architecture-dependent libraries go.
6648: sitelib default is /usr/local/lib/perl5/site_perl/$version
6649: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6650: sitelib may have an optional trailing /share.
6651case "$sitearch" in
6652'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6653 dflt="$dflt/$archname"
6654 ;;
6655*) dflt="$sitearch"
6656 ;;
6657esac
6658set sitearch sitearch none
6659eval $prefixit
6660$cat <<EOM
6661
6662The installation process will also create a directory for
6663architecture-dependent site-specific extensions and modules.
6664
6665EOM
6666fn=d~+
6667rp='Pathname for the site-specific architecture-dependent library files?'
6668. ./getfile
6669sitearch="$ans"
6670sitearchexp="$ansexp"
6671: Change installation prefix, if necessary.
6672if $test X"$prefix" != X"$installprefix"; then
6673 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6674else
6675 installsitearch="$sitearchexp"
6676fi
6677
6678$cat <<EOM
6679
6680The installation process will also create a directory for
6681vendor-supplied add-ons. Vendors who supply perl with their system
6682may find it convenient to place all vendor-supplied files in this
6683directory rather than in the main distribution directory. This will
6684ease upgrades between binary-compatible maintenance versions of perl.
6685
6686Of course you may also use these directories in whatever way you see
6687fit. For example, you might use them to access modules shared over a
6688company-wide network.
6689
6690The default answer should be fine for most people.
6691This causes further questions about vendor add-ons to be skipped
6692and no vendor-specific directories will be configured for perl.
6693
6694EOM
6695rp='Do you want to configure vendor-specific add-on directories?'
6696case "$usevendorprefix" in
6697define|true|[yY]*) dflt=y ;;
6698*) : User may have set vendorprefix directly on Configure command line.
6699 case "$vendorprefix" in
6700 ''|' ') dflt=n ;;
6701 *) dflt=y ;;
6702 esac
6703 ;;
6704esac
6705. ./myread
6706case "$ans" in
6707[yY]*) fn=d~+
6708 rp='Installation prefix to use for vendor-supplied add-ons?'
6709 case "$vendorprefix" in
6710 '') dflt='' ;;
6711 *) dflt=$vendorprefix ;;
6712 esac
6713 . ./getfile
6714 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6715 oldvendorprefix=''
6716 case "$vendorprefix" in
6717 '') ;;
6718 *) case "$ans" in
6719 "$prefix") ;;
6720 *) oldvendorprefix="$prefix";;
6721 esac
6722 ;;
6723 esac
6724 usevendorprefix="$define"
6725 vendorprefix="$ans"
6726 vendorprefixexp="$ansexp"
6727 ;;
6728*) usevendorprefix="$undef"
6729 vendorprefix=''
6730 vendorprefixexp=''
6731 ;;
6732esac
6733
6734case "$vendorprefix" in
6735'') d_vendorlib="$undef"
6736 vendorlib=''
6737 vendorlibexp=''
6738 ;;
6739*) d_vendorlib="$define"
6740 : determine where vendor-supplied modules go.
6741 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6742 case "$vendorlib" in
6743 '')
6744 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6745 case "$installstyle" in
6746 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6747 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6748 esac
6749 ;;
6750 *) dflt="$vendorlib"
6751 ;;
6752 esac
6753 fn=d~+
6754 rp='Pathname for the vendor-supplied library files?'
6755 . ./getfile
6756 vendorlib="$ans"
6757 vendorlibexp="$ansexp"
6758 ;;
6759esac
6760vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6761: Change installation prefix, if necessary.
6762if $test X"$prefix" != X"$installprefix"; then
6763 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6764else
6765 installvendorlib="$vendorlibexp"
6766fi
6767
6768case "$vendorprefix" in
6769'') d_vendorarch="$undef"
6770 vendorarch=''
6771 vendorarchexp=''
6772 ;;
6773*) d_vendorarch="$define"
6774 : determine where vendor-supplied architecture-dependent libraries go.
6775 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6776 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6777 : vendorlib may have an optional trailing /share.
6778 case "$vendorarch" in
6779 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6780 dflt="$dflt/$archname"
6781 ;;
6782 *) dflt="$vendorarch" ;;
6783 esac
6784 fn=d~+
6785 rp='Pathname for vendor-supplied architecture-dependent files?'
6786 . ./getfile
6787 vendorarch="$ans"
6788 vendorarchexp="$ansexp"
6789 ;;
6790esac
6791: Change installation prefix, if necessary.
6792if $test X"$prefix" != X"$installprefix"; then
6793 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6794else
6795 installvendorarch="$vendorarchexp"
6796fi
6797
6798: Final catch-all directories to search
6799$cat <<EOM
6800
6801Lastly, you can have perl look in other directories for extensions and
6802modules in addition to those already specified.
6803These directories will be searched after
6804 $sitearch
6805 $sitelib
6806EOM
6807test X"$vendorlib" != "X" && echo ' ' $vendorlib
6808test X"$vendorarch" != "X" && echo ' ' $vendorarch
6809echo ' '
6810case "$otherlibdirs" in
6811''|' ') dflt='none' ;;
6812*) dflt="$otherlibdirs" ;;
6813esac
6814$cat <<EOM
6815Enter a colon-separated set of extra paths to include in perl's @INC
6816search path, or enter 'none' for no extra paths.
6817
6818EOM
6819
6820rp='Colon-separated list of additional directories for perl to search?'
6821. ./myread
6822case "$ans" in
6823' '|''|none) otherlibdirs=' ' ;;
6824*) otherlibdirs="$ans" ;;
6825esac
6826case "$otherlibdirs" in
6827' ') val=$undef ;;
6828*) val=$define ;;
6829esac
6830set d_perl_otherlibdirs
6831eval $setvar
6832
6833: Cruising for prototypes
6834echo " "
6835echo "Checking out function prototypes..." >&4
6836$cat >prototype.c <<'EOCP'
6837int main(int argc, char *argv[]) {
6838 exit(0);}
6839EOCP
6840if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6841 echo "Your C compiler appears to support function prototypes."
6842 val="$define"
6843else
6844 echo "Your C compiler doesn't seem to understand function prototypes."
6845 val="$undef"
6846fi
6847set prototype
6848eval $setvar
6849$rm -f prototype*
6850
6851case "$prototype" in
6852"$define") ;;
6853*) ansi2knr='ansi2knr'
6854 echo " "
6855 cat <<EOM >&4
6856
6857$me: FATAL ERROR:
6858This version of $package can only be compiled by a compiler that
6859understands function prototypes. Unfortunately, your C compiler
6860 $cc $ccflags
6861doesn't seem to understand them. Sorry about that.
6862
6863If GNU cc is available for your system, perhaps you could try that instead.
6864
6865Eventually, we hope to support building Perl with pre-ANSI compilers.
6866If you would like to help in that effort, please contact <perlbug@perl.org>.
6867
6868Aborting Configure now.
6869EOM
6870 exit 2
6871 ;;
6872esac
6873
6874: determine where public executables go
6875echo " "
6876set dflt bin bin
6877eval $prefixit
6878fn=d~
6879rp='Pathname where the public executables will reside?'
6880. ./getfile
6881if $test "X$ansexp" != "X$binexp"; then
6882 installbin=''
6883fi
6884bin="$ans"
6885binexp="$ansexp"
6886: Change installation prefix, if necessary.
6887: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6888if $test X"$prefix" != X"$installprefix"; then
6889 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6890else
6891 installbin="$binexp"
6892fi
6893
6894: Find perl5.005 or later.
6895echo "Looking for a previously installed perl5.005 or later... "
6896case "$perl5" in
a938a3bb 6897'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
b4eb6b3d 6898 : Check if this perl is recent and can load a simple module
a938a3bb 6899 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
b4eb6b3d
JH
6900 perl5=$tdir/perl
6901 break;
a938a3bb
IZ
6902 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6903 perl5=$tdir/perl5
b4eb6b3d
JH
6904 break;
6905 fi
6906 done
6907 ;;
6908*) perl5="$perl5"
6909 ;;
6910esac
6911case "$perl5" in
6912'') echo "None found. That's ok.";;
6913*) echo "Using $perl5." ;;
6914esac
6915
6916: Determine list of previous versions to include in @INC
6917$cat > getverlist <<EOPL
6918#!$perl5 -w
6919use File::Basename;
6920\$api_versionstring = "$api_versionstring";
6921\$version = "$version";
6922\$stem = "$sitelib_stem";
6923\$archname = "$archname";
6924EOPL
6925 $cat >> getverlist <<'EOPL'
6926# Can't have leading @ because metaconfig interprets it as a command!
6927;@inc_version_list=();
6928# XXX Redo to do opendir/readdir?
6929if (-d $stem) {
6930 chdir($stem);
6931 ;@candidates = glob("5.*");
6932}
6933else {
6934 ;@candidates = ();
6935}
6936
6937# XXX ToDo: These comparisons must be reworked when two-digit
6938# subversions come along, so that 5.7.10 compares as greater than
6939# 5.7.3! By that time, hope that 5.6.x is sufficiently
6940# widespread that we can use the built-in version vectors rather
6941# than reinventing them here. For 5.6.0, however, we must
6942# assume this script will likely be run by 5.005_0x. --AD 1/2000.
6943foreach $d (@candidates) {
6944 if ($d lt $version) {
6945 if ($d ge $api_versionstring) {
6946 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6947 }
6948 elsif ($d ge "5.005") {
6949 unshift(@inc_version_list, grep { -d } $d);
6950 }
6951 }
6952 else {
6953 # Skip newer version. I.e. don't look in
6954 # 5.7.0 if we're installing 5.6.1.
6955 }
6956}
6957
6958if (@inc_version_list) {
6959 print join(' ', @inc_version_list);
6960}
6961else {
6962 # Blank space to preserve value for next Configure run.
6963 print " ";
6964}
6965EOPL
6966chmod +x getverlist
6967case "$inc_version_list" in
a938a3bb 6968'') if test -x "$perl5$exe_ext"; then
b4eb6b3d
JH
6969 dflt=`$perl5 getverlist`
6970 else
6971 dflt='none'
6972 fi
6973 ;;
6974$undef) dflt='none' ;;
6d1a7737 6975*) eval dflt=\"$inc_version_list\" ;;
b4eb6b3d
JH
6976esac
6977case "$dflt" in
6978''|' ') dflt=none ;;
6979esac
6980case "$dflt" in
69815.005) case "$bincompat5005" in
6982 $define|true|[yY]*) ;;
6983 *) dflt=none ;;
6984 esac
6985 ;;
6986esac
6987$cat <<'EOM'
6988
6989In order to ease the process of upgrading, this version of perl
6990can be configured to use modules built and installed with earlier
6991versions of perl that were installed under $prefix. Specify here
6992the list of earlier versions that this version of perl should check.
6993If Configure detected no earlier versions of perl installed under
6994$prefix, then the list will be empty. Answer 'none' to tell perl
6995to not search earlier versions.
6996
6997The default should almost always be sensible, so if you're not sure,
6998just accept the default.
6999EOM
7000
7001rp='List of earlier versions to include in @INC?'
7002. ./myread
7003case "$ans" in
7004[Nn]one|''|' ') inc_version_list=' ' ;;
7005*) inc_version_list="$ans" ;;
7006esac
7007case "$inc_version_list" in
7008''|' ')
7009 inc_version_list_init='0';;
7010*) inc_version_list_init=`echo $inc_version_list |
7011 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7012 ;;
7013esac
7014$rm -f getverlist
7015
7016: determine whether to install perl also as /usr/bin/perl
7017
7018echo " "
7019if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7020 $cat <<EOM
7021Many scripts expect perl to be installed as /usr/bin/perl.
7022I can install the perl you are about to compile also as /usr/bin/perl
7023(in addition to $installbin/perl).
7024EOM
7025 case "$installusrbinperl" in
7026 "$undef"|[nN]*) dflt='n';;
7027 *) dflt='y';;
7028 esac
7029 rp="Do you want to install perl as /usr/bin/perl?"
7030 . ./myread
7031 case "$ans" in
7032 [yY]*) val="$define";;
7033 *) val="$undef" ;;
7034 esac
7035else
7036 val="$undef"
7037fi
7038set installusrbinperl
7039eval $setvar
7040
7041: see if dld is available
7042set dld.h i_dld
7043eval $inhdr
7044
7045: see if dlopen exists
7046xxx_runnm="$runnm"
7047runnm=false
7048set dlopen d_dlopen
7049eval $inlibc
7050runnm="$xxx_runnm"
7051
7052: determine which dynamic loading, if any, to compile in
7053echo " "
7054dldir="ext/DynaLoader"
7055case "$usedl" in
7056$define|y|true)
7057 dflt='y'
7058 usedl="$define"
7059 ;;
7060$undef|n|false)
7061 dflt='n'
7062 usedl="$undef"
7063 ;;
7064*)
7065 dflt='n'
7066 case "$d_dlopen" in
7067 $define) dflt='y' ;;
7068 esac
7069 case "$i_dld" in
7070 $define) dflt='y' ;;
7071 esac
7072 : Does a dl_xxx.xs file exist for this operating system
7073 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7074 ;;
7075esac
7076rp="Do you wish to use dynamic loading?"
7077. ./myread
7078usedl="$ans"
7079case "$ans" in
7080y*) usedl="$define"
7081 case "$dlsrc" in
7082 '')
7083 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7084 dflt="$dldir/dl_${osname}.xs"
7085 elif $test "$d_dlopen" = "$define" ; then
7086 dflt="$dldir/dl_dlopen.xs"
7087 elif $test "$i_dld" = "$define" ; then
7088 dflt="$dldir/dl_dld.xs"
7089 else
7090 dflt=''
7091 fi
7092 ;;
7093 *) dflt="$dldir/$dlsrc"
7094 ;;
7095 esac
7096 echo "The following dynamic loading files are available:"
7097 : Can not go over to $dldir because getfile has path hard-coded in.
7098 tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
7099 rp="Source file to use for dynamic loading"
7100 fn="fne"
7101 gfpth="$src"
7102 . ./getfile
7103 usedl="$define"
7104 : emulate basename
7105 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7106
7107 $cat << EOM
7108
7109Some systems may require passing special flags to $cc -c to
7110compile modules that will be used to create a shared library.
7111To use no flags, say "none".
7112
7113EOM
7114 case "$cccdlflags" in
7115 '') case "$gccversion" in
7116 '') case "$osname" in
7117 hpux) dflt='+z' ;;
7118 next) dflt='none' ;;
7119 irix*) dflt='-KPIC' ;;
48bcfe03 7120 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7121 sunos) dflt='-pic' ;;
7122 *) dflt='none' ;;
7123 esac
7124 ;;
7125 *) case "$osname" in
48bcfe03 7126 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7127 *) dflt='-fpic' ;;
7128 esac ;;
7129 esac ;;
7130 ' ') dflt='none' ;;
7131 *) dflt="$cccdlflags" ;;
7132 esac
7133 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7134 . ./myread
7135 case "$ans" in
7136 none) cccdlflags=' ' ;;
7137 *) cccdlflags="$ans" ;;
7138 esac
7139
7140 cat << EOM
7141
7142Some systems use ld to create libraries that can be dynamically loaded,
7143while other systems (such as those using ELF) use $cc.
7144
7145EOM
7146 case "$ld" in
7147 '') $cat >try.c <<'EOM'
7148/* Test for whether ELF binaries are produced */
7149#include <fcntl.h>
7150#include <stdlib.h>
7151int main() {
7152 char b[4];
7153 int i = open("a.out",O_RDONLY);
7154 if(i == -1)
7155 exit(1); /* fail */
7156 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7157 exit(0); /* succeed (yes, it's ELF) */
7158 else
7159 exit(1); /* fail */
7160}
7161EOM
5440bc8e 7162 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7163 cat <<EOM
7164You appear to have ELF support. I'll use $cc to build dynamic libraries.
7165EOM
7166 dflt="$cc"
7167 else
7168 echo "I'll use ld to build dynamic libraries."
7169 dflt='ld'
7170 fi
7171 rm -f try.c a.out
7172 ;;
7173 *) dflt="$ld"
7174 ;;
7175 esac
7176
7177 rp="What command should be used to create dynamic libraries?"
7178 . ./myread
7179 ld="$ans"
7180
7181 cat << EOM
7182
7183Some systems may require passing special flags to $ld to create a
7184library that can be dynamically loaded. If your ld flags include
7185-L/other/path options to locate libraries outside your loader's normal
7186search path, you may need to specify those -L options here as well. To
7187use no flags, say "none".
7188
7189EOM
7190 case "$lddlflags" in
7191 '') case "$osname" in
7192 beos) dflt='-nostart' ;;
7193 hpux) dflt='-b';
7194 case "$gccversion" in
7195 '') dflt="$dflt +vnocompatwarnings" ;;
7196 esac
7197 ;;
7198 linux|irix*) dflt='-shared' ;;
7199 next) dflt='none' ;;
7200 solaris) dflt='-G' ;;
7201 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7202 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7203 *) dflt='none' ;;
7204 esac
7205 ;;
7206 *) dflt="$lddlflags" ;;
7207 esac
7208
7209 : Try to guess additional flags to pick up local libraries.
7210 : Be careful not to append to a plain 'none'
7211 case "$dflt" in
7212 none) dflt='' ;;
7213 esac
7214 for thisflag in $ldflags; do
7215 case "$thisflag" in
7216 -L*|-R*)
7217 case " $dflt " in
7218 *" $thisflag "*) ;;
7219 *) dflt="$dflt $thisflag" ;;
7220 esac
7221 ;;
7222 esac
7223 done
7224
7225 case "$dflt" in
7226 ''|' ') dflt='none' ;;
7227 esac
7228
7229 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7230 . ./myread
7231 case "$ans" in
7232 none) lddlflags=' ' ;;
7233 *) lddlflags="$ans" ;;
7234 esac
7235
7236 cat <<EOM
7237
7238Some systems may require passing special flags to $cc to indicate that
7239the resulting executable will use dynamic linking. To use no flags,
7240say "none".
7241
7242EOM
7243 case "$ccdlflags" in
7244 '') case "$osname" in
7245 hpux) dflt='-Wl,-E' ;;
7246 linux) dflt='-rdynamic' ;;
7247 next) dflt='none' ;;
7248 sunos) dflt='none' ;;
7249 *) dflt='none' ;;
7250 esac ;;
7251 ' ') dflt='none' ;;
7252 *) dflt="$ccdlflags" ;;
7253 esac
7254 rp="Any special flags to pass to $cc to use dynamic linking?"
7255 . ./myread
7256 case "$ans" in
7257 none) ccdlflags=' ' ;;
7258 *) ccdlflags="$ans" ;;
7259 esac
7260 ;;
7261*) usedl="$undef"
7262 ld='ld'
7263 dlsrc='dl_none.xs'
7264 lddlflags=''
7265 ccdlflags=''
7266 ;;
7267esac
7268
7269also=''
7270case "$usedl" in
7271$undef)
7272 # No dynamic loading being used, so don't bother even to prompt.
7273 useshrplib='false'
7274 ;;
7275*) case "$useshrplib" in
7276 '') case "$osname" in
48bcfe03 7277 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7278 dflt=y
7279 also='Building a shared libperl is required for dynamic loading to work on your system.'
7280 ;;
7281 next*)
7282 case "$osvers" in
7283 4*) dflt=y
7284 also='Building a shared libperl is needed for MAB support.'
7285 ;;
7286 *) dflt=n
7287 ;;
7288 esac
7289 ;;
7290 *) dflt=n
7291 ;;
7292 esac
7293 ;;
7294 $define|true|[Yy]*)
7295 dflt=y
7296 ;;
7297 *) dflt=n
7298 ;;
7299 esac
7300 $cat << EOM
7301
7302The perl executable is normally obtained by linking perlmain.c with
7303libperl${_a}, any static extensions (usually just DynaLoader), and
7304any other libraries needed on this system (such as -lm, etc.). Since
7305your system supports dynamic loading, it is probably possible to build
7306a shared libperl.$so. If you will have more than one executable linked
7307to libperl.$so, this will significantly reduce the size of each
7308executable, but it may have a noticeable affect on performance. The
7309default is probably sensible for your system.
7310$also
7311
7312EOM
7313 rp="Build a shared libperl.$so (y/n)"
7314 . ./myread
7315 case "$ans" in
7316 true|$define|[Yy]*)
7317 useshrplib='true' ;;
7318 *) useshrplib='false' ;;
7319 esac
7320 ;;
7321esac
7322
7323case "$useshrplib" in
7324true)
7325 case "$libperl" in
7326 '')
7327 # Figure out a good name for libperl.so. Since it gets stored in
7328 # a version-specific architecture-dependent library, the version
7329 # number isn't really that important, except for making cc/ld happy.
7330 #
7331 # A name such as libperl.so.3.1
7332 majmin="libperl.$so.$patchlevel.$subversion"
7333 # A name such as libperl.so.301
7334 majonly=`echo $patchlevel $subversion |
7335 $awk '{printf "%d%02d", $1, $2}'`
7336 majonly=libperl.$so.$majonly
7337 # I'd prefer to keep the os-specific stuff here to a minimum, and
7338 # rely on figuring it out from the naming of libc.
7339 case "${osname}${osvers}" in
7340 next4*)
7341 dflt=libperl.5.$so
7342 # XXX How handle the --version stuff for MAB?
7343 ;;
7344 linux*) # ld won't link with a bare -lperl otherwise.
7345 dflt=libperl.$so
7346 ;;
7347 cygwin*) # include version
7348 dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7349 ;;
7350 *) # Try to guess based on whether libc has major.minor.
7351 case "$libc" in
7352 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7353 *libc.$so.[0-9]*) dflt=$majonly ;;
7354 *) dflt=libperl.$so ;;
7355 esac
7356 ;;
7357 esac
7358 ;;
7359 *) dflt=$libperl
7360 ;;
7361 esac
7362 cat << EOM
7363
7364I need to select a good name for the shared libperl. If your system uses
7365library names with major and minor numbers, then you might want something
7366like $majmin. Alternatively, if your system uses a single version
7367number for shared libraries, then you might want to use $majonly.
7368Or, your system might be quite happy with a simple libperl.$so.
7369
7370Since the shared libperl will get installed into a version-specific
7371architecture-dependent directory, the version number of the shared perl
7372library probably isn't important, so the default should be o.k.
7373
7374EOM
7375 rp='What name do you want to give to the shared libperl?'
7376 . ./myread
7377 libperl=$ans
7378 echo "Ok, I'll use $libperl"
7379 ;;
7380*)
7381 libperl="libperl${_a}"
7382 ;;
7383esac
7384
7385# Detect old use of shrpdir via undocumented Configure -Dshrpdir
7386case "$shrpdir" in
7387'') ;;
7388*) $cat >&4 <<EOM
7389WARNING: Use of the shrpdir variable for the installation location of
7390the shared $libperl is not supported. It was never documented and
7391will not work in this version. Let me (perlbug@perl.org)
7392know of any problems this may cause.
7393
7394EOM
7395 case "$shrpdir" in
7396 "$archlibexp/CORE")
7397 $cat >&4 <<EOM
7398But your current setting of $shrpdir is
7399the default anyway, so it's harmless.
7400EOM
7401 ;;
7402 *)
7403 $cat >&4 <<EOM
7404Further, your current attempted setting of $shrpdir
7405conflicts with the value of $archlibexp/CORE
7406that installperl will use.
7407EOM
7408 ;;
7409 esac
7410 ;;
7411esac
7412
7413# How will the perl executable find the installed shared $libperl?
7414# Add $xxx to ccdlflags.
7415# If we can't figure out a command-line option, use $shrpenv to
7416# set env LD_RUN_PATH. The main perl makefile uses this.
7417shrpdir=$archlibexp/CORE
7418xxx=''
7419tmp_shrpenv=''
7420if "$useshrplib"; then
7421 case "$osname" in
7422 aix)
7423 # We'll set it in Makefile.SH...
7424 ;;
7425 solaris|netbsd)
7426 xxx="-R $shrpdir"
7427 ;;
7428 freebsd)
7429 xxx="-Wl,-R$shrpdir"
7430 ;;
7431 linux|irix*|dec_osf)
7432 xxx="-Wl,-rpath,$shrpdir"
7433 ;;
7434 next)
7435 # next doesn't like the default...
7436 ;;
7437 beos)
7438 # beos doesn't like the default, either.
7439 ;;
7440 hpux*)
7441 # hpux doesn't like the default, either.
7442 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7443 ;;
7444 *)
7445 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7446 ;;
7447 esac
7448 case "$xxx" in
7449 '') ;;
7450 *)
7451 # Only add $xxx if it isn't already in ccdlflags.
7452 case " $ccdlflags " in
7453 *" $xxx "*) ;;
7454 *) ccdlflags="$ccdlflags $xxx"
7455 cat <<EOM >&4
7456
7457Adding $xxx to the flags
7458passed to $ld so that the perl executable will find the
7459installed shared $libperl.
7460
7461EOM
7462 ;;
7463 esac
7464 ;;
7465 esac
7466fi
7467# Fix ccdlflags in AIX for building external extensions.
7468# (For building Perl itself bare -bE:perl.exp is needed,
7469# Makefile.SH takes care of this.)
7470case "$osname" in
7471aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7472esac
7473# Respect a hint or command-line value.
7474case "$shrpenv" in
7475'') shrpenv="$tmp_shrpenv" ;;
7476esac
7477case "$ldlibpthname" in
7478'') ldlibpthname=LD_LIBRARY_PATH ;;
7479none) ldlibpthname='' ;;
7480esac
7481
7482: determine where manual pages are on this system
7483echo " "
7484case "$sysman" in
7485'')
7486 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
7487 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
7488 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7489 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7490 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7491 sysman=`./loc . /usr/man/man1 $syspath`
7492 ;;
7493esac
7494if $test -d "$sysman"; then
7495 echo "System manual is in $sysman." >&4
7496else
7497 echo "Could not find manual pages in source form." >&4
7498fi
7499
7500: determine where manual pages go
7501set man1dir man1dir none
7502eval $prefixit
7503$cat <<EOM
7504
7505$spackage has manual pages available in source form.
7506EOM
7507case "$nroff" in
7508nroff)
7509 echo "However, you don't have nroff, so they're probably useless to you."
7510 case "$man1dir" in
7511 '') man1dir="none";;
7512 esac;;
7513esac
7514echo "If you don't want the manual sources installed, answer 'none'."
7515case "$man1dir" in
7516' ') dflt=none
7517 ;;
7518'')
7519 lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
7520 lookpath="$lookpath $prefixexp/man/p_man/man1"
7521 lookpath="$lookpath $prefixexp/man/u_man/man1"
7522 lookpath="$lookpath $prefixexp/man/man.1"
7523 case "$sysman" in
7524 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7525 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7526 esac
7527 set dflt
7528 eval $prefixup
7529 ;;
7530*) dflt="$man1dir"
7531 ;;
7532esac
7533echo " "
7534fn=dn+~
7535rp="Where do the main $spackage manual pages (source) go?"
7536. ./getfile
7537if $test "X$man1direxp" != "X$ansexp"; then
7538 installman1dir=''
7539fi
7540man1dir="$ans"
7541man1direxp="$ansexp"
7542case "$man1dir" in
7543'') man1dir=' '
7544 installman1dir='';;
7545esac
7546
7547: Change installation prefix, if necessary.
7548if $test X"$prefix" != X"$installprefix"; then
7549 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7550else
7551 installman1dir="$man1direxp"
7552fi
7553
7554: What suffix to use on installed man pages
7555
7556case "$man1dir" in
7557' ')
7558 man1ext='0'
7559 ;;
7560*)
7561 rp="What suffix should be used for the main $spackage man pages?"
7562 case "$man1ext" in
7563 '') case "$man1dir" in
7564 *1) dflt=1 ;;
7565 *1p) dflt=1p ;;
7566 *1pm) dflt=1pm ;;
7567 *l) dflt=l;;
7568 *n) dflt=n;;
7569 *o) dflt=o;;
7570 *p) dflt=p;;
7571 *C) dflt=C;;
7572 *L) dflt=L;;
7573 *L1) dflt=L1;;
7574 *) dflt=1;;
7575 esac
7576 ;;
7577 *) dflt="$man1ext";;
7578 esac
7579 . ./myread
7580 man1ext="$ans"
7581 ;;
7582esac
7583
7584: see if we can have long filenames
7585echo " "
7586first=123456789abcdef
7587$rm -f $first
7588if (echo hi >$first) 2>/dev/null; then
7589 if $test -f 123456789abcde; then
7590 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
7591 val="$undef"
7592 else
7593 echo 'You can have filenames longer than 14 characters.'>&4
7594 val="$define"
7595 fi
7596else
7597 $cat <<'EOM'
7598You can't have filenames longer than 14 chars.
7599You can't even think about them!
7600EOM
7601 val="$undef"
7602fi
7603set d_flexfnam
7604eval $setvar
7605$rm -rf 123456789abcde*
7606
7607: determine where library module manual pages go
7608set man3dir man3dir none
7609eval $prefixit
7610$cat <<EOM
7611
7612$spackage has manual pages for many of the library modules.
7613EOM
7614
7615case "$nroff" in
7616nroff)
7617 $cat <<'EOM'
7618However, you don't have nroff, so they're probably useless to you.
7619EOM
7620 case "$man3dir" in
7621 '') man3dir="none";;
7622 esac;;
7623esac
7624
7625case "$d_flexfnam" in
7626undef)
7627 $cat <<'EOM'
7628However, your system can't handle the long file names like File::Basename.3.
7629EOM
7630 case "$man3dir" in
7631 '') man3dir="none";;
7632 esac;;
7633esac
7634
7635echo "If you don't want the manual sources installed, answer 'none'."
7636prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7637case "$man3dir" in
7638'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7639 if $test -d "$privlib/man/man3"; then
7640 cat <<EOM >&4
7641
7642WARNING: Previous versions of perl installed man3 pages into
7643$privlib/man/man3. This version will suggest a
7644new default of $dflt.
7645EOM
7646 tdflt=$dflt
7647 dflt='n'
7648 rp='Do you wish to preserve the old behavior?(y/n)'
7649 . ./myread
7650 case "$ans" in
7651 y*) dflt="$privlib/man/man3" ;;
7652 *) dflt=$tdflt ;;
7653 esac
7654 fi
7655 ;;
7656*) dflt="$man3dir" ;;
7657esac
7658case "$dflt" in
7659' ') dflt=none ;;
7660esac
7661echo " "
7662fn=dn+~
7663rp="Where do the $package library man pages (source) go?"
7664. ./getfile
7665man3dir="$ans"
7666man3direxp="$ansexp"
7667case "$man3dir" in
7668'') man3dir=' '
7669 installman3dir='';;
7670esac
7671
7672: Change installation prefix, if necessary.
7673if $test X"$prefix" != X"$installprefix"; then
7674 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7675else
7676 installman3dir="$man3direxp"
7677fi
7678
7679: What suffix to use on installed man pages
7680case "$man3dir" in
7681' ')
7682 man3ext='0'
7683 ;;
7684*)
7685 rp="What suffix should be used for the $package library man pages?"
7686 case "$man3ext" in
7687 '') case "$man3dir" in
7688 *3) dflt=3 ;;
7689 *3p) dflt=3p ;;
7690 *3pm) dflt=3pm ;;
7691 *l) dflt=l;;
7692 *n) dflt=n;;
7693 *o) dflt=o;;
7694 *p) dflt=p;;
7695 *C) dflt=C;;
7696 *L) dflt=L;;
7697 *L3) dflt=L3;;
7698 *) dflt=3;;
7699 esac
7700 ;;
7701 *) dflt="$man3ext";;
7702 esac
7703 . ./myread
7704 man3ext="$ans"
7705 ;;
7706esac
7707
7708: see if we have to deal with yellow pages, now NIS.
7709if $test -d /usr/etc/yp || $test -d /etc/yp; then
7710 if $test -f /usr/etc/nibindd; then
7711 echo " "
7712 echo "I'm fairly confident you're on a NeXT."
7713 echo " "
7714 rp='Do you get the hosts file via NetInfo?'
7715 dflt=y
7716 case "$hostcat" in
7717 nidump*) ;;
7718 '') ;;
7719 *) dflt=n;;
7720 esac
7721 . ./myread
7722 case "$ans" in
7723 y*) hostcat='nidump hosts .';;
7724 *) case "$hostcat" in
7725 nidump*) hostcat='';;
7726 esac
7727 ;;
7728 esac
7729 fi
7730 case "$hostcat" in
7731 nidump*) ;;
7732 *)
7733 case "$hostcat" in
7734 *ypcat*) dflt=y;;
7735 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7736 dflt=y
7737 else
7738 dflt=n
7739 fi;;
7740 *) dflt=n;;
7741 esac
7742 echo " "
7743 rp='Are you getting the hosts file via yellow pages?'
7744 . ./myread
7745 case "$ans" in
7746 y*) hostcat='ypcat hosts';;
7747 *) hostcat='cat /etc/hosts';;
7748 esac
7749 ;;
7750 esac
7751fi
7752case "$hostcat" in
7753'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7754esac
7755case "$groupcat" in
7756'') test -f /etc/group && groupcat='cat /etc/group';;
7757esac
7758case "$passcat" in
7759'') test -f /etc/passwd && passcat='cat /etc/passwd';;
7760esac
7761
7762: now get the host name
7763echo " "
7764echo "Figuring out host name..." >&4
7765case "$myhostname" in
7766'') cont=true
7767 echo 'Maybe "hostname" will work...'
73614538 7768 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
7769 myhostname=$tans
7770 phostname=hostname
7771 cont=''
7772 fi
7773 ;;
7774*) cont='';;
7775esac
7776if $test "$cont"; then
7777 if ./xenix; then
7778 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
7779 if tans=`cat /etc/systemid 2>&1` ; then
7780 myhostname=$tans
7781 phostname='cat /etc/systemid'
7782 echo "Whadyaknow. Xenix always was a bit strange..."
7783 cont=''
7784 fi
7785 elif $test -r /etc/systemid; then
7786 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7787 fi
7788fi
7789if $test "$cont"; then
7790 echo 'No, maybe "uuname -l" will work...'
73614538 7791 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
7792 myhostname=$tans
7793 phostname='uuname -l'
7794 else
7795 echo 'Strange. Maybe "uname -n" will work...'
73614538 7796 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
7797 myhostname=$tans
7798 phostname='uname -n'
7799 else
7800 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 7801 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
7802 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7803 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7804 else
7805 case "$myhostname" in
7806 '') echo "Does this machine have an identity crisis or something?"
7807 phostname='';;
7808 *)
7809 echo "Well, you said $myhostname before..."
7810 phostname='echo $myhostname';;
7811 esac
7812 fi
7813 fi
7814 fi
7815fi
7816: you do not want to know about this
7817set $myhostname
7818myhostname=$1
7819
7820: verify guess
7821if $test "$myhostname" ; then
7822 dflt=y
7823 rp='Your host name appears to be "'$myhostname'".'" Right?"
7824 . ./myread
7825 case "$ans" in
7826 y*) ;;
7827 *) myhostname='';;
7828 esac
7829fi
7830
7831: bad guess or no guess
7832while $test "X$myhostname" = X ; do
7833 dflt=''
7834 rp="Please type the (one word) name of your host:"
7835 . ./myread
7836 myhostname="$ans"
7837done
7838
7839: translate upper to lower if necessary
7840case "$myhostname" in
7841*[A-Z]*)
7842 echo "(Normalizing case in your host name)"
7843 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7844 ;;
7845esac
7846
7847case "$myhostname" in
7848*.*)
7849 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7850 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7851 echo "(Trimming domain name from host name--host name is now $myhostname)"
7852 ;;
7853*) case "$mydomain" in
7854 '')
7855 {
7856 test "X$hostcat" = "Xypcat hosts" &&
7857 ypmatch "$myhostname" hosts 2>/dev/null |\
7858 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
7859 $test -s hosts
7860 } || {
7861 test "X$hostcat" != "X" &&
7862 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
7863 /[ ]$myhostname[ . ]/p" > hosts
7864 }
7865 tmp_re="[ . ]"
f08cbdd1
PP
7866 if $test -f hosts; then
7867 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 7868 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
7869 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7870 hosts | $sort | $uniq | \
7871 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7872 case `$echo X$dflt` in
7873 X*\ *) echo "(Several hosts in the database matched hostname)"
7874 dflt=.
7875 ;;
7876 X.) echo "(You do not have fully-qualified names in the hosts database)"
7877 ;;
7878 esac
7879 else
7880 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 7881 dflt=.
f08cbdd1 7882 fi
b4eb6b3d
JH
7883 case "$dflt" in
7884 .)
7885 tans=`./loc resolv.conf X /etc /usr/etc`
7886 if $test -f "$tans"; then
7887 echo "(Attempting domain name extraction from $tans)"
7888 dflt=.`$sed -n -e 's/ / /g' \
7889 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
7890 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7891 case "$dflt" in
7892 .) dflt=.`$sed -n -e 's/ / /g' \
7893 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
7894 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7895 ;;
7896 esac
7897 fi
7898 ;;
7899 esac
7900 case "$dflt" in
7901 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 7902 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
7903 case "$dflt" in
7904 '') dflt='.';;
7905 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7906 esac
7907 ;;
7908 esac
59c9e5d6
PP
7909 case "$dflt$osname" in
7910 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 7911 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
7912 ;;
7913 esac
b4eb6b3d
JH
7914 case "$dflt" in
7915 .) echo "(Lost all hope -- silly guess then)"
7916 dflt='.uucp'
7917 ;;
7918 esac
7919 $rm -f hosts
7920 ;;
7921 *) dflt="$mydomain";;
7922 esac;;
7923esac
7924echo " "
7925rp="What is your domain name?"
7926. ./myread
7927tans="$ans"
7928case "$ans" in
7929'') ;;
7930.*) ;;
7931*) tans=".$tans";;
7932esac
7933mydomain="$tans"
7934
7935: translate upper to lower if necessary
7936case "$mydomain" in
7937*[A-Z]*)
7938 echo "(Normalizing case in your domain name)"
7939 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7940 ;;
7941esac
7942
7943: a little sanity check here
7944case "$phostname" in
7945'') ;;
7946*)
7947 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7948 $myhostname$mydomain|$myhostname) ;;
7949 *)
7950 case "$phostname" in
7951 sed*)
7952 echo "(That doesn't agree with your whoami.h file, by the way.)"
7953 ;;
7954 *)
7955 echo "(That doesn't agree with your $phostname command, by the way.)"
7956 ;;
7957 esac
7958 ;;
7959 esac
7960 ;;
7961esac
7962
7963$cat <<EOM
7964
7965I need to get your e-mail address in Internet format if possible, i.e.
7966something like user@host.domain. Please answer accurately since I have
7967no easy means to double check it. The default value provided below
7968is most probably close to reality but may not be valid from outside
7969your organization...
7970
7971EOM
7972cont=x
7973while test "$cont"; do
7974 case "$cf_email" in
7975 '') dflt="$cf_by@$myhostname$mydomain";;
7976 *) dflt="$cf_email";;
7977 esac
7978 rp='What is your e-mail address?'
7979 . ./myread
7980 cf_email="$ans"
7981 case "$cf_email" in
7982 *@*.*) cont='' ;;
7983 *)
7984 rp='Address does not look like an Internet one. Use it anyway?'
7985 case "$fastread" in
7986 yes) dflt=y ;;
7987 *) dflt=n ;;
7988 esac
7989 . ./myread
7990 case "$ans" in
7991 y*) cont='' ;;
7992 *) echo " " ;;
7993 esac
7994 ;;
7995 esac
7996done
7997
7998$cat <<EOM
7999
8000If you or somebody else will be maintaining perl at your site, please
8001fill in the correct e-mail address here so that they may be contacted
8002if necessary. Currently, the "perlbug" program included with perl
8003will send mail to this address in addition to perlbug@perl.org. You may
8004enter "none" for no administrator.
8005
8006EOM
8007case "$perladmin" in
8008'') dflt="$cf_email";;
8009*) dflt="$perladmin";;
8010esac
8011rp='Perl administrator e-mail address'
8012. ./myread
8013perladmin="$ans"
8014
674912d7
RB
8015: determine whether to only install version-specific parts.
8016echo " "
8017$cat <<EOM
8018Do you want to install only the version-specific parts of the perl
8019distribution? Usually you do *not* want to do this.
8020EOM
8021case "$versiononly" in
8022"$define"|[Yy]*|true) dflt='y' ;;
8023*) dflt='n';
8024esac
8025rp="Do you want to install only the version-specific parts of perl?"
8026. ./myread
8027case "$ans" in
8028[yY]*) val="$define";;
8029*) val="$undef" ;;
8030esac
8031set versiononly
8032eval $setvar
8033
b4eb6b3d
JH
8034: figure out how to guarantee perl startup
8035case "$startperl" in
8036'')
8037 case "$sharpbang" in
8038 *!)
8039 $cat <<EOH
8040
8041I can use the #! construct to start perl on your system. This will
8042make startup of perl scripts faster, but may cause problems if you
8043want to share those scripts and perl is not in a standard place
8044($binexp/perl) on all your platforms. The alternative is to force
8045a shell by starting the script with a single ':' character.
8046
8047EOH
674912d7
RB
8048 case "$versiononly" in
8049 "$define") dflt="$binexp/perl$version";;
8050 *) dflt="$binexp/perl";;
8051 esac
b4eb6b3d
JH
8052 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8053 . ./myread
8054 case "$ans" in
8055 none) startperl=": # use perl";;
8056 *) startperl="#!$ans"
8057 if $test 30 -lt `echo "$ans" | wc -c`; then
8058 $cat >&4 <<EOM
8059
8060WARNING: Some systems limit the #! command to 32 characters.
8061If you experience difficulty running Perl scripts with #!, try
8062installing Perl in a directory with a shorter pathname.
8063
8064EOM
8065 fi ;;
8066 esac
8067 ;;
8068 *) startperl=": # use perl"
8069 ;;
8070 esac
8071 ;;
8072esac
8073echo "I'll use $startperl to start perl scripts."
8074
8075: figure best path for perl in scripts
8076case "$perlpath" in
8077'')
8078 perlpath="$binexp/perl"
8079 case "$startperl" in
8080 *!*) ;;
8081 *)
8082 $cat <<EOH
8083
8084I will use the "eval 'exec'" idiom to start Perl on your system.
8085I can use the full path of your Perl binary for this purpose, but
8086doing so may cause problems if you want to share those scripts and
8087Perl is not always in a standard place ($binexp/perl).
8088
8089EOH
8090 dflt="$binexp/perl"
8091 rp="What path shall I use in \"eval 'exec'\"?"
8092 . ./myread
8093 perlpath="$ans"
8094 ;;
8095 esac
8096 ;;
8097esac
8098case "$startperl" in
8099*!*) ;;
8100*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8101esac
8102
8103: determine where public executable scripts go
8104set scriptdir scriptdir
8105eval $prefixit
8106case "$scriptdir" in
8107'')
8108 dflt="$bin"
8109 : guess some guesses
8110 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8111 $test -d /usr/share/bin && dflt=/usr/share/bin
8112 $test -d /usr/local/script && dflt=/usr/local/script
8113 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8114 $test -d $prefixexp/script && dflt=$prefixexp/script
8115 set dflt
8116 eval $prefixup
8117 ;;
8118*) dflt="$scriptdir"
8119 ;;
8120esac
8121$cat <<EOM
8122
8123Some installations have a separate directory just for executable scripts so
8124that they can mount it across multiple architectures but keep the scripts in
8125one spot. You might, for example, have a subdirectory of /usr/share for this.
8126Or you might just lump your scripts in with all your other executables.
8127
8128EOM
8129fn=d~
8130rp='Where do you keep publicly executable scripts?'
8131. ./getfile
8132if $test "X$ansexp" != "X$scriptdirexp"; then
8133 installscript=''
8134fi
8135scriptdir="$ans"
8136scriptdirexp="$ansexp"
8137: Change installation prefix, if necessary.
8138if $test X"$prefix" != X"$installprefix"; then
8139 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8140else
8141 installscript="$scriptdirexp"
8142fi
8143
8144: determine where add-on public executables go
8145case "$sitebin" in
8146'') dflt=$siteprefix/bin ;;
8147*) dflt=$sitebin ;;
8148esac
8149fn=d~
8150rp='Pathname where the add-on public executables should be installed?'
8151. ./getfile
8152sitebin="$ans"
8153sitebinexp="$ansexp"
8154: Change installation prefix, if necessary.
8155if $test X"$prefix" != X"$installprefix"; then
8156 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8157else
8158 installsitebin="$sitebinexp"
8159fi
8160
b4eb6b3d
JH
8161case "$vendorprefix" in
8162'') d_vendorbin="$undef"
8163 vendorbin=''
8164 vendorbinexp=''
8165 ;;
8166*) d_vendorbin="$define"
8167 : determine where vendor-supplied executables go.
8168 case "$vendorbin" in
8169 '') dflt=$vendorprefix/bin ;;
8170 *) dflt="$vendorbin" ;;
8171 esac
8172 fn=d~+
8173 rp='Pathname for the vendor-supplied executables directory?'
8174 . ./getfile
8175 vendorbin="$ans"
8176 vendorbinexp="$ansexp"
8177 ;;
8178esac
8179: Change installation prefix, if necessary.
8180if $test X"$prefix" != X"$installprefix"; then
8181 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8182else
8183 installvendorbin="$vendorbinexp"
8184fi
8185
8186: see if qgcvt exists
8187set qgcvt d_qgcvt
8188eval $inlibc
8189
8190echo " "
8191
8192if $test X"$d_longdbl" = X"$define"; then
8193
8194echo "Checking how to print long doubles..." >&4
8195
8196if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
8197 $cat >try.c <<'EOCP'
8198#include <sys/types.h>
8199#include <stdio.h>
8200int main() {
8201 double d = 123.456;
8202 printf("%.3f\n", d);
8203}
8204EOCP
8205 set try
8206 if eval $compile; then
5440bc8e 8207 yyy=`$run ./try`
b4eb6b3d
JH
8208 case "$yyy" in
8209 123.456)
8210 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
8211 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
8212 echo "We will use %f."
8213 ;;
8214 esac
8215 fi
8216fi
8217
8218if $test X"$sPRIfldbl" = X; then
8219 $cat >try.c <<'EOCP'
8220#include <sys/types.h>
8221#include <stdio.h>
8222int main() {
8223 long double d = 123.456;
2ef53570 8224 printf("%.3Lf\n", d);
b4eb6b3d
JH
8225}
8226EOCP
8227 set try
8228 if eval $compile; then
5440bc8e 8229 yyy=`$run ./try`
b4eb6b3d
JH
8230 case "$yyy" in
8231 123.456)
2ef53570
JH
8232 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8233 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8234 echo "We will use %Lf."
b4eb6b3d
JH
8235 ;;
8236 esac
8237 fi
8238fi
8239
8240if $test X"$sPRIfldbl" = X; then
8241 $cat >try.c <<'EOCP'
8242#include <sys/types.h>
8243#include <stdio.h>
8244int main() {
8245 long double d = 123.456;
2ef53570 8246 printf("%.3llf\n", d);
b4eb6b3d
JH
8247}
8248EOCP
8249 set try
8250 if eval $compile; then
5440bc8e 8251 yyy=`$run ./try`
b4eb6b3d
JH
8252 case "$yyy" in
8253 123.456)
2ef53570
JH
8254 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8255 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8256 echo "We will use %llf."
b4eb6b3d
JH
8257 ;;
8258 esac
8259 fi
8260fi
8261
8262if $test X"$sPRIfldbl" = X; then
8263 $cat >try.c <<'EOCP'
8264#include <sys/types.h>
8265#include <stdio.h>
8266int main() {
8267 long double d = 123.456;
8268 printf("%.3lf\n", d);
8269}
8270EOCP
8271 set try
8272 if eval $compile; then
5440bc8e 8273 yyy=`$run ./try`
b4eb6b3d
JH
8274 case "$yyy" in
8275 123.456)
8276 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8277 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8278 echo "We will use %lf."
8279 ;;
8280 esac
8281 fi
8282fi
8283
8284if $test X"$sPRIfldbl" = X; then
8285 echo "Cannot figure out how to print long doubles." >&4
8286else
8287 sSCNfldbl=$sPRIfldbl # expect consistency
8288fi
8289
8290$rm -f try try.*
8291
8292fi # d_longdbl
8293
8294case "$sPRIfldbl" in
8295'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
8296 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
8297 d_SCNfldbl="$undef";
8298 ;;
8299*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
8300 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
8301 d_SCNfldbl="$define";
8302 ;;
8303esac
8304
8305: Check how to convert floats to strings.
8306echo " "
8307echo "Checking for an efficient way to convert floats to strings."
8308echo " " > try.c
8309case "$uselongdouble" in
8310"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8311esac
8312case "$d_longdbl" in
8313"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8314esac
8315case "$d_PRIgldbl" in
8316"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
8317esac
8318$cat >>try.c <<EOP
8319#ifdef TRY_gconvert
8320#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8321char *myname = "gconvert";
8322#endif
8323#ifdef TRY_gcvt
8324#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8325char *myname = "gcvt";
8326#endif
8327#ifdef TRY_qgcvt
8328#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8329char *myname = "qgcvt";
8330#define DOUBLETYPE long double
8331#endif
8332#ifdef TRY_sprintf
8333#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8334#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8335#else
8336#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8337#endif
8338char *myname = "sprintf";
8339#endif
8340
8341#ifndef DOUBLETYPE
8342#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8343#define DOUBLETYPE long double
8344#else
8345#define DOUBLETYPE double
8346#endif
8347#endif
8348
8349#include <stdio.h>
8350
8351#define I_STDLIB $i_stdlib
8352#ifdef I_STDLIB
8353#include <stdlib.h>
8354#endif
8355
8356int
8357checkit(expect, got)
8358char *expect;
8359char *got;
8360{
8361 if (strcmp(expect, got)) {
8362 printf("%s oddity: Expected %s, got %s\n",
8363 myname, expect, got);
8364 exit(1);
8365 }
8366}
8367
8368int main()
8369{
8370 char buf[64];
8371 buf[63] = '\0';
8372
8373 /* This must be 1st test on (which?) platform */
8374 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8375 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8376 checkit("0.1", buf);
8377
8378 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
8379 checkit("1", buf);
8380
8381 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
8382 checkit("1.1", buf);
8383
8384 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
8385 checkit("1.01", buf);
8386
8387 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
8388 checkit("1.001", buf);
8389
8390 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
8391 checkit("1.0001", buf);
8392
8393 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
8394 checkit("1.00001", buf);
8395
8396 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
8397 checkit("1.000001", buf);
8398
8399 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
8400 checkit("0", buf);
8401
8402 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
8403 checkit("-1", buf);
8404
8405 /* Some Linux gcvt's give 1.e+5 here. */
8406 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
8407 checkit("100000", buf);
8408
8409 /* Some Linux gcvt's give -1.e+5 here. */
8410 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
8411 checkit("-100000", buf);
8412
8413 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
8414 checkit("123.456", buf);
8415
8416 exit(0);
8417}
8418EOP
8419case "$d_Gconvert" in
8420gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8421gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8422sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8423*) xxx_list='gconvert gcvt sprintf' ;;
8424esac
8425
8426case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8427"$define$define$define")
8428 # for long doubles prefer first qgcvt, then sprintf
8429 xxx_list="`echo $xxx_list|sed s/sprintf//`"
8430 xxx_list="sprintf $xxx_list"
8431 case "$d_qgcvt" in
8432 "$define") xxx_list="qgcvt $xxx_list" ;;
8433 esac
8434 ;;
8435esac
8436
8437for xxx_convert in $xxx_list; do
8438 echo "Trying $xxx_convert..."
8439 $rm -f try try$_o
8440 set try -DTRY_$xxx_convert
8441 if eval $compile; then
8442 echo "$xxx_convert() found." >&4
5440bc8e 8443 if $run ./try; then
b4eb6b3d
JH
8444 echo "I'll use $xxx_convert to convert floats into a string." >&4
8445 break;
8446 else
8447 echo "...But $xxx_convert didn't work as I expected."
8448 fi
8449 else
8450 echo "$xxx_convert NOT found." >&4
8451 fi
8452done
8453
8454case "$xxx_convert" in
8455gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8456gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8457qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8458*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8459 "$define$define$define")
8460 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8461 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8462 esac
8463 ;;
8464esac
8465
74cac757
JH
8466: see if _fwalk exists
8467set fwalk d__fwalk
8468eval $inlibc
8469
b4eb6b3d
JH
8470: Initialize h_fcntl
8471h_fcntl=false
8472
8473: Initialize h_sysfile
8474h_sysfile=false
8475
8476: access call always available on UNIX
8477set access d_access
8478eval $inlibc
8479
8480: locate the flags for 'access()'
8481case "$d_access" in
8482"$define")
8483 echo " "
8484 $cat >access.c <<'EOCP'
8485#include <sys/types.h>
8486#ifdef I_FCNTL
8487#include <fcntl.h>
8488#endif
8489#ifdef I_SYS_FILE
8490#include <sys/file.h>
8491#endif
8492#ifdef I_UNISTD
8493#include <unistd.h>
8494#endif
8495int main() {
8496 exit(R_OK);
8497}
8498EOCP
8499 : check sys/file.h first, no particular reason here
8500 if $test `./findhdr sys/file.h` && \
7a282f6d 8501 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
8502 h_sysfile=true;
8503 echo "<sys/file.h> defines the *_OK access constants." >&4
8504 elif $test `./findhdr fcntl.h` && \
7a282f6d 8505 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
8506 h_fcntl=true;
8507 echo "<fcntl.h> defines the *_OK access constants." >&4
8508 elif $test `./findhdr unistd.h` && \
7a282f6d 8509 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
8510 echo "<unistd.h> defines the *_OK access constants." >&4
8511 else
8512 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8513 fi
8514 ;;
8515esac
8516$rm -f access*
8517
8518: see if accessx exists
8519set accessx d_accessx
8520eval $inlibc
8521
8522: see if alarm exists
8523set alarm d_alarm
8524eval $inlibc
8525
8526: see if atolf exists
8527set atolf d_atolf
8528eval $inlibc
8529
8530: see if atoll exists
8531set atoll d_atoll
8532eval $inlibc
8533
8534: Look for GNU-cc style attribute checking
8535echo " "
8536echo "Checking whether your compiler can handle __attribute__ ..." >&4
8537$cat >attrib.c <<'EOCP'
8538#include <stdio.h>
8539void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8540EOCP
8541if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8542 if $contains 'warning' attrib.out >/dev/null 2>&1; then
8543 echo "Your C compiler doesn't fully support __attribute__."
8544 val="$undef"
8545 else
8546 echo "Your C compiler supports __attribute__."
8547 val="$define"
8548 fi
8549else
8550 echo "Your C compiler doesn't seem to understand __attribute__ at all."
8551 val="$undef"
8552fi
8553set d_attribut
8554eval $setvar
8555$rm -f attrib*
8556
8557: see if bcmp exists
8558set bcmp d_bcmp
8559eval $inlibc
8560
8561: see if bcopy exists
8562set bcopy d_bcopy
8563eval $inlibc
8564
8565: see if this is a unistd.h system
8566set unistd.h i_unistd
8567eval $inhdr
8568
8569: see if getpgrp exists
8570set getpgrp d_getpgrp
8571eval $inlibc
8572
8573case "$d_getpgrp" in
8574"$define")
8575 echo " "
8576 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 8577 $cat >try.c <<EOP
b4eb6b3d
JH
8578#$i_unistd I_UNISTD
8579#include <sys/types.h>
8580#ifdef I_UNISTD
8581# include <unistd.h>
8582#endif
8583int main()
8584{
8585 if (getuid() == 0) {
8586 printf("(I see you are running Configure as super-user...)\n");
8587 setuid(1);
8588 }
8589#ifdef TRY_BSD_PGRP
8590 if (getpgrp(1) == 0)
8591 exit(0);
8592#else
8593 if (getpgrp() > 0)
8594 exit(0);
8595#endif
8596 exit(1);
8597}
8598EOP
5440bc8e 8599 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
8600 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8601 val="$define"
5440bc8e 8602 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
8603 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8604 val="$undef"
8605 else
8606 echo "I can't seem to compile and run the test program."
8607 if ./usg; then
8608 xxx="a USG one, i.e. you use getpgrp()."
8609 else
8610 # SVR4 systems can appear rather BSD-ish.
8611 case "$i_unistd" in
8612 $undef)
8613 xxx="a BSD one, i.e. you use getpgrp(pid)."
8614 val="$define"
8615 ;;
8616 $define)
8617 xxx="probably a USG one, i.e. you use getpgrp()."
8618 val="$undef"
8619 ;;
8620 esac
8621 fi
8622 echo "Assuming your getpgrp is $xxx" >&4
8623 fi
8624 ;;
8625*) val="$undef";;
8626esac
8627set d_bsdgetpgrp
8628eval $setvar
5440bc8e 8629$rm -f try try.*
b4eb6b3d
JH
8630
8631: see if setpgrp exists
8632set setpgrp d_setpgrp
8633eval $inlibc
8634
8635case "$d_setpgrp" in
8636"$define")
8637 echo " "
8638 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 8639 $cat >try.c <<EOP
b4eb6b3d
JH
8640#$i_unistd I_UNISTD
8641#include <sys/types.h>
8642#ifdef I_UNISTD
8643# include <unistd.h>
8644#endif
8645int main()
8646{
8647 if (getuid() == 0) {
8648 printf("(I see you are running Configure as super-user...)\n");
8649 setuid(1);
8650 }
8651#ifdef TRY_BSD_PGRP
8652 if (-1 == setpgrp(1, 1))
8653 exit(0);
8654#else
8655 if (setpgrp() != -1)
8656 exit(0);
8657#endif
8658 exit(1);
8659}
8660EOP
5440bc8e 8661 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
8662 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8663 val="$define"
5440bc8e 8664 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
8665 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8666 val="$undef"
8667 else
8668 echo "(I can't seem to compile and run the test program.)"
8669 if ./usg; then
8670 xxx="a USG one, i.e. you use setpgrp()."
8671 else
8672 # SVR4 systems can appear rather BSD-ish.
8673 case "$i_unistd" in
8674 $undef)
8675 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8676 val="$define"
8677 ;;
8678 $define)
8679 xxx="probably a USG one, i.e. you use setpgrp()."
8680 val="$undef"
8681 ;;
8682 esac
8683 fi
8684 echo "Assuming your setpgrp is $xxx" >&4
8685 fi
8686 ;;
8687*) val="$undef";;
8688esac
8689set d_bsdsetpgrp
8690eval $setvar
5440bc8e 8691$rm -f try try.*
b4eb6b3d
JH
8692: see if bzero exists
8693set bzero d_bzero
8694eval $inlibc
8695
8696: see if signal is declared as pointer to function returning int or void
8697echo " "
8698xxx=`./findhdr signal.h`
8699$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8700if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
8701 echo "You have int (*signal())() instead of void." >&4
8702 val="$undef"
8703elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
8704 echo "You have void (*signal())()." >&4
8705 val="$define"
8706elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8707 echo "You have int (*signal())() instead of void." >&4
8708 val="$undef"
8709elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8710 echo "You have void (*signal())()." >&4
8711 val="$define"
8712else
8713 case "$d_voidsig" in
8714 '')
8715 echo "I can't determine whether signal handler returns void or int..." >&4
8716 dflt=void
8717 rp="What type does your signal handler return?"
8718 . ./myread
8719 case "$ans" in
8720 v*) val="$define";;
8721 *) val="$undef";;
8722 esac;;
8723 "$define")
8724 echo "As you already told me, signal handler returns void." >&4
8725 val="$define"
8726 ;;
8727 *) echo "As you already told me, signal handler returns int." >&4
8728 val="$undef"
8729 ;;
8730 esac
8731fi
8732set d_voidsig
8733eval $setvar
8734case "$d_voidsig" in
8735"$define") signal_t="void";;
8736*) signal_t="int";;
8737esac
8738$rm -f $$.tmp
8739
8740: check for ability to cast large floats to 32-bit ints.
8741echo " "
8742echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8743if $test "$intsize" -ge 4; then
8744 xxx=int
8745else
8746 xxx=long
8747fi
8748$cat >try.c <<EOCP
8749#include <stdio.h>
8750#include <sys/types.h>
8751#include <signal.h>
8752$signal_t blech(s) int s; { exit(3); }
8753int main()
8754{
8755 $xxx i32;
8756 double f, g;
8757 int result = 0;
8758 char str[16];
8759 signal(SIGFPE, blech);
8760
8761 /* Don't let compiler optimize the test away. Store the number
8762 in a writable string for gcc to pass to sscanf under HP/UX.
8763 */
8764 sprintf(str, "2147483647");
8765 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8766 g = 10 * f;
8767 i32 = ($xxx) g;
8768
8769 /* x86 processors will probably give 0x8000 0000, which is a
8770 sign change. We don't want that. We want to mimic SPARC
8771 behavior here, which is to preserve the sign and give
8772 back 0x7fff ffff.
8773 */
8774 if (i32 != ($xxx) f)
8775 result |= 1;
8776 exit(result);
8777}
8778EOCP
8779set try
8780if eval $compile_ok; then
5440bc8e 8781 $run ./try
b4eb6b3d
JH
8782 yyy=$?
8783else
8784 echo "(I can't seem to compile the test program--assuming it can't)"
8785 yyy=1
8786fi
8787case "$yyy" in
87880) val="$define"
8789 echo "Yup, it can."
8790 ;;
8791*) val="$undef"
8792 echo "Nope, it can't."
8793 ;;
8794esac
8795set d_casti32
8796eval $setvar
8797$rm -f try try.*
8798
8799: check for ability to cast negative floats to unsigned
8800echo " "
8801echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8802$cat >try.c <<EOCP
8803#include <stdio.h>
8804#include <sys/types.h>
8805#include <signal.h>
8806$signal_t blech(s) int s; { exit(7); }
8807$signal_t blech_in_list(s) int s; { exit(4); }
8808unsigned long dummy_long(p) unsigned long p; { return p; }
8809unsigned int dummy_int(p) unsigned int p; { return p; }
8810unsigned short dummy_short(p) unsigned short p; { return p; }
8811int main()
8812{
8813 double f;
8814 unsigned long along;
8815 unsigned int aint;
8816 unsigned short ashort;
8817 int result = 0;
8818 char str[16];
8819
8820 /* Frustrate gcc-2.7.2's optimizer which failed this test with
8821 a direct f = -123. assignment. gcc-2.8.0 reportedly
8822 optimized the whole file away
8823 */
8824 /* Store the number in a writable string for gcc to pass to
8825 sscanf under HP/UX.
8826 */
8827 sprintf(str, "-123");
8828 sscanf(str, "%lf", &f); /* f = -123.; */
8829
8830 signal(SIGFPE, blech);
8831 along = (unsigned long)f;
8832 aint = (unsigned int)f;
8833 ashort = (unsigned short)f;
8834 if (along != (unsigned long)-123)
8835 result |= 1;
8836 if (aint != (unsigned int)-123)
8837 result |= 1;
8838 if (ashort != (unsigned short)-123)
8839 result |= 1;
8840 sprintf(str, "1073741824.");
8841 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8842 f = f + f;
8843 along = 0;
8844 along = (unsigned long)f;
8845 if (along != 0x80000000)
8846 result |= 2;
8847 f -= 1.;
8848 along = 0;
8849 along = (unsigned long)f;
8850 if (along != 0x7fffffff)
8851 result |= 1;
8852 f += 2.;
8853 along = 0;
8854 along = (unsigned long)f;
8855 if (along != 0x80000001)
8856 result |= 2;
8857 if (result)
8858 exit(result);
8859 signal(SIGFPE, blech_in_list);
8860 sprintf(str, "123.");
8861 sscanf(str, "%lf", &f); /* f = 123.; */
8862 along = dummy_long((unsigned long)f);
8863 aint = dummy_int((unsigned int)f);
8864 ashort = dummy_short((unsigned short)f);
8865 if (along != (unsigned long)123)
8866 result |= 4;
8867 if (aint != (unsigned int)123)
8868 result |= 4;
8869 if (ashort != (unsigned short)123)
8870 result |= 4;
8871 exit(result);
8872
8873}
8874EOCP
8875set try
8876if eval $compile_ok; then
5440bc8e 8877 $run ./try
b4eb6b3d
JH
8878 castflags=$?
8879else
8880 echo "(I can't seem to compile the test program--assuming it can't)"
8881 castflags=7
8882fi
8883case "$castflags" in
88840) val="$define"
8885 echo "Yup, it can."
8886 ;;
8887*) val="$undef"
8888 echo "Nope, it can't."
8889 ;;
8890esac
8891set d_castneg
8892eval $setvar
8893$rm -f try.*
8894
8895: see if vprintf exists
8896echo " "
8897if set vprintf val -f d_vprintf; eval $csym; $val; then
8898 echo 'vprintf() found.' >&4
8899 val="$define"
5440bc8e 8900 $cat >try.c <<'EOF'
b4eb6b3d
JH
8901#include <varargs.h>
8902
8903int main() { xxx("foo"); }
8904
8905xxx(va_alist)
8906va_dcl
8907{
8908 va_list args;
8909 char buf[10];
8910
8911 va_start(args);
8912 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8913}
8914EOF
5440bc8e
JH
8915 set try
8916 if eval $compile && $run ./try; then
b4eb6b3d
JH
8917 echo "Your vsprintf() returns (int)." >&4
8918 val2="$undef"
8919 else
8920 echo "Your vsprintf() returns (char*)." >&4
8921 val2="$define"
8922 fi
8923else
8924 echo 'vprintf() NOT found.' >&4
8925 val="$undef"
8926 val2="$undef"
8927fi
5440bc8e 8928$rm -f try try.*
b4eb6b3d
JH
8929set d_vprintf
8930eval $setvar
8931val=$val2
8932set d_charvspr
8933eval $setvar
8934
8935: see if chown exists
8936set chown d_chown
8937eval $inlibc
8938
8939: see if chroot exists
8940set chroot d_chroot
8941eval $inlibc
8942
8943: see if chsize exists
8944set chsize d_chsize
8945eval $inlibc
8946
4e0554ec
JH
8947hasstruct='varname=$1; struct=$2; shift; shift;
8948while $test $# -ge 2; do
8949 case "$1" in
8950 $define) echo "#include <$2>";;
8951 esac ;
8952 shift 2;
8953done > try.c;
8954echo "int main () { struct $struct foo; }" >> try.c;
8955set try;
8956if eval $compile; then
8957 val="$define";
8958else
8959 val="$undef";
8960fi;
8961set $varname;
8962eval $setvar;
8963$rm -f try.c try.o'
8964
8965: see if sys/types.h has to be included
8966set sys/types.h i_systypes
8967eval $inhdr
8968
8969hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8970while $test $# -ge 2; do
8971 case "$1" in
8972 $define) echo "#include <$2>";;
8973 esac ;
8974 shift 2;
8975done > try.c;
8976echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8977set try;
8978if eval $compile; then
8979 val="$define";
8980else
8981 val="$undef";
8982fi;
8983set $varname;
8984eval $setvar;
8985$rm -f try.c try.o'
8986
8987socketlib=''
8988sockethdr=''
8989: see whether socket exists
8990echo " "
8991$echo $n "Hmm... $c" >&4
8992if set socket val -f d_socket; eval $csym; $val; then
8993 echo "Looks like you have Berkeley networking support." >&4
8994 d_socket="$define"
8995 if set setsockopt val -f; eval $csym; $val; then
8996 d_oldsock="$undef"
8997 else
8998 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8999 d_oldsock="$define"
9000 fi
9001else
9002 if $contains socklib libc.list >/dev/null 2>&1; then
9003 echo "Looks like you have Berkeley networking support." >&4
9004 d_socket="$define"
9005 : we will have to assume that it supports the 4.2 BSD interface
9006 d_oldsock="$undef"
9007 else
9008 echo "You don't have Berkeley networking in libc$_a..." >&4
9009 if test "X$d_socket" = "X$define"; then
9010 echo "...but you seem to believe that you have sockets." >&4
9011 else
9012 for net in net socket
9013 do
9014 if test -f /usr/lib/lib$net$_a; then
9015 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
9016 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9017 if $contains socket libc.list >/dev/null 2>&1; then
9018 d_socket="$define"
9019 socketlib="-l$net"
9020 case "$net" in
9021 net)
9022 echo "...but the Wollongong group seems to have hacked it in." >&4
9023 sockethdr="-I/usr/netinclude"
9024 ;;
9025 esac
9026 echo "Found Berkeley sockets interface in lib$net." >& 4
9027 if $contains setsockopt libc.list >/dev/null 2>&1; then
9028 d_oldsock="$undef"
9029 else
9030 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9031 d_oldsock="$define"
9032 fi
9033 break
9034 fi
9035 fi
9036 done
9037 if test "X$d_socket" != "X$define"; then
9038 echo "or anywhere else I see." >&4
9039 d_socket="$undef"
9040 d_oldsock="$undef"
9041 fi
9042 fi
9043 fi
9044fi
9045
9046: see if socketpair exists
9047set socketpair d_sockpair
9048eval $inlibc
9049
9050
9051echo " "
9052echo "Checking the availability of certain socket constants..." >& 4
9053for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9054 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9055 $cat >try.c <<EOF
9056#include <sys/types.h>
9057#include <sys/socket.h>
9058int main() {
9059 int i = $ENUM;
9060}
9061EOF
9062 val="$undef"
9063 set try; if eval $compile; then
9064 val="$define"
9065 fi
9066 set d_${enum}; eval $setvar
9067 $rm -f try.c try
9068done
9069
9070: see if this is a sys/uio.h system
9071set sys/uio.h i_sysuio
9072eval $inhdr
9073
9074
9075echo " "
9076echo "Checking to see if your system supports struct cmsghdr..." >&4
9077set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9078eval $hasstruct
9079case "$d_cmsghdr_s" in
9080"$define") echo "Yes, it does." ;;
9081*) echo "No, it doesn't." ;;
9082esac
9083
9084
b4eb6b3d
JH
9085: check for const keyword
9086echo " "
9087echo 'Checking to see if your C compiler knows about "const"...' >&4
9088$cat >const.c <<'EOCP'
9089typedef struct spug { int drokk; } spug;
9090int main()
9091{
9092 const char *foo;
9093 const spug y;
9094}
9095EOCP
9096if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9097 val="$define"
9098 echo "Yup, it does."
9099else
9100 val="$undef"
9101 echo "Nope, it doesn't."
9102fi
9103set d_const
9104eval $setvar
9105
9106: see if crypt exists
9107echo " "
9108if set crypt val -f d_crypt; eval $csym; $val; then
9109 echo 'crypt() found.' >&4
9110 val="$define"
9111 cryptlib=''
9112else
9113 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9114 if $test -z "$cryptlib"; then
9115 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9116 else
9117 cryptlib=-lcrypt
9118 fi
9119 if $test -z "$cryptlib"; then
9120 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9121 else
9122 cryptlib=-lcrypt
9123 fi
9124 if $test -z "$cryptlib"; then
9125 cryptlib=`./loc libcrypt$_a "" $libpth`
9126 else
9127 cryptlib=-lcrypt
9128 fi
9129 if $test -z "$cryptlib"; then
9130 echo 'crypt() NOT found.' >&4
9131 val="$undef"
9132 else
9133 val="$define"
9134 fi
9135fi
9136set d_crypt
9137eval $setvar
9138
9139: get csh whereabouts
9140case "$csh" in
9141'csh') val="$undef" ;;
9142*) val="$define" ;;
9143esac
9144set d_csh
9145eval $setvar
9146: Respect a hint or command line value for full_csh.
9147case "$full_csh" in
9148'') full_csh=$csh ;;
9149esac
9150
9151: see if cuserid exists
9152set cuserid d_cuserid
9153eval $inlibc
9154
9155: see if this is a limits.h system
9156set limits.h i_limits
9157eval $inhdr
9158
9159: see if this is a float.h system
9160set float.h i_float
9161eval $inhdr
9162
9163: See if number of significant digits in a double precision number is known
9164echo " "
9165$cat >dbl_dig.c <<EOM
9166#$i_limits I_LIMITS
9167#$i_float I_FLOAT
9168#ifdef I_LIMITS
9169#include <limits.h>
9170#endif
9171#ifdef I_FLOAT
9172#include <float.h>
9173#endif
9174#ifdef DBL_DIG
9175printf("Contains DBL_DIG");
9176#endif
9177EOM
9178$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
9179if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
9180 echo "DBL_DIG found." >&4
9181 val="$define"
9182else
9183 echo "DBL_DIG NOT found." >&4
9184 val="$undef"
9185fi
9186$rm -f dbl_dig.?
9187set d_dbl_dig
9188eval $setvar
9189
2ef53570
JH
9190hasproto='varname=$1; func=$2; shift; shift;
9191while $test $# -ge 2; do
9192 case "$1" in
9193 $define) echo "#include <$2>";;
9194 esac ;
9195 shift 2;
9196done > try.c;
9197$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9198if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9199 echo "$func() prototype found.";
9200 val="$define";
9201else
9202 echo "$func() prototype NOT found.";
9203 val="$undef";
9204fi;
9205set $varname;
9206eval $setvar;
9207$rm -f try.c tryout.c'
9208
9209: see if dbm.h is available
9210: see if dbmclose exists
9211set dbmclose d_dbmclose
9212eval $inlibc
9213
9214case "$d_dbmclose" in
9215$define)
9216 set dbm.h i_dbm
9217 eval $inhdr
9218 case "$i_dbm" in
9219 $define)
9220 val="$undef"
9221 set i_rpcsvcdbm
9222 eval $setvar
9223 ;;
9224 *) set rpcsvc/dbm.h i_rpcsvcdbm
9225 eval $inhdr
9226 ;;
9227 esac
9228 ;;
9229*) echo "We won't be including <dbm.h>"
9230 val="$undef"
9231 set i_dbm
9232 eval $setvar
9233 val="$undef"
9234 set i_rpcsvcdbm
9235 eval $setvar
9236 ;;
9237esac
9238
9239: see if prototype for dbminit is available
9240echo " "
9241set d_dbminitproto dbminit $i_dbm dbm.h
9242eval $hasproto
9243
b4eb6b3d
JH
9244: see if difftime exists
9245set difftime d_difftime
9246eval $inlibc
9247
9248: see if this is a dirent system
9249echo " "
9250if xinc=`./findhdr dirent.h`; $test "$xinc"; then
9251 val="$define"
9252 echo "<dirent.h> found." >&4
9253else
9254 val="$undef"
9255 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
9256 echo "<sys/dir.h> found." >&4
9257 echo " "
9258 else
9259 xinc=`./findhdr sys/ndir.h`
9260 fi
9261 echo "<dirent.h> NOT found." >&4
9262fi
9263set i_dirent
9264eval $setvar
9265
9266: Look for type of directory structure.
9267echo " "
9268$cppstdin $cppflags $cppminus < "$xinc" > try.c
9269
9270case "$direntrytype" in
9271''|' ')
9272 case "$i_dirent" in
9273 $define) guess1='struct dirent' ;;
9274 *) guess1='struct direct' ;;
9275 esac
9276 ;;
9277*) guess1="$direntrytype"
9278 ;;
9279esac
9280
9281case "$guess1" in
9282'struct dirent') guess2='struct direct' ;;
9283*) guess2='struct dirent' ;;
9284esac
9285
9286if $contains "$guess1" try.c >/dev/null 2>&1; then
9287 direntrytype="$guess1"
9288 echo "Your directory entries are $direntrytype." >&4
9289elif $contains "$guess2" try.c >/dev/null 2>&1; then
9290 direntrytype="$guess2"
9291 echo "Your directory entries seem to be $direntrytype." >&4
9292else
9293 echo "I don't recognize your system's directory entries." >&4
9294 rp="What type is used for directory entries on this system?"
9295 dflt="$guess1"
9296 . ./myread
9297 direntrytype="$ans"
9298fi
9299$rm -f try.c
9300
9301
9302: see if the directory entry stores field length
9303echo " "
9304$cppstdin $cppflags $cppminus < "$xinc" > try.c
9305if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9306 echo "Good, your directory entry keeps length information in d_namlen." >&4
9307 val="$define"
9308else
9309 echo "Your directory entry does not know about the d_namlen field." >&4
9310 val="$undef"
9311fi
9312set d_dirnamlen
9313eval $setvar
9314$rm -f try.c
9315
9316: see if dlerror exists
9317xxx_runnm="$runnm"
9318runnm=false
9319set dlerror d_dlerror
9320eval $inlibc
9321runnm="$xxx_runnm"
9322
9323: see if dlfcn is available
9324set dlfcn.h i_dlfcn
9325eval $inhdr
9326
9327case "$usedl" in
9328$define|y|true)
9329 $cat << EOM
9330
9331On a few systems, the dynamically loaded modules that perl generates and uses
9332will need a different extension than shared libs. The default will probably
9333be appropriate.
9334
9335EOM
9336 case "$dlext" in
9337 '') dflt="$so" ;;
9338 *) dflt="$dlext" ;;
9339 esac
9340 rp='What is the extension of dynamically loaded modules'
9341 . ./myread
9342 dlext="$ans"
9343 ;;
9344*)
9345 dlext="none"
9346 ;;
9347esac
9348
9349: Check if dlsym need a leading underscore
9350echo " "
9351val="$undef"
9352
9353case "$dlsrc" in
9354dl_dlopen.xs)
9355 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9356 $cat >dyna.c <<'EOM'
9357fred () { }
9358EOM
9359
9360$cat >fred.c<<EOM
9361
9362#include <stdio.h>
9363#$i_dlfcn I_DLFCN
9364#ifdef I_DLFCN
5440bc8e 9365#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
9366#else
9367#include <sys/types.h>
9368#include <nlist.h>
9369#include <link.h>
9370#endif
9371
9372extern int fred() ;
9373
9374int main()
9375{
9376 void * handle ;
9377 void * symbol ;
9378#ifndef RTLD_LAZY
9379 int mode = 1 ;
9380#else
9381 int mode = RTLD_LAZY ;
9382#endif
9383 handle = dlopen("./dyna.$dlext", mode) ;
9384 if (handle == NULL) {
9385 printf ("1\n") ;
9386 fflush (stdout) ;
9387 exit(0);
9388 }
9389 symbol = dlsym(handle, "fred") ;
9390 if (symbol == NULL) {
9391 /* try putting a leading underscore */
9392 symbol = dlsym(handle, "_fred") ;
9393 if (symbol == NULL) {
9394 printf ("2\n") ;
9395 fflush (stdout) ;
9396 exit(0);
9397 }
9398 printf ("3\n") ;
9399 }
9400 else
9401 printf ("4\n") ;
9402 fflush (stdout) ;
9403 exit(0);
9404}
9405EOM
9406 : Call the object file tmp-dyna.o in case dlext=o.
9407 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
9408 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 9409 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
9410 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
9411 xxx=`$run ./fred`
b4eb6b3d
JH
9412 case $xxx in
9413 1) echo "Test program failed using dlopen." >&4
9414 echo "Perhaps you should not use dynamic loading." >&4;;
9415 2) echo "Test program failed using dlsym." >&4
9416 echo "Perhaps you should not use dynamic loading." >&4;;
9417 3) echo "dlsym needs a leading underscore" >&4
9418 val="$define" ;;
9419 4) echo "dlsym doesn't need a leading underscore." >&4;;
9420 esac
9421 else
9422 echo "I can't compile and run the test program." >&4
9423 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9424 fi
9425 ;;
9426esac
9427
9428$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
9429
9430set d_dlsymun
9431eval $setvar
9432
b4eb6b3d
JH
9433: see if prototype for drand48 is available
9434echo " "
9435set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9436eval $hasproto
9437
9438: see if dup2 exists
9439set dup2 d_dup2
9440eval $inlibc
9441
9442: see if eaccess exists
9443set eaccess d_eaccess
9444eval $inlibc
9445
9446: see if endgrent exists
9447set endgrent d_endgrent
9448eval $inlibc
9449
9450: see if endhostent exists
9451set endhostent d_endhent
9452eval $inlibc
9453
9454: see if endnetent exists
9455set endnetent d_endnent
9456eval $inlibc
9457
9458: see if endprotoent exists
9459set endprotoent d_endpent
9460eval $inlibc
9461
9462: see if endpwent exists
9463set endpwent d_endpwent
9464eval $inlibc
9465
9466: see if endservent exists
9467set endservent d_endsent
9468eval $inlibc
9469
9470: Locate the flags for 'open()'
9471echo " "
5440bc8e 9472$cat >try.c <<'EOCP'
b4eb6b3d
JH
9473#include <sys/types.h>
9474#ifdef I_FCNTL
9475#include <fcntl.h>
9476#endif
9477#ifdef I_SYS_FILE
9478#include <sys/file.h>
9479#endif
9480int main() {
9481 if(O_RDONLY);
9482#ifdef O_TRUNC
9483 exit(0);
9484#else
9485 exit(1);
9486#endif
9487}
9488EOCP
9489: check sys/file.h first to get FREAD on Sun
9490if $test `./findhdr sys/file.h` && \
5440bc8e 9491 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
9492 h_sysfile=true;
9493 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 9494 if $run ./try; then
b4eb6b3d
JH
9495 echo "and you have the 3 argument form of open()." >&4
9496 val="$define"
9497 else
9498 echo "but not the 3 argument form of open(). Oh, well." >&4
9499 val="$undef"
9500 fi
9501elif $test `./findhdr fcntl.h` && \
5440bc8e 9502 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
9503 h_fcntl=true;
9504 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 9505 if $run ./try; then
b4eb6b3d
JH
9506 echo "and you have the 3 argument form of open()." >&4
9507 val="$define"
9508 else
9509 echo "but not the 3 argument form of open(). Oh, well." >&4
9510 val="$undef"
9511 fi
9512else
9513 val="$undef"
9514 echo "I can't find the O_* constant definitions! You got problems." >&4
9515fi
9516set d_open3
9517eval $setvar
5440bc8e 9518$rm -f try try.*
b4eb6b3d
JH
9519
9520: see which of string.h or strings.h is needed
9521echo " "
9522strings=`./findhdr string.h`
9523if $test "$strings" && $test -r "$strings"; then
9524 echo "Using <string.h> instead of <strings.h>." >&4
9525 val="$define"
9526else
9527 val="$undef"
9528 strings=`./findhdr strings.h`
9529 if $test "$strings" && $test -r "$strings"; then
9530 echo "Using <strings.h> instead of <string.h>." >&4
9531 else
9532 echo "No string header found -- You'll surely have problems." >&4
9533 fi
9534fi
9535set i_string
9536eval $setvar
9537case "$i_string" in
9538"$undef") strings=`./findhdr strings.h`;;
9539*) strings=`./findhdr string.h`;;
9540esac
9541
9542: check for non-blocking I/O stuff
9543case "$h_sysfile" in
a0acbdc3
JH
9544true) echo "#include <sys/file.h>" > head.c;;
9545*)
9546 case "$h_fcntl" in
9547 true) echo "#include <fcntl.h>" > head.c;;
9548 *) echo "#include <sys/fcntl.h>" > head.c;;
9549 esac
9550 ;;
b4eb6b3d
JH
9551esac
9552echo " "
9553echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9554case "$o_nonblock" in
9555'')
9556 $cat head.c > try.c
9557 $cat >>try.c <<'EOCP'
9558#include <stdio.h>
9559int main() {
9560#ifdef O_NONBLOCK
9561 printf("O_NONBLOCK\n");
9562 exit(0);
9563#endif
9564#ifdef O_NDELAY
9565 printf("O_NDELAY\n");
9566 exit(0);
9567#endif
9568#ifdef FNDELAY
9569 printf("FNDELAY\n");
9570 exit(0);
9571#endif
9572 exit(0);
9573}
9574EOCP
9575 set try
9576 if eval $compile_ok; then
5440bc8e 9577 o_nonblock=`$run ./try`
b4eb6b3d
JH
9578 case "$o_nonblock" in
9579 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9580 *) echo "Seems like we can use $o_nonblock.";;
9581 esac
9582 else
9583 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9584 fi
9585 ;;
9586*) echo "Using $hint value $o_nonblock.";;
9587esac
9588$rm -f try try.* .out core
9589
9590echo " "
9591echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9592case "$eagain" in
9593'')
9594 $cat head.c > try.c
9595 $cat >>try.c <<EOCP
9596#include <errno.h>
9597#include <sys/types.h>
9598#include <signal.h>
9599#include <stdio.h>
9600#define MY_O_NONBLOCK $o_nonblock
9601#ifndef errno /* XXX need better Configure test */
9602extern int errno;
9603#endif
9604#$i_unistd I_UNISTD
9605#ifdef I_UNISTD
9606#include <unistd.h>
9607#endif
9608#$i_string I_STRING
9609#ifdef I_STRING
9610#include <string.h>
9611#else
9612#include <strings.h>
9613#endif
9614$signal_t blech(x) int x; { exit(3); }
9615EOCP
9616 $cat >> try.c <<'EOCP'
9617int main()
9618{
9619 int pd[2];
9620 int pu[2];
9621 char buf[1];
9622 char string[100];
9623
9624 pipe(pd); /* Down: child -> parent */
9625 pipe(pu); /* Up: parent -> child */
9626 if (0 != fork()) {
9627 int ret;
9628 close(pd[1]); /* Parent reads from pd[0] */
9629 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 9630#ifdef F_SETFL
b4eb6b3d
JH
9631 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
9632 exit(1);
a0acbdc3
JH
9633#else
9634 exit(4);
9635#endif
b4eb6b3d
JH
9636 signal(SIGALRM, blech);
9637 alarm(5);
9638 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
9639 exit(2);
9640 sprintf(string, "%d\n", ret);
9641 write(2, string, strlen(string));
9642 alarm(0);
9643#ifdef EAGAIN
9644 if (errno == EAGAIN) {
9645 printf("EAGAIN\n");
9646 goto ok;
9647 }
9648#endif
9649#ifdef EWOULDBLOCK
9650 if (errno == EWOULDBLOCK)
9651 printf("EWOULDBLOCK\n");
9652#endif
9653 ok:
9654 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
9655 sleep(2); /* Give it time to close our pipe */
9656 alarm(5);
9657 ret = read(pd[0], buf, 1); /* Should read EOF */
9658 alarm(0);
9659 sprintf(string, "%d\n", ret);
9660 write(3, string, strlen(string));
9661 exit(0);
9662 }
9663
9664 close(pd[0]); /* We write to pd[1] */
9665 close(pu[1]); /* We read from pu[0] */
9666 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
9667 close(pd[1]); /* Pipe pd is now fully closed! */
9668 exit(0); /* Bye bye, thank you for playing! */
9669}
9670EOCP
9671 set try
9672 if eval $compile_ok; then
9673 echo "$startsh" >mtry
5440bc8e 9674 echo "$run ./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
b4eb6b3d
JH
9675 chmod +x mtry
9676 ./mtry >/dev/null 2>&1
9677 case $? in
9678 0) eagain=`$cat try.out`;;
9679 1) echo "Could not perform non-blocking setting!";;
9680 2) echo "I did a successful read() for something that was not there!";;
9681 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 9682 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
9683 *) echo "Something terribly wrong happened during testing.";;
9684 esac
9685 rd_nodata=`$cat try.ret`
9686 echo "A read() system call with no data present returns $rd_nodata."
9687 case "$rd_nodata" in
9688 0|-1) ;;
9689 *)
9690 echo "(That's peculiar, fixing that to be -1.)"
9691 rd_nodata=-1
9692 ;;
9693 esac
9694 case "$eagain" in
9695 '')
9696 echo "Forcing errno EAGAIN on read() with no data available."
9697 eagain=EAGAIN
9698 ;;
9699 *)
9700 echo "Your read() sets errno to $eagain when no data is available."
9701 ;;
9702 esac
9703 status=`$cat try.err`
9704 case "$status" in
9705 0) echo "And it correctly returns 0 to signal EOF.";;
9706 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
9707 *) echo "However, your read() returns '$status' on EOF??";;
9708 esac
9709 val="$define"
9710 if test "$status" = "$rd_nodata"; then
9711 echo "WARNING: you can't distinguish between EOF and no data!"
9712 val="$undef"
9713 fi
9714 else
9715 echo "I can't compile the test program--assuming errno EAGAIN will do."
9716 eagain=EAGAIN
9717 fi
9718 set d_eofnblk
9719 eval $setvar
9720 ;;
9721*)
9722 echo "Using $hint value $eagain."
9723 echo "Your read() returns $rd_nodata when no data is present."
9724 case "$d_eofnblk" in
9725 "$define") echo "And you can see EOF because read() returns 0.";;
9726 "$undef") echo "But you can't see EOF status from read() returned value.";;
9727 *)
9728 echo "(Assuming you can't see EOF status from read anyway.)"
9729 d_eofnblk=$undef
9730 ;;
9731 esac
9732 ;;
9733esac
9734$rm -f try try.* .out core head.c mtry
9735
9736: see if fchmod exists
9737set fchmod d_fchmod
9738eval $inlibc
9739
9740: see if fchown exists
9741set fchown d_fchown
9742eval $inlibc
9743
9744: see if this is an fcntl system
9745set fcntl d_fcntl
9746eval $inlibc
9747
9d9004a9
AD
9748echo " "
9749: See if fcntl-based locking works.
9750$cat >try.c <<'EOCP'
9751#include <stdlib.h>
9752#include <unistd.h>
9753#include <fcntl.h>
9754int main() {
9755#if defined(F_SETLK) && defined(F_SETLKW)
9756 struct flock flock;
9757 int retval, fd;
9758 fd = open("try.c", O_RDONLY);
9759 flock.l_type = F_RDLCK;
9760 flock.l_whence = SEEK_SET;
9761 flock.l_start = flock.l_len = 0;
9762 retval = fcntl(fd, F_SETLK, &flock);
9763 close(fd);
9764 (retval < 0 ? exit(2) : exit(0));
9765#else
9766 exit(2);
9767#endif
9768}
9769EOCP
9770echo "Checking if fcntl-based file locking works... "
9771case "$d_fcntl" in
9772"$define")
9773 set try
9774 if eval $compile_ok; then
5440bc8e 9775 if $run ./try; then
9d9004a9
AD
9776 echo "Yes, it seems to work."
9777 val="$define"
9778 else
9779 echo "Nope, it didn't work."
9780 val="$undef"
9781 fi
9782 else
9783 echo "I'm unable to compile the test program, so I'll assume not."
9784 val="$undef"
9785 fi
9786 ;;
9787*) val="$undef";
9788 echo "Nope, since you don't even have fcntl()."
9789 ;;
9790esac
9791set d_fcntl_can_lock
9792eval $setvar
9793$rm -f try*
9794
9795
b4eb6b3d
JH
9796: see if sys/select.h has to be included
9797set sys/select.h i_sysselct
9798eval $inhdr
9799
9800: see if we should include time.h, sys/time.h, or both
9801echo " "
9802if test "X$timeincl" = X; then
9803 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9804 $echo $n "I'm now running the test program...$c"
9805 $cat >try.c <<'EOCP'
9806#include <sys/types.h>
9807#ifdef I_TIME
9808#include <time.h>
9809#endif
9810#ifdef I_SYSTIME
9811#ifdef SYSTIMEKERNEL
9812#define KERNEL
9813#endif
9814#include <sys/time.h>
9815#endif
9816#ifdef I_SYSSELECT
9817#include <sys/select.h>
9818#endif
9819int main()
9820{
9821 struct tm foo;
9822#ifdef S_TIMEVAL
9823 struct timeval bar;
9824#endif
9825#ifdef S_TIMEZONE
9826 struct timezone tzp;
9827#endif
9828 if (foo.tm_sec == foo.tm_sec)
9829 exit(0);
9830#ifdef S_TIMEVAL
9831 if (bar.tv_sec == bar.tv_sec)
9832 exit(0);
9833#endif
9834 exit(1);
9835}
9836EOCP
9837 flags=''
9838 for s_timezone in '-DS_TIMEZONE' ''; do
9839 sysselect=''
9840 for s_timeval in '-DS_TIMEVAL' ''; do
9841 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9842 for i_time in '' '-DI_TIME'; do
9843 for i_systime in '-DI_SYSTIME' ''; do
9844 case "$flags" in
9845 '') $echo $n ".$c"
9846 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9847 if eval $compile; then
9848 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9849 shift
9850 flags="$*"
9851 echo " "
9852 $echo $n "Succeeded with $flags$c"
9853 fi
9854 ;;
9855 esac
9856 done
9857 done
9858 done
9859 done
9860 done
9861 timeincl=''
9862 echo " "
9863 case "$flags" in
9864 *SYSTIMEKERNEL*) i_systimek="$define"
9865 timeincl=`./findhdr sys/time.h`
9866 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9867 *) i_systimek="$undef";;
9868 esac
9869 case "$flags" in
9870 *I_TIME*) i_time="$define"
9871 timeincl=`./findhdr time.h`" $timeincl"
9872 echo "We'll include <time.h>." >&4;;
9873 *) i_time="$undef";;
9874 esac
9875 case "$flags" in
9876 *I_SYSTIME*) i_systime="$define"
9877 timeincl=`./findhdr sys/time.h`" $timeincl"
9878 echo "We'll include <sys/time.h>." >&4;;
9879 *) i_systime="$undef";;
9880 esac
9881 $rm -f try.c try
9882fi
9883
9884: check for fd_set items
9885$cat <<EOM
9886
9887Checking to see how well your C compiler handles fd_set and friends ...
9888EOM
5440bc8e 9889$cat >try.c <<EOCP
b4eb6b3d
JH
9890#$i_systime I_SYS_TIME
9891#$i_sysselct I_SYS_SELECT
9892#$d_socket HAS_SOCKET
9893#include <sys/types.h>
9894#ifdef HAS_SOCKET
9895#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9896#endif
9897#ifdef I_SYS_TIME
9898#include <sys/time.h>
9899#endif
9900#ifdef I_SYS_SELECT
9901#include <sys/select.h>
9902#endif
9903int main() {
9904 fd_set fds;
9905
9906#ifdef TRYBITS
9907 if(fds.fds_bits);
9908#endif
9909
9910#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9911 exit(0);
9912#else
9913 exit(1);
9914#endif
9915}
9916EOCP
5440bc8e 9917set try -DTRYBITS
b4eb6b3d
JH
9918if eval $compile; then
9919 d_fds_bits="$define"
9920 d_fd_set="$define"
9921 echo "Well, your system knows about the normal fd_set typedef..." >&4
5440bc8e 9922 if $run ./try; then
b4eb6b3d
JH
9923 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9924 d_fd_macros="$define"
9925 else
9926 $cat >&4 <<'EOM'
9927but not the normal fd_set macros! Gaaack! I'll have to cover for you.
9928EOM
9929 d_fd_macros="$undef"
9930 fi
9931else
9932 $cat <<'EOM'
9933Hmm, your compiler has some difficulty with fd_set. Checking further...
9934EOM
5440bc8e 9935 set try
b4eb6b3d
JH
9936 if eval $compile; then
9937 d_fds_bits="$undef"
9938 d_fd_set="$define"
9939 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 9940 if $run ./try; then
b4eb6b3d
JH
9941 echo "and you have the normal fd_set macros." >&4
9942 d_fd_macros="$define"
9943 else
9944 $cat <<'EOM'
9945but not the normal fd_set macros! Gross! More work for me...
9946EOM
9947 d_fd_macros="$undef"
9948 fi
9949 else
9950 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
9951 d_fd_set="$undef"
9952 d_fds_bits="$undef"
9953 d_fd_macros="$undef"
9954 fi
9955fi
5440bc8e 9956$rm -f try try.*
b4eb6b3d
JH
9957
9958: see if fgetpos exists
9959set fgetpos d_fgetpos
9960eval $inlibc
9961
9962: see if flock exists
9963set flock d_flock
9964eval $inlibc
9965
2ef53570
JH
9966: see if this is a sys/file.h system
9967val=''
9968set sys/file.h val
9969eval $inhdr
9970
9971: do we need to include sys/file.h ?
9972case "$val" in
9973"$define")
9974 echo " "
9975 if $h_sysfile; then
9976 val="$define"
9977 echo "We'll be including <sys/file.h>." >&4
9978 else
9979 val="$undef"
9980 echo "We won't be including <sys/file.h>." >&4
9981 fi
9982 ;;
9983*)
9984 h_sysfile=false
9985 ;;
9986esac
9987set i_sysfile
9988eval $setvar
9989
9990: see if prototype for flock is available
9991echo " "
9992set d_flockproto flock $i_sysfile sys/file.h
9993eval $hasproto
9994
b4eb6b3d
JH
9995: see if fork exists
9996set fork d_fork
9997eval $inlibc
9998
9999: see if pathconf exists
10000set pathconf d_pathconf
10001eval $inlibc
10002
10003: see if fpathconf exists
10004set fpathconf d_fpathconf
10005eval $inlibc
10006
10007
10008: check for fpos64_t
10009echo " "
10010echo "Checking to see if you have fpos64_t..." >&4
10011$cat >try.c <<EOCP
10012#include <stdio.h>
10013int main() { fpos64_t x = 7; }
10014EOCP
10015set try
10016if eval $compile; then
10017 val="$define"
10018 echo "You have fpos64_t."
10019else
10020 val="$undef"
10021 echo "You do not have fpos64_t."
10022 case "$fpossize" in
10023 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
10024 esac
10025fi
10026$rm -f try.* try
10027set d_fpos64_t
10028eval $setvar
10029
10030: see if frexpl exists
10031set frexpl d_frexpl
10032eval $inlibc
10033
b4eb6b3d
JH
10034: see if this is a sys/param system
10035set sys/param.h i_sysparam
10036eval $inhdr
10037
10038: see if this is a sys/mount.h system
10039set sys/mount.h i_sysmount
10040eval $inhdr
10041
b4eb6b3d
JH
10042
10043echo " "
10044echo "Checking to see if your system supports struct fs_data..." >&4
10045set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
10046eval $hasstruct
10047case "$d_fs_data_s" in
10048"$define") echo "Yes, it does." ;;
10049*) echo "No, it doesn't." ;;
10050esac
10051
10052: see if fseeko exists
10053set fseeko d_fseeko
10054eval $inlibc
10055case "$longsize" in
100568) echo "(Your long is 64 bits, so you could use fseek.)" ;;
10057esac
10058
10059: see if fsetpos exists
10060set fsetpos d_fsetpos
10061eval $inlibc
10062
10063
10064: see if fstatfs exists
10065set fstatfs d_fstatfs
10066eval $inlibc
10067
10068
10069: see if statvfs exists
10070set statvfs d_statvfs
10071eval $inlibc
10072
10073: see if fstatvfs exists
10074set fstatvfs d_fstatvfs
10075eval $inlibc
10076
10077
411ab01c
JH
10078: see if fsync exists
10079set fsync d_fsync
10080eval $inlibc
10081
b4eb6b3d
JH
10082: see if ftello exists
10083set ftello d_ftello
10084eval $inlibc
10085case "$longsize" in
100868) echo "(Your long is 64 bits, so you could use ftell.)" ;;
10087esac
10088
10089: see if getcwd exists
10090set getcwd d_getcwd
10091eval $inlibc
10092
10093: see if getespwnam exists
10094set getespwnam d_getespwnam
10095eval $inlibc
10096
10097
10098: see if getfsstat exists
10099set getfsstat d_getfsstat
10100eval $inlibc
10101
10102: see if getgrent exists
10103set getgrent d_getgrent
10104eval $inlibc
10105
10106: see if gethostbyaddr exists
10107set gethostbyaddr d_gethbyaddr
10108eval $inlibc
10109
10110: see if gethostbyname exists
10111set gethostbyname d_gethbyname
10112eval $inlibc
10113
10114: see if gethostent exists
10115set gethostent d_gethent
10116eval $inlibc
10117
10118: see how we will look up host name
10119echo " "
10120call=''
10121if set gethostname val -f d_gethname; eval $csym; $val; then
10122 echo 'gethostname() found.' >&4
10123 d_gethname="$define"
10124 call=gethostname
10125fi
10126if set uname val -f d_uname; eval $csym; $val; then
10127 if ./xenix; then
10128 $cat <<'EOM'
10129uname() was found, but you're running xenix, and older versions of xenix
10130have a broken uname(). If you don't really know whether your xenix is old
10131enough to have a broken system call, use the default answer.
10132
10133EOM
10134 dflt=y
10135 case "$d_uname" in
10136 "$define") dflt=n;;
10137 esac
10138 rp='Is your uname() broken?'
10139 . ./myread
10140 case "$ans" in
10141 n*) d_uname="$define"; call=uname;;
10142 esac
10143 else
10144 echo 'uname() found.' >&4
10145 d_uname="$define"
10146 case "$call" in
10147 '') call=uname ;;
10148 esac
10149 fi
10150fi
10151case "$d_gethname" in
10152'') d_gethname="$undef";;
10153esac
10154case "$d_uname" in
10155'') d_uname="$undef";;
10156esac
10157case "$d_uname$d_gethname" in
10158*define*)
10159 dflt=n
10160 cat <<EOM
10161
10162Every now and then someone has a $call() that lies about the hostname
10163but can't be fixed for political or economic reasons. If you wish, I can
10164pretend $call() isn't there and maybe compute hostname at run-time
10165thanks to the '$phostname' command.
10166
10167EOM
10168 rp="Shall I ignore $call() from now on?"
10169 . ./myread
10170 case "$ans" in
10171 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
10172 esac;;
10173esac
10174case "$phostname" in
10175'') aphostname='';;
10176*) case "$aphostname" in
10177 /*) ;;
10178 *) set X $phostname
10179 shift
10180 file=$1
10181 shift
10182 file=`./loc $file $file $pth`
10183 aphostname=`echo $file $*`
10184 ;;
10185 esac
10186 ;;
10187esac
10188case "$d_uname$d_gethname" in
10189*define*) ;;
10190*)
10191 case "$phostname" in
10192 '')
10193 echo "There will be no way for $package to get your hostname." >&4;;
10194 *)
10195 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
10196 ;;
10197 esac;;
10198esac
10199case "$d_phostname" in
10200'') d_phostname="$undef";;
10201esac
10202
10203: see if this is a netdb.h system
10204set netdb.h i_netdb
10205eval $inhdr
10206
10207: see if prototypes for various gethostxxx netdb.h functions are available
10208echo " "
10209set d_gethostprotos gethostent $i_netdb netdb.h
10210eval $hasproto
10211
4e0554ec
JH
10212: see if getitimer exists
10213set getitimer d_getitimer
10214eval $inlibc
10215
b4eb6b3d
JH
10216: see if getlogin exists
10217set getlogin d_getlogin
10218eval $inlibc
10219
10220: see if getmnt exists
10221set getmnt d_getmnt
10222eval $inlibc
10223
10224: see if getmntent exists
10225set getmntent d_getmntent
10226eval $inlibc
10227
10228: see if getnetbyaddr exists
10229set getnetbyaddr d_getnbyaddr
10230eval $inlibc
10231
10232: see if getnetbyname exists
10233set getnetbyname d_getnbyname
10234eval $inlibc
10235
10236: see if getnetent exists
10237set getnetent d_getnent
10238eval $inlibc
10239
10240: see if prototypes for various getnetxxx netdb.h functions are available
10241echo " "
10242set d_getnetprotos getnetent $i_netdb netdb.h
10243eval $hasproto
10244
0c0643d0
JH
10245: see if getpagesize exists
10246set getpagesize d_getpagsz
10247eval $inlibc
10248
b4eb6b3d
JH
10249
10250: see if getprotobyname exists
10251set getprotobyname d_getpbyname
10252eval $inlibc
10253
10254: see if getprotobynumber exists
10255set getprotobynumber d_getpbynumber
10256eval $inlibc
10257
10258: see if getprotoent exists
10259set getprotoent d_getpent
10260eval $inlibc
10261
10262: see if getpgid exists
10263set getpgid d_getpgid
10264eval $inlibc
10265
10266: see if getpgrp2 exists
10267set getpgrp2 d_getpgrp2
10268eval $inlibc
10269
10270: see if getppid exists
10271set getppid d_getppid
10272eval $inlibc
10273
10274: see if getpriority exists
10275set getpriority d_getprior
10276eval $inlibc
10277
10278: see if prototypes for various getprotoxxx netdb.h functions are available
10279echo " "
10280set d_getprotoprotos getprotoent $i_netdb netdb.h
10281eval $hasproto
10282
10283: see if getprpwnam exists
10284set getprpwnam d_getprpwnam
10285eval $inlibc
10286
10287: see if getpwent exists
10288set getpwent d_getpwent
10289eval $inlibc
10290
10291
10292: see if getservbyname exists
10293set getservbyname d_getsbyname
10294eval $inlibc
10295
10296: see if getservbyport exists
10297set getservbyport d_getsbyport
10298eval $inlibc
10299
10300: see if getservent exists
10301set getservent d_getsent
10302eval $inlibc
10303
10304: see if prototypes for various getservxxx netdb.h functions are available
10305echo " "
10306set d_getservprotos getservent $i_netdb netdb.h
10307eval $hasproto
10308
10309: see if getspnam exists
10310set getspnam d_getspnam
10311eval $inlibc
10312
10313: see if gettimeofday or ftime exists
10314set gettimeofday d_gettimeod
10315eval $inlibc
10316case "$d_gettimeod" in
10317"$undef")
10318 set ftime d_ftime
10319 eval $inlibc
10320 ;;
10321*)
10322 val="$undef"; set d_ftime; eval $setvar
10323 ;;
10324esac
10325case "$d_gettimeod$d_ftime" in
10326"$undef$undef")
10327 echo " "
10328 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10329 ;;
10330esac
10331
10332: see if this is an grp system
10333set grp.h i_grp
10334eval $inhdr
10335
10336case "$i_grp" in
10337$define)
10338 xxx=`./findhdr grp.h`
10339 $cppstdin $cppflags $cppminus < $xxx >$$.h
10340
10341 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10342 val="$define"
10343 else
10344 val="$undef"
10345 fi
10346 set d_grpasswd
10347 eval $setvar
10348
10349 $rm -f $$.h
10350 ;;
10351*)
10352 val="$undef";
10353 set d_grpasswd; eval $setvar
10354 ;;
10355esac
10356
10357: see if hasmntopt exists
10358set hasmntopt d_hasmntopt
10359eval $inlibc
10360
10361: see if this is a netinet/in.h or sys/in.h system
10362set netinet/in.h i_niin sys/in.h i_sysin
10363eval $inhdr
10364
10365: see if arpa/inet.h has to be included
10366set arpa/inet.h i_arpainet
10367eval $inhdr
10368
10369: see if htonl --and friends-- exists
10370val=''
10371set htonl val
10372eval $inlibc
10373
10374: Maybe they are macros.
10375case "$val" in
10376$undef)
10377 $cat >htonl.c <<EOM
10378#include <stdio.h>
10379#include <sys/types.h>
10380#$i_niin I_NETINET_IN
10381#$i_sysin I_SYS_IN
10382#$i_arpainet I_ARPA_INET
10383#ifdef I_NETINET_IN
10384#include <netinet/in.h>
10385#endif
10386#ifdef I_SYS_IN
10387#include <sys/in.h>
10388#endif
10389#ifdef I_ARPA_INET
10390#include <arpa/inet.h>
10391#endif
10392#ifdef htonl
10393printf("Defined as a macro.");
10394#endif
10395EOM
10396 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10397 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10398 val="$define"
10399 echo "But it seems to be defined as a macro." >&4
10400 fi
10401 $rm -f htonl.?
10402 ;;
10403esac
10404set d_htonl
10405eval $setvar
10406
10407: see if iconv exists
10408set iconv d_iconv
10409eval $inlibc
10410
10411: index or strchr
10412echo " "
10413if set index val -f; eval $csym; $val; then
10414 if set strchr val -f d_strchr; eval $csym; $val; then
10415 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10416 val="$define"
10417 vali="$undef"
10418 echo "strchr() found." >&4
10419 else
10420 val="$undef"
10421 vali="$define"
10422 echo "index() found." >&4
10423 fi
10424 else
10425 val="$undef"
10426 vali="$define"
8dfa8df9
JH
10427 echo "index() found." >&4
10428 fi
b4eb6b3d 10429else
8dfa8df9
JH
10430 if set strchr val -f d_strchr; eval $csym; $val; then
10431 val="$define"
10432 vali="$undef"
10433 echo "strchr() found." >&4
10434 else
10435 echo "No index() or strchr() found!" >&4
10436 val="$undef"
10437 vali="$undef"
10438 fi
b4eb6b3d 10439fi
8dfa8df9
JH
10440set d_strchr; eval $setvar
10441val="$vali"
10442set d_index; eval $setvar
10443
10444: check whether inet_aton exists
10445set inet_aton d_inetaton
10446eval $inlibc
b4eb6b3d
JH
10447
10448: Look for isascii
10449echo " "
10450$cat >isascii.c <<'EOCP'
10451#include <stdio.h>
10452#include <ctype.h>
10453int main() {
10454 int c = 'A';
10455 if (isascii(c))
10456 exit(0);
10457 else
10458 exit(1);
10459}
10460EOCP
10461set isascii
10462if eval $compile; then
10463 echo "isascii() found." >&4
10464 val="$define"
10465else
10466 echo "isascii() NOT found." >&4
10467 val="$undef"
10468fi
10469set d_isascii
10470eval $setvar
10471$rm -f isascii*
10472
10473: see if isnan exists
10474set isnan d_isnan
10475eval $inlibc
10476
10477: see if isnanl exists
10478set isnanl d_isnanl
10479eval $inlibc
10480
10481: see if killpg exists
10482set killpg d_killpg
10483eval $inlibc
10484
10485: see if lchown exists
10486echo " "
10487$cat > try.c <<'EOCP'
10488/* System header to define __stub macros and hopefully few prototypes,
10489 which can conflict with char lchown(); below. */
10490#include <assert.h>
10491/* Override any gcc2 internal prototype to avoid an error. */
10492/* We use char because int might match the return type of a gcc2
10493 builtin and then its argument prototype would still apply. */
10494char lchown();
10495int main() {
10496 /* The GNU C library defines this for functions which it implements
10497 to always fail with ENOSYS. Some functions are actually named
10498 something starting with __ and the normal name is an alias. */
10499#if defined (__stub_lchown) || defined (__stub___lchown)
10500choke me
10501#else
10502lchown();
10503#endif
10504; return 0; }
10505EOCP
10506set try
10507if eval $compile; then
10508 $echo "lchown() found." >&4
10509 val="$define"
10510else
10511 $echo "lchown() NOT found." >&4
10512 val="$undef"
10513fi
10514set d_lchown
10515eval $setvar
10516
10517: See if number of significant digits in a double precision number is known
10518echo " "
10519$cat >ldbl_dig.c <<EOM
10520#$i_limits I_LIMITS
10521#$i_float I_FLOAT
10522#ifdef I_LIMITS
10523#include <limits.h>
10524#endif
10525#ifdef I_FLOAT
10526#include <float.h>
10527#endif
10528#ifdef LDBL_DIG
10529printf("Contains LDBL_DIG");
10530#endif
10531EOM
10532$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10533if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10534 echo "LDBL_DIG found." >&4
10535 val="$define"
10536else
10537 echo "LDBL_DIG NOT found." >&4
10538 val="$undef"
10539fi
10540$rm -f ldbl_dig.?
10541set d_ldbl_dig
10542eval $setvar
10543
10544: see if link exists
10545set link d_link
10546eval $inlibc
10547
10548: see if localeconv exists
10549set localeconv d_locconv
10550eval $inlibc
10551
10552: see if lockf exists
10553set lockf d_lockf
10554eval $inlibc
10555
b4eb6b3d
JH
10556: see if prototype for lseek is available
10557echo " "
10558set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10559eval $hasproto
10560
10561: see if lstat exists
10562set lstat d_lstat
10563eval $inlibc
10564
10565: see if madvise exists
10566set madvise d_madvise
10567eval $inlibc
10568
10569: see if mblen exists
10570set mblen d_mblen
10571eval $inlibc
10572
10573: see if mbstowcs exists
10574set mbstowcs d_mbstowcs
10575eval $inlibc
10576
10577: see if mbtowc exists
10578set mbtowc d_mbtowc
10579eval $inlibc
10580
10581: see if memchr exists
10582set memchr d_memchr
10583eval $inlibc
10584
10585: see if memcmp exists
10586set memcmp d_memcmp
10587eval $inlibc
10588
10589: see if memcpy exists
10590set memcpy d_memcpy
10591eval $inlibc
10592
10593: see if memmove exists
10594set memmove d_memmove
10595eval $inlibc
10596
10597: see if memset exists
10598set memset d_memset
10599eval $inlibc
10600
10601: see if mkdir exists
10602set mkdir d_mkdir
10603eval $inlibc
10604
10605: see if mkdtemp exists
10606set mkdtemp d_mkdtemp
10607eval $inlibc
10608
10609: see if mkfifo exists
10610set mkfifo d_mkfifo
10611eval $inlibc
10612
10613: see if mkstemp exists
10614set mkstemp d_mkstemp
10615eval $inlibc
10616
10617: see if mkstemps exists
10618set mkstemps d_mkstemps
10619eval $inlibc
10620
10621: see if mktime exists
10622set mktime d_mktime
10623eval $inlibc
10624
10625: see if this is a sys/mman.h system
10626set sys/mman.h i_sysmman
10627eval $inhdr
10628
10629: see if mmap exists
10630set mmap d_mmap
10631eval $inlibc
10632: see what shmat returns
10633: default to something harmless
10634mmaptype='void *'
10635case "$i_sysmman$d_mmap" in
10636"$define$define")
10637 $cat >mmap.c <<'END'
10638#include <sys/mman.h>
10639void *mmap();
10640END
10641 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10642 mmaptype='void *'
10643 else
10644 mmaptype='caddr_t'
10645 fi
10646 echo "and it returns ($mmaptype)." >&4
10647 ;;
10648esac
10649
10650
10651
10652: see if modfl exists
10653set modfl d_modfl
10654eval $inlibc
10655
e67aeab1
JH
10656d_modfl_pow32_bug="$undef"
10657
2b2cdb4d
HS
10658case "$d_longdbl$d_modfl" in
10659$define$define)
10660 $cat <<EOM
10661Checking to see whether your modfl() is okay for large values...
10662EOM
10663$cat >try.c <<EOCP
10664#include <math.h>
10665#include <stdio.h>
10666int main() {
10667 long double nv = 4294967303.15;
10668 long double v, w;
10669 v = modfl(nv, &w);
10670#ifdef __GLIBC__
10671 printf("glibc");
10672#endif
10673 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
10674 return 0;
10675}
10676EOCP
27f9615e
JH
10677 case "$osname:$gccversion" in
10678 aix:) saveccflags="$ccflags"
10679 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10680 esac
2b2cdb4d
HS
10681 set try
10682 if eval $compile; then
5440bc8e 10683 foo=`$run ./try`
2b2cdb4d
HS
10684 case "$foo" in
10685 *" 4294967303.150000 1.150000 4294967302.000000")
10686 echo >&4 "Your modfl() is broken for large values."
e67aeab1 10687 d_modfl_pow32_bug="$define"
2b2cdb4d
HS
10688 case "$foo" in
10689 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
10690 ;;
10691 esac
10692 ;;
10693 *" 4294967303.150000 0.150000 4294967303.000000")
10694 echo >&4 "Your modfl() seems okay for large values."
10695 ;;
10696 *) echo >&4 "I don't understand your modfl() at all."
10697 d_modfl="$undef"
10698 ;;
10699 esac
10700 $rm -f try.* try core core.try.*
10701 else
10702 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
10703 d_modfl="$undef"
10704 fi
27f9615e
JH
10705 case "$osname:$gccversion" in
10706 aix:) $ccflags="saveccflags" ;; # restore
10707 esac
2b2cdb4d
HS
10708 ;;
10709esac
10710
b4eb6b3d
JH
10711: see if mprotect exists
10712set mprotect d_mprotect
10713eval $inlibc
10714
10715: see if msgctl exists
10716set msgctl d_msgctl
10717eval $inlibc
10718
10719: see if msgget exists
10720set msgget d_msgget
10721eval $inlibc
10722
10723: see if msgsnd exists
10724set msgsnd d_msgsnd
10725eval $inlibc
10726
10727: see if msgrcv exists
10728set msgrcv d_msgrcv
10729eval $inlibc
10730
10731: see how much of the 'msg*(2)' library is present.
10732h_msg=true
10733echo " "
10734case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10735*"$undef"*) h_msg=false;;
10736esac
10737case "$osname" in
10738freebsd)
10739 case "`ipcs 2>&1`" in
10740 "SVID messages"*"not configured"*)
10741 echo "Your $osname does not have the msg*(2) configured." >&4
10742 h_msg=false
10743 val="$undef"
10744 set msgctl d_msgctl
10745 eval $setvar
10746 set msgget d_msgget
10747 eval $setvar
10748 set msgsnd d_msgsnd
10749 eval $setvar
10750 set msgrcv d_msgrcv
10751 eval $setvar
10752 ;;
10753 esac
10754 ;;
10755esac
10756: we could also check for sys/ipc.h ...
10757if $h_msg && $test `./findhdr sys/msg.h`; then
10758 echo "You have the full msg*(2) library." >&4
10759 val="$define"
10760else
10761 echo "You don't have the full msg*(2) library." >&4
10762 val="$undef"
10763fi
10764set d_msg
10765eval $setvar
10766
4e0554ec
JH
10767
10768echo " "
10769echo "Checking to see if your system supports struct msghdr..." >&4
10770set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10771eval $hasstruct
10772case "$d_msghdr_s" in
10773"$define") echo "Yes, it does." ;;
10774*) echo "No, it doesn't." ;;
10775esac
10776
10777
b4eb6b3d
JH
10778: see if msync exists
10779set msync d_msync
10780eval $inlibc
10781
10782: see if munmap exists
10783set munmap d_munmap
10784eval $inlibc
10785
10786: see if nice exists
10787set nice d_nice
10788eval $inlibc
10789
b4eb6b3d
JH
10790: check for length of character
10791echo " "
10792case "$charsize" in
10793'')
10794 echo "Checking to see how big your characters are (hey, you never know)..." >&4
10795 $cat >try.c <<'EOCP'
10796#include <stdio.h>
10797int main()
10798{
10799 printf("%d\n", (int)sizeof(char));
10800 exit(0);
10801}
10802EOCP
10803 set try
10804 if eval $compile_ok; then
5440bc8e 10805 dflt=`$run ./try`
b4eb6b3d
JH
10806 else
10807 dflt='1'
10808 echo "(I can't seem to compile the test program. Guessing...)"
10809 fi
10810 ;;
10811*)
10812 dflt="$charsize"
10813 ;;
10814esac
10815rp="What is the size of a character (in bytes)?"
10816. ./myread
10817charsize="$ans"
10818$rm -f try.c try
10819
1d1be0dc
NC
10820: check for volatile keyword
10821echo " "
10822echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10823$cat >try.c <<'EOCP'
10824int main()
10825{
10826 typedef struct _goo_struct goo_struct;
10827 goo_struct * volatile goo = ((goo_struct *)0);
10828 struct _goo_struct {
10829 long long_int;
10830 int reg_int;
10831 char char_var;
10832 };
10833 typedef unsigned short foo_t;
10834 char *volatile foo;
10835 volatile int bar;
10836 volatile foo_t blech;
10837 foo = foo;
10838}
10839EOCP
10840if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10841 val="$define"
10842 echo "Yup, it does."
10843else
10844 val="$undef"
10845 echo "Nope, it doesn't."
10846fi
10847set d_volatile
10848eval $setvar
10849$rm -f try.*
10850
b4eb6b3d
JH
10851
10852echo " "
10853$echo "Choosing the C types to be used for Perl's internal types..." >&4
10854
10855case "$use64bitint:$d_quad:$quadtype" in
10856define:define:?*)
10857 ivtype="$quadtype"
10858 uvtype="$uquadtype"
10859 ivsize=8
10860 uvsize=8
10861 ;;
10862*) ivtype="long"
10863 uvtype="unsigned long"
10864 ivsize=$longsize
10865 uvsize=$longsize
10866 ;;
10867esac
10868
10869case "$uselongdouble:$d_longdbl" in
10870define:define)
10871 nvtype="long double"
10872 nvsize=$longdblsize
10873 ;;
10874*) nvtype=double
10875 nvsize=$doublesize
10876 ;;
10877esac
10878
10879$echo "(IV will be "$ivtype", $ivsize bytes)"
10880$echo "(UV will be "$uvtype", $uvsize bytes)"
10881$echo "(NV will be "$nvtype", $nvsize bytes)"
10882
10883$cat >try.c <<EOCP
10884#$i_inttypes I_INTTYPES
10885#ifdef I_INTTYPES
10886#include <inttypes.h>
10887#endif
10888#include <stdio.h>
10889int main() {
10890#ifdef INT8
10891 int8_t i = INT8_MAX;
10892 uint8_t u = UINT8_MAX;
10893 printf("int8_t\n");
10894#endif
10895#ifdef INT16
10896 int16_t i = INT16_MAX;
10897 uint16_t i = UINT16_MAX;
10898 printf("int16_t\n");
10899#endif
10900#ifdef INT32
10901 int32_t i = INT32_MAX;
10902 uint32_t u = UINT32_MAX;
10903 printf("int32_t\n");
10904#endif
10905}
10906EOCP
10907
10908case "$i8type" in
10909'') case "$charsize" in
10910 1) i8type=char
10911 u8type="unsigned char"
10912 i8size=$charsize
10913 u8size=$charsize
10914 ;;
10915 esac
10916 ;;
10917esac
10918case "$i8type" in
10919'') set try -DINT8
10920 if eval $compile; then
5440bc8e 10921 case "`$run ./try`" in
b4eb6b3d
JH
10922 int8_t) i8type=int8_t
10923 u8type=uint8_t
10924 i8size=1
10925 u8size=1
10926 ;;
10927 esac
10928 fi
10929 ;;
10930esac
10931case "$i8type" in
10932'') if $test $charsize -ge 1; then
10933 i8type=char
10934 u8type="unsigned char"
10935 i8size=$charsize
10936 u8size=$charsize
10937 fi
10938 ;;
10939esac
10940
10941case "$i16type" in
10942'') case "$shortsize" in
10943 2) i16type=short
10944 u16type="unsigned short"
10945 i16size=$shortsize
10946 u16size=$shortsize
10947 ;;
10948 esac
10949 ;;
10950esac
10951case "$i16type" in
10952'') set try -DINT16
10953 if eval $compile; then
5440bc8e 10954 case "`$run ./try`" in
b4eb6b3d
JH
10955 int16_t)
10956 i16type=int16_t
10957 u16type=uint16_t
10958 i16size=2
10959 u16size=2
10960 ;;
10961 esac
10962 fi
10963 ;;
10964esac
10965case "$i16type" in
10966'') if $test $shortsize -ge 2; then
10967 i16type=short
10968 u16type="unsigned short"
10969 i16size=$shortsize
10970 u16size=$shortsize
10971 fi
10972 ;;
10973esac
10974
10975case "$i32type" in
10976'') case "$longsize" in
10977 4) i32type=long
10978 u32type="unsigned long"
10979 i32size=$longsize
10980 u32size=$longsize
10981 ;;
10982 *) case "$intsize" in
10983 4) i32type=int
10984 u32type="unsigned int"
10985 i32size=$intsize
10986 u32size=$intsize
10987 ;;
10988 esac
10989 ;;
10990 esac
10991 ;;
10992esac
10993case "$i32type" in
10994'') set try -DINT32
10995 if eval $compile; then
5440bc8e 10996 case "`$run ./try`" in
b4eb6b3d
JH
10997 int32_t)
10998 i32type=int32_t
10999 u32type=uint32_t
11000 i32size=4
11001 u32size=4
11002 ;;
11003 esac
11004 fi
11005 ;;
11006esac
11007case "$i32type" in
11008'') if $test $intsize -ge 4; then
11009 i32type=int
11010 u32type="unsigned int"
11011 i32size=$intsize
11012 u32size=$intsize
11013 fi
11014 ;;
11015esac
11016
11017case "$i64type" in
11018'') case "$d_quad:$quadtype" in
11019 define:?*)
11020 i64type="$quadtype"
11021 u64type="$uquadtype"
11022 i64size=8
11023 u64size=8
11024 ;;
11025 esac
11026 ;;
11027esac
11028
1d1be0dc
NC
11029$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
11030: volatile so that the compiler has to store it out to memory.
11031if test X"$d_volatile" = X"$define"; then
11032 volatile=volatile
11033fi
b4eb6b3d
JH
11034$cat <<EOP >try.c
11035#include <stdio.h>
1d1be0dc
NC
11036#include <sys/types.h>
11037#include <signal.h>
11038#ifdef SIGFPE
11039$volatile int bletched = 0;
11040$signal_t blech(s) int s; { bletched = 1; }
11041#endif
b4eb6b3d
JH
11042int main() {
11043 $uvtype u = 0;
1d1be0dc 11044 $nvtype d;
b4eb6b3d
JH
11045 int n = 8 * $uvsize;
11046 int i;
1d1be0dc
NC
11047#ifdef SIGFPE
11048 signal(SIGFPE, blech);
11049#endif
11050
b4eb6b3d
JH
11051 for (i = 0; i < n; i++) {
11052 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
11053 d = ($nvtype)u;
11054 if (($uvtype)d != u)
b4eb6b3d 11055 break;
1d1be0dc
NC
11056 if (d <= 0)
11057 break;
11058 d = ($nvtype)(u - 1);
11059 if (($uvtype)d != (u - 1))
11060 break;
11061#ifdef SIGFPE
11062 if (bletched) {
11063 break;
11064#endif
11065 }
b4eb6b3d 11066 }
efd1522b 11067 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
11068 exit(0);
11069}
11070EOP
1d1be0dc
NC
11071set try
11072
11073d_nv_preserves_uv="$undef"
11074if eval $compile; then
5440bc8e 11075 d_nv_preserves_uv_bits="`$run ./try`"
1d1be0dc
NC
11076fi
11077case "$d_nv_preserves_uv_bits" in
11078\-[1-9]*)
11079 d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
11080 $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs." 2>&1
11081 d_nv_preserves_uv="$define"
b4eb6b3d 11082 ;;
1d1be0dc
NC
11083[1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs." 2>&1
11084 d_nv_preserves_uv="$undef" ;;
11085*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
11086 d_nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
11087esac
11088
1d1be0dc
NC
11089$rm -f try.* try
11090
b4eb6b3d
JH
11091
11092: check for off64_t
11093echo " "
11094echo "Checking to see if you have off64_t..." >&4
11095$cat >try.c <<EOCP
11096#include <sys/types.h>
11097#include <unistd.h>
11098int main() { off64_t x = 7; }
11099EOCP
11100set try
11101if eval $compile; then
11102 val="$define"
11103 echo "You have off64_t."
11104else
11105 val="$undef"
11106 echo "You do not have off64_t."
11107 case "$lseeksize" in
11108 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
11109 esac
11110fi
11111$rm -f try.* try
11112set d_off64_t
11113eval $setvar
11114
11115: see if POSIX threads are available
11116set pthread.h i_pthread
11117eval $inhdr
11118
11119
11120
11121
11122: how to create joinable pthreads
11123if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
11124 echo " "
11125 echo "Checking what constant to use for creating joinable pthreads..." >&4
11126 $cat >try.c <<'EOCP'
11127#include <pthread.h>
11128int main() {
11129 int detachstate = JOINABLE;
11130}
11131EOCP
11132 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
11133 if eval $compile; then
11134 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
11135 val="$undef" # Yes, undef.
11136 set d_old_pthread_create_joinable
11137 eval $setvar
11138 val=""
11139 set old_pthread_create_joinable
11140 eval $setvar
11141 else
11142 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
11143 if eval $compile; then
11144 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
11145 val="$define"
11146 set d_old_pthread_create_joinable
11147 eval $setvar
11148 val=PTHREAD_CREATE_UNDETACHED
11149 set old_pthread_create_joinable
11150 eval $setvar
11151 else
11152 set try -DJOINABLE=__UNDETACHED
11153 if eval $compile; then
11154 echo "You seem to use __UNDETACHED." >&4
11155 val="$define"
11156 set d_old_pthread_create_joinable
11157 eval $setvar
11158 val=__UNDETACHED
11159 set old_pthread_create_joinable
11160 eval $setvar
11161 else
11162 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
11163 val="$define"
11164 set d_old_pthread_create_joinable
11165 eval $setvar
11166 val=0
11167 set old_pthread_create_joinable
11168 eval $setvar
11169 fi
11170 fi
11171 fi
11172 $rm -f try try.*
11173else
11174 d_old_pthread_create_joinable="$undef"
11175 old_pthread_create_joinable=""
11176fi
11177
11178: see if pause exists
11179set pause d_pause
11180eval $inlibc
11181
11182: see if pipe exists
11183set pipe d_pipe
11184eval $inlibc
11185
11186: see if poll exists
11187set poll d_poll
11188eval $inlibc
11189
11190
11191: see whether the various POSIXish _yields exist
11192$cat >try.c <<EOP
11193#include <pthread.h>
11194#include <stdio.h>
11195int main() {
11196#ifdef SCHED_YIELD
11197 sched_yield();
11198#else
11199#ifdef PTHREAD_YIELD
11200 pthread_yield();
11201#else
11202#ifdef PTHREAD_YIELD_NULL
11203 pthread_yield(NULL);
11204#endif
11205#endif
11206#endif
11207}
11208EOP
11209: see if sched_yield exists
11210set try -DSCHED_YIELD
11211if eval $compile; then
11212 val="$define"
11213 sched_yield='sched_yield()'
11214else
11215 val="$undef"
11216fi
11217case "$usethreads" in
11218$define)
11219 case "$val" in
11220 $define) echo 'sched_yield() found.' >&4 ;;
11221 *) echo 'sched_yield() NOT found.' >&4 ;;
11222 esac
11223esac
11224set d_sched_yield
11225eval $setvar
11226
11227: see if pthread_yield exists
11228set try -DPTHREAD_YIELD
11229if eval $compile; then
11230 val="$define"
11231 case "$sched_yield" in
11232 '') sched_yield='pthread_yield()' ;;
11233 esac
11234else
11235 set try -DPTHREAD_YIELD_NULL
11236 if eval $compile; then
11237 val="$define"
11238 case "$sched_yield" in
11239 '') sched_yield='pthread_yield(NULL)' ;;
11240 esac
11241 else
11242 val="$undef"
11243 fi
11244fi
11245case "$usethreads" in
11246$define)
11247 case "$val" in
11248 $define) echo 'pthread_yield() found.' >&4 ;;
11249 *) echo 'pthread_yield() NOT found.' >&4 ;;
11250 esac
11251 ;;
11252esac
11253set d_pthread_yield
11254eval $setvar
11255
11256case "$sched_yield" in
11257'') sched_yield=undef ;;
11258esac
11259
11260$rm -f try try.*
11261
11262: see if this is a pwd.h system
11263set pwd.h i_pwd
11264eval $inhdr
11265
11266case "$i_pwd" in
11267$define)
11268 xxx=`./findhdr pwd.h`
11269 $cppstdin $cppflags $cppminus < $xxx >$$.h
11270
11271 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11272 val="$define"
11273 else
11274 val="$undef"
11275 fi
11276 set d_pwquota
11277 eval $setvar
11278
11279 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11280 val="$define"
11281 else
11282 val="$undef"
11283 fi
11284 set d_pwage
11285 eval $setvar
11286
11287 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11288 val="$define"
11289 else
11290 val="$undef"
11291 fi
11292 set d_pwchange
11293 eval $setvar
11294
11295 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11296 val="$define"
11297 else
11298 val="$undef"
11299 fi
11300 set d_pwclass
11301 eval $setvar
11302
11303 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11304 val="$define"
11305 else
11306 val="$undef"
11307 fi
11308 set d_pwexpire
11309 eval $setvar
11310
11311 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11312 val="$define"
11313 else
11314 val="$undef"
11315 fi
11316 set d_pwcomment
11317 eval $setvar
11318
11319 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11320 val="$define"
11321 else
11322 val="$undef"
11323 fi
11324 set d_pwgecos
11325 eval $setvar
11326
11327 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11328 val="$define"
11329 else
11330 val="$undef"
11331 fi
11332 set d_pwpasswd
11333 eval $setvar
11334
11335 $rm -f $$.h
11336 ;;
11337*)
11338 val="$undef";
11339 set d_pwquota; eval $setvar
11340 set d_pwage; eval $setvar
11341 set d_pwchange; eval $setvar
11342 set d_pwclass; eval $setvar
11343 set d_pwexpire; eval $setvar
11344 set d_pwcomment; eval $setvar
11345 set d_pwgecos; eval $setvar
11346 set d_pwpasswd; eval $setvar
11347 ;;
11348esac
11349
11350: see if readdir and friends exist
11351set readdir d_readdir
11352eval $inlibc
11353set seekdir d_seekdir
11354eval $inlibc
11355set telldir d_telldir
11356eval $inlibc
11357set rewinddir d_rewinddir
11358eval $inlibc
11359
11360: see if readlink exists
11361set readlink d_readlink
11362eval $inlibc
11363
4e0554ec
JH
11364: see if readv exists
11365set readv d_readv
11366eval $inlibc
11367
640374d0
JH
11368: see if realpath exists
11369set realpath d_realpath
11370eval $inlibc
11371
4e0554ec
JH
11372: see if recvmsg exists
11373set recvmsg d_recvmsg
11374eval $inlibc
11375
b4eb6b3d
JH
11376: see if rename exists
11377set rename d_rename
11378eval $inlibc
11379
11380: see if rmdir exists
11381set rmdir d_rmdir
11382eval $inlibc
11383
11384: see if memory.h is available.
11385val=''
11386set memory.h val
11387eval $inhdr
11388
11389: See if it conflicts with string.h
11390case "$val" in
11391$define)
11392 case "$strings" in
11393 '') ;;
11394 *)
11395 $cppstdin $cppflags $cppminus < $strings > mem.h
11396 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11397 echo " "
11398 echo "We won't be including <memory.h>."
11399 val="$undef"
11400 fi
11401 $rm -f mem.h
11402 ;;
11403 esac
11404esac
11405set i_memory
11406eval $setvar
11407
11408: can bcopy handle overlapping blocks?
11409val="$undef"
11410case "$d_bcopy" in
11411"$define")
11412 echo " "
11413 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
11414 $cat >try.c <<EOCP
11415#$i_memory I_MEMORY
11416#$i_stdlib I_STDLIB
11417#$i_string I_STRING
11418#$i_unistd I_UNISTD
11419EOCP
11420 $cat >>try.c <<'EOCP'
11421#include <stdio.h>
11422#ifdef I_MEMORY
11423# include <memory.h>
11424#endif
11425#ifdef I_STDLIB
11426# include <stdlib.h>
11427#endif
11428#ifdef I_STRING
11429# include <string.h>
11430#else
11431# include <strings.h>
11432#endif
11433#ifdef I_UNISTD
11434# include <unistd.h> /* Needed for NetBSD */
11435#endif
11436int main()
11437{
11438char buf[128], abc[128];
11439char *b;
11440int len;
11441int off;
11442int align;
11443
11444bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11445
11446for (align = 7; align >= 0; align--) {
11447 for (len = 36; len; len--) {
11448 b = buf+align;
11449 bcopy(abc, b, len);
11450 for (off = 1; off <= len; off++) {
11451 bcopy(b, b+off, len);
11452 bcopy(b+off, b, len);
11453 if (bcmp(b, abc, len))
11454 exit(1);
11455 }
11456 }
11457}
11458exit(0);
11459}
11460EOCP
11461 set try
11462 if eval $compile_ok; then
5440bc8e 11463 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
11464 echo "Yes, it can."
11465 val="$define"
11466 else
11467 echo "It can't, sorry."
11468 case "$d_memmove" in
11469 "$define") echo "But that's Ok since you have memmove()." ;;
11470 esac
11471 fi
11472 else
11473 echo "(I can't compile the test program, so we'll assume not...)"
11474 case "$d_memmove" in
11475 "$define") echo "But that's Ok since you have memmove()." ;;
11476 esac
11477 fi
11478 ;;
11479esac
11480$rm -f try.* try core
11481set d_safebcpy
11482eval $setvar
11483
11484: can memcpy handle overlapping blocks?
11485val="$undef"
11486case "$d_memcpy" in
11487"$define")
11488 echo " "
11489 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
11490 $cat >try.c <<EOCP
11491#$i_memory I_MEMORY
11492#$i_stdlib I_STDLIB
11493#$i_string I_STRING
11494#$i_unistd I_UNISTD
11495EOCP
11496 $cat >>try.c <<'EOCP'
11497#include <stdio.h>
11498#ifdef I_MEMORY
11499# include <memory.h>
11500#endif
11501#ifdef I_STDLIB
11502# include <stdlib.h>
11503#endif
11504#ifdef I_STRING
11505# include <string.h>
11506#else
11507# include <strings.h>
11508#endif
11509#ifdef I_UNISTD
11510# include <unistd.h> /* Needed for NetBSD */
11511#endif
11512int main()
11513{
11514char buf[128], abc[128];
11515char *b;
11516int len;
11517int off;
11518int align;
11519
11520/* Copy "abcde..." string to char abc[] so that gcc doesn't
11521 try to store the string in read-only memory. */
11522memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11523
11524for (align = 7; align >= 0; align--) {
11525 for (len = 36; len; len--) {
11526 b = buf+align;
11527 memcpy(b, abc, len);
11528 for (off = 1; off <= len; off++) {
11529 memcpy(b+off, b, len);
11530 memcpy(b, b+off, len);
11531 if (memcmp(b, abc, len))
11532 exit(1);
11533 }
11534 }
11535}
11536exit(0);
11537}
11538EOCP
11539 set try
11540 if eval $compile_ok; then
5440bc8e 11541 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
11542 echo "Yes, it can."
11543 val="$define"
11544 else
11545 echo "It can't, sorry."
11546 case "$d_memmove" in
11547 "$define") echo "But that's Ok since you have memmove()." ;;
11548 esac
11549 fi
11550 else
11551 echo "(I can't compile the test program, so we'll assume not...)"
11552 case "$d_memmove" in
11553 "$define") echo "But that's Ok since you have memmove()." ;;
11554 esac
11555 fi
11556 ;;
11557esac
11558$rm -f try.* try core
11559set d_safemcpy
11560eval $setvar
11561
11562: can memcmp be trusted to compare relative magnitude?
11563val="$undef"
11564case "$d_memcmp" in
11565"$define")
11566 echo " "
11567 echo "Checking if your memcmp() can compare relative magnitude..." >&4
11568 $cat >try.c <<EOCP
11569#$i_memory I_MEMORY
11570#$i_stdlib I_STDLIB
11571#$i_string I_STRING
11572#$i_unistd I_UNISTD
11573EOCP
11574 $cat >>try.c <<'EOCP'
11575#include <stdio.h>
11576#ifdef I_MEMORY
11577# include <memory.h>
11578#endif
11579#ifdef I_STDLIB
11580# include <stdlib.h>
11581#endif
11582#ifdef I_STRING
11583# include <string.h>
11584#else
11585# include <strings.h>
11586#endif
11587#ifdef I_UNISTD
11588# include <unistd.h> /* Needed for NetBSD */
11589#endif
11590int main()
11591{
11592char a = -1;
11593char b = 0;
11594if ((a < b) && memcmp(&a, &b, 1) < 0)
11595 exit(1);
11596exit(0);
11597}
11598EOCP
11599 set try
11600 if eval $compile_ok; then
5440bc8e 11601 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
11602 echo "Yes, it can."
11603 val="$define"
11604 else
11605 echo "No, it can't (it uses signed chars)."
11606 fi
11607 else
11608 echo "(I can't compile the test program, so we'll assume not...)"
11609 fi
11610 ;;
11611esac
11612$rm -f try.* try core
11613set d_sanemcmp
11614eval $setvar
11615
ef9f17be
JH
11616: see if prototype for sbrk is available
11617echo " "
11618set d_sbrkproto sbrk $i_unistd unistd.h
11619eval $hasproto
11620
b4eb6b3d
JH
11621: see if select exists
11622set select d_select
11623eval $inlibc
11624
11625: see if semctl exists
11626set semctl d_semctl
11627eval $inlibc
11628
11629: see if semget exists
11630set semget d_semget
11631eval $inlibc
11632
11633: see if semop exists
11634set semop d_semop
11635eval $inlibc
11636
11637: see how much of the 'sem*(2)' library is present.
11638h_sem=true
11639echo " "
11640case "$d_semctl$d_semget$d_semop" in
11641*"$undef"*) h_sem=false;;
11642esac
11643case "$osname" in
11644freebsd)
11645 case "`ipcs 2>&1`" in
11646 "SVID messages"*"not configured"*)
11647 echo "Your $osname does not have the sem*(2) configured." >&4
11648 h_sem=false
11649 val="$undef"
11650 set semctl d_semctl
11651 eval $setvar
11652 set semget d_semget
11653 eval $setvar
11654 set semop d_semop
11655 eval $setvar
11656 ;;
11657 esac
11658 ;;
11659esac
11660: we could also check for sys/ipc.h ...
11661if $h_sem && $test `./findhdr sys/sem.h`; then
11662 echo "You have the full sem*(2) library." >&4
11663 val="$define"
11664else
11665 echo "You don't have the full sem*(2) library." >&4
11666 val="$undef"
11667fi
11668set d_sem
11669eval $setvar
11670
11671: see whether sys/sem.h defines union semun
11672echo " "
11673$cat > try.c <<'END'
11674#include <sys/types.h>
11675#include <sys/ipc.h>
11676#include <sys/sem.h>
11677int main () { union semun semun; semun.buf = 0; }
11678END
11679set try
11680if eval $compile; then
11681 echo "You have union semun in <sys/sem.h>." >&4
11682 val="$define"
11683else
11684 echo "You do not have union semun in <sys/sem.h>." >&4
11685 val="$undef"
11686fi
11687$rm -f try try.c try.h
11688set d_union_semun
11689eval $setvar
11690
11691: see how to do semctl IPC_STAT
11692case "$d_sem" in
11693$define)
11694 : see whether semctl IPC_STAT can use union semun
11695 echo " "
11696 $cat > try.h <<END
11697#ifndef S_IRUSR
11698# ifdef S_IREAD
11699# define S_IRUSR S_IREAD
11700# define S_IWUSR S_IWRITE
11701# define S_IXUSR S_IEXEC
11702# else
11703# define S_IRUSR 0400
11704# define S_IWUSR 0200
11705# define S_IXUSR 0100
11706# endif
11707# define S_IRGRP (S_IRUSR>>3)
11708# define S_IWGRP (S_IWUSR>>3)
11709# define S_IXGRP (S_IXUSR>>3)
11710# define S_IROTH (S_IRUSR>>6)
11711# define S_IWOTH (S_IWUSR>>6)
11712# define S_IXOTH (S_IXUSR>>6)
11713#endif
11714#ifndef S_IRWXU
11715# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11716# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11717# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11718#endif
11719END
11720
11721 $cat > try.c <<END
11722#include <sys/types.h>
11723#include <sys/ipc.h>
11724#include <sys/sem.h>
11725#include <sys/stat.h>
11726#include <stdio.h>
11727#include <errno.h>
11728#include "try.h"
11729#ifndef errno
11730extern int errno;
11731#endif
11732#$d_union_semun HAS_UNION_SEMUN
11733int main() {
11734 union semun
11735#ifndef HAS_UNION_SEMUN
11736 {
11737 int val;
11738 struct semid_ds *buf;
11739 unsigned short *array;
11740 }
11741#endif
11742 arg;
11743 int sem, st;
11744
11745#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11746 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11747 if (sem > -1) {
11748 struct semid_ds argbuf;
11749 arg.buf = &argbuf;
11750# ifdef IPC_STAT
11751 st = semctl(sem, 0, IPC_STAT, arg);
11752 if (st == 0)
11753 printf("semun\n");
11754 else
11755# endif /* IPC_STAT */
11756 printf("semctl IPC_STAT failed: errno = %d\n", errno);
11757# ifdef IPC_RMID
11758 if (semctl(sem, 0, IPC_RMID, arg) != 0)
11759# endif /* IPC_RMID */
11760 printf("semctl IPC_RMID failed: errno = %d\n", errno);
11761 } else
11762#endif /* IPC_PRIVATE && ... */
11763 printf("semget failed: errno = %d\n", errno);
11764 return 0;
11765}
11766END
11767 val="$undef"
11768 set try
11769 if eval $compile; then
5440bc8e 11770 xxx=`$run ./try`
b4eb6b3d
JH
11771 case "$xxx" in
11772 semun) val="$define" ;;
11773 esac
11774 fi
11775 $rm -f try try.c
11776 set d_semctl_semun
11777 eval $setvar
11778 case "$d_semctl_semun" in
11779 $define)
11780 echo "You can use union semun for semctl IPC_STAT." >&4
11781 also='also'
11782 ;;
11783 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
11784 also=''
11785 ;;
11786 esac
11787
11788 : see whether semctl IPC_STAT can use struct semid_ds pointer
11789 $cat > try.c <<'END'
11790#include <sys/types.h>
11791#include <sys/ipc.h>
11792#include <sys/sem.h>
11793#include <sys/stat.h>
11794#include "try.h"
11795#include <stdio.h>
11796#include <errno.h>
11797#ifndef errno
11798extern int errno;
11799#endif
11800int main() {
11801 struct semid_ds arg;
11802 int sem, st;
11803
11804#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11805 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11806 if (sem > -1) {
11807# ifdef IPC_STAT
11808 st = semctl(sem, 0, IPC_STAT, &arg);
11809 if (st == 0)
11810 printf("semid_ds\n");
11811 else
11812# endif /* IPC_STAT */
11813 printf("semctl IPC_STAT failed: errno = %d\n", errno);
11814# ifdef IPC_RMID
11815 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11816# endif /* IPC_RMID */
11817 printf("semctl IPC_RMID failed: errno = %d\n", errno);
11818 } else
11819#endif /* IPC_PRIVATE && ... */
11820 printf("semget failed: errno = %d\n", errno);
11821
11822 return 0;
11823}
11824END
11825 val="$undef"
11826 set try
11827 if eval $compile; then
5440bc8e 11828 xxx=`$run ./try`
b4eb6b3d
JH
11829 case "$xxx" in
11830 semid_ds) val="$define" ;;
11831 esac
11832 fi
11833 $rm -f try try.c
11834 set d_semctl_semid_ds
11835 eval $setvar
11836 case "$d_semctl_semid_ds" in
11837 $define)
11838 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11839 ;;
11840 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11841 ;;
11842 esac
11843 $rm -f try.h
11844 ;;
11845*) val="$undef"
11846
11847 # We do not have the full sem*(2) library, so assume we can not
11848 # use either.
11849
11850 set d_semctl_semun
11851 eval $setvar
11852
11853 set d_semctl_semid_ds
11854 eval $setvar
11855 ;;
11856esac
11857
4e0554ec
JH
11858: see if sendmsg exists
11859set sendmsg d_sendmsg
11860eval $inlibc
11861
b4eb6b3d
JH
11862: see if setegid exists
11863set setegid d_setegid
11864eval $inlibc
11865
11866: see if seteuid exists
11867set seteuid d_seteuid
11868eval $inlibc
11869
11870: see if setgrent exists
11871set setgrent d_setgrent
11872eval $inlibc
11873
11874: see if sethostent exists
11875set sethostent d_sethent
11876eval $inlibc
11877
4e0554ec
JH
11878: see if setitimer exists
11879set setitimer d_setitimer
11880eval $inlibc
11881
b4eb6b3d
JH
11882: see if setlinebuf exists
11883set setlinebuf d_setlinebuf
11884eval $inlibc
11885
11886: see if setlocale exists
11887set setlocale d_setlocale
11888eval $inlibc
11889
11890: see if setnetent exists
11891set setnetent d_setnent
11892eval $inlibc
11893
11894: see if setprotoent exists
11895set setprotoent d_setpent
11896eval $inlibc
11897
11898: see if setpgid exists
11899set setpgid d_setpgid
11900eval $inlibc
11901
11902: see if setpgrp2 exists
11903set setpgrp2 d_setpgrp2
11904eval $inlibc
11905
11906: see if setpriority exists
11907set setpriority d_setprior
11908eval $inlibc
11909
11910: see if setproctitle exists
11911set setproctitle d_setproctitle
11912eval $inlibc
11913
11914: see if setpwent exists
11915set setpwent d_setpwent
11916eval $inlibc
11917
11918: see if setregid exists
11919set setregid d_setregid
11920eval $inlibc
11921set setresgid d_setresgid
11922eval $inlibc
11923
11924: see if setreuid exists
11925set setreuid d_setreuid
11926eval $inlibc
11927set setresuid d_setresuid
11928eval $inlibc
11929
11930: see if setrgid exists
11931set setrgid d_setrgid
11932eval $inlibc
11933
11934: see if setruid exists
11935set setruid d_setruid
11936eval $inlibc
11937
11938: see if setservent exists
11939set setservent d_setsent
11940eval $inlibc
11941
11942: see if setsid exists
11943set setsid d_setsid
11944eval $inlibc
11945
11946: see if setvbuf exists
11947set setvbuf d_setvbuf
11948eval $inlibc
11949
11950: see if sfio.h is available
11951set sfio.h i_sfio
11952eval $inhdr
11953
11954
11955: see if sfio library is available
11956case "$i_sfio" in
11957$define)
11958 val=''
11959 set sfreserve val
11960 eval $inlibc
11961 ;;
11962*)
11963 val="$undef"
11964 ;;
11965esac
11966: Ok, but do we want to use it.
11967case "$val" in
11968$define)
11969 case "$usesfio" in
11970 true|$define|[yY]*) dflt='y';;
11971 *) dflt='n';;
11972 esac
11973 echo "$package can use the sfio library, but it is experimental."
11974 case "$useperlio" in
11975 "$undef")
11976 echo "For sfio also the PerlIO abstraction layer is needed."
11977 echo "Earlier you said you wouldn't want that."
11978 ;;
11979 esac
11980 rp="You seem to have sfio available, do you want to try using it?"
11981 . ./myread
11982 case "$ans" in
11983 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
11984 useperlio="$define"
11985 val="$define"
11986 ;;
11987 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
11988 val="$undef"
b4eb6b3d
JH
11989 ;;
11990 esac
11991 ;;
11992*) case "$usesfio" in
11993 true|$define|[yY]*)
11994 echo "Sorry, cannot find sfio on this machine." >&4
11995 echo "Ignoring your setting of usesfio=$usesfio." >&4
11996 val="$undef"
11997 ;;
11998 esac
11999 ;;
12000esac
12001set d_sfio
12002eval $setvar
12003case "$d_sfio" in
12004$define) usesfio='true';;
12005*) usesfio='false';;
12006esac
3659ebf1
JH
12007case "$d_sfio" in
12008$define) ;;
12009*) : Remove sfio from list of libraries to use
12010 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
12011 shift
12012 libs="$*"
12013 echo "libs = $libs" >&4
12014;;
12015esac
12016
b4eb6b3d
JH
12017
12018: see if shmctl exists
12019set shmctl d_shmctl
12020eval $inlibc
12021
12022: see if shmget exists
12023set shmget d_shmget
12024eval $inlibc
12025
12026: see if shmat exists
12027set shmat d_shmat
12028eval $inlibc
12029: see what shmat returns
12030case "$d_shmat" in
12031"$define")
12032 $cat >shmat.c <<'END'
12033#include <sys/shm.h>
12034void *shmat();
12035END
12036 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
12037 shmattype='void *'
12038 else
12039 shmattype='char *'
12040 fi
12041 echo "and it returns ($shmattype)." >&4
12042 : see if a prototype for shmat is available
12043 xxx=`./findhdr sys/shm.h`
12044 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
12045 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
12046 val="$define"
12047 else
12048 val="$undef"
12049 fi
12050 $rm -f shmat.[co]
12051 ;;
12052*)
12053 val="$undef"
12054 ;;
12055esac
12056set d_shmatprototype
12057eval $setvar
12058
12059: see if shmdt exists
12060set shmdt d_shmdt
12061eval $inlibc
12062
12063: see how much of the 'shm*(2)' library is present.
12064h_shm=true
12065echo " "
12066case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
12067*"$undef"*) h_shm=false;;
12068esac
12069case "$osname" in
12070freebsd)
12071 case "`ipcs 2>&1`" in
12072 "SVID shared memory"*"not configured"*)
12073 echo "Your $osname does not have the shm*(2) configured." >&4
12074 h_shm=false
12075 val="$undef"
12076 set shmctl d_shmctl
12077 evat $setvar
12078 set shmget d_shmget
12079 evat $setvar
12080 set shmat d_shmat
12081 evat $setvar
12082 set shmdt d_shmdt
12083 evat $setvar
12084 ;;
12085 esac
12086 ;;
12087esac
12088: we could also check for sys/ipc.h ...
12089if $h_shm && $test `./findhdr sys/shm.h`; then
12090 echo "You have the full shm*(2) library." >&4
12091 val="$define"
12092else
12093 echo "You don't have the full shm*(2) library." >&4
12094 val="$undef"
12095fi
12096set d_shm
12097eval $setvar
12098
12099echo " "
12100: see if we have sigaction
12101if set sigaction val -f d_sigaction; eval $csym; $val; then
12102 echo 'sigaction() found.' >&4
12103 $cat > try.c <<'EOP'
12104#include <stdio.h>
12105#include <sys/types.h>
12106#include <signal.h>
12107int main()
12108{
12109 struct sigaction act, oact;
12110 act.sa_flags = 0;
12111 oact.sa_handler = 0;
12112 /* so that act and oact are used */
12113 exit(act.sa_flags == 0 && oact.sa_handler == 0);
12114}
12115EOP
12116 set try
12117 if eval $compile_ok; then
12118 val="$define"
12119 else
12120 echo "But you don't seem to have a useable struct sigaction." >&4
12121 val="$undef"
12122 fi
12123else
12124 echo 'sigaction NOT found.' >&4
12125 val="$undef"
12126fi
12127set d_sigaction; eval $setvar
12128$rm -f try try$_o try.c
12129
983dbef6
JH
12130: see if sigprocmask exists
12131set sigprocmask d_sigprocmask
12132eval $inlibc
12133
b4eb6b3d
JH
12134: see if sigsetjmp exists
12135echo " "
12136case "$d_sigsetjmp" in
12137'')
12138 $cat >try.c <<'EOP'
12139#include <setjmp.h>
12140sigjmp_buf env;
12141int set = 1;
12142int main()
12143{
12144 if (sigsetjmp(env,1))
12145 exit(set);
12146 set = 0;
12147 siglongjmp(env, 1);
12148 exit(1);
12149}
12150EOP
12151 set try
12152 if eval $compile; then
5440bc8e 12153 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
12154 echo "POSIX sigsetjmp found." >&4
12155 val="$define"
12156 else
12157 $cat >&4 <<EOM
12158Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
12159I'll ignore them.
12160EOM
12161 val="$undef"
12162 fi
12163 else
12164 echo "sigsetjmp not found." >&4
12165 val="$undef"
12166 fi
12167 ;;
12168*) val="$d_sigsetjmp"
12169 case "$d_sigsetjmp" in
12170 $define) echo "POSIX sigsetjmp found." >&4;;
12171 $undef) echo "sigsetjmp not found." >&4;;
12172 esac
12173 ;;
12174esac
12175set d_sigsetjmp
12176eval $setvar
12177$rm -f try.c try
12178
49a78c82
JH
12179: see if sockatmark exists
12180set sockatmark d_sockatmark
12181eval $inlibc
12182
2ef53570
JH
12183: see if prototype for sockatmark is available
12184echo " "
12185set d_sockatmarkproto sockatmark $d_socket sys/socket.h
12186eval $hasproto
12187
b4eb6b3d
JH
12188: see if socks5_init exists
12189set socks5_init d_socks5_init
12190eval $inlibc
12191
eef837ea
JH
12192: see if prototype for setresgid is available
12193echo " "
12194set d_sresgproto setresgid $i_unistd unistd.h
12195eval $hasproto
12196
640374d0
JH
12197: see if prototype for setresuid is available
12198echo " "
12199set d_sresuproto setresuid $i_unistd unistd.h
12200eval $hasproto
12201
b4eb6b3d
JH
12202: see if sys/stat.h is available
12203set sys/stat.h i_sysstat
12204eval $inhdr
12205
12206
12207: see if stat knows about block sizes
12208echo " "
12209echo "Checking to see if your struct stat has st_blocks field..." >&4
12210set d_statblks stat st_blocks $i_sysstat sys/stat.h
12211eval $hasfield
12212
12213
12214: see if this is a sys/vfs.h system
12215set sys/vfs.h i_sysvfs
12216eval $inhdr
12217
12218
12219: see if this is a sys/statfs.h system
12220set sys/statfs.h i_sysstatfs
12221eval $inhdr
12222
12223
12224echo " "
12225echo "Checking to see if your system supports struct statfs..." >&4
12226set 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
12227eval $hasstruct
12228case "$d_statfs_s" in
12229"$define") echo "Yes, it does." ;;
12230*) echo "No, it doesn't." ;;
12231esac
12232
12233
12234
12235: see if struct statfs knows about f_flags
12236case "$d_statfs_s" in
12237define)
12238 echo " "
12239 echo "Checking to see if your struct statfs has f_flags field..." >&4
12240 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
12241 eval $hasfield
12242 ;;
12243*) val="$undef"
12244 set d_statfs_f_flags
12245 eval $setvar
12246 ;;
12247esac
12248case "$d_statfs_f_flags" in
12249"$define") echo "Yes, it does." ;;
12250*) echo "No, it doesn't." ;;
12251esac
12252
12253: see if _ptr and _cnt from stdio act std
12254echo " "
80f36755
NC
12255
12256if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12257 echo "(Looks like you have stdio.h from BSD.)"
12258 case "$stdio_ptr" in
12259 '') stdio_ptr='((fp)->_p)'
12260 ptr_lval=$define
12261 ;;
12262 *) ptr_lval=$d_stdio_ptr_lval;;
12263 esac
12264 case "$stdio_cnt" in
12265 '') stdio_cnt='((fp)->_r)'
12266 cnt_lval=$define
12267 ;;
12268 *) cnt_lval=$d_stdio_cnt_lval;;
12269 esac
12270 case "$stdio_base" in
12271 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12272 esac
12273 case "$stdio_bufsiz" in
12274 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12275 esac
12276elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
b4eb6b3d
JH
12277 echo "(Looks like you have stdio.h from Linux.)"
12278 case "$stdio_ptr" in
12279 '') stdio_ptr='((fp)->_IO_read_ptr)'
12280 ptr_lval=$define
12281 ;;
12282 *) ptr_lval=$d_stdio_ptr_lval;;
12283 esac
12284 case "$stdio_cnt" in
12285 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12286 cnt_lval=$undef
12287 ;;
12288 *) cnt_lval=$d_stdio_cnt_lval;;
12289 esac
12290 case "$stdio_base" in
12291 '') stdio_base='((fp)->_IO_read_base)';;
12292 esac
12293 case "$stdio_bufsiz" in
12294 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12295 esac
12296else
12297 case "$stdio_ptr" in
12298 '') stdio_ptr='((fp)->_ptr)'
12299 ptr_lval=$define
12300 ;;
12301 *) ptr_lval=$d_stdio_ptr_lval;;
12302 esac
12303 case "$stdio_cnt" in
12304 '') stdio_cnt='((fp)->_cnt)'
12305 cnt_lval=$define
12306 ;;
12307 *) cnt_lval=$d_stdio_cnt_lval;;
12308 esac
12309 case "$stdio_base" in
12310 '') stdio_base='((fp)->_base)';;
12311 esac
12312 case "$stdio_bufsiz" in
12313 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12314 esac
12315fi
80f36755 12316
b4eb6b3d
JH
12317: test whether _ptr and _cnt really work
12318echo "Checking how std your stdio is..." >&4
12319$cat >try.c <<EOP
12320#include <stdio.h>
12321#define FILE_ptr(fp) $stdio_ptr
12322#define FILE_cnt(fp) $stdio_cnt
12323int main() {
12324 FILE *fp = fopen("try.c", "r");
12325 char c = getc(fp);
12326 if (
12327 18 <= FILE_cnt(fp) &&
12328 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12329 )
12330 exit(0);
12331 exit(1);
12332}
12333EOP
12334val="$undef"
12335set try
5440bc8e
JH
12336if eval $compile && $to try.c; then
12337 if $run ./try; then
b4eb6b3d
JH
12338 echo "Your stdio acts pretty std."
12339 val="$define"
12340 else
12341 echo "Your stdio isn't very std."
12342 fi
12343else
12344 echo "Your stdio doesn't appear very std."
12345fi
12346$rm -f try.c try
12347set d_stdstdio
12348eval $setvar
12349
12350: Can _ptr be used as an lvalue?
12351case "$d_stdstdio$ptr_lval" in
12352$define$define) val=$define ;;
12353*) val=$undef ;;
12354esac
12355set d_stdio_ptr_lval
12356eval $setvar
12357
12358: Can _cnt be used as an lvalue?
12359case "$d_stdstdio$cnt_lval" in
12360$define$define) val=$define ;;
12361*) val=$undef ;;
12362esac
12363set d_stdio_cnt_lval
12364eval $setvar
12365
a7ffa9b9
NC
12366
12367: test whether setting _ptr sets _cnt as a side effect
12368d_stdio_ptr_lval_sets_cnt="$undef"
12369d_stdio_ptr_lval_nochange_cnt="$undef"
12370case "$d_stdio_ptr_lval$d_stdstdio" in
12371$define$define)
12372 echo "Checking to see what happens if we set the stdio ptr..." >&4
12373$cat >try.c <<EOP
12374#include <stdio.h>
12375/* Can we scream? */
12376/* Eat dust sed :-) */
c1d9e6fa 12377/* In the buffer space, no one can hear you scream. */
0bbfc344
JH
12378#define FILE_ptr(fp) $stdio_ptr
12379#define FILE_cnt(fp) $stdio_cnt
c1d9e6fa 12380#include <sys/types.h>
a7ffa9b9
NC
12381int main() {
12382 FILE *fp = fopen("try.c", "r");
c1d9e6fa 12383 int c;
a7ffa9b9
NC
12384 char *ptr;
12385 size_t cnt;
c1d9e6fa
JH
12386 if (!fp) {
12387 puts("Fail even to read");
12388 exit(1);
12389 }
12390 c = getc(fp); /* Read away the first # */
12391 if (c == EOF) {
12392 puts("Fail even to read");
12393 exit(1);
12394 }
a7ffa9b9
NC
12395 if (!(
12396 18 <= FILE_cnt(fp) &&
12397 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12398 )) {
12399 puts("Fail even to read");
12400 exit (1);
12401 }
c1d9e6fa
JH
12402 ptr = (char*) FILE_ptr(fp);
12403 cnt = (size_t)FILE_cnt(fp);
a7ffa9b9 12404
c1d9e6fa 12405 FILE_ptr(fp) += 42;
a7ffa9b9 12406
c1d9e6fa 12407 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
a7ffa9b9
NC
12408 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12409 exit (1);
12410 }
12411 if (FILE_cnt(fp) <= 20) {
12412 printf ("Fail (<20 chars to test)");
12413 exit (1);
12414 }
12415 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12416 puts("Fail compare");
12417 exit (1);
12418 }
12419 if (cnt == FILE_cnt(fp)) {
12420 puts("Pass_unchanged");
12421 exit (0);
12422 }
12423 if (FILE_cnt(fp) == (cnt - 42)) {
12424 puts("Pass_changed");
12425 exit (0);
12426 }
12427 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12428 return 1;
12429
12430}
12431EOP
12432 set try
5440bc8e
JH
12433 if eval $compile && $to try.c; then
12434 case `$run ./try` in
a7ffa9b9 12435 Pass_changed)
2e32dcfe 12436 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
a7ffa9b9
NC
12437 d_stdio_ptr_lval_sets_cnt="$define" ;;
12438 Pass_unchanged)
12439 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12440 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12441 Fail*)
12442 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12443 *)
12444 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12445 esac
12446 else
12447 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12448 fi
12449 $rm -f try.c try
12450 ;;
12451esac
12452
b4eb6b3d
JH
12453: see if _base is also standard
12454val="$undef"
12455case "$d_stdstdio" in
12456$define)
12457 $cat >try.c <<EOP
12458#include <stdio.h>
12459#define FILE_base(fp) $stdio_base
12460#define FILE_bufsiz(fp) $stdio_bufsiz
12461int main() {
12462 FILE *fp = fopen("try.c", "r");
12463 char c = getc(fp);
12464 if (
12465 19 <= FILE_bufsiz(fp) &&
12466 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12467 )
12468 exit(0);
12469 exit(1);
12470}
12471EOP
12472 set try
5440bc8e
JH
12473 if eval $compile && $to try.c; then
12474 if $run ./try; then
b4eb6b3d
JH
12475 echo "And its _base field acts std."
12476 val="$define"
12477 else
12478 echo "But its _base field isn't std."
12479 fi
12480 else
12481 echo "However, it seems to be lacking the _base field."
12482 fi
12483 $rm -f try.c try
12484 ;;
12485esac
12486set d_stdiobase
12487eval $setvar
12488
12489$cat >&4 <<EOM
12490Checking how to access stdio streams by file descriptor number...
12491EOM
12492case "$stdio_stream_array" in
12493'') $cat >try.c <<EOCP
12494#include <stdio.h>
12495int main() {
12496 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12497 printf("yes\n");
12498}
12499EOCP
12500 for s in _iob __iob __sF
12501 do
12502 set try -DSTDIO_STREAM_ARRAY=$s
12503 if eval $compile; then
5440bc8e 12504 case "`$run ./try`" in
b4eb6b3d
JH
12505 yes) stdio_stream_array=$s; break ;;
12506 esac
12507 fi
12508 done
12509 $rm -f try.* try$exe_ext
12510esac
12511case "$stdio_stream_array" in
12512'') $cat >&4 <<EOM
12513I can't figure out how to access stdio streams by file descriptor number.
12514EOM
12515 d_stdio_stream_array="$undef"
12516 ;;
12517*) $cat >&4 <<EOM
12518You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12519EOM
12520 d_stdio_stream_array="$define"
12521 ;;
12522esac
12523
12524: see if strcoll exists
12525set strcoll d_strcoll
12526eval $inlibc
12527
12528: check for structure copying
12529echo " "
12530echo "Checking to see if your C compiler can copy structs..." >&4
12531$cat >try.c <<'EOCP'
12532int main()
12533{
12534 struct blurfl {
12535 int dyick;
12536 } foo, bar;
12537
12538 foo = bar;
12539}
12540EOCP
12541if $cc -c try.c >/dev/null 2>&1 ; then
12542 val="$define"
12543 echo "Yup, it can."
12544else
12545 val="$undef"
12546 echo "Nope, it can't."
12547fi
12548set d_strctcpy
12549eval $setvar
12550$rm -f try.*
12551
12552: see if strerror and/or sys_errlist[] exist
12553echo " "
12554if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12555 if set strerror val -f d_strerror; eval $csym; $val; then
12556 echo 'strerror() found.' >&4
12557 d_strerror="$define"
12558 d_strerrm='strerror(e)'
12559 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12560 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
12561 d_syserrlst="$define"
12562 else
12563 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12564 d_syserrlst="$undef"
12565 fi
12566 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12567 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12568 echo 'strerror() found in string header.' >&4
12569 d_strerror="$define"
12570 d_strerrm='strerror(e)'
12571 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12572 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12573 d_syserrlst="$define"
12574 else
12575 echo "(You don't appear to have any sys_errlist[], how can this be?)"
12576 d_syserrlst="$undef"
12577 fi
12578 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12579 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12580 d_strerror="$undef"
12581 d_syserrlst="$define"
12582 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12583 else
12584 echo 'strerror() and sys_errlist[] NOT found.' >&4
12585 d_strerror="$undef"
12586 d_syserrlst="$undef"
12587 d_strerrm='"unknown"'
12588 fi
12589fi
12590
b3c85772
JH
12591: see if strftime exists
12592set strftime d_strftime
12593eval $inlibc
12594
b4eb6b3d
JH
12595: see if strtod exists
12596set strtod d_strtod
12597eval $inlibc
12598
12599: see if strtol exists
12600set strtol d_strtol
12601eval $inlibc
12602
12603: see if strtold exists
12604set strtold d_strtold
12605eval $inlibc
12606
12607: see if strtoll exists
12608set strtoll d_strtoll
12609eval $inlibc
12610
12611case "$d_longlong-$d_strtoll" in
12612"$define-$define")
12613 $cat <<EOM
12614Checking whether your strtoll() works okay...
12615EOM
12616 $cat >try.c <<'EOCP'
12617#include <errno.h>
12618#ifdef __hpux
12619#define strtoll __strtoll
12620#endif
e75931a7
YST
12621#ifdef __EMX__
12622#define strtoll _strtoll
12623#endif
b4eb6b3d
JH
12624#include <stdio.h>
12625extern long long int strtoll(char *s, char **, int);
12626static int bad = 0;
12627int check(char *s, long long ell, int een) {
12628 long long gll;
12629 errno = 0;
12630 gll = strtoll(s, 0, 10);
12631 if (!((gll == ell) && (errno == een)))
12632 bad++;
12633}
12634int main() {
12635 check(" 1", 1LL, 0);
12636 check(" 0", 0LL, 0);
12637 check("-1", -1LL, 0);
12638 check("-9223372036854775808", -9223372036854775808LL, 0);
12639 check("-9223372036854775808", -9223372036854775808LL, 0);
12640 check(" 9223372036854775807", 9223372036854775807LL, 0);
12641 check("-9223372036854775808", -9223372036854775808LL, 0);
12642 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
12643 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12644 if (!bad)
12645 printf("ok\n");
12646}
12647EOCP
12648 set try
12649 if eval $compile; then
5440bc8e 12650 yyy=`$run ./try`
e75931a7 12651 case "$yyy" in
b4eb6b3d
JH
12652 ok) echo "Your strtoll() seems to be working okay." ;;
12653 *) cat <<EOM >&4
12654Your strtoll() doesn't seem to be working okay.
12655EOM
12656 d_strtoll="$undef"
12657 ;;
69eadf66 12658 esac
e75931a7
YST
12659 else
12660 echo "(I can't seem to compile the test program--assuming it doesn't)"
12661 d_strtoll="$undef"
b4eb6b3d
JH
12662 fi
12663 ;;
12664esac
12665
28e5dec8
JH
12666: see if strtoq exists
12667set strtoq d_strtoq
12668eval $inlibc
12669
b4eb6b3d
JH
12670: see if strtoul exists
12671set strtoul d_strtoul
12672eval $inlibc
12673
d0e6d399
NC
12674case "$d_strtoul" in
12675"$define")
12676 $cat <<EOM
12677Checking whether your strtoul() works okay...
12678EOM
12679 $cat >try.c <<'EOCP'
12680#include <errno.h>
12681#include <stdio.h>
12682extern unsigned long int strtoul(char *s, char **, int);
12683static int bad = 0;
12684void check(char *s, unsigned long eul, int een) {
12685 unsigned long gul;
12686 errno = 0;
12687 gul = strtoul(s, 0, 10);
12688 if (!((gul == eul) && (errno == een)))
12689 bad++;
12690}
12691int main() {
12692 check(" 1", 1L, 0);
12693 check(" 0", 0L, 0);
12694EOCP
12695 case "$longsize" in
12696 8)
12697 $cat >>try.c <<'EOCP'
09c0d2c4
JH
12698 check("18446744073709551615", 18446744073709551615UL, 0);
12699 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 12700#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 12701 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
12702 check("-18446744073709551614", 2, 0);
12703 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
12704 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12705 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 12706#endif
d0e6d399
NC
12707EOCP
12708 ;;
12709 4)
12710 $cat >>try.c <<'EOCP'
12711 check("4294967295", 4294967295UL, 0);
12712 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 12713#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
12714 check("-1", 4294967295UL, 0);
12715 check("-4294967294", 2, 0);
12716 check("-4294967295", 1, 0);
12717 check("-4294967296", 4294967295UL, ERANGE);
12718 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 12719#endif
d0e6d399
NC
12720EOCP
12721 ;;
12722 *)
12723: Should we write these tests to be more portable by sprintf-ing
12724: ~0 and then manipulating that char string as input for strtol?
12725 ;;
12726 esac
12727 $cat >>try.c <<'EOCP'
12728 if (!bad)
12729 printf("ok\n");
12730 return 0;
12731}
12732EOCP
12733 set try
12734 if eval $compile; then
5440bc8e 12735 case "`$run ./try`" in
d0e6d399
NC
12736 ok) echo "Your strtoul() seems to be working okay." ;;
12737 *) cat <<EOM >&4
12738Your strtoul() doesn't seem to be working okay.
12739EOM
12740 d_strtoul="$undef"
12741 ;;
12742 esac
12743 fi
12744 ;;
12745esac
12746
b4eb6b3d
JH
12747: see if strtoull exists
12748set strtoull d_strtoull
12749eval $inlibc
12750
12751case "$d_longlong-$d_strtoull" in
12752"$define-$define")
12753 $cat <<EOM
12754Checking whether your strtoull() works okay...
12755EOM
12756 $cat >try.c <<'EOCP'
12757#include <errno.h>
12758#ifdef __hpux
12759#define strtoull __strtoull
12760#endif
12761#include <stdio.h>
12762extern unsigned long long int strtoull(char *s, char **, int);
12763static int bad = 0;
12764int check(char *s, long long eull, int een) {
12765 long long gull;
12766 errno = 0;
12767 gull = strtoull(s, 0, 10);
12768 if (!((gull == eull) && (errno == een)))
12769 bad++;
12770}
12771int main() {
d0e6d399
NC
12772 check(" 1", 1LL, 0);
12773 check(" 0", 0LL, 0);
12774 check("18446744073709551615", 18446744073709551615ULL, 0);
12775 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 12776#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
12777 check("-1", 18446744073709551615ULL, 0);
12778 check("-18446744073709551614", 2LL, 0);
12779 check("-18446744073709551615", 1LL, 0);
12780 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12781 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 12782#endif
b4eb6b3d
JH
12783 if (!bad)
12784 printf("ok\n");
12785}
12786EOCP
12787 set try
12788 if eval $compile; then
5440bc8e 12789 case "`$run ./try`" in
b4eb6b3d
JH
12790 ok) echo "Your strtoull() seems to be working okay." ;;
12791 *) cat <<EOM >&4
12792Your strtoull() doesn't seem to be working okay.
12793EOM
12794 d_strtoull="$undef"
12795 ;;
12796 esac
12797 fi
12798 ;;
12799esac
12800
12801: see if strtouq exists
12802set strtouq d_strtouq
12803eval $inlibc
12804
d0e6d399
NC
12805case "$d_strtouq" in
12806"$define")
12807 $cat <<EOM
12808Checking whether your strtouq() works okay...
12809EOM
12810 $cat >try.c <<'EOCP'
12811#include <errno.h>
12812#include <stdio.h>
12813extern unsigned long long int strtouq(char *s, char **, int);
12814static int bad = 0;
12815void check(char *s, unsigned long long eull, int een) {
12816 unsigned long long gull;
12817 errno = 0;
12818 gull = strtouq(s, 0, 10);
12819 if (!((gull == eull) && (errno == een)))
12820 bad++;
12821}
12822int main() {
12823 check(" 1", 1LL, 0);
12824 check(" 0", 0LL, 0);
12825 check("18446744073709551615", 18446744073709551615ULL, 0);
12826 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 12827#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
12828 check("-1", 18446744073709551615ULL, 0);
12829 check("-18446744073709551614", 2LL, 0);
12830 check("-18446744073709551615", 1LL, 0);
12831 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12832 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 12833#endif
d0e6d399
NC
12834 if (!bad)
12835 printf("ok\n");
12836 return 0;
12837}
12838EOCP
12839 set try
12840 if eval $compile; then
5440bc8e 12841 case "`$run ./try`" in
d0e6d399
NC
12842 ok) echo "Your strtouq() seems to be working okay." ;;
12843 *) cat <<EOM >&4
12844Your strtouq() doesn't seem to be working okay.
12845EOM
12846 d_strtouq="$undef"
12847 ;;
12848 esac
12849 fi
12850 ;;
12851esac
12852
b4eb6b3d
JH
12853: see if strxfrm exists
12854set strxfrm d_strxfrm
12855eval $inlibc
12856
12857: see if symlink exists
12858set symlink d_symlink
12859eval $inlibc
12860
12861: see if syscall exists
12862set syscall d_syscall
12863eval $inlibc
12864
2ef53570
JH
12865: see if prototype for syscall is available
12866echo " "
12867set d_syscallproto syscall $i_unistd unistd.h
12868eval $hasproto
12869
b4eb6b3d
JH
12870: see if sysconf exists
12871set sysconf d_sysconf
12872eval $inlibc
12873
12874: see if system exists
12875set system d_system
12876eval $inlibc
12877
12878: see if tcgetpgrp exists
12879set tcgetpgrp d_tcgetpgrp
12880eval $inlibc
12881
12882: see if tcsetpgrp exists
12883set tcsetpgrp d_tcsetpgrp
12884eval $inlibc
12885
12886: see if prototype for telldir is available
12887echo " "
12888set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12889eval $hasproto
12890
12891: see if this is a sys/times.h system
12892set sys/times.h i_systimes
12893eval $inhdr
12894
12895: see if times exists
12896echo " "
12897if set times val -f d_times; eval $csym; $val; then
12898 echo 'times() found.' >&4
12899 d_times="$define"
12900 inc=''
12901 case "$i_systimes" in
12902 "$define") inc='sys/times.h';;
12903 esac
12904 rp="What is the type returned by times() on this system?"
12905 set clock_t clocktype long stdio.h sys/types.h $inc
12906 eval $typedef_ask
12907else
12908 echo 'times() NOT found, hope that will do.' >&4
12909 d_times="$undef"
12910 clocktype='int'
12911fi
12912
12913: see if truncate exists
12914set truncate d_truncate
12915eval $inlibc
12916
12917: see if tzname[] exists
12918echo " "
12919if set tzname val -a d_tzname; eval $csym; $val; then
12920 val="$define"
12921 echo 'tzname[] found.' >&4
12922else
12923 val="$undef"
12924 echo 'tzname[] NOT found.' >&4
12925fi
12926set d_tzname
12927eval $setvar
12928
4e0554ec
JH
12929case "$osname" in
12930next|rhapsody|darwin) multiarch="$define" ;;
12931esac
12932case "$multiarch" in
12933''|[nN]*) multiarch="$undef" ;;
12934esac
12935
12936: check for ordering of bytes in a long
12937echo " "
5440bc8e 12938case "$usecrosscompile$multiarch" in
4e0554ec
JH
12939*$define*)
12940 $cat <<EOM
12941You seem to be either cross-compiling or doing a multiarchitecture build,
12942skipping the byteorder check.
12943
12944EOM
5440bc8e 12945 byteorder='ffff'
4e0554ec
JH
12946 ;;
12947*)
12948 case "$byteorder" in
12949 '')
12950 $cat <<'EOM'
12951In the following, larger digits indicate more significance. A big-endian
12952machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12953little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12954machines may have weird orders like 3412. A Cray will report 87654321,
12955an Alpha will report 12345678. If the test program works the default is
12956probably right.
12957I'm now running the test program...
12958EOM
12959 $cat >try.c <<'EOCP'
12960#include <stdio.h>
12961int main()
12962{
12963 int i;
12964 union {
12965 unsigned long l;
12966 char c[sizeof(long)];
12967 } u;
12968
12969 if (sizeof(long) > 4)
12970 u.l = (0x08070605L << 32) | 0x04030201L;
12971 else
12972 u.l = 0x04030201L;
12973 for (i = 0; i < sizeof(long); i++)
12974 printf("%c", u.c[i]+'0');
12975 printf("\n");
12976 exit(0);
12977}
12978EOCP
12979 xxx_prompt=y
12980 set try
12981 if eval $compile && ./try > /dev/null; then
5440bc8e 12982 dflt=`$run ./try`
4e0554ec
JH
12983 case "$dflt" in
12984 [1-4][1-4][1-4][1-4]|12345678|87654321)
12985 echo "(The test program ran ok.)"
12986 echo "byteorder=$dflt"
12987 xxx_prompt=n
12988 ;;
12989 ????|????????) echo "(The test program ran ok.)" ;;
12990 *) echo "(The test program didn't run right for some reason.)" ;;
12991 esac
12992 else
12993 dflt='4321'
12994 cat <<'EOM'
12995(I can't seem to compile the test program. Guessing big-endian...)
12996EOM
12997 fi
12998 case "$xxx_prompt" in
12999 y)
13000 rp="What is the order of bytes in a long?"
13001 . ./myread
13002 byteorder="$ans"
13003 ;;
13004 *) byteorder=$dflt
13005 ;;
13006 esac
13007 ;;
13008 esac
13009 $rm -f try.c try
13010 ;;
13011esac
13012
13013
13014$cat <<EOM
13015
13016Checking to see whether you can access character data unalignedly...
13017EOM
13018$cat >try.c <<EOCP
13019#include <stdio.h>
13020#define U32 $u32type
13021#define BYTEORDER $byteorder
13022int main() {
13023#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
13024 U8 buf[] = "\0\0\0\1\0\0\0\0";
13025 U32 *up;
13026 int i;
13027
13028 if (sizeof(U32) != 4) {
13029 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
13030 exit(1);
13031 }
13032
13033 fflush(stdout);
13034
13035 for (i = 0; i < 4; i++) {
13036 up = (U32*)(buf + i);
13037 if (! ((*up == 1 << (8*i)) || /* big-endian */
13038 (*up == 1 << (8*(3-i))) /* little-endian */
13039 )
13040 )
13041 {
13042 printf("read failed (%x)\n", *up);
13043 exit(2);
13044 }
13045 }
13046
13047 /* write test */
13048 for (i = 0; i < 4; i++) {
13049 up = (U32*)(buf + i);
13050 *up = 0xBeef;
13051 if (*up != 0xBeef) {
13052 printf("write failed (%x)\n", *up);
13053 exit(3);
13054 }
13055 }
13056
13057 exit(0);
13058#else
13059 printf("1\n");
13060 exit(1);
13061#endif
13062 return 0;
13063}
13064EOCP
13065set try
13066if eval $compile_ok; then
5440bc8e
JH
13067 echo "(Testing for character data alignment may dump core.)" >&4
13068 $run ./try 2>&1 >/dev/null
4e0554ec
JH
13069 case "$?" in
13070 0) cat >&4 <<EOM
13071You can access character data pretty unalignedly.
13072EOM
13073 d_u32align="$undef"
13074 ;;
13075 *) cat >&4 <<EOM
13076It seems that you must access character data in an aligned manner.
13077EOM
13078 d_u32align="$define"
13079 ;;
13080 esac
13081 $rm -f core core.try.* try.core
13082else
13083 rp='Can you access character data at unaligned addresses?'
13084 dflt='n'
13085 . ./myread
13086 case "$ans" in
13087 [yY]*) d_u32align="$undef" ;;
13088 *) d_u32align="$define" ;;
13089 esac
13090fi
13091
13092: see if ualarm exists
13093set ualarm d_ualarm
13094eval $inlibc
13095
b4eb6b3d
JH
13096: see if umask exists
13097set umask d_umask
13098eval $inlibc
13099
4e0554ec
JH
13100: see if usleep exists
13101set usleep d_usleep
13102eval $inlibc
13103
2ef53570
JH
13104: see if prototype for usleep is available
13105echo " "
13106set d_usleepproto usleep $i_unistd unistd.h
13107eval $hasproto
13108
b4eb6b3d
JH
13109: see if ustat exists
13110set ustat d_ustat
13111eval $inlibc
13112
13113: backward compatibility for d_hvfork
13114if test X$d_hvfork != X; then
13115 d_vfork="$d_hvfork"
13116 d_hvfork=''
13117fi
13118: see if there is a vfork
13119val=''
13120set vfork val
13121eval $inlibc
13122
13123: Ok, but do we want to use it. vfork is reportedly unreliable in
13124: perl on Solaris 2.x, and probably elsewhere.
13125case "$val" in
13126$define)
13127 echo " "
13128 case "$usevfork" in
13129 false) dflt='n';;
13130 *) dflt='y';;
13131 esac
13132 cat <<'EOM'
13133
13134Perl can only use a vfork() that doesn't suffer from strict
13135restrictions on calling functions or modifying global data in
13136the child. For example, glibc-2.1 contains such a vfork()
13137that is unsuitable. If your system provides a proper fork()
13138call, chances are that you do NOT want perl to use vfork().
13139
13140EOM
13141 rp="Do you still want to use vfork()?"
13142 . ./myread
13143 case "$ans" in
13144 y|Y) ;;
13145 *)
13146 echo "Ok, we won't use vfork()."
13147 val="$undef"
13148 ;;
13149 esac
13150 ;;
13151esac
13152set d_vfork
13153eval $setvar
13154case "$d_vfork" in
13155$define) usevfork='true';;
13156*) usevfork='false';;
13157esac
13158
13159: see if this is an sysdir system
13160set sys/dir.h i_sysdir
13161eval $inhdr
13162
13163: see if this is an sysndir system
13164set sys/ndir.h i_sysndir
13165eval $inhdr
13166
13167: see if closedir exists
13168set closedir d_closedir
13169eval $inlibc
13170
13171case "$d_closedir" in
13172"$define")
13173 echo " "
13174 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 13175 cat > try.c <<EOM
b4eb6b3d
JH
13176#$i_dirent I_DIRENT /**/
13177#$i_sysdir I_SYS_DIR /**/
13178#$i_sysndir I_SYS_NDIR /**/
13179#$i_systypes I_SYS_TYPES /**/
13180
13181#if defined(I_SYS_TYPES)
13182#include <sys/types.h>
13183#endif
13184#if defined(I_DIRENT)
13185#include <dirent.h>
13186#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
13187#include <sys/dir.h>
13188#endif
13189#else
13190#ifdef I_SYS_NDIR
13191#include <sys/ndir.h>
13192#else
13193#ifdef I_SYS_DIR
13194#ifdef hp9000s500
13195#include <ndir.h> /* may be wrong in the future */
13196#else
13197#include <sys/dir.h>
13198#endif
13199#endif
13200#endif
13201#endif
13202int main() { return closedir(opendir(".")); }
13203EOM
5440bc8e 13204 set try
b4eb6b3d 13205 if eval $compile_ok; then
5440bc8e 13206 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
13207 echo "Yes, it does."
13208 val="$undef"
13209 else
13210 echo "No, it doesn't."
13211 val="$define"
13212 fi
13213 else
13214 echo "(I can't seem to compile the test program--assuming it doesn't)"
13215 val="$define"
13216 fi
13217 ;;
13218*)
13219 val="$undef";
13220 ;;
13221esac
13222set d_void_closedir
13223eval $setvar
5440bc8e 13224$rm -f try try.*
b4eb6b3d
JH
13225: see if there is a wait4
13226set wait4 d_wait4
13227eval $inlibc
13228
13229: see if waitpid exists
13230set waitpid d_waitpid
13231eval $inlibc
13232
13233: see if wcstombs exists
13234set wcstombs d_wcstombs
13235eval $inlibc
13236
13237: see if wctomb exists
13238set wctomb d_wctomb
13239eval $inlibc
13240
4e0554ec
JH
13241: see if writev exists
13242set writev d_writev
13243eval $inlibc
13244
b4eb6b3d
JH
13245: preserve RCS keywords in files with variable substitution, grrr
13246Date='$Date'
13247Id='$Id'
13248Log='$Log'
13249RCSfile='$RCSfile'
13250Revision='$Revision'
13251
b4eb6b3d
JH
13252: check for alignment requirements
13253echo " "
5440bc8e 13254case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
13255*$define*)
13256 $cat <<EOM
13257You seem to be either cross-compiling or doing a multiarchitecture build,
13258skipping the memory alignment check.
13259
13260EOM
13261 case "$alignbytes" in
13262 '') alignbytes=8 ;;
13263 esac
13264 ;;
13265*)
13266 case "$alignbytes" in
13267 '') echo "Checking alignment constraints..." >&4
13268 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
13269 $cat >try.c <<'EOCP'
13270typedef long double NV;
13271EOCP
13272 else
13273 $cat >try.c <<'EOCP'
13274typedef double NV;
13275EOCP
13276 fi
13277 $cat >>try.c <<'EOCP'
13278#include <stdio.h>
13279struct foobar {
13280 char foo;
13281 NV bar;
13282} try_algn;
13283int main()
13284{
13285 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
13286 return(0);
13287}
13288EOCP
13289 set try
13290 if eval $compile_ok; then
5440bc8e 13291 dflt=`$run ./try`
b4eb6b3d
JH
13292 else
13293 dflt='8'
13294 echo "(I can't seem to compile the test program...)"
13295 fi
13296 ;;
13297 *) dflt="$alignbytes"
13298 ;;
13299 esac
13300 rp="Doubles must be aligned on a how-many-byte boundary?"
13301 . ./myread
13302 alignbytes="$ans"
13303 $rm -f try.c try
13304 ;;
13305esac
13306
13307
13308: set the base revision
13309baserev=5.0
13310
b4eb6b3d
JH
13311: how do we catenate cpp tokens here?
13312echo " "
13313echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
13314$cat >cpp_stuff.c <<'EOCP'
13315#define RCAT(a,b)a/**/b
13316#define ACAT(a,b)a ## b
13317RCAT(Rei,ser)
13318ACAT(Cir,cus)
13319EOCP
13320$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
13321if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
13322 echo "Oh! Smells like ANSI's been here." >&4
13323 echo "We can catify or stringify, separately or together!"
13324 cpp_stuff=42
13325elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
13326 echo "Ah, yes! The good old days!" >&4
13327 echo "However, in the good old days we don't know how to stringify and"
13328 echo "catify at the same time."
13329 cpp_stuff=1
13330else
13331 $cat >&4 <<EOM
13332Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
13333to have to edit the values of CAT[2-5] in config.h...
13334EOM
13335 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
13336fi
13337$rm -f cpp_stuff.*
13338
13339: see if this is a db.h system
13340set db.h i_db
13341eval $inhdr
13342
13343case "$i_db" in
13344$define)
13345 : Check db version.
13346 echo " "
13347 echo "Checking Berkeley DB version ..." >&4
13348 $cat >try.c <<EOCP
13349#$d_const HASCONST
13350#ifndef HASCONST
13351#define const
13352#endif
13353#include <sys/types.h>
13354#include <stdio.h>
13355#include <db.h>
640374d0 13356int main(int argc, char *argv[])
b4eb6b3d
JH
13357{
13358#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
13359 int Major, Minor, Patch ;
13360 unsigned long Version ;
13361 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
13362 if (argc == 2) {
13363 printf("%d %d %d %d %d %d\n",
13364 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
13365 Major, Minor, Patch);
13366 exit(0);
13367 }
13368 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
13369
13370 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13371 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13372 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13373 Major, Minor, Patch) ;
13374
13375 /* check that db.h & libdb are compatible */
13376 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 13377 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
13378 exit(3);
13379 }
13380
640374d0 13381 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
13382
13383 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13384 + DB_VERSION_PATCH ;
13385
13386 /* needs to be >= 2.3.4 */
13387 if (Version < 2003004) {
13388 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 13389 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
13390 exit(2);
13391 }
13392
13393 exit(0);
13394#else
13395#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
13396 if (argc == 2) {
13397 printf("1 0 0\n");
13398 exit(0);
13399 }
13400 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
13401 exit(0); /* DB version < 2: the coast is clear. */
13402#else
13403 exit(1); /* <db.h> not Berkeley DB? */
13404#endif
13405#endif
13406}
13407EOCP
13408 set try
5440bc8e 13409 if eval $compile_ok && $run ./try; then
b4eb6b3d 13410 echo 'Looks OK.' >&4
5440bc8e 13411 set `$run ./try 1`
640374d0
JH
13412 db_version_major=$1
13413 db_version_minor=$2
13414 db_version_patch=$3
b4eb6b3d
JH
13415 else
13416 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
13417 i_db=$undef
13418 case " $libs " in
13419 *"-ldb "*)
13420 : Remove db from list of libraries to use
13421 echo "Removing unusable -ldb from library list" >&4
13422 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13423 shift
13424 libs="$*"
13425 echo "libs = $libs" >&4
13426 ;;
13427 esac
13428 fi
13429 $rm -f try.*
13430 ;;
13431esac
13432
13433case "$i_db" in
13434define)
13435 : Check the return type needed for hash
13436 echo " "
13437 echo "Checking return type needed for hash for Berkeley DB ..." >&4
13438 $cat >try.c <<EOCP
13439#$d_const HASCONST
13440#ifndef HASCONST
13441#define const
13442#endif
13443#include <sys/types.h>
13444#include <db.h>
13445
13446#ifndef DB_VERSION_MAJOR
13447u_int32_t hash_cb (ptr, size)
13448const void *ptr;
13449size_t size;
13450{
13451}
13452HASHINFO info;
13453int main()
13454{
13455 info.hash = hash_cb;
13456}
13457#endif
13458EOCP
13459 if $cc $ccflags -c try.c >try.out 2>&1 ; then
13460 if $contains warning try.out >>/dev/null 2>&1 ; then
13461 db_hashtype='int'
13462 else
13463 db_hashtype='u_int32_t'
13464 fi
13465 else
13466 : XXX Maybe we should just give up here.
13467 db_hashtype=u_int32_t
13468 $cat try.out >&4
13469 echo "Help: I can't seem to compile the db test program." >&4
13470 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13471 fi
13472 $rm -f try.*
13473 echo "Your version of Berkeley DB uses $db_hashtype for hash."
13474 ;;
13475*) db_hashtype=u_int32_t
13476 ;;
13477esac
13478case "$i_db" in
13479define)
13480 : Check the return type needed for prefix
13481 echo " "
13482 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13483 cat >try.c <<EOCP
13484#$d_const HASCONST
13485#ifndef HASCONST
13486#define const
13487#endif
13488#include <sys/types.h>
13489#include <db.h>
13490
13491#ifndef DB_VERSION_MAJOR
13492size_t prefix_cb (key1, key2)
13493const DBT *key1;
13494const DBT *key2;
13495{
13496}
13497BTREEINFO info;
13498int main()
13499{
13500 info.prefix = prefix_cb;
13501}
13502#endif
13503EOCP
13504 if $cc $ccflags -c try.c >try.out 2>&1 ; then
13505 if $contains warning try.out >>/dev/null 2>&1 ; then
13506 db_prefixtype='int'
13507 else
13508 db_prefixtype='size_t'
13509 fi
13510 else
13511 db_prefixtype='size_t'
13512 : XXX Maybe we should just give up here.
13513 $cat try.out >&4
13514 echo "Help: I can't seem to compile the db test program." >&4
13515 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13516 fi
13517 $rm -f try.*
13518 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13519 ;;
13520*) db_prefixtype='size_t'
13521 ;;
13522esac
13523
b4eb6b3d
JH
13524
13525: How can we generate normalized random numbers ?
13526echo " "
13527echo "Looking for a random number function..." >&4
13528case "$randfunc" in
13529'')
13530 if set drand48 val -f; eval $csym; $val; then
13531 dflt="drand48"
13532 echo "Good, found drand48()." >&4
13533 elif set random val -f; eval $csym; $val; then
13534 dflt="random"
13535 echo "OK, found random()." >&4
13536 else
13537 dflt="rand"
13538 echo "Yick, looks like I have to use rand()." >&4
13539 fi
13540 echo " "
13541 ;;
13542*)
13543 dflt="$randfunc"
13544 ;;
13545esac
13546cont=true
13547
13548case "$ccflags" in
13549*-Dmy_rand=*|*-Dmy_srand=*)
13550 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13551 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13552 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13553 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13554 ;;
13555esac
13556
13557while $test "$cont"; do
13558 rp="Use which function to generate random numbers?"
13559 . ./myread
13560 if $test "$ans" = "$dflt"; then
13561 : null
13562 else
13563 randbits=''
13564 fi
13565 randfunc="$ans"
13566 if set $ans val -f; eval $csym; $val; then
13567 cont=''
13568 else
13569 dflt=y
13570 rp="I cannot find function $ans. Use that name anyway?"
13571 . ./myread
13572 dflt=rand
13573 case "$ans" in
13574 [yY]*) cont='';;
13575 esac
13576 fi
13577 case "$cont" in
13578 '')
13579 case "$randfunc" in
13580 drand48)
13581 drand01="drand48()"
13582 seedfunc="srand48"
13583 randbits=48
13584 randseedtype=long
13585 ;;
13586 rand|random)
13587 case "$randbits" in
13588 '')
13589echo "Checking to see how many bits your $randfunc() function produces..." >&4
13590 $cat >try.c <<EOCP
13591#$i_unistd I_UNISTD
13592#$i_stdlib I_STDLIB
13593#include <stdio.h>
13594#ifdef I_UNISTD
13595# include <unistd.h>
13596#endif
13597#ifdef I_STDLIB
13598# include <stdlib.h>
13599#endif
13600int main()
13601{
13602 register int i;
13603 register unsigned long tmp;
13604 register unsigned long max = 0L;
13605
13606 for (i = 1000; i; i--) {
13607 tmp = (unsigned long) $randfunc();
13608 if (tmp > max) max = tmp;
13609 }
13610 for (i = 0; max; i++)
13611 max /= 2;
13612 printf("%d\n",i);
13613}
13614EOCP
13615 set try
13616 if eval $compile_ok; then
13617 dflt=`try`
13618 else
13619 dflt='?'
13620 echo "(I can't seem to compile the test program...)"
13621 fi
13622 ;;
13623 *)
13624 dflt="$randbits"
13625 ;;
13626 esac
13627 rp="How many bits does your $randfunc() function produce?"
13628 . ./myread
13629 randbits="$ans"
13630 $rm -f try.c try
13631 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13632 seedfunc="s$randfunc"
13633 randseedtype=unsigned
13634 ;;
13635 *)
13636 dflt="31"
13637 rp="How many bits does your $randfunc() function produce?"
13638 . ./myread
13639 randbits="$ans"
13640 seedfunc="s$randfunc"
13641 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13642 if set $seedfunc val -f; eval $csym; $val; then
13643 echo "(Using $seedfunc() to seed random generator)"
13644 else
13645 echo "(Warning: no $seedfunc() to seed random generator)"
13646 seedfunc=rand
13647 fi
13648 randseedtype=unsigned
13649 ;;
13650 esac
13651 ;;
13652 esac
13653done
13654
13655echo " "
13656echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 13657$cat >try.c <<'EOM'
b4eb6b3d
JH
13658int main()
13659{
13660 if ('M'==0xd4) return 0;
13661 return 1;
13662}
13663EOM
13664
13665val=$undef
5440bc8e 13666set try
b4eb6b3d 13667if eval $compile_ok; then
5440bc8e 13668 if $run ./try; then
b4eb6b3d
JH
13669 echo "You seem to speak EBCDIC." >&4
13670 val="$define"
13671 else
5440bc8e 13672 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
13673 fi
13674else
13675 echo "I'm unable to compile the test program." >&4
13676 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13677fi
5440bc8e 13678$rm -f try try.*
b4eb6b3d
JH
13679set ebcdic
13680eval $setvar
13681
13682echo " "
13683$cat >&4 <<EOM
13684Checking how to flush all pending stdio output...
13685EOM
13686# I only know how to find the first 32 possibly open files on SunOS.
13687# See also hints/sunos_4_1.sh and util.c --AD
13688case "$osname" in
13689sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13690esac
13691$cat >>try.c <<EOCP
13692#include <stdio.h>
13693#$i_unistd I_UNISTD
13694#ifdef I_UNISTD
13695# include <unistd.h>
13696#endif
13697#$d_sysconf HAS_SYSCONF
13698#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13699#ifdef HAS_STDIO_STREAM_ARRAY
13700# define STDIO_STREAM_ARRAY $stdio_stream_array
13701#endif
13702int main() {
5440bc8e
JH
13703 FILE* p;
13704 unlink("try.out");
13705 p = fopen("try.out", "w");
b4eb6b3d
JH
13706#ifdef TRY_FPUTC
13707 fputc('x', p);
13708#else
13709# ifdef TRY_FPRINTF
13710 fprintf(p, "x");
13711# endif
13712#endif
13713#ifdef TRY_FFLUSH_NULL
13714 fflush(NULL);
13715#endif
13716#ifdef TRY_FFLUSH_ALL
13717 {
13718 long open_max = -1;
13719# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13720 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13721# else
13722# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13723 open_max = sysconf(_SC_OPEN_MAX);
13724# else
13725# ifdef FOPEN_MAX
13726 open_max = FOPEN_MAX;
13727# else
13728# ifdef OPEN_MAX
13729 open_max = OPEN_MAX;
13730# else
13731# ifdef _NFILE
13732 open_max = _NFILE;
13733# endif
13734# endif
13735# endif
13736# endif
13737# endif
13738# ifdef HAS_STDIO_STREAM_ARRAY
13739 if (open_max > 0) {
13740 long i;
13741 for (i = 0; i < open_max; i++)
13742 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13743 STDIO_STREAM_ARRAY[i]._file < open_max &&
13744 STDIO_STREAM_ARRAY[i]._flag)
13745 fflush(&STDIO_STREAM_ARRAY[i]);
13746 }
13747 }
13748# endif
13749#endif
13750 _exit(42);
13751}
13752EOCP
13753: first we have to find out how _not_ to flush
5440bc8e 13754$to try.c
b4eb6b3d
JH
13755if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13756 output=''
13757 set try -DTRY_FPUTC
13758 if eval $compile; then
5440bc8e 13759 $run ./try 2>/dev/null
b4eb6b3d 13760 $rm -f try.out
5440bc8e 13761 $from try.out
b4eb6b3d
JH
13762 if $test ! -s try.out -a "X$?" = X42; then
13763 output=-DTRY_FPUTC
13764 fi
13765 fi
13766 case "$output" in
13767 '')
13768 set try -DTRY_FPRINTF
b4eb6b3d 13769 if eval $compile; then
5440bc8e 13770 $run ./try 2>/dev/null
b4eb6b3d 13771 $rm -f try.out
5440bc8e 13772 $from try.out
b4eb6b3d
JH
13773 if $test ! -s try.out -a "X$?" = X42; then
13774 output=-DTRY_FPRINTF
13775 fi
13776 fi
13777 ;;
13778 esac
13779fi
13780: check for fflush NULL behaviour
13781case "$fflushNULL" in
13782'') set try -DTRY_FFLUSH_NULL $output
13783 if eval $compile; then
5440bc8e 13784 $run ./try 2>/dev/null
b4eb6b3d 13785 code="$?"
5440bc8e
JH
13786 $rm -f try.out
13787 $from try.out
b4eb6b3d
JH
13788 if $test -s try.out -a "X$code" = X42; then
13789 fflushNULL="`$cat try.out`"
13790 else
13791 if $test "X$code" != X42; then
13792 $cat >&4 <<EOM
13793(If this test failed, don't worry, we'll try another method shortly.)
13794EOM
13795 fi
13796 fi
13797 fi
13798 $rm -f core try.core core.try.*
13799 case "$fflushNULL" in
13800 x) $cat >&4 <<EOM
13801Your fflush(NULL) works okay for output streams.
13802Let's see if it clobbers input pipes...
13803EOM
13804# As of mid-March 2000 all versions of Solaris appear to have a stdio
13805# bug that improperly flushes the input end of pipes. So we avoid the
13806# autoflush on fork/system/exec support for now. :-(
13807$cat >tryp.c <<EOCP
13808#include <stdio.h>
13809int
13810main(int argc, char **argv)
13811{
13812 char buf[1024];
13813 int i;
13814 char *bp = buf;
13815 while (1) {
13816 while ((i = getc(stdin)) != -1
13817 && (*bp++ = i) != '\n'
13818 && bp < &buf[1024])
13819 /* DO NOTHING */ ;
13820 *bp = '\0';
13821 fprintf(stdout, "%s", buf);
13822 fflush(NULL);
13823 if (i == -1)
13824 return 0;
13825 bp = buf;
13826 }
13827}
13828EOCP
13829 fflushNULL="$define"
13830 set tryp
13831 if eval $compile; then
13832 $rm -f tryp.out
5440bc8e 13833 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
13834 if cmp tryp.c tryp.out >/dev/null 2>&1; then
13835 $cat >&4 <<EOM
13836fflush(NULL) seems to behave okay with input streams.
13837EOM
13838 fflushNULL="$define"
13839 else
13840 $cat >&4 <<EOM
13841Ouch, fflush(NULL) clobbers input pipes! We will not use it.
13842EOM
13843 fflushNULL="$undef"
13844 fi
13845 fi
13846 $rm -f core tryp.c tryp.core core.tryp.*
13847 ;;
13848 '') $cat >&4 <<EOM
13849Your fflush(NULL) isn't working (contrary to ANSI C).
13850EOM
13851 fflushNULL="$undef"
13852 ;;
13853 *) $cat >&4 <<EOM
13854Cannot figure out whether your fflush(NULL) works or not.
13855I'm assuming it doesn't (contrary to ANSI C).
13856EOM
13857 fflushNULL="$undef"
13858 ;;
13859 esac
13860 ;;
13861$define|true|[yY]*)
13862 fflushNULL="$define"
13863 ;;
13864*)
13865 fflushNULL="$undef"
13866 ;;
13867esac
13868: check explicit looping only if NULL did not work, and if the pipe
13869: bug does not show up on an explicit flush too
13870case "$fflushNULL" in
13871"$undef")
13872 $cat >tryp.c <<EOCP
13873#include <stdio.h>
13874int
13875main(int argc, char **argv)
13876{
13877 char buf[1024];
13878 int i;
13879 char *bp = buf;
13880 while (1) {
13881 while ((i = getc(stdin)) != -1
13882 && (*bp++ = i) != '\n'
13883 && bp < &buf[1024])
13884 /* DO NOTHING */ ;
13885 *bp = '\0';
13886 fprintf(stdout, "%s", buf);
13887 fflush(stdin);
13888 if (i == -1)
13889 return 0;
13890 bp = buf;
13891 }
13892}
13893EOCP
13894 set tryp
13895 if eval $compile; then
13896 $rm -f tryp.out
5440bc8e 13897 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
13898 if cmp tryp.c tryp.out >/dev/null 2>&1; then
13899 $cat >&4 <<EOM
13900Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13901EOM
13902 : now check for fflushall behaviour
13903 case "$fflushall" in
13904 '') set try -DTRY_FFLUSH_ALL $output
13905 if eval $compile; then
13906 $cat >&4 <<EOM
13907(Now testing the other method--but note that this also may fail.)
13908EOM
13909 $rm -f try.out
5440bc8e 13910 $run ./try 2>/dev/null
b4eb6b3d
JH
13911 if $test -s try.out -a "X$?" = X42; then
13912 fflushall="`$cat try.out`"
13913 fi
13914 fi
13915 $rm -f core try.core core.try.*
13916 case "$fflushall" in
13917 x) $cat >&4 <<EOM
13918Whew. Flushing explicitly all the stdio streams works.
13919EOM
13920 fflushall="$define"
13921 ;;
13922 '') $cat >&4 <<EOM
13923Sigh. Flushing explicitly all the stdio streams doesn't work.
13924EOM
13925 fflushall="$undef"
13926 ;;
13927 *) $cat >&4 <<EOM
13928Cannot figure out whether flushing stdio streams explicitly works or not.
13929I'm assuming it doesn't.
13930EOM
13931 fflushall="$undef"
13932 ;;
13933 esac
13934 ;;
13935 "$define"|true|[yY]*)
13936 fflushall="$define"
13937 ;;
13938 *)
13939 fflushall="$undef"
13940 ;;
13941 esac
13942 else
13943 $cat >&4 <<EOM
13944All is futile. Even fflush(stdin) clobbers input pipes!
13945EOM
13946 fflushall="$undef"
13947 fi
13948 else
13949 fflushall="$undef"
13950 fi
13951 $rm -f core tryp.c tryp.core core.tryp.*
13952 ;;
13953*) fflushall="$undef"
13954 ;;
13955esac
13956
13957case "$fflushNULL$fflushall" in
13958undefundef)
13959 $cat <<EOM
13960OK, I give up. I cannot figure out how to flush pending stdio output.
13961We won't be flushing handles at all before fork/exec/popen.
13962EOM
13963 ;;
13964esac
13965$rm -f try.* try$exe_ext
13966
13967: Store the full pathname to the ar program for use in the C program
13968: Respect a hint or command line value for full_ar.
13969case "$full_ar" in
13970'') full_ar=$ar ;;
13971esac
13972
13973: Store the full pathname to the sed program for use in the C program
13974full_sed=$sed
13975
13976: see what type gids are declared as in the kernel
13977echo " "
13978echo "Looking for the type for group ids returned by getgid()."
13979set gid_t gidtype xxx stdio.h sys/types.h
13980eval $typedef
13981case "$gidtype" in
13982xxx)
13983 xxx=`./findhdr sys/user.h`
13984 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13985 case $1 in
13986 unsigned) dflt="$1 $2" ;;
13987 *) dflt="$1" ;;
13988 esac
13989 ;;
13990*) dflt="$gidtype";;
13991esac
13992case "$gidtype" in
13993gid_t) echo "gid_t found." ;;
13994*) rp="What is the type for group ids returned by getgid()?"
13995 . ./myread
13996 gidtype="$ans"
13997 ;;
13998esac
13999
14000echo " "
14001case "$gidtype" in
14002*_t) zzz="$gidtype" ;;
14003*) zzz="gid" ;;
14004esac
14005echo "Checking the size of $zzz..." >&4
14006cat > try.c <<EOCP
14007#include <sys/types.h>
14008#include <stdio.h>
14009int main() {
14010 printf("%d\n", (int)sizeof($gidtype));
14011 exit(0);
14012}
14013EOCP
14014set try
14015if eval $compile_ok; then
5440bc8e 14016 yyy=`$run ./try`
b4eb6b3d
JH
14017 case "$yyy" in
14018 '') gidsize=4
14019 echo "(I can't execute the test program--guessing $gidsize.)" >&4
14020 ;;
14021 *) gidsize=$yyy
14022 echo "Your $zzz is $gidsize bytes long."
14023 ;;
14024 esac
14025else
14026 gidsize=4
14027 echo "(I can't compile the test program--guessing $gidsize.)" >&4
14028fi
14029
14030
14031echo " "
14032case "$gidtype" in
14033*_t) zzz="$gidtype" ;;
14034*) zzz="gid" ;;
14035esac
14036echo "Checking the sign of $zzz..." >&4
14037cat > try.c <<EOCP
14038#include <sys/types.h>
14039#include <stdio.h>
14040int main() {
14041 $gidtype foo = -1;
14042 if (foo < 0)
14043 printf("-1\n");
14044 else
14045 printf("1\n");
14046}
14047EOCP
14048set try
14049if eval $compile; then
5440bc8e 14050 yyy=`$run ./try`
b4eb6b3d
JH
14051 case "$yyy" in
14052 '') gidsign=1
14053 echo "(I can't execute the test program--guessing unsigned.)" >&4
14054 ;;
14055 *) gidsign=$yyy
14056 case "$gidsign" in
14057 1) echo "Your $zzz is unsigned." ;;
14058 -1) echo "Your $zzz is signed." ;;
14059 esac
14060 ;;
14061 esac
14062else
14063 gidsign=1
14064 echo "(I can't compile the test program--guessing unsigned.)" >&4
14065fi
14066
14067
14068echo " "
14069
14070if $test X"$quadtype" != X; then
14071
14072echo "Checking how to print 64-bit integers..." >&4
14073
14074if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
14075 $cat >try.c <<'EOCP'
14076#include <sys/types.h>
14077#include <stdio.h>
14078int main() {
14079 int q = 12345678901;
14080 printf("%ld\n", q);
14081}
14082EOCP
14083 set try
14084 if eval $compile; then
5440bc8e 14085 yyy=`$run ./try`
b4eb6b3d
JH
14086 case "$yyy" in
14087 12345678901)
14088 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
14089 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
14090 echo "We will use %d."
14091 ;;
14092 esac
14093 fi
14094fi
14095
14096if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
14097 $cat >try.c <<'EOCP'
14098#include <sys/types.h>
14099#include <stdio.h>
14100int main() {
14101 long q = 12345678901;
14102 printf("%ld\n", q);
14103}
14104EOCP
14105 set try
14106 if eval $compile; then
5440bc8e 14107 yyy=`$run ./try`
b4eb6b3d
JH
14108 case "$yyy" in
14109 12345678901)
14110 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
14111 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
14112 echo "We will use %ld."
14113 ;;
14114 esac
14115 fi
14116fi
14117
14118if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
14119 $cat >try.c <<'EOCP'
14120#include <sys/types.h>
14121#include <inttypes.h>
14122#include <stdio.h>
14123int main() {
14124 int64_t q = 12345678901;
14125 printf("%" PRId64 "\n", q);
14126}
14127EOCP
14128 set try
14129 if eval $compile; then
5440bc8e 14130 yyy=`$run ./try`
b4eb6b3d
JH
14131 case "$yyy" in
14132 12345678901)
14133 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
14134 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
14135 echo "We will use the C9X style."
14136 ;;
14137 esac
14138 fi
14139fi
14140
2ef53570
JH
14141if $test X"$sPRId64" = X -a X"$quadtype" != X; then
14142 $cat >try.c <<EOCP
b4eb6b3d
JH
14143#include <sys/types.h>
14144#include <stdio.h>
14145int main() {
2ef53570
JH
14146 $quadtype q = 12345678901;
14147 printf("%Ld\n", q);
b4eb6b3d
JH
14148}
14149EOCP
14150 set try
14151 if eval $compile; then
5440bc8e 14152 yyy=`$run ./try`
b4eb6b3d
JH
14153 case "$yyy" in
14154 12345678901)
2ef53570
JH
14155 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
14156 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
14157 echo "We will use %Ld."
b4eb6b3d
JH
14158 ;;
14159 esac
14160 fi
14161fi
14162
2ef53570
JH
14163if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
14164 $cat >try.c <<'EOCP'
b4eb6b3d
JH
14165#include <sys/types.h>
14166#include <stdio.h>
14167int main() {
2ef53570
JH
14168 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
14169 printf("%lld\n", q);
b4eb6b3d
JH
14170}
14171EOCP
14172 set try
14173 if eval $compile; then
5440bc8e 14174 yyy=`$run ./try`
b4eb6b3d
JH
14175 case "$yyy" in
14176 12345678901)
2ef53570
JH
14177 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
14178 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
14179 echo "We will use the %lld style."
b4eb6b3d
JH
14180 ;;
14181 esac
14182 fi
14183fi
14184
14185if $test X"$sPRId64" = X -a X"$quadtype" != X; then
14186 $cat >try.c <<EOCP
14187#include <sys/types.h>
14188#include <stdio.h>
14189int main() {
14190 $quadtype q = 12345678901;
14191 printf("%qd\n", q);
14192}
14193EOCP
14194 set try
14195 if eval $compile; then
5440bc8e 14196 yyy=`$run ./try`
b4eb6b3d
JH
14197 case "$yyy" in
14198 12345678901)
14199 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
14200 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
14201 echo "We will use %qd."
14202 ;;
14203 esac
14204 fi
14205fi
14206
14207if $test X"$sPRId64" = X; then
14208 echo "Cannot figure out how to print 64-bit integers." >&4
14209fi
14210
14211$rm -f try try.*
14212
14213fi
14214
14215case "$sPRId64" in
14216'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
14217 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
14218 ;;
14219*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
14220 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
14221 ;;
14222esac
14223
14224
14225echo " "
14226$echo "Checking the format strings to be used for Perl's internal types..." >&4
14227
14228if $test X"$ivsize" = X8; then
14229 ivdformat="$sPRId64"
14230 uvuformat="$sPRIu64"
14231 uvoformat="$sPRIo64"
14232 uvxformat="$sPRIx64"
14233 uvXUformat="$sPRIXU64"
14234else
14235 if $test X"$ivsize" = X"$longsize"; then
14236 ivdformat='"ld"'
14237 uvuformat='"lu"'
14238 uvoformat='"lo"'
14239 uvxformat='"lx"'
14240 uvXUformat='"lX"'
14241 else
14242 if $test X"$ivsize" = X"$intsize"; then
14243 ivdformat='"d"'
14244 uvuformat='"u"'
14245 uvoformat='"o"'
14246 uvxformat='"x"'
14247 uvXUformat='"X"'
14248 else
14249 : far out
14250 if $test X"$ivsize" = X"$shortsize"; then
14251 ivdformat='"hd"'
14252 uvuformat='"hu"'
14253 uvoformat='"ho"'
14254 uvxformat='"hx"'
14255 uvXUformat='"hX"'
14256 fi
14257 fi
14258 fi
14259fi
14260
14261if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
14262 nveformat="$sPRIeldbl"
14263 nvfformat="$sPRIfldbl"
14264 nvgformat="$sPRIgldbl"
14265 nvEUformat="$sPRIEUldbl"
14266 nvFUformat="$sPRIFUldbl"
14267 nvGUformat="$sPRIGUldbl"
14268else
14269 nveformat='"e"'
14270 nvfformat='"f"'
14271 nvgformat='"g"'
14272 nvEUformat='"E"'
14273 nvFUformat='"F"'
14274 nvGUformat='"G"'
14275fi
14276
14277case "$ivdformat" in
14278'') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
14279 exit 1
14280 ;;
14281esac
14282
14283
14284echo " "
14285$echo "Checking the format string to be used for gids..." >&4
14286
14287case "$gidsign" in
14288-1) if $test X"$gidsize" = X"$ivsize"; then
14289 gidformat="$ivdformat"
14290 else
14291 if $test X"$gidsize" = X"$longsize"; then
14292 gidformat='"ld"'
14293 else
14294 if $test X"$gidsize" = X"$intsize"; then
14295 gidformat='"d"'
14296 else
14297 if $test X"$gidsize" = X"$shortsize"; then
14298 gidformat='"hd"'
14299 fi
14300 fi
14301 fi
14302 fi
14303 ;;
14304*) if $test X"$gidsize" = X"$uvsize"; then
14305 gidformat="$uvuformat"
14306 else
14307 if $test X"$gidsize" = X"$longsize"; then
14308 gidformat='"lu"'
14309 else
14310 if $test X"$gidsize" = X"$intsize"; then
14311 gidformat='"u"'
14312 else
14313 if $test X"$gidsize" = X"$shortsize"; then
14314 gidformat='"hu"'
14315 fi
14316 fi
14317 fi
14318 fi
14319 ;;
14320esac
14321
14322: see if getgroups exists
14323set getgroups d_getgrps
14324eval $inlibc
14325
14326: see if setgroups exists
14327set setgroups d_setgrps
14328eval $inlibc
14329
14330
14331: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
14332echo " "
14333case "$d_getgrps$d_setgrps" in
14334*define*)
14335 case "$groupstype" in
14336 '') dflt="$gidtype" ;;
14337 *) dflt="$groupstype" ;;
14338 esac
14339 $cat <<EOM
14340What type of pointer is the second argument to getgroups() and setgroups()?
14341Usually this is the same as group ids, $gidtype, but not always.
14342
14343EOM
14344 rp='What type pointer is the second argument to getgroups() and setgroups()?'
14345 . ./myread
14346 groupstype="$ans"
14347 ;;
14348*) groupstype="$gidtype";;
14349esac
14350
14351echo " "
14352echo "Checking if your $make program sets \$(MAKE)..." >&4
14353case "$make_set_make" in
14354'')
14355 $sed 's/^X //' > testmake.mak << 'EOF'
14356Xall:
14357X @echo 'maketemp="$(MAKE)"'
14358EOF
14359 case "`$make -f testmake.mak 2>/dev/null`" in
14360 *maketemp=*) make_set_make='#' ;;
14361 *) make_set_make="MAKE=$make" ;;
14362 esac
14363 $rm -f testmake.mak
14364 ;;
14365esac
14366case "$make_set_make" in
14367'#') echo "Yup, it does.";;
14368*) echo "Nope, it doesn't.";;
14369esac
14370
14371: see what type is used for mode_t
14372rp="What is the type used for file modes for system calls (e.g. fchmod())?"
14373set mode_t modetype int stdio.h sys/types.h
14374eval $typedef_ask
14375
2cc61e15
DD
14376: see if stdarg is available
14377echo " "
14378if $test `./findhdr stdarg.h`; then
14379 echo "<stdarg.h> found." >&4
14380 valstd="$define"
14381else
14382 echo "<stdarg.h> NOT found." >&4
14383 valstd="$undef"
14384fi
14385
14386: see if varags is available
14387echo " "
14388if $test `./findhdr varargs.h`; then
14389 echo "<varargs.h> found." >&4
14390else
14391 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14392fi
14393
14394: set up the varargs testing programs
14395$cat > varargs.c <<EOP
14396#ifdef I_STDARG
14397#include <stdarg.h>
14398#endif
14399#ifdef I_VARARGS
14400#include <varargs.h>
14401#endif
14402
14403#ifdef I_STDARG
14404int f(char *p, ...)
14405#else
14406int f(va_alist)
14407va_dcl
14408#endif
14409{
14410 va_list ap;
14411#ifndef I_STDARG
14412 char *p;
14413#endif
14414#ifdef I_STDARG
14415 va_start(ap,p);
14416#else
14417 va_start(ap);
14418 p = va_arg(ap, char *);
14419#endif
14420 va_end(ap);
14421}
14422EOP
14423$cat > varargs <<EOP
14424$startsh
14425if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14426 echo "true"
14427else
14428 echo "false"
14429fi
14430$rm -f varargs$_o
14431EOP
14432chmod +x varargs
14433
14434: now check which varargs header should be included
14435echo " "
14436i_varhdr=''
14437case "$valstd" in
14438"$define")
14439 if `./varargs I_STDARG`; then
14440 val='stdarg.h'
14441 elif `./varargs I_VARARGS`; then
14442 val='varargs.h'
14443 fi
14444 ;;
14445*)
14446 if `./varargs I_VARARGS`; then
14447 val='varargs.h'
14448 fi
14449 ;;
14450esac
14451case "$val" in
14452'')
14453echo "I could not find the definition for va_dcl... You have problems..." >&4
14454 val="$undef"; set i_stdarg; eval $setvar
14455 val="$undef"; set i_varargs; eval $setvar
14456 ;;
14457*)
14458 set i_varhdr
14459 eval $setvar
14460 case "$i_varhdr" in
14461 stdarg.h)
14462 val="$define"; set i_stdarg; eval $setvar
14463 val="$undef"; set i_varargs; eval $setvar
14464 ;;
14465 varargs.h)
14466 val="$undef"; set i_stdarg; eval $setvar
14467 val="$define"; set i_varargs; eval $setvar
14468 ;;
14469 esac
14470 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14471esac
14472$rm -f varargs*
14473
14474: see if we need va_copy
14475echo " "
14476case "$i_stdarg" in
14477"$define")
14478 $cat >try.c <<EOCP
14479#include <stdarg.h>
14480#include <stdio.h>
85c8a686
DD
14481#$i_stdlib I_STDLIB
14482#ifdef I_STDLIB
14483#include <stdlib.h>
14484#endif
14485#include <signal.h>
2cc61e15
DD
14486
14487int
14488ivfprintf(FILE *f, const char *fmt, va_list *valp)
14489{
14490 return vfprintf(f, fmt, *valp);
14491}
14492
14493int
14494myvfprintf(FILE *f, const char *fmt, va_list val)
14495{
14496 return ivfprintf(f, fmt, &val);
14497}
14498
14499int
14500myprintf(char *fmt, ...)
14501{
14502 va_list val;
14503 va_start(val, fmt);
14504 return myvfprintf(stdout, fmt, val);
14505}
14506
14507int
14508main(int ac, char **av)
14509{
85c8a686
DD
14510 signal(SIGSEGV, exit);
14511
2cc61e15
DD
14512 myprintf("%s%cs all right, then\n", "that", '\'');
14513 exit(0);
14514}
14515EOCP
14516 set try
5440bc8e
JH
14517 if eval $compile && $run ./try 2>&1 >/dev/null; then
14518 case "`$run ./try`" in
2cc61e15
DD
14519 "that's all right, then")
14520 okay=yes
14521 ;;
14522 esac
14523 fi
14524 case "$okay" in
14525 yes) echo "It seems that you don't need va_copy()." >&4
14526 need_va_copy="$undef"
14527 ;;
14528 *) echo "It seems that va_copy() or similar will be needed." >&4
14529 need_va_copy="$define"
14530 ;;
14531 esac
14532 $rm -f try.* core core.* *.core *.core.*
14533 ;;
14534*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14535 ;;
14536esac
14537
b4eb6b3d
JH
14538: define a fucntion to check prototypes
14539$cat > protochk <<EOSH
14540$startsh
14541cc="$cc"
14542optimize="$optimize"
14543ccflags="$ccflags"
14544prototype="$prototype"
14545define="$define"
14546rm=$rm
14547EOSH
14548
14549$cat >> protochk <<'EOSH'
14550
14551$rm -f try.c
14552foo="$1"
14553shift
14554while test $# -ge 2; do
14555 case "$1" in
14556 $define) echo "#include <$2>" >> try.c ;;
14557 literal) echo "$2" >> try.c ;;
14558 esac
14559 shift 2
14560done
14561test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
14562cat >> try.c <<'EOCP'
14563#ifdef CAN_PROTOTYPE
14564#define _(args) args
14565#else
14566#define _(args) ()
14567#endif
14568EOCP
14569echo "$foo" >> try.c
14570echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14571$cc $optimize $ccflags -c try.c > /dev/null 2>&1
14572status=$?
14573$rm -f try.[co]
14574exit $status
14575EOSH
14576chmod +x protochk
14577$eunicefix protochk
14578
14579: see what type is used for size_t
14580rp="What is the type used for the length parameter for string functions?"
14581set size_t sizetype 'unsigned int' stdio.h sys/types.h
14582eval $typedef_ask
14583
14584: check for type of arguments to gethostbyaddr.
14585if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14586 case "$d_gethbyaddr" in
14587 $define)
14588 $cat <<EOM
14589
14590Checking to see what type of arguments are accepted by gethostbyaddr().
14591EOM
14592 hdrs="$define sys/types.h
14593 $d_socket sys/socket.h
14594 $i_niin netinet/in.h
14595 $i_netdb netdb.h
14596 $i_unistd unistd.h"
14597 : The first arg can 'char *' or 'void *'
14598 : The second arg is some of integral type
14599 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14600 for yyy in size_t long int; do
14601 case "$netdb_host_type" in
14602 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14603 if ./protochk "$try" $hdrs; then
14604 echo "Your system accepts $xxx for the first arg."
14605 echo "...and $yyy for the second arg."
14606 netdb_host_type="$xxx"
14607 netdb_hlen_type="$yyy"
14608 fi
14609 ;;
14610 esac
14611 done
14612 done
14613 : In case none of those worked, prompt the user.
14614 case "$netdb_host_type" in
14615 '') rp='What is the type for the 1st argument to gethostbyaddr?'
14616 dflt='char *'
14617 . ./myread
14618 netdb_host_type=$ans
14619 rp='What is the type for the 2nd argument to gethostbyaddr?'
14620 dflt="$sizetype"
14621 . ./myread
14622 netdb_hlen_type=$ans
14623 ;;
14624 esac
14625 ;;
14626 *) : no gethostbyaddr, so pick harmless defaults
14627 netdb_host_type='char *'
14628 netdb_hlen_type="$sizetype"
14629 ;;
14630 esac
14631 # Remove the "const" if needed. -- but then we'll have a
14632 # prototype clash!
14633 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14634fi
14635
14636: check for type of argument to gethostbyname.
14637if test "X$netdb_name_type" = X ; then
14638 case "$d_gethbyname" in
14639 $define)
14640 $cat <<EOM
14641
14642Checking to see what type of argument is accepted by gethostbyname().
14643EOM
14644 hdrs="$define sys/types.h
14645 $d_socket sys/socket.h
14646 $i_niin netinet/in.h
14647 $i_netdb netdb.h
14648 $i_unistd unistd.h"
14649 for xxx in "const char *" "char *"; do
14650 case "$netdb_name_type" in
14651 '') try="extern struct hostent *gethostbyname($xxx);"
14652 if ./protochk "$try" $hdrs; then
14653 echo "Your system accepts $xxx."
14654 netdb_name_type="$xxx"
14655 fi
14656 ;;
14657 esac
14658 done
14659 : In case none of those worked, prompt the user.
14660 case "$netdb_name_type" in
14661 '') rp='What is the type for the 1st argument to gethostbyname?'
14662 dflt='char *'
14663 . ./myread
14664 netdb_name_type=$ans
14665 ;;
14666 esac
14667 ;;
14668 *) : no gethostbyname, so pick harmless default
14669 netdb_name_type='char *'
14670 ;;
14671 esac
14672fi
14673
14674: check for type of 1st argument to getnetbyaddr.
14675if test "X$netdb_net_type" = X ; then
14676 case "$d_getnbyaddr" in
14677 $define)
14678 $cat <<EOM
14679
14680Checking to see what type of 1st argument is accepted by getnetbyaddr().
14681EOM
14682 hdrs="$define sys/types.h
14683 $d_socket sys/socket.h
14684 $i_niin netinet/in.h
14685 $i_netdb netdb.h
14686 $i_unistd unistd.h"
14687 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14688 case "$netdb_net_type" in
14689 '') try="extern struct netent *getnetbyaddr($xxx, int);"
14690 if ./protochk "$try" $hdrs; then
14691 echo "Your system accepts $xxx."
14692 netdb_net_type="$xxx"
14693 fi
14694 ;;
14695 esac
14696 done
14697 : In case none of those worked, prompt the user.
14698 case "$netdb_net_type" in
14699 '') rp='What is the type for the 1st argument to getnetbyaddr?'
14700 dflt='long'
14701 . ./myread
14702 netdb_net_type=$ans
14703 ;;
14704 esac
14705 ;;
14706 *) : no getnetbyaddr, so pick harmless default
14707 netdb_net_type='long'
14708 ;;
14709 esac
14710fi
14711: locate the preferred pager for this system
14712case "$pager" in
14713'')
14714 dflt=''
14715 case "$pg" in
14716 /*) dflt=$pg;;
14717 [a-zA-Z]:/*) dflt=$pg;;
14718 esac
14719 case "$more" in
14720 /*) dflt=$more;;
14721 [a-zA-Z]:/*) dflt=$more;;
14722 esac
14723 case "$less" in
14724 /*) dflt=$less;;
14725 [a-zA-Z]:/*) dflt=$less;;
14726 esac
14727 case "$dflt" in
14728 '') dflt=/usr/ucb/more;;
14729 esac
14730 ;;
14731*) dflt="$pager";;
14732esac
14733echo " "
14734fn=f/
14735rp='What pager is used on your system?'
14736. ./getfile
14737pager="$ans"
14738
14739: see what type pids are declared as in the kernel
14740rp="What is the type of process ids on this system?"
14741set pid_t pidtype int stdio.h sys/types.h
14742eval $typedef_ask
14743
14744: Find earliest binary compatible site_perl subdirectory perl can use.
14745case "$bincompat5005" in
14746"$define") xs_apiversion='5.005' ;;
14747*) xs_apiversion=$version ;; # The current site_perl version.
14748esac
14749: Find earliest pure perl site_perl subdirectory perl can use.
14750: The versioned directories started at 5.005.
14751pm_apiversion='5.005'
14752
b4eb6b3d
JH
14753: see if ar generates random libraries by itself
14754echo " "
14755echo "Checking how to generate random libraries on your machine..." >&4
14756echo 'int bar1() { return bar2(); }' > bar1.c
14757echo 'int bar2() { return 2; }' > bar2.c
14758$cat > foo.c <<'EOP'
14759int main() { printf("%d\n", bar1()); exit(0); }
14760EOP
14761$cc $ccflags -c bar1.c >/dev/null 2>&1
14762$cc $ccflags -c bar2.c >/dev/null 2>&1
14763$cc $ccflags -c foo.c >/dev/null 2>&1
14764$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 14765if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 14766 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
14767 echo "$ar appears to generate random libraries itself."
14768 orderlib=false
14769 ranlib=":"
14770elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 14771 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 14772 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
14773 echo "a table of contents needs to be added with '$ar ts'."
14774 orderlib=false
14775 ranlib="$ar ts"
14776else
14777 case "$ranlib" in
14778 :) ranlib='';;
14779 '')
14780 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14781 $test -f $ranlib || ranlib=''
14782 ;;
14783 esac
14784 if $test -n "$ranlib"; then
14785 echo "your system has '$ranlib'; we'll use that."
14786 orderlib=false
14787 else
14788 echo "your system doesn't seem to support random libraries"
14789 echo "so we'll use lorder and tsort to order the libraries."
14790 orderlib=true
14791 ranlib=":"
14792 fi
14793fi
14794$rm -f foo* bar*
14795
14796: check for type of arguments to select.
14797case "$selecttype" in
14798'') case "$d_select" in
14799 $define)
14800 echo " "
14801 $cat <<EOM
14802Checking to see what type of arguments are accepted by select().
14803EOM
14804 hdrs="$define sys/types.h
14805 $i_systime sys/time.h
14806 $i_sysselct sys/select.h
14807 $d_socket sys/socket.h"
14808 : The first arg can be int, unsigned, or size_t
14809 : The last arg may or may not be 'const'
14810 val=''
14811 : void pointer has been seen but using that
14812 : breaks the selectminbits test
14813 for xxx in 'fd_set *' 'int *'; do
14814 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14815 for tmo in 'struct timeval *' 'const struct timeval *'; do
14816 case "$val" in
14817 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14818 if ./protochk "$try" $hdrs; then
14819 echo "Your system accepts $xxx."
14820 val="$xxx"
14821 fi
14822 ;;
14823 esac
14824 done
14825 done
14826 done
14827 case "$val" in
14828 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14829 case "$d_fd_set" in
14830 $define) dflt="fd_set *" ;;
14831 *) dflt="int *" ;;
14832 esac
14833 . ./myread
14834 val=$ans
14835 ;;
14836 esac
14837 selecttype="$val"
14838 ;;
14839 *) : no select, so pick a harmless default
14840 selecttype='int *'
14841 ;;
14842 esac
14843 ;;
14844esac
14845
14846: check for the select 'width'
14847case "$selectminbits" in
14848'') case "$d_select" in
14849 $define)
14850 $cat <<EOM
14851
14852Checking to see on how many bits at a time your select() operates...
14853EOM
14854 $cat >try.c <<EOCP
14855#include <sys/types.h>
14856#$i_time I_TIME
14857#$i_systime I_SYS_TIME
14858#$i_systimek I_SYS_TIME_KERNEL
14859#ifdef I_TIME
14860# include <time.h>
14861#endif
14862#ifdef I_SYS_TIME
14863# ifdef I_SYS_TIME_KERNEL
14864# define KERNEL
14865# endif
14866# include <sys/time.h>
14867# ifdef I_SYS_TIME_KERNEL
14868# undef KERNEL
14869# endif
14870#endif
14871#$i_sysselct I_SYS_SELECT
14872#ifdef I_SYS_SELECT
14873#include <sys/select.h>
14874#endif
14875#$d_socket HAS_SOCKET
14876#ifdef HAS_SOCKET
14877# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14878#endif
14879#include <stdio.h>
14880$selecttype b;
14881#define S sizeof(*(b))
14882#define MINBITS 64
14883#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14884#define NBITS (NBYTES * 8)
14885int main() {
14886 char s[NBYTES];
14887 struct timeval t;
14888 int i;
14889 FILE* fp;
14890 int fd;
14891
14892 fclose(stdin);
14893 fp = fopen("try.c", "r");
14894 if (fp == 0)
14895 exit(1);
14896 fd = fileno(fp);
14897 if (fd < 0)
14898 exit(2);
14899 b = ($selecttype)s;
14900 for (i = 0; i < NBITS; i++)
14901 FD_SET(i, b);
14902 t.tv_sec = 0;
14903 t.tv_usec = 0;
14904 select(fd + 1, b, 0, 0, &t);
14905 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14906 printf("%d\n", i + 1);
14907 return 0;
14908}
14909EOCP
14910 set try
14911 if eval $compile_ok; then
5440bc8e 14912 selectminbits=`$run ./try`
b4eb6b3d
JH
14913 case "$selectminbits" in
14914 '') cat >&4 <<EOM
14915Cannot figure out on how many bits at a time your select() operates.
14916I'll play safe and guess it is 32 bits.
14917EOM
14918 selectminbits=32
14919 bits="32 bits"
14920 ;;
14921 1) bits="1 bit" ;;
14922 *) bits="$selectminbits bits" ;;
14923 esac
14924 echo "Your select() operates on $bits at a time." >&4
14925 else
14926 rp='What is the minimum number of bits your select() operates on?'
14927 case "$byteorder" in
14928 1234|12345678) dflt=32 ;;
14929 *) dflt=1 ;;
14930 esac
14931 . ./myread
14932 val=$ans
14933 selectminbits="$val"
14934 fi
14935 $rm -f try.* try
14936 ;;
14937 *) : no select, so pick a harmless default
14938 selectminbits='32'
14939 ;;
14940 esac
14941 ;;
14942esac
14943
14944: Trace out the files included by signal.h, then look for SIGxxx names.
14945: Remove SIGARRAYSIZE used by HPUX.
14946: Remove SIGSTKSIZE used by Linux.
14947: Remove SIGSTKSZ used by Posix.
14948: Remove SIGTYP void lines used by OS2.
14949: Some cpps, like os390, dont give the file name anywhere
14950if [ "X$fieldn" = X ]; then
14951 : Just make some guesses. We check them later.
14952 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14953else
14954 xxx=`echo '#include <signal.h>' |
14955 $cppstdin $cppminus $cppflags 2>/dev/null |
14956 $grep '^[ ]*#.*include' |
a938a3bb 14957 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
14958fi
14959: Check this list of files to be sure we have parsed the cpp output ok.
14960: This will also avoid potentially non-existent files, such
14961: as ../foo/bar.h
14962xxxfiles=''
14963for xx in $xxx /dev/null ; do
14964 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14965done
14966: If we have found no files, at least try signal.h
14967case "$xxxfiles" in
14968'') xxxfiles=`./findhdr signal.h` ;;
14969esac
14970xxx=`awk '
14971$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14972 print substr($2, 4, 20)
14973}
14974$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14975 print substr($3, 4, 20)
14976}' $xxxfiles`
14977: Append some common names just in case the awk scan failed.
14978xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14979xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14980xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14981xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14982xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14983
14984: generate a few handy files for later
14985$cat > signal.c <<'EOCP'
14986#include <sys/types.h>
14987#include <signal.h>
14988#include <stdio.h>
14989int main() {
14990
14991/* Strange style to avoid deeply-nested #if/#else/#endif */
14992#ifndef NSIG
14993# ifdef _NSIG
14994# define NSIG (_NSIG)
14995# endif
14996#endif
14997
14998#ifndef NSIG
14999# ifdef SIGMAX
15000# define NSIG (SIGMAX+1)
15001# endif
15002#endif
15003
15004#ifndef NSIG
15005# ifdef SIG_MAX
15006# define NSIG (SIG_MAX+1)
15007# endif
15008#endif
15009
15010#ifndef NSIG
15011# ifdef MAXSIG
15012# define NSIG (MAXSIG+1)
15013# endif
15014#endif
15015
15016#ifndef NSIG
15017# ifdef MAX_SIG
15018# define NSIG (MAX_SIG+1)
15019# endif
15020#endif
15021
15022#ifndef NSIG
15023# ifdef SIGARRAYSIZE
15024# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
15025# endif
15026#endif
15027
15028#ifndef NSIG
15029# ifdef _sys_nsig
15030# define NSIG (_sys_nsig) /* Solaris 2.5 */
15031# endif
15032#endif
15033
15034/* Default to some arbitrary number that's big enough to get most
15035 of the common signals.
15036*/
15037#ifndef NSIG
15038# define NSIG 50
15039#endif
15040
15041printf("NSIG %d\n", NSIG);
15042
15043#ifndef JUST_NSIG
15044
15045EOCP
15046
15047echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
15048{
15049 printf "#ifdef SIG"; printf $1; printf "\n"
15050 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
15051 printf $1; printf ");\n"
15052 printf "#endif\n"
15053}
15054END {
15055 printf "#endif /* JUST_NSIG */\n";
15056 printf "exit(0);\n}\n";
15057}
15058' >>signal.c
15059$cat >signal.awk <<'EOP'
15060BEGIN { ndups = 0 }
15061$1 ~ /^NSIG$/ { nsig = $2 }
15062($1 !~ /^NSIG$/) && (NF == 2) {
15063 if ($2 > maxsig) { maxsig = $2 }
15064 if (sig_name[$2]) {
15065 dup_name[ndups] = $1
15066 dup_num[ndups] = $2
15067 ndups++
15068 }
15069 else {
15070 sig_name[$2] = $1
15071 sig_num[$2] = $2
15072 }
15073}
15074END {
15075 if (nsig == 0) {
15076 nsig = maxsig + 1
15077 }
15078 printf("NSIG %d\n", nsig);
15079 for (n = 1; n < nsig; n++) {
15080 if (sig_name[n]) {
15081 printf("%s %d\n", sig_name[n], sig_num[n])
15082 }
15083 else {
15084 printf("NUM%d %d\n", n, n)
15085 }
15086 }
15087 for (n = 0; n < ndups; n++) {
15088 printf("%s %d\n", dup_name[n], dup_num[n])
15089 }
15090}
15091EOP
15092$cat >signal_cmd <<EOS
15093$startsh
15094if $test -s signal.lst; then
15095 echo "Using your existing signal.lst file"
15096 exit 0
15097fi
15098xxx="$xxx"
15099EOS
15100$cat >>signal_cmd <<'EOS'
15101
15102set signal
15103if eval $compile_ok; then
5440bc8e 15104 $run ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
15105else
15106 echo "(I can't seem be able to compile the whole test program)" >&4
15107 echo "(I'll try it in little pieces.)" >&4
15108 set signal -DJUST_NSIG
15109 if eval $compile_ok; then
5440bc8e 15110 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
15111 $cat signal.nsg
15112 else
15113 echo "I can't seem to figure out how many signals you have." >&4
15114 echo "Guessing 50." >&4
15115 echo 'NSIG 50' > signal.nsg
15116 fi
15117 : Now look at all the signal names, one at a time.
15118 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
15119 $cat > signal.c <<EOCP
15120#include <sys/types.h>
15121#include <signal.h>
15122#include <stdio.h>
15123int main() {
15124printf("$xx %d\n", SIG${xx});
15125return 0;
15126}
15127EOCP
15128 set signal
15129 if eval $compile; then
15130 echo "SIG${xx} found."
5440bc8e 15131 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
15132 else
15133 echo "SIG${xx} NOT found."
15134 fi
15135 done
15136 if $test -s signal.ls1; then
15137 $cat signal.nsg signal.ls1 |
15138 $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
15139 fi
15140
15141fi
15142if $test -s signal.lst; then
15143 :
15144else
15145 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
15146 echo 'kill -l' >signal
15147 set X `csh -f <signal`
15148 $rm -f signal
15149 shift
15150 case $# in
15151 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
15152 esac
15153 echo $@ | $tr ' ' $trnl | \
15154 $awk '{ printf "%s %d\n", $1, ++s; }
15155 END { printf "NSIG %d\n", ++s }' >signal.lst
15156fi
15157$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
15158EOS
15159chmod a+x signal_cmd
15160$eunicefix signal_cmd
15161
15162: generate list of signal names
15163echo " "
15164case "$sig_name_init" in
15165'') doinit=yes ;;
15166*) case "$sig_num_init" in
15167 ''|*,*) doinit=yes ;;
15168 esac ;;
15169esac
15170case "$doinit" in
15171yes)
15172 echo "Generating a list of signal names and numbers..." >&4
15173 . ./signal_cmd
15174 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
15175 sig_name=`$awk 'BEGIN { printf "ZERO " }
15176 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
15177 sig_num=`$awk 'BEGIN { printf "0 " }
15178 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
15179 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
15180 !/^NSIG/ { printf "\"%s\", ", $1 }
15181 END { printf "0\n" }' signal.lst`
15182 sig_num_init=`$awk 'BEGIN { printf "0, " }
15183 !/^NSIG/ { printf "%d, ", $2}
15184 END { printf "0\n"}' signal.lst`
15185 ;;
15186esac
15187echo "The following $sig_count signals are available:"
15188echo " "
15189echo $sig_name | $awk \
15190'BEGIN { linelen = 0 }
15191{
15192 for (i = 1; i <= NF; i++) {
15193 name = "SIG" $i " "
15194 linelen = linelen + length(name)
15195 if (linelen > 70) {
15196 printf "\n"
15197 linelen = length(name)
15198 }
15199 printf "%s", name
15200 }
15201 printf "\n"
15202}'
76d3c696 15203sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
15204$rm -f signal signal.c signal.awk signal.lst signal_cmd
15205
15206echo " "
15207case "$sizetype" in
15208*_t) zzz="$sizetype" ;;
15209*) zzz="filesize" ;;
15210esac
15211echo "Checking the size of $zzz..." >&4
15212cat > try.c <<EOCP
15213#include <sys/types.h>
15214#include <stdio.h>
15215int main() {
15216 printf("%d\n", (int)sizeof($sizetype));
15217 exit(0);
15218}
15219EOCP
15220set try
15221if eval $compile_ok; then
5440bc8e 15222 yyy=`$run ./try`
b4eb6b3d
JH
15223 case "$yyy" in
15224 '') sizesize=4
15225 echo "(I can't execute the test program--guessing $sizesize.)" >&4
15226 ;;
15227 *) sizesize=$yyy
15228 echo "Your $zzz size is $sizesize bytes."
15229 ;;
15230 esac
15231else
15232 sizesize=4
15233 echo "(I can't compile the test program--guessing $sizesize.)" >&4
15234fi
15235
15236
15237: check for socklen_t
15238echo " "
15239echo "Checking to see if you have socklen_t..." >&4
15240$cat >try.c <<EOCP
15241#include <sys/types.h>
15242#$d_socket HAS_SOCKET
15243#ifdef HAS_SOCKET
15244#include <sys/socket.h>
15245#endif
15246int main() { socklen_t x = 16; }
15247EOCP
15248set try
15249if eval $compile; then
15250 val="$define"
15251 echo "You have socklen_t."
15252else
15253 val="$undef"
15254 echo "You do not have socklen_t."
15255 case "$sizetype" in
15256 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
15257 esac
15258fi
15259$rm -f try try.*
15260set d_socklen_t
15261eval $setvar
15262
a7710f8d
JH
15263: see if this is a socks.h system
15264set socks.h i_socks
15265eval $inhdr
15266
b4eb6b3d
JH
15267: check for type of the size argument to socket calls
15268case "$d_socket" in
15269"$define")
15270 $cat <<EOM
15271
15272Checking to see what type is the last argument of accept().
15273EOM
b4eb6b3d
JH
15274 yyy=''
15275 case "$d_socklen_t" in
15276 "$define") yyy="$yyy socklen_t"
15277 esac
15278 yyy="$yyy $sizetype int long unsigned"
15279 for xxx in $yyy; do
15280 case "$socksizetype" in
15281 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
15282 case "$usesocks" in
15283 "$define")
15284 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
15285 echo "Your system accepts '$xxx *' for the last argument of accept()."
15286 socksizetype="$xxx"
15287 fi
15288 ;;
15289 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
15290 echo "Your system accepts '$xxx *' for the last argument of accept()."
15291 socksizetype="$xxx"
15292 fi
15293 ;;
15294 esac
b4eb6b3d
JH
15295 ;;
15296 esac
15297 done
15298: In case none of those worked, prompt the user.
15299 case "$socksizetype" in
15300 '') rp='What is the type for socket address structure sizes?'
15301 dflt='int'
15302 . ./myread
15303 socksizetype=$ans
15304 ;;
15305 esac
15306 ;;
15307*) : no sockets, so pick relatively harmless default
15308 socksizetype='int'
15309 ;;
15310esac
15311
15312: see what type is used for signed size_t
15313set ssize_t ssizetype int stdio.h sys/types.h
15314eval $typedef
15315dflt="$ssizetype"
5440bc8e 15316$cat > try.c <<EOM
b4eb6b3d
JH
15317#include <stdio.h>
15318#include <sys/types.h>
15319#define Size_t $sizetype
15320#define SSize_t $dflt
15321int main()
15322{
15323 if (sizeof(Size_t) == sizeof(SSize_t))
15324 printf("$dflt\n");
15325 else if (sizeof(Size_t) == sizeof(int))
15326 printf("int\n");
15327 else
15328 printf("long\n");
15329 exit(0);
15330}
15331EOM
15332echo " "
5440bc8e
JH
15333set try
15334if eval $compile_ok && $run ./try > /dev/null; then
15335 ssizetype=`$run ./try`
b4eb6b3d
JH
15336 echo "I'll be using $ssizetype for functions returning a byte count." >&4
15337else
15338 $cat >&4 <<EOM
15339Help! I can't compile and run the ssize_t test program: please enlighten me!
15340(This is probably a misconfiguration in your system or libraries, and
15341you really ought to fix it. Still, I'll try anyway.)
15342
15343I need a type that is the same size as $sizetype, but is guaranteed to
15344be signed. Common values are ssize_t, int and long.
15345
15346EOM
15347 rp="What signed type is the same size as $sizetype?"
15348 . ./myread
15349 ssizetype="$ans"
15350fi
5440bc8e 15351$rm -f try try.*
b4eb6b3d
JH
15352
15353: see what type of char stdio uses.
15354echo " "
aa517f50
JH
15355echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
15356if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
15357 echo "Your stdio uses unsigned chars." >&4
15358 stdchar="unsigned char"
15359else
aa517f50
JH
15360 echo "Your stdio uses signed chars." >&4
15361 stdchar="char"
b4eb6b3d 15362fi
aa517f50
JH
15363$rm -f stdioh
15364
15365
b4eb6b3d
JH
15366
15367: see if time exists
15368echo " "
15369if test "X$d_time" = X -o X"$timetype" = X; then
15370 if set time val -f d_time; eval $csym; $val; then
15371 echo 'time() found.' >&4
15372 val="$define"
15373 rp="What is the type returned by time() on this system?"
15374 set time_t timetype long stdio.h sys/types.h
15375 eval $typedef_ask
15376 else
15377 echo 'time() not found, hope that will do.' >&4
15378 val="$undef"
15379 timetype='int';
15380 fi
15381 set d_time
15382 eval $setvar
15383fi
15384
15385: see what type uids are declared as in the kernel
15386echo " "
15387echo "Looking for the type for user ids returned by getuid()."
15388set uid_t uidtype xxx stdio.h sys/types.h
15389eval $typedef
15390case "$uidtype" in
15391xxx)
15392 xxx=`./findhdr sys/user.h`
15393 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15394 case $1 in
15395 unsigned) dflt="$1 $2" ;;
15396 *) dflt="$1" ;;
15397 esac
15398 ;;
15399*) dflt="$uidtype";;
15400esac
15401case "$uidtype" in
15402uid_t) echo "uid_t found." ;;
15403*) rp="What is the type for user ids returned by getuid()?"
15404 . ./myread
15405 uidtype="$ans"
15406 ;;
15407esac
15408
15409echo " "
15410case "$uidtype" in
15411*_t) zzz="$uidtype" ;;
15412*) zzz="uid" ;;
15413esac
15414echo "Checking the size of $zzz..." >&4
15415cat > try.c <<EOCP
15416#include <sys/types.h>
15417#include <stdio.h>
15418int main() {
15419 printf("%d\n", (int)sizeof($uidtype));
15420 exit(0);
15421}
15422EOCP
15423set try
15424if eval $compile_ok; then
5440bc8e 15425 yyy=`$run ./try`
b4eb6b3d
JH
15426 case "$yyy" in
15427 '') uidsize=4
15428 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15429 ;;
15430 *) uidsize=$yyy
15431 echo "Your $zzz is $uidsize bytes long."
15432 ;;
15433 esac
15434else
15435 uidsize=4
15436 echo "(I can't compile the test program--guessing $uidsize.)" >&4
15437fi
15438
15439echo " "
15440case "$uidtype" in
15441*_t) zzz="$uidtype" ;;
15442*) zzz="uid" ;;
15443esac
15444echo "Checking the sign of $zzz..." >&4
15445cat > try.c <<EOCP
15446#include <sys/types.h>
15447#include <stdio.h>
15448int main() {
15449 $uidtype foo = -1;
15450 if (foo < 0)
15451 printf("-1\n");
15452 else
15453 printf("1\n");
15454}
15455EOCP
15456set try
15457if eval $compile; then
5440bc8e 15458 yyy=`$run ./try`
b4eb6b3d
JH
15459 case "$yyy" in
15460 '') uidsign=1
15461 echo "(I can't execute the test program--guessing unsigned.)" >&4
15462 ;;
15463 *) uidsign=$yyy
15464 case "$uidsign" in
15465 1) echo "Your $zzz is unsigned." ;;
15466 -1) echo "Your $zzz is signed." ;;
15467 esac
15468 ;;
15469 esac
15470else
15471 uidsign=1
15472 echo "(I can't compile the test program--guessing unsigned.)" >&4
15473fi
15474
15475
15476
15477echo " "
15478$echo "Checking the format string to be used for uids..." >&4
15479
15480case "$uidsign" in
15481-1) if $test X"$uidsize" = X"$ivsize"; then
15482 uidformat="$ivdformat"
15483 else
15484 if $test X"$uidsize" = X"$longsize"; then
15485 uidformat='"ld"'
15486 else
15487 if $test X"$uidsize" = X"$intsize"; then
15488 uidformat='"d"'
15489 else
15490 if $test X"$uidsize" = X"$shortsize"; then
15491 uidformat='"hd"'
15492 fi
15493 fi
15494 fi
15495 fi
15496 ;;
15497*) if $test X"$uidsize" = X"$uvsize"; then
15498 uidformat="$uvuformat"
15499 else
15500 if $test X"$uidsize" = X"$longsize"; then
15501 uidformat='"lu"'
15502 else
15503 if $test X"$uidsize" = X"$intsize"; then
15504 uidformat='"u"'
15505 else
15506 if $test X"$uidsize" = X"$shortsize"; then
15507 uidformat='"hu"'
15508 fi
15509 fi
15510 fi
15511 fi
15512 ;;
15513esac
15514
3659ebf1
JH
15515: determine compiler compiler
15516case "$yacc" in
15517'')
15518 dflt=yacc;;
15519*)
15520 dflt="$yacc";;
15521esac
15522echo " "
15523comp='yacc'
15524if $test -f "$byacc"; then
15525 dflt="$byacc"
15526 comp="byacc or $comp"
15527fi
15528if $test -f "$bison"; then
15529 comp="$comp or bison -y"
15530fi
15531rp="Which compiler compiler ($comp) shall I use?"
15532. ./myread
15533yacc="$ans"
15534case "$yacc" in
15535*bis*)
15536 case "$yacc" in
15537 *-y*) ;;
15538 *)
15539 yacc="$yacc -y"
15540 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15541 ;;
15542 esac
15543 ;;
15544esac
15545
b4eb6b3d
JH
15546: see if fcntl.h is there
15547val=''
15548set fcntl.h val
15549eval $inhdr
15550
15551: see if we can include fcntl.h
15552case "$val" in
15553"$define")
15554 echo " "
15555 if $h_fcntl; then
15556 val="$define"
15557 echo "We'll be including <fcntl.h>." >&4
15558 else
15559 val="$undef"
15560 if $h_sysfile; then
15561 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15562 else
15563 echo "We won't be including <fcntl.h>." >&4
15564 fi
15565 fi
15566 ;;
15567*)
15568 h_fcntl=false
15569 val="$undef"
15570 ;;
15571esac
15572set i_fcntl
15573eval $setvar
15574
15575: see if this is a iconv.h system
15576set iconv.h i_iconv
15577eval $inhdr
15578
15579: see if this is a ieeefp.h system
15580set ieeefp.h i_ieeefp
15581eval $inhdr
15582
15583: see if this is a libutil.h system
15584set libutil.h i_libutil
15585eval $inhdr
15586
15587: see if locale.h is available
15588set locale.h i_locale
15589eval $inhdr
15590
15591: see if mach cthreads are available
15592if test "X$usethreads" = "X$define"; then
15593 set mach/cthreads.h i_machcthr
15594 eval $inhdr
15595else
15596 i_machcthr="$undef"
15597fi
15598
15599
15600
15601: see if this is a math.h system
15602set math.h i_math
15603eval $inhdr
15604
15605: see if this is a mntent.h system
15606set mntent.h i_mntent
15607eval $inhdr
15608
15609: see if ndbm.h is available
15610set ndbm.h t_ndbm
15611eval $inhdr
15612case "$t_ndbm" in
15613$define)
15614 : see if dbm_open exists
15615 set dbm_open d_dbm_open
15616 eval $inlibc
15617 case "$d_dbm_open" in
15618 $undef)
15619 t_ndbm="$undef"
15620 echo "We won't be including <ndbm.h>"
15621 ;;
15622 esac
15623 ;;
15624esac
15625val="$t_ndbm"
15626set i_ndbm
15627eval $setvar
15628
15629: see if net/errno.h is available
15630val=''
15631set net/errno.h val
15632eval $inhdr
15633
15634: Unfortunately, it causes problems on some systems. Arrgh.
15635case "$val" in
15636$define)
15637 cat > try.c <<'EOM'
15638#include <stdio.h>
15639#include <errno.h>
15640#include <net/errno.h>
15641int func()
15642{
15643 return ENOTSOCK;
15644}
15645EOM
15646 if $cc $ccflags -c try.c >/dev/null 2>&1; then
15647 echo "We'll be including <net/errno.h>." >&4
15648 else
15649 echo "We won't be including <net/errno.h>." >&4
15650 val="$undef"
15651 fi
15652 $rm -f try.* try
15653 ;;
15654esac
15655set i_neterrno
15656eval $setvar
15657
15658: see if netinet/tcp.h is available
15659set netinet/tcp.h i_netinettcp
15660eval $inhdr
15661
15662: see if this is a poll.h system
15663set poll.h i_poll
15664eval $inhdr
15665
15666: see if this is a prot.h system
15667set prot.h i_prot
15668eval $inhdr
15669
15670echo " "
15671$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
15672$cat <<'EOSH' > Cppsym.know
15673a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15674AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
d46c9a2d
JH
15675alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15676ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15677BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
15678BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15679bull c cadmus clipper CMU COFF COMPILER_VERSION
15680concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15681CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15682Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15683FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15684GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15685H3050R H3050RX hbullx20 hcx host_mips
15686hp200 hp300 hp700 HP700 hp800 hp9000
15687hp9000s200 hp9000s300 hp9000s400 hp9000s500
15688hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15689i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 15690IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
15691INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15692LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15693LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15694Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15695LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15696M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15697M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15698M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15699MATH_HAS_NO_SIDE_EFFECTS
15700mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15701mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15702mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15703MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15704mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15705NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 15706news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
15707ns32016 ns32332 ns32k nsc32000
15708OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15709pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15710pc532 pdp11 PGC PIC plexus PORTAR posix
15711POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15712POSIX_C_SOURCE POSIX_SOURCE POWER
15713PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 15714riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
15715SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15716sony sony_news sonyrisc sparc sparclite spectrum
15717stardent stdc STDC_EXT stratos sun sun3 sun386
15718Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15719SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15720SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15721sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 15722TM3200 TM5400 TM5600
b4eb6b3d
JH
15723tower tower32 tower32_200 tower32_600 tower32_700
15724tower32_800 tower32_850 tss
15725u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15726ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15727unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15728Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15729XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15730XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15731z8000
15732EOSH
15733# Maybe put other stuff here too.
15734cat <<EOSH >>Cppsym.know
15735$osname
15736EOSH
15737./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15738./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15739$cat Cppsym.know > Cppsym.c
381aa1ff 15740$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
15741$rm -f Cppsym.a Cppsym.b Cppsym.c
15742cat <<EOSH > Cppsym
15743$startsh
15744if $test \$# -gt 0; then
15745 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15746 if $test -s Cppsym.got; then
15747 $rm -f Cppsym.got
15748 exit 0
15749 fi
15750 $rm -f Cppsym.got
15751 exit 1
15752else
15753 $tr " " "$trnl" | ./Cppsym.try
15754 exit 0
15755fi
15756EOSH
15757chmod +x Cppsym
15758$eunicefix Cppsym
15759cat <<EOSH > Cppsym.try
15760$startsh
15761cat <<'EOCP' > try.c
15762#include <stdio.h>
15763int main() {
15764EOCP
15765$awk \\
15766EOSH
15767cat <<'EOSH' >> Cppsym.try
15768'length($1) > 0 {
2ef53570
JH
15769 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
15770 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
15771 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
15772 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 15773}' >> try.c
2ef53570 15774echo 'return 0;}' >> try.c
b4eb6b3d
JH
15775EOSH
15776cat <<EOSH >> Cppsym.try
15777ccflags="$ccflags"
15778case "$osname-$gccversion" in
15779irix-) ccflags="\$ccflags -woff 1178" ;;
15780os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15781esac
5440bc8e 15782$cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
b4eb6b3d
JH
15783EOSH
15784chmod +x Cppsym.try
15785$eunicefix Cppsym.try
15786./Cppsym < Cppsym.know > Cppsym.true
15787: now check the C compiler for additional symbols
15788postprocess_cc_v=''
15789case "$osname" in
15790aix) postprocess_cc_v="|$tr , ' '" ;;
15791esac
15792$cat >ccsym <<EOS
15793$startsh
15794$cat >tmp.c <<EOF
15795extern int foo;
15796EOF
15797for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15798do
15799 case "\$i" in
15800 -D*) echo "\$i" | $sed 's/^-D//';;
15801 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15802 esac
15803done
15804$rm -f try.c
15805EOS
15806postprocess_cc_v=''
15807chmod +x ccsym
15808$eunicefix ccsym
15809./ccsym > ccsym1.raw
15810if $test -s ccsym1.raw; then
15811 $sort ccsym1.raw | $uniq >ccsym.raw
15812else
15813 mv ccsym1.raw ccsym.raw
15814fi
15815
15816$awk '/\=/ { print $0; next }
15817 { print $0"=1" }' ccsym.raw >ccsym.list
15818$awk '/\=/ { print $0; next }
15819 { print $0"=1" }' Cppsym.true >ccsym.true
15820$comm -13 ccsym.true ccsym.list >ccsym.own
15821$comm -12 ccsym.true ccsym.list >ccsym.com
15822$comm -23 ccsym.true ccsym.list >ccsym.cpp
15823also=''
15824if $test -z ccsym.raw; then
15825 echo "Your C compiler doesn't seem to define any symbols!" >&4
15826 echo " "
15827 echo "However, your C preprocessor defines the following symbols:"
15828 $cat Cppsym.true
15829 ccsymbols=''
15830 cppsymbols=`$cat Cppsym.true`
15831 cppsymbols=`echo $cppsymbols`
15832 cppccsymbols="$cppsymbols"
15833else
15834 if $test -s ccsym.com; then
15835 echo "Your C compiler and pre-processor define these symbols:"
15836 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15837 also='also '
15838 symbols='ones'
15839 cppccsymbols=`$cat ccsym.com`
15840 cppccsymbols=`echo $cppccsymbols`
15841 $test "$silent" || sleep 1
15842 fi
15843 if $test -s ccsym.cpp; then
15844 $test "$also" && echo " "
15845 echo "Your C pre-processor ${also}defines the following symbols:"
15846 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15847 also='further '
15848 cppsymbols=`$cat ccsym.cpp`
15849 cppsymbols=`echo $cppsymbols`
15850 $test "$silent" || sleep 1
15851 fi
15852 if $test -s ccsym.own; then
15853 $test "$also" && echo " "
15854 echo "Your C compiler ${also}defines the following cpp symbols:"
15855 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15856 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15857 ccsymbols=`$cat ccsym.own`
15858 ccsymbols=`echo $ccsymbols`
15859 $test "$silent" || sleep 1
15860 fi
15861fi
15862$rm -f ccsym* Cppsym.*
15863
15864: see if this is a termio system
15865val="$undef"
15866val2="$undef"
15867val3="$undef"
15868if $test `./findhdr termios.h`; then
15869 set tcsetattr i_termios
15870 eval $inlibc
15871 val3="$i_termios"
15872fi
15873echo " "
15874case "$val3" in
15875"$define") echo "You have POSIX termios.h... good!" >&4;;
15876*) if ./Cppsym pyr; then
15877 case "`/bin/universe`" in
15878 ucb) if $test `./findhdr sgtty.h`; then
15879 val2="$define"
15880 echo "<sgtty.h> found." >&4
15881 else
15882 echo "System is pyramid with BSD universe."
15883 echo "<sgtty.h> not found--you could have problems." >&4
15884 fi;;
15885 *) if $test `./findhdr termio.h`; then
15886 val="$define"
15887 echo "<termio.h> found." >&4
15888 else
15889 echo "System is pyramid with USG universe."
15890 echo "<termio.h> not found--you could have problems." >&4
15891 fi;;
15892 esac
15893 elif ./usg; then
15894 if $test `./findhdr termio.h`; then
15895 echo "<termio.h> found." >&4
15896 val="$define"
15897 elif $test `./findhdr sgtty.h`; then
15898 echo "<sgtty.h> found." >&4
15899 val2="$define"
15900 else
15901echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15902 fi
15903 else
15904 if $test `./findhdr sgtty.h`; then
15905 echo "<sgtty.h> found." >&4
15906 val2="$define"
15907 elif $test `./findhdr termio.h`; then
15908 echo "<termio.h> found." >&4
15909 val="$define"
15910 else
15911echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15912 fi
15913 fi;;
15914esac
15915set i_termio; eval $setvar
15916val=$val2; set i_sgtty; eval $setvar
15917val=$val3; set i_termios; eval $setvar
15918
15919: see if this is a shadow.h system
15920set shadow.h i_shadow
15921eval $inhdr
15922
b4eb6b3d
JH
15923: see if stddef is available
15924set stddef.h i_stddef
15925eval $inhdr
923fc586 15926
b4eb6b3d
JH
15927: see if this is a sunmath.h system
15928set sunmath.h i_sunmath
15929eval $inhdr
5f80c64f 15930
b4eb6b3d
JH
15931: see if sys/access.h is available
15932set sys/access.h i_sysaccess
15933eval $inhdr
15934
15935: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15936set sys/filio.h i_sysfilio
15937eval $inhdr
15938echo " "
15939if $test `./findhdr sys/ioctl.h`; then
15940 val="$define"
15941 echo '<sys/ioctl.h> found.' >&4
15942else
15943 val="$undef"
15944 if $test $i_sysfilio = "$define"; then
15945 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 15946 else
b4eb6b3d
JH
15947 $test $i_sgtty = "$define" && xxx="sgtty.h"
15948 $test $i_termio = "$define" && xxx="termio.h"
15949 $test $i_termios = "$define" && xxx="termios.h"
15950echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15951 fi
15952fi
15953set i_sysioctl
15954eval $setvar
15955
49a78c82
JH
15956: see if socket ioctl defs are in sys/sockio.h
15957echo " "
15958xxx=`./findhdr sys/sockio.h`
15959if $test "$xxx"; then
15960 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
15961 val="$define"
15962 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
15963 else
15964 val="$undef"
15965 echo "No socket ioctls found in <sys/sockio.h>." >&4
15966 fi
15967else
15968 val="$undef"
15969 $cat <<EOM
15970<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
15971EOM
15972fi
15973set i_syssockio
15974eval $setvar
15975
b4eb6b3d
JH
15976
15977: see if this is a syslog.h system
15978set syslog.h i_syslog
15979eval $inhdr
15980
15981
15982: see if this is a sys/mode.h system
15983set sys/mode.h i_sysmode
15984eval $inhdr
15985
15986: see if sys/resource.h has to be included
15987set sys/resource.h i_sysresrc
15988eval $inhdr
15989
15990: see if sys/security.h is available
15991set sys/security.h i_syssecrt
15992eval $inhdr
15993
15994: see if this is a sys/statvfs.h system
15995set sys/statvfs.h i_sysstatvfs
15996eval $inhdr
15997
b4eb6b3d
JH
15998: see if this is a sys/un.h system
15999set sys/un.h i_sysun
16000eval $inhdr
16001
16002
16003: see if this is a sys/utsname.h system
16004set sys/utsname.h i_sysutsname
16005eval $inhdr
16006
16007: see if this is a syswait system
16008set sys/wait.h i_syswait
16009eval $inhdr
16010
16011: see if this is a ustat.h system
16012set ustat.h i_ustat
16013eval $inhdr
16014
16015: see if this is an utime system
16016set utime.h i_utime
16017eval $inhdr
16018
16019: see if this is a values.h system
16020set values.h i_values
16021eval $inhdr
16022
16023: see if this is a vfork system
16024case "$d_vfork" in
16025"$define")
16026 set vfork.h i_vfork
16027 eval $inhdr
16028 ;;
16029*)
16030 i_vfork="$undef"
16031 ;;
16032esac
16033
16034: see if gdbm.h is available
16035set gdbm.h t_gdbm
16036eval $inhdr
16037case "$t_gdbm" in
16038$define)
16039 : see if gdbm_open exists
16040 set gdbm_open d_gdbm_open
16041 eval $inlibc
16042 case "$d_gdbm_open" in
16043 $undef)
16044 t_gdbm="$undef"
16045 echo "We won't be including <gdbm.h>"
5f80c64f 16046 ;;
b4eb6b3d
JH
16047 esac
16048 ;;
16049esac
16050val="$t_gdbm"
16051set i_gdbm
16052eval $setvar
16053
16054echo " "
16055echo "Looking for extensions..." >&4
16056: If we are using the old config.sh, known_extensions may contain
16057: old or inaccurate or duplicate values.
16058known_extensions=''
16059nonxs_extensions=''
16060: We do not use find because it might not be available.
16061: We do not just use MANIFEST because the user may have dropped
16062: some additional extensions into the source tree and expect them
16063: to be built.
16064
16065: Function to recursively find available extensions, ignoring DynaLoader
16066: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
16067find_extensions='
16068 for xxx in *; do
16069 case "$xxx" in
16070 DynaLoader|dynaload) ;;
16071 *)
16072 if $test -f $xxx/$xxx.xs; then
16073 known_extensions="$known_extensions $1$xxx";
16074 elif $test -f $xxx/Makefile.PL; then
16075 nonxs_extensions="$nonxs_extensions $1$xxx";
16076 else
16077 if $test -d $xxx -a $# -lt 10; then
16078 set $1$xxx/ $*;
16079 cd $xxx;
16080 eval $find_extensions;
16081 cd ..;
16082 shift;
16083 fi;
16084 fi
16085 ;;
16086 esac;
16087 done'
16088tdir=`pwd`
16089cd $rsrc/ext
16090set X
16091shift
16092eval $find_extensions
16093set X $nonxs_extensions
16094shift
16095nonxs_extensions="$*"
16096set X $known_extensions
16097shift
16098known_extensions="$*"
16099cd $tdir
16100
16101: Now see which are supported on this system.
16102avail_ext=''
16103for xxx in $known_extensions ; do
16104 case "$xxx" in
16105 DB_File|db_file)
16106 case "$i_db" in
16107 $define) avail_ext="$avail_ext $xxx" ;;
16108 esac
16109 ;;
16110 GDBM_File|gdbm_fil)
16111 case "$i_gdbm" in
16112 $define) avail_ext="$avail_ext $xxx" ;;
16113 esac
16114 ;;
16115 NDBM_File|ndbm_fil)
16116 case "$i_ndbm" in
16117 $define)
16118 case "$osname-$use64bitint" in
16119 hpux-define)
16120 case "$libs" in
16121 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
16122 esac
16123 ;;
16124 *) avail_ext="$avail_ext $xxx" ;;
16125 esac
16126 ;;
16127 esac
16128 ;;
16129 ODBM_File|odbm_fil)
16130 case "${i_dbm}${i_rpcsvcdbm}" in
16131 *"${define}"*)
16132 case "$osname-$use64bitint" in
16133 hpux-define)
16134 case "$libs" in
16135 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
16136 esac
16137 ;;
16138 *) avail_ext="$avail_ext $xxx" ;;
16139 esac
16140 ;;
16141 esac
16142 ;;
16143 POSIX|posix)
16144 case "$useposix" in
16145 true|define|y) avail_ext="$avail_ext $xxx" ;;
16146 esac
16147 ;;
16148 Opcode|opcode)
16149 case "$useopcode" in
16150 true|define|y) avail_ext="$avail_ext $xxx" ;;
16151 esac
16152 ;;
16153 Socket|socket)
16154 case "$d_socket" in
16155 true|$define|y) avail_ext="$avail_ext $xxx" ;;
16156 esac
16157 ;;
16158 Sys/Syslog|sys/syslog)
16159 : XXX syslog requires socket
16160 case "$d_socket" in
16161 true|$define|y) avail_ext="$avail_ext $xxx" ;;
16162 esac
16163 ;;
16164 Thread|thread)
b00ec89b
AB
16165 case "$usethreads" in
16166 true|$define|y)
16167 case "$useithreads" in
16168 $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
16169 esac
b4eb6b3d
JH
16170 esac
16171 ;;
16172 IPC/SysV|ipc/sysv)
16173 : XXX Do we need a useipcsysv variable here
16174 case "${d_msg}${d_sem}${d_shm}" in
16175 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
16176 esac
16177 ;;
16178 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
16179 ;;
16180 esac
b4eb6b3d 16181done
5f80c64f 16182
b4eb6b3d
JH
16183set X $avail_ext
16184shift
16185avail_ext="$*"
5f80c64f 16186
b4eb6b3d
JH
16187: Now see which nonxs extensions are supported on this system.
16188: For now assume all are.
16189nonxs_ext=''
16190for xxx in $nonxs_extensions ; do
16191 case "$xxx" in
16192 *) nonxs_ext="$nonxs_ext $xxx"
16193 ;;
16194 esac
16195done
5f80c64f 16196
b4eb6b3d
JH
16197set X $nonxs_ext
16198shift
16199nonxs_ext="$*"
16200
16201case $usedl in
16202$define)
16203 $cat <<EOM
16204A number of extensions are supplied with $package. You may choose to
16205compile these extensions for dynamic loading (the default), compile
16206them into the $package executable (static loading), or not include
16207them at all. Answer "none" to include no extensions.
16208Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
16209
16210EOM
b4eb6b3d
JH
16211 case "$dynamic_ext" in
16212 '') dflt="$avail_ext" ;;
16213 *) dflt="$dynamic_ext"
16214 # Perhaps we are reusing an old out-of-date config.sh.
16215 case "$hint" in
16216 previous)
16217 if test X"$dynamic_ext" != X"$avail_ext"; then
16218 $cat <<EOM
16219NOTICE: Your previous config.sh list may be incorrect.
16220The extensions now available to you are
16221 ${avail_ext}
16222but the default list from your previous config.sh is
16223 ${dynamic_ext}
9c839522 16224
b4eb6b3d
JH
16225EOM
16226 fi
9c839522
PM
16227 ;;
16228 esac
b4eb6b3d
JH
16229 ;;
16230 esac
5f80c64f 16231 case "$dflt" in
b4eb6b3d
JH
16232 '') dflt=none;;
16233 esac
16234 rp="What extensions do you wish to load dynamically?"
16235 . ./myread
16236 case "$ans" in
16237 none) dynamic_ext=' ' ;;
16238 *) dynamic_ext="$ans" ;;
5f80c64f 16239 esac
5f80c64f 16240
b4eb6b3d
JH
16241 case "$static_ext" in
16242 '')
16243 : Exclude those already listed in dynamic linking
16244 dflt=''
16245 for xxx in $avail_ext; do
16246 case " $dynamic_ext " in
16247 *" $xxx "*) ;;
16248 *) dflt="$dflt $xxx" ;;
16249 esac
16250 done
16251 set X $dflt
16252 shift
16253 dflt="$*"
16254 ;;
16255 *) dflt="$static_ext"
16256 ;;
16257 esac
9c839522 16258
b4eb6b3d
JH
16259 case "$dflt" in
16260 '') dflt=none;;
16261 esac
16262 rp="What extensions do you wish to load statically?"
16263 . ./myread
16264 case "$ans" in
16265 none) static_ext=' ' ;;
16266 *) static_ext="$ans" ;;
16267 esac
16268 ;;
16269*)
16270 $cat <<EOM
16271A number of extensions are supplied with $package. Answer "none"
16272to include no extensions.
16273Note that DynaLoader is always built and need not be mentioned here.
9c839522 16274
b4eb6b3d
JH
16275EOM
16276 case "$static_ext" in
16277 '') dflt="$avail_ext" ;;
16278 *) dflt="$static_ext"
16279 # Perhaps we are reusing an old out-of-date config.sh.
16280 case "$hint" in
16281 previous)
16282 if test X"$static_ext" != X"$avail_ext"; then
16283 $cat <<EOM
16284NOTICE: Your previous config.sh list may be incorrect.
16285The extensions now available to you are
16286 ${avail_ext}
16287but the default list from your previous config.sh is
16288 ${static_ext}
5f80c64f
JH
16289
16290EOM
b4eb6b3d
JH
16291 fi
16292 ;;
16293 esac
16294 ;;
16295 esac
16296 : Exclude those that are not xs extensions
16297 case "$dflt" in
16298 '') dflt=none;;
16299 esac
16300 rp="What extensions do you wish to include?"
16301 . ./myread
16302 case "$ans" in
16303 none) static_ext=' ' ;;
16304 *) static_ext="$ans" ;;
16305 esac
16306 ;;
5f80c64f
JH
16307esac
16308
b4eb6b3d
JH
16309set X $dynamic_ext $static_ext $nonxs_ext
16310shift
16311extensions="$*"
16312
9c839522
PM
16313: Remove libraries needed only for extensions
16314: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
16315: The exception is SunOS 4.x, which needs them.
16316case "${osname}X${osvers}" in
16317sunos*X4*)
16318 perllibs="$libs"
16319 ;;
16320*) case "$usedl" in
16321 $define|true|[yY]*)
16322 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
16323 shift
16324 perllibs="$*"
16325 ;;
16326 *) perllibs="$libs"
16327 ;;
16328 esac
16329 ;;
9c839522 16330esac
5f80c64f
JH
16331
16332: Remove build directory name from cppstdin so it can be used from
16333: either the present location or the final installed location.
16334echo " "
16335: Get out of the UU directory to get correct path name.
16336cd ..
16337case "$cppstdin" in
16338`pwd`/cppstdin)
16339 echo "Stripping down cppstdin path name"
16340 cppstdin=cppstdin
16341 ;;
16342esac
16343cd UU
16344
16345: end of configuration questions
16346echo " "
16347echo "End of configuration questions."
16348echo " "
16349
16350: back to where it started
16351if test -d ../UU; then
16352 cd ..
16353fi
16354
16355: configuration may be patched via a 'config.over' file
16356if $test -f config.over; then
16357 echo " "
16358 dflt=y
16359 rp='I see a config.over file. Do you wish to load it?'
16360 . UU/myread
16361 case "$ans" in
16362 n*) echo "OK, I'll ignore it.";;
16363 *) . ./config.over
16364 echo "Configuration override changes have been loaded."
16365 ;;
16366 esac
16367fi
16368
16369: in case they want portability, strip down executable paths
16370case "$d_portable" in
16371"$define")
16372 echo " "
16373 echo "Stripping down executable paths..." >&4
16374 for file in $loclist $trylist; do
534ac15a
JH
16375 eval temp=\$$file
16376 eval $file=`basename $temp`
5f80c64f
JH
16377 done
16378 ;;
16379esac
16380
16381: create config.sh file
16382echo " "
16383echo "Creating config.sh..." >&4
16384$spitshell <<EOT >config.sh
16385$startsh
16386#
16387# This file was produced by running the Configure script. It holds all the
16388# definitions figured out by Configure. Should you modify one of these values,
16389# do not forget to propagate your changes by running "Configure -der". You may
16390# instead choose to run each of the .SH files by yourself, or "Configure -S".
16391#
16392
16393# Package name : $package
16394# Source directory : $src
16395# Configuration time: $cf_time
16396# Configured by : $cf_by
16397# Target system : $myuname
16398
16399Author='$Author'
16400Date='$Date'
16401Header='$Header'
16402Id='$Id'
16403Locker='$Locker'
16404Log='$Log'
16405Mcc='$Mcc'
16406RCSfile='$RCSfile'
16407Revision='$Revision'
16408Source='$Source'
16409State='$State'
16410_a='$_a'
16411_exe='$_exe'
16412_o='$_o'
b4eb6b3d 16413afs='$afs'
a6d26a0d 16414afsroot='$afsroot'
b4eb6b3d
JH
16415alignbytes='$alignbytes'
16416ansi2knr='$ansi2knr'
16417aphostname='$aphostname'
16418api_revision='$api_revision'
16419api_subversion='$api_subversion'
16420api_version='$api_version'
16421api_versionstring='$api_versionstring'
5f80c64f 16422ar='$ar'
b4eb6b3d
JH
16423archlib='$archlib'
16424archlibexp='$archlibexp'
16425archname64='$archname64'
16426archname='$archname'
5f80c64f
JH
16427archobjs='$archobjs'
16428awk='$awk'
b4eb6b3d 16429baserev='$baserev'
5f80c64f 16430bash='$bash'
b4eb6b3d
JH
16431bin='$bin'
16432bincompat5005='$bincompat5005'
16433binexp='$binexp'
5f80c64f
JH
16434bison='$bison'
16435byacc='$byacc'
b4eb6b3d 16436byteorder='$byteorder'
5f80c64f 16437c='$c'
b4eb6b3d 16438castflags='$castflags'
5f80c64f
JH
16439cat='$cat'
16440cc='$cc'
16441cccdlflags='$cccdlflags'
16442ccdlflags='$ccdlflags'
16443ccflags='$ccflags'
b4eb6b3d 16444ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 16445ccname='$ccname'
b4eb6b3d 16446ccsymbols='$ccsymbols'
6b356c8e 16447ccversion='$ccversion'
5f80c64f 16448cf_by='$cf_by'
b4eb6b3d 16449cf_email='$cf_email'
5f80c64f 16450cf_time='$cf_time'
b4eb6b3d 16451charsize='$charsize'
5f80c64f
JH
16452chgrp='$chgrp'
16453chmod='$chmod'
16454chown='$chown'
b4eb6b3d 16455clocktype='$clocktype'
5f80c64f
JH
16456comm='$comm'
16457compress='$compress'
16458contains='$contains'
16459cp='$cp'
16460cpio='$cpio'
16461cpp='$cpp'
b4eb6b3d
JH
16462cpp_stuff='$cpp_stuff'
16463cppccsymbols='$cppccsymbols'
5f80c64f
JH
16464cppflags='$cppflags'
16465cpplast='$cpplast'
16466cppminus='$cppminus'
16467cpprun='$cpprun'
16468cppstdin='$cppstdin'
b4eb6b3d 16469cppsymbols='$cppsymbols'
b4eb6b3d 16470cryptlib='$cryptlib'
5f80c64f 16471csh='$csh'
b4eb6b3d
JH
16472d_Gconvert='$d_Gconvert'
16473d_PRIEUldbl='$d_PRIEUldbl'
16474d_PRIFUldbl='$d_PRIFUldbl'
16475d_PRIGUldbl='$d_PRIGUldbl'
16476d_PRIXU64='$d_PRIXU64'
16477d_PRId64='$d_PRId64'
16478d_PRIeldbl='$d_PRIeldbl'
16479d_PRIfldbl='$d_PRIfldbl'
16480d_PRIgldbl='$d_PRIgldbl'
16481d_PRIi64='$d_PRIi64'
16482d_PRIo64='$d_PRIo64'
16483d_PRIu64='$d_PRIu64'
16484d_PRIx64='$d_PRIx64'
16485d_SCNfldbl='$d_SCNfldbl'
74cac757 16486d__fwalk='$d__fwalk'
b4eb6b3d
JH
16487d_access='$d_access'
16488d_accessx='$d_accessx'
16489d_alarm='$d_alarm'
16490d_archlib='$d_archlib'
16491d_atolf='$d_atolf'
16492d_atoll='$d_atoll'
16493d_attribut='$d_attribut'
16494d_bcmp='$d_bcmp'
16495d_bcopy='$d_bcopy'
16496d_bincompat5005='$d_bincompat5005'
5f80c64f 16497d_bsd='$d_bsd'
b4eb6b3d
JH
16498d_bsdgetpgrp='$d_bsdgetpgrp'
16499d_bsdsetpgrp='$d_bsdsetpgrp'
16500d_bzero='$d_bzero'
16501d_casti32='$d_casti32'
16502d_castneg='$d_castneg'
16503d_charvspr='$d_charvspr'
16504d_chown='$d_chown'
16505d_chroot='$d_chroot'
16506d_chsize='$d_chsize'
16507d_closedir='$d_closedir'
4e0554ec 16508d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d
JH
16509d_const='$d_const'
16510d_crypt='$d_crypt'
16511d_csh='$d_csh'
16512d_cuserid='$d_cuserid'
16513d_dbl_dig='$d_dbl_dig'
2ef53570 16514d_dbminitproto='$d_dbminitproto'
b4eb6b3d
JH
16515d_difftime='$d_difftime'
16516d_dirnamlen='$d_dirnamlen'
16517d_dlerror='$d_dlerror'
5f80c64f 16518d_dlopen='$d_dlopen'
b4eb6b3d
JH
16519d_dlsymun='$d_dlsymun'
16520d_dosuid='$d_dosuid'
16521d_drand48proto='$d_drand48proto'
16522d_dup2='$d_dup2'
16523d_eaccess='$d_eaccess'
16524d_endgrent='$d_endgrent'
16525d_endhent='$d_endhent'
16526d_endnent='$d_endnent'
16527d_endpent='$d_endpent'
16528d_endpwent='$d_endpwent'
16529d_endsent='$d_endsent'
16530d_eofnblk='$d_eofnblk'
5f80c64f 16531d_eunice='$d_eunice'
b4eb6b3d
JH
16532d_fchmod='$d_fchmod'
16533d_fchown='$d_fchown'
16534d_fcntl='$d_fcntl'
9d9004a9 16535d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
16536d_fd_macros='$d_fd_macros'
16537d_fd_set='$d_fd_set'
16538d_fds_bits='$d_fds_bits'
16539d_fgetpos='$d_fgetpos'
16540d_flexfnam='$d_flexfnam'
16541d_flock='$d_flock'
2ef53570 16542d_flockproto='$d_flockproto'
b4eb6b3d
JH
16543d_fork='$d_fork'
16544d_fpathconf='$d_fpathconf'
16545d_fpos64_t='$d_fpos64_t'
16546d_frexpl='$d_frexpl'
16547d_fs_data_s='$d_fs_data_s'
16548d_fseeko='$d_fseeko'
16549d_fsetpos='$d_fsetpos'
16550d_fstatfs='$d_fstatfs'
16551d_fstatvfs='$d_fstatvfs'
411ab01c 16552d_fsync='$d_fsync'
b4eb6b3d
JH
16553d_ftello='$d_ftello'
16554d_ftime='$d_ftime'
16555d_getcwd='$d_getcwd'
16556d_getespwnam='$d_getespwnam'
16557d_getfsstat='$d_getfsstat'
16558d_getgrent='$d_getgrent'
16559d_getgrps='$d_getgrps'
16560d_gethbyaddr='$d_gethbyaddr'
16561d_gethbyname='$d_gethbyname'
16562d_gethent='$d_gethent'
16563d_gethname='$d_gethname'
16564d_gethostprotos='$d_gethostprotos'
4e0554ec 16565d_getitimer='$d_getitimer'
b4eb6b3d
JH
16566d_getlogin='$d_getlogin'
16567d_getmnt='$d_getmnt'
16568d_getmntent='$d_getmntent'
16569d_getnbyaddr='$d_getnbyaddr'
16570d_getnbyname='$d_getnbyname'
16571d_getnent='$d_getnent'
16572d_getnetprotos='$d_getnetprotos'
0c0643d0 16573d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
16574d_getpbyname='$d_getpbyname'
16575d_getpbynumber='$d_getpbynumber'
16576d_getpent='$d_getpent'
16577d_getpgid='$d_getpgid'
16578d_getpgrp2='$d_getpgrp2'
16579d_getpgrp='$d_getpgrp'
16580d_getppid='$d_getppid'
16581d_getprior='$d_getprior'
16582d_getprotoprotos='$d_getprotoprotos'
16583d_getprpwnam='$d_getprpwnam'
16584d_getpwent='$d_getpwent'
16585d_getsbyname='$d_getsbyname'
16586d_getsbyport='$d_getsbyport'
16587d_getsent='$d_getsent'
16588d_getservprotos='$d_getservprotos'
16589d_getspnam='$d_getspnam'
16590d_gettimeod='$d_gettimeod'
5f80c64f 16591d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
16592d_grpasswd='$d_grpasswd'
16593d_hasmntopt='$d_hasmntopt'
16594d_htonl='$d_htonl'
16595d_iconv='$d_iconv'
16596d_index='$d_index'
16597d_inetaton='$d_inetaton'
16598d_int64_t='$d_int64_t'
16599d_isascii='$d_isascii'
16600d_isnan='$d_isnan'
16601d_isnanl='$d_isnanl'
16602d_killpg='$d_killpg'
16603d_lchown='$d_lchown'
16604d_ldbl_dig='$d_ldbl_dig'
16605d_link='$d_link'
16606d_locconv='$d_locconv'
16607d_lockf='$d_lockf'
16608d_longdbl='$d_longdbl'
16609d_longlong='$d_longlong'
16610d_lseekproto='$d_lseekproto'
16611d_lstat='$d_lstat'
16612d_madvise='$d_madvise'
16613d_mblen='$d_mblen'
16614d_mbstowcs='$d_mbstowcs'
16615d_mbtowc='$d_mbtowc'
16616d_memchr='$d_memchr'
16617d_memcmp='$d_memcmp'
16618d_memcpy='$d_memcpy'
16619d_memmove='$d_memmove'
16620d_memset='$d_memset'
16621d_mkdir='$d_mkdir'
16622d_mkdtemp='$d_mkdtemp'
16623d_mkfifo='$d_mkfifo'
16624d_mkstemp='$d_mkstemp'
16625d_mkstemps='$d_mkstemps'
16626d_mktime='$d_mktime'
16627d_mmap='$d_mmap'
16628d_modfl='$d_modfl'
e67aeab1 16629d_modfl_pow32_bug='$d_modfl_pow32_bug'
b4eb6b3d
JH
16630d_mprotect='$d_mprotect'
16631d_msg='$d_msg'
16632d_msg_ctrunc='$d_msg_ctrunc'
16633d_msg_dontroute='$d_msg_dontroute'
16634d_msg_oob='$d_msg_oob'
16635d_msg_peek='$d_msg_peek'
16636d_msg_proxy='$d_msg_proxy'
16637d_msgctl='$d_msgctl'
16638d_msgget='$d_msgget'
4e0554ec 16639d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
16640d_msgrcv='$d_msgrcv'
16641d_msgsnd='$d_msgsnd'
16642d_msync='$d_msync'
16643d_munmap='$d_munmap'
16644d_mymalloc='$d_mymalloc'
16645d_nice='$d_nice'
16646d_nv_preserves_uv='$d_nv_preserves_uv'
16647d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16648d_off64_t='$d_off64_t'
16649d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16650d_oldpthreads='$d_oldpthreads'
16651d_oldsock='$d_oldsock'
16652d_open3='$d_open3'
16653d_pathconf='$d_pathconf'
16654d_pause='$d_pause'
16655d_perl_otherlibdirs='$d_perl_otherlibdirs'
16656d_phostname='$d_phostname'
16657d_pipe='$d_pipe'
16658d_poll='$d_poll'
5f80c64f 16659d_portable='$d_portable'
b4eb6b3d
JH
16660d_pthread_yield='$d_pthread_yield'
16661d_pwage='$d_pwage'
16662d_pwchange='$d_pwchange'
16663d_pwclass='$d_pwclass'
16664d_pwcomment='$d_pwcomment'
16665d_pwexpire='$d_pwexpire'
16666d_pwgecos='$d_pwgecos'
16667d_pwpasswd='$d_pwpasswd'
16668d_pwquota='$d_pwquota'
16669d_qgcvt='$d_qgcvt'
16670d_quad='$d_quad'
16671d_readdir='$d_readdir'
16672d_readlink='$d_readlink'
4e0554ec 16673d_readv='$d_readv'
640374d0 16674d_realpath='$d_realpath'
4e0554ec 16675d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
16676d_rename='$d_rename'
16677d_rewinddir='$d_rewinddir'
16678d_rmdir='$d_rmdir'
16679d_safebcpy='$d_safebcpy'
16680d_safemcpy='$d_safemcpy'
16681d_sanemcmp='$d_sanemcmp'
ef9f17be 16682d_sbrkproto='$d_sbrkproto'
b4eb6b3d
JH
16683d_sched_yield='$d_sched_yield'
16684d_scm_rights='$d_scm_rights'
16685d_seekdir='$d_seekdir'
16686d_select='$d_select'
16687d_sem='$d_sem'
16688d_semctl='$d_semctl'
16689d_semctl_semid_ds='$d_semctl_semid_ds'
16690d_semctl_semun='$d_semctl_semun'
16691d_semget='$d_semget'
16692d_semop='$d_semop'
4e0554ec 16693d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
16694d_setegid='$d_setegid'
16695d_seteuid='$d_seteuid'
16696d_setgrent='$d_setgrent'
16697d_setgrps='$d_setgrps'
16698d_sethent='$d_sethent'
4e0554ec 16699d_setitimer='$d_setitimer'
b4eb6b3d
JH
16700d_setlinebuf='$d_setlinebuf'
16701d_setlocale='$d_setlocale'
16702d_setnent='$d_setnent'
16703d_setpent='$d_setpent'
16704d_setpgid='$d_setpgid'
16705d_setpgrp2='$d_setpgrp2'
16706d_setpgrp='$d_setpgrp'
16707d_setprior='$d_setprior'
16708d_setproctitle='$d_setproctitle'
16709d_setpwent='$d_setpwent'
16710d_setregid='$d_setregid'
16711d_setresgid='$d_setresgid'
16712d_setresuid='$d_setresuid'
16713d_setreuid='$d_setreuid'
16714d_setrgid='$d_setrgid'
16715d_setruid='$d_setruid'
16716d_setsent='$d_setsent'
16717d_setsid='$d_setsid'
16718d_setvbuf='$d_setvbuf'
16719d_sfio='$d_sfio'
16720d_shm='$d_shm'
16721d_shmat='$d_shmat'
16722d_shmatprototype='$d_shmatprototype'
16723d_shmctl='$d_shmctl'
16724d_shmdt='$d_shmdt'
16725d_shmget='$d_shmget'
16726d_sigaction='$d_sigaction'
983dbef6 16727d_sigprocmask='$d_sigprocmask'
b4eb6b3d 16728d_sigsetjmp='$d_sigsetjmp'
49a78c82 16729d_sockatmark='$d_sockatmark'
2ef53570 16730d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
16731d_socket='$d_socket'
16732d_socklen_t='$d_socklen_t'
16733d_sockpair='$d_sockpair'
16734d_socks5_init='$d_socks5_init'
16735d_sqrtl='$d_sqrtl'
eef837ea 16736d_sresgproto='$d_sresgproto'
640374d0 16737d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
16738d_statblks='$d_statblks'
16739d_statfs_f_flags='$d_statfs_f_flags'
16740d_statfs_s='$d_statfs_s'
16741d_statvfs='$d_statvfs'
16742d_stdio_cnt_lval='$d_stdio_cnt_lval'
16743d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
16744d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16745d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
16746d_stdio_stream_array='$d_stdio_stream_array'
16747d_stdiobase='$d_stdiobase'
16748d_stdstdio='$d_stdstdio'
16749d_strchr='$d_strchr'
16750d_strcoll='$d_strcoll'
16751d_strctcpy='$d_strctcpy'
16752d_strerrm='$d_strerrm'
16753d_strerror='$d_strerror'
b3c85772 16754d_strftime='$d_strftime'
b4eb6b3d
JH
16755d_strtod='$d_strtod'
16756d_strtol='$d_strtol'
16757d_strtold='$d_strtold'
16758d_strtoll='$d_strtoll'
28e5dec8 16759d_strtoq='$d_strtoq'
b4eb6b3d
JH
16760d_strtoul='$d_strtoul'
16761d_strtoull='$d_strtoull'
16762d_strtouq='$d_strtouq'
16763d_strxfrm='$d_strxfrm'
16764d_suidsafe='$d_suidsafe'
16765d_symlink='$d_symlink'
16766d_syscall='$d_syscall'
2ef53570 16767d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
16768d_sysconf='$d_sysconf'
16769d_sysernlst='$d_sysernlst'
16770d_syserrlst='$d_syserrlst'
16771d_system='$d_system'
16772d_tcgetpgrp='$d_tcgetpgrp'
16773d_tcsetpgrp='$d_tcsetpgrp'
16774d_telldir='$d_telldir'
16775d_telldirproto='$d_telldirproto'
16776d_time='$d_time'
16777d_times='$d_times'
16778d_truncate='$d_truncate'
16779d_tzname='$d_tzname'
4e0554ec
JH
16780d_u32align='$d_u32align'
16781d_ualarm='$d_ualarm'
b4eb6b3d
JH
16782d_umask='$d_umask'
16783d_uname='$d_uname'
16784d_union_semun='$d_union_semun'
4e0554ec 16785d_usleep='$d_usleep'
2ef53570 16786d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
16787d_ustat='$d_ustat'
16788d_vendorarch='$d_vendorarch'
16789d_vendorbin='$d_vendorbin'
16790d_vendorlib='$d_vendorlib'
16791d_vfork='$d_vfork'
16792d_void_closedir='$d_void_closedir'
16793d_voidsig='$d_voidsig'
16794d_voidtty='$d_voidtty'
16795d_volatile='$d_volatile'
16796d_vprintf='$d_vprintf'
16797d_wait4='$d_wait4'
16798d_waitpid='$d_waitpid'
16799d_wcstombs='$d_wcstombs'
16800d_wctomb='$d_wctomb'
4e0554ec 16801d_writev='$d_writev'
5f80c64f
JH
16802d_xenix='$d_xenix'
16803date='$date'
b4eb6b3d
JH
16804db_hashtype='$db_hashtype'
16805db_prefixtype='$db_prefixtype'
640374d0
JH
16806db_version_major='$db_version_major'
16807db_version_minor='$db_version_minor'
16808db_version_patch='$db_version_patch'
b4eb6b3d
JH
16809defvoidused='$defvoidused'
16810direntrytype='$direntrytype'
16811dlext='$dlext'
5f80c64f 16812dlsrc='$dlsrc'
b4eb6b3d
JH
16813doublesize='$doublesize'
16814drand01='$drand01'
16815dynamic_ext='$dynamic_ext'
16816eagain='$eagain'
16817ebcdic='$ebcdic'
5f80c64f
JH
16818echo='$echo'
16819egrep='$egrep'
16820emacs='$emacs'
16821eunicefix='$eunicefix'
16822exe_ext='$exe_ext'
16823expr='$expr'
b4eb6b3d
JH
16824extensions='$extensions'
16825fflushNULL='$fflushNULL'
16826fflushall='$fflushall'
5f80c64f
JH
16827find='$find'
16828firstmakefile='$firstmakefile'
16829flex='$flex'
b4eb6b3d
JH
16830fpossize='$fpossize'
16831fpostype='$fpostype'
16832freetype='$freetype'
5440bc8e 16833from='$from'
b4eb6b3d
JH
16834full_ar='$full_ar'
16835full_csh='$full_csh'
16836full_sed='$full_sed'
5b463ca7 16837gccosandvers='$gccosandvers'
5f80c64f 16838gccversion='$gccversion'
b4eb6b3d
JH
16839gidformat='$gidformat'
16840gidsign='$gidsign'
16841gidsize='$gidsize'
16842gidtype='$gidtype'
5f80c64f
JH
16843glibpth='$glibpth'
16844grep='$grep'
b4eb6b3d
JH
16845groupcat='$groupcat'
16846groupstype='$groupstype'
5f80c64f 16847gzip='$gzip'
b4eb6b3d
JH
16848h_fcntl='$h_fcntl'
16849h_sysfile='$h_sysfile'
5f80c64f 16850hint='$hint'
b4eb6b3d
JH
16851hostcat='$hostcat'
16852i16size='$i16size'
16853i16type='$i16type'
16854i32size='$i32size'
16855i32type='$i32type'
16856i64size='$i64size'
16857i64type='$i64type'
16858i8size='$i8size'
16859i8type='$i8type'
16860i_arpainet='$i_arpainet'
16861i_bsdioctl='$i_bsdioctl'
16862i_db='$i_db'
16863i_dbm='$i_dbm'
16864i_dirent='$i_dirent'
5f80c64f 16865i_dld='$i_dld'
b4eb6b3d
JH
16866i_dlfcn='$i_dlfcn'
16867i_fcntl='$i_fcntl'
16868i_float='$i_float'
16869i_gdbm='$i_gdbm'
16870i_grp='$i_grp'
16871i_iconv='$i_iconv'
16872i_ieeefp='$i_ieeefp'
16873i_inttypes='$i_inttypes'
16874i_libutil='$i_libutil'
16875i_limits='$i_limits'
16876i_locale='$i_locale'
16877i_machcthr='$i_machcthr'
16878i_malloc='$i_malloc'
16879i_math='$i_math'
16880i_memory='$i_memory'
16881i_mntent='$i_mntent'
16882i_ndbm='$i_ndbm'
16883i_netdb='$i_netdb'
16884i_neterrno='$i_neterrno'
16885i_netinettcp='$i_netinettcp'
16886i_niin='$i_niin'
16887i_poll='$i_poll'
16888i_prot='$i_prot'
16889i_pthread='$i_pthread'
16890i_pwd='$i_pwd'
16891i_rpcsvcdbm='$i_rpcsvcdbm'
16892i_sfio='$i_sfio'
16893i_sgtty='$i_sgtty'
16894i_shadow='$i_shadow'
16895i_socks='$i_socks'
16896i_stdarg='$i_stdarg'
16897i_stddef='$i_stddef'
16898i_stdlib='$i_stdlib'
16899i_string='$i_string'
16900i_sunmath='$i_sunmath'
16901i_sysaccess='$i_sysaccess'
16902i_sysdir='$i_sysdir'
16903i_sysfile='$i_sysfile'
16904i_sysfilio='$i_sysfilio'
16905i_sysin='$i_sysin'
16906i_sysioctl='$i_sysioctl'
16907i_syslog='$i_syslog'
16908i_sysmman='$i_sysmman'
16909i_sysmode='$i_sysmode'
16910i_sysmount='$i_sysmount'
16911i_sysndir='$i_sysndir'
16912i_sysparam='$i_sysparam'
16913i_sysresrc='$i_sysresrc'
16914i_syssecrt='$i_syssecrt'
16915i_sysselct='$i_sysselct'
16916i_syssockio='$i_syssockio'
16917i_sysstat='$i_sysstat'
16918i_sysstatfs='$i_sysstatfs'
16919i_sysstatvfs='$i_sysstatvfs'
16920i_systime='$i_systime'
16921i_systimek='$i_systimek'
16922i_systimes='$i_systimes'
16923i_systypes='$i_systypes'
16924i_sysuio='$i_sysuio'
16925i_sysun='$i_sysun'
16926i_sysutsname='$i_sysutsname'
16927i_sysvfs='$i_sysvfs'
16928i_syswait='$i_syswait'
16929i_termio='$i_termio'
16930i_termios='$i_termios'
16931i_time='$i_time'
16932i_unistd='$i_unistd'
16933i_ustat='$i_ustat'
16934i_utime='$i_utime'
16935i_values='$i_values'
16936i_varargs='$i_varargs'
16937i_varhdr='$i_varhdr'
16938i_vfork='$i_vfork'
5f80c64f 16939ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
16940inc_version_list='$inc_version_list'
16941inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
16942incpath='$incpath'
16943inews='$inews'
b4eb6b3d
JH
16944installarchlib='$installarchlib'
16945installbin='$installbin'
16946installman1dir='$installman1dir'
16947installman3dir='$installman3dir'
16948installprefix='$installprefix'
16949installprefixexp='$installprefixexp'
16950installprivlib='$installprivlib'
16951installscript='$installscript'
16952installsitearch='$installsitearch'
16953installsitebin='$installsitebin'
16954installsitelib='$installsitelib'
16955installstyle='$installstyle'
16956installusrbinperl='$installusrbinperl'
16957installvendorarch='$installvendorarch'
16958installvendorbin='$installvendorbin'
16959installvendorlib='$installvendorlib'
16960intsize='$intsize'
4b661809 16961issymlink='$issymlink'
b4eb6b3d
JH
16962ivdformat='$ivdformat'
16963ivsize='$ivsize'
16964ivtype='$ivtype'
16965known_extensions='$known_extensions'
5f80c64f 16966ksh='$ksh'
5f80c64f
JH
16967ld='$ld'
16968lddlflags='$lddlflags'
16969ldflags='$ldflags'
b4eb6b3d
JH
16970ldflags_uselargefiles='$ldflags_uselargefiles'
16971ldlibpthname='$ldlibpthname'
5f80c64f
JH
16972less='$less'
16973lib_ext='$lib_ext'
16974libc='$libc'
b4eb6b3d 16975libperl='$libperl'
5f80c64f
JH
16976libpth='$libpth'
16977libs='$libs'
43999f95
JH
16978libsdirs='$libsdirs'
16979libsfiles='$libsfiles'
16980libsfound='$libsfound'
13b3f787 16981libspath='$libspath'
5f80c64f 16982libswanted='$libswanted'
b4eb6b3d 16983libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
16984line='$line'
16985lint='$lint'
16986lkflags='$lkflags'
16987ln='$ln'
16988lns='$lns'
16989locincpth='$locincpth'
16990loclibpth='$loclibpth'
b4eb6b3d
JH
16991longdblsize='$longdblsize'
16992longlongsize='$longlongsize'
16993longsize='$longsize'
5f80c64f
JH
16994lp='$lp'
16995lpr='$lpr'
16996ls='$ls'
b4eb6b3d
JH
16997lseeksize='$lseeksize'
16998lseektype='$lseektype'
5f80c64f
JH
16999mail='$mail'
17000mailx='$mailx'
17001make='$make'
17002make_set_make='$make_set_make'
b4eb6b3d
JH
17003mallocobj='$mallocobj'
17004mallocsrc='$mallocsrc'
17005malloctype='$malloctype'
17006man1dir='$man1dir'
17007man1direxp='$man1direxp'
17008man1ext='$man1ext'
17009man3dir='$man3dir'
17010man3direxp='$man3direxp'
17011man3ext='$man3ext'
5f80c64f
JH
17012mips_type='$mips_type'
17013mkdir='$mkdir'
b4eb6b3d
JH
17014mmaptype='$mmaptype'
17015modetype='$modetype'
5f80c64f 17016more='$more'
b4eb6b3d 17017multiarch='$multiarch'
5f80c64f 17018mv='$mv'
b4eb6b3d
JH
17019myarchname='$myarchname'
17020mydomain='$mydomain'
17021myhostname='$myhostname'
5f80c64f
JH
17022myuname='$myuname'
17023n='$n'
2cc61e15 17024need_va_copy='$need_va_copy'
b4eb6b3d
JH
17025netdb_hlen_type='$netdb_hlen_type'
17026netdb_host_type='$netdb_host_type'
17027netdb_name_type='$netdb_name_type'
17028netdb_net_type='$netdb_net_type'
5f80c64f
JH
17029nm='$nm'
17030nm_opt='$nm_opt'
17031nm_so_opt='$nm_so_opt'
b4eb6b3d 17032nonxs_ext='$nonxs_ext'
5f80c64f 17033nroff='$nroff'
b4eb6b3d
JH
17034nvEUformat='$nvEUformat'
17035nvFUformat='$nvFUformat'
17036nvGUformat='$nvGUformat'
17037nveformat='$nveformat'
17038nvfformat='$nvfformat'
17039nvgformat='$nvgformat'
17040nvsize='$nvsize'
17041nvtype='$nvtype'
17042o_nonblock='$o_nonblock'
5f80c64f 17043obj_ext='$obj_ext'
b4eb6b3d 17044old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 17045optimize='$optimize'
b4eb6b3d 17046orderlib='$orderlib'
5f80c64f
JH
17047osname='$osname'
17048osvers='$osvers'
b4eb6b3d 17049otherlibdirs='$otherlibdirs'
5f80c64f 17050package='$package'
b4eb6b3d
JH
17051pager='$pager'
17052passcat='$passcat'
17053patchlevel='$patchlevel'
5f80c64f 17054path_sep='$path_sep'
b4eb6b3d 17055perl5='$perl5'
5f80c64f 17056perl='$perl'
151e6568 17057perl_patchlevel='$perl_patchlevel'
b4eb6b3d 17058perladmin='$perladmin'
9c839522 17059perllibs='$perllibs'
b4eb6b3d 17060perlpath='$perlpath'
5f80c64f 17061pg='$pg'
b4eb6b3d
JH
17062phostname='$phostname'
17063pidtype='$pidtype'
5f80c64f 17064plibpth='$plibpth'
b4eb6b3d 17065pm_apiversion='$pm_apiversion'
5f80c64f
JH
17066pmake='$pmake'
17067pr='$pr'
b4eb6b3d
JH
17068prefix='$prefix'
17069prefixexp='$prefixexp'
17070privlib='$privlib'
17071privlibexp='$privlibexp'
17072prototype='$prototype'
17073ptrsize='$ptrsize'
17074quadkind='$quadkind'
17075quadtype='$quadtype'
17076randbits='$randbits'
17077randfunc='$randfunc'
17078randseedtype='$randseedtype'
17079ranlib='$ranlib'
17080rd_nodata='$rd_nodata'
17081revision='$revision'
5f80c64f
JH
17082rm='$rm'
17083rmail='$rmail'
5440bc8e 17084run='$run'
5f80c64f 17085runnm='$runnm'
b4eb6b3d
JH
17086sPRIEUldbl='$sPRIEUldbl'
17087sPRIFUldbl='$sPRIFUldbl'
17088sPRIGUldbl='$sPRIGUldbl'
17089sPRIXU64='$sPRIXU64'
17090sPRId64='$sPRId64'
17091sPRIeldbl='$sPRIeldbl'
17092sPRIfldbl='$sPRIfldbl'
17093sPRIgldbl='$sPRIgldbl'
17094sPRIi64='$sPRIi64'
17095sPRIo64='$sPRIo64'
17096sPRIu64='$sPRIu64'
17097sPRIx64='$sPRIx64'
17098sSCNfldbl='$sSCNfldbl'
17099sched_yield='$sched_yield'
17100scriptdir='$scriptdir'
17101scriptdirexp='$scriptdirexp'
5f80c64f 17102sed='$sed'
b4eb6b3d
JH
17103seedfunc='$seedfunc'
17104selectminbits='$selectminbits'
17105selecttype='$selecttype'
5f80c64f
JH
17106sendmail='$sendmail'
17107sh='$sh'
17108shar='$shar'
17109sharpbang='$sharpbang'
b4eb6b3d
JH
17110shmattype='$shmattype'
17111shortsize='$shortsize'
17112shrpenv='$shrpenv'
5f80c64f 17113shsharp='$shsharp'
b4eb6b3d
JH
17114sig_count='$sig_count'
17115sig_name='$sig_name'
17116sig_name_init='$sig_name_init'
17117sig_num='$sig_num'
17118sig_num_init='$sig_num_init'
76d3c696 17119sig_size='$sig_size'
b4eb6b3d
JH
17120signal_t='$signal_t'
17121sitearch='$sitearch'
17122sitearchexp='$sitearchexp'
17123sitebin='$sitebin'
17124sitebinexp='$sitebinexp'
17125sitelib='$sitelib'
17126sitelib_stem='$sitelib_stem'
17127sitelibexp='$sitelibexp'
17128siteprefix='$siteprefix'
17129siteprefixexp='$siteprefixexp'
17130sizesize='$sizesize'
17131sizetype='$sizetype'
5f80c64f
JH
17132sleep='$sleep'
17133smail='$smail'
5f80c64f 17134so='$so'
b4eb6b3d
JH
17135sockethdr='$sockethdr'
17136socketlib='$socketlib'
17137socksizetype='$socksizetype'
5f80c64f
JH
17138sort='$sort'
17139spackage='$spackage'
17140spitshell='$spitshell'
5f80c64f 17141src='$src'
b4eb6b3d
JH
17142ssizetype='$ssizetype'
17143startperl='$startperl'
5f80c64f 17144startsh='$startsh'
b4eb6b3d
JH
17145static_ext='$static_ext'
17146stdchar='$stdchar'
17147stdio_base='$stdio_base'
17148stdio_bufsiz='$stdio_bufsiz'
17149stdio_cnt='$stdio_cnt'
17150stdio_filbuf='$stdio_filbuf'
17151stdio_ptr='$stdio_ptr'
17152stdio_stream_array='$stdio_stream_array'
17153strings='$strings'
5f80c64f 17154submit='$submit'
b4eb6b3d
JH
17155subversion='$subversion'
17156sysman='$sysman'
5f80c64f
JH
17157tail='$tail'
17158tar='$tar'
5440bc8e 17159targetarch='$targetarch'
5f80c64f
JH
17160tbl='$tbl'
17161tee='$tee'
17162test='$test'
b4eb6b3d
JH
17163timeincl='$timeincl'
17164timetype='$timetype'
5440bc8e 17165to='$to'
5f80c64f
JH
17166touch='$touch'
17167tr='$tr'
17168trnl='$trnl'
17169troff='$troff'
b4eb6b3d
JH
17170u16size='$u16size'
17171u16type='$u16type'
17172u32size='$u32size'
17173u32type='$u32type'
17174u64size='$u64size'
17175u64type='$u64type'
17176u8size='$u8size'
17177u8type='$u8type'
17178uidformat='$uidformat'
17179uidsign='$uidsign'
17180uidsize='$uidsize'
17181uidtype='$uidtype'
5f80c64f
JH
17182uname='$uname'
17183uniq='$uniq'
b4eb6b3d
JH
17184uquadtype='$uquadtype'
17185use5005threads='$use5005threads'
17186use64bitall='$use64bitall'
17187use64bitint='$use64bitint'
5440bc8e 17188usecrosscompile='$usecrosscompile'
5f80c64f 17189usedl='$usedl'
b4eb6b3d
JH
17190useithreads='$useithreads'
17191uselargefiles='$uselargefiles'
17192uselongdouble='$uselongdouble'
17193usemorebits='$usemorebits'
17194usemultiplicity='$usemultiplicity'
17195usemymalloc='$usemymalloc'
5f80c64f 17196usenm='$usenm'
b4eb6b3d
JH
17197useopcode='$useopcode'
17198useperlio='$useperlio'
17199useposix='$useposix'
9514c62b 17200usereentrant='$usereentrant'
b4eb6b3d
JH
17201usesfio='$usesfio'
17202useshrplib='$useshrplib'
29209bc5 17203usesocks='$usesocks'
b4eb6b3d
JH
17204usethreads='$usethreads'
17205usevendorprefix='$usevendorprefix'
17206usevfork='$usevfork'
5f80c64f
JH
17207usrinc='$usrinc'
17208uuname='$uuname'
b4eb6b3d
JH
17209uvXUformat='$uvXUformat'
17210uvoformat='$uvoformat'
17211uvsize='$uvsize'
17212uvtype='$uvtype'
17213uvuformat='$uvuformat'
17214uvxformat='$uvxformat'
17215vendorarch='$vendorarch'
17216vendorarchexp='$vendorarchexp'
17217vendorbin='$vendorbin'
17218vendorbinexp='$vendorbinexp'
17219vendorlib='$vendorlib'
17220vendorlib_stem='$vendorlib_stem'
17221vendorlibexp='$vendorlibexp'
17222vendorprefix='$vendorprefix'
17223vendorprefixexp='$vendorprefixexp'
17224version='$version'
d56c5707 17225versiononly='$versiononly'
5f80c64f 17226vi='$vi'
b4eb6b3d 17227voidflags='$voidflags'
5f80c64f 17228xlibpth='$xlibpth'
b4eb6b3d 17229xs_apiversion='$xs_apiversion'
3659ebf1
JH
17230yacc='$yacc'
17231yaccflags='$yaccflags'
5f80c64f
JH
17232zcat='$zcat'
17233zip='$zip'
17234EOT
17235
17236: Add in command line options if available
17237$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
17238
17239: add special variables
17240$test -f $src/patchlevel.h && \
d00b958f 17241awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 17242echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 17243echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
17244
17245: propagate old symbols
17246if $test -f UU/config.sh; then
381aa1ff 17247 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 17248 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 17249 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
17250 set X `cat UU/oldsyms`
17251 shift
17252 case $# in
17253 0) ;;
17254 *)
17255 cat <<EOM
17256Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
17257EOM
17258 echo "# Variables propagated from previous config.sh file." >>config.sh
17259 for sym in `cat UU/oldsyms`; do
17260 echo " Propagating $hint variable "'$'"$sym..."
17261 eval 'tmp="$'"${sym}"'"'
17262 echo "$tmp" | \
17263 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
17264 done
17265 ;;
17266 esac
17267fi
17268
17269: Finish up by extracting the .SH files
17270case "$alldone" in
17271exit)
17272 $rm -rf UU
24ccb310 17273 echo "Extraction done."
5f80c64f
JH
17274 exit 0
17275 ;;
17276cont)
17277 ;;
17278'')
17279 dflt=''
17280 nostick=true
17281 $cat <<EOM
17282
17283If you'd like to make any changes to the config.sh file before I begin
17284to configure things, do it as a shell escape now (e.g. !vi config.sh).
17285
17286EOM
17287 rp="Press return or use a shell escape to edit config.sh:"
17288 . UU/myread
17289 nostick=''
17290 case "$ans" in
17291 '') ;;
17292 *) : in case they cannot read
17293 sh 1>&4 -c "$ans";;
17294 esac
17295 ;;
17296esac
17297
17298: if this fails, just run all the .SH files by hand
17299. ./config.sh
17300
17301echo " "
17302exec 1>&4
a43e8593 17303pwd=`pwd`
5f80c64f 17304. ./UU/extract
a43e8593 17305cd $pwd
5f80c64f
JH
17306
17307if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
17308 dflt=y
17309 case "$silent" in
17310 true) ;;
17311 *)
17312 $cat <<EOM
17313
17314Now you need to generate make dependencies by running "$make depend".
17315You might prefer to run it in background: "$make depend > makedepend.out &"
17316It can take a while, so you might not want to run it right now.
17317
17318EOM
17319 ;;
17320 esac
17321 rp="Run $make depend now?"
17322 . UU/myread
17323 case "$ans" in
17324 y*)
3d5d58b1 17325 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
17326 ;;
17327 *)
17328 echo "You must run '$make depend' then '$make'."
17329 ;;
17330 esac
17331elif test -f [Mm]akefile; then
17332 echo " "
17333 echo "Now you must run a $make."
17334else
24ccb310 17335 echo "Configure done."
5f80c64f
JH
17336fi
17337
17338if $test -f Policy.sh; then
17339 $cat <<EOM
17340
17341If you compile $package on a different machine or from a different object
17342directory, copy the Policy.sh file from this object directory to the
17343new one before you run Configure -- this will help you with most of
17344the policy defaults.
17345
17346EOM
17347fi
17348if $test -f config.msg; then
17349 echo "Hmm. I also noted the following information while running:"
17350 echo " "
17351 $cat config.msg >&4
17352 $rm -f config.msg
17353fi
17354$rm -f kit*isdone ark*isdone
17355$rm -rf UU
17356
17357: End of Configure
17358