This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate changes #8853,8854 from maintperl to mainline.
[perl5.git] / Configure
CommitLineData
2304df62
AD
1#! /bin/sh
2#
3# If these # comments don't work, trim them. Don't worry about any other
4# shell scripts, Configure will trim # comments from them for you.
5#
6# (If you are trying to port this package to a machine without sh,
7# I would suggest you have a look at the prototypical config_h.SH file
8# and edit it to reflect your system. Some packages may include samples
9# of config.h for certain machines, so you might look for one of those.)
10#
11# Yes, you may rip this off to use in other distribution packages. This
12# script belongs to the public domain and cannot be copyrighted.
13#
14# (Note: this Configure script was generated automatically. Rather than
15# working with this copy of Configure, you may wish to get metaconfig.
16# The dist-3.0 package (which contains metaconfig) was posted in
dfe9444c
AD
17# comp.sources.misc and is available on CPAN under authors/id/RAM so
18# you may fetch it yourself from your nearest archive site.)
2304df62
AD
19#
20
dfe9444c 21# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
2304df62 22#
8feeef0e 23# Generated on Sat Feb 3 18:24:21 EET 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=''
9c839522 168perllibs=''
b4eb6b3d
JH
169dynamic_ext=''
170extensions=''
171known_extensions=''
172nonxs_ext=''
173static_ext=''
174useopcode=''
175useposix=''
ecfc5424 176d_bsd=''
40a7a20a 177d_eunice=''
2304df62
AD
178d_xenix=''
179eunicefix=''
180Mcc=''
dfe9444c 181ar=''
2304df62
AD
182awk=''
183bash=''
184bison=''
185byacc=''
186cat=''
187chgrp=''
188chmod=''
189chown=''
ecfc5424 190comm=''
2304df62
AD
191compress=''
192cp=''
193cpio=''
194cpp=''
195csh=''
196date=''
197echo=''
198egrep=''
199emacs=''
200expr=''
201find=''
202flex=''
2304df62 203grep=''
8ff267be 204gzip=''
2304df62
AD
205inews=''
206ksh=''
207less=''
208line=''
209lint=''
210ln=''
211lp=''
212lpr=''
213ls=''
214mail=''
215mailx=''
dfe9444c 216make=''
2304df62
AD
217mkdir=''
218more=''
219mv=''
693762b4 220nm=''
2304df62
AD
221nroff=''
222perl=''
223pg=''
224pmake=''
225pr=''
226rm=''
227rmail=''
228sed=''
229sendmail=''
2304df62
AD
230shar=''
231sleep=''
232smail=''
233sort=''
234submit=''
235tail=''
236tar=''
237tbl=''
693762b4 238tee=''
2304df62
AD
239test=''
240touch=''
241tr=''
242troff=''
243uname=''
244uniq=''
245uuname=''
246vi=''
247zcat=''
8ff267be 248zip=''
b4eb6b3d
JH
249full_ar=''
250full_sed=''
a0d0e21e 251libswanted=''
2304df62
AD
252hint=''
253myuname=''
85e6fe83
LW
254osname=''
255osvers=''
2304df62
AD
256Author=''
257Date=''
258Header=''
259Id=''
260Locker=''
261Log=''
262RCSfile=''
263Revision=''
264Source=''
265State=''
dfe9444c
AD
266_a=''
267_exe=''
268_o=''
4633a7c4
LW
269archobjs=''
270exe_ext=''
271firstmakefile=''
272lib_ext=''
273obj_ext=''
274path_sep=''
b4eb6b3d
JH
275afs=''
276alignbytes=''
277ansi2knr=''
278archlib=''
279archlibexp=''
280d_archlib=''
281installarchlib=''
282archname=''
283myarchname=''
284d_atolf=''
285d_atoll=''
286baserev=''
287bin=''
288binexp=''
289installbin=''
290bincompat5005=''
291d_bincompat5005=''
292byteorder=''
2304df62 293cc=''
2304df62
AD
294ccflags=''
295cppflags=''
296ldflags=''
297lkflags=''
8e07c86e 298locincpth=''
2304df62 299optimize=''
b4eb6b3d 300cf_email=''
2304df62
AD
301cf_by=''
302cf_time=''
b4eb6b3d 303charsize=''
2304df62 304contains=''
b4eb6b3d 305cpp_stuff=''
2304df62
AD
306cpplast=''
307cppminus=''
308cpprun=''
309cppstdin=''
b4eb6b3d 310crosscompile=''
74cac757 311d__fwalk=''
b4eb6b3d
JH
312d_access=''
313d_accessx=''
314d_alarm=''
315d_attribut=''
316d_bcmp=''
317d_bcopy=''
318d_bzero=''
319d_casti32=''
320castflags=''
321d_castneg=''
322d_chown=''
323d_chroot=''
324d_chsize=''
325d_closedir=''
326d_void_closedir=''
327d_const=''
328cryptlib=''
329d_crypt=''
330d_csh=''
331full_csh=''
332d_cuserid=''
333d_dbl_dig=''
334d_difftime=''
335d_dlerror=''
a0d0e21e 336d_dlopen=''
b4eb6b3d
JH
337d_dlsymun=''
338d_dosuid=''
339d_suidsafe=''
340d_drand48proto=''
341d_dup2=''
342d_eaccess=''
343d_endgrent=''
344d_endhent=''
345d_endnent=''
346d_endpent=''
347d_endpwent=''
348d_endsent=''
349d_fchmod=''
350d_fchown=''
351d_fcntl=''
9d9004a9 352d_fcntl_can_lock=''
b4eb6b3d
JH
353d_fd_macros=''
354d_fd_set=''
355d_fds_bits=''
356d_fgetpos=''
357d_flexfnam=''
358d_flock=''
359d_fork=''
360d_fpos64_t=''
361d_frexpl=''
362d_fs_data_s=''
363d_fseeko=''
364d_fsetpos=''
365d_fstatfs=''
411ab01c 366d_fsync=''
b4eb6b3d
JH
367d_ftello=''
368d_ftime=''
369d_gettimeod=''
370d_Gconvert=''
371d_getcwd=''
372d_getespwnam=''
373d_getfsstat=''
374d_getgrent=''
375d_getgrps=''
376d_gethbyaddr=''
377d_gethbyname=''
378d_gethent=''
379aphostname=''
380d_gethname=''
381d_phostname=''
382d_uname=''
383d_gethostprotos=''
384d_getlogin=''
385d_getmnt=''
386d_getmntent=''
387d_getnbyaddr=''
388d_getnbyname=''
389d_getnent=''
390d_getnetprotos=''
0c0643d0 391d_getpagsz=''
b4eb6b3d
JH
392d_getpent=''
393d_getpgid=''
394d_getpgrp2=''
395d_bsdgetpgrp=''
396d_getpgrp=''
397d_getppid=''
398d_getprior=''
399d_getpbyname=''
400d_getpbynumber=''
401d_getprotoprotos=''
402d_getprpwnam=''
403d_getpwent=''
404d_getsent=''
405d_getservprotos=''
406d_getspnam=''
407d_getsbyname=''
408d_getsbyport=''
a4f3eea9 409d_gnulibc=''
b4eb6b3d
JH
410d_hasmntopt=''
411d_htonl=''
412d_iconv=''
413d_inetaton=''
414d_int64_t=''
415d_isascii=''
416d_isnan=''
417d_isnanl=''
418d_killpg=''
419d_lchown=''
420d_ldbl_dig=''
421d_link=''
422d_locconv=''
423d_lockf=''
424d_longdbl=''
425longdblsize=''
426d_longlong=''
427longlongsize=''
428d_lseekproto=''
429d_lstat=''
430d_madvise=''
431d_mblen=''
432d_mbstowcs=''
433d_mbtowc=''
434d_memchr=''
435d_memcmp=''
436d_memcpy=''
437d_memmove=''
438d_memset=''
439d_mkdir=''
440d_mkdtemp=''
441d_mkfifo=''
442d_mkstemp=''
443d_mkstemps=''
444d_mktime=''
445d_mmap=''
446mmaptype=''
447d_modfl=''
448d_mprotect=''
449d_msg=''
450d_msgctl=''
451d_msgget=''
452d_msgrcv=''
453d_msgsnd=''
454d_msync=''
455d_munmap=''
456d_nice=''
457d_off64_t=''
458d_open3=''
459d_fpathconf=''
460d_pathconf=''
461d_pause=''
462d_pipe=''
463d_poll=''
2304df62 464d_portable=''
b4eb6b3d
JH
465d_old_pthread_create_joinable=''
466old_pthread_create_joinable=''
467d_pthread_yield=''
468d_sched_yield=''
469sched_yield=''
470d_qgcvt=''
471d_readdir=''
472d_rewinddir=''
473d_seekdir=''
474d_telldir=''
475d_readlink=''
476d_rename=''
477d_rmdir=''
478d_safebcpy=''
479d_safemcpy=''
480d_sanemcmp=''
ef9f17be 481d_sbrkproto=''
b4eb6b3d
JH
482d_select=''
483d_sem=''
484d_semctl=''
485d_semget=''
486d_semop=''
487d_setegid=''
488d_seteuid=''
489d_setgrent=''
490d_setgrps=''
491d_sethent=''
492d_setlinebuf=''
493d_setlocale=''
494d_setnent=''
495d_setpent=''
496d_setpgid=''
497d_setpgrp2=''
498d_bsdsetpgrp=''
499d_setpgrp=''
500d_setprior=''
501d_setproctitle=''
502d_setpwent=''
503d_setregid=''
504d_setresgid=''
505d_setresuid=''
506d_setreuid=''
507d_setrgid=''
508d_setruid=''
509d_setsent=''
510d_setsid=''
511d_setvbuf=''
512d_sfio=''
513usesfio=''
514d_shm=''
515d_shmat=''
516d_shmatprototype=''
517shmattype=''
518d_shmctl=''
519d_shmdt=''
520d_shmget=''
521d_sigaction=''
983dbef6 522d_sigprocmask=''
b4eb6b3d
JH
523d_sigsetjmp=''
524d_msg_ctrunc=''
525d_msg_dontroute=''
526d_msg_oob=''
527d_msg_peek=''
528d_msg_proxy=''
529d_oldsock=''
530d_scm_rights=''
531d_socket=''
532d_sockpair=''
533sockethdr=''
534socketlib=''
535d_socklen_t=''
536d_socks5_init=''
537d_sqrtl=''
538d_statblks=''
539d_statfs_f_flags=''
540d_statfs_s=''
541d_fstatvfs=''
542d_statvfs=''
543d_stdio_cnt_lval=''
544d_stdio_ptr_lval=''
a7ffa9b9
NC
545d_stdio_ptr_lval_nochange_cnt=''
546d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
547d_stdiobase=''
548d_stdstdio=''
549stdio_base=''
550stdio_bufsiz=''
551stdio_cnt=''
552stdio_filbuf=''
553stdio_ptr=''
554d_index=''
555d_strchr=''
556d_strcoll=''
557d_strctcpy=''
558d_strerrm=''
559d_strerror=''
560d_sysernlst=''
561d_syserrlst=''
562d_strtod=''
563d_strtol=''
564d_strtold=''
565d_strtoll=''
28e5dec8 566d_strtoq=''
b4eb6b3d
JH
567d_strtoul=''
568d_strtoull=''
569d_strtouq=''
570d_strxfrm=''
571d_symlink=''
572d_syscall=''
573d_sysconf=''
574d_system=''
575d_tcgetpgrp=''
576d_tcsetpgrp=''
577d_telldirproto=''
578d_time=''
579timetype=''
580clocktype=''
581d_times=''
582d_truncate=''
583d_tzname=''
584d_umask=''
585d_semctl_semid_ds=''
586d_semctl_semun=''
587d_union_semun=''
588d_ustat=''
589d_vfork=''
590usevfork=''
591d_voidsig=''
592signal_t=''
593d_volatile=''
594d_charvspr=''
595d_vprintf=''
596d_wait4=''
597d_waitpid=''
598d_wcstombs=''
599d_wctomb=''
600dlext=''
85e6fe83
LW
601cccdlflags=''
602ccdlflags=''
2304df62 603dlsrc=''
232e078e 604ld=''
85e6fe83 605lddlflags=''
2304df62 606usedl=''
b4eb6b3d
JH
607doublesize=''
608ebcdic=''
609fflushNULL=''
610fflushall=''
611fpossize=''
612fpostype=''
5b463ca7 613gccosandvers=''
8a27cf78 614gccversion=''
b4eb6b3d
JH
615gidformat=''
616gidsign=''
617gidsize=''
618gidtype=''
619groupstype=''
620h_fcntl=''
621h_sysfile=''
622i_arpainet=''
623db_hashtype=''
624db_prefixtype=''
625i_db=''
626i_dbm=''
627i_rpcsvcdbm=''
628d_dirnamlen=''
629direntrytype=''
630i_dirent=''
a0d0e21e 631i_dld=''
b4eb6b3d
JH
632i_dlfcn=''
633i_fcntl=''
634i_float=''
635i_gdbm=''
636d_grpasswd=''
637i_grp=''
638i_iconv=''
639i_ieeefp=''
640i_inttypes=''
641i_libutil=''
642i_limits=''
643i_locale=''
644i_machcthr=''
645i_malloc=''
646i_math=''
647i_memory=''
648i_mntent=''
649i_ndbm=''
650i_netdb=''
651i_neterrno=''
652i_netinettcp=''
653i_niin=''
654i_sysin=''
655i_poll=''
656i_prot=''
657i_pthread=''
658d_pwage=''
659d_pwchange=''
660d_pwclass=''
661d_pwcomment=''
662d_pwexpire=''
663d_pwgecos=''
664d_pwpasswd=''
665d_pwquota=''
666i_pwd=''
667i_sfio=''
668i_shadow=''
669i_socks=''
670i_stddef=''
671i_stdlib=''
672i_string=''
673strings=''
674i_sunmath=''
675i_sysaccess=''
676i_sysdir=''
677i_sysfile=''
678d_voidtty=''
679i_bsdioctl=''
680i_sysfilio=''
681i_sysioctl=''
682i_syssockio=''
683i_syslog=''
684i_sysmman=''
685i_sysmode=''
686i_sysmount=''
687i_sysndir=''
688i_sysparam=''
689i_sysresrc=''
690i_syssecrt=''
691i_sysselct=''
692i_sysstat=''
693i_sysstatfs=''
694i_sysstatvfs=''
695i_systimes=''
696i_systypes=''
697i_sysuio=''
698i_sysun=''
699i_sysutsname=''
700i_sysvfs=''
701i_syswait=''
702i_sgtty=''
703i_termio=''
704i_termios=''
705i_systime=''
706i_systimek=''
707i_time=''
708timeincl=''
709i_unistd=''
710i_ustat=''
711i_utime=''
712i_values=''
713i_stdarg=''
714i_varargs=''
715i_varhdr=''
716i_vfork=''
717inc_version_list=''
718inc_version_list_init=''
719installprefix=''
720installprefixexp=''
721installstyle=''
722installusrbinperl=''
723intsize=''
724longsize=''
725shortsize=''
4b661809 726issymlink=''
2304df62 727libc=''
b4eb6b3d
JH
728ldlibpthname=''
729libperl=''
730shrpenv=''
731useshrplib=''
a0d0e21e 732glibpth=''
2304df62 733libpth=''
8e07c86e 734loclibpth=''
2304df62
AD
735plibpth=''
736xlibpth=''
1cfa4ec7 737ignore_versioned_solibs=''
2304df62 738libs=''
43999f95
JH
739libsdirs=''
740libsfiles=''
741libsfound=''
13b3f787 742libspath=''
85e6fe83 743lns=''
b4eb6b3d
JH
744d_PRIEUldbl=''
745d_PRIFUldbl=''
746d_PRIGUldbl=''
747d_PRIeldbl=''
748d_PRIfldbl=''
749d_PRIgldbl=''
750d_SCNfldbl=''
751sPRIEUldbl=''
752sPRIFUldbl=''
753sPRIGUldbl=''
754sPRIeldbl=''
755sPRIfldbl=''
756sPRIgldbl=''
757sSCNfldbl=''
758lseeksize=''
759lseektype=''
8ff267be 760make_set_make=''
b4eb6b3d
JH
761d_mymalloc=''
762freetype=''
763mallocobj=''
764mallocsrc=''
765malloctype=''
766usemymalloc=''
767installman1dir=''
768man1dir=''
769man1direxp=''
770man1ext=''
771installman3dir=''
772man3dir=''
773man3direxp=''
774man3ext=''
775modetype=''
776multiarch=''
777mydomain=''
778myhostname=''
779phostname=''
2304df62
AD
780c=''
781n=''
b4eb6b3d
JH
782d_eofnblk=''
783eagain=''
784o_nonblock=''
785rd_nodata=''
2cc61e15 786need_va_copy=''
b4eb6b3d
JH
787netdb_hlen_type=''
788netdb_host_type=''
789netdb_name_type=''
790netdb_net_type=''
791groupcat=''
792hostcat=''
793passcat=''
794orderlib=''
795ranlib=''
796d_perl_otherlibdirs=''
797otherlibdirs=''
2304df62
AD
798package=''
799spackage=''
b4eb6b3d
JH
800pager=''
801api_revision=''
802api_subversion=''
803api_version=''
804api_versionstring=''
805patchlevel=''
806revision=''
807subversion=''
808version=''
809perl5=''
810perladmin=''
811perlpath=''
812d_nv_preserves_uv=''
813d_nv_preserves_uv_bits=''
814i16size=''
815i16type=''
816i32size=''
817i32type=''
818i64size=''
819i64type=''
820i8size=''
821i8type=''
822ivsize=''
823ivtype=''
824nvsize=''
825nvtype=''
826u16size=''
827u16type=''
828u32size=''
829u32type=''
830u64size=''
831u64type=''
832u8size=''
833u8type=''
834uvsize=''
835uvtype=''
836ivdformat=''
837nvEUformat=''
838nvFUformat=''
839nvGUformat=''
840nveformat=''
841nvfformat=''
842nvgformat=''
843uvXUformat=''
844uvoformat=''
845uvuformat=''
846uvxformat=''
847pidtype=''
848prefix=''
849prefixexp=''
850installprivlib=''
851privlib=''
852privlibexp=''
853prototype=''
854ptrsize=''
855d_PRIXU64=''
856d_PRId64=''
857d_PRIi64=''
858d_PRIo64=''
859d_PRIu64=''
860d_PRIx64=''
861sPRIXU64=''
862sPRId64=''
863sPRIi64=''
864sPRIo64=''
865sPRIu64=''
866sPRIx64=''
867d_quad=''
868quadkind=''
869quadtype=''
870uquadtype=''
871drand01=''
872randbits=''
873randfunc=''
874randseedtype=''
875seedfunc=''
876installscript=''
877scriptdir=''
878scriptdirexp=''
879selectminbits=''
880selecttype=''
8ff267be 881sh=''
b4eb6b3d
JH
882sig_count=''
883sig_name=''
884sig_name_init=''
885sig_num=''
886sig_num_init=''
76d3c696 887sig_size=''
b4eb6b3d
JH
888installsitearch=''
889sitearch=''
890sitearchexp=''
891installsitebin=''
892sitebin=''
893sitebinexp=''
894installsitelib=''
895sitelib=''
896sitelib_stem=''
897sitelibexp=''
898siteprefix=''
899siteprefixexp=''
900sizesize=''
901sizetype=''
a0d0e21e 902so=''
b4eb6b3d 903socksizetype=''
2304df62
AD
904sharpbang=''
905shsharp=''
906spitshell=''
dfe9444c 907src=''
b4eb6b3d
JH
908ssizetype=''
909startperl=''
2304df62 910startsh=''
b4eb6b3d
JH
911stdchar=''
912d_stdio_stream_array=''
913stdio_stream_array=''
914sysman=''
5ff3f7a4 915trnl=''
b4eb6b3d
JH
916uidformat=''
917uidsign=''
918uidsize=''
919uidtype=''
920archname64=''
921use64bitall=''
922use64bitint=''
923ccflags_uselargefiles=''
924ldflags_uselargefiles=''
925libswanted_uselargefiles=''
926uselargefiles=''
927uselongdouble=''
928usemorebits=''
929usemultiplicity=''
2304df62 930nm_opt=''
40a7a20a 931nm_so_opt=''
2304df62
AD
932runnm=''
933usenm=''
b4eb6b3d 934useperlio=''
29209bc5 935usesocks=''
b4eb6b3d
JH
936d_oldpthreads=''
937use5005threads=''
938useithreads=''
939usethreads=''
2304df62 940incpath=''
2304df62
AD
941mips_type=''
942usrinc=''
b4eb6b3d
JH
943d_vendorarch=''
944installvendorarch=''
945vendorarch=''
946vendorarchexp=''
947d_vendorbin=''
948installvendorbin=''
949vendorbin=''
950vendorbinexp=''
951d_vendorlib=''
952installvendorlib=''
953vendorlib=''
954vendorlib_stem=''
955vendorlibexp=''
956usevendorprefix=''
957vendorprefix=''
958vendorprefixexp=''
d56c5707 959versiononly=''
b4eb6b3d
JH
960defvoidused=''
961voidflags=''
962pm_apiversion=''
963xs_apiversion=''
2304df62
AD
964CONFIG=''
965
ecfc5424
AD
966define='define'
967undef='undef'
968smallmach='pdp11 i8086 z8000 i80286 iAPX286'
969rmlist=''
970
971: We must find out about Eunice early
972eunicefix=':'
973if test -f /etc/unixtovms; then
974 eunicefix=/etc/unixtovms
975fi
976if test -f /etc/unixtovms.exe; then
977 eunicefix=/etc/unixtovms.exe
978fi
979
b4eb6b3d 980i_whoami=''
6b356c8e
JH
981ccname=''
982ccversion=''
9c839522 983perllibs=''
b4eb6b3d
JH
984: set useposix=false in your hint file to disable the POSIX extension.
985useposix=true
986: set useopcode=false in your hint file to disable the Opcode extension.
987useopcode=true
dfe9444c 988: Trailing extension. Override this in a hint file, if needed.
4e2a5f63 989_exe=''
dfe9444c
AD
990: Extra object files, if any, needed on this platform.
991archobjs=''
b4eb6b3d 992archname=''
ff935051
JH
993: Possible local include directories to search.
994: Set locincpth to "" in a hint file to defeat local include searches.
995locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
996locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
997:
998: no include file wanted by default
999inclwanted=''
1000
b4eb6b3d 1001groupstype=''
732c9516
JH
1002: change the next line if compiling for Xenix/286 on Xenix/386
1003xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1004: Possible local library directories to search.
1005loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1006loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1007
1008: general looking path for locating libraries
5869b1f1 1009glibpth="/lib /usr/lib $xlibpth"
732c9516 1010glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1011test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1012test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1013
1014: Private path used by Configure to find libraries. Its value
1015: is prepended to libpth. This variable takes care of special
1016: machines, like the mips. Usually, it should be empty.
1017plibpth=''
1018
1cfa4ec7
GS
1019: default library list
1020libswanted=''
921b2963 1021: some systems want to use only the non-versioned libso:s
1cfa4ec7 1022ignore_versioned_solibs=''
b4eb6b3d
JH
1023archname64=''
1024ccflags_uselargefiles=''
1025ldflags_uselargefiles=''
1026libswanted_uselargefiles=''
1027: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1028: set usesocks on the Configure command line to enable socks.
b4eb6b3d
JH
1029: set usethreads on the Configure command line to enable threads.
1030: full support for void wanted by default
1031defvoidused=15
1032
ecfc5424 1033: List of libraries we want.
693762b4 1034: If anyone needs -lnet, put it in a hint file.
997d70a2 1035libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
69e84d1d 1036libswanted="$libswanted dld ld sun m c cposix posix"
f1066039 1037libswanted="$libswanted ndir dir crypt sec"
0c9177ab 1038libswanted="$libswanted ucb bsd BSD PW x iconv util"
1aef975c 1039: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1040: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1041glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1042glibpth="/usr/shlib $glibpth"
1043: Do not use vfork unless overridden by a hint file.
1044usevfork=false
1045
8ff267be 1046: Find the basic shell for Bourne shell scripts
1047case "$sh" in
1048'')
8ff267be 1049 case "$SYSTYPE" in
1050 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1051 *) xxx='/bin/sh';;
1052 esac
1053 if test -f "$xxx"; then
1054 sh="$xxx"
1055 else
1056 : Build up a list and do a single loop so we can 'break' out.
1057 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1058 for xxx in sh bash ksh pdksh ash; do
1059 for p in $pth; do
1060 try="$try ${p}/${xxx}"
1061 done
1062 done
1063 for xxx in $try; do
1064 if test -f "$xxx"; then
1065 sh="$xxx";
8ff267be 1066 break
1067 elif test -f "$xxx.exe"; then
1068 sh="$xxx";
8ff267be 1069 break
1070 fi
1071 done
1072 fi
1073 ;;
1074esac
1075
1076case "$sh" in
1077'') cat <<EOM >&2
1078$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1079
8ff267be 1080Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1081Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1082we'll try to straighten this all out.
8ff267be 1083EOM
1084 exit 1
1085 ;;
1086esac
1087
760ac839 1088: see if sh knows # comments
73614538 1089if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1090 shsharp=true
1091 spitshell=cat
760ac839
LW
1092 xcat=/bin/cat
1093 test -f $xcat || xcat=/usr/bin/cat
1094 echo "#!$xcat" >try
1095 $eunicefix try
1096 chmod +x try
1097 ./try > today
1098 if test -s today; then
760ac839
LW
1099 sharpbang='#!'
1100 else
1101 echo "#! $xcat" > try
1102 $eunicefix try
1103 chmod +x try
1104 ./try > today
1105 if test -s today; then
760ac839
LW
1106 sharpbang='#! '
1107 else
760ac839
LW
1108 sharpbang=': use '
1109 fi
1110 fi
1111else
dfe9444c 1112 echo " "
8ff267be 1113 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1114 shsharp=false
1115 cd ..
1116 echo "exec grep -v '^[ ]*#'" >spitshell
1117 chmod +x spitshell
1118 $eunicefix spitshell
1119 spitshell=`pwd`/spitshell
1120 cd UU
1121 echo "I presume that if # doesn't work, #! won't work either!"
1122 sharpbang=': use '
1123fi
1124rm -f try today
1125
1126: figure out how to guarantee sh startup
8ff267be 1127case "$startsh" in
1128'') startsh=${sharpbang}${sh} ;;
1129*)
760ac839 1130esac
760ac839
LW
1131cat >try <<EOSS
1132$startsh
1133set abc
1134test "$?abc" != 1
1135EOSS
1136
1137chmod +x try
1138$eunicefix try
1139if ./try; then
8ff267be 1140 : echo "Yup, it does."
760ac839 1141else
dfe9444c
AD
1142 echo "Hmm... '$startsh' does not guarantee sh startup..."
1143 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839
LW
1144fi
1145rm -f try
1146
aebf16e7
AD
1147
1148: Save command line options in file UU/cmdline.opt for later use in
1149: generating config.sh.
1150cat > cmdline.opt <<EOSH
1151# Configure command line arguments.
1152config_arg0='$0'
1153config_args='$*'
1154config_argc=$#
1155EOSH
1156argn=1
1157for arg in "$@"; do
1158 cat >>cmdline.opt <<EOSH
1159config_arg$argn='$arg'
1160EOSH
1161 argn=`expr $argn + 1`
1162done
1163
2304df62
AD
1164: produce awk script to parse command line options
1165cat >options.awk <<'EOF'
1166BEGIN {
02e93a22 1167 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1168
1169 len = length(optstr);
1170 for (i = 1; i <= len; i++) {
1171 c = substr(optstr, i, 1);
1172 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1173 if (a == ":") {
1174 arg[c] = 1;
1175 i++;
1176 }
1177 opt[c] = 1;
1178 }
1179}
1180{
1181 expect = 0;
1182 str = $0;
1183 if (substr(str, 1, 1) != "-") {
1184 printf("'%s'\n", str);
1185 next;
1186 }
1187 len = length($0);
1188 for (i = 2; i <= len; i++) {
1189 c = substr(str, i, 1);
1190 if (!opt[c]) {
1191 printf("-%s\n", substr(str, i));
1192 next;
1193 }
1194 printf("-%s\n", c);
1195 if (arg[c]) {
1196 if (i < len)
1197 printf("'%s'\n", substr(str, i + 1));
1198 else
1199 expect = 1;
1200 next;
1201 }
1202 }
1203}
1204END {
1205 if (expect)
1206 print "?";
1207}
1208EOF
1209
1210: process the command line options
4633a7c4
LW
1211set X `for arg in "$@"; do echo "X$arg"; done |
1212 sed -e s/X// | awk -f options.awk`
2304df62
AD
1213eval "set $*"
1214shift
1215rm -f options.awk
1216
1217: set up default values
1218fastread=''
1219reuseval=false
1220config_sh=''
1221alldone=''
1222error=''
1223silent=''
1224extractsh=''
ecfc5424 1225override=''
16d20bd9 1226knowitall=''
02e93a22 1227rm -f optdef.sh posthint.sh
28757baa 1228cat >optdef.sh <<EOS
1229$startsh
1230EOS
2304df62 1231
dfe9444c 1232
2304df62
AD
1233: option parsing
1234while test $# -gt 0; do
1235 case "$1" in
1236 -d) shift; fastread=yes;;
1237 -e) shift; alldone=cont;;
1238 -f)
1239 shift
1240 cd ..
1241 if test -r "$1"; then
1242 config_sh="$1"
1243 else
a0d0e21e 1244 echo "$me: cannot read config file $1." >&2
2304df62
AD
1245 error=true
1246 fi
1247 cd UU
1248 shift;;
1249 -h) shift; error=true;;
1250 -r) shift; reuseval=true;;
dfe9444c 1251 -s) shift; silent=true; realsilent=true;;
2304df62 1252 -E) shift; alldone=exit;;
16d20bd9 1253 -K) shift; knowitall=true;;
ecfc5424 1254 -O) shift; override=true;;
dfe9444c 1255 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1256 -D)
1257 shift
1258 case "$1" in
1259 *=)
1260 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1261 echo "$me: ignoring -D $1" >&2
1262 ;;
ecfc5424 1263 *=*) echo "$1" | \
1aef975c
AD
1264 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1265 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1266 esac
1267 shift
1268 ;;
1269 -U)
1270 shift
1271 case "$1" in
1aef975c 1272 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1273 *=*)
1274 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1275 echo "$me: ignoring -U $1" >&2
1276 ;;
1aef975c 1277 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1278 esac
1279 shift
1280 ;;
02e93a22
JH
1281 -A)
1282 shift
1283 xxx=''
1284 yyy="$1"
02e93a22 1285 zzz=''
5f83a3e9 1286 uuu=undef
02e93a22 1287 case "$yyy" in
5f83a3e9
JH
1288 *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1289 case "$zzz" in
1290 *:*) zzz='' ;;
1291 *) xxx=append
1292 zzz=" "`echo $yyy|sed 's!^[^=]*=!!'`
1293 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1294 esac
1295 ;;
1296 esac
1297 case "$xxx" in
1298 '') case "$yyy" in
1299 *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1300 yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1301 zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1302 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1303 *) xxx=`echo $yyy|sed 's!:.*!!'`
1304 yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1305 esac
1306 ;;
1307 esac
02e93a22
JH
1308 case "$xxx" in
1309 append)
5f83a3e9 1310 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1311 clear)
5f83a3e9 1312 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1313 define)
1314 case "$zzz" in
1315 '') zzz=define ;;
1316 esac
5f83a3e9 1317 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1318 eval)
5f83a3e9 1319 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1320 prepend)
5f83a3e9 1321 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1322 undef)
1323 case "$zzz" in
1324 '') zzz="$uuu" ;;
1325 esac
5f83a3e9
JH
1326 echo "$yyy=$zzz" >> posthint.sh ;;
1327 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1328 esac
bde6b06b 1329 shift
02e93a22 1330 ;;
dfe9444c 1331 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1332 exit 0;;
2304df62 1333 --) break;;
a0d0e21e 1334 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1335 *) break;;
1336 esac
1337done
1338
1339case "$error" in
1340true)
1341 cat >&2 <<EOM
2afac517 1342Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1343 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1344 -d : use defaults for all answers.
1345 -e : go on without questioning past the production of config.sh.
1346 -f : specify an alternate default configuration file.
1347 -h : print this help message and exit (with an error status).
1348 -r : reuse C symbols value if possible (skips costly nm extraction).
1349 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1350 -D : define symbol to have some value:
1351 -D symbol symbol gets the value 'define'
1352 -D symbol=value symbol gets the value 'value'
2304df62 1353 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1354 -K : do not use unless you know what you are doing.
ecfc5424 1355 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1356 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1357 -U : undefine symbol:
1358 -U symbol symbol gets the value 'undef'
1359 -U symbol= symbol gets completely empty
02e93a22 1360 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1361 -A symbol=value append " "value to symbol
02e93a22
JH
1362 -A append:symbol=value append value to symbol
1363 -A define:symbol=value define symbol to have value
02e93a22
JH
1364 -A clear:symbol define symbol to be ''
1365 -A define:symbol define symbol to be 'define'
1366 -A eval:symbol=value define symbol to be eval of value
1367 -A prepend:symbol=value prepend value to symbol
1368 -A undef:symbol define symbol to be 'undef'
1369 -A undef:symbol= define symbol to be ''
2304df62
AD
1370 -V : print version number and exit (with a zero status).
1371EOM
1372 exit 1
1373 ;;
1374esac
1375
dfe9444c
AD
1376: Sanity checks
1377case "$fastread$alldone" in
1378yescont|yesexit) ;;
1379*)
aaeb8e51
GS
1380 case "$extractsh" in
1381 true) ;;
1382 *)
1383 if test ! -t 0; then
1384 echo "Say 'sh Configure', not 'sh <Configure'"
1385 exit 1
1386 fi
1387 ;;
1388 esac
dfe9444c
AD
1389 ;;
1390esac
1391
2304df62
AD
1392exec 4>&1
1393case "$silent" in
1394true) exec 1>/dev/null;;
1395esac
1396
ecfc5424 1397: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1398touch optdef.sh
1399. ./optdef.sh
02e93a22
JH
1400: create the posthint manipulation script and leave the file out there...
1401touch posthint.sh
a0d0e21e 1402
2304df62 1403: set package name
85e6fe83 1404package=perl5
b4eb6b3d
JH
1405first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1406last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1407case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1408ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1409*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1410esac
2304df62 1411
2304df62
AD
1412: Some greps do not return status, grrr.
1413echo "grimblepritz" >grimble
1414if grep blurfldyick grimble >/dev/null 2>&1 ; then
1415 contains=contains
1416elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1417 contains=grep
1418else
1419 contains=contains
1420fi
1421rm -f grimble
1422: the following should work in any shell
1423case "$contains" in
1424contains*)
1425 echo " "
1426 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1427 cat >contains <<'EOSS'
1428grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1429EOSS
1430chmod +x contains
1431esac
1432
dfe9444c
AD
1433: Find the path to the source tree
1434case "$src" in
1435'') case "$0" in
b233458b
JH
1436 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1437 case "$src" in
1438 /*) ;;
8504afb7 1439 .) ;;
b233458b
JH
1440 *) src=`cd ../$src && pwd` ;;
1441 esac
1442 ;;
dfe9444c
AD
1443 *) src='.';;
1444 esac;;
1445esac
1446case "$src" in
1447'') src=/
1448 rsrc=/
1449 ;;
1450/*) rsrc="$src";;
1451*) rsrc="../$src";;
1452esac
1453if test -f $rsrc/Configure && \
1454 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1455then
1456 : found it, so we are ok.
1457else
1458 rsrc=''
1459 for src in . .. ../.. ../../.. ../../../..; do
1460 if test -f ../$src/Configure && \
1461 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1462 then
1463 rsrc=../$src
1464 break
1465 fi
1466 done
1467fi
1468case "$rsrc" in
1469'')
1470 cat <<EOM >&4
1471
1472Sorry, I can't seem to locate the source dir for $package. Please start
1473Configure with an explicit path -- i.e. /some/path/Configure.
1474
1475EOM
1476 exit 1
1477 ;;
1478../.) rsrc='..';;
1479*)
1480 echo " "
1481 echo "Sources for $package found in \"$src\"." >&4
1482 ;;
1483esac
1484
1485: script used to extract .SH files with variable substitutions
1486cat >extract <<'EOS'
2000072c 1487CONFIGDOTSH=true
dfe9444c
AD
1488echo "Doing variable substitutions on .SH files..."
1489if test -f $src/MANIFEST; then
f7ab18e9 1490 set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
dfe9444c
AD
1491else
1492 echo "(Looking for .SH files under the source directory.)"
1493 set x `(cd $src; find . -name "*.SH" -print)`
1494fi
1495shift
1496case $# in
14970) set x `(cd $src; echo *.SH)`; shift;;
1498esac
1499if test ! -f $src/$1; then
1500 shift
1501fi
1502mkdir_p='
1503name=$1;
1504create="";
1505while test $name; do
1506 if test ! -d "$name"; then
1507 create="$name $create";
1508 name=`echo $name | sed -e "s|^[^/]*$||"`;
1509 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1510 else
1511 name="";
1512 fi;
1513done;
1514for file in $create; do
1515 mkdir $file;
1516done
1517'
1518for file in $*; do
1519 case "$src" in
1520 ".")
1521 case "$file" in
1522 */*)
1523 dir=`expr X$file : 'X\(.*\)/'`
1524 file=`expr X$file : 'X.*/\(.*\)'`
1525 (cd $dir && . ./$file)
1526 ;;
1527 *)
1528 . ./$file
1529 ;;
1530 esac
1531 ;;
1532 *)
1533 case "$file" in
1534 */*)
1535 dir=`expr X$file : 'X\(.*\)/'`
1536 file=`expr X$file : 'X.*/\(.*\)'`
1537 (set x $dir; shift; eval $mkdir_p)
1538 sh <$src/$dir/$file
1539 ;;
1540 *)
1541 sh <$src/$file
1542 ;;
1543 esac
1544 ;;
1545 esac
1546done
1547if test -f $src/config_h.SH; then
1548 if test ! -f config.h; then
1549 : oops, they left it out of MANIFEST, probably, so do it anyway.
1550 . $src/config_h.SH
1551 fi
1552fi
1553EOS
1554
1555: extract files and exit if asked to do so
1556case "$extractsh" in
1557true)
1558 case "$realsilent" in
1559 true) ;;
1560 *) exec 1>&4;;
1561 esac
1562 case "$config_sh" in
1563 '') config_sh='config.sh';;
1564 esac
1565 echo " "
1566 echo "Fetching answers from $config_sh..."
1567 cd ..
1568 . $config_sh
1569 test "$override" && . ./optdef.sh
1570 echo " "
1571 . UU/extract
1572 rm -rf UU
1573 echo "Done."
1574 exit 0
1575 ;;
1576esac
1577
1578: Eunice requires " " instead of "", can you believe it
1579echo " "
1580: Here we go...
1581echo "Beginning of configuration questions for $package."
1582
1583trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1584
2304df62
AD
1585: first determine how to suppress newline on echo command
1586echo " "
1587echo "Checking echo to see how to suppress newlines..."
1588(echo "hi there\c" ; echo " ") >.echotmp
1589if $contains c .echotmp >/dev/null 2>&1 ; then
1590 echo "...using -n."
1591 n='-n'
1592 c=''
1593else
1594 cat <<'EOM'
1595...using \c
1596EOM
1597 n=''
1598 c='\c'
1599fi
1600echo $n "The star should be here-->$c"
1601echo '*'
1602rm -f .echotmp
1603
1604: Now test for existence of everything in MANIFEST
1605echo " "
dfe9444c 1606if test -f $rsrc/MANIFEST; then
2304df62 1607 echo "First let's make sure your kit is complete. Checking..." >&4
dfe9444c 1608 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
2304df62 1609 rm -f missing
dfe9444c 1610 tmppwd=`pwd`
2304df62 1611 for filelist in x??; do
dfe9444c 1612 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
2304df62
AD
1613 done
1614 if test -s missing; then
1615 cat missing >&4
1616 cat >&4 <<'EOM'
1617
1618THIS PACKAGE SEEMS TO BE INCOMPLETE.
1619
1620You have the option of continuing the configuration process, despite the
1621distinct possibility that your kit is damaged, by typing 'y'es. If you
1622do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1623and contact the author (perlbug@perl.org).
2304df62
AD
1624
1625EOM
1626 echo $n "Continue? [n] $c" >&4
1627 read ans
1628 case "$ans" in
1629 y*)
1630 echo "Continuing..." >&4
1631 rm -f missing
1632 ;;
1633 *)
1634 echo "ABORTING..." >&4
1635 kill $$
1636 ;;
1637 esac
1638 else
dfe9444c 1639 echo "Looks good..."
2304df62
AD
1640 fi
1641else
1642 echo "There is no MANIFEST file. I hope your kit is complete !"
1643fi
1644rm -f missing x??
1645
5ff3f7a4
GS
1646echo " "
1647: Find the appropriate value for a newline for tr
1648if test -n "$DJGPP"; then
1649 trnl='\012'
1650fi
1651if test X"$trnl" = X; then
1652 case "`echo foo|tr '\n' x 2>/dev/null`" in
1653 foox) trnl='\n' ;;
1654 esac
1655fi
1656if test X"$trnl" = X; then
1657 case "`echo foo|tr '\012' x 2>/dev/null`" in
1658 foox) trnl='\012' ;;
1659 esac
1660fi
1661if test X"$trnl" = X; then
1662 cat <<EOM >&2
1663
1664$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1665
1666EOM
1667 exit 1
1668fi
1669
2304df62
AD
1670: compute the number of columns on the terminal for proper question formatting
1671case "$COLUMNS" in
1672'') COLUMNS='80';;
1673esac
1674
1675: set up the echo used in my read
1676myecho="case \"\$xxxm\" in
1677'') echo $n \"\$rp $c\" >&4;;
1678*) case \"\$rp\" in
1679 '') echo $n \"[\$xxxm] $c\";;
1680 *)
1681 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1682 echo \"\$rp\" >&4
1683 echo $n \"[\$xxxm] $c\" >&4
1684 else
1685 echo $n \"\$rp [\$xxxm] $c\" >&4
1686 fi
1687 ;;
1688 esac;;
1689esac"
1690
1691: now set up to do reads with possible shell escape and default assignment
1692cat <<EOSC >myread
28757baa 1693$startsh
2304df62
AD
1694xxxm=\$dflt
1695$myecho
1696ans='!'
1697case "\$fastread" in
1698yes) case "\$dflt" in
1699 '') ;;
1700 *) ans='';
1701 case "\$silent-\$rp" in
1702 true-) ;;
1703 *) echo " " >&4;;
1704 esac;;
1705 esac;;
1706*) case "\$silent" in
1707 true) case "\$rp" in
1708 '') ans='';;
1709 esac;;
1710 esac;;
1711esac
1712while expr "X\$ans" : "X!" >/dev/null; do
1713 read answ
1714 set x \$xxxm
1715 shift
dfe9444c 1716 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1717 case "\$answ" in
dfe9444c
AD
1718 "!")
1719 sh 1>&4
1720 echo " "
1721 $myecho
1722 ;;
1723 !*)
1724 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1725 shift
1726 sh 1>&4 -c "\$*"
1727 echo " "
1728 $myecho
1729 ;;
2304df62
AD
1730 "\$ans")
1731 case "\$ans" in
ecfc5424
AD
1732 \\&*)
1733 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1734 shift
1735 case "\$1" in
1736 -d)
1737 fastread=yes
40a7a20a 1738 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1739 ;;
1740 -*)
40a7a20a 1741 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1742 ;;
1743 esac
1744 $myecho
1745 ans=!
1746 ;;
2304df62
AD
1747 esac;;
1748 *)
1749 case "\$aok" in
1750 y)
1751 echo "*** Substitution done -- please confirm."
1752 xxxm="\$ans"
c9795ab7 1753 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1754 xxxm="\$ans"
1755 ans=!
1756 ;;
1757 *)
1758 echo "*** Error -- try again."
1759 ans=!
1760 ;;
1761 esac
1762 $myecho
1763 ;;
1764 esac
1765 case "\$ans\$xxxm\$nostick" in
1766 '')
1767 ans=!
1768 $myecho
1769 ;;
1770 esac
1771done
1772case "\$ans" in
1773'') ans="\$xxxm";;
1774esac
1775EOSC
1776
1777: create .config dir to save info across Configure sessions
1778test -d ../.config || mkdir ../.config
1779cat >../.config/README <<EOF
1780This directory created by Configure to save information that should
dfe9444c 1781persist across sessions for $package.
2304df62
AD
1782
1783You may safely delete it if you wish.
1784EOF
1785
9507cadf 1786xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 1787case "$usedevel" in
0107c034 1788$define|true|[yY]*) ;;
9507cadf 1789*) case "$xversion" in
0107c034
JH
1790 *[13579])
1791 cat >&4 <<EOH
1792*** WHOA THERE!!! ***
1793
1794 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
1795 The version of this $package distribution is $xversion, that is, odd,
1796 (as opposed to even) and that signifies a development release.
3d5d58b1 1797 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
1798
1799 Do ***NOT*** install this into production use.
1800 Data corruption and crashes are possible.
1801
1802 It is most seriously suggested that you do not continue any further
1803 unless you want to help in developing and debugging Perl.
1804
1805EOH
1806 rp='Do you really want to continue?'
1807 dflt='n'
1808 . ./myread
1809 case "$ans" in
8feeef0e
JH
1810 [yY]) echo >&4 "Okay, continuing."
1811 usedevel="$define" ;;
0107c034
JH
1812 *) echo >&4 "Okay, bye."
1813 exit 1
1814 ;;
1815 esac
1816 ;;
1817 esac
1818 ;;
1819esac
8feeef0e
JH
1820case "$usedevel" in
1821$define|true|[yY]*)
1822 case "$versiononly" in
1823 '') versiononly="$define" ;;
1824 esac
1825 case "$installusrbinperl" in
1826 '') installusrbinperl="$undef" ;;
1827 esac
1828 ;;
1829esac
0107c034 1830
2304df62
AD
1831: general instructions
1832needman=true
1833firsttime=true
760ac839 1834user=`(logname) 2>/dev/null`
dfe9444c
AD
1835case "$user" in
1836'') user=`whoami 2>&1`;;
760ac839 1837esac
2304df62
AD
1838if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1839 firsttime=false
1840 echo " "
1841 rp='Would you like to see the instructions?'
1842 dflt=n
1843 . ./myread
1844 case "$ans" in
1845 [yY]*) ;;
1846 *) needman=false;;
1847 esac
1848fi
1849if $needman; then
1850 cat <<EOH
4e2a5f63 1851
2304df62 1852This installation shell script will examine your system and ask you questions
a0d0e21e 1853to determine how the perl5 package should be installed. If you get
2304df62
AD
1854stuck on a question, you may use a ! shell escape to start a subshell or
1855execute a command. Many of the questions will have default answers in square
1856brackets; typing carriage return will give you the default.
1857
1858On some of the questions which ask for file or directory names you are allowed
1859to use the ~name construct to specify the login directory belonging to "name",
1860even if you don't have a shell which knows about that. Questions where this is
1861allowed will be marked "(~name ok)".
1862
1863EOH
1864 rp=''
1865 dflt='Type carriage return to continue'
1866 . ./myread
1867 cat <<'EOH'
1868
1869The prompter used in this script allows you to use shell variables and
1870backticks in your answers. You may use $1, $2, etc... to refer to the words
1871in the default answer, as if the default line was a set of arguments given to a
1872script shell. This means you may also use $* to repeat the whole default line,
1873so you do not have to re-type everything to add something to the default.
1874
1875Everytime there is a substitution, you will have to confirm. If there is an
1876error (e.g. an unmatched backtick), the default answer will remain unchanged
1877and you will be prompted again.
1878
1879If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1880the questions and use the computed defaults (or the previous answers if there
1881was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1882You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1883on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1884
1885EOH
1886 . ./myread
1887 cat <<EOH
1888
1889Much effort has been expended to ensure that this shell script will run on any
1890Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1891Configure and run it again. If you can't run Configure for some reason,
1892you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 1893have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
1894
1895This installation script affects things in two ways:
1896
18971) it may do direct variable substitutions on some of the files included
1898 in this kit.
18992) it builds a config.h file for inclusion in C programs. You may edit
1900 any of these files as the need arises after running this script.
1901
1902If you make a mistake on a question, there is no easy way to back up to it
1903currently. The easiest thing to do is to edit config.sh and rerun all the SH
1904files. Configure will offer to let you do this before it runs the SH files.
1905
1906EOH
1907 dflt='Type carriage return to continue'
1908 . ./myread
1909 case "$firsttime" in
1910 true) echo $user >>../.config/instruct;;
1911 esac
1912fi
1913
2304df62
AD
1914: find out where common programs are
1915echo " "
1916echo "Locating common programs..." >&4
1917cat <<EOSC >loc
1918$startsh
1919case \$# in
19200) exit 1;;
1921esac
1922thing=\$1
1923shift
1924dflt=\$1
1925shift
1926for dir in \$*; do
1927 case "\$thing" in
1928 .)
1929 if test -d \$dir/\$thing; then
1930 echo \$dir
1931 exit 0
1932 fi
1933 ;;
1934 *)
a0d0e21e 1935 for thisthing in \$dir/\$thing; do
ecfc5424 1936 : just loop through to pick last item
a0d0e21e 1937 done
25f94b33 1938 if test -f \$thisthing; then
a0d0e21e 1939 echo \$thisthing
2304df62
AD
1940 exit 0
1941 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
1942 if test -n "$DJGPP"; then
1943 echo \$dir/\$thing.exe
1944 else
1945 : on Eunice apparently
1946 echo \$dir/\$thing
1947 fi
2304df62
AD
1948 exit 0
1949 fi
1950 ;;
1951 esac
1952done
1953echo \$dflt
1954exit 1
1955EOSC
1956chmod +x loc
1957$eunicefix loc
1958loclist="
1959awk
1960cat
b4eb6b3d
JH
1961comm
1962cp
2304df62
AD
1963echo
1964expr
1965grep
a0d0e21e 1966ls
dfe9444c 1967make
b4eb6b3d 1968mkdir
2304df62
AD
1969rm
1970sed
b4eb6b3d 1971sort
85e6fe83 1972touch
2304df62 1973tr
b4eb6b3d 1974uniq
2304df62
AD
1975"
1976trylist="
1977Mcc
dfe9444c 1978ar
b4eb6b3d 1979byacc
2304df62 1980cpp
b4eb6b3d 1981csh
2304df62
AD
1982date
1983egrep
8ff267be 1984gzip
b4eb6b3d 1985less
8ff267be 1986ln
b4eb6b3d 1987more
693762b4 1988nm
b4eb6b3d
JH
1989nroff
1990pg
2304df62
AD
1991test
1992uname
8ff267be 1993zip
2304df62 1994"
8e07c86e 1995pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
1996pth="$pth /lib /usr/lib"
1997for file in $loclist; do
dfe9444c
AD
1998 eval xxx=\$$file
1999 case "$xxx" in
2000 /*|?:[\\/]*)
2001 if test -f "$xxx"; then
2002 : ok
2003 else
2004 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2005 xxx=`./loc $file $file $pth`
2006 fi
2007 ;;
2008 '') xxx=`./loc $file $file $pth`;;
2009 *) xxx=`./loc $xxx $xxx $pth`;;
2010 esac
2304df62
AD
2011 eval $file=$xxx
2012 eval _$file=$xxx
2013 case "$xxx" in
2014 /*)
2015 echo $file is in $xxx.
2016 ;;
8e07c86e
AD
2017 ?:[\\/]*)
2018 echo $file is in $xxx.
2019 ;;
2304df62 2020 *)
25f94b33
AD
2021 echo "I don't know where '$file' is, and my life depends on it." >&4
2022 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2023 exit 1
2304df62
AD
2024 ;;
2025 esac
2026done
2027echo " "
2028echo "Don't worry if any of the following aren't found..."
2029say=offhand
2030for file in $trylist; do
dfe9444c
AD
2031 eval xxx=\$$file
2032 case "$xxx" in
2033 /*|?:[\\/]*)
2034 if test -f "$xxx"; then
2035 : ok
2036 else
2037 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2038 xxx=`./loc $file $file $pth`
2039 fi
2040 ;;
2041 '') xxx=`./loc $file $file $pth`;;
2042 *) xxx=`./loc $xxx $xxx $pth`;;
2043 esac
2304df62
AD
2044 eval $file=$xxx
2045 eval _$file=$xxx
2046 case "$xxx" in
2047 /*)
2048 echo $file is in $xxx.
2049 ;;
8e07c86e
AD
2050 ?:[\\/]*)
2051 echo $file is in $xxx.
2052 ;;
2304df62
AD
2053 *)
2054 echo "I don't see $file out there, $say."
2055 say=either
2056 ;;
2057 esac
2058done
2059case "$egrep" in
2060egrep)
2061 echo "Substituting grep for egrep."
2062 egrep=$grep
2063 ;;
2064esac
8ff267be 2065case "$ln" in
2066ln)
2067 echo "Substituting cp for ln."
2068 ln=$cp
2069 ;;
2070esac
2304df62
AD
2071case "$test" in
2072test)
2073 echo "Hopefully test is built into your sh."
2074 ;;
2075*)
73614538 2076 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2077 echo "Using the test built into your sh."
2304df62
AD
2078 test=test
2079 _test=test
2080 fi
2081 ;;
2082esac
2083case "$echo" in
2084echo)
2085 echo "Hopefully echo is built into your sh."
2086 ;;
2087'') ;;
2088*)
2089 echo " "
2090echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2091 $echo $n "hi there$c" >foo1
2092 echo $n "hi there$c" >foo2
2093 if cmp foo1 foo2 >/dev/null 2>&1; then
2094 echo "They are compatible. In fact, they may be identical."
2095 else
2096 case "$n" in
2097 '-n') n='' c='\c';;
2098 *) n='-n' c='';;
2099 esac
2100 cat <<FOO
2101They are not compatible! You are probably running ksh on a non-USG system.
2102I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2103have echo built in and we may have to run some Bourne shell scripts. That
2104means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2105
2106FOO
2107 $echo $n "The star should be here-->$c"
2108 $echo "*"
2109 fi
2110 $rm -f foo1 foo2
2111 ;;
2112esac
2113
2573c5f9
JH
2114cat <<EOS >checkcc
2115$startsh
2116EOS
2117cat <<'EOSC' >>checkcc
2118case "$cc" in
2119'') ;;
2120*) $rm -f try try.*
2121 $cat >try.c <<EOM
2122int main(int argc, char *argv[]) {
2123 return 0;
2124}
2125EOM
7a282f6d 2126 if $cc -o try $ccflags try.c; then
2573c5f9
JH
2127 :
2128 else
2129 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2130 despair=yes
2131 trygcc=yes
2132 case "$cc" in
2133 *gcc*) trygcc=no ;;
2134 esac
2135 case "`$cc -v -c try.c 2>&1`" in
2136 *gcc*) trygcc=no ;;
2137 esac
2138 if $test X"$trygcc" = Xyes; then
2139 if gcc -o try -c try.c; then
2140 echo " "
2141 echo "You seem to have a working gcc, though." >&4
2142 rp="Would you like to use it?"
2143 dflt=y
2144 if $test -f myread; then
2145 . ./myread
2146 else
2147 if $test -f UU/myread; then
2148 . ./UU/myread
2149 else
2150 echo "Cannot find myread, sorry. Aborting." >&2
2151 exit 1
2152 fi
2153 fi
2154 case "$ans" in
e723fc21 2155 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2573c5f9
JH
2156 esac
2157 fi
2158 fi
2159 if $test X"$despair" = Xyes; then
5dd4fbdf
MB
2160 $cat >&4 <<EOM
2161You need to find a working C compiler.
2162Either (purchase and) install the C compiler supplied by your OS vendor,
2163or for a free C compiler try http://gcc.gnu.org/
2164I cannot continue any further, aborting.
2165EOM
2573c5f9
JH
2166 exit 1
2167 fi
2168 fi
2169 $rm -f try try.*
2170 ;;
2171esac
2172EOSC
2173
a0d0e21e
LW
2174: determine whether symbolic links are supported
2175echo " "
2176$touch blurfl
2177if $ln -s blurfl sym > /dev/null 2>&1 ; then
2178 echo "Symbolic links are supported." >&4
2179 lns="$ln -s"
2180else
2181 echo "Symbolic links are NOT supported." >&4
2182 lns="$ln"
2183fi
2184$rm -f blurfl sym
2185
dafca956
JH
2186: determine whether symbolic links are supported
2187echo " "
2188case "$lns" in
2189*"ln -s")
2190 echo "Checking how to test for symbolic links..." >&4
2191 $lns blurfl sym
4b661809 2192 if $test "X$issymlink" = X; then
73614538 2193 sh -c "PATH= test -h sym" >/dev/null 2>&1
5d644a95
MB
2194 if test $? = 0; then
2195 issymlink="test -h"
2196 fi
2197 fi
2198 if $test "X$issymlink" = X; then
73614538 2199 if $test -h >/dev/null 2>&1; then
5d644a95
MB
2200 issymlink="$test -h"
2201 echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2202 fi
dafca956 2203 fi
4b661809 2204 if $test "X$issymlink" = X; then
dafca956 2205 if $test -L sym 2>/dev/null; then
5d644a95 2206 issymlink="$test -L"
dafca956
JH
2207 fi
2208 fi
4b661809 2209 if $test "X$issymlink" != X; then
5d644a95 2210 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2211 else
2212 echo "I do not know how you can test for symbolic links." >&4
2213 fi
2214 $rm -f blurfl sym
2215 ;;
2216*) echo "No symbolic links, so not testing for their testing..." >&4
2217 ;;
2218esac
2219echo " "
2220
2221
2222case "$mksymlinks" in
2223$define|true|[yY]*)
2224 case "$src" in
2225 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2226 exit 1
2227 ;;
4b661809 2228 *) case "$lns:$issymlink" in
7a800fca 2229 *"ln -s:"*"test -"?)
dafca956
JH
2230 echo "Creating the symbolic links..." >&4
2231 echo "(First creating the subdirectories...)" >&4
2232 cd ..
2233 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2234 read directory
2235 test -z "$directory" && break
2236 mkdir -p $directory
2237 done
2238 # Sanity check 1.
2239 if test ! -d t/base; then
2240 echo "Failed to create the subdirectories. Aborting." >&4
2241 exit 1
2242 fi
2243 echo "(Then creating the symlinks...)" >&4
2244 awk '{print $1}' $src/MANIFEST | while true; do
2245 read filename
2246 test -z "$filename" && break
2247 if test -f $filename; then
5d644a95 2248 if $issymlink $filename; then
dafca956
JH
2249 rm -f $filename
2250 fi
2251 fi
2252 if test -f $filename; then
2253 echo "$filename already exists, not symlinking."
2254 else
2255 ln -s $src/$filename $filename
2256 fi
2257 done
2258 # Sanity check 2.
2259 if test ! -f t/base/commonsense.t; then
2260 echo "Failed to create the symlinks. Aborting." >&4
2261 exit 1
2262 fi
2263 cd UU
2264 ;;
2265 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2266 ;;
2267 esac
2268 ;;
2269 esac
2270 ;;
2271esac
2272
ecfc5424
AD
2273: see whether [:lower:] and [:upper:] are supported character classes
2274echo " "
ecfc5424
AD
2275case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2276ABYZ)
2277 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2278 up='[:upper:]'
2279 low='[:lower:]'
2280 ;;
28e8609d
JH
2281*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2282 # (0xc9 and 0xd1), therefore that is a nice testing point.
2283 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2284 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2285 ij) up='[A-Z]'
2286 low='[a-z]'
2287 ;;
2288 esac
2289 fi
2290 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2291 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2292 ij) up='A-Z'
2293 low='a-z'
2294 ;;
2295 esac
2296 fi
2297 if test "X$up" = X -o "X$low" = X; then
2298 case "`echo IJ | od -x 2>/dev/null`" in
2299 *C9D1*|*c9d1*)
2300 echo "Hey, this might be EBCDIC." >&4
2301 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2302 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2303 ij) up='[A-IJ-RS-Z]'
2304 low='[a-ij-rs-z]'
2305 ;;
2306 esac
2307 fi
2308 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2309 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2310 ij) up='A-IJ-RS-Z'
2311 low='a-ij-rs-z'
2312 ;;
2313 esac
2314 fi
2315 ;;
2316 esac
2317 fi
2318esac
3eaeeeae 2319case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2320ij)
2321 echo "Using $up and $low to convert case." >&4
2322 ;;
ecfc5424 2323*)
28e8609d
JH
2324 echo "I don't know how to translate letters from upper to lower case." >&4
2325 echo "Your tr is not acting any way I know of." >&4
2326 exit 1
2327 ;;
ecfc5424
AD
2328esac
2329: set up the translation script tr, must be called with ./tr of course
2330cat >tr <<EOSC
2331$startsh
2332case "\$1\$2" in
2333'[A-Z][a-z]') exec $tr '$up' '$low';;
2334'[a-z][A-Z]') exec $tr '$low' '$up';;
2335esac
2336exec $tr "\$@"
2337EOSC
2338chmod +x tr
2339$eunicefix tr
2340
2304df62
AD
2341: Try to determine whether config.sh was made on this system
2342case "$config_sh" in
2343'')
43999f95
JH
2344myuname=`$uname -a 2>/dev/null`
2345$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2346# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2347# because the A-Z/a-z are not consecutive.
a0d0e21e 2348myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2349 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2350newmyuname="$myuname"
2304df62 2351dflt=n
16d20bd9
AD
2352case "$knowitall" in
2353'')
2354 if test -f ../config.sh; then
2355 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2356 eval "`grep myuname= ../config.sh`"
2357 fi
2358 if test "X$myuname" = "X$newmyuname"; then
2359 dflt=y
2360 fi
2304df62 2361 fi
16d20bd9
AD
2362 ;;
2363*) dflt=y;;
2364esac
2304df62
AD
2365
2366: Get old answers from old config file if Configure was run on the
2367: same system, otherwise use the hints.
2368hint=default
2369cd ..
2370if test -f config.sh; then
16d20bd9
AD
2371 echo " "
2372 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2373 . UU/myread
2374 case "$ans" in
f83701cd
AD
2375 n*|N*) echo "OK, I'll ignore it."
2376 mv config.sh config.sh.old
2377 myuname="$newmyuname"
2378 ;;
2304df62 2379 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2380 tmp_n="$n"
2381 tmp_c="$c"
85cad39c 2382 tmp_sh="$sh"
2304df62
AD
2383 . ./config.sh
2384 cp config.sh UU
ecfc5424
AD
2385 n="$tmp_n"
2386 c="$tmp_c"
85cad39c 2387 : Older versions did not always set $sh. Catch re-use of such
2388 : an old config.sh.
2389 case "$sh" in
2390 '') sh="$tmp_sh" ;;
2391 esac
2304df62
AD
2392 hint=previous
2393 ;;
2394 esac
2395fi
2573c5f9 2396. ./UU/checkcc
2304df62
AD
2397if test ! -f config.sh; then
2398 $cat <<EOM
2399
4e2a5f63
AD
2400First time through, eh? I have some defaults handy for some systems
2401that need some extra help getting the Configure answers right:
2304df62
AD
2402
2403EOM
dfe9444c 2404 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2405 dflt=''
2406 : Half the following guesses are probably wrong... If you have better
7f2de2d2 2407 : tests or hints, please send them to perlbug@perl.org
2304df62 2408 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2409 $test -f /irix && osname=irix
85e6fe83
LW
2410 $test -f /xenix && osname=sco_xenix
2411 $test -f /dynix && osname=dynix
2412 $test -f /dnix && osname=dnix
5f05dabc 2413 $test -f /lynx.os && osname=lynxos
2414 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2415 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2416 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2417 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2418 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2419 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2420 $test -d /usr/apollo/bin && osname=apollo
2421 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2422 $test -d /usr/include/minix && osname=minix
e060872b 2423 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2424 osname=machten
4633a7c4 2425 if $test -x /sbin/version; then
dfe9444c 2426 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2427 $sed -e 's/[A-Za-z]$//'`
2428 elif $test -x /usr/etc/version; then
dfe9444c 2429 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2430 $sed -e 's/[A-Za-z]$//'`
2431 else
2432 osvers="$2.$3"
2433 fi
2434 fi
aaacdc8b
GS
2435
2436 $test -f /sys/posix.dll &&
2437 $test -f /usr/bin/what &&
2438 set X `/usr/bin/what /sys/posix.dll` &&
2439 $test "$3" = UWIN &&
2440 osname=uwin &&
2441 osvers="$5"
2442
2304df62
AD
2443 if $test -f $uname; then
2444 set X $myuname
2445 shift
2446
2304df62 2447 case "$5" in
85e6fe83 2448 fps*) osname=fps ;;
2304df62
AD
2449 mips*)
2450 case "$4" in
85e6fe83
LW
2451 umips) osname=umips ;;
2452 *) osname=mips ;;
2304df62 2453 esac;;
85e6fe83
LW
2454 [23]100) osname=mips ;;
2455 next*) osname=next ;;
ecfc5424 2456 i386*)
c6912327
JH
2457 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2458 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2459 osname='sco'
2460 osvers=$tmp
2461 elif $test -f /etc/kconfig; then
ecfc5424 2462 osname=isc
bd628c73 2463 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2464 osvers=4
2465 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2466 osvers=3
2304df62 2467 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2468 osvers=2
ecfc5424
AD
2469 fi
2470 fi
2000072c 2471 tmp=''
ecfc5424 2472 ;;
c4f23d77
AD
2473 pc*)
2474 if test -n "$DJGPP"; then
2475 osname=dos
2476 osvers=djgpp
2477 fi
2478 ;;
2304df62
AD
2479 esac
2480
2481 case "$1" in
a0d0e21e
LW
2482 aix) osname=aix
2483 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2484 case "$tmp" in
1aef975c 2485 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2486 '<3240'|'<>3240') osvers=3.2.0 ;;
2487 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2488 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2489 *) osvers=$tmp;;
a0d0e21e
LW
2490 esac
2491 ;;
aaacdc8b
GS
2492 bsd386) osname=bsd386
2493 osvers=`$uname -r`
2494 ;;
2495 cygwin*) osname=cygwin
2496 osvers="$3"
2497 ;;
23f87696
SZ
2498 *dc.osx) osname=dcosx
2499 osvers="$3"
2500 ;;
a0d0e21e
LW
2501 dnix) osname=dnix
2502 osvers="$3"
2503 ;;
2504 domainos) osname=apollo
2505 osvers="$3"
2506 ;;
2507 dgux) osname=dgux
2508 osvers="$3"
2509 ;;
760ac839 2510 dynixptx*) osname=dynixptx
e58e581d 2511 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2512 ;;
a0d0e21e
LW
2513 freebsd) osname=freebsd
2514 osvers="$3" ;;
2515 genix) osname=genix ;;
2516 hp*) osname=hpux
bfb7748a 2517 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2518 ;;
a78b0d02 2519 irix*) osname=irix
a0d0e21e
LW
2520 case "$3" in
2521 4*) osvers=4 ;;
2522 5*) osvers=5 ;;
ecfc5424 2523 *) osvers="$3" ;;
a0d0e21e
LW
2524 esac
2525 ;;
2526 linux) osname=linux
2527 case "$3" in
a0d0e21e
LW
2528 *) osvers="$3" ;;
2529 esac
2530 ;;
28e8609d
JH
2531 MiNT) osname=mint
2532 ;;
2533 netbsd*) osname=netbsd
ecfc5424
AD
2534 osvers="$3"
2535 ;;
4e81affe
MM
2536 news-os) osvers="$3"
2537 case "$3" in
2538 4*) osname=newsos4 ;;
2539 *) osname=newsos ;;
2540 esac
2541 ;;
aaacdc8b 2542 next*) osname=next ;;
28bb1e2c 2543 nonstop-ux) osname=nonstopux ;;
aaacdc8b
GS
2544 POSIX-BC | posix-bc ) osname=posix-bc
2545 osvers="$3"
a0d0e21e 2546 ;;
ae3afa4e
TH
2547 powerux | power_ux | powermax_os | powermaxos | \
2548 powerunix | power_unix) osname=powerux
2549 osvers="$3"
2550 ;;
aaacdc8b
GS
2551 qnx) osname=qnx
2552 osvers="$4"
2553 ;;
a0d0e21e
LW
2554 solaris) osname=solaris
2555 case "$3" in
2556 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2557 *) osvers="$3" ;;
a0d0e21e
LW
2558 esac
2559 ;;
85e6fe83
LW
2560 sunos) osname=sunos
2561 case "$3" in
85e6fe83
LW
2562 5*) osname=solaris
2563 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2564 *) osvers="$3" ;;
2304df62
AD
2565 esac
2566 ;;
a0d0e21e 2567 titanos) osname=titanos
85e6fe83 2568 case "$3" in
a0d0e21e
LW
2569 1*) osvers=1 ;;
2570 2*) osvers=2 ;;
2571 3*) osvers=3 ;;
2572 4*) osvers=4 ;;
ecfc5424 2573 *) osvers="$3" ;;
2304df62
AD
2574 esac
2575 ;;
85e6fe83 2576 ultrix) osname=ultrix
ecfc5424 2577 osvers="$3"
2304df62 2578 ;;
28757baa 2579 osf1|mls+) case "$5" in
fed7345c
AD
2580 alpha)
2581 osname=dec_osf
2aa76180
JH
2582 osvers=`sizer -v | awk '{print $3}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2583 case "$osvers" in
2584 [1-9].[0-9]*) ;;
2585 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2586 esac
ecfc5424
AD
2587 ;;
2588 hp*) osname=hp_osf1 ;;
2589 mips) osname=mips_osf1 ;;
85e6fe83
LW
2590 esac
2591 ;;
0337d152
BG
2592 unixware) osname=svr5
2593 osvers="$4"
2594 ;;
2595 uts) osname=uts
a0d0e21e
LW
2596 osvers="$3"
2597 ;;
85e6fe83 2598 $2) case "$osname" in
2304df62 2599 *isc*) ;;
a0d0e21e 2600 *freebsd*) ;;
5f05dabc 2601 svr*)
a0d0e21e
LW
2602 : svr4.x or possibly later
2603 case "svr$3" in
2604 ${osname}*)
2605 osname=svr$3
2606 osvers=$4
2607 ;;
2608 esac
2609 case "$osname" in
2610 svr4.0)
2611 : Check for ESIX
2612 if test -f /stand/boot ; then
2613 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2614 if test -n "$INITPROG" -a -f "$INITPROG"; then
2615 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2616 if test -n "$isesix"; then
a0d0e21e
LW
2617 osname=esix4
2618 fi
2619 fi
2620 fi
2621 ;;
2622 esac
2623 ;;
2304df62 2624 *) if test -f /etc/systemid; then
a0d0e21e
LW
2625 osname=sco
2626 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2627 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2628 osvers=$1.$2.$3
c4f23d77 2629 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2630 osvers=$1.$2
c4f23d77 2631 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2632 osvers=$1
2304df62 2633 fi
a0d0e21e
LW
2634 else
2635 case "$osname" in
2636 '') : Still unknown. Probably a generic Sys V.
2637 osname="sysv"
2638 osvers="$3"
2639 ;;
2640 esac
2304df62
AD
2641 fi
2642 ;;
2643 esac
2644 ;;
a0d0e21e
LW
2645 *) case "$osname" in
2646 '') : Still unknown. Probably a generic BSD.
2647 osname="$1"
2648 osvers="$3"
2649 ;;
2650 esac
2651 ;;
2304df62
AD
2652 esac
2653 else
dfe9444c
AD
2654 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2655 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2656 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2657 osname=news_os
2304df62 2658 fi
dfe9444c 2659 $rm -f UU/kernel.what
8e07c86e
AD
2660 elif test -d c:/.; then
2661 set X $myuname
2662 osname=os2
2663 osvers="$5"
2304df62
AD
2664 fi
2665 fi
85e6fe83 2666
a0d0e21e
LW
2667 : Now look for a hint file osname_osvers, unless one has been
2668 : specified already.
2669 case "$hintfile" in
2670 ''|' ')
1e127011 2671 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 2672 : Also try without trailing minor version numbers.
1e127011
DD
2673 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2674 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2675 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2676 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
2677 case "$file" in
2678 '') dflt=none ;;
2679 *) case "$osvers" in
2680 '') dflt=$file
2681 ;;
dfe9444c 2682 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 2683 dflt=$file
dfe9444c 2684 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 2685 dflt=$xfile
dfe9444c 2686 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 2687 dflt=$xxfile
dfe9444c 2688 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 2689 dflt=$xxxfile
dfe9444c 2690 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 2691 dflt=$xxxxfile
dfe9444c 2692 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
2693 dflt="${osname}"
2694 else
2695 dflt=none
2696 fi
2697 ;;
2698 esac
85e6fe83
LW
2699 ;;
2700 esac
4e2a5f63
AD
2701 if $test -f Policy.sh ; then
2702 case "$dflt" in
2703 *Policy*) ;;
2704 none) dflt="Policy" ;;
2705 *) dflt="Policy $dflt" ;;
2706 esac
2707 fi
85e6fe83 2708 ;;
a0d0e21e 2709 *)
ecfc5424 2710 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 2711 ;;
2304df62 2712 esac
1aef975c 2713
4e2a5f63
AD
2714 if $test -f Policy.sh ; then
2715 $cat <<EOM
2716
2717There's also a Policy hint file available, which should make the
2718site-specific (policy) questions easier to answer.
2719EOM
2720
2721 fi
2722
2304df62
AD
2723 $cat <<EOM
2724
2725You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 2726A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 2727is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
2728
2729EOM
4e2a5f63 2730
2304df62 2731 rp="Which of these apply, if any?"
dfe9444c 2732 . UU/myread
85e6fe83
LW
2733 tans=$ans
2734 for file in $tans; do
4e2a5f63
AD
2735 if $test X$file = XPolicy -a -f Policy.sh; then
2736 . Policy.sh
2737 $cat Policy.sh >> UU/config.sh
2738 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
2739 . $src/hints/$file.sh
2740 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83 2741 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
2742 : nothing
2743 else
85e6fe83
LW
2744 : Give one chance to correct a possible typo.
2745 echo "$file.sh does not exist"
2746 dflt=$file
2747 rp="hint to use instead?"
dfe9444c 2748 . UU/myread
85e6fe83 2749 for file in $ans; do
dfe9444c
AD
2750 if $test -f "$src/hints/$file.sh"; then
2751 . $src/hints/$file.sh
2752 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
2753 elif $test X$ans = X -o X$ans = Xnone ; then
2754 : nothing
2755 else
2756 echo "$file.sh does not exist -- ignored."
2757 fi
2758 done
2304df62
AD
2759 fi
2760 done
85e6fe83 2761
2304df62 2762 hint=recommended
85e6fe83 2763 : Remember our hint file for later.
dfe9444c 2764 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 2765 hintfile="$file"
85e6fe83 2766 else
a0d0e21e 2767 hintfile=''
85e6fe83 2768 fi
2304df62
AD
2769fi
2770cd UU
2771;;
2772*)
2773 echo " "
2774 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
2775 tmp_n="$n"
2776 tmp_c="$c"
2304df62
AD
2777 cd ..
2778 cp $config_sh config.sh 2>/dev/null
a78b0d02 2779 chmod +w config.sh
2304df62
AD
2780 . ./config.sh
2781 cd UU
2782 cp ../config.sh .
ecfc5424
AD
2783 n="$tmp_n"
2784 c="$tmp_c"
2304df62
AD
2785 hint=previous
2786 ;;
2787esac
1aef975c 2788test "$override" && . ./optdef.sh
2304df62
AD
2789
2790: Restore computed paths
2791for file in $loclist $trylist; do
2792 eval $file="\$_$file"
2793done
2794
85e6fe83 2795cat << EOM
a0d0e21e 2796
85e6fe83 2797Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
2798The default value is probably right if the name rings a bell. Otherwise,
2799since spelling matters for me, either accept the default or answer "none"
2800to leave it blank.
a0d0e21e 2801
85e6fe83 2802EOM
85e6fe83 2803case "$osname" in
a0d0e21e 2804 ''|' ')
85e6fe83 2805 case "$hintfile" in
a0d0e21e 2806 ''|' '|none) dflt=none ;;
ecfc5424 2807 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
2808 esac
2809 ;;
2810 *) dflt="$osname" ;;
2811esac
2812rp="Operating system name?"
2813. ./myread
2814case "$ans" in
ecfc5424
AD
2815none) osname='' ;;
2816*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 2817esac
8ff267be 2818echo " "
2819case "$osvers" in
2820 ''|' ')
2821 case "$hintfile" in
2822 ''|' '|none) dflt=none ;;
2823 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2824 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2825 case "$dflt" in
2826 ''|' ') dflt=none ;;
2827 esac
2828 ;;
2829 esac
2830 ;;
2831 *) dflt="$osvers" ;;
2832esac
2833rp="Operating system version?"
2834. ./myread
2835case "$ans" in
2836none) osvers='' ;;
2837*) osvers="$ans" ;;
2838esac
2839
02e93a22
JH
2840
2841. ./posthint.sh
2842
2304df62 2843: who configured the system
59b83a6f 2844cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 2845cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
2846case "$cf_by" in
2847"")
8ff267be 2848 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
2849 case "$cf_by" in
2850 "") cf_by=unknown ;;
8ff267be 2851 esac ;;
2852esac
2304df62 2853
b4eb6b3d
JH
2854: set up the script used to warn in case of inconsistency
2855cat <<EOS >whoa
2856$startsh
2857EOS
2858cat <<'EOSC' >>whoa
2859dflt=y
2860echo " "
2861echo "*** WHOA THERE!!! ***" >&4
2862echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2863rp=" Keep the $hint value?"
2864. ./myread
2865case "$ans" in
2866y) td=$was; tu=$was;;
2867esac
2868EOSC
2869
2870: function used to set $1 to $val
2871setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2872case "$val$was" in
2873$define$undef) . ./whoa; eval "$var=\$td";;
2874$undef$define) . ./whoa; eval "$var=\$tu";;
2875*) eval "$var=$val";;
2876esac'
2877
2878case "$usethreads" in
2879$define|true|[yY]*) dflt='y';;
2880*) dflt='n';;
2881esac
2882cat <<EOM
2883
2884Perl can be built to take advantage of threads on some systems.
2885To do so, Configure can be run with -Dusethreads.
2886
2887Note that threading is a highly experimental feature, and
2888some known race conditions still remain. If you choose to try
2889it, be very sure to not actually deploy it for production
2890purposes. README.threads has more details, and is required
2891reading if you enable threads.
2892
2893If this doesn't make any sense to you, just accept the default '$dflt'.
2894EOM
2895rp='Build a threading Perl?'
2896. ./myread
2897case "$ans" in
2898y|Y) val="$define" ;;
2899*) val="$undef" ;;
2900esac
2901set usethreads
2902eval $setvar
2903
2904case "$usethreads" in
2905$define)
2906 $cat <<EOM
2907
2908As of 5.5.640, Perl has two different internal threading implementations,
2909the 5.005 version (5005threads) and an interpreter-based version
2910(ithreads) that has one interpreter per thread. Both are very
2911experimental. This arrangement exists to help developers work out
2912which one is better.
2913
2914If you're a casual user, you probably don't want interpreter-threads
2915at this time. There doesn't yet exist a way to create threads from
2916within Perl in this model, i.e., "use Thread;" will NOT work.
2917EOM
2918 : Default to ithreads unless overridden on command line or with
2919 : old config.sh
2920 dflt='y'
2921 case "$use5005threads" in
2922 $define|true|[yY]*) dflt='n';;
2923 esac
2924 case "$useithreads" in
2925 $undef|false|[nN]*) dflt='n';;
2926 esac
2927 rp='Use interpreter-based ithreads?'
2928 . ./myread
2929 case "$ans" in
2930 y|Y) val="$define" ;;
2931 *) val="$undef" ;;
2932 esac
2933 set useithreads
2934 eval $setvar
2935 : Now set use5005threads to the opposite value.
2936 case "$useithreads" in
2937 $define) val="$undef" ;;
2938 *) val="$define" ;;
2939 esac
2940 set use5005threads
2941 eval $setvar
2942 ;;
2943*)
2944 useithreads="$undef"
2945 use5005threads="$undef"
2946 ;;
2947esac
2948
c915ce7f
JH
2949case "$useithreads$use5005threads" in
2950"$define$define")
2951 $cat >&4 <<EOM
2952
2953You cannot have both the ithreads and the 5.005 threads enabled
2954at the same time. Disabling the 5.005 threads since they are
2955much less stable than the ithreads.
2956
2957EOM
2958 use5005threads="$undef"
2959 ;;
2960esac
2961
b4eb6b3d
JH
2962case "$d_oldpthreads" in
2963'') : Configure tests would be welcome here. For now, assume undef.
2964 val="$undef" ;;
2965*) val="$d_oldpthreads" ;;
2966esac
2967set d_oldpthreads
2968eval $setvar
2969
2970
2971case "$usethreads" in
2972"$define"|true|[yY]*)
2973: Look for a hint-file generated 'call-back-unit'. If the
2974: user has specified that a threading perl is to be built,
2975: we may need to set or change some other defaults.
2976 if $test -f usethreads.cbu; then
2977 echo "Your platform has some specific hints for threaded builds, using them..."
2978 . ./usethreads.cbu
2979 else
2980 $cat <<EOM
2981(Your platform doesn't have any specific hints for threaded builds.
2982 Assuming POSIX threads, then.)
2983EOM
2984 fi
2985 ;;
2986esac
2987
2988cat <<EOM
2989
2990Perl can be built so that multiple Perl interpreters can coexist
2991within the same Perl executable.
2992EOM
2993
2994case "$useithreads" in
2995$define)
2996 cat <<EOM
2997This multiple interpreter support is required for interpreter-based threads.
2998EOM
2999 val="$define"
3000 ;;
3001*) case "$usemultiplicity" in
3002 $define|true|[yY]*) dflt='y';;
3003 *) dflt='n';;
3004 esac
3005 echo " "
3006 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3007 rp='Build Perl for multiplicity?'
3008 . ./myread
3009 case "$ans" in
3010 y|Y) val="$define" ;;
3011 *) val="$undef" ;;
3012 esac
3013 ;;
3014esac
3015set usemultiplicity
3016eval $setvar
3017
e5e20432
JH
3018: make some quick guesses about what we are up against
3019echo " "
3020$echo $n "Hmm... $c"
3021echo exit 1 >bsd
3022echo exit 1 >usg
3023echo exit 1 >v7
3024echo exit 1 >osf1
3025echo exit 1 >eunice
3026echo exit 1 >xenix
3027echo exit 1 >venix
3028echo exit 1 >os2
3029d_bsd="$undef"
3030$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3031if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3032then
3033 echo "Looks kind of like an OSF/1 system, but we'll see..."
3034 echo exit 0 >osf1
381aa1ff 3035elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3036 xxx=`./loc addbib blurfl $pth`
3037 if $test -f $xxx; then
3038 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3039 echo exit 0 >bsd
3040 echo exit 0 >usg
3041 else
3042 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3043 echo "Looks kind of like an extended USG system, but we'll see..."
3044 else
3045 echo "Looks kind of like a USG system, but we'll see..."
3046 fi
3047 echo exit 0 >usg
3048 fi
3049elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3050 echo "Looks kind of like a BSD system, but we'll see..."
3051 d_bsd="$define"
3052 echo exit 0 >bsd
3053else
3054 echo "Looks kind of like a Version 7 system, but we'll see..."
3055 echo exit 0 >v7
3056fi
3057case "$eunicefix" in
3058*unixtovms*)
3059 $cat <<'EOI'
3060There is, however, a strange, musty smell in the air that reminds me of
3061something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3062EOI
3063 echo exit 0 >eunice
3064 d_eunice="$define"
3065: it so happens the Eunice I know will not run shell scripts in Unix format
3066 ;;
3067*)
3068 echo " "
3069 echo "Congratulations. You aren't running Eunice."
3070 d_eunice="$undef"
3071 ;;
3072esac
3073: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3074: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3075: semicolon as a patch separator
e5e20432
JH
3076case "$p_" in
3077:) ;;
3078*)
3079 $cat <<'EOI'
3080I have the feeling something is not exactly right, however...don't tell me...
3081lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3082(Or you may be running DOS with DJGPP.)
e5e20432
JH
3083EOI
3084 echo exit 0 >os2
3085 ;;
3086esac
3087if test -f /xenix; then
3088 echo "Actually, this looks more like a XENIX system..."
3089 echo exit 0 >xenix
3090 d_xenix="$define"
3091else
3092 echo " "
3093 echo "It's not Xenix..."
3094 d_xenix="$undef"
3095fi
3096chmod +x xenix
3097$eunicefix xenix
3098if test -f /venix; then
3099 echo "Actually, this looks more like a VENIX system..."
3100 echo exit 0 >venix
3101else
3102 echo " "
3103 if ./xenix; then
3104 : null
3105 else
3106 echo "Nor is it Venix..."
3107 fi
3108fi
3109chmod +x bsd usg v7 osf1 eunice xenix venix os2
3110$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3111$rm -f foo
3112
5869b1f1
JH
3113case "$cc" in
3114'') dflt=cc;;
3115*) dflt="$cc";;
3116esac
3117rp="Use which C compiler?"
3118. ./myread
3119cc="$ans"
e5e20432
JH
3120: Look for a hint-file generated 'call-back-unit'. Now that the
3121: user has specified the compiler, we may need to set or change some
3122: other defaults.
3123if $test -f cc.cbu; then
3124 . ./cc.cbu
3125fi
2573c5f9 3126. ./checkcc
8a27cf78 3127
e5e20432
JH
3128echo " "
3129echo "Checking for GNU cc in disguise and/or its version number..." >&4
3130$cat >gccvers.c <<EOM
3131#include <stdio.h>
3132int main() {
3133#ifdef __GNUC__
3134#ifdef __VERSION__
3135 printf("%s\n", __VERSION__);
3136#else
3137 printf("%s\n", "1");
3138#endif
3139#endif
3140 exit(0);
3141}
3142EOM
7a282f6d 3143if $cc -o gccvers $ldflags gccvers.c; then
e5e20432
JH
3144 gccversion=`./gccvers`
3145 case "$gccversion" in
3146 '') echo "You are not using GNU cc." ;;
fc68435e 3147 *) echo "You are using GNU cc $gccversion."
e723fc21 3148 ccname=gcc
fc68435e 3149 ;;
e5e20432
JH
3150 esac
3151else
3152 echo " "
3153 echo "*** WHOA THERE!!! ***" >&4
3154 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3155 case "$knowitall" in
3156 '')
3157 echo " You'd better start hunting for one and let me know about it." >&4
3158 exit 1
3159 ;;
3160 esac
3161fi
3162$rm -f gccvers*
3163case "$gccversion" in
31641*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3165esac
5b463ca7
KS
3166case "$gccversion" in
3167'') gccosandvers='' ;;
10b4ebb5
JH
3168*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3169 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3170 gccshortvers=''
5b463ca7 3171 case "$gccosandvers" in
02903077
JH
3172 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3173 $osname$osvers) ;; # looking good
5b463ca7
KS
3174 $osname*) cat <<EOM >&4
3175
3176*** WHOA THERE!!! ***
3177
3178 Your gcc has not been compiled for the exact release of
3179 your operating system ($gccosandvers versus $osname$osvers).
3180
3181 In general it is a good idea to keep gcc synchronized with
3182 the operating system because otherwise serious problems
3183 may ensue when trying to compile software, like Perl.
3184
3185 I'm trying to be optimistic here, though, and will continue.
3186 If later during the configuration and build icky compilation
02903077
JH
3187 problems appear (headerfile conflicts being the most common
3188 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3189 your operating system release.
3190
3191EOM
3192 ;;
81575342 3193 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3194 esac
3195 ;;
3196esac
e723fc21
JH
3197case "$ccname" in
3198'') ccname="$cc" ;;
3199esac
e5e20432 3200
8a27cf78
JH
3201: see how we invoke the C preprocessor
3202echo " "
3203echo "Now, how can we feed standard input to your C preprocessor..." >&4
3204cat <<'EOT' >testcpp.c
3205#define ABC abc
3206#define XYZ xyz
3207ABC.XYZ
3208EOT
3209cd ..
3210if test ! -f cppstdin; then
3211 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3212 # AIX cc -E doesn't show the absolute headerfile
3213 # locations but we'll cheat by using the -M flag.
3214 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
3215 else
3216 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3217 fi
3218else
3219 echo "Keeping your $hint cppstdin wrapper."
3220fi
3221chmod 755 cppstdin
3222wrapper=`pwd`/cppstdin
3223ok='false'
3224cd UU
3225
3226if $test "X$cppstdin" != "X" && \
3227 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3228 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3229then
3230 echo "You used to use $cppstdin $cppminus so we'll use that again."
3231 case "$cpprun" in
3232 '') echo "But let's see if we can live without a wrapper..." ;;
3233 *)
3234 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3235 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3236 then
3237 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3238 ok='true'
3239 else
3240 echo "(However, $cpprun $cpplast does not work, let's see...)"
3241 fi
3242 ;;
3243 esac
3244else
3245 case "$cppstdin" in
3246 '') ;;
3247 *)
3248 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3249 ;;
3250 esac
3251fi
3252
3253if $ok; then
3254 : nothing
3255elif echo 'Maybe "'"$cc"' -E" will work...'; \
3256 $cc -E <testcpp.c >testcpp.out 2>&1; \
3257 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3258 echo "Yup, it does."
3259 x_cpp="$cc -E"
3260 x_minus='';
3261elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3262 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3263 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3264 echo "Yup, it does."
3265 x_cpp="$cc -E"
3266 x_minus='-';
3267elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3268 $cc -P <testcpp.c >testcpp.out 2>&1; \
3269 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3270 echo "Yipee, that works!"
3271 x_cpp="$cc -P"
3272 x_minus='';
3273elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3274 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3275 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3276 echo "At long last!"
3277 x_cpp="$cc -P"
3278 x_minus='-';
3279elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3280 $cpp <testcpp.c >testcpp.out 2>&1; \
3281 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3282 echo "It works!"
3283 x_cpp="$cpp"
3284 x_minus='';
3285elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3286 $cpp - <testcpp.c >testcpp.out 2>&1; \
3287 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3288 echo "Hooray, it works! I was beginning to wonder."
3289 x_cpp="$cpp"
3290 x_minus='-';
3291elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3292 $wrapper <testcpp.c >testcpp.out 2>&1; \
3293 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3294 x_cpp="$wrapper"
3295 x_minus=''
3296 echo "Eureka!"
3297else
3298 dflt=''
3299 rp="No dice. I can't find a C preprocessor. Name one:"
3300 . ./myread
3301 x_cpp="$ans"
3302 x_minus=''
3303 $x_cpp <testcpp.c >testcpp.out 2>&1
3304 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3305 echo "OK, that will do." >&4
3306 else
3307echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3308 exit 1
3309 fi
3310fi
3311
3312case "$ok" in
3313false)
3314 cppstdin="$x_cpp"
3315 cppminus="$x_minus"
3316 cpprun="$x_cpp"
3317 cpplast="$x_minus"
3318 set X $x_cpp
3319 shift
3320 case "$1" in
3321 "$cpp")
3322 echo "Perhaps can we force $cc -E using a wrapper..."
3323 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3324 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3325 then
3326 echo "Yup, we can."
3327 cppstdin="$wrapper"
3328 cppminus='';
3329 else
3330 echo "Nope, we'll have to live without it..."
3331 fi
3332 ;;
3333 esac
3334 case "$cpprun" in
3335 "$wrapper")
3336 cpprun=''
3337 cpplast=''
3338 ;;
3339 esac
3340 ;;
3341esac
3342
3343case "$cppstdin" in
3344"$wrapper"|'cppstdin') ;;
3345*) $rm -f $wrapper;;
3346esac
3347$rm -f testcpp.c testcpp.out
3348
bd9b35c9
JH
3349: decide how portable to be. Allow command line overrides.
3350case "$d_portable" in
3351"$undef") ;;
3352*) d_portable="$define" ;;
104d25b7 3353esac
85ab1d1d 3354
bd9b35c9
JH
3355: set up shell script to do ~ expansion
3356cat >filexp <<EOSS
3357$startsh
3358: expand filename
3359case "\$1" in
3360 ~/*|~)
3361 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3362 ;;
3363 ~*)
3364 if $test -f /bin/csh; then
3365 /bin/csh -f -c "glob \$1"
3366 failed=\$?
3367 echo ""
3368 exit \$failed
e5e20432 3369 else
bd9b35c9
JH
3370 name=\`$expr x\$1 : '..\([^/]*\)'\`
3371 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3372 if $test ! -d "\$dir"; then
3373 me=\`basename \$0\`
3374 echo "\$me: can't locate home directory for: \$name" >&2
3375 exit 1
3376 fi
3377 case "\$1" in
3378 */*)
3379 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3380 ;;
3381 *)
3382 echo \$dir
e5e20432
JH
3383 ;;
3384 esac
3385 fi
b691c02f 3386 ;;
4633a7c4 3387*)
bd9b35c9 3388 echo \$1
2304df62
AD
3389 ;;
3390esac
4633a7c4
LW
3391EOSS
3392chmod +x filexp
3393$eunicefix filexp
2304df62
AD
3394
3395: now set up to get a file name
28757baa 3396cat <<EOS >getfile
3397$startsh
3398EOS
3399cat <<'EOSC' >>getfile
2304df62
AD
3400tilde=''
3401fullpath=''
3402already=''
3403skip=''
3404none_ok=''
3405exp_file=''
a0d0e21e 3406nopath_ok=''
2304df62
AD
3407orig_rp="$rp"
3408orig_dflt="$dflt"
b233458b
JH
3409case "$gfpth" in
3410'') gfpth='.' ;;
3411esac
2304df62
AD
3412
3413case "$fn" in
ecfc5424 3414*\(*)
381aa1ff 3415 expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
3416 fn=`echo $fn | sed 's/(.*)//'`
3417 ;;
3418esac
3419
3420case "$fn" in
a0d0e21e
LW
3421*:*)
3422 loc_file=`expr $fn : '.*:\(.*\)'`
3423 fn=`expr $fn : '\(.*\):.*'`
3424 ;;
3425esac
3426
3427case "$fn" in
2304df62
AD
3428*~*) tilde=true;;
3429esac
3430case "$fn" in
3431*/*) fullpath=true;;
3432esac
3433case "$fn" in
3434*+*) skip=true;;
3435esac
3436case "$fn" in
3437*n*) none_ok=true;;
3438esac
3439case "$fn" in
3440*e*) exp_file=true;;
3441esac
a0d0e21e
LW
3442case "$fn" in
3443*p*) nopath_ok=true;;
3444esac
2304df62
AD
3445
3446case "$fn" in
3447*f*) type='File';;
3448*d*) type='Directory';;
a0d0e21e 3449*l*) type='Locate';;
2304df62
AD
3450esac
3451
3452what="$type"
3453case "$what" in
3454Locate) what='File';;
3455esac
3456
3457case "$exp_file" in
3458'')
3459 case "$d_portable" in
3460 "$define") ;;
3461 *) exp_file=true;;
3462 esac
3463 ;;
3464esac
3465
3466cd ..
3467while test "$type"; do
3468 redo=''
3469 rp="$orig_rp"
3470 dflt="$orig_dflt"
3471 case "$tilde" in
3472 true) rp="$rp (~name ok)";;
3473 esac
3474 . UU/myread
ecfc5424
AD
3475 if test -f UU/getfile.ok && \
3476 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3477 then
3478 value="$ans"
3479 ansexp="$ans"
3480 break
3481 fi
2304df62
AD
3482 case "$ans" in
3483 none)
3484 value=''
3485 ansexp=''
3486 case "$none_ok" in
3487 true) type='';;
3488 esac
3489 ;;
3490 *)
3491 case "$tilde" in
3492 '') value="$ans"
3493 ansexp="$ans";;
3494 *)
3495 value=`UU/filexp $ans`
3496 case $? in
3497 0)
3498 if test "$ans" != "$value"; then
ecfc5424 3499 echo "(That expands to $value on this system.)"
2304df62
AD
3500 fi
3501 ;;
3502 *) value="$ans";;
3503 esac
3504 ansexp="$value"
3505 case "$exp_file" in
3506 '') value="$ans";;
3507 esac
3508 ;;
3509 esac
3510 case "$fullpath" in
3511 true)
3512 case "$ansexp" in
3513 /*) value="$ansexp" ;;
23da6c43 3514 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
3515 *)
3516 redo=true
3517 case "$already" in
3518 true)
3519 echo "I shall only accept a full path name, as in /bin/ls." >&4
3520 echo "Use a ! shell escape if you wish to check pathnames." >&4
3521 ;;
3522 *)
3523 echo "Please give a full path name, starting with slash." >&4
3524 case "$tilde" in
3525 true)
3526 echo "Note that using ~name is ok provided it expands well." >&4
3527 already=true
3528 ;;
3529 esac
3530 esac
3531 ;;
3532 esac
3533 ;;
3534 esac
3535 case "$redo" in
3536 '')
3537 case "$type" in
3538 File)
b233458b
JH
3539 for fp in $gfpth; do
3540 if test "X$fp" = X.; then
3541 pf="$ansexp"
3542 else
3543 pf="$fp/$ansexp"
3544 fi
3545 if test -f "$pf"; then
3546 type=''
3547 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3548 then
3549 echo "($value is not a plain file, but that's ok.)"
3550 type=''
3551 fi
3552 if test X"$type" = X; then
3553 value="$pf"
3554 break
3555 fi
3556 done
2304df62
AD
3557 ;;
3558 Directory)
b233458b
JH
3559 for fp in $gfpth; do
3560 if test "X$fp" = X.; then
f78bfc9c
JH
3561 dir="$ans"
3562 direxp="$ansexp"
b233458b 3563 else
dd858076 3564 dir="$fp/$ansexp"
f78bfc9c 3565 direxp="$fp/$ansexp"
b233458b 3566 fi
f78bfc9c 3567 if test -d "$direxp"; then
b233458b 3568 type=''
f78bfc9c 3569 value="$dir"
b233458b
JH
3570 break
3571 fi
3572 done
2304df62
AD
3573 ;;
3574 Locate)
40000a8c 3575 if test -d "$ansexp"; then
a0d0e21e
LW
3576 echo "(Looking for $loc_file in directory $value.)"
3577 value="$value/$loc_file"
40000a8c 3578 ansexp="$ansexp/$loc_file"
2304df62 3579 fi
40000a8c 3580 if test -f "$ansexp"; then
2304df62
AD
3581 type=''
3582 fi
a0d0e21e
LW
3583 case "$nopath_ok" in
3584 true) case "$value" in
3585 */*) ;;
3586 *) echo "Assuming $value will be in people's path."
3587 type=''
3588 ;;
3589 esac
3590 ;;
3591 esac
2304df62
AD
3592 ;;
3593 esac
3594
3595 case "$skip" in
3596 true) type='';
3597 esac
3598
3599 case "$type" in
3600 '') ;;
3601 *)
3602 if test "$fastread" = yes; then
3603 dflt=y
3604 else
3605 dflt=n
3606 fi
3607 rp="$what $value doesn't exist. Use that name anyway?"
3608 . UU/myread
3609 dflt=''
3610 case "$ans" in
3611 y*) type='';;
3612 *) echo " ";;
3613 esac
3614 ;;
3615 esac
3616 ;;
3617 esac
3618 ;;
3619 esac
3620done
3621cd UU
3622ans="$value"
3623rp="$orig_rp"
3624dflt="$orig_dflt"
ecfc5424 3625rm -f getfile.ok
b233458b 3626test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3627EOSC
3628
bd9b35c9
JH
3629: What should the include directory be ?
3630echo " "
3631$echo $n "Hmm... $c"
3632dflt='/usr/include'
3633incpath=''
3634mips_type=''
3635if $test -f /bin/mips && /bin/mips; then
3636 echo "Looks like a MIPS system..."
3637 $cat >usr.c <<'EOCP'
3638#ifdef SYSTYPE_BSD43
3639/bsd43
3640#endif
3641EOCP
8a27cf78 3642 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
3643 dflt='/bsd43/usr/include'
3644 incpath='/bsd43'
3645 mips_type='BSD 4.3'
3646 else
3647 mips_type='System V'
3648 fi
3649 $rm -f usr.c usr.out
3650 echo "and you're compiling with the $mips_type compiler and libraries."
3651 xxx_prompt=y
3652 echo "exit 0" >mips
3653else
3654 echo "Doesn't look like a MIPS system."
3655 xxx_prompt=n
3656 echo "exit 1" >mips
3657fi
3658chmod +x mips
3659$eunicefix mips
3660case "$usrinc" in
3661'') ;;
3662*) dflt="$usrinc";;
3663esac
3664case "$xxx_prompt" in
3665y) fn=d/
3666 echo " "
3667 rp='Where are the include files you want to use?'
3668 . ./getfile
3669 usrinc="$ans"
8e07c86e 3670 ;;
bd9b35c9 3671*) usrinc="$dflt"
8e07c86e
AD
3672 ;;
3673esac
2304df62 3674
bd9b35c9
JH
3675: Set private lib path
3676case "$plibpth" in
3677'') if ./mips; then
3678 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3679 fi;;
3680esac
3681case "$libpth" in
3682' ') dlist='';;
3683'') dlist="$loclibpth $plibpth $glibpth";;
3684*) dlist="$libpth";;
3685esac
3686
3687: Now check and see which directories actually exist, avoiding duplicates
3688libpth=''
3689for xxx in $dlist
3690do
3691 if $test -d $xxx; then
3692 case " $libpth " in
3693 *" $xxx "*) ;;
3694 *) libpth="$libpth $xxx";;
3695 esac
3696 fi
3697done
3698$cat <<'EOM'
3699
3700Some systems have incompatible or broken versions of libraries. Among
3701the directories listed in the question below, please remove any you
3702know not to be holding relevant libraries, and add any that are needed.
3703Say "none" for none.
8e07c86e
AD
3704
3705EOM
bd9b35c9
JH
3706case "$libpth" in
3707'') dflt='none';;
8e07c86e 3708*)
bd9b35c9
JH
3709 set X $libpth
3710 shift
3711 dflt=${1+"$@"}
8e07c86e 3712 ;;
a0d0e21e 3713esac
bd9b35c9
JH
3714rp="Directories to use for library searches?"
3715. ./myread
3716case "$ans" in
3717none) libpth=' ';;
3718*) libpth="$ans";;
3719esac
a0d0e21e 3720
bd9b35c9
JH
3721: compute shared library extension
3722case "$so" in
3723'')
3724 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3725 dflt='sl'
dd4e71fd 3726 else
bd9b35c9 3727 dflt='so'
dd4e71fd
JH
3728 fi
3729 ;;
bd9b35c9 3730*) dflt="$so";;
dd4e71fd 3731esac
dd4e71fd
JH
3732$cat <<EOM
3733
bd9b35c9 3734On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 3735you want to suppress searching of shared libraries for the remainder
bd9b35c9 3736of this configuration.
dd4e71fd
JH
3737
3738EOM
bd9b35c9
JH
3739rp='What is the file extension used for shared libraries?'
3740. ./myread
3741so="$ans"
dd4e71fd 3742
bd9b35c9
JH
3743: Define several unixisms.
3744: Hints files or command line option can be used to override them.
3745: The convoluted testing is in case hints files set either the old
3746: or the new name.
3747case "$_exe" in
3748'') case "$exe_ext" in
3749 '') ;;
3750 *) _exe="$exe_ext" ;;
dd4e71fd 3751 esac
bd9b35c9 3752 ;;
bfb7748a 3753esac
bd9b35c9
JH
3754case "$_a" in
3755'') case "$lib_ext" in
3756 '') _a='.a';;
3757 *) _a="$lib_ext" ;;
dd4e71fd
JH
3758 esac
3759 ;;
dd4e71fd 3760esac
bd9b35c9
JH
3761case "$_o" in
3762'') case "$obj_ext" in
3763 '') _o='.o';;
3764 *) _o="$obj_ext";;
3765 esac
3766 ;;
3767esac
3768case "$p_" in
3769'') case "$path_sep" in
3770 '') p_=':';;
3771 *) p_="$path_sep";;
3772 esac
3773 ;;
3774esac
3775exe_ext=$_exe
3776lib_ext=$_a
3777obj_ext=$_o
3778path_sep=$p_
dd4e71fd 3779
b4eb6b3d
JH
3780: Which makefile gets called first. This is used by make depend.
3781case "$firstmakefile" in
3782'') firstmakefile='makefile';;
4633a7c4 3783esac
4633a7c4 3784
0f0995ae
JH
3785case "$usesocks" in
3786$define|true|[yY]*) dflt='y';;
3787*) dflt='n';;
3788esac
bd9b35c9 3789cat <<EOM
4633a7c4 3790
bd9b35c9 3791Perl can be built to use the SOCKS proxy protocol library. To do so,
cf829ab0
JH
3792Configure must be run with -Dusesocks. If you use SOCKS you also need
3793to use the PerlIO abstraction layer, this will be implicitly selected.
4633a7c4 3794
0f0995ae 3795If this doesn't make any sense to you, just accept the default '$dflt'.
bd9b35c9 3796EOM
bd9b35c9
JH
3797rp='Build Perl for SOCKS?'
3798. ./myread
3799case "$ans" in
3800y|Y) val="$define" ;;
3801*) val="$undef" ;;
3802esac
3803set usesocks
3804eval $setvar
3805
cf829ab0
JH
3806case "$usesocks" in
3807$define|true|[yY]*) useperlio="$define";;
3808esac
3809
bd9b35c9
JH
3810: Looking for optional libraries
3811echo " "
3812echo "Checking for optional libraries..." >&4
3813case "$libs" in
3814' '|'') dflt='';;
3815*) dflt="$libs";;
3816esac
3817case "$libswanted" in
3818'') libswanted='c_s';;
3819esac
3820case "$usesocks" in
923fc586 3821"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 3822esac
68435ea7
JH
3823libsfound=''
3824libsfiles=''
3825libsdirs=''
13b3f787
JH
3826libspath=''
3827for thisdir in $libpth $xlibpth; do
3828 test -d $thisdir && libspath="$libspath $thisdir"
3829done
bd9b35c9 3830for thislib in $libswanted; do
13b3f787 3831 for thisdir in $libspath; do
f7dd4e7f
JH
3832 xxx=''
3833 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3834 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3835 $test -f "$xxx" && eval $libscheck
3836 $test -f "$xxx" && libstyle=shared
3837 fi
3838 if test ! -f "$xxx"; then
3839 xxx=$thisdir/lib$thislib.$so
3840 $test -f "$xxx" && eval $libscheck
3841 $test -f "$xxx" && libstyle=shared
3842 fi
3843 if test ! -f "$xxx"; then
3844 xxx=$thisdir/lib$thislib$_a
3845 $test -f "$xxx" && eval $libscheck
3846 $test -f "$xxx" && libstyle=static
3847 fi
3848 if test ! -f "$xxx"; then
3849 xxx=$thisdir/$thislib$_a
3850 $test -f "$xxx" && eval $libscheck
3851 $test -f "$xxx" && libstyle=static
3852 fi
3853 if test ! -f "$xxx"; then
3854 xxx=$thisdir/lib${thislib}_s$_a
3855 $test -f "$xxx" && eval $libscheck
3856 $test -f "$xxx" && libstyle=static
09ea5ba9 3857 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
3858 fi
3859 if test ! -f "$xxx"; then
3860 xxx=$thisdir/Slib$thislib$_a
3861 $test -f "$xxx" && eval $libscheck
3862 $test -f "$xxx" && libstyle=static
3863 fi
3864 if $test -f "$xxx"; then
43999f95 3865 case "$libstyle" in
f7dd4e7f
JH
3866 shared) echo "Found -l$thislib (shared)." ;;
3867 static) echo "Found -l$thislib." ;;
3868 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 3869 esac
bd9b35c9
JH
3870 case " $dflt " in
3871 *"-l$thislib "*);;
f7dd4e7f 3872 *) dflt="$dflt -l$thislib"
43999f95
JH
3873 libsfound="$libsfound $xxx"
3874 yyy=`basename $xxx`
3875 libsfiles="$libsfiles $yyy"
1e127011 3876 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
3877 case " $libsdirs " in
3878 *" $yyy "*) ;;
3879 *) libsdirs="$libsdirs $yyy" ;;
3880 esac
3881 ;;
bd9b35c9 3882 esac
f7dd4e7f
JH
3883 break
3884 fi
3885 done
3886 if $test ! -f "$xxx"; then
3887 echo "No -l$thislib."
bd9b35c9
JH
3888 fi
3889done
3890set X $dflt
3891shift
3892dflt="$*"
3893case "$libs" in
3894'') dflt="$dflt";;
3895*) dflt="$libs";;
3896esac
3897case "$dflt" in
3898' '|'') dflt='none';;
3899esac
4633a7c4 3900
bd9b35c9 3901$cat <<EOM
4633a7c4 3902
bd9b35c9
JH
3903In order to compile $package on your machine, a number of libraries
3904are usually needed. Include any other special libraries here as well.
3905Say "none" for none. The default list is almost always right.
8e07c86e 3906EOM
8e07c86e 3907
bd9b35c9
JH
3908echo " "
3909rp="What libraries to use?"
3910. ./myread
3911case "$ans" in
3912none) libs=' ';;
3913*) libs="$ans";;
3914esac
d71b2b6b 3915
bd9b35c9
JH
3916: determine optimization, if desired, or use for debug flag also
3917case "$optimize" in
3918' '|$undef) dflt='none';;
3919'') dflt='-O';;
3920*) dflt="$optimize";;
3921esac
3922$cat <<EOH
d71b2b6b 3923
bd9b35c9
JH
3924By default, $package compiles with the -O flag to use the optimizer.
3925Alternately, you might want to use the symbolic debugger, which uses
3926the -g flag (on traditional Unix systems). Either flag can be
3927specified here. To use neither flag, specify the word "none".
d71b2b6b 3928
bd9b35c9
JH
3929EOH
3930rp="What optimizer/debugger flag should be used?"
3931. ./myread
3932optimize="$ans"
3933case "$optimize" in
3934'none') optimize=" ";;
3935esac
3936
3937dflt=''
3938: We will not override a previous value, but we might want to
3939: augment a hint file
3940case "$hint" in
3941default|recommended)
3942 case "$gccversion" in
3943 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 3944 esac
bd9b35c9
JH
3945 case "$optimize" in
3946 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 3947 esac
bd9b35c9
JH
3948 case "$gccversion" in
3949 2*) if test -d /etc/conf/kconfig.d &&
3950 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3951 then
3952 dflt="$dflt -posix"
3953 fi
f0d04425 3954 ;;
bd9b35c9
JH
3955 esac
3956 case "$gccversion" in
3957 1*) ;;
3958 2.[0-8]*) ;;
3959 ?*) echo " "
3960 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3961 echo 'int main(void) { return 0; }' > gcctest.c
3962 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3963 echo "Yes, it does." 2>&1
3964 case "$ccflags" in
3965 *strict-aliasing*)
3966 echo "Leaving current flags $ccflags alone." 2>&1
3967 ;;
3968 *) dflt="$dflt -fno-strict-aliasing" ;;
3969 esac
3970 else
3971 echo "Nope, it doesn't, but that's ok." 2>&1
3972 fi
f0d04425 3973 ;;
e5e20432
JH
3974 esac
3975 ;;
3976esac
3977
bd9b35c9
JH
3978case "$mips_type" in
3979*BSD*|'') inclwanted="$locincpth $usrinc";;
3980*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3981esac
3982for thisincl in $inclwanted; do
3983 if $test -d $thisincl; then
3984 if $test x$thisincl != x$usrinc; then
3985 case "$dflt" in
422af00a
LC
3986 *" -I$thisincl "*);;
3987 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
3988 esac
3989 fi
3990 fi
3991done
40a7a20a 3992
bd9b35c9
JH
3993inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3994 xxx=true;
3995elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3996 xxx=true;
3997else
3998 xxx=false;
3999fi;
4000if $xxx; then
4001 case "$dflt" in
4002 *$2*);;
4003 *) dflt="$dflt -D$2";;
4004 esac;
4005fi'
40a7a20a 4006
bd9b35c9 4007set signal.h LANGUAGE_C; eval $inctest
40a7a20a 4008
bd9b35c9
JH
4009case "$usesocks" in
4010$define)
4011 ccflags="$ccflags -DSOCKS"
4012 ;;
4013esac
40a7a20a 4014
bd9b35c9
JH
4015case "$hint" in
4016default|recommended) dflt="$ccflags $dflt" ;;
4017*) dflt="$ccflags";;
4018esac
40a7a20a 4019
bd9b35c9
JH
4020case "$dflt" in
4021''|' ') dflt=none;;
4022esac
422af00a 4023
bd9b35c9 4024$cat <<EOH
40a7a20a 4025
bd9b35c9
JH
4026Your C compiler may want other flags. For this question you should include
4027-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4028but you should NOT include libraries or ld flags like -lwhatever. If you
4029want $package to honor its debug switch, you should include -DDEBUGGING here.
4030Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 4031
bd9b35c9 4032To use no flags, specify the word "none".
40a7a20a 4033
bd9b35c9
JH
4034EOH
4035set X $dflt
4036shift
4037dflt=${1+"$@"}
4038rp="Any additional cc flags?"
4039. ./myread
4040case "$ans" in
4041none) ccflags='';;
4042*) ccflags="$ans";;
4043esac
8e07c86e 4044
bd9b35c9
JH
4045: the following weeds options from ccflags that are of no interest to cpp
4046cppflags="$ccflags"
4047case "$gccversion" in
40481*) cppflags="$cppflags -D__GNUC__"
4633a7c4 4049esac
bd9b35c9
JH
4050case "$mips_type" in
4051'');;
4052*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4053esac
4054case "$cppflags" in
4055'');;
4056*)
4057 echo " "
4058 echo "Let me guess what the preprocessor flags are..." >&4
4059 set X $cppflags
4060 shift
4061 cppflags=''
4062 $cat >cpp.c <<'EOM'
4063#define BLURFL foo
8e07c86e 4064
bd9b35c9
JH
4065BLURFL xx LFRULB
4066EOM
4067 previous=''
4068 for flag in $*
4069 do
4070 case "$flag" in
4071 -*) ftry="$flag";;
4072 *) ftry="$previous $flag";;
4073 esac
4074 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4075 >cpp1.out 2>/dev/null && \
4076 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4077 >cpp2.out 2>/dev/null && \
4078 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4079 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4080 then
4081 cppflags="$cppflags $ftry"
4082 previous=''
4083 else
4084 previous="$flag"
4085 fi
4086 done
4087 set X $cppflags
4088 shift
4089 cppflags=${1+"$@"}
4090 case "$cppflags" in
4091 *-*) echo "They appear to be: $cppflags";;
4092 esac
4093 $rm -f cpp.c cpp?.out
2afac517 4094 ;;
4095esac
8e07c86e 4096
bd9b35c9
JH
4097: flags used in final linking phase
4098case "$ldflags" in
4099'') if ./venix; then
4100 dflt='-i -z'
10a23457 4101 else
bd9b35c9 4102 dflt=''
10a23457 4103 fi
bd9b35c9
JH
4104 case "$ccflags" in
4105 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 4106 esac
bd9b35c9
JH
4107 ;;
4108*) dflt="$ldflags";;
4109esac
4110
4111: Try to guess additional flags to pick up local libraries.
4112for thislibdir in $libpth; do
4113 case " $loclibpth " in
4114 *" $thislibdir "*)
4115 case "$dflt " in
4116 *"-L$thislibdir "*) ;;
4117 *) dflt="$dflt -L$thislibdir" ;;
4118 esac
c4f23d77
AD
4119 ;;
4120 esac
bd9b35c9 4121done
c4f23d77 4122
bd9b35c9
JH
4123case "$dflt" in
4124'') dflt='none' ;;
4125esac
c4f23d77 4126
bd9b35c9
JH
4127$cat <<EOH
4128
4129Your C linker may need flags. For this question you should
4130include -L/whatever and any other flags used by the C linker, but you
4131should NOT include libraries like -lwhatever.
4132
4133Make sure you include the appropriate -L/path flags if your C linker
4134does not normally search all of the directories you specified above,
4135namely
4136 $libpth
4137To use no flags, specify the word "none".
4138
4139EOH
4140
4141rp="Any additional ld flags (NOT including libraries)?"
4142. ./myread
4143case "$ans" in
4144none) ldflags='';;
4145*) ldflags="$ans";;
4146esac
4147rmlist="$rmlist pdp11"
4148
4149: coherency check
4150echo " "
4151echo "Checking your choice of C compiler and flags for coherency..." >&4
4152$cat > try.c <<'EOF'
4153#include <stdio.h>
4154int main() { printf("Ok\n"); exit(0); }
4155EOF
7a282f6d 4156set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
4157shift
4158$cat >try.msg <<'EOM'
4159I've tried to compile and run the following simple program:
4160
4161EOM
4162$cat try.c >> try.msg
4163
4164$cat >> try.msg <<EOM
4165
4166I used the command:
4167
4168 $*
4169 ./try
4170
4171and I got the following output:
4172
4173EOM
4174dflt=y
73614538
JH
4175if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4176 if $sh -c './try' >>try.msg 2>&1; then
bd9b35c9
JH
4177 xxx=`./try`
4178 case "$xxx" in
4179 "Ok") dflt=n ;;
4180 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4181 case " $libs " in
4182 *" -lsfio "*)
4183 cat >> try.msg <<'EOQS'
4184If $libs contains -lsfio, and sfio is mis-configured, then it
4185sometimes (apparently) runs and exits with a 0 status, but with no
4186output! It may have to do with sfio's use of _exit vs. exit.
4187
4188EOQS
4189 rp="You have a big problem. Shall I abort Configure"
4190 dflt=y
4191 ;;
4192 esac
4193 ;;
4194 esac
4195 else
4196 echo "The program compiled OK, but exited with status $?." >>try.msg
4197 rp="You have a problem. Shall I abort Configure"
4198 dflt=y
4199 fi
4200else
4201 echo "I can't compile the test program." >>try.msg
4202 rp="You have a BIG problem. Shall I abort Configure"
4203 dflt=y
4204fi
4205case "$dflt" in
4206y)
4207 $cat try.msg >&4
4208 case "$knowitall" in
4209 '')
4210 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 4211 ;;
bd9b35c9 4212 *) dflt=n;;
c4f23d77 4213 esac
bd9b35c9
JH
4214 echo " "
4215 . ./myread
4216 case "$ans" in
4217 n*|N*) ;;
4218 *) echo "Ok. Stopping Configure." >&4
4219 exit 1
c4f23d77
AD
4220 ;;
4221 esac
4222 ;;
bd9b35c9 4223n) echo "OK, that should do.";;
c4f23d77 4224esac
bd9b35c9 4225$rm -f try try.* core
c4f23d77 4226
b4eb6b3d
JH
4227: define an is-a-typedef? function
4228typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4229case "$inclist" in
4230"") inclist="sys/types.h";;
4231esac;
4232eval "varval=\$$var";
4233case "$varval" in
4234"")
4235 $rm -f temp.c;
4236 for inc in $inclist; do
4237 echo "#include <$inc>" >>temp.c;
4238 done;
4239 echo "#ifdef $type" >> temp.c;
4240 echo "printf(\"We have $type\");" >> temp.c;
4241 echo "#endif" >> temp.c;
4242 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4243 if $contains $type temp.E >/dev/null 2>&1; then
4244 eval "$var=\$type";
4245 else
4246 eval "$var=\$def";
4247 fi;
4248 $rm -f temp.?;;
4249*) eval "$var=\$varval";;
4250esac'
4251
4252: define an is-a-typedef? function that prompts if the type is not available.
4253typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4254case "$inclist" in
4255"") inclist="sys/types.h";;
4256esac;
4257eval "varval=\$$var";
4258case "$varval" in
4259"")
4260 $rm -f temp.c;
4261 for inc in $inclist; do
4262 echo "#include <$inc>" >>temp.c;
4263 done;
4264 echo "#ifdef $type" >> temp.c;
4265 echo "printf(\"We have $type\");" >> temp.c;
4266 echo "#endif" >> temp.c;
4267 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4268 echo " " ;
4269 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4270 if $contains $type temp.E >/dev/null 2>&1; then
4271 echo "$type found." >&4;
4272 eval "$var=\$type";
4273 else
4274 echo "$type NOT found." >&4;
4275 dflt="$def";
4276 . ./myread ;
4277 eval "$var=\$ans";
4278 fi;
4279 $rm -f temp.?;;
4280*) eval "$var=\$varval";;
4281esac'
4282
bd9b35c9
JH
4283: define a shorthand compile call
4284compile='
4285mc_file=$1;
4286shift;
08413ebc 4287$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
4288: define a shorthand compile call for compilations that should be ok.
4289compile_ok='
4290mc_file=$1;
4291shift;
7a282f6d 4292$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 4293
b4eb6b3d 4294: check for lengths of integral types
bd9b35c9 4295echo " "
b4eb6b3d
JH
4296case "$intsize" in
4297'')
4298 echo "Checking to see how big your integers are..." >&4
4299 $cat >intsize.c <<'EOCP'
bd9b35c9
JH
4300#include <stdio.h>
4301int main()
4302{
b4eb6b3d
JH
4303 printf("intsize=%d;\n", (int)sizeof(int));
4304 printf("longsize=%d;\n", (int)sizeof(long));
4305 printf("shortsize=%d;\n", (int)sizeof(short));
4306 exit(0);
bd9b35c9 4307}
b4eb6b3d
JH
4308EOCP
4309 set intsize
4310 if eval $compile_ok && ./intsize > /dev/null; then
4311 eval `./intsize`
4312 echo "Your integers are $intsize bytes long."
4313 echo "Your long integers are $longsize bytes long."
4314 echo "Your short integers are $shortsize bytes long."
4315 else
4316 $cat >&4 <<EOM
4317!
4318Help! I can't compile and run the intsize test program: please enlighten me!
4319(This is probably a misconfiguration in your system or libraries, and
4320you really ought to fix it. Still, I'll try anyway.)
4321!
bd9b35c9 4322EOM
b4eb6b3d
JH
4323 dflt=4
4324 rp="What is the size of an integer (in bytes)?"
4325 . ./myread
4326 intsize="$ans"
4327 dflt=$intsize
4328 rp="What is the size of a long integer (in bytes)?"
4329 . ./myread
4330 longsize="$ans"
4331 dflt=2
4332 rp="What is the size of a short integer (in bytes)?"
4333 . ./myread
4334 shortsize="$ans"
4335 fi
4336 ;;
4337esac
4338$rm -f intsize intsize.*
c1a7f87b 4339
b4eb6b3d
JH
4340: see what type lseek is declared as in the kernel
4341rp="What is the type used for lseek's offset on this system?"
4342set off_t lseektype long stdio.h sys/types.h
4343eval $typedef_ask
4344
4345echo " "
4346echo "Checking to see how big your file offsets are..." >&4
4347$cat >try.c <<EOCP
4348#include <sys/types.h>
4349#include <stdio.h>
4350int main()
4351{
4352 printf("%d\n", (int)sizeof($lseektype));
4353 return(0);
4354}
4355EOCP
4356set try
4357if eval $compile_ok; then
4358 lseeksize=`./try`
4359 echo "Your file offsets are $lseeksize bytes long."
4360else
4361 dflt=$longsize
4362 echo " "
4363 echo "(I can't seem to compile the test program. Guessing...)"
4364 rp="What is the size of your file offsets (in bytes)?"
4365 . ./myread
4366 lseeksize="$ans"
4367fi
4368$rm -f try.c try
4369
4370: see what type file positions are declared as in the library
4371rp="What is the type for file position used by fsetpos()?"
4372set fpos_t fpostype long stdio.h sys/types.h
4373eval $typedef_ask
4374
4375echo " "
4376case "$fpostype" in
4377*_t) zzz="$fpostype" ;;
4378*) zzz="fpos_t" ;;
4379esac
4380echo "Checking the size of $zzz..." >&4
4381cat > try.c <<EOCP
4382#include <sys/types.h>
4383#include <stdio.h>
4384int main() {
4385 printf("%d\n", (int)sizeof($fpostype));
4386 exit(0);
4387}
4388EOCP
4389set try
4390if eval $compile_ok; then
4391 yyy=`./try`
4392 case "$yyy" in
4393 '') fpossize=4
4394 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4395 ;;
4396 *) fpossize=$yyy
4397 echo "Your $zzz is $fpossize bytes long."
4398 ;;
4399 esac
4400else
4401 dflt="$longsize"
4402 echo " " >&4
4403 echo "(I can't compile the test program. Guessing...)" >&4
4404 rp="What is the size of your file positions (in bytes)?"
4405 . ./myread
4406 fpossize="$ans"
4407fi
4408
4409
4410
4411# Backward compatibility (uselfs is deprecated).
4412case "$uselfs" in
4413"$define"|true|[yY]*)
4414 cat <<EOM >&4
4415
4416*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4417EOM
4418 uselargefiles="$define"
4419 ;;
4420esac
4421
4422case "$lseeksize:$fpossize" in
44238:8) cat <<EOM
4424
4425You can have files larger than 2 gigabytes.
4426EOM
4427 val="$define" ;;
4428*) case "$uselargefiles" in
4429 "$undef"|false|[nN]*) dflt='n' ;;
4430 *) dflt='y' ;;
4431 esac
4432 cat <<EOM
4433
4434Perl can be built to understand large files (files larger than 2 gigabytes)
4435on some systems. To do so, Configure can be run with -Duselargefiles.
4436
4437If this doesn't make any sense to you, just accept the default '$dflt'.
4438EOM
4439 rp='Try to understand large files, if available?'
4440 . ./myread
4441 case "$ans" in
4442 y|Y) val="$define" ;;
4443 *) val="$undef" ;;
4444 esac
4445 ;;
4446esac
4447set uselargefiles
4448eval $setvar
4449case "$uselargefiles" in
4450"$define")
4451: Look for a hint-file generated 'call-back-unit'. If the
4452: user has specified that a large files perl is to be built,
4453: we may need to set or change some other defaults.
4454 if $test -f uselargefiles.cbu; then
4455 echo "Your platform has some specific hints for large file builds, using them..."
4456 . ./uselargefiles.cbu
4457 echo " "
4458 echo "Rechecking to see how big your file offsets are..." >&4
4459 $cat >try.c <<EOCP
4460#include <sys/types.h>
4461#include <stdio.h>
4462int main()
4463{
4464 printf("%d\n", (int)sizeof($lseektype));
4465 return(0);
4466}
4467EOCP
4468 set try
4469 if eval $compile_ok; then
4470 lseeksize=`./try`
4471 $echo "Your file offsets are now $lseeksize bytes long."
4472 else
4473 dflt="$lseeksize"
4474 echo " "
4475 echo "(I can't seem to compile the test program. Guessing...)"
4476 rp="What is the size of your file offsets (in bytes)?"
4477 . ./myread
4478 lseeksize="$ans"
4479 fi
4480 case "$fpostype" in
4481 *_t) zzz="$fpostype" ;;
4482 *) zzz="fpos_t" ;;
4483 esac
4484 $echo $n "Rechecking the size of $zzz...$c" >&4
4485 $cat > try.c <<EOCP
4486#include <sys/types.h>
4487#include <stdio.h>
4488int main() {
4489 printf("%d\n", (int)sizeof($fpostype));
4490 exit(0);
4491}
4492EOCP
4493 set try
4494 if eval $compile_ok; then
4495 yyy=`./try`
4496 dflt="$lseeksize"
4497 case "$yyy" in
4498 '') echo " "
4499 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4500 ;;
4501 *) fpossize=$yyy
4502 echo " $fpossize bytes." >&4
4503 ;;
4504 esac
4505 else
4506 dflt="$fpossize"
4507 echo " "
4508 echo "(I can't compile the test program. Guessing...)" >&4
4509 rp="What is the size of your file positions (in bytes)?"
4510 . ./myread
4511 fpossize="$ans"
4512 fi
4513 $rm -f try.c try
4514 fi
4515 ;;
4516esac
4517
4518
4519case "$usemorebits" in
4520"$define"|true|[yY]*)
4521 use64bitint="$define"
4522 uselongdouble="$define"
4523 usemorebits="$define"
4524 ;;
4525*) usemorebits="$undef"
4526 ;;
4527esac
4528
4529
4530case "$uselonglong" in
4531"$define"|true|[yY]*)
4532 cat <<EOM >&4
4533
4534*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4535EOM
4536 use64bitint="$define"
4537 ;;
4538esac
4539case "$use64bits" in
4540"$define"|true|[yY]*)
4541 cat <<EOM >&4
4542
4543*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4544EOM
4545 use64bitint="$define"
4546 ;;
4547esac
4548case "$use64bitints" in
4549"$define"|true|[yY]*)
4550 cat <<EOM >&4
4551
4552*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4553EOM
4554 use64bitint="$define"
4555 ;;
4556esac
4557case "$use64bitsint" in
4558"$define"|true|[yY]*)
4559 cat <<EOM >&4
4560
4561*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4562EOM
4563 use64bitint="$define"
4564 ;;
4565esac
4566case "$uselonglongs" in
4567"$define"|true|[yY]*)
4568 cat <<EOM >&4
4569
4570*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4571EOM
4572 use64bitint="$define"
4573 ;;
4574esac
4575case "$use64bitsall" in
4576"$define"|true|[yY]*)
4577 cat <<EOM >&4
4578
4579*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4580EOM
4581 use64bitall="$define"
4582 ;;
4583esac
4584
4585case "$ccflags" in
4586*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4587esac
4588case "$use64bitall" in
4589"$define"|true|[yY]*) use64bitint="$define" ;;
4590esac
4591
4592case "$longsize" in
45938) cat <<EOM
4594
4595You have natively 64-bit long integers.
4596EOM
4597 val="$define"
4598 ;;
4599*) case "$use64bitint" in
4600 "$define"|true|[yY]*) dflt='y';;
4601 *) dflt='n';;
4602 esac
4603 cat <<EOM
4604
4605Perl can be built to take advantage of 64-bit integer types
4606on some systems. To do so, Configure can be run with -Duse64bitint.
4607Choosing this option will most probably introduce binary incompatibilities.
4608
4609If this doesn't make any sense to you, just accept the default '$dflt'.
4610EOM
4611 rp='Try to use 64-bit integers, if available?'
4612 . ./myread
4613 case "$ans" in
4614 [yY]*) val="$define" ;;
4615 *) val="$undef" ;;
4616 esac
4617 ;;
4618esac
4619set use64bitint
4620eval $setvar
4621
4622case "$use64bitall" in
4623"$define"|true|[yY]*) dflt='y' ;;
4624*) case "$longsize" in
4625 8) dflt='y' ;;
4626 *) dflt='n' ;;
4627 esac
4628 ;;
4629esac
4630cat <<EOM
4631
4632You may also choose to try maximal 64-bitness. It means using as much
463364-bitness as possible on the platform. This in turn means even more
4634binary incompatibilities. On the other hand, your platform may not
4635have any more 64-bitness available than what you already have chosen.
4636
4637If this doesn't make any sense to you, just accept the default '$dflt'.
4638EOM
4639rp='Try to use maximal 64-bit support, if available?'
4640. ./myread
4641case "$ans" in
4642[yY]*) val="$define" ;;
4643*) val="$undef" ;;
4644esac
4645set use64bitall
4646eval $setvar
4647case "$use64bitall" in
4648"$define")
4649 case "$use64bitint" in
4650 "$undef")
4651 cat <<EOM
4652
4653Since you have chosen a maximally 64-bit build, I'm also turning on
4654the use of 64-bit integers.
4655EOM
4656 use64bitint="$define" ;;
4657 esac
4658 ;;
4659esac
4660
4661case "$use64bitint" in
4662"$define"|true|[yY]*)
4663: Look for a hint-file generated 'call-back-unit'. If the
4664: user has specified that a 64-bit perl is to be built,
4665: we may need to set or change some other defaults.
4666 if $test -f use64bitint.cbu; then
4667 echo "Your platform has some specific hints for 64-bit integers, using them..."
4668 . ./use64bitint.cbu
4669 fi
4670 case "$longsize" in
4671 4) case "$archname64" in
4672 '') archname64=64int ;;
4673 esac
4674 ;;
4675 esac
4676 ;;
4677esac
4678
4679case "$use64bitall" in
4680"$define"|true|[yY]*)
4681: Look for a hint-file generated 'call-back-unit'. If the
4682: user has specified that a maximally 64-bit perl is to be built,
4683: we may need to set or change some other defaults.
4684 if $test -f use64bitall.cbu; then
4685 echo "Your platform has some specific hints for 64-bit builds, using them..."
4686 . ./use64bitall.cbu
4687 fi
4688 case "$longsize" in
4689 4) case "$archname64" in
4690 ''|64int) archname64=64all ;;
4691 esac
4692 ;;
4693 esac
4694 ;;
4695esac
4696
4697echo " "
4698echo "Checking for GNU C Library..." >&4
4699cat >gnulibc.c <<EOM
4700#include <stdio.h>
4701int main()
4702{
4703#ifdef __GLIBC__
4704 exit(0);
4705#else
4706 exit(1);
4707#endif
4708}
4709EOM
4710set gnulibc
4711if eval $compile_ok && ./gnulibc; then
4712 val="$define"
4713 echo "You are using the GNU C Library"
4714else
4715 val="$undef"
4716 echo "You are not using the GNU C Library"
4717fi
4718$rm -f gnulibc*
4719set d_gnulibc
4720eval $setvar
4721
4722: see if nm is to be used to determine whether a symbol is defined or not
4723case "$usenm" in
4724'')
4725 dflt=''
c1a7f87b
JH
4726 case "$d_gnulibc" in
4727 "$define")
4728 echo " "
4729 echo "nm probably won't work on the GNU C Library." >&4
4730 dflt=n
bd9b35c9 4731 ;;
c1a7f87b
JH
4732 esac
4733 case "$dflt" in
4734 '')
4735 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4736 echo " "
4737 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
4738 echo "'nm' won't be sufficient on this sytem." >&4
4739 dflt=n
4740 fi
4741 ;;
4742 esac
4743 case "$dflt" in
4744 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4745 if $test $dflt -gt 20; then
4746 dflt=y
4747 else
4748 dflt=n
4749 fi
bd9b35c9
JH
4750 ;;
4751 esac
bd9b35c9
JH
4752 ;;
4753*)
c1a7f87b
JH
4754 case "$usenm" in
4755 true|$define) dflt=y;;
4756 *) dflt=n;;
4757 esac
bd9b35c9
JH
4758 ;;
4759esac
4760$cat <<EOM
4761
c1a7f87b
JH
4762I can use $nm to extract the symbols from your C libraries. This
4763is a time consuming task which may generate huge output on the disk (up
4764to 3 megabytes) but that should make the symbols extraction faster. The
4765alternative is to skip the 'nm' extraction part and to compile a small
4766test program instead to determine whether each symbol is present. If
4767you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4768this may be the best solution.
4769
4770You probably shouldn't let me use 'nm' if you are using the GNU C Library.
bd9b35c9
JH
4771
4772EOM
c1a7f87b
JH
4773rp="Shall I use $nm to extract C symbols from the libraries?"
4774. ./myread
4775case "$ans" in
4776[Nn]*) usenm=false;;
4777*) usenm=true;;
bd9b35c9 4778esac
bd9b35c9 4779
c1a7f87b
JH
4780runnm=$usenm
4781case "$reuseval" in
4782true) runnm=false;;
8e07c86e 4783esac
29209bc5 4784
c1a7f87b
JH
4785: nm options which may be necessary
4786case "$nm_opt" in
4787'') if $test -f /mach_boot; then
4788 nm_opt='' # Mach
4789 elif $test -d /usr/ccs/lib; then
4790 nm_opt='-p' # Solaris (and SunOS?)
4791 elif $test -f /dgux; then
4792 nm_opt='-p' # DG-UX
4793 elif $test -f /lib64/rld; then
4794 nm_opt='-p' # 64-bit Irix
4795 else
4796 nm_opt=''
4797 fi;;
4798esac
bd9b35c9 4799
c1a7f87b
JH
4800: nm options which may be necessary for shared libraries but illegal
4801: for archive libraries. Thank you, Linux.
4802case "$nm_so_opt" in
4803'') case "$myuname" in
4804 *linux*)
4805 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4806 nm_so_opt='--dynamic'
4807 fi
4808 ;;
bd9b35c9 4809 esac
c1a7f87b
JH
4810 ;;
4811esac
8e07c86e 4812
c1a7f87b
JH
4813case "$runnm" in
4814true)
4815: get list of predefined functions in a handy place
4816echo " "
4817case "$libc" in
4818'') libc=unknown
4819 case "$libs" in
4820 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
bd9b35c9 4821 esac
ff935051
JH
4822 ;;
4823esac
c1a7f87b
JH
4824libnames='';
4825case "$libs" in
4826'') ;;
4827*) for thislib in $libs; do
4828 case "$thislib" in
4829 -lc|-lc_s)
4830 : Handle C library specially below.
4831 ;;
4832 -l*)
4833 thislib=`echo $thislib | $sed -e 's/^-l//'`
4834 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4835 :
4836 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4837 :
4838 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4839 :
4840 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4841 :
4842 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4843 :
4844 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4845 :
4846 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4847 :
4848 else
4849 try=''
4850 fi
4851 libnames="$libnames $try"
4852 ;;
4853 *) libnames="$libnames $thislib" ;;
34d1710f 4854 esac
c1a7f87b 4855 done
4633a7c4
LW
4856 ;;
4857esac
c1a7f87b
JH
4858xxx=normal
4859case "$libc" in
4860unknown)
4861 set /lib/libc.$so
4862 for xxx in $libpth; do
4863 $test -r $1 || set $xxx/libc.$so
4864 : The messy sed command sorts on library version numbers.
4865 $test -r $1 || \
4866 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4867 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4868 h
4869 s/[0-9][0-9]*/0000&/g
4870 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4871 G
4872 s/\n/ /' | \
381aa1ff 4873 $sort | $sed -e 's/^.* //'`
c1a7f87b
JH
4874 eval set \$$#
4875 done
4876 $test -r $1 || set /usr/ccs/lib/libc.$so
4877 $test -r $1 || set /lib/libsys_s$_a
4878 ;;
4879*)
4880 set blurfl
4881 ;;
a4f3eea9 4882esac
c1a7f87b
JH
4883if $test -r "$1"; then
4884 echo "Your (shared) C library seems to be in $1."
4885 libc="$1"
4886elif $test -r /lib/libc && $test -r /lib/clib; then
4887 echo "Your C library seems to be in both /lib/clib and /lib/libc."
4888 xxx=apollo
4889 libc='/lib/clib /lib/libc'
4890 if $test -r /lib/syslib; then
4891 echo "(Your math library is in /lib/syslib.)"
4892 libc="$libc /lib/syslib"
4893 fi
4894elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4895 echo "Your C library seems to be in $libc, as you said before."
4896elif $test -r $incpath/usr/lib/libc$_a; then
4897 libc=$incpath/usr/lib/libc$_a;
4898 echo "Your C library seems to be in $libc. That's fine."
4899elif $test -r /lib/libc$_a; then
4900 libc=/lib/libc$_a;
4901 echo "Your C library seems to be in $libc. You're normal."
4902else
4903 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4904 :
4905 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4906 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4907 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4908 :
4909 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4910 :
4911 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4912 :
4913 else
4914 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4915 fi
4916 if $test -r "$tans"; then
4917 echo "Your C library seems to be in $tans, of all places."
4918 libc=$tans
4919 else
4920 libc='blurfl'
4921 fi
4922fi
4923if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4924 dflt="$libc"
4925 cat <<EOM
a4f3eea9 4926
c1a7f87b
JH
4927If the guess above is wrong (which it might be if you're using a strange
4928compiler, or your machine supports multiple models), you can override it here.
bd9b35c9
JH
4929
4930EOM
a4f3eea9 4931else
c1a7f87b 4932 dflt=''
381aa1ff 4933 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
c1a7f87b
JH
4934 cat >&4 <<EOM
4935I can't seem to find your C library. I've looked in the following places:
a4f3eea9 4936
c1a7f87b
JH
4937EOM
4938 $sed 's/^/ /' libpath
4939 cat <<EOM
29209bc5 4940
c1a7f87b 4941None of these seems to contain your C library. I need to get its name...
a4f3eea9 4942
bd9b35c9 4943EOM
bd9b35c9 4944fi
c1a7f87b
JH
4945fn=f
4946rp='Where is your C library?'
4947. ./getfile
4948libc="$ans"
a4f3eea9 4949
c1a7f87b 4950echo " "
381aa1ff 4951echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
c1a7f87b
JH
4952set X `cat libnames`
4953shift
4954xxx=files
4955case $# in 1) xxx=file; esac
4956echo "Extracting names from the following $xxx for later perusal:" >&4
4957echo " "
4958$sed 's/^/ /' libnames >&4
4959echo " "
4960$echo $n "This may take a while...$c" >&4
a4f3eea9 4961
c1a7f87b
JH
4962for file in $*; do
4963 case $file in
4964 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4965 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 4966 esac
c1a7f87b 4967done >libc.tmp
a4f3eea9 4968
c1a7f87b
JH
4969$echo $n ".$c"
4970$grep fprintf libc.tmp > libc.ptf
4971xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4972xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4973xxx='[ADTSIW]'
4974if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
4975 eval $xscan;\
4976 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4977 eval $xrun
4978elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4979 eval $xscan;\
4980 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4981 eval $xrun
4982elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4983 eval $xscan;\
4984 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4985 eval $xrun
4986elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4987 eval $xscan;\
4988 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4989 eval $xrun
4990elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4991 eval $xscan;\
4992 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4993 eval $xrun
4994elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4995 eval $xscan;\
4996 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4997 eval $xrun
4998elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4999 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
5000 eval $xscan;\
5001 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5002 eval $xrun
5003elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5004 eval $xscan;\
5005 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5006 eval $xrun
5007elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5008 eval $xscan;\
5009 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5010 eval $xrun
5011elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5012 eval $xscan;\
5013 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5014 eval $xrun
5015elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5016 eval $xscan;\
5017 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5018 eval $xrun
5019elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5020 eval $xscan;\
5021 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5022 eval $xrun
5023elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5024 eval $xscan;\
5025 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5026 eval $xrun
5027elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
5028 eval $xscan;\
5029 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5030 eval $xrun
5031else
5032 $nm -p $* 2>/dev/null >libc.tmp
5033 $grep fprintf libc.tmp > libc.ptf
5034 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5035 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5036 then
5037 nm_opt='-p'
5038 eval $xrun
bd9b35c9 5039 else
c1a7f87b
JH
5040 echo " "
5041 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5042 com=''
5043 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5044 for thisname in $libnames $libc; do
5045 $ar t $thisname >>libc.tmp
5046 done
5047 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5048 echo "Ok." >&4
5049 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5050 # Repeat libc to extract forwarders to DLL entries too
5051 for thisname in $libnames $libc; do
5052 $ar tv $thisname >>libc.tmp
5053 # Revision 50 of EMX has bug in $ar.
5054 # it will not extract forwarders to DLL entries
5055 # Use emximp which will extract exactly them.
5056 emximp -o tmp.imp $thisname \
5057 2>/dev/null && \
5058 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5059 < tmp.imp >>libc.tmp
5060 $rm tmp.imp
5061 done
5062 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5063 echo "Ok." >&4
5064 else
5065 echo "$ar didn't seem to work right." >&4
5066 echo "Maybe this is a Cray...trying bld instead..." >&4
5067 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5068 then
5069 for thisname in $libnames; do
5070 bld t $libnames | \
5071 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5072 $ar t $thisname >>libc.tmp
5073 done
5074 echo "Ok." >&4
bd9b35c9 5075 else
c1a7f87b
JH
5076 echo "That didn't work either. Giving up." >&4
5077 exit 1
bd9b35c9 5078 fi
c1a7f87b 5079 fi
a4f3eea9 5080 fi
a4f3eea9 5081fi
c1a7f87b
JH
5082nm_extract="$com"
5083if $test -f /lib/syscalls.exp; then
5084 echo " "
5085 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5086 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5087fi
5088;;
5089esac
5090$rm -f libnames libpath
bd9b35c9 5091
c1a7f87b
JH
5092: is a C symbol defined?
5093csym='tlook=$1;
5094case "$3" in
5095-v) tf=libc.tmp; tc=""; tdc="";;
5096-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5097*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5098esac;
5099tx=yes;
5100case "$reuseval-$4" in
5101true-) ;;
5102true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5103esac;
5104case "$tx" in
5105yes)
5106 case "$runnm" in
5107 true)
5108 if $contains $tlook $tf >/dev/null 2>&1;
5109 then tval=true;
5110 else tval=false;
5111 fi;;
5112 *)
5113 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
7a282f6d 5114 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
c1a7f87b
JH
5115 then tval=true;
5116 else tval=false;
5117 fi;
5118 $rm -f t t.c;;
5119 esac;;
5120*)
5121 case "$tval" in
5122 $define) tval=true;;
5123 *) tval=false;;
5124 esac;;
5125esac;
5126eval "$2=$tval"'
bd9b35c9 5127
c1a7f87b
JH
5128: define an is-in-libc? function
5129inlibc='echo " "; td=$define; tu=$undef;
5130sym=$1; var=$2; eval "was=\$$2";
5131tx=yes;
5132case "$reuseval$was" in
5133true) ;;
5134true*) tx=no;;
5135esac;
5136case "$tx" in
5137yes)
5138 set $sym tres -f;
5139 eval $csym;
5140 case "$tres" in
5141 true)
5142 echo "$sym() found." >&4;
5143 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5144 *)
5145 echo "$sym() NOT found." >&4;
5146 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5147 esac;;
bd9b35c9 5148*)
c1a7f87b
JH
5149 case "$was" in
5150 $define) echo "$sym() found." >&4;;
5151 *) echo "$sym() NOT found." >&4;;
5152 esac;;
5153esac'
5154
b4eb6b3d
JH
5155: see if sqrtl exists
5156set sqrtl d_sqrtl
c1a7f87b
JH
5157eval $inlibc
5158
b4eb6b3d
JH
5159case "$ccflags" in
5160*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
c1a7f87b 5161esac
b4eb6b3d
JH
5162
5163case "$uselongdouble" in
5164$define|true|[yY]*) dflt='y';;
5165*) dflt='n';;
5166esac
5167cat <<EOM
5168
5169Perl can be built to take advantage of long doubles which
5170(if available) may give more accuracy and range for floating point numbers.
5171
5172If this doesn't make any sense to you, just accept the default '$dflt'.
5173EOM
5174rp='Try to use long doubles if available?'
c1a7f87b
JH
5175. ./myread
5176case "$ans" in
b4eb6b3d
JH
5177y|Y) val="$define" ;;
5178*) val="$undef" ;;
5179esac
5180set uselongdouble
5181eval $setvar
bfb7748a 5182
b4eb6b3d
JH
5183case "$uselongdouble" in
5184true|[yY]*) uselongdouble="$define" ;;
5185esac
bfb7748a 5186
b4eb6b3d
JH
5187case "$uselongdouble" in
5188$define)
5189: Look for a hint-file generated 'call-back-unit'. If the
5190: user has specified that long doubles should be used,
5191: we may need to set or change some other defaults.
5192 if $test -f uselongdouble.cbu; then
5193 echo "Your platform has some specific hints for long doubles, using them..."
5194 . ./uselongdouble.cbu
5195 else
5196 $cat <<EOM
5197(Your platform doesn't have any specific hints for long doubles.)
c1a7f87b 5198EOM
b4eb6b3d
JH
5199 fi
5200 ;;
5201esac
5202
5203case "$uselongdouble:$d_sqrtl" in
5204$define:$undef)
5205 $cat <<EOM >&4
5206
5207*** You requested the use of long doubles but you do not seem to have
5208*** the mathematic functions for long doubles. I'm disabling the use
5209*** of long doubles.
5210
5211EOM
5212 uselongdouble=$undef
5213 ;;
5214esac
5215
5216: check for length of double
5217echo " "
5218case "$doublesize" in
5219'')
5220 echo "Checking to see how big your double precision numbers are..." >&4
5221 $cat >try.c <<'EOCP'
5222#include <stdio.h>
5223int main()
5224{
5225 printf("%d\n", (int)sizeof(double));
5226 exit(0);
5227}
5228EOCP
5229 set try
5230 if eval $compile_ok; then
5231 doublesize=`./try`
5232 echo "Your double is $doublesize bytes long."
5233 else
5234 dflt='8'
5235 echo "(I can't seem to compile the test program. Guessing...)"
5236 rp="What is the size of a double precision number (in bytes)?"
5237 . ./myread
5238 doublesize="$ans"
5239 fi
5240 ;;
5241esac
5242$rm -f try.c try
5243
5244: check for long doubles
5245echo " "
5246echo "Checking to see if you have long double..." >&4
5247echo 'int main() { long double x = 7.0; }' > try.c
5248set try
5249if eval $compile; then
5250 val="$define"
5251 echo "You have long double."
5252else
5253 val="$undef"
5254 echo "You do not have long double."
5255fi
5256$rm try.*
5257set d_longdbl
5258eval $setvar
5259
5260: check for length of long double
5261case "${d_longdbl}${longdblsize}" in
5262$define)
5263 echo " "
5264 echo "Checking to see how big your long doubles are..." >&4
5265 $cat >try.c <<'EOCP'
5266#include <stdio.h>
5267int main()
5268{
5269 printf("%d\n", sizeof(long double));
5270}
5271EOCP
5272 set try
5273 set try
5274 if eval $compile; then
5275 longdblsize=`./try$exe_ext`
5276 echo "Your long doubles are $longdblsize bytes long."
5277 else
5278 dflt='8'
5279 echo " "
5280 echo "(I can't seem to compile the test program. Guessing...)" >&4
5281 rp="What is the size of a long double (in bytes)?"
5282 . ./myread
5283 longdblsize="$ans"
5284 fi
5285 if $test "X$doublesize" = "X$longdblsize"; then
5286 echo "(That isn't any different from an ordinary double.)"
5287 fi
5288 ;;
5289esac
5290$rm -f try.* try
5291
51de783f
JH
5292case "$useperlio" in
5293$define|true|[yY]*) dflt='y';;
5294*) dflt='n';;
5295esac
5296cat <<EOM
5297
5298Previous version of $package used the standard IO mechanisms as
5299defined in <stdio.h>. Versions 5.003_02 and later of perl allow
5300alternate IO mechanisms via the PerlIO abstraction layer, but the
5301stdio mechanism is still the default. This abstraction layer can
5302use AT&T's sfio (if you already have sfio installed) or regular stdio.
5303Using PerlIO with sfio may cause problems with some extension modules.
5304
5305If this doesn't make any sense to you, just accept the default '$dflt'.
5306EOM
5307rp='Use the experimental PerlIO abstraction layer?'
5308. ./myread
5309case "$ans" in
5310y|Y)
5311 val="$define"
5312 ;;
5313*)
5314 echo "Ok, doing things the stdio way."
5315 val="$undef"
5316 ;;
5317esac
5318set useperlio
5319eval $setvar
5320
5321case "$usesocks" in
5322$define|true|[yY]*)
5323 case "$useperlio" in
5324 $define|true|[yY]*) ;;
5325 *) cat >&4 <<EOM
5326
5327You are using the SOCKS proxy protocol library which means that you
5328should also use the PerlIO layer. You may be headed for trouble.
5329
5330EOM
5331 ;;
5332 esac
5333 ;;
5334esac
5335
5336
b4eb6b3d
JH
5337: determine the architecture name
5338echo " "
5339if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5340 tarch=`arch`"-$osname"
5341elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5342 if uname -m > tmparch 2>&1 ; then
5343 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5344 -e 's/$/'"-$osname/" tmparch`
5345 else
5346 tarch="$osname"
5347 fi
5348 $rm -f tmparch
5349else
5350 tarch="$osname"
5351fi
5352case "$myarchname" in
5353''|"$tarch") ;;
5354*)
5355 echo "(Your architecture name used to be $myarchname.)"
5356 archname=''
5357 ;;
5358esac
5359myarchname="$tarch"
5360case "$archname" in
5361'') dflt="$tarch";;
5362*) dflt="$archname";;
5363esac
5364rp='What is your architecture name'
5365. ./myread
5366archname="$ans"
5367case "$usethreads" in
5368$define)
5369 echo "Threads selected." >&4
5370 case "$archname" in
5371 *-thread*) echo "...and architecture name already has -thread." >&4
5372 ;;
5373 *) archname="$archname-thread"
5374 echo "...setting architecture name to $archname." >&4
5375 ;;
5376 esac
5377 ;;
5378esac
5379case "$usemultiplicity" in
5380$define)
5381 echo "Multiplicity selected." >&4
5382 case "$archname" in
5383 *-multi*) echo "...and architecture name already has -multi." >&4
5384 ;;
5385 *) archname="$archname-multi"
5386 echo "...setting architecture name to $archname." >&4
5387 ;;
5388 esac
5389 ;;
5390esac
5391case "$use64bitint$use64bitall" in
5392*"$define"*)
5393 case "$archname64" in
5394 '')
5395 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5396 ;;
5397 *)
5398 case "$use64bitint" in
5399 "$define") echo "64 bit integers selected." >&4 ;;
5400 esac
5401 case "$use64bitall" in
5402 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5403 esac
5404 case "$archname" in
5405 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5406 ;;
5407 *) archname="$archname-$archname64"
5408 echo "...setting architecture name to $archname." >&4
5409 ;;
5410 esac
5411 ;;
5412 esac
5413esac
5414case "$uselongdouble" in
5415$define)
5416 echo "Long doubles selected." >&4
5417 case "$longdblsize" in
5418 $doublesize)
5419 "...but long doubles are equal to doubles, not changing architecture name." >&4
5420 ;;
5421 *)
5422 case "$archname" in
5423 *-ld*) echo "...and architecture name already has -ld." >&4
5424 ;;
5425 *) archname="$archname-ld"
5426 echo "...setting architecture name to $archname." >&4
5427 ;;
5428 esac
5429 ;;
5430 esac
5431 ;;
5432esac
51de783f
JH
5433case "$useperlio" in
5434$define)
5435 echo "Perlio selected." >&4
5436 case "$archname" in
5437 *-perlio*) echo "...and architecture name already has -perlio." >&4
5438 ;;
5439 *) archname="$archname-perlio"
5440 echo "...setting architecture name to $archname." >&4
5441 ;;
5442 esac
5443 ;;
5444esac
b4eb6b3d
JH
5445
5446: determine root of directory hierarchy where package will be installed.
5447case "$prefix" in
5448'')
5449 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5450 ;;
5451*)
5452 dflt="$prefix"
5453 ;;
5454esac
5455$cat <<EOM
5456
5457By default, $package will be installed in $dflt/bin, manual pages
5458under $dflt/man, etc..., i.e. with $dflt as prefix for all
5459installation directories. Typically this is something like /usr/local.
5460If you wish to have binaries under /usr/bin but other parts of the
5461installation under /usr/local, that's ok: you will be prompted
5462separately for each of the installation directories, the prefix being
5463only used to set the defaults.
5464
5465EOM
5466fn=d~
5467rp='Installation prefix to use?'
5468. ./getfile
5469oldprefix=''
5470case "$prefix" in
5471'') ;;
5472*)
5473 case "$ans" in
5474 "$prefix") ;;
5475 *) oldprefix="$prefix";;
5476 esac
5477 ;;
5478esac
5479prefix="$ans"
5480prefixexp="$ansexp"
5481
5482: is AFS running?
5483echo " "
5484case "$afs" in
5485$define|true) afs=true ;;
5486$undef|false) afs=false ;;
5487*) if test -d /afs; then
5488 afs=true
5489 else
5490 afs=false
5491 fi
5492 ;;
5493esac
5494if $afs; then
5495 echo "AFS may be running... I'll be extra cautious then..." >&4
5496else
5497 echo "AFS does not seem to be running..." >&4
5498fi
5499
5500: determine installation prefix for where package is to be installed.
5501if $afs; then
5502$cat <<EOM
5503
5504Since you are running AFS, I need to distinguish the directory in which
5505files will reside from the directory in which they are installed (and from
5506which they are presumably copied to the former directory by occult means).
5507
5508EOM
5509 case "$installprefix" in
5510 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5511 *) dflt="$installprefix";;
5512 esac
5513else
5514$cat <<EOM
5515
5516In some special cases, particularly when building $package for distribution,
5517it is convenient to distinguish between the directory in which files should
5518be installed from the directory ($prefix) in which they
5519will eventually reside. For most users, these two directories are the same.
5520
5521EOM
5522 case "$installprefix" in
5523 '') dflt=$prefix ;;
5524 *) dflt=$installprefix;;
5525 esac
5526fi
5527fn=d~
5528rp='What installation prefix should I use for installing files?'
5529. ./getfile
5530installprefix="$ans"
5531installprefixexp="$ansexp"
5532
5533: set the prefixit variable, to compute a suitable default value
5534prefixit='case "$3" in
5535""|none)
5536 case "$oldprefix" in
5537 "") eval "$1=\"\$$2\"";;
5538 *)
5539 case "$3" in
5540 "") eval "$1=";;
5541 none)
5542 eval "tp=\"\$$2\"";
5543 case "$tp" in
5544 ""|" ") eval "$1=\"\$$2\"";;
5545 *) eval "$1=";;
5546 esac;;
5547 esac;;
5548 esac;;
5549*)
5550 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5551 case "$tp" in
5552 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5553 /*-$oldprefix/*|\~*-$oldprefix/*)
5554 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5555 *) eval "$1=\"\$$2\"";;
5556 esac;;
5557esac'
5558
5559
5560: get the patchlevel
5561echo " "
5562echo "Getting the current patchlevel..." >&4
5563if $test -r $rsrc/patchlevel.h;then
5564 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5565 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5566 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5567 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5568 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5569 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5570else
5571 revision=0
5572 patchlevel=0
5573 subversion=0
5574 api_revision=0
5575 api_version=0
5576 api_subversion=0
5577fi
5578$echo "(You have $package version $patchlevel subversion $subversion.)"
5579case "$osname" in
5580dos|vms)
5581 : XXX Should be a Configure test for double-dots in filenames.
5582 version=`echo $revision $patchlevel $subversion | \
5583 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5584 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5585 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5586 ;;
5587*)
5588 version=`echo $revision $patchlevel $subversion | \
5589 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5590 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5591 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5592 ;;
5593esac
5594: Special case the 5.005_xx maintenance series, which used 5.005
5595: without any subversion label as a subdirectory in $sitelib
5596if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5597 api_versionstring='5.005'
5598fi
5599
5600: determine installation style
5601: For now, try to deduce it from prefix unless it is already set.
5602: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5603case "$installstyle" in
5604'') case "$prefix" in
5605 *perl*) dflt='lib';;
5606 *) dflt='lib/perl5' ;;
5607 esac
5608 ;;
5609*) dflt="$installstyle" ;;
5610esac
5611: Probably not worth prompting for this since we prompt for all
5612: the directories individually, and the prompt would be too long and
5613: confusing anyway.
5614installstyle=$dflt
5615
5616: determine where private library files go
5617: Usual default is /usr/local/lib/perl5/$version.
5618: Also allow things like /opt/perl/lib/$version, since
5619: /opt/perl/lib/perl5... would be redundant.
5620: The default "style" setting is made in installstyle.U
5621case "$installstyle" in
5622*lib/perl5*) set dflt privlib lib/$package/$version ;;
5623*) set dflt privlib lib/$version ;;
5624esac
5625eval $prefixit
5626$cat <<EOM
5627
5628There are some auxiliary files for $package that need to be put into a
5629private library directory that is accessible by everyone.
5630
5631EOM
5632fn=d~+
5633rp='Pathname where the private library files will reside?'
5634. ./getfile
5635privlib="$ans"
5636privlibexp="$ansexp"
5637: Change installation prefix, if necessary.
5638if $test X"$prefix" != X"$installprefix"; then
5639 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5640else
5641 installprivlib="$privlibexp"
5642fi
5643
5644: set the prefixup variable, to restore leading tilda escape
5645prefixup='case "$prefixexp" in
5646"$prefix") ;;
5647*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5648esac'
5649
5650: determine where public architecture dependent libraries go
5651set archlib archlib
5652eval $prefixit
5653: privlib default is /usr/local/lib/$package/$version
5654: archlib default is /usr/local/lib/$package/$version/$archname
5655: privlib may have an optional trailing /share.
5656tdflt=`echo $privlib | $sed 's,/share$,,'`
5657tdflt=$tdflt/$archname
5658case "$archlib" in
5659'') dflt=$tdflt
5660 ;;
5661*) dflt="$archlib"
5662 ;;
5663esac
5664$cat <<EOM
5665
5666$spackage contains architecture-dependent library files. If you are
5667sharing libraries in a heterogeneous environment, you might store
5668these files in a separate location. Otherwise, you can just include
5669them with the rest of the public library files.
5670
5671EOM
5672fn=d+~
5673rp='Where do you want to put the public architecture-dependent libraries?'
5674. ./getfile
5675archlib="$ans"
5676archlibexp="$ansexp"
5677if $test X"$archlib" = X"$privlib"; then
5678 d_archlib="$undef"
5679else
5680 d_archlib="$define"
5681fi
5682: Change installation prefix, if necessary.
5683if $test X"$prefix" != X"$installprefix"; then
5684 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5685else
5686 installarchlib="$archlibexp"
5687fi
5688
5689
5690: Binary compatibility with 5.005 is not possible for builds
5691: with advanced features
5692case "$usethreads$usemultiplicity" in
5693*define*)
5694 bincompat5005="$undef"
5695 d_bincompat5005="$undef"
5696 ;;
5697*) $cat <<EOM
5698
5699This version of Perl can be compiled for binary compatibility with 5.005.
5700If you decide to do so, you will be able to continue using most of the
5701extensions that were compiled for Perl 5.005.
5702
5703EOM
5704 case "$bincompat5005$d_bincompat5005" in
5705 *"$undef"*) dflt=n ;;
5706 *) dflt=y ;;
5707 esac
5708 rp='Binary compatibility with Perl 5.005?'
5709 . ./myread
5710 case "$ans" in
5711 y*) val="$define" ;;
5712 *) val="$undef" ;;
5713 esac
5714 set d_bincompat5005
5715 eval $setvar
5716 case "$d_bincompat5005" in
5717 "$define")
5718 bincompat5005="$define"
5719 ;;
5720 *) bincompat5005="$undef"
5721 d_bincompat5005="$undef"
5722 ;;
5723 esac
5724 ;;
5725esac
5726
5727
5728: see if setuid scripts can be secure
5729$cat <<EOM
5730
5731Some kernels have a bug that prevents setuid #! scripts from being
5732secure. Some sites have disabled setuid #! scripts because of this.
5733
5734First let's decide if your kernel supports secure setuid #! scripts.
5735(If setuid #! scripts would be secure but have been disabled anyway,
5736don't say that they are secure if asked.)
5737
5738EOM
5739
5740val="$undef"
5741if $test -d /dev/fd; then
5742 echo "#!$ls" >reflect
5743 chmod +x,u+s reflect
5744 ./reflect >flect 2>&1
5745 if $contains "/dev/fd" flect >/dev/null; then
5746 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5747 val="$define"
5748 else
5749 $cat <<EOM
5750If you are not sure if they are secure, I can check but I'll need a
5751username and password different from the one you are using right now.
5752If you don't have such a username or don't want me to test, simply
5753enter 'none'.
5754
5755EOM
5756 rp='Other username to test security of setuid scripts with?'
5757 dflt='none'
5758 . ./myread
5759 case "$ans" in
5760 n|none)
5761 case "$d_suidsafe" in
5762 '') echo "I'll assume setuid scripts are *not* secure." >&4
5763 dflt=n;;
5764 "$undef")
5765 echo "Well, the $hint value is *not* secure." >&4
5766 dflt=n;;
5767 *) echo "Well, the $hint value *is* secure." >&4
5768 dflt=y;;
5769 esac
c1a7f87b 5770 ;;
b4eb6b3d
JH
5771 *)
5772 $rm -f reflect flect
5773 echo "#!$ls" >reflect
5774 chmod +x,u+s reflect
5775 echo >flect
5776 chmod a+w flect
5777 echo '"su" will (probably) prompt you for '"$ans's password."
5778 su $ans -c './reflect >flect'
5779 if $contains "/dev/fd" flect >/dev/null; then
5780 echo "Okay, it looks like setuid scripts are secure." >&4
5781 dflt=y
5782 else
5783 echo "I don't think setuid scripts are secure." >&4
5784 dflt=n
5785 fi
5786 ;;
5787 esac
5788 rp='Does your kernel have *secure* setuid scripts?'
5789 . ./myread
5790 case "$ans" in
5791 [yY]*) val="$define";;
5792 *) val="$undef";;
5793 esac
5794 fi
5795else
5796 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5797 echo "(That's for file descriptors, not floppy disks.)"
5798 val="$undef"
5799fi
5800set d_suidsafe
5801eval $setvar
5802
5803$rm -f reflect flect
5804
5805: now see if they want to do setuid emulation
5806echo " "
5807val="$undef"
5808case "$d_suidsafe" in
5809"$define")
5810 val="$undef"
5811 echo "No need to emulate SUID scripts since they are secure here." >& 4
5812 ;;
5813*)
5814 $cat <<EOM
5815Some systems have disabled setuid scripts, especially systems where
5816setuid scripts cannot be secure. On systems where setuid scripts have
5817been disabled, the setuid/setgid bits on scripts are currently
5818useless. It is possible for $package to detect those bits and emulate
5819setuid/setgid in a secure fashion. This emulation will only work if
5820setuid scripts have been disabled in your kernel.
5821
5822EOM
5823 case "$d_dosuid" in
5824 "$define") dflt=y ;;
5825 *) dflt=n ;;
5826 esac
5827 rp="Do you want to do setuid/setgid emulation?"
5828 . ./myread
5829 case "$ans" in
5830 [yY]*) val="$define";;
5831 *) val="$undef";;
5832 esac
5833 ;;
5834esac
5835set d_dosuid
5836eval $setvar
5837
5838: determine filename position in cpp output
5839echo " "
5840echo "Computing filename position in cpp output for #include directives..." >&4
5841echo '#include <stdio.h>' > foo.c
5842$cat >fieldn <<EOF
5843$startsh
5844$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5845$grep '^[ ]*#.*stdio\.h' | \
5846while read cline; do
5847 pos=1
5848 set \$cline
5849 while $test \$# -gt 0; do
5850 if $test -r \`echo \$1 | $tr -d '"'\`; then
5851 echo "\$pos"
5852 exit 0
5853 fi
5854 shift
5855 pos=\`expr \$pos + 1\`
5856 done
5857done
5858EOF
5859chmod +x fieldn
5860fieldn=`./fieldn`
5861$rm -f foo.c fieldn
5862case $fieldn in
5863'') pos='???';;
58641) pos=first;;
58652) pos=second;;
58663) pos=third;;
5867*) pos="${fieldn}th";;
5868esac
5869echo "Your cpp writes the filename in the $pos field of the line."
5870
5871: locate header file
5872$cat >findhdr <<EOF
5873$startsh
5874wanted=\$1
5875name=''
5876for usrincdir in $usrinc
5877do
5878 if test -f \$usrincdir/\$wanted; then
5879 echo "\$usrincdir/\$wanted"
5880 exit 0
5881 fi
5882done
5883awkprg='{ print \$$fieldn }'
5884echo "#include <\$wanted>" > foo\$\$.c
5885$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5886$grep "^[ ]*#.*\$wanted" | \
5887while read cline; do
5888 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5889 case "\$name" in
5890 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5891 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5892 *) exit 2;;
5893 esac;
5894done;
5895#
5896# status = 0: grep returned 0 lines, case statement not executed
5897# status = 1: headerfile found
5898# status = 2: while loop executed, no headerfile found
5899#
5900status=\$?
5901$rm -f foo\$\$.c;
5902if test \$status -eq 1; then
5903 exit 0;
5904fi
5905exit 1
5906EOF
5907chmod +x findhdr
5908
5909: define an alternate in-header-list? function
5910inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5911cont=true; xxf="echo \"<\$1> found.\" >&4";
5912case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5913*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5914esac;
5915case $# in 4) instead=instead;; *) instead="at last";; esac;
5916while $test "$cont"; do
5917 xxx=`./findhdr $1`
5918 var=$2; eval "was=\$$2";
5919 if $test "$xxx" && $test -r "$xxx";
5920 then eval $xxf;
5921 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5922 cont="";
5923 else eval $xxnf;
5924 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5925 set $yyy; shift; shift; yyy=$@;
5926 case $# in 0) cont="";;
5927 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5928 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5929 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5930 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5931 esac;
5932done;
5933while $test "$yyy";
5934do set $yyy; var=$2; eval "was=\$$2";
5935 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5936 set $yyy; shift; shift; yyy=$@;
5937done'
5938
5939: see if this is a malloc.h system
5940set malloc.h i_malloc
5941eval $inhdr
5942
5943: see if stdlib is available
5944set stdlib.h i_stdlib
5945eval $inhdr
5946
5947: determine which malloc to compile in
5948echo " "
5949case "$usemymalloc" in
5950''|[yY]*|true|$define) dflt='y' ;;
5951*) dflt='n' ;;
5952esac
5953rp="Do you wish to attempt to use the malloc that comes with $package?"
5954. ./myread
5955usemymalloc="$ans"
5956case "$ans" in
5957y*|true)
5958 usemymalloc='y'
5959 mallocsrc='malloc.c'
5960 mallocobj="malloc$_o"
5961 d_mymalloc="$define"
5962 case "$libs" in
5963 *-lmalloc*)
5964 : Remove malloc from list of libraries to use
5965 echo "Removing unneeded -lmalloc from library list" >&4
5966 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5967 shift
5968 libs="$*"
5969 echo "libs = $libs" >&4
5970 ;;
5971 esac
5972 ;;
5973*)
5974 usemymalloc='n'
5975 mallocsrc=''
5976 mallocobj=''
5977 d_mymalloc="$undef"
5978 ;;
5979esac
5980
5981: compute the return types of malloc and free
5982echo " "
5983$cat >malloc.c <<END
5984#$i_malloc I_MALLOC
5985#$i_stdlib I_STDLIB
5986#include <stdio.h>
5987#include <sys/types.h>
5988#ifdef I_MALLOC
5989#include <malloc.h>
5990#endif
5991#ifdef I_STDLIB
5992#include <stdlib.h>
5993#endif
5994#ifdef TRY_MALLOC
5995void *malloc();
5996#endif
5997#ifdef TRY_FREE
5998void free();
5999#endif
6000END
6001case "$malloctype" in
6002'')
6003 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6004 malloctype='void *'
6005 else
6006 malloctype='char *'
6007 fi
6008 ;;
6009esac
6010echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6011
6012case "$freetype" in
6013'')
6014 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6015 freetype='void'
6016 else
6017 freetype='int'
6018 fi
6019 ;;
6020esac
6021echo "Your system uses $freetype free(), it would seem." >&4
6022$rm -f malloc.[co]
6023$cat <<EOM
6024
6025After $package is installed, you may wish to install various
6026add-on modules and utilities. Typically, these add-ons will
6027be installed under $prefix with the rest
6028of this package. However, you may wish to install such add-ons
6029elsewhere under a different prefix.
6030
6031If you do not wish to put everything under a single prefix, that's
6032ok. You will be prompted for the individual locations; this siteprefix
6033is only used to suggest the defaults.
6034
6035The default should be fine for most people.
6036
6037EOM
6038fn=d~+
6039rp='Installation prefix to use for add-on modules and utilities?'
6040: XXX Here might be another good place for an installstyle setting.
6041case "$siteprefix" in
6042'') dflt=$prefix ;;
6043*) dflt=$siteprefix ;;
6044esac
6045. ./getfile
6046: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6047oldsiteprefix=''
6048case "$siteprefix" in
6049'') ;;
6050*) case "$ans" in
6051 "$prefix") ;;
6052 *) oldsiteprefix="$prefix";;
6053 esac
6054 ;;
6055esac
6056siteprefix="$ans"
6057siteprefixexp="$ansexp"
6058
6059: determine where site specific libraries go.
6060: Usual default is /usr/local/lib/perl5/site_perl/$version
6061: The default "style" setting is made in installstyle.U
6062: XXX No longer works with Prefixit stuff.
6063prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6064case "$sitelib" in
6065'') case "$installstyle" in
6066 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6067 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6068 esac
6069 ;;
6070*) dflt="$sitelib"
6071 ;;
6072esac
6073$cat <<EOM
6074
6075The installation process will create a directory for
6076site-specific extensions and modules. Most users find it convenient
6077to place all site-specific files in this directory rather than in the
6078main distribution directory.
6079
6080EOM
6081fn=d~+
6082rp='Pathname for the site-specific library files?'
6083. ./getfile
6084sitelib="$ans"
6085sitelibexp="$ansexp"
6086sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6087: Change installation prefix, if necessary.
6088if $test X"$prefix" != X"$installprefix"; then
6089 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6090else
6091 installsitelib="$sitelibexp"
6092fi
6093
6094: determine where site specific architecture-dependent libraries go.
6095: sitelib default is /usr/local/lib/perl5/site_perl/$version
6096: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6097: sitelib may have an optional trailing /share.
6098case "$sitearch" in
6099'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6100 dflt="$dflt/$archname"
6101 ;;
6102*) dflt="$sitearch"
6103 ;;
6104esac
6105set sitearch sitearch none
6106eval $prefixit
6107$cat <<EOM
6108
6109The installation process will also create a directory for
6110architecture-dependent site-specific extensions and modules.
6111
6112EOM
6113fn=d~+
6114rp='Pathname for the site-specific architecture-dependent library files?'
6115. ./getfile
6116sitearch="$ans"
6117sitearchexp="$ansexp"
6118: Change installation prefix, if necessary.
6119if $test X"$prefix" != X"$installprefix"; then
6120 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6121else
6122 installsitearch="$sitearchexp"
6123fi
6124
6125$cat <<EOM
6126
6127The installation process will also create a directory for
6128vendor-supplied add-ons. Vendors who supply perl with their system
6129may find it convenient to place all vendor-supplied files in this
6130directory rather than in the main distribution directory. This will
6131ease upgrades between binary-compatible maintenance versions of perl.
6132
6133Of course you may also use these directories in whatever way you see
6134fit. For example, you might use them to access modules shared over a
6135company-wide network.
6136
6137The default answer should be fine for most people.
6138This causes further questions about vendor add-ons to be skipped
6139and no vendor-specific directories will be configured for perl.
6140
6141EOM
6142rp='Do you want to configure vendor-specific add-on directories?'
6143case "$usevendorprefix" in
6144define|true|[yY]*) dflt=y ;;
6145*) : User may have set vendorprefix directly on Configure command line.
6146 case "$vendorprefix" in
6147 ''|' ') dflt=n ;;
6148 *) dflt=y ;;
6149 esac
6150 ;;
6151esac
6152. ./myread
6153case "$ans" in
6154[yY]*) fn=d~+
6155 rp='Installation prefix to use for vendor-supplied add-ons?'
6156 case "$vendorprefix" in
6157 '') dflt='' ;;
6158 *) dflt=$vendorprefix ;;
6159 esac
6160 . ./getfile
6161 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6162 oldvendorprefix=''
6163 case "$vendorprefix" in
6164 '') ;;
6165 *) case "$ans" in
6166 "$prefix") ;;
6167 *) oldvendorprefix="$prefix";;
6168 esac
6169 ;;
6170 esac
6171 usevendorprefix="$define"
6172 vendorprefix="$ans"
6173 vendorprefixexp="$ansexp"
6174 ;;
6175*) usevendorprefix="$undef"
6176 vendorprefix=''
6177 vendorprefixexp=''
6178 ;;
6179esac
6180
6181case "$vendorprefix" in
6182'') d_vendorlib="$undef"
6183 vendorlib=''
6184 vendorlibexp=''
6185 ;;
6186*) d_vendorlib="$define"
6187 : determine where vendor-supplied modules go.
6188 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6189 case "$vendorlib" in
6190 '')
6191 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6192 case "$installstyle" in
6193 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6194 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6195 esac
6196 ;;
6197 *) dflt="$vendorlib"
6198 ;;
6199 esac
6200 fn=d~+
6201 rp='Pathname for the vendor-supplied library files?'
6202 . ./getfile
6203 vendorlib="$ans"
6204 vendorlibexp="$ansexp"
6205 ;;
6206esac
6207vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6208: Change installation prefix, if necessary.
6209if $test X"$prefix" != X"$installprefix"; then
6210 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6211else
6212 installvendorlib="$vendorlibexp"
6213fi
6214
6215case "$vendorprefix" in
6216'') d_vendorarch="$undef"
6217 vendorarch=''
6218 vendorarchexp=''
6219 ;;
6220*) d_vendorarch="$define"
6221 : determine where vendor-supplied architecture-dependent libraries go.
6222 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6223 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6224 : vendorlib may have an optional trailing /share.
6225 case "$vendorarch" in
6226 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6227 dflt="$dflt/$archname"
6228 ;;
6229 *) dflt="$vendorarch" ;;
6230 esac
6231 fn=d~+
6232 rp='Pathname for vendor-supplied architecture-dependent files?'
6233 . ./getfile
6234 vendorarch="$ans"
6235 vendorarchexp="$ansexp"
6236 ;;
6237esac
6238: Change installation prefix, if necessary.
6239if $test X"$prefix" != X"$installprefix"; then
6240 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6241else
6242 installvendorarch="$vendorarchexp"
6243fi
6244
6245: Final catch-all directories to search
6246$cat <<EOM
6247
6248Lastly, you can have perl look in other directories for extensions and
6249modules in addition to those already specified.
6250These directories will be searched after
6251 $sitearch
6252 $sitelib
6253EOM
6254test X"$vendorlib" != "X" && echo ' ' $vendorlib
6255test X"$vendorarch" != "X" && echo ' ' $vendorarch
6256echo ' '
6257case "$otherlibdirs" in
6258''|' ') dflt='none' ;;
6259*) dflt="$otherlibdirs" ;;
6260esac
6261$cat <<EOM
6262Enter a colon-separated set of extra paths to include in perl's @INC
6263search path, or enter 'none' for no extra paths.
6264
6265EOM
6266
6267rp='Colon-separated list of additional directories for perl to search?'
6268. ./myread
6269case "$ans" in
6270' '|''|none) otherlibdirs=' ' ;;
6271*) otherlibdirs="$ans" ;;
6272esac
6273case "$otherlibdirs" in
6274' ') val=$undef ;;
6275*) val=$define ;;
6276esac
6277set d_perl_otherlibdirs
6278eval $setvar
6279
6280: Cruising for prototypes
6281echo " "
6282echo "Checking out function prototypes..." >&4
6283$cat >prototype.c <<'EOCP'
6284int main(int argc, char *argv[]) {
6285 exit(0);}
6286EOCP
6287if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6288 echo "Your C compiler appears to support function prototypes."
6289 val="$define"
6290else
6291 echo "Your C compiler doesn't seem to understand function prototypes."
6292 val="$undef"
6293fi
6294set prototype
6295eval $setvar
6296$rm -f prototype*
6297
6298case "$prototype" in
6299"$define") ;;
6300*) ansi2knr='ansi2knr'
6301 echo " "
6302 cat <<EOM >&4
6303
6304$me: FATAL ERROR:
6305This version of $package can only be compiled by a compiler that
6306understands function prototypes. Unfortunately, your C compiler
6307 $cc $ccflags
6308doesn't seem to understand them. Sorry about that.
6309
6310If GNU cc is available for your system, perhaps you could try that instead.
6311
6312Eventually, we hope to support building Perl with pre-ANSI compilers.
6313If you would like to help in that effort, please contact <perlbug@perl.org>.
6314
6315Aborting Configure now.
6316EOM
6317 exit 2
6318 ;;
6319esac
6320
6321: determine where public executables go
6322echo " "
6323set dflt bin bin
6324eval $prefixit
6325fn=d~
6326rp='Pathname where the public executables will reside?'
6327. ./getfile
6328if $test "X$ansexp" != "X$binexp"; then
6329 installbin=''
6330fi
6331bin="$ans"
6332binexp="$ansexp"
6333: Change installation prefix, if necessary.
6334: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6335if $test X"$prefix" != X"$installprefix"; then
6336 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6337else
6338 installbin="$binexp"
6339fi
6340
6341: Find perl5.005 or later.
6342echo "Looking for a previously installed perl5.005 or later... "
6343case "$perl5" in
6344'') for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6345 : Check if this perl is recent and can load a simple module
6346 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6347 perl5=$tdir/perl
6348 break;
6349 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6350 perl5=$tdir/perl
6351 break;
6352 fi
6353 done
6354 ;;
6355*) perl5="$perl5"
6356 ;;
6357esac
6358case "$perl5" in
6359'') echo "None found. That's ok.";;
6360*) echo "Using $perl5." ;;
6361esac
6362
6363: Determine list of previous versions to include in @INC
6364$cat > getverlist <<EOPL
6365#!$perl5 -w
6366use File::Basename;
6367\$api_versionstring = "$api_versionstring";
6368\$version = "$version";
6369\$stem = "$sitelib_stem";
6370\$archname = "$archname";
6371EOPL
6372 $cat >> getverlist <<'EOPL'
6373# Can't have leading @ because metaconfig interprets it as a command!
6374;@inc_version_list=();
6375# XXX Redo to do opendir/readdir?
6376if (-d $stem) {
6377 chdir($stem);
6378 ;@candidates = glob("5.*");
6379}
6380else {
6381 ;@candidates = ();
6382}
6383
6384# XXX ToDo: These comparisons must be reworked when two-digit
6385# subversions come along, so that 5.7.10 compares as greater than
6386# 5.7.3! By that time, hope that 5.6.x is sufficiently
6387# widespread that we can use the built-in version vectors rather
6388# than reinventing them here. For 5.6.0, however, we must
6389# assume this script will likely be run by 5.005_0x. --AD 1/2000.
6390foreach $d (@candidates) {
6391 if ($d lt $version) {
6392 if ($d ge $api_versionstring) {
6393 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6394 }
6395 elsif ($d ge "5.005") {
6396 unshift(@inc_version_list, grep { -d } $d);
6397 }
6398 }
6399 else {
6400 # Skip newer version. I.e. don't look in
6401 # 5.7.0 if we're installing 5.6.1.
6402 }
6403}
6404
6405if (@inc_version_list) {
6406 print join(' ', @inc_version_list);
6407}
6408else {
6409 # Blank space to preserve value for next Configure run.
6410 print " ";
6411}
6412EOPL
6413chmod +x getverlist
6414case "$inc_version_list" in
6415'') if test -x "$perl5"; then
6416 dflt=`$perl5 getverlist`
6417 else
6418 dflt='none'
6419 fi
6420 ;;
6421$undef) dflt='none' ;;
6422*) dflt="$inc_version_list" ;;
6423esac
6424case "$dflt" in
6425''|' ') dflt=none ;;
6426esac
6427case "$dflt" in
64285.005) case "$bincompat5005" in
6429 $define|true|[yY]*) ;;
6430 *) dflt=none ;;
6431 esac
6432 ;;
6433esac
6434$cat <<'EOM'
6435
6436In order to ease the process of upgrading, this version of perl
6437can be configured to use modules built and installed with earlier
6438versions of perl that were installed under $prefix. Specify here
6439the list of earlier versions that this version of perl should check.
6440If Configure detected no earlier versions of perl installed under
6441$prefix, then the list will be empty. Answer 'none' to tell perl
6442to not search earlier versions.
6443
6444The default should almost always be sensible, so if you're not sure,
6445just accept the default.
6446EOM
6447
6448rp='List of earlier versions to include in @INC?'
6449. ./myread
6450case "$ans" in
6451[Nn]one|''|' ') inc_version_list=' ' ;;
6452*) inc_version_list="$ans" ;;
6453esac
6454case "$inc_version_list" in
6455''|' ')
6456 inc_version_list_init='0';;
6457*) inc_version_list_init=`echo $inc_version_list |
6458 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6459 ;;
6460esac
6461$rm -f getverlist
6462
6463: determine whether to install perl also as /usr/bin/perl
6464
6465echo " "
6466if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6467 $cat <<EOM
6468Many scripts expect perl to be installed as /usr/bin/perl.
6469I can install the perl you are about to compile also as /usr/bin/perl
6470(in addition to $installbin/perl).
6471EOM
6472 case "$installusrbinperl" in
6473 "$undef"|[nN]*) dflt='n';;
6474 *) dflt='y';;
6475 esac
6476 rp="Do you want to install perl as /usr/bin/perl?"
6477 . ./myread
6478 case "$ans" in
6479 [yY]*) val="$define";;
6480 *) val="$undef" ;;
6481 esac
6482else
6483 val="$undef"
6484fi
6485set installusrbinperl
6486eval $setvar
6487
6488: see if dld is available
6489set dld.h i_dld
6490eval $inhdr
6491
6492: see if dlopen exists
6493xxx_runnm="$runnm"
6494runnm=false
6495set dlopen d_dlopen
6496eval $inlibc
6497runnm="$xxx_runnm"
6498
6499: determine which dynamic loading, if any, to compile in
6500echo " "
6501dldir="ext/DynaLoader"
6502case "$usedl" in
6503$define|y|true)
6504 dflt='y'
6505 usedl="$define"
6506 ;;
6507$undef|n|false)
6508 dflt='n'
6509 usedl="$undef"
6510 ;;
6511*)
6512 dflt='n'
6513 case "$d_dlopen" in
6514 $define) dflt='y' ;;
6515 esac
6516 case "$i_dld" in
6517 $define) dflt='y' ;;
6518 esac
6519 : Does a dl_xxx.xs file exist for this operating system
6520 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6521 ;;
6522esac
6523rp="Do you wish to use dynamic loading?"
6524. ./myread
6525usedl="$ans"
6526case "$ans" in
6527y*) usedl="$define"
6528 case "$dlsrc" in
6529 '')
6530 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6531 dflt="$dldir/dl_${osname}.xs"
6532 elif $test "$d_dlopen" = "$define" ; then
6533 dflt="$dldir/dl_dlopen.xs"
6534 elif $test "$i_dld" = "$define" ; then
6535 dflt="$dldir/dl_dld.xs"
6536 else
6537 dflt=''
6538 fi
6539 ;;
6540 *) dflt="$dldir/$dlsrc"
6541 ;;
6542 esac
6543 echo "The following dynamic loading files are available:"
6544 : Can not go over to $dldir because getfile has path hard-coded in.
6545 tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6546 rp="Source file to use for dynamic loading"
6547 fn="fne"
6548 gfpth="$src"
6549 . ./getfile
6550 usedl="$define"
6551 : emulate basename
6552 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6553
6554 $cat << EOM
6555
6556Some systems may require passing special flags to $cc -c to
6557compile modules that will be used to create a shared library.
6558To use no flags, say "none".
6559
6560EOM
6561 case "$cccdlflags" in
6562 '') case "$gccversion" in
6563 '') case "$osname" in
6564 hpux) dflt='+z' ;;
6565 next) dflt='none' ;;
6566 irix*) dflt='-KPIC' ;;
48bcfe03 6567 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
6568 sunos) dflt='-pic' ;;
6569 *) dflt='none' ;;
6570 esac
6571 ;;
6572 *) case "$osname" in
48bcfe03 6573 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
6574 *) dflt='-fpic' ;;
6575 esac ;;
6576 esac ;;
6577 ' ') dflt='none' ;;
6578 *) dflt="$cccdlflags" ;;
6579 esac
6580 rp="Any special flags to pass to $cc -c to compile shared library modules?"
6581 . ./myread
6582 case "$ans" in
6583 none) cccdlflags=' ' ;;
6584 *) cccdlflags="$ans" ;;
6585 esac
6586
6587 cat << EOM
6588
6589Some systems use ld to create libraries that can be dynamically loaded,
6590while other systems (such as those using ELF) use $cc.
6591
6592EOM
6593 case "$ld" in
6594 '') $cat >try.c <<'EOM'
6595/* Test for whether ELF binaries are produced */
6596#include <fcntl.h>
6597#include <stdlib.h>
6598int main() {
6599 char b[4];
6600 int i = open("a.out",O_RDONLY);
6601 if(i == -1)
6602 exit(1); /* fail */
6603 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6604 exit(0); /* succeed (yes, it's ELF) */
6605 else
6606 exit(1); /* fail */
6607}
6608EOM
6609 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6610 cat <<EOM
6611You appear to have ELF support. I'll use $cc to build dynamic libraries.
6612EOM
6613 dflt="$cc"
6614 else
6615 echo "I'll use ld to build dynamic libraries."
6616 dflt='ld'
6617 fi
6618 rm -f try.c a.out
6619 ;;
6620 *) dflt="$ld"
6621 ;;
6622 esac
6623
6624 rp="What command should be used to create dynamic libraries?"
6625 . ./myread
6626 ld="$ans"
6627
6628 cat << EOM
6629
6630Some systems may require passing special flags to $ld to create a
6631library that can be dynamically loaded. If your ld flags include
6632-L/other/path options to locate libraries outside your loader's normal
6633search path, you may need to specify those -L options here as well. To
6634use no flags, say "none".
6635
6636EOM
6637 case "$lddlflags" in
6638 '') case "$osname" in
6639 beos) dflt='-nostart' ;;
6640 hpux) dflt='-b';
6641 case "$gccversion" in
6642 '') dflt="$dflt +vnocompatwarnings" ;;
6643 esac
6644 ;;
6645 linux|irix*) dflt='-shared' ;;
6646 next) dflt='none' ;;
6647 solaris) dflt='-G' ;;
6648 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 6649 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
6650 *) dflt='none' ;;
6651 esac
6652 ;;
6653 *) dflt="$lddlflags" ;;
6654 esac
6655
6656 : Try to guess additional flags to pick up local libraries.
6657 : Be careful not to append to a plain 'none'
6658 case "$dflt" in
6659 none) dflt='' ;;
6660 esac
6661 for thisflag in $ldflags; do
6662 case "$thisflag" in
6663 -L*|-R*)
6664 case " $dflt " in
6665 *" $thisflag "*) ;;
6666 *) dflt="$dflt $thisflag" ;;
6667 esac
6668 ;;
6669 esac
6670 done
6671
6672 case "$dflt" in
6673 ''|' ') dflt='none' ;;
6674 esac
6675
6676 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6677 . ./myread
6678 case "$ans" in
6679 none) lddlflags=' ' ;;
6680 *) lddlflags="$ans" ;;
6681 esac
6682
6683 cat <<EOM
6684
6685Some systems may require passing special flags to $cc to indicate that
6686the resulting executable will use dynamic linking. To use no flags,
6687say "none".
6688
6689EOM
6690 case "$ccdlflags" in
6691 '') case "$osname" in
6692 hpux) dflt='-Wl,-E' ;;
6693 linux) dflt='-rdynamic' ;;
6694 next) dflt='none' ;;
6695 sunos) dflt='none' ;;
6696 *) dflt='none' ;;
6697 esac ;;
6698 ' ') dflt='none' ;;
6699 *) dflt="$ccdlflags" ;;
6700 esac
6701 rp="Any special flags to pass to $cc to use dynamic linking?"
6702 . ./myread
6703 case "$ans" in
6704 none) ccdlflags=' ' ;;
6705 *) ccdlflags="$ans" ;;
6706 esac
6707 ;;
6708*) usedl="$undef"
6709 ld='ld'
6710 dlsrc='dl_none.xs'
6711 lddlflags=''
6712 ccdlflags=''
6713 ;;
6714esac
6715
6716also=''
6717case "$usedl" in
6718$undef)
6719 # No dynamic loading being used, so don't bother even to prompt.
6720 useshrplib='false'
6721 ;;
6722*) case "$useshrplib" in
6723 '') case "$osname" in
48bcfe03 6724 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
6725 dflt=y
6726 also='Building a shared libperl is required for dynamic loading to work on your system.'
6727 ;;
6728 next*)
6729 case "$osvers" in
6730 4*) dflt=y
6731 also='Building a shared libperl is needed for MAB support.'
6732 ;;
6733 *) dflt=n
6734 ;;
6735 esac
6736 ;;
6737 *) dflt=n
6738 ;;
6739 esac
6740 ;;
6741 $define|true|[Yy]*)
6742 dflt=y
6743 ;;
6744 *) dflt=n
6745 ;;
6746 esac
6747 $cat << EOM
6748
6749The perl executable is normally obtained by linking perlmain.c with
6750libperl${_a}, any static extensions (usually just DynaLoader), and
6751any other libraries needed on this system (such as -lm, etc.). Since
6752your system supports dynamic loading, it is probably possible to build
6753a shared libperl.$so. If you will have more than one executable linked
6754to libperl.$so, this will significantly reduce the size of each
6755executable, but it may have a noticeable affect on performance. The
6756default is probably sensible for your system.
6757$also
6758
6759EOM
6760 rp="Build a shared libperl.$so (y/n)"
6761 . ./myread
6762 case "$ans" in
6763 true|$define|[Yy]*)
6764 useshrplib='true' ;;
6765 *) useshrplib='false' ;;
6766 esac
6767 ;;
6768esac
6769
6770case "$useshrplib" in
6771true)
6772 case "$libperl" in
6773 '')
6774 # Figure out a good name for libperl.so. Since it gets stored in
6775 # a version-specific architecture-dependent library, the version
6776 # number isn't really that important, except for making cc/ld happy.
6777 #
6778 # A name such as libperl.so.3.1
6779 majmin="libperl.$so.$patchlevel.$subversion"
6780 # A name such as libperl.so.301
6781 majonly=`echo $patchlevel $subversion |
6782 $awk '{printf "%d%02d", $1, $2}'`
6783 majonly=libperl.$so.$majonly
6784 # I'd prefer to keep the os-specific stuff here to a minimum, and
6785 # rely on figuring it out from the naming of libc.
6786 case "${osname}${osvers}" in
6787 next4*)
6788 dflt=libperl.5.$so
6789 # XXX How handle the --version stuff for MAB?
6790 ;;
6791 linux*) # ld won't link with a bare -lperl otherwise.
6792 dflt=libperl.$so
6793 ;;
6794 cygwin*) # include version
6795 dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6796 ;;
6797 *) # Try to guess based on whether libc has major.minor.
6798 case "$libc" in
6799 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6800 *libc.$so.[0-9]*) dflt=$majonly ;;
6801 *) dflt=libperl.$so ;;
6802 esac
6803 ;;
6804 esac
6805 ;;
6806 *) dflt=$libperl
6807 ;;
6808 esac
6809 cat << EOM
6810
6811I need to select a good name for the shared libperl. If your system uses
6812library names with major and minor numbers, then you might want something
6813like $majmin. Alternatively, if your system uses a single version
6814number for shared libraries, then you might want to use $majonly.
6815Or, your system might be quite happy with a simple libperl.$so.
6816
6817Since the shared libperl will get installed into a version-specific
6818architecture-dependent directory, the version number of the shared perl
6819library probably isn't important, so the default should be o.k.
6820
6821EOM
6822 rp='What name do you want to give to the shared libperl?'
6823 . ./myread
6824 libperl=$ans
6825 echo "Ok, I'll use $libperl"
6826 ;;
6827*)
6828 libperl="libperl${_a}"
6829 ;;
6830esac
6831
6832# Detect old use of shrpdir via undocumented Configure -Dshrpdir
6833case "$shrpdir" in
6834'') ;;
6835*) $cat >&4 <<EOM
6836WARNING: Use of the shrpdir variable for the installation location of
6837the shared $libperl is not supported. It was never documented and
6838will not work in this version. Let me (perlbug@perl.org)
6839know of any problems this may cause.
6840
6841EOM
6842 case "$shrpdir" in
6843 "$archlibexp/CORE")
6844 $cat >&4 <<EOM
6845But your current setting of $shrpdir is
6846the default anyway, so it's harmless.
6847EOM
6848 ;;
6849 *)
6850 $cat >&4 <<EOM
6851Further, your current attempted setting of $shrpdir
6852conflicts with the value of $archlibexp/CORE
6853that installperl will use.
6854EOM
6855 ;;
6856 esac
6857 ;;
6858esac
6859
6860# How will the perl executable find the installed shared $libperl?
6861# Add $xxx to ccdlflags.
6862# If we can't figure out a command-line option, use $shrpenv to
6863# set env LD_RUN_PATH. The main perl makefile uses this.
6864shrpdir=$archlibexp/CORE
6865xxx=''
6866tmp_shrpenv=''
6867if "$useshrplib"; then
6868 case "$osname" in
6869 aix)
6870 # We'll set it in Makefile.SH...
6871 ;;
6872 solaris|netbsd)
6873 xxx="-R $shrpdir"
6874 ;;
6875 freebsd)
6876 xxx="-Wl,-R$shrpdir"
6877 ;;
6878 linux|irix*|dec_osf)
6879 xxx="-Wl,-rpath,$shrpdir"
6880 ;;
6881 next)
6882 # next doesn't like the default...
6883 ;;
6884 beos)
6885 # beos doesn't like the default, either.
6886 ;;
6887 hpux*)
6888 # hpux doesn't like the default, either.
6889 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6890 ;;
6891 *)
6892 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6893 ;;
6894 esac
6895 case "$xxx" in
6896 '') ;;
6897 *)
6898 # Only add $xxx if it isn't already in ccdlflags.
6899 case " $ccdlflags " in
6900 *" $xxx "*) ;;
6901 *) ccdlflags="$ccdlflags $xxx"
6902 cat <<EOM >&4
6903
6904Adding $xxx to the flags
6905passed to $ld so that the perl executable will find the
6906installed shared $libperl.
6907
6908EOM
6909 ;;
6910 esac
6911 ;;
6912 esac
6913fi
6914# Fix ccdlflags in AIX for building external extensions.
6915# (For building Perl itself bare -bE:perl.exp is needed,
6916# Makefile.SH takes care of this.)
6917case "$osname" in
6918aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6919esac
6920# Respect a hint or command-line value.
6921case "$shrpenv" in
6922'') shrpenv="$tmp_shrpenv" ;;
6923esac
6924case "$ldlibpthname" in
6925'') ldlibpthname=LD_LIBRARY_PATH ;;
6926none) ldlibpthname='' ;;
6927esac
6928
6929: determine where manual pages are on this system
6930echo " "
6931case "$sysman" in
6932'')
6933 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
6934 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
6935 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
6936 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6937 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
6938 sysman=`./loc . /usr/man/man1 $syspath`
6939 ;;
6940esac
6941if $test -d "$sysman"; then
6942 echo "System manual is in $sysman." >&4
6943else
6944 echo "Could not find manual pages in source form." >&4
6945fi
6946
6947: determine where manual pages go
6948set man1dir man1dir none
6949eval $prefixit
6950$cat <<EOM
6951
6952$spackage has manual pages available in source form.
6953EOM
6954case "$nroff" in
6955nroff)
6956 echo "However, you don't have nroff, so they're probably useless to you."
6957 case "$man1dir" in
6958 '') man1dir="none";;
6959 esac;;
6960esac
6961echo "If you don't want the manual sources installed, answer 'none'."
6962case "$man1dir" in
6963' ') dflt=none
6964 ;;
6965'')
6966 lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6967 lookpath="$lookpath $prefixexp/man/p_man/man1"
6968 lookpath="$lookpath $prefixexp/man/u_man/man1"
6969 lookpath="$lookpath $prefixexp/man/man.1"
6970 case "$sysman" in
6971 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6972 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6973 esac
6974 set dflt
6975 eval $prefixup
6976 ;;
6977*) dflt="$man1dir"
6978 ;;
6979esac
6980echo " "
6981fn=dn+~
6982rp="Where do the main $spackage manual pages (source) go?"
6983. ./getfile
6984if $test "X$man1direxp" != "X$ansexp"; then
6985 installman1dir=''
6986fi
6987man1dir="$ans"
6988man1direxp="$ansexp"
6989case "$man1dir" in
6990'') man1dir=' '
6991 installman1dir='';;
6992esac
6993
6994: Change installation prefix, if necessary.
6995if $test X"$prefix" != X"$installprefix"; then
6996 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6997else
6998 installman1dir="$man1direxp"
6999fi
7000
7001: What suffix to use on installed man pages
7002
7003case "$man1dir" in
7004' ')
7005 man1ext='0'
7006 ;;
7007*)
7008 rp="What suffix should be used for the main $spackage man pages?"
7009 case "$man1ext" in
7010 '') case "$man1dir" in
7011 *1) dflt=1 ;;
7012 *1p) dflt=1p ;;
7013 *1pm) dflt=1pm ;;
7014 *l) dflt=l;;
7015 *n) dflt=n;;
7016 *o) dflt=o;;
7017 *p) dflt=p;;
7018 *C) dflt=C;;
7019 *L) dflt=L;;
7020 *L1) dflt=L1;;
7021 *) dflt=1;;
7022 esac
7023 ;;
7024 *) dflt="$man1ext";;
7025 esac
7026 . ./myread
7027 man1ext="$ans"
7028 ;;
7029esac
7030
7031: see if we can have long filenames
7032echo " "
7033first=123456789abcdef
7034$rm -f $first
7035if (echo hi >$first) 2>/dev/null; then
7036 if $test -f 123456789abcde; then
7037 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
7038 val="$undef"
7039 else
7040 echo 'You can have filenames longer than 14 characters.'>&4
7041 val="$define"
7042 fi
7043else
7044 $cat <<'EOM'
7045You can't have filenames longer than 14 chars.
7046You can't even think about them!
7047EOM
7048 val="$undef"
7049fi
7050set d_flexfnam
7051eval $setvar
7052$rm -rf 123456789abcde*
7053
7054: determine where library module manual pages go
7055set man3dir man3dir none
7056eval $prefixit
7057$cat <<EOM
7058
7059$spackage has manual pages for many of the library modules.
7060EOM
7061
7062case "$nroff" in
7063nroff)
7064 $cat <<'EOM'
7065However, you don't have nroff, so they're probably useless to you.
7066EOM
7067 case "$man3dir" in
7068 '') man3dir="none";;
7069 esac;;
7070esac
7071
7072case "$d_flexfnam" in
7073undef)
7074 $cat <<'EOM'
7075However, your system can't handle the long file names like File::Basename.3.
7076EOM
7077 case "$man3dir" in
7078 '') man3dir="none";;
7079 esac;;
7080esac
7081
7082echo "If you don't want the manual sources installed, answer 'none'."
7083prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7084case "$man3dir" in
7085'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7086 if $test -d "$privlib/man/man3"; then
7087 cat <<EOM >&4
7088
7089WARNING: Previous versions of perl installed man3 pages into
7090$privlib/man/man3. This version will suggest a
7091new default of $dflt.
7092EOM
7093 tdflt=$dflt
7094 dflt='n'
7095 rp='Do you wish to preserve the old behavior?(y/n)'
7096 . ./myread
7097 case "$ans" in
7098 y*) dflt="$privlib/man/man3" ;;
7099 *) dflt=$tdflt ;;
7100 esac
7101 fi
7102 ;;
7103*) dflt="$man3dir" ;;
7104esac
7105case "$dflt" in
7106' ') dflt=none ;;
7107esac
7108echo " "
7109fn=dn+~
7110rp="Where do the $package library man pages (source) go?"
7111. ./getfile
7112man3dir="$ans"
7113man3direxp="$ansexp"
7114case "$man3dir" in
7115'') man3dir=' '
7116 installman3dir='';;
7117esac
7118
7119: Change installation prefix, if necessary.
7120if $test X"$prefix" != X"$installprefix"; then
7121 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7122else
7123 installman3dir="$man3direxp"
7124fi
7125
7126: What suffix to use on installed man pages
7127case "$man3dir" in
7128' ')
7129 man3ext='0'
7130 ;;
7131*)
7132 rp="What suffix should be used for the $package library man pages?"
7133 case "$man3ext" in
7134 '') case "$man3dir" in
7135 *3) dflt=3 ;;
7136 *3p) dflt=3p ;;
7137 *3pm) dflt=3pm ;;
7138 *l) dflt=l;;
7139 *n) dflt=n;;
7140 *o) dflt=o;;
7141 *p) dflt=p;;
7142 *C) dflt=C;;
7143 *L) dflt=L;;
7144 *L3) dflt=L3;;
7145 *) dflt=3;;
7146 esac
7147 ;;
7148 *) dflt="$man3ext";;
7149 esac
7150 . ./myread
7151 man3ext="$ans"
7152 ;;
7153esac
7154
7155: see if we have to deal with yellow pages, now NIS.
7156if $test -d /usr/etc/yp || $test -d /etc/yp; then
7157 if $test -f /usr/etc/nibindd; then
7158 echo " "
7159 echo "I'm fairly confident you're on a NeXT."
7160 echo " "
7161 rp='Do you get the hosts file via NetInfo?'
7162 dflt=y
7163 case "$hostcat" in
7164 nidump*) ;;
7165 '') ;;
7166 *) dflt=n;;
7167 esac
7168 . ./myread
7169 case "$ans" in
7170 y*) hostcat='nidump hosts .';;
7171 *) case "$hostcat" in
7172 nidump*) hostcat='';;
7173 esac
7174 ;;
7175 esac
7176 fi
7177 case "$hostcat" in
7178 nidump*) ;;
7179 *)
7180 case "$hostcat" in
7181 *ypcat*) dflt=y;;
7182 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7183 dflt=y
7184 else
7185 dflt=n
7186 fi;;
7187 *) dflt=n;;
7188 esac
7189 echo " "
7190 rp='Are you getting the hosts file via yellow pages?'
7191 . ./myread
7192 case "$ans" in
7193 y*) hostcat='ypcat hosts';;
7194 *) hostcat='cat /etc/hosts';;
7195 esac
7196 ;;
7197 esac
7198fi
7199case "$hostcat" in
7200'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7201esac
7202case "$groupcat" in
7203'') test -f /etc/group && groupcat='cat /etc/group';;
7204esac
7205case "$passcat" in
7206'') test -f /etc/passwd && passcat='cat /etc/passwd';;
7207esac
7208
7209: now get the host name
7210echo " "
7211echo "Figuring out host name..." >&4
7212case "$myhostname" in
7213'') cont=true
7214 echo 'Maybe "hostname" will work...'
73614538 7215 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
7216 myhostname=$tans
7217 phostname=hostname
7218 cont=''
7219 fi
7220 ;;
7221*) cont='';;
7222esac
7223if $test "$cont"; then
7224 if ./xenix; then
7225 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
7226 if tans=`cat /etc/systemid 2>&1` ; then
7227 myhostname=$tans
7228 phostname='cat /etc/systemid'
7229 echo "Whadyaknow. Xenix always was a bit strange..."
7230 cont=''
7231 fi
7232 elif $test -r /etc/systemid; then
7233 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7234 fi
7235fi
7236if $test "$cont"; then
7237 echo 'No, maybe "uuname -l" will work...'
73614538 7238 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
7239 myhostname=$tans
7240 phostname='uuname -l'
7241 else
7242 echo 'Strange. Maybe "uname -n" will work...'
73614538 7243 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
7244 myhostname=$tans
7245 phostname='uname -n'
7246 else
7247 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 7248 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
7249 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7250 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7251 else
7252 case "$myhostname" in
7253 '') echo "Does this machine have an identity crisis or something?"
7254 phostname='';;
7255 *)
7256 echo "Well, you said $myhostname before..."
7257 phostname='echo $myhostname';;
7258 esac
7259 fi
7260 fi
7261 fi
7262fi
7263: you do not want to know about this
7264set $myhostname
7265myhostname=$1
7266
7267: verify guess
7268if $test "$myhostname" ; then
7269 dflt=y
7270 rp='Your host name appears to be "'$myhostname'".'" Right?"
7271 . ./myread
7272 case "$ans" in
7273 y*) ;;
7274 *) myhostname='';;
7275 esac
7276fi
7277
7278: bad guess or no guess
7279while $test "X$myhostname" = X ; do
7280 dflt=''
7281 rp="Please type the (one word) name of your host:"
7282 . ./myread
7283 myhostname="$ans"
7284done
7285
7286: translate upper to lower if necessary
7287case "$myhostname" in
7288*[A-Z]*)
7289 echo "(Normalizing case in your host name)"
7290 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7291 ;;
7292esac
7293
7294case "$myhostname" in
7295*.*)
7296 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7297 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7298 echo "(Trimming domain name from host name--host name is now $myhostname)"
7299 ;;
7300*) case "$mydomain" in
7301 '')
7302 {
7303 test "X$hostcat" = "Xypcat hosts" &&
7304 ypmatch "$myhostname" hosts 2>/dev/null |\
7305 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
7306 $test -s hosts
7307 } || {
7308 test "X$hostcat" != "X" &&
7309 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
7310 /[ ]$myhostname[ . ]/p" > hosts
7311 }
7312 tmp_re="[ . ]"
f08cbdd1
PP
7313 if $test -f hosts; then
7314 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 7315 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
7316 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7317 hosts | $sort | $uniq | \
7318 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7319 case `$echo X$dflt` in
7320 X*\ *) echo "(Several hosts in the database matched hostname)"
7321 dflt=.
7322 ;;
7323 X.) echo "(You do not have fully-qualified names in the hosts database)"
7324 ;;
7325 esac
7326 else
7327 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 7328 dflt=.
f08cbdd1 7329 fi
b4eb6b3d
JH
7330 case "$dflt" in
7331 .)
7332 tans=`./loc resolv.conf X /etc /usr/etc`
7333 if $test -f "$tans"; then
7334 echo "(Attempting domain name extraction from $tans)"
7335 dflt=.`$sed -n -e 's/ / /g' \
7336 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
7337 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7338 case "$dflt" in
7339 .) dflt=.`$sed -n -e 's/ / /g' \
7340 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
7341 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7342 ;;
7343 esac
7344 fi
7345 ;;
7346 esac
7347 case "$dflt" in
7348 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 7349 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
7350 case "$dflt" in
7351 '') dflt='.';;
7352 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7353 esac
7354 ;;
7355 esac
7356 case "$dflt" in
7357 .) echo "(Lost all hope -- silly guess then)"
7358 dflt='.uucp'
7359 ;;
7360 esac
7361 $rm -f hosts
7362 ;;
7363 *) dflt="$mydomain";;
7364 esac;;
7365esac
7366echo " "
7367rp="What is your domain name?"
7368. ./myread
7369tans="$ans"
7370case "$ans" in
7371'') ;;
7372.*) ;;
7373*) tans=".$tans";;
7374esac
7375mydomain="$tans"
7376
7377: translate upper to lower if necessary
7378case "$mydomain" in
7379*[A-Z]*)
7380 echo "(Normalizing case in your domain name)"
7381 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7382 ;;
7383esac
7384
7385: a little sanity check here
7386case "$phostname" in
7387'') ;;
7388*)
7389 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7390 $myhostname$mydomain|$myhostname) ;;
7391 *)
7392 case "$phostname" in
7393 sed*)
7394 echo "(That doesn't agree with your whoami.h file, by the way.)"
7395 ;;
7396 *)
7397 echo "(That doesn't agree with your $phostname command, by the way.)"
7398 ;;
7399 esac
7400 ;;
7401 esac
7402 ;;
7403esac
7404
7405$cat <<EOM
7406
7407I need to get your e-mail address in Internet format if possible, i.e.
7408something like user@host.domain. Please answer accurately since I have
7409no easy means to double check it. The default value provided below
7410is most probably close to reality but may not be valid from outside
7411your organization...
7412
7413EOM
7414cont=x
7415while test "$cont"; do
7416 case "$cf_email" in
7417 '') dflt="$cf_by@$myhostname$mydomain";;
7418 *) dflt="$cf_email";;
7419 esac
7420 rp='What is your e-mail address?'
7421 . ./myread
7422 cf_email="$ans"
7423 case "$cf_email" in
7424 *@*.*) cont='' ;;
7425 *)
7426 rp='Address does not look like an Internet one. Use it anyway?'
7427 case "$fastread" in
7428 yes) dflt=y ;;
7429 *) dflt=n ;;
7430 esac
7431 . ./myread
7432 case "$ans" in
7433 y*) cont='' ;;
7434 *) echo " " ;;
7435 esac
7436 ;;
7437 esac
7438done
7439
7440$cat <<EOM
7441
7442If you or somebody else will be maintaining perl at your site, please
7443fill in the correct e-mail address here so that they may be contacted
7444if necessary. Currently, the "perlbug" program included with perl
7445will send mail to this address in addition to perlbug@perl.org. You may
7446enter "none" for no administrator.
7447
7448EOM
7449case "$perladmin" in
7450'') dflt="$cf_email";;
7451*) dflt="$perladmin";;
7452esac
7453rp='Perl administrator e-mail address'
7454. ./myread
7455perladmin="$ans"
7456
674912d7
RB
7457: determine whether to only install version-specific parts.
7458echo " "
7459$cat <<EOM
7460Do you want to install only the version-specific parts of the perl
7461distribution? Usually you do *not* want to do this.
7462EOM
7463case "$versiononly" in
7464"$define"|[Yy]*|true) dflt='y' ;;
7465*) dflt='n';
7466esac
7467rp="Do you want to install only the version-specific parts of perl?"
7468. ./myread
7469case "$ans" in
7470[yY]*) val="$define";;
7471*) val="$undef" ;;
7472esac
7473set versiononly
7474eval $setvar
7475
b4eb6b3d
JH
7476: figure out how to guarantee perl startup
7477case "$startperl" in
7478'')
7479 case "$sharpbang" in
7480 *!)
7481 $cat <<EOH
7482
7483I can use the #! construct to start perl on your system. This will
7484make startup of perl scripts faster, but may cause problems if you
7485want to share those scripts and perl is not in a standard place
7486($binexp/perl) on all your platforms. The alternative is to force
7487a shell by starting the script with a single ':' character.
7488
7489EOH
674912d7
RB
7490 case "$versiononly" in
7491 "$define") dflt="$binexp/perl$version";;
7492 *) dflt="$binexp/perl";;
7493 esac
b4eb6b3d
JH
7494 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7495 . ./myread
7496 case "$ans" in
7497 none) startperl=": # use perl";;
7498 *) startperl="#!$ans"
7499 if $test 30 -lt `echo "$ans" | wc -c`; then
7500 $cat >&4 <<EOM
7501
7502WARNING: Some systems limit the #! command to 32 characters.
7503If you experience difficulty running Perl scripts with #!, try
7504installing Perl in a directory with a shorter pathname.
7505
7506EOM
7507 fi ;;
7508 esac
7509 ;;
7510 *) startperl=": # use perl"
7511 ;;
7512 esac
7513 ;;
7514esac
7515echo "I'll use $startperl to start perl scripts."
7516
7517: figure best path for perl in scripts
7518case "$perlpath" in
7519'')
7520 perlpath="$binexp/perl"
7521 case "$startperl" in
7522 *!*) ;;
7523 *)
7524 $cat <<EOH
7525
7526I will use the "eval 'exec'" idiom to start Perl on your system.
7527I can use the full path of your Perl binary for this purpose, but
7528doing so may cause problems if you want to share those scripts and
7529Perl is not always in a standard place ($binexp/perl).
7530
7531EOH
7532 dflt="$binexp/perl"
7533 rp="What path shall I use in \"eval 'exec'\"?"
7534 . ./myread
7535 perlpath="$ans"
7536 ;;
7537 esac
7538 ;;
7539esac
7540case "$startperl" in
7541*!*) ;;
7542*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7543esac
7544
7545: determine where public executable scripts go
7546set scriptdir scriptdir
7547eval $prefixit
7548case "$scriptdir" in
7549'')
7550 dflt="$bin"
7551 : guess some guesses
7552 $test -d /usr/share/scripts && dflt=/usr/share/scripts
7553 $test -d /usr/share/bin && dflt=/usr/share/bin
7554 $test -d /usr/local/script && dflt=/usr/local/script
7555 $test -d /usr/local/scripts && dflt=/usr/local/scripts
7556 $test -d $prefixexp/script && dflt=$prefixexp/script
7557 set dflt
7558 eval $prefixup
7559 ;;
7560*) dflt="$scriptdir"
7561 ;;
7562esac
7563$cat <<EOM
7564
7565Some installations have a separate directory just for executable scripts so
7566that they can mount it across multiple architectures but keep the scripts in
7567one spot. You might, for example, have a subdirectory of /usr/share for this.
7568Or you might just lump your scripts in with all your other executables.
7569
7570EOM
7571fn=d~
7572rp='Where do you keep publicly executable scripts?'
7573. ./getfile
7574if $test "X$ansexp" != "X$scriptdirexp"; then
7575 installscript=''
7576fi
7577scriptdir="$ans"
7578scriptdirexp="$ansexp"
7579: Change installation prefix, if necessary.
7580if $test X"$prefix" != X"$installprefix"; then
7581 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7582else
7583 installscript="$scriptdirexp"
7584fi
7585
7586: determine where add-on public executables go
7587case "$sitebin" in
7588'') dflt=$siteprefix/bin ;;
7589*) dflt=$sitebin ;;
7590esac
7591fn=d~
7592rp='Pathname where the add-on public executables should be installed?'
7593. ./getfile
7594sitebin="$ans"
7595sitebinexp="$ansexp"
7596: Change installation prefix, if necessary.
7597if $test X"$prefix" != X"$installprefix"; then
7598 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7599else
7600 installsitebin="$sitebinexp"
7601fi
7602
b4eb6b3d
JH
7603case "$vendorprefix" in
7604'') d_vendorbin="$undef"
7605 vendorbin=''
7606 vendorbinexp=''
7607 ;;
7608*) d_vendorbin="$define"
7609 : determine where vendor-supplied executables go.
7610 case "$vendorbin" in
7611 '') dflt=$vendorprefix/bin ;;
7612 *) dflt="$vendorbin" ;;
7613 esac
7614 fn=d~+
7615 rp='Pathname for the vendor-supplied executables directory?'
7616 . ./getfile
7617 vendorbin="$ans"
7618 vendorbinexp="$ansexp"
7619 ;;
7620esac
7621: Change installation prefix, if necessary.
7622if $test X"$prefix" != X"$installprefix"; then
7623 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7624else
7625 installvendorbin="$vendorbinexp"
7626fi
7627
7628: see if qgcvt exists
7629set qgcvt d_qgcvt
7630eval $inlibc
7631
7632echo " "
7633
7634if $test X"$d_longdbl" = X"$define"; then
7635
7636echo "Checking how to print long doubles..." >&4
7637
7638if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7639 $cat >try.c <<'EOCP'
7640#include <sys/types.h>
7641#include <stdio.h>
7642int main() {
7643 double d = 123.456;
7644 printf("%.3f\n", d);
7645}
7646EOCP
7647 set try
7648 if eval $compile; then
7649 yyy=`./try$exe_ext`
7650 case "$yyy" in
7651 123.456)
7652 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7653 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7654 echo "We will use %f."
7655 ;;
7656 esac
7657 fi
7658fi
7659
7660if $test X"$sPRIfldbl" = X; then
7661 $cat >try.c <<'EOCP'
7662#include <sys/types.h>
7663#include <stdio.h>
7664int main() {
7665 long double d = 123.456;
7666 printf("%.3llf\n", d);
7667}
7668EOCP
7669 set try
7670 if eval $compile; then
7671 yyy=`./try$exe_ext`
7672 case "$yyy" in
7673 123.456)
7674 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7675 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7676 echo "We will use %llf."
7677 ;;
7678 esac
7679 fi
7680fi
7681
7682if $test X"$sPRIfldbl" = X; then
7683 $cat >try.c <<'EOCP'
7684#include <sys/types.h>
7685#include <stdio.h>
7686int main() {
7687 long double d = 123.456;
7688 printf("%.3Lf\n", d);
7689}
7690EOCP
7691 set try
7692 if eval $compile; then
7693 yyy=`./try$exe_ext`
7694 case "$yyy" in
7695 123.456)
7696 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7697 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7698 echo "We will use %Lf."
7699 ;;
7700 esac
7701 fi
7702fi
7703
7704if $test X"$sPRIfldbl" = X; then
7705 $cat >try.c <<'EOCP'
7706#include <sys/types.h>
7707#include <stdio.h>
7708int main() {
7709 long double d = 123.456;
7710 printf("%.3lf\n", d);
7711}
7712EOCP
7713 set try
7714 if eval $compile; then
7715 yyy=`./try$exe_ext`
7716 case "$yyy" in
7717 123.456)
7718 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7719 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7720 echo "We will use %lf."
7721 ;;
7722 esac
7723 fi
7724fi
7725
7726if $test X"$sPRIfldbl" = X; then
7727 echo "Cannot figure out how to print long doubles." >&4
7728else
7729 sSCNfldbl=$sPRIfldbl # expect consistency
7730fi
7731
7732$rm -f try try.*
7733
7734fi # d_longdbl
7735
7736case "$sPRIfldbl" in
7737'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
7738 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
7739 d_SCNfldbl="$undef";
7740 ;;
7741*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
7742 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
7743 d_SCNfldbl="$define";
7744 ;;
7745esac
7746
7747: Check how to convert floats to strings.
7748echo " "
7749echo "Checking for an efficient way to convert floats to strings."
7750echo " " > try.c
7751case "$uselongdouble" in
7752"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7753esac
7754case "$d_longdbl" in
7755"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7756esac
7757case "$d_PRIgldbl" in
7758"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
7759esac
7760$cat >>try.c <<EOP
7761#ifdef TRY_gconvert
7762#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7763char *myname = "gconvert";
7764#endif
7765#ifdef TRY_gcvt
7766#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7767char *myname = "gcvt";
7768#endif
7769#ifdef TRY_qgcvt
7770#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7771char *myname = "qgcvt";
7772#define DOUBLETYPE long double
7773#endif
7774#ifdef TRY_sprintf
7775#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7776#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7777#else
7778#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7779#endif
7780char *myname = "sprintf";
7781#endif
7782
7783#ifndef DOUBLETYPE
7784#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7785#define DOUBLETYPE long double
7786#else
7787#define DOUBLETYPE double
7788#endif
7789#endif
7790
7791#include <stdio.h>
7792
7793#define I_STDLIB $i_stdlib
7794#ifdef I_STDLIB
7795#include <stdlib.h>
7796#endif
7797
7798int
7799checkit(expect, got)
7800char *expect;
7801char *got;
7802{
7803 if (strcmp(expect, got)) {
7804 printf("%s oddity: Expected %s, got %s\n",
7805 myname, expect, got);
7806 exit(1);
7807 }
7808}
7809
7810int main()
7811{
7812 char buf[64];
7813 buf[63] = '\0';
7814
7815 /* This must be 1st test on (which?) platform */
7816 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7817 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7818 checkit("0.1", buf);
7819
7820 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
7821 checkit("1", buf);
7822
7823 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
7824 checkit("1.1", buf);
7825
7826 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
7827 checkit("1.01", buf);
7828
7829 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
7830 checkit("1.001", buf);
7831
7832 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
7833 checkit("1.0001", buf);
7834
7835 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
7836 checkit("1.00001", buf);
7837
7838 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
7839 checkit("1.000001", buf);
7840
7841 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
7842 checkit("0", buf);
7843
7844 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
7845 checkit("-1", buf);
7846
7847 /* Some Linux gcvt's give 1.e+5 here. */
7848 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
7849 checkit("100000", buf);
7850
7851 /* Some Linux gcvt's give -1.e+5 here. */
7852 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
7853 checkit("-100000", buf);
7854
7855 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
7856 checkit("123.456", buf);
7857
7858 exit(0);
7859}
7860EOP
7861case "$d_Gconvert" in
7862gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7863gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7864sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7865*) xxx_list='gconvert gcvt sprintf' ;;
7866esac
7867
7868case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7869"$define$define$define")
7870 # for long doubles prefer first qgcvt, then sprintf
7871 xxx_list="`echo $xxx_list|sed s/sprintf//`"
7872 xxx_list="sprintf $xxx_list"
7873 case "$d_qgcvt" in
7874 "$define") xxx_list="qgcvt $xxx_list" ;;
7875 esac
7876 ;;
7877esac
7878
7879for xxx_convert in $xxx_list; do
7880 echo "Trying $xxx_convert..."
7881 $rm -f try try$_o
7882 set try -DTRY_$xxx_convert
7883 if eval $compile; then
7884 echo "$xxx_convert() found." >&4
7885 if ./try; then
7886 echo "I'll use $xxx_convert to convert floats into a string." >&4
7887 break;
7888 else
7889 echo "...But $xxx_convert didn't work as I expected."
7890 fi
7891 else
7892 echo "$xxx_convert NOT found." >&4
7893 fi
7894done
7895
7896case "$xxx_convert" in
7897gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7898gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7899qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7900*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7901 "$define$define$define")
7902 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7903 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7904 esac
7905 ;;
7906esac
7907
74cac757
JH
7908: see if _fwalk exists
7909set fwalk d__fwalk
7910eval $inlibc
7911
b4eb6b3d
JH
7912: Initialize h_fcntl
7913h_fcntl=false
7914
7915: Initialize h_sysfile
7916h_sysfile=false
7917
7918: access call always available on UNIX
7919set access d_access
7920eval $inlibc
7921
7922: locate the flags for 'access()'
7923case "$d_access" in
7924"$define")
7925 echo " "
7926 $cat >access.c <<'EOCP'
7927#include <sys/types.h>
7928#ifdef I_FCNTL
7929#include <fcntl.h>
7930#endif
7931#ifdef I_SYS_FILE
7932#include <sys/file.h>
7933#endif
7934#ifdef I_UNISTD
7935#include <unistd.h>
7936#endif
7937int main() {
7938 exit(R_OK);
7939}
7940EOCP
7941 : check sys/file.h first, no particular reason here
7942 if $test `./findhdr sys/file.h` && \
7a282f6d 7943 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
7944 h_sysfile=true;
7945 echo "<sys/file.h> defines the *_OK access constants." >&4
7946 elif $test `./findhdr fcntl.h` && \
7a282f6d 7947 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
7948 h_fcntl=true;
7949 echo "<fcntl.h> defines the *_OK access constants." >&4
7950 elif $test `./findhdr unistd.h` && \
7a282f6d 7951 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
7952 echo "<unistd.h> defines the *_OK access constants." >&4
7953 else
7954 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7955 fi
7956 ;;
7957esac
7958$rm -f access*
7959
7960: see if accessx exists
7961set accessx d_accessx
7962eval $inlibc
7963
7964: see if alarm exists
7965set alarm d_alarm
7966eval $inlibc
7967
7968: see if atolf exists
7969set atolf d_atolf
7970eval $inlibc
7971
7972: see if atoll exists
7973set atoll d_atoll
7974eval $inlibc
7975
7976: Look for GNU-cc style attribute checking
7977echo " "
7978echo "Checking whether your compiler can handle __attribute__ ..." >&4
7979$cat >attrib.c <<'EOCP'
7980#include <stdio.h>
7981void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7982EOCP
7983if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7984 if $contains 'warning' attrib.out >/dev/null 2>&1; then
7985 echo "Your C compiler doesn't fully support __attribute__."
7986 val="$undef"
7987 else
7988 echo "Your C compiler supports __attribute__."
7989 val="$define"
7990 fi
7991else
7992 echo "Your C compiler doesn't seem to understand __attribute__ at all."
7993 val="$undef"
7994fi
7995set d_attribut
7996eval $setvar
7997$rm -f attrib*
7998
7999: see if bcmp exists
8000set bcmp d_bcmp
8001eval $inlibc
8002
8003: see if bcopy exists
8004set bcopy d_bcopy
8005eval $inlibc
8006
8007: see if this is a unistd.h system
8008set unistd.h i_unistd
8009eval $inhdr
8010
8011: see if getpgrp exists
8012set getpgrp d_getpgrp
8013eval $inlibc
8014
8015case "$d_getpgrp" in
8016"$define")
8017 echo " "
8018 echo "Checking to see which flavor of getpgrp is in use..."
8019 $cat >set.c <<EOP
8020#$i_unistd I_UNISTD
8021#include <sys/types.h>
8022#ifdef I_UNISTD
8023# include <unistd.h>
8024#endif
8025int main()
8026{
8027 if (getuid() == 0) {
8028 printf("(I see you are running Configure as super-user...)\n");
8029 setuid(1);
8030 }
8031#ifdef TRY_BSD_PGRP
8032 if (getpgrp(1) == 0)
8033 exit(0);
8034#else
8035 if (getpgrp() > 0)
8036 exit(0);
8037#endif
8038 exit(1);
8039}
8040EOP
7a282f6d 8041 if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
8042 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8043 val="$define"
7a282f6d 8044 elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
8045 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8046 val="$undef"
8047 else
8048 echo "I can't seem to compile and run the test program."
8049 if ./usg; then
8050 xxx="a USG one, i.e. you use getpgrp()."
8051 else
8052 # SVR4 systems can appear rather BSD-ish.
8053 case "$i_unistd" in
8054 $undef)
8055 xxx="a BSD one, i.e. you use getpgrp(pid)."
8056 val="$define"
8057 ;;
8058 $define)
8059 xxx="probably a USG one, i.e. you use getpgrp()."
8060 val="$undef"
8061 ;;
8062 esac
8063 fi
8064 echo "Assuming your getpgrp is $xxx" >&4
8065 fi
8066 ;;
8067*) val="$undef";;
8068esac
8069set d_bsdgetpgrp
8070eval $setvar
8071$rm -f set set.c
8072
8073: see if setpgrp exists
8074set setpgrp d_setpgrp
8075eval $inlibc
8076
8077case "$d_setpgrp" in
8078"$define")
8079 echo " "
8080 echo "Checking to see which flavor of setpgrp is in use..."
8081 $cat >set.c <<EOP
8082#$i_unistd I_UNISTD
8083#include <sys/types.h>
8084#ifdef I_UNISTD
8085# include <unistd.h>
8086#endif
8087int main()
8088{
8089 if (getuid() == 0) {
8090 printf("(I see you are running Configure as super-user...)\n");
8091 setuid(1);
8092 }
8093#ifdef TRY_BSD_PGRP
8094 if (-1 == setpgrp(1, 1))
8095 exit(0);
8096#else
8097 if (setpgrp() != -1)
8098 exit(0);
8099#endif
8100 exit(1);
8101}
8102EOP
7a282f6d 8103 if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
8104 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8105 val="$define"
7a282f6d 8106 elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
8107 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8108 val="$undef"
8109 else
8110 echo "(I can't seem to compile and run the test program.)"
8111 if ./usg; then
8112 xxx="a USG one, i.e. you use setpgrp()."
8113 else
8114 # SVR4 systems can appear rather BSD-ish.
8115 case "$i_unistd" in
8116 $undef)
8117 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8118 val="$define"
8119 ;;
8120 $define)
8121 xxx="probably a USG one, i.e. you use setpgrp()."
8122 val="$undef"
8123 ;;
8124 esac
8125 fi
8126 echo "Assuming your setpgrp is $xxx" >&4
8127 fi
8128 ;;
8129*) val="$undef";;
8130esac
8131set d_bsdsetpgrp
8132eval $setvar
8133$rm -f set set.c
8134: see if bzero exists
8135set bzero d_bzero
8136eval $inlibc
8137
8138: see if signal is declared as pointer to function returning int or void
8139echo " "
8140xxx=`./findhdr signal.h`
8141$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8142if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
8143 echo "You have int (*signal())() instead of void." >&4
8144 val="$undef"
8145elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
8146 echo "You have void (*signal())()." >&4
8147 val="$define"
8148elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8149 echo "You have int (*signal())() instead of void." >&4
8150 val="$undef"
8151elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8152 echo "You have void (*signal())()." >&4
8153 val="$define"
8154else
8155 case "$d_voidsig" in
8156 '')
8157 echo "I can't determine whether signal handler returns void or int..." >&4
8158 dflt=void
8159 rp="What type does your signal handler return?"
8160 . ./myread
8161 case "$ans" in
8162 v*) val="$define";;
8163 *) val="$undef";;
8164 esac;;
8165 "$define")
8166 echo "As you already told me, signal handler returns void." >&4
8167 val="$define"
8168 ;;
8169 *) echo "As you already told me, signal handler returns int." >&4
8170 val="$undef"
8171 ;;
8172 esac
8173fi
8174set d_voidsig
8175eval $setvar
8176case "$d_voidsig" in
8177"$define") signal_t="void";;
8178*) signal_t="int";;
8179esac
8180$rm -f $$.tmp
8181
8182: check for ability to cast large floats to 32-bit ints.
8183echo " "
8184echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8185if $test "$intsize" -ge 4; then
8186 xxx=int
8187else
8188 xxx=long
8189fi
8190$cat >try.c <<EOCP
8191#include <stdio.h>
8192#include <sys/types.h>
8193#include <signal.h>
8194$signal_t blech(s) int s; { exit(3); }
8195int main()
8196{
8197 $xxx i32;
8198 double f, g;
8199 int result = 0;
8200 char str[16];
8201 signal(SIGFPE, blech);
8202
8203 /* Don't let compiler optimize the test away. Store the number
8204 in a writable string for gcc to pass to sscanf under HP/UX.
8205 */
8206 sprintf(str, "2147483647");
8207 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8208 g = 10 * f;
8209 i32 = ($xxx) g;
8210
8211 /* x86 processors will probably give 0x8000 0000, which is a
8212 sign change. We don't want that. We want to mimic SPARC
8213 behavior here, which is to preserve the sign and give
8214 back 0x7fff ffff.
8215 */
8216 if (i32 != ($xxx) f)
8217 result |= 1;
8218 exit(result);
8219}
8220EOCP
8221set try
8222if eval $compile_ok; then
8223 ./try
8224 yyy=$?
8225else
8226 echo "(I can't seem to compile the test program--assuming it can't)"
8227 yyy=1
8228fi
8229case "$yyy" in
82300) val="$define"
8231 echo "Yup, it can."
8232 ;;
8233*) val="$undef"
8234 echo "Nope, it can't."
8235 ;;
8236esac
8237set d_casti32
8238eval $setvar
8239$rm -f try try.*
8240
8241: check for ability to cast negative floats to unsigned
8242echo " "
8243echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8244$cat >try.c <<EOCP
8245#include <stdio.h>
8246#include <sys/types.h>
8247#include <signal.h>
8248$signal_t blech(s) int s; { exit(7); }
8249$signal_t blech_in_list(s) int s; { exit(4); }
8250unsigned long dummy_long(p) unsigned long p; { return p; }
8251unsigned int dummy_int(p) unsigned int p; { return p; }
8252unsigned short dummy_short(p) unsigned short p; { return p; }
8253int main()
8254{
8255 double f;
8256 unsigned long along;
8257 unsigned int aint;
8258 unsigned short ashort;
8259 int result = 0;
8260 char str[16];
8261
8262 /* Frustrate gcc-2.7.2's optimizer which failed this test with
8263 a direct f = -123. assignment. gcc-2.8.0 reportedly
8264 optimized the whole file away
8265 */
8266 /* Store the number in a writable string for gcc to pass to
8267 sscanf under HP/UX.
8268 */
8269 sprintf(str, "-123");
8270 sscanf(str, "%lf", &f); /* f = -123.; */
8271
8272 signal(SIGFPE, blech);
8273 along = (unsigned long)f;
8274 aint = (unsigned int)f;
8275 ashort = (unsigned short)f;
8276 if (along != (unsigned long)-123)
8277 result |= 1;
8278 if (aint != (unsigned int)-123)
8279 result |= 1;
8280 if (ashort != (unsigned short)-123)
8281 result |= 1;
8282 sprintf(str, "1073741824.");
8283 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8284 f = f + f;
8285 along = 0;
8286 along = (unsigned long)f;
8287 if (along != 0x80000000)
8288 result |= 2;
8289 f -= 1.;
8290 along = 0;
8291 along = (unsigned long)f;
8292 if (along != 0x7fffffff)
8293 result |= 1;
8294 f += 2.;
8295 along = 0;
8296 along = (unsigned long)f;
8297 if (along != 0x80000001)
8298 result |= 2;
8299 if (result)
8300 exit(result);
8301 signal(SIGFPE, blech_in_list);
8302 sprintf(str, "123.");
8303 sscanf(str, "%lf", &f); /* f = 123.; */
8304 along = dummy_long((unsigned long)f);
8305 aint = dummy_int((unsigned int)f);
8306 ashort = dummy_short((unsigned short)f);
8307 if (along != (unsigned long)123)
8308 result |= 4;
8309 if (aint != (unsigned int)123)
8310 result |= 4;
8311 if (ashort != (unsigned short)123)
8312 result |= 4;
8313 exit(result);
8314
8315}
8316EOCP
8317set try
8318if eval $compile_ok; then
8319 ./try
8320 castflags=$?
8321else
8322 echo "(I can't seem to compile the test program--assuming it can't)"
8323 castflags=7
8324fi
8325case "$castflags" in
83260) val="$define"
8327 echo "Yup, it can."
8328 ;;
8329*) val="$undef"
8330 echo "Nope, it can't."
8331 ;;
8332esac
8333set d_castneg
8334eval $setvar
8335$rm -f try.*
8336
8337: see if vprintf exists
8338echo " "
8339if set vprintf val -f d_vprintf; eval $csym; $val; then
8340 echo 'vprintf() found.' >&4
8341 val="$define"
8342 $cat >vprintf.c <<'EOF'
8343#include <varargs.h>
8344
8345int main() { xxx("foo"); }
8346
8347xxx(va_alist)
8348va_dcl
8349{
8350 va_list args;
8351 char buf[10];
8352
8353 va_start(args);
8354 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8355}
8356EOF
8357 set vprintf
8358 if eval $compile && ./vprintf; then
8359 echo "Your vsprintf() returns (int)." >&4
8360 val2="$undef"
8361 else
8362 echo "Your vsprintf() returns (char*)." >&4
8363 val2="$define"
8364 fi
8365else
8366 echo 'vprintf() NOT found.' >&4
8367 val="$undef"
8368 val2="$undef"
8369fi
8370set d_vprintf
8371eval $setvar
8372val=$val2
8373set d_charvspr
8374eval $setvar
8375
8376: see if chown exists
8377set chown d_chown
8378eval $inlibc
8379
8380: see if chroot exists
8381set chroot d_chroot
8382eval $inlibc
8383
8384: see if chsize exists
8385set chsize d_chsize
8386eval $inlibc
8387
8388: check for const keyword
8389echo " "
8390echo 'Checking to see if your C compiler knows about "const"...' >&4
8391$cat >const.c <<'EOCP'
8392typedef struct spug { int drokk; } spug;
8393int main()
8394{
8395 const char *foo;
8396 const spug y;
8397}
8398EOCP
8399if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8400 val="$define"
8401 echo "Yup, it does."
8402else
8403 val="$undef"
8404 echo "Nope, it doesn't."
8405fi
8406set d_const
8407eval $setvar
8408
8409: see if crypt exists
8410echo " "
8411if set crypt val -f d_crypt; eval $csym; $val; then
8412 echo 'crypt() found.' >&4
8413 val="$define"
8414 cryptlib=''
8415else
8416 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8417 if $test -z "$cryptlib"; then
8418 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8419 else
8420 cryptlib=-lcrypt
8421 fi
8422 if $test -z "$cryptlib"; then
8423 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8424 else
8425 cryptlib=-lcrypt
8426 fi
8427 if $test -z "$cryptlib"; then
8428 cryptlib=`./loc libcrypt$_a "" $libpth`
8429 else
8430 cryptlib=-lcrypt
8431 fi
8432 if $test -z "$cryptlib"; then
8433 echo 'crypt() NOT found.' >&4
8434 val="$undef"
8435 else
8436 val="$define"
8437 fi
8438fi
8439set d_crypt
8440eval $setvar
8441
8442: get csh whereabouts
8443case "$csh" in
8444'csh') val="$undef" ;;
8445*) val="$define" ;;
8446esac
8447set d_csh
8448eval $setvar
8449: Respect a hint or command line value for full_csh.
8450case "$full_csh" in
8451'') full_csh=$csh ;;
8452esac
8453
8454: see if cuserid exists
8455set cuserid d_cuserid
8456eval $inlibc
8457
8458: see if this is a limits.h system
8459set limits.h i_limits
8460eval $inhdr
8461
8462: see if this is a float.h system
8463set float.h i_float
8464eval $inhdr
8465
8466: See if number of significant digits in a double precision number is known
8467echo " "
8468$cat >dbl_dig.c <<EOM
8469#$i_limits I_LIMITS
8470#$i_float I_FLOAT
8471#ifdef I_LIMITS
8472#include <limits.h>
8473#endif
8474#ifdef I_FLOAT
8475#include <float.h>
8476#endif
8477#ifdef DBL_DIG
8478printf("Contains DBL_DIG");
8479#endif
8480EOM
8481$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8482if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8483 echo "DBL_DIG found." >&4
8484 val="$define"
8485else
8486 echo "DBL_DIG NOT found." >&4
8487 val="$undef"
8488fi
8489$rm -f dbl_dig.?
8490set d_dbl_dig
8491eval $setvar
8492
8493: see if difftime exists
8494set difftime d_difftime
8495eval $inlibc
8496
8497: see if this is a dirent system
8498echo " "
8499if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8500 val="$define"
8501 echo "<dirent.h> found." >&4
8502else
8503 val="$undef"
8504 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8505 echo "<sys/dir.h> found." >&4
8506 echo " "
8507 else
8508 xinc=`./findhdr sys/ndir.h`
8509 fi
8510 echo "<dirent.h> NOT found." >&4
8511fi
8512set i_dirent
8513eval $setvar
8514
8515: Look for type of directory structure.
8516echo " "
8517$cppstdin $cppflags $cppminus < "$xinc" > try.c
8518
8519case "$direntrytype" in
8520''|' ')
8521 case "$i_dirent" in
8522 $define) guess1='struct dirent' ;;
8523 *) guess1='struct direct' ;;
8524 esac
8525 ;;
8526*) guess1="$direntrytype"
8527 ;;
8528esac
8529
8530case "$guess1" in
8531'struct dirent') guess2='struct direct' ;;
8532*) guess2='struct dirent' ;;
8533esac
8534
8535if $contains "$guess1" try.c >/dev/null 2>&1; then
8536 direntrytype="$guess1"
8537 echo "Your directory entries are $direntrytype." >&4
8538elif $contains "$guess2" try.c >/dev/null 2>&1; then
8539 direntrytype="$guess2"
8540 echo "Your directory entries seem to be $direntrytype." >&4
8541else
8542 echo "I don't recognize your system's directory entries." >&4
8543 rp="What type is used for directory entries on this system?"
8544 dflt="$guess1"
8545 . ./myread
8546 direntrytype="$ans"
8547fi
8548$rm -f try.c
8549
8550
8551: see if the directory entry stores field length
8552echo " "
8553$cppstdin $cppflags $cppminus < "$xinc" > try.c
8554if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8555 echo "Good, your directory entry keeps length information in d_namlen." >&4
8556 val="$define"
8557else
8558 echo "Your directory entry does not know about the d_namlen field." >&4
8559 val="$undef"
8560fi
8561set d_dirnamlen
8562eval $setvar
8563$rm -f try.c
8564
8565: see if dlerror exists
8566xxx_runnm="$runnm"
8567runnm=false
8568set dlerror d_dlerror
8569eval $inlibc
8570runnm="$xxx_runnm"
8571
8572: see if dlfcn is available
8573set dlfcn.h i_dlfcn
8574eval $inhdr
8575
8576case "$usedl" in
8577$define|y|true)
8578 $cat << EOM
8579
8580On a few systems, the dynamically loaded modules that perl generates and uses
8581will need a different extension than shared libs. The default will probably
8582be appropriate.
8583
8584EOM
8585 case "$dlext" in
8586 '') dflt="$so" ;;
8587 *) dflt="$dlext" ;;
8588 esac
8589 rp='What is the extension of dynamically loaded modules'
8590 . ./myread
8591 dlext="$ans"
8592 ;;
8593*)
8594 dlext="none"
8595 ;;
8596esac
8597
8598: Check if dlsym need a leading underscore
8599echo " "
8600val="$undef"
8601
8602case "$dlsrc" in
8603dl_dlopen.xs)
8604 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8605 $cat >dyna.c <<'EOM'
8606fred () { }
8607EOM
8608
8609$cat >fred.c<<EOM
8610
8611#include <stdio.h>
8612#$i_dlfcn I_DLFCN
8613#ifdef I_DLFCN
8614#include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
8615#else
8616#include <sys/types.h>
8617#include <nlist.h>
8618#include <link.h>
8619#endif
8620
8621extern int fred() ;
8622
8623int main()
8624{
8625 void * handle ;
8626 void * symbol ;
8627#ifndef RTLD_LAZY
8628 int mode = 1 ;
8629#else
8630 int mode = RTLD_LAZY ;
8631#endif
8632 handle = dlopen("./dyna.$dlext", mode) ;
8633 if (handle == NULL) {
8634 printf ("1\n") ;
8635 fflush (stdout) ;
8636 exit(0);
8637 }
8638 symbol = dlsym(handle, "fred") ;
8639 if (symbol == NULL) {
8640 /* try putting a leading underscore */
8641 symbol = dlsym(handle, "_fred") ;
8642 if (symbol == NULL) {
8643 printf ("2\n") ;
8644 fflush (stdout) ;
8645 exit(0);
8646 }
8647 printf ("3\n") ;
8648 }
8649 else
8650 printf ("4\n") ;
8651 fflush (stdout) ;
8652 exit(0);
8653}
8654EOM
8655 : Call the object file tmp-dyna.o in case dlext=o.
8656 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
8657 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
7a282f6d
JH
8658 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
8659 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
b4eb6b3d
JH
8660 xxx=`./fred`
8661 case $xxx in
8662 1) echo "Test program failed using dlopen." >&4
8663 echo "Perhaps you should not use dynamic loading." >&4;;
8664 2) echo "Test program failed using dlsym." >&4
8665 echo "Perhaps you should not use dynamic loading." >&4;;
8666 3) echo "dlsym needs a leading underscore" >&4
8667 val="$define" ;;
8668 4) echo "dlsym doesn't need a leading underscore." >&4;;
8669 esac
8670 else
8671 echo "I can't compile and run the test program." >&4
8672 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8673 fi
8674 ;;
8675esac
8676
8677$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8678
8679set d_dlsymun
8680eval $setvar
8681
8682hasproto='varname=$1; func=$2; shift; shift;
8683while $test $# -ge 2; do
8684 case "$1" in
8685 $define) echo "#include <$2>";;
8686 esac ;
8687 shift 2;
8688done > try.c;
8689$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8690if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8691 echo "$func() prototype found.";
8692 val="$define";
8693else
8694 echo "$func() prototype NOT found.";
8695 val="$undef";
8696fi;
8697set $varname;
8698eval $setvar;
8699$rm -f try.c tryout.c'
8700
8701: see if prototype for drand48 is available
8702echo " "
8703set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8704eval $hasproto
8705
8706: see if dup2 exists
8707set dup2 d_dup2
8708eval $inlibc
8709
8710: see if eaccess exists
8711set eaccess d_eaccess
8712eval $inlibc
8713
8714: see if endgrent exists
8715set endgrent d_endgrent
8716eval $inlibc
8717
8718: see if endhostent exists
8719set endhostent d_endhent
8720eval $inlibc
8721
8722: see if endnetent exists
8723set endnetent d_endnent
8724eval $inlibc
8725
8726: see if endprotoent exists
8727set endprotoent d_endpent
8728eval $inlibc
8729
8730: see if endpwent exists
8731set endpwent d_endpwent
8732eval $inlibc
8733
8734: see if endservent exists
8735set endservent d_endsent
8736eval $inlibc
8737
8738: Locate the flags for 'open()'
8739echo " "
8740$cat >open3.c <<'EOCP'
8741#include <sys/types.h>
8742#ifdef I_FCNTL
8743#include <fcntl.h>
8744#endif
8745#ifdef I_SYS_FILE
8746#include <sys/file.h>
8747#endif
8748int main() {
8749 if(O_RDONLY);
8750#ifdef O_TRUNC
8751 exit(0);
8752#else
8753 exit(1);
8754#endif
8755}
8756EOCP
8757: check sys/file.h first to get FREAD on Sun
8758if $test `./findhdr sys/file.h` && \
8759 set open3 -DI_SYS_FILE && eval $compile; then
8760 h_sysfile=true;
8761 echo "<sys/file.h> defines the O_* constants..." >&4
8762 if ./open3; then
8763 echo "and you have the 3 argument form of open()." >&4
8764 val="$define"
8765 else
8766 echo "but not the 3 argument form of open(). Oh, well." >&4
8767 val="$undef"
8768 fi
8769elif $test `./findhdr fcntl.h` && \
8770 set open3 -DI_FCNTL && eval $compile; then
8771 h_fcntl=true;
8772 echo "<fcntl.h> defines the O_* constants..." >&4
8773 if ./open3; then
8774 echo "and you have the 3 argument form of open()." >&4
8775 val="$define"
8776 else
8777 echo "but not the 3 argument form of open(). Oh, well." >&4
8778 val="$undef"
8779 fi
8780else
8781 val="$undef"
8782 echo "I can't find the O_* constant definitions! You got problems." >&4
8783fi
8784set d_open3
8785eval $setvar
8786$rm -f open3*
8787
8788: see which of string.h or strings.h is needed
8789echo " "
8790strings=`./findhdr string.h`
8791if $test "$strings" && $test -r "$strings"; then
8792 echo "Using <string.h> instead of <strings.h>." >&4
8793 val="$define"
8794else
8795 val="$undef"
8796 strings=`./findhdr strings.h`
8797 if $test "$strings" && $test -r "$strings"; then
8798 echo "Using <strings.h> instead of <string.h>." >&4
8799 else
8800 echo "No string header found -- You'll surely have problems." >&4
8801 fi
8802fi
8803set i_string
8804eval $setvar
8805case "$i_string" in
8806"$undef") strings=`./findhdr strings.h`;;
8807*) strings=`./findhdr string.h`;;
8808esac
8809
8810: check for non-blocking I/O stuff
8811case "$h_sysfile" in
86498e88
JH
8812true) echo "#include <sys/file.h>" > head.c;;
8813esac
8814case "$h_fcntl" in
8815true) echo "#include <fcntl.h>" >> head.c;;
8816*) echo "#include <sys/fcntl.h>" >> head.c;;
b4eb6b3d
JH
8817esac
8818echo " "
8819echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8820case "$o_nonblock" in
8821'')
8822 $cat head.c > try.c
8823 $cat >>try.c <<'EOCP'
8824#include <stdio.h>
8825int main() {
8826#ifdef O_NONBLOCK
8827 printf("O_NONBLOCK\n");
8828 exit(0);
8829#endif
8830#ifdef O_NDELAY
8831 printf("O_NDELAY\n");
8832 exit(0);
8833#endif
8834#ifdef FNDELAY
8835 printf("FNDELAY\n");
8836 exit(0);
8837#endif
8838 exit(0);
8839}
8840EOCP
8841 set try
8842 if eval $compile_ok; then
8843 o_nonblock=`./try`
8844 case "$o_nonblock" in
8845 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8846 *) echo "Seems like we can use $o_nonblock.";;
8847 esac
8848 else
8849 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8850 fi
8851 ;;
8852*) echo "Using $hint value $o_nonblock.";;
8853esac
8854$rm -f try try.* .out core
8855
8856echo " "
8857echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8858case "$eagain" in
8859'')
8860 $cat head.c > try.c
8861 $cat >>try.c <<EOCP
8862#include <errno.h>
8863#include <sys/types.h>
8864#include <signal.h>
8865#include <stdio.h>
8866#define MY_O_NONBLOCK $o_nonblock
8867#ifndef errno /* XXX need better Configure test */
8868extern int errno;
8869#endif
8870#$i_unistd I_UNISTD
8871#ifdef I_UNISTD
8872#include <unistd.h>
8873#endif
8874#$i_string I_STRING
8875#ifdef I_STRING
8876#include <string.h>
8877#else
8878#include <strings.h>
8879#endif
8880$signal_t blech(x) int x; { exit(3); }
8881EOCP
8882 $cat >> try.c <<'EOCP'
8883int main()
8884{
8885 int pd[2];
8886 int pu[2];
8887 char buf[1];
8888 char string[100];
8889
8890 pipe(pd); /* Down: child -> parent */
8891 pipe(pu); /* Up: parent -> child */
8892 if (0 != fork()) {
8893 int ret;
8894 close(pd[1]); /* Parent reads from pd[0] */
8895 close(pu[0]); /* Parent writes (blocking) to pu[1] */
8896 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8897 exit(1);
8898 signal(SIGALRM, blech);
8899 alarm(5);
8900 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
8901 exit(2);
8902 sprintf(string, "%d\n", ret);
8903 write(2, string, strlen(string));
8904 alarm(0);
8905#ifdef EAGAIN
8906 if (errno == EAGAIN) {
8907 printf("EAGAIN\n");
8908 goto ok;
8909 }
8910#endif
8911#ifdef EWOULDBLOCK
8912 if (errno == EWOULDBLOCK)
8913 printf("EWOULDBLOCK\n");
8914#endif
8915 ok:
8916 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
8917 sleep(2); /* Give it time to close our pipe */
8918 alarm(5);
8919 ret = read(pd[0], buf, 1); /* Should read EOF */
8920 alarm(0);
8921 sprintf(string, "%d\n", ret);
8922 write(3, string, strlen(string));
8923 exit(0);
8924 }
8925
8926 close(pd[0]); /* We write to pd[1] */
8927 close(pu[1]); /* We read from pu[0] */
8928 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
8929 close(pd[1]); /* Pipe pd is now fully closed! */
8930 exit(0); /* Bye bye, thank you for playing! */
8931}
8932EOCP
8933 set try
8934 if eval $compile_ok; then
8935 echo "$startsh" >mtry
8936 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8937 chmod +x mtry
8938 ./mtry >/dev/null 2>&1
8939 case $? in
8940 0) eagain=`$cat try.out`;;
8941 1) echo "Could not perform non-blocking setting!";;
8942 2) echo "I did a successful read() for something that was not there!";;
8943 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8944 *) echo "Something terribly wrong happened during testing.";;
8945 esac
8946 rd_nodata=`$cat try.ret`
8947 echo "A read() system call with no data present returns $rd_nodata."
8948 case "$rd_nodata" in
8949 0|-1) ;;
8950 *)
8951 echo "(That's peculiar, fixing that to be -1.)"
8952 rd_nodata=-1
8953 ;;
8954 esac
8955 case "$eagain" in
8956 '')
8957 echo "Forcing errno EAGAIN on read() with no data available."
8958 eagain=EAGAIN
8959 ;;
8960 *)
8961 echo "Your read() sets errno to $eagain when no data is available."
8962 ;;
8963 esac
8964 status=`$cat try.err`
8965 case "$status" in
8966 0) echo "And it correctly returns 0 to signal EOF.";;
8967 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8968 *) echo "However, your read() returns '$status' on EOF??";;
8969 esac
8970 val="$define"
8971 if test "$status" = "$rd_nodata"; then
8972 echo "WARNING: you can't distinguish between EOF and no data!"
8973 val="$undef"
8974 fi
8975 else
8976 echo "I can't compile the test program--assuming errno EAGAIN will do."
8977 eagain=EAGAIN
8978 fi
8979 set d_eofnblk
8980 eval $setvar
8981 ;;
8982*)
8983 echo "Using $hint value $eagain."
8984 echo "Your read() returns $rd_nodata when no data is present."
8985 case "$d_eofnblk" in
8986 "$define") echo "And you can see EOF because read() returns 0.";;
8987 "$undef") echo "But you can't see EOF status from read() returned value.";;
8988 *)
8989 echo "(Assuming you can't see EOF status from read anyway.)"
8990 d_eofnblk=$undef
8991 ;;
8992 esac
8993 ;;
8994esac
8995$rm -f try try.* .out core head.c mtry
8996
8997: see if fchmod exists
8998set fchmod d_fchmod
8999eval $inlibc
9000
9001: see if fchown exists
9002set fchown d_fchown
9003eval $inlibc
9004
9005: see if this is an fcntl system
9006set fcntl d_fcntl
9007eval $inlibc
9008
9d9004a9
AD
9009echo " "
9010: See if fcntl-based locking works.
9011$cat >try.c <<'EOCP'
9012#include <stdlib.h>
9013#include <unistd.h>
9014#include <fcntl.h>
9015int main() {
9016#if defined(F_SETLK) && defined(F_SETLKW)
9017 struct flock flock;
9018 int retval, fd;
9019 fd = open("try.c", O_RDONLY);
9020 flock.l_type = F_RDLCK;
9021 flock.l_whence = SEEK_SET;
9022 flock.l_start = flock.l_len = 0;
9023 retval = fcntl(fd, F_SETLK, &flock);
9024 close(fd);
9025 (retval < 0 ? exit(2) : exit(0));
9026#else
9027 exit(2);
9028#endif
9029}
9030EOCP
9031echo "Checking if fcntl-based file locking works... "
9032case "$d_fcntl" in
9033"$define")
9034 set try
9035 if eval $compile_ok; then
9036 if ./try; then
9037 echo "Yes, it seems to work."
9038 val="$define"
9039 else
9040 echo "Nope, it didn't work."
9041 val="$undef"
9042 fi
9043 else
9044 echo "I'm unable to compile the test program, so I'll assume not."
9045 val="$undef"
9046 fi
9047 ;;
9048*) val="$undef";
9049 echo "Nope, since you don't even have fcntl()."
9050 ;;
9051esac
9052set d_fcntl_can_lock
9053eval $setvar
9054$rm -f try*
9055
9056
b4eb6b3d
JH
9057hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9058while $test $# -ge 2; do
9059 case "$1" in
9060 $define) echo "#include <$2>";;
9061 esac ;
9062 shift 2;
9063done > try.c;
9064echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9065set try;
9066if eval $compile; then
9067 val="$define";
9068else
9069 val="$undef";
9070fi;
9071set $varname;
9072eval $setvar;
9073$rm -f try.c try.o'
9074
9075socketlib=''
9076sockethdr=''
9077: see whether socket exists
9078echo " "
9079$echo $n "Hmm... $c" >&4
9080if set socket val -f d_socket; eval $csym; $val; then
9081 echo "Looks like you have Berkeley networking support." >&4
9082 d_socket="$define"
9083 if set setsockopt val -f; eval $csym; $val; then
9084 d_oldsock="$undef"
9085 else
9086 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9087 d_oldsock="$define"
9088 fi
9089else
9090 if $contains socklib libc.list >/dev/null 2>&1; then
9091 echo "Looks like you have Berkeley networking support." >&4
9092 d_socket="$define"
9093 : we will have to assume that it supports the 4.2 BSD interface
9094 d_oldsock="$undef"
9095 else
9096 echo "You don't have Berkeley networking in libc$_a..." >&4
9097 if test "X$d_socket" = "X$define"; then
9098 echo "...but you seem to believe that you have sockets." >&4
9099 else
9100 for net in net socket
9101 do
9102 if test -f /usr/lib/lib$net$_a; then
9103 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
9104 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9105 if $contains socket libc.list >/dev/null 2>&1; then
9106 d_socket="$define"
9107 socketlib="-l$net"
9108 case "$net" in
9109 net)
9110 echo "...but the Wollongong group seems to have hacked it in." >&4
9111 sockethdr="-I/usr/netinclude"
9112 ;;
9113 esac
9114 echo "Found Berkeley sockets interface in lib$net." >& 4
9115 if $contains setsockopt libc.list >/dev/null 2>&1; then
9116 d_oldsock="$undef"
9117 else
9118 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9119 d_oldsock="$define"
9120 fi
9121 break
9122 fi
9123 fi
9124 done
9125 if test "X$d_socket" != "X$define"; then
9126 echo "or anywhere else I see." >&4
9127 d_socket="$undef"
9128 d_oldsock="$undef"
9129 fi
9130 fi
9131 fi
9132fi
9133
9134: see if socketpair exists
9135set socketpair d_sockpair
9136eval $inlibc
9137
9138
9139echo " "
9140echo "Checking the availability of certain socket constants..." >& 4
9141for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9142 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9143 $cat >try.c <<EOF
9144#include <sys/types.h>
9145#include <sys/socket.h>
9146int main() {
9147 int i = $ENUM;
9148}
9149EOF
9150 val="$undef"
9151 set try; if eval $compile; then
9152 val="$define"
9153 fi
9154 set d_${enum}; eval $setvar
9155 $rm -f try.c try
9156done
9157
9158: see if sys/select.h has to be included
9159set sys/select.h i_sysselct
9160eval $inhdr
9161
9162: see if we should include time.h, sys/time.h, or both
9163echo " "
9164if test "X$timeincl" = X; then
9165 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9166 $echo $n "I'm now running the test program...$c"
9167 $cat >try.c <<'EOCP'
9168#include <sys/types.h>
9169#ifdef I_TIME
9170#include <time.h>
9171#endif
9172#ifdef I_SYSTIME
9173#ifdef SYSTIMEKERNEL
9174#define KERNEL
9175#endif
9176#include <sys/time.h>
9177#endif
9178#ifdef I_SYSSELECT
9179#include <sys/select.h>
9180#endif
9181int main()
9182{
9183 struct tm foo;
9184#ifdef S_TIMEVAL
9185 struct timeval bar;
9186#endif
9187#ifdef S_TIMEZONE
9188 struct timezone tzp;
9189#endif
9190 if (foo.tm_sec == foo.tm_sec)
9191 exit(0);
9192#ifdef S_TIMEVAL
9193 if (bar.tv_sec == bar.tv_sec)
9194 exit(0);
9195#endif
9196 exit(1);
9197}
9198EOCP
9199 flags=''
9200 for s_timezone in '-DS_TIMEZONE' ''; do
9201 sysselect=''
9202 for s_timeval in '-DS_TIMEVAL' ''; do
9203 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9204 for i_time in '' '-DI_TIME'; do
9205 for i_systime in '-DI_SYSTIME' ''; do
9206 case "$flags" in
9207 '') $echo $n ".$c"
9208 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9209 if eval $compile; then
9210 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9211 shift
9212 flags="$*"
9213 echo " "
9214 $echo $n "Succeeded with $flags$c"
9215 fi
9216 ;;
9217 esac
9218 done
9219 done
9220 done
9221 done
9222 done
9223 timeincl=''
9224 echo " "
9225 case "$flags" in
9226 *SYSTIMEKERNEL*) i_systimek="$define"
9227 timeincl=`./findhdr sys/time.h`
9228 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9229 *) i_systimek="$undef";;
9230 esac
9231 case "$flags" in
9232 *I_TIME*) i_time="$define"
9233 timeincl=`./findhdr time.h`" $timeincl"
9234 echo "We'll include <time.h>." >&4;;
9235 *) i_time="$undef";;
9236 esac
9237 case "$flags" in
9238 *I_SYSTIME*) i_systime="$define"
9239 timeincl=`./findhdr sys/time.h`" $timeincl"
9240 echo "We'll include <sys/time.h>." >&4;;
9241 *) i_systime="$undef";;
9242 esac
9243 $rm -f try.c try
9244fi
9245
9246: check for fd_set items
9247$cat <<EOM
9248
9249Checking to see how well your C compiler handles fd_set and friends ...
9250EOM
9251$cat >fd_set.c <<EOCP
9252#$i_systime I_SYS_TIME
9253#$i_sysselct I_SYS_SELECT
9254#$d_socket HAS_SOCKET
9255#include <sys/types.h>
9256#ifdef HAS_SOCKET
9257#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9258#endif
9259#ifdef I_SYS_TIME
9260#include <sys/time.h>
9261#endif
9262#ifdef I_SYS_SELECT
9263#include <sys/select.h>
9264#endif
9265int main() {
9266 fd_set fds;
9267
9268#ifdef TRYBITS
9269 if(fds.fds_bits);
9270#endif
9271
9272#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9273 exit(0);
9274#else
9275 exit(1);
9276#endif
9277}
9278EOCP
9279set fd_set -DTRYBITS
9280if eval $compile; then
9281 d_fds_bits="$define"
9282 d_fd_set="$define"
9283 echo "Well, your system knows about the normal fd_set typedef..." >&4
9284 if ./fd_set; then
9285 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9286 d_fd_macros="$define"
9287 else
9288 $cat >&4 <<'EOM'
9289but not the normal fd_set macros! Gaaack! I'll have to cover for you.
9290EOM
9291 d_fd_macros="$undef"
9292 fi
9293else
9294 $cat <<'EOM'
9295Hmm, your compiler has some difficulty with fd_set. Checking further...
9296EOM
9297 set fd_set
9298 if eval $compile; then
9299 d_fds_bits="$undef"
9300 d_fd_set="$define"
9301 echo "Well, your system has some sort of fd_set available..." >&4
9302 if ./fd_set; then
9303 echo "and you have the normal fd_set macros." >&4
9304 d_fd_macros="$define"
9305 else
9306 $cat <<'EOM'
9307but not the normal fd_set macros! Gross! More work for me...
9308EOM
9309 d_fd_macros="$undef"
9310 fi
9311 else
9312 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
9313 d_fd_set="$undef"
9314 d_fds_bits="$undef"
9315 d_fd_macros="$undef"
9316 fi
9317fi
9318$rm -f fd_set*
9319
9320: see if fgetpos exists
9321set fgetpos d_fgetpos
9322eval $inlibc
9323
9324: see if flock exists
9325set flock d_flock
9326eval $inlibc
9327
9328: see if fork exists
9329set fork d_fork
9330eval $inlibc
9331
9332: see if pathconf exists
9333set pathconf d_pathconf
9334eval $inlibc
9335
9336: see if fpathconf exists
9337set fpathconf d_fpathconf
9338eval $inlibc
9339
9340
9341: check for fpos64_t
9342echo " "
9343echo "Checking to see if you have fpos64_t..." >&4
9344$cat >try.c <<EOCP
9345#include <stdio.h>
9346int main() { fpos64_t x = 7; }
9347EOCP
9348set try
9349if eval $compile; then
9350 val="$define"
9351 echo "You have fpos64_t."
9352else
9353 val="$undef"
9354 echo "You do not have fpos64_t."
9355 case "$fpossize" in
9356 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9357 esac
9358fi
9359$rm -f try.* try
9360set d_fpos64_t
9361eval $setvar
9362
9363: see if frexpl exists
9364set frexpl d_frexpl
9365eval $inlibc
9366
9367hasstruct='varname=$1; struct=$2; shift; shift;
9368while $test $# -ge 2; do
9369 case "$1" in
9370 $define) echo "#include <$2>";;
9371 esac ;
9372 shift 2;
9373done > try.c;
9374echo "int main () { struct $struct foo; }" >> try.c;
9375set try;
9376if eval $compile; then
9377 val="$define";
9378else
9379 val="$undef";
9380fi;
9381set $varname;
9382eval $setvar;
9383$rm -f try.c try.o'
9384
9385: see if this is a sys/param system
9386set sys/param.h i_sysparam
9387eval $inhdr
9388
9389: see if this is a sys/mount.h system
9390set sys/mount.h i_sysmount
9391eval $inhdr
9392
9393: see if sys/types.h has to be included
9394set sys/types.h i_systypes
9395eval $inhdr
9396
9397
9398echo " "
9399echo "Checking to see if your system supports struct fs_data..." >&4
9400set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9401eval $hasstruct
9402case "$d_fs_data_s" in
9403"$define") echo "Yes, it does." ;;
9404*) echo "No, it doesn't." ;;
9405esac
9406
9407: see if fseeko exists
9408set fseeko d_fseeko
9409eval $inlibc
9410case "$longsize" in
94118) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9412esac
9413
9414: see if fsetpos exists
9415set fsetpos d_fsetpos
9416eval $inlibc
9417
9418
9419: see if fstatfs exists
9420set fstatfs d_fstatfs
9421eval $inlibc
9422
9423
9424: see if statvfs exists
9425set statvfs d_statvfs
9426eval $inlibc
9427
9428: see if fstatvfs exists
9429set fstatvfs d_fstatvfs
9430eval $inlibc
9431
9432
411ab01c
JH
9433: see if fsync exists
9434set fsync d_fsync
9435eval $inlibc
9436
b4eb6b3d
JH
9437: see if ftello exists
9438set ftello d_ftello
9439eval $inlibc
9440case "$longsize" in
94418) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9442esac
9443
9444: see if getcwd exists
9445set getcwd d_getcwd
9446eval $inlibc
9447
9448: see if getespwnam exists
9449set getespwnam d_getespwnam
9450eval $inlibc
9451
9452
9453: see if getfsstat exists
9454set getfsstat d_getfsstat
9455eval $inlibc
9456
9457: see if getgrent exists
9458set getgrent d_getgrent
9459eval $inlibc
9460
9461: see if gethostbyaddr exists
9462set gethostbyaddr d_gethbyaddr
9463eval $inlibc
9464
9465: see if gethostbyname exists
9466set gethostbyname d_gethbyname
9467eval $inlibc
9468
9469: see if gethostent exists
9470set gethostent d_gethent
9471eval $inlibc
9472
9473: see how we will look up host name
9474echo " "
9475call=''
9476if set gethostname val -f d_gethname; eval $csym; $val; then
9477 echo 'gethostname() found.' >&4
9478 d_gethname="$define"
9479 call=gethostname
9480fi
9481if set uname val -f d_uname; eval $csym; $val; then
9482 if ./xenix; then
9483 $cat <<'EOM'
9484uname() was found, but you're running xenix, and older versions of xenix
9485have a broken uname(). If you don't really know whether your xenix is old
9486enough to have a broken system call, use the default answer.
9487
9488EOM
9489 dflt=y
9490 case "$d_uname" in
9491 "$define") dflt=n;;
9492 esac
9493 rp='Is your uname() broken?'
9494 . ./myread
9495 case "$ans" in
9496 n*) d_uname="$define"; call=uname;;
9497 esac
9498 else
9499 echo 'uname() found.' >&4
9500 d_uname="$define"
9501 case "$call" in
9502 '') call=uname ;;
9503 esac
9504 fi
9505fi
9506case "$d_gethname" in
9507'') d_gethname="$undef";;
9508esac
9509case "$d_uname" in
9510'') d_uname="$undef";;
9511esac
9512case "$d_uname$d_gethname" in
9513*define*)
9514 dflt=n
9515 cat <<EOM
9516
9517Every now and then someone has a $call() that lies about the hostname
9518but can't be fixed for political or economic reasons. If you wish, I can
9519pretend $call() isn't there and maybe compute hostname at run-time
9520thanks to the '$phostname' command.
9521
9522EOM
9523 rp="Shall I ignore $call() from now on?"
9524 . ./myread
9525 case "$ans" in
9526 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9527 esac;;
9528esac
9529case "$phostname" in
9530'') aphostname='';;
9531*) case "$aphostname" in
9532 /*) ;;
9533 *) set X $phostname
9534 shift
9535 file=$1
9536 shift
9537 file=`./loc $file $file $pth`
9538 aphostname=`echo $file $*`
9539 ;;
9540 esac
9541 ;;
9542esac
9543case "$d_uname$d_gethname" in
9544*define*) ;;
9545*)
9546 case "$phostname" in
9547 '')
9548 echo "There will be no way for $package to get your hostname." >&4;;
9549 *)
9550 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9551 ;;
9552 esac;;
9553esac
9554case "$d_phostname" in
9555'') d_phostname="$undef";;
9556esac
9557
9558: see if this is a netdb.h system
9559set netdb.h i_netdb
9560eval $inhdr
9561
9562: see if prototypes for various gethostxxx netdb.h functions are available
9563echo " "
9564set d_gethostprotos gethostent $i_netdb netdb.h
9565eval $hasproto
9566
9567: see if getlogin exists
9568set getlogin d_getlogin
9569eval $inlibc
9570
9571: see if getmnt exists
9572set getmnt d_getmnt
9573eval $inlibc
9574
9575: see if getmntent exists
9576set getmntent d_getmntent
9577eval $inlibc
9578
9579: see if getnetbyaddr exists
9580set getnetbyaddr d_getnbyaddr
9581eval $inlibc
9582
9583: see if getnetbyname exists
9584set getnetbyname d_getnbyname
9585eval $inlibc
9586
9587: see if getnetent exists
9588set getnetent d_getnent
9589eval $inlibc
9590
9591: see if prototypes for various getnetxxx netdb.h functions are available
9592echo " "
9593set d_getnetprotos getnetent $i_netdb netdb.h
9594eval $hasproto
9595
0c0643d0
JH
9596: see if getpagesize exists
9597set getpagesize d_getpagsz
9598eval $inlibc
9599
b4eb6b3d
JH
9600
9601: see if getprotobyname exists
9602set getprotobyname d_getpbyname
9603eval $inlibc
9604
9605: see if getprotobynumber exists
9606set getprotobynumber d_getpbynumber
9607eval $inlibc
9608
9609: see if getprotoent exists
9610set getprotoent d_getpent
9611eval $inlibc
9612
9613: see if getpgid exists
9614set getpgid d_getpgid
9615eval $inlibc
9616
9617: see if getpgrp2 exists
9618set getpgrp2 d_getpgrp2
9619eval $inlibc
9620
9621: see if getppid exists
9622set getppid d_getppid
9623eval $inlibc
9624
9625: see if getpriority exists
9626set getpriority d_getprior
9627eval $inlibc
9628
9629: see if prototypes for various getprotoxxx netdb.h functions are available
9630echo " "
9631set d_getprotoprotos getprotoent $i_netdb netdb.h
9632eval $hasproto
9633
9634: see if getprpwnam exists
9635set getprpwnam d_getprpwnam
9636eval $inlibc
9637
9638: see if getpwent exists
9639set getpwent d_getpwent
9640eval $inlibc
9641
9642
9643: see if getservbyname exists
9644set getservbyname d_getsbyname
9645eval $inlibc
9646
9647: see if getservbyport exists
9648set getservbyport d_getsbyport
9649eval $inlibc
9650
9651: see if getservent exists
9652set getservent d_getsent
9653eval $inlibc
9654
9655: see if prototypes for various getservxxx netdb.h functions are available
9656echo " "
9657set d_getservprotos getservent $i_netdb netdb.h
9658eval $hasproto
9659
9660: see if getspnam exists
9661set getspnam d_getspnam
9662eval $inlibc
9663
9664: see if gettimeofday or ftime exists
9665set gettimeofday d_gettimeod
9666eval $inlibc
9667case "$d_gettimeod" in
9668"$undef")
9669 set ftime d_ftime
9670 eval $inlibc
9671 ;;
9672*)
9673 val="$undef"; set d_ftime; eval $setvar
9674 ;;
9675esac
9676case "$d_gettimeod$d_ftime" in
9677"$undef$undef")
9678 echo " "
9679 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9680 ;;
9681esac
9682
9683: see if this is an grp system
9684set grp.h i_grp
9685eval $inhdr
9686
9687case "$i_grp" in
9688$define)
9689 xxx=`./findhdr grp.h`
9690 $cppstdin $cppflags $cppminus < $xxx >$$.h
9691
9692 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9693 val="$define"
9694 else
9695 val="$undef"
9696 fi
9697 set d_grpasswd
9698 eval $setvar
9699
9700 $rm -f $$.h
9701 ;;
9702*)
9703 val="$undef";
9704 set d_grpasswd; eval $setvar
9705 ;;
9706esac
9707
9708: see if hasmntopt exists
9709set hasmntopt d_hasmntopt
9710eval $inlibc
9711
9712: see if this is a netinet/in.h or sys/in.h system
9713set netinet/in.h i_niin sys/in.h i_sysin
9714eval $inhdr
9715
9716: see if arpa/inet.h has to be included
9717set arpa/inet.h i_arpainet
9718eval $inhdr
9719
9720: see if htonl --and friends-- exists
9721val=''
9722set htonl val
9723eval $inlibc
9724
9725: Maybe they are macros.
9726case "$val" in
9727$undef)
9728 $cat >htonl.c <<EOM
9729#include <stdio.h>
9730#include <sys/types.h>
9731#$i_niin I_NETINET_IN
9732#$i_sysin I_SYS_IN
9733#$i_arpainet I_ARPA_INET
9734#ifdef I_NETINET_IN
9735#include <netinet/in.h>
9736#endif
9737#ifdef I_SYS_IN
9738#include <sys/in.h>
9739#endif
9740#ifdef I_ARPA_INET
9741#include <arpa/inet.h>
9742#endif
9743#ifdef htonl
9744printf("Defined as a macro.");
9745#endif
9746EOM
9747 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9748 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9749 val="$define"
9750 echo "But it seems to be defined as a macro." >&4
9751 fi
9752 $rm -f htonl.?
9753 ;;
9754esac
9755set d_htonl
9756eval $setvar
9757
9758: see if iconv exists
9759set iconv d_iconv
9760eval $inlibc
9761
9762: index or strchr
9763echo " "
9764if set index val -f; eval $csym; $val; then
9765 if set strchr val -f d_strchr; eval $csym; $val; then
9766 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9767 val="$define"
9768 vali="$undef"
9769 echo "strchr() found." >&4
9770 else
9771 val="$undef"
9772 vali="$define"
9773 echo "index() found." >&4
9774 fi
9775 else
9776 val="$undef"
9777 vali="$define"
9778 echo "index() found." >&4
9779 fi
9780else
9781 if set strchr val -f d_strchr; eval $csym; $val; then
9782 val="$define"
9783 vali="$undef"
9784 echo "strchr() found." >&4
9785 else
9786 echo "No index() or strchr() found!" >&4
9787 val="$undef"
9788 vali="$undef"
9789 fi
9790fi
9791set d_strchr; eval $setvar
9792val="$vali"
9793set d_index; eval $setvar
9794
9795: check whether inet_aton exists
9796set inet_aton d_inetaton
9797eval $inlibc
9798
9799: see if inttypes.h is available
9800: we want a real compile instead of Inhdr because some systems
9801: have an inttypes.h which includes non-existent headers
9802echo " "
9803$cat >try.c <<EOCP
9804#include <inttypes.h>
9805int main() {
9806 static int32_t foo32 = 0x12345678;
9807}
9808EOCP
9809set try
9810if eval $compile; then
9811 echo "<inttypes.h> found." >&4
9812 val="$define"
9813else
9814 echo "<inttypes.h> NOT found." >&4
9815 val="$undef"
9816fi
9817$rm -f try.c try
9818set i_inttypes
9819eval $setvar
9820
9821: check for int64_t
9822echo " "
9823echo "Checking to see if you have int64_t..." >&4
9824$cat >try.c <<EOCP
9825#include <sys/types.h>
9826#$i_inttypes I_INTTYPES
9827#ifdef I_INTTYPES
9828#include <inttypes.h>
9829#endif
9830int main() { int64_t x = 7; }
9831EOCP
9832set try
9833if eval $compile; then
9834 val="$define"
9835 echo "You have int64_t."
9836else
9837 val="$undef"
9838 echo "You do not have int64_t."
9839fi
9840$rm -f try try.*
9841set d_int64_t
9842eval $setvar
9843
9844: Look for isascii
9845echo " "
9846$cat >isascii.c <<'EOCP'
9847#include <stdio.h>
9848#include <ctype.h>
9849int main() {
9850 int c = 'A';
9851 if (isascii(c))
9852 exit(0);
9853 else
9854 exit(1);
9855}
9856EOCP
9857set isascii
9858if eval $compile; then
9859 echo "isascii() found." >&4
9860 val="$define"
9861else
9862 echo "isascii() NOT found." >&4
9863 val="$undef"
9864fi
9865set d_isascii
9866eval $setvar
9867$rm -f isascii*
9868
9869: see if isnan exists
9870set isnan d_isnan
9871eval $inlibc
9872
9873: see if isnanl exists
9874set isnanl d_isnanl
9875eval $inlibc
9876
9877: see if killpg exists
9878set killpg d_killpg
9879eval $inlibc
9880
9881: see if lchown exists
9882echo " "
9883$cat > try.c <<'EOCP'
9884/* System header to define __stub macros and hopefully few prototypes,
9885 which can conflict with char lchown(); below. */
9886#include <assert.h>
9887/* Override any gcc2 internal prototype to avoid an error. */
9888/* We use char because int might match the return type of a gcc2
9889 builtin and then its argument prototype would still apply. */
9890char lchown();
9891int main() {
9892 /* The GNU C library defines this for functions which it implements
9893 to always fail with ENOSYS. Some functions are actually named
9894 something starting with __ and the normal name is an alias. */
9895#if defined (__stub_lchown) || defined (__stub___lchown)
9896choke me
9897#else
9898lchown();
9899#endif
9900; return 0; }
9901EOCP
9902set try
9903if eval $compile; then
9904 $echo "lchown() found." >&4
9905 val="$define"
9906else
9907 $echo "lchown() NOT found." >&4
9908 val="$undef"
9909fi
9910set d_lchown
9911eval $setvar
9912
9913: See if number of significant digits in a double precision number is known
9914echo " "
9915$cat >ldbl_dig.c <<EOM
9916#$i_limits I_LIMITS
9917#$i_float I_FLOAT
9918#ifdef I_LIMITS
9919#include <limits.h>
9920#endif
9921#ifdef I_FLOAT
9922#include <float.h>
9923#endif
9924#ifdef LDBL_DIG
9925printf("Contains LDBL_DIG");
9926#endif
9927EOM
9928$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9929if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9930 echo "LDBL_DIG found." >&4
9931 val="$define"
9932else
9933 echo "LDBL_DIG NOT found." >&4
9934 val="$undef"
9935fi
9936$rm -f ldbl_dig.?
9937set d_ldbl_dig
9938eval $setvar
9939
9940: see if link exists
9941set link d_link
9942eval $inlibc
9943
9944: see if localeconv exists
9945set localeconv d_locconv
9946eval $inlibc
9947
9948: see if lockf exists
9949set lockf d_lockf
9950eval $inlibc
9951
9952: check for long long
9953echo " "
9954echo "Checking to see if you have long long..." >&4
9955echo 'int main() { long long x = 7; return 0; }' > try.c
9956set try
9957if eval $compile; then
9958 val="$define"
9959 echo "You have long long."
9960else
9961 val="$undef"
9962 echo "You do not have long long."
9963fi
9964$rm try.*
9965set d_longlong
9966eval $setvar
9967
9968: check for length of long long
9969case "${d_longlong}${longlongsize}" in
9970$define)
9971 echo " "
9972 echo "Checking to see how big your long longs are..." >&4
9973 $cat >try.c <<'EOCP'
9974#include <stdio.h>
9975int main()
9976{
9977 printf("%d\n", (int)sizeof(long long));
9978 return(0);
9979}
9980EOCP
9981 set try
9982 if eval $compile_ok; then
9983 longlongsize=`./try$exe_ext`
9984 echo "Your long longs are $longlongsize bytes long."
9985 else
9986 dflt='8'
9987 echo " "
9988 echo "(I can't seem to compile the test program. Guessing...)"
9989 rp="What is the size of a long long (in bytes)?"
9990 . ./myread
9991 longlongsize="$ans"
9992 fi
9993 if $test "X$longsize" = "X$longlongsize"; then
9994 echo "(That isn't any different from an ordinary long.)"
9995 fi
9996 ;;
9997esac
9998$rm -f try.* try
9999
10000: see if prototype for lseek is available
10001echo " "
10002set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10003eval $hasproto
10004
10005: see if lstat exists
10006set lstat d_lstat
10007eval $inlibc
10008
10009: see if madvise exists
10010set madvise d_madvise
10011eval $inlibc
10012
10013: see if mblen exists
10014set mblen d_mblen
10015eval $inlibc
10016
10017: see if mbstowcs exists
10018set mbstowcs d_mbstowcs
10019eval $inlibc
10020
10021: see if mbtowc exists
10022set mbtowc d_mbtowc
10023eval $inlibc
10024
10025: see if memchr exists
10026set memchr d_memchr
10027eval $inlibc
10028
10029: see if memcmp exists
10030set memcmp d_memcmp
10031eval $inlibc
10032
10033: see if memcpy exists
10034set memcpy d_memcpy
10035eval $inlibc
10036
10037: see if memmove exists
10038set memmove d_memmove
10039eval $inlibc
10040
10041: see if memset exists
10042set memset d_memset
10043eval $inlibc
10044
10045: see if mkdir exists
10046set mkdir d_mkdir
10047eval $inlibc
10048
10049: see if mkdtemp exists
10050set mkdtemp d_mkdtemp
10051eval $inlibc
10052
10053: see if mkfifo exists
10054set mkfifo d_mkfifo
10055eval $inlibc
10056
10057: see if mkstemp exists
10058set mkstemp d_mkstemp
10059eval $inlibc
10060
10061: see if mkstemps exists
10062set mkstemps d_mkstemps
10063eval $inlibc
10064
10065: see if mktime exists
10066set mktime d_mktime
10067eval $inlibc
10068
10069: see if this is a sys/mman.h system
10070set sys/mman.h i_sysmman
10071eval $inhdr
10072
10073: see if mmap exists
10074set mmap d_mmap
10075eval $inlibc
10076: see what shmat returns
10077: default to something harmless
10078mmaptype='void *'
10079case "$i_sysmman$d_mmap" in
10080"$define$define")
10081 $cat >mmap.c <<'END'
10082#include <sys/mman.h>
10083void *mmap();
10084END
10085 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10086 mmaptype='void *'
10087 else
10088 mmaptype='caddr_t'
10089 fi
10090 echo "and it returns ($mmaptype)." >&4
10091 ;;
10092esac
10093
10094
10095
10096: see if modfl exists
10097set modfl d_modfl
10098eval $inlibc
10099
10100: see if mprotect exists
10101set mprotect d_mprotect
10102eval $inlibc
10103
10104: see if msgctl exists
10105set msgctl d_msgctl
10106eval $inlibc
10107
10108: see if msgget exists
10109set msgget d_msgget
10110eval $inlibc
10111
10112: see if msgsnd exists
10113set msgsnd d_msgsnd
10114eval $inlibc
10115
10116: see if msgrcv exists
10117set msgrcv d_msgrcv
10118eval $inlibc
10119
10120: see how much of the 'msg*(2)' library is present.
10121h_msg=true
10122echo " "
10123case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10124*"$undef"*) h_msg=false;;
10125esac
10126case "$osname" in
10127freebsd)
10128 case "`ipcs 2>&1`" in
10129 "SVID messages"*"not configured"*)
10130 echo "Your $osname does not have the msg*(2) configured." >&4
10131 h_msg=false
10132 val="$undef"
10133 set msgctl d_msgctl
10134 eval $setvar
10135 set msgget d_msgget
10136 eval $setvar
10137 set msgsnd d_msgsnd
10138 eval $setvar
10139 set msgrcv d_msgrcv
10140 eval $setvar
10141 ;;
10142 esac
10143 ;;
10144esac
10145: we could also check for sys/ipc.h ...
10146if $h_msg && $test `./findhdr sys/msg.h`; then
10147 echo "You have the full msg*(2) library." >&4
10148 val="$define"
10149else
10150 echo "You don't have the full msg*(2) library." >&4
10151 val="$undef"
10152fi
10153set d_msg
10154eval $setvar
10155
10156: see if msync exists
10157set msync d_msync
10158eval $inlibc
10159
10160: see if munmap exists
10161set munmap d_munmap
10162eval $inlibc
10163
10164: see if nice exists
10165set nice d_nice
10166eval $inlibc
10167
10168
10169echo " "
10170echo "Checking which 64-bit integer type we could use..." >&4
10171
10172case "$intsize" in
101738) val=int
10174 set quadtype
10175 eval $setvar
10176 val='"unsigned int"'
10177 set uquadtype
10178 eval $setvar
10179 quadkind=1
10180 ;;
10181*) case "$longsize" in
10182 8) val=long
10183 set quadtype
10184 eval $setvar
10185 val='"unsigned long"'
10186 set uquadtype
10187 eval $setvar
10188 quadkind=2
10189 ;;
10190 *) case "$d_longlong:$longlongsize" in
10191 define:8)
10192 val='"long long"'
10193 set quadtype
10194 eval $setvar
10195 val='"unsigned long long"'
10196 set uquadtype
10197 eval $setvar
10198 quadkind=3
10199 ;;
10200 *) case "$d_int64_t" in
10201 define)
10202 val=int64_t
10203 set quadtype
10204 eval $setvar
10205 val=uint64_t
10206 set uquadtype
10207 eval $setvar
10208 quadkind=4
10209 ;;
10210 esac
10211 ;;
10212 esac
10213 ;;
10214 esac
10215 ;;
10216esac
10217
10218case "$quadtype" in
10219'') echo "Alas, no 64-bit integer types in sight." >&4
10220 d_quad="$undef"
10221 ;;
10222*) if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10223 verb="will"
10224 else
10225 verb="could"
10226 fi
10227 echo "We $verb use '$quadtype' for 64-bit integers." >&4
10228 d_quad="$define"
10229 ;;
10230esac
10231
10232: check for length of character
10233echo " "
10234case "$charsize" in
10235'')
10236 echo "Checking to see how big your characters are (hey, you never know)..." >&4
10237 $cat >try.c <<'EOCP'
10238#include <stdio.h>
10239int main()
10240{
10241 printf("%d\n", (int)sizeof(char));
10242 exit(0);
10243}
10244EOCP
10245 set try
10246 if eval $compile_ok; then
10247 dflt=`./try`
10248 else
10249 dflt='1'
10250 echo "(I can't seem to compile the test program. Guessing...)"
10251 fi
10252 ;;
10253*)
10254 dflt="$charsize"
10255 ;;
10256esac
10257rp="What is the size of a character (in bytes)?"
10258. ./myread
10259charsize="$ans"
10260$rm -f try.c try
10261
1d1be0dc
NC
10262: check for volatile keyword
10263echo " "
10264echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10265$cat >try.c <<'EOCP'
10266int main()
10267{
10268 typedef struct _goo_struct goo_struct;
10269 goo_struct * volatile goo = ((goo_struct *)0);
10270 struct _goo_struct {
10271 long long_int;
10272 int reg_int;
10273 char char_var;
10274 };
10275 typedef unsigned short foo_t;
10276 char *volatile foo;
10277 volatile int bar;
10278 volatile foo_t blech;
10279 foo = foo;
10280}
10281EOCP
10282if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10283 val="$define"
10284 echo "Yup, it does."
10285else
10286 val="$undef"
10287 echo "Nope, it doesn't."
10288fi
10289set d_volatile
10290eval $setvar
10291$rm -f try.*
10292
b4eb6b3d
JH
10293
10294echo " "
10295$echo "Choosing the C types to be used for Perl's internal types..." >&4
10296
10297case "$use64bitint:$d_quad:$quadtype" in
10298define:define:?*)
10299 ivtype="$quadtype"
10300 uvtype="$uquadtype"
10301 ivsize=8
10302 uvsize=8
10303 ;;
10304*) ivtype="long"
10305 uvtype="unsigned long"
10306 ivsize=$longsize
10307 uvsize=$longsize
10308 ;;
10309esac
10310
10311case "$uselongdouble:$d_longdbl" in
10312define:define)
10313 nvtype="long double"
10314 nvsize=$longdblsize
10315 ;;
10316*) nvtype=double
10317 nvsize=$doublesize
10318 ;;
10319esac
10320
10321$echo "(IV will be "$ivtype", $ivsize bytes)"
10322$echo "(UV will be "$uvtype", $uvsize bytes)"
10323$echo "(NV will be "$nvtype", $nvsize bytes)"
10324
10325$cat >try.c <<EOCP
10326#$i_inttypes I_INTTYPES
10327#ifdef I_INTTYPES
10328#include <inttypes.h>
10329#endif
10330#include <stdio.h>
10331int main() {
10332#ifdef INT8
10333 int8_t i = INT8_MAX;
10334 uint8_t u = UINT8_MAX;
10335 printf("int8_t\n");
10336#endif
10337#ifdef INT16
10338 int16_t i = INT16_MAX;
10339 uint16_t i = UINT16_MAX;
10340 printf("int16_t\n");
10341#endif
10342#ifdef INT32
10343 int32_t i = INT32_MAX;
10344 uint32_t u = UINT32_MAX;
10345 printf("int32_t\n");
10346#endif
10347}
10348EOCP
10349
10350case "$i8type" in
10351'') case "$charsize" in
10352 1) i8type=char
10353 u8type="unsigned char"
10354 i8size=$charsize
10355 u8size=$charsize
10356 ;;
10357 esac
10358 ;;
10359esac
10360case "$i8type" in
10361'') set try -DINT8
10362 if eval $compile; then
10363 case "`./try$exe_ext`" in
10364 int8_t) i8type=int8_t
10365 u8type=uint8_t
10366 i8size=1
10367 u8size=1
10368 ;;
10369 esac
10370 fi
10371 ;;
10372esac
10373case "$i8type" in
10374'') if $test $charsize -ge 1; then
10375 i8type=char
10376 u8type="unsigned char"
10377 i8size=$charsize
10378 u8size=$charsize
10379 fi
10380 ;;
10381esac
10382
10383case "$i16type" in
10384'') case "$shortsize" in
10385 2) i16type=short
10386 u16type="unsigned short"
10387 i16size=$shortsize
10388 u16size=$shortsize
10389 ;;
10390 esac
10391 ;;
10392esac
10393case "$i16type" in
10394'') set try -DINT16
10395 if eval $compile; then
10396 case "`./try$exe_ext`" in
10397 int16_t)
10398 i16type=int16_t
10399 u16type=uint16_t
10400 i16size=2
10401 u16size=2
10402 ;;
10403 esac
10404 fi
10405 ;;
10406esac
10407case "$i16type" in
10408'') if $test $shortsize -ge 2; then
10409 i16type=short
10410 u16type="unsigned short"
10411 i16size=$shortsize
10412 u16size=$shortsize
10413 fi
10414 ;;
10415esac
10416
10417case "$i32type" in
10418'') case "$longsize" in
10419 4) i32type=long
10420 u32type="unsigned long"
10421 i32size=$longsize
10422 u32size=$longsize
10423 ;;
10424 *) case "$intsize" in
10425 4) i32type=int
10426 u32type="unsigned int"
10427 i32size=$intsize
10428 u32size=$intsize
10429 ;;
10430 esac
10431 ;;
10432 esac
10433 ;;
10434esac
10435case "$i32type" in
10436'') set try -DINT32
10437 if eval $compile; then
10438 case "`./try$exe_ext`" in
10439 int32_t)
10440 i32type=int32_t
10441 u32type=uint32_t
10442 i32size=4
10443 u32size=4
10444 ;;
10445 esac
10446 fi
10447 ;;
10448esac
10449case "$i32type" in
10450'') if $test $intsize -ge 4; then
10451 i32type=int
10452 u32type="unsigned int"
10453 i32size=$intsize
10454 u32size=$intsize
10455 fi
10456 ;;
10457esac
10458
10459case "$i64type" in
10460'') case "$d_quad:$quadtype" in
10461 define:?*)
10462 i64type="$quadtype"
10463 u64type="$uquadtype"
10464 i64size=8
10465 u64size=8
10466 ;;
10467 esac
10468 ;;
10469esac
10470
1d1be0dc
NC
10471$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10472: volatile so that the compiler has to store it out to memory.
10473if test X"$d_volatile" = X"$define"; then
10474 volatile=volatile
10475fi
b4eb6b3d
JH
10476$cat <<EOP >try.c
10477#include <stdio.h>
1d1be0dc
NC
10478#include <sys/types.h>
10479#include <signal.h>
10480#ifdef SIGFPE
10481$volatile int bletched = 0;
10482$signal_t blech(s) int s; { bletched = 1; }
10483#endif
b4eb6b3d
JH
10484int main() {
10485 $uvtype u = 0;
1d1be0dc 10486 $nvtype d;
b4eb6b3d
JH
10487 int n = 8 * $uvsize;
10488 int i;
1d1be0dc
NC
10489#ifdef SIGFPE
10490 signal(SIGFPE, blech);
10491#endif
10492
b4eb6b3d
JH
10493 for (i = 0; i < n; i++) {
10494 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
10495 d = ($nvtype)u;
10496 if (($uvtype)d != u)
b4eb6b3d 10497 break;
1d1be0dc
NC
10498 if (d <= 0)
10499 break;
10500 d = ($nvtype)(u - 1);
10501 if (($uvtype)d != (u - 1))
10502 break;
10503#ifdef SIGFPE
10504 if (bletched) {
10505 break;
10506#endif
10507 }
b4eb6b3d 10508 }
efd1522b 10509 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
10510 exit(0);
10511}
10512EOP
1d1be0dc
NC
10513set try
10514
10515d_nv_preserves_uv="$undef"
10516if eval $compile; then
10517 d_nv_preserves_uv_bits="`./try$exe_ext`"
10518fi
10519case "$d_nv_preserves_uv_bits" in
10520\-[1-9]*)
10521 d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10522 $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs." 2>&1
10523 d_nv_preserves_uv="$define"
b4eb6b3d 10524 ;;
1d1be0dc
NC
10525[1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs." 2>&1
10526 d_nv_preserves_uv="$undef" ;;
10527*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
10528 d_nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
10529esac
10530
1d1be0dc
NC
10531$rm -f try.* try
10532
b4eb6b3d
JH
10533
10534: check for off64_t
10535echo " "
10536echo "Checking to see if you have off64_t..." >&4
10537$cat >try.c <<EOCP
10538#include <sys/types.h>
10539#include <unistd.h>
10540int main() { off64_t x = 7; }
10541EOCP
10542set try
10543if eval $compile; then
10544 val="$define"
10545 echo "You have off64_t."
10546else
10547 val="$undef"
10548 echo "You do not have off64_t."
10549 case "$lseeksize" in
10550 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10551 esac
10552fi
10553$rm -f try.* try
10554set d_off64_t
10555eval $setvar
10556
10557: see if POSIX threads are available
10558set pthread.h i_pthread
10559eval $inhdr
10560
10561
10562
10563
10564: how to create joinable pthreads
10565if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10566 echo " "
10567 echo "Checking what constant to use for creating joinable pthreads..." >&4
10568 $cat >try.c <<'EOCP'
10569#include <pthread.h>
10570int main() {
10571 int detachstate = JOINABLE;
10572}
10573EOCP
10574 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10575 if eval $compile; then
10576 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10577 val="$undef" # Yes, undef.
10578 set d_old_pthread_create_joinable
10579 eval $setvar
10580 val=""
10581 set old_pthread_create_joinable
10582 eval $setvar
10583 else
10584 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10585 if eval $compile; then
10586 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10587 val="$define"
10588 set d_old_pthread_create_joinable
10589 eval $setvar
10590 val=PTHREAD_CREATE_UNDETACHED
10591 set old_pthread_create_joinable
10592 eval $setvar
10593 else
10594 set try -DJOINABLE=__UNDETACHED
10595 if eval $compile; then
10596 echo "You seem to use __UNDETACHED." >&4
10597 val="$define"
10598 set d_old_pthread_create_joinable
10599 eval $setvar
10600 val=__UNDETACHED
10601 set old_pthread_create_joinable
10602 eval $setvar
10603 else
10604 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
10605 val="$define"
10606 set d_old_pthread_create_joinable
10607 eval $setvar
10608 val=0
10609 set old_pthread_create_joinable
10610 eval $setvar
10611 fi
10612 fi
10613 fi
10614 $rm -f try try.*
10615else
10616 d_old_pthread_create_joinable="$undef"
10617 old_pthread_create_joinable=""
10618fi
10619
10620: see if pause exists
10621set pause d_pause
10622eval $inlibc
10623
10624: see if pipe exists
10625set pipe d_pipe
10626eval $inlibc
10627
10628: see if poll exists
10629set poll d_poll
10630eval $inlibc
10631
10632
10633: see whether the various POSIXish _yields exist
10634$cat >try.c <<EOP
10635#include <pthread.h>
10636#include <stdio.h>
10637int main() {
10638#ifdef SCHED_YIELD
10639 sched_yield();
10640#else
10641#ifdef PTHREAD_YIELD
10642 pthread_yield();
10643#else
10644#ifdef PTHREAD_YIELD_NULL
10645 pthread_yield(NULL);
10646#endif
10647#endif
10648#endif
10649}
10650EOP
10651: see if sched_yield exists
10652set try -DSCHED_YIELD
10653if eval $compile; then
10654 val="$define"
10655 sched_yield='sched_yield()'
10656else
10657 val="$undef"
10658fi
10659case "$usethreads" in
10660$define)
10661 case "$val" in
10662 $define) echo 'sched_yield() found.' >&4 ;;
10663 *) echo 'sched_yield() NOT found.' >&4 ;;
10664 esac
10665esac
10666set d_sched_yield
10667eval $setvar
10668
10669: see if pthread_yield exists
10670set try -DPTHREAD_YIELD
10671if eval $compile; then
10672 val="$define"
10673 case "$sched_yield" in
10674 '') sched_yield='pthread_yield()' ;;
10675 esac
10676else
10677 set try -DPTHREAD_YIELD_NULL
10678 if eval $compile; then
10679 val="$define"
10680 case "$sched_yield" in
10681 '') sched_yield='pthread_yield(NULL)' ;;
10682 esac
10683 else
10684 val="$undef"
10685 fi
10686fi
10687case "$usethreads" in
10688$define)
10689 case "$val" in
10690 $define) echo 'pthread_yield() found.' >&4 ;;
10691 *) echo 'pthread_yield() NOT found.' >&4 ;;
10692 esac
10693 ;;
10694esac
10695set d_pthread_yield
10696eval $setvar
10697
10698case "$sched_yield" in
10699'') sched_yield=undef ;;
10700esac
10701
10702$rm -f try try.*
10703
10704: see if this is a pwd.h system
10705set pwd.h i_pwd
10706eval $inhdr
10707
10708case "$i_pwd" in
10709$define)
10710 xxx=`./findhdr pwd.h`
10711 $cppstdin $cppflags $cppminus < $xxx >$$.h
10712
10713 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10714 val="$define"
10715 else
10716 val="$undef"
10717 fi
10718 set d_pwquota
10719 eval $setvar
10720
10721 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10722 val="$define"
10723 else
10724 val="$undef"
10725 fi
10726 set d_pwage
10727 eval $setvar
10728
10729 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10730 val="$define"
10731 else
10732 val="$undef"
10733 fi
10734 set d_pwchange
10735 eval $setvar
10736
10737 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10738 val="$define"
10739 else
10740 val="$undef"
10741 fi
10742 set d_pwclass
10743 eval $setvar
10744
10745 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10746 val="$define"
10747 else
10748 val="$undef"
10749 fi
10750 set d_pwexpire
10751 eval $setvar
10752
10753 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10754 val="$define"
10755 else
10756 val="$undef"
10757 fi
10758 set d_pwcomment
10759 eval $setvar
10760
10761 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10762 val="$define"
10763 else
10764 val="$undef"
10765 fi
10766 set d_pwgecos
10767 eval $setvar
10768
10769 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10770 val="$define"
10771 else
10772 val="$undef"
10773 fi
10774 set d_pwpasswd
10775 eval $setvar
10776
10777 $rm -f $$.h
10778 ;;
10779*)
10780 val="$undef";
10781 set d_pwquota; eval $setvar
10782 set d_pwage; eval $setvar
10783 set d_pwchange; eval $setvar
10784 set d_pwclass; eval $setvar
10785 set d_pwexpire; eval $setvar
10786 set d_pwcomment; eval $setvar
10787 set d_pwgecos; eval $setvar
10788 set d_pwpasswd; eval $setvar
10789 ;;
10790esac
10791
10792: see if readdir and friends exist
10793set readdir d_readdir
10794eval $inlibc
10795set seekdir d_seekdir
10796eval $inlibc
10797set telldir d_telldir
10798eval $inlibc
10799set rewinddir d_rewinddir
10800eval $inlibc
10801
10802: see if readlink exists
10803set readlink d_readlink
10804eval $inlibc
10805
10806: see if rename exists
10807set rename d_rename
10808eval $inlibc
10809
10810: see if rmdir exists
10811set rmdir d_rmdir
10812eval $inlibc
10813
10814: see if memory.h is available.
10815val=''
10816set memory.h val
10817eval $inhdr
10818
10819: See if it conflicts with string.h
10820case "$val" in
10821$define)
10822 case "$strings" in
10823 '') ;;
10824 *)
10825 $cppstdin $cppflags $cppminus < $strings > mem.h
10826 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10827 echo " "
10828 echo "We won't be including <memory.h>."
10829 val="$undef"
10830 fi
10831 $rm -f mem.h
10832 ;;
10833 esac
10834esac
10835set i_memory
10836eval $setvar
10837
10838: can bcopy handle overlapping blocks?
10839val="$undef"
10840case "$d_bcopy" in
10841"$define")
10842 echo " "
10843 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10844 $cat >try.c <<EOCP
10845#$i_memory I_MEMORY
10846#$i_stdlib I_STDLIB
10847#$i_string I_STRING
10848#$i_unistd I_UNISTD
10849EOCP
10850 $cat >>try.c <<'EOCP'
10851#include <stdio.h>
10852#ifdef I_MEMORY
10853# include <memory.h>
10854#endif
10855#ifdef I_STDLIB
10856# include <stdlib.h>
10857#endif
10858#ifdef I_STRING
10859# include <string.h>
10860#else
10861# include <strings.h>
10862#endif
10863#ifdef I_UNISTD
10864# include <unistd.h> /* Needed for NetBSD */
10865#endif
10866int main()
10867{
10868char buf[128], abc[128];
10869char *b;
10870int len;
10871int off;
10872int align;
10873
10874bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10875
10876for (align = 7; align >= 0; align--) {
10877 for (len = 36; len; len--) {
10878 b = buf+align;
10879 bcopy(abc, b, len);
10880 for (off = 1; off <= len; off++) {
10881 bcopy(b, b+off, len);
10882 bcopy(b+off, b, len);
10883 if (bcmp(b, abc, len))
10884 exit(1);
10885 }
10886 }
10887}
10888exit(0);
10889}
10890EOCP
10891 set try
10892 if eval $compile_ok; then
10893 if ./try 2>/dev/null; then
10894 echo "Yes, it can."
10895 val="$define"
10896 else
10897 echo "It can't, sorry."
10898 case "$d_memmove" in
10899 "$define") echo "But that's Ok since you have memmove()." ;;
10900 esac
10901 fi
10902 else
10903 echo "(I can't compile the test program, so we'll assume not...)"
10904 case "$d_memmove" in
10905 "$define") echo "But that's Ok since you have memmove()." ;;
10906 esac
10907 fi
10908 ;;
10909esac
10910$rm -f try.* try core
10911set d_safebcpy
10912eval $setvar
10913
10914: can memcpy handle overlapping blocks?
10915val="$undef"
10916case "$d_memcpy" in
10917"$define")
10918 echo " "
10919 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10920 $cat >try.c <<EOCP
10921#$i_memory I_MEMORY
10922#$i_stdlib I_STDLIB
10923#$i_string I_STRING
10924#$i_unistd I_UNISTD
10925EOCP
10926 $cat >>try.c <<'EOCP'
10927#include <stdio.h>
10928#ifdef I_MEMORY
10929# include <memory.h>
10930#endif
10931#ifdef I_STDLIB
10932# include <stdlib.h>
10933#endif
10934#ifdef I_STRING
10935# include <string.h>
10936#else
10937# include <strings.h>
10938#endif
10939#ifdef I_UNISTD
10940# include <unistd.h> /* Needed for NetBSD */
10941#endif
10942int main()
10943{
10944char buf[128], abc[128];
10945char *b;
10946int len;
10947int off;
10948int align;
10949
10950/* Copy "abcde..." string to char abc[] so that gcc doesn't
10951 try to store the string in read-only memory. */
10952memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10953
10954for (align = 7; align >= 0; align--) {
10955 for (len = 36; len; len--) {
10956 b = buf+align;
10957 memcpy(b, abc, len);
10958 for (off = 1; off <= len; off++) {
10959 memcpy(b+off, b, len);
10960 memcpy(b, b+off, len);
10961 if (memcmp(b, abc, len))
10962 exit(1);
10963 }
10964 }
10965}
10966exit(0);
10967}
10968EOCP
10969 set try
10970 if eval $compile_ok; then
10971 if ./try 2>/dev/null; then
10972 echo "Yes, it can."
10973 val="$define"
10974 else
10975 echo "It can't, sorry."
10976 case "$d_memmove" in
10977 "$define") echo "But that's Ok since you have memmove()." ;;
10978 esac
10979 fi
10980 else
10981 echo "(I can't compile the test program, so we'll assume not...)"
10982 case "$d_memmove" in
10983 "$define") echo "But that's Ok since you have memmove()." ;;
10984 esac
10985 fi
10986 ;;
10987esac
10988$rm -f try.* try core
10989set d_safemcpy
10990eval $setvar
10991
10992: can memcmp be trusted to compare relative magnitude?
10993val="$undef"
10994case "$d_memcmp" in
10995"$define")
10996 echo " "
10997 echo "Checking if your memcmp() can compare relative magnitude..." >&4
10998 $cat >try.c <<EOCP
10999#$i_memory I_MEMORY
11000#$i_stdlib I_STDLIB
11001#$i_string I_STRING
11002#$i_unistd I_UNISTD
11003EOCP
11004 $cat >>try.c <<'EOCP'
11005#include <stdio.h>
11006#ifdef I_MEMORY
11007# include <memory.h>
11008#endif
11009#ifdef I_STDLIB
11010# include <stdlib.h>
11011#endif
11012#ifdef I_STRING
11013# include <string.h>
11014#else
11015# include <strings.h>
11016#endif
11017#ifdef I_UNISTD
11018# include <unistd.h> /* Needed for NetBSD */
11019#endif
11020int main()
11021{
11022char a = -1;
11023char b = 0;
11024if ((a < b) && memcmp(&a, &b, 1) < 0)
11025 exit(1);
11026exit(0);
11027}
11028EOCP
11029 set try
11030 if eval $compile_ok; then
11031 if ./try 2>/dev/null; then
11032 echo "Yes, it can."
11033 val="$define"
11034 else
11035 echo "No, it can't (it uses signed chars)."
11036 fi
11037 else
11038 echo "(I can't compile the test program, so we'll assume not...)"
11039 fi
11040 ;;
11041esac
11042$rm -f try.* try core
11043set d_sanemcmp
11044eval $setvar
11045
ef9f17be
JH
11046: see if prototype for sbrk is available
11047echo " "
11048set d_sbrkproto sbrk $i_unistd unistd.h
11049eval $hasproto
11050
b4eb6b3d
JH
11051: see if select exists
11052set select d_select
11053eval $inlibc
11054
11055: see if semctl exists
11056set semctl d_semctl
11057eval $inlibc
11058
11059: see if semget exists
11060set semget d_semget
11061eval $inlibc
11062
11063: see if semop exists
11064set semop d_semop
11065eval $inlibc
11066
11067: see how much of the 'sem*(2)' library is present.
11068h_sem=true
11069echo " "
11070case "$d_semctl$d_semget$d_semop" in
11071*"$undef"*) h_sem=false;;
11072esac
11073case "$osname" in
11074freebsd)
11075 case "`ipcs 2>&1`" in
11076 "SVID messages"*"not configured"*)
11077 echo "Your $osname does not have the sem*(2) configured." >&4
11078 h_sem=false
11079 val="$undef"
11080 set semctl d_semctl
11081 eval $setvar
11082 set semget d_semget
11083 eval $setvar
11084 set semop d_semop
11085 eval $setvar
11086 ;;
11087 esac
11088 ;;
11089esac
11090: we could also check for sys/ipc.h ...
11091if $h_sem && $test `./findhdr sys/sem.h`; then
11092 echo "You have the full sem*(2) library." >&4
11093 val="$define"
11094else
11095 echo "You don't have the full sem*(2) library." >&4
11096 val="$undef"
11097fi
11098set d_sem
11099eval $setvar
11100
11101: see whether sys/sem.h defines union semun
11102echo " "
11103$cat > try.c <<'END'
11104#include <sys/types.h>
11105#include <sys/ipc.h>
11106#include <sys/sem.h>
11107int main () { union semun semun; semun.buf = 0; }
11108END
11109set try
11110if eval $compile; then
11111 echo "You have union semun in <sys/sem.h>." >&4
11112 val="$define"
11113else
11114 echo "You do not have union semun in <sys/sem.h>." >&4
11115 val="$undef"
11116fi
11117$rm -f try try.c try.h
11118set d_union_semun
11119eval $setvar
11120
11121: see how to do semctl IPC_STAT
11122case "$d_sem" in
11123$define)
11124 : see whether semctl IPC_STAT can use union semun
11125 echo " "
11126 $cat > try.h <<END
11127#ifndef S_IRUSR
11128# ifdef S_IREAD
11129# define S_IRUSR S_IREAD
11130# define S_IWUSR S_IWRITE
11131# define S_IXUSR S_IEXEC
11132# else
11133# define S_IRUSR 0400
11134# define S_IWUSR 0200
11135# define S_IXUSR 0100
11136# endif
11137# define S_IRGRP (S_IRUSR>>3)
11138# define S_IWGRP (S_IWUSR>>3)
11139# define S_IXGRP (S_IXUSR>>3)
11140# define S_IROTH (S_IRUSR>>6)
11141# define S_IWOTH (S_IWUSR>>6)
11142# define S_IXOTH (S_IXUSR>>6)
11143#endif
11144#ifndef S_IRWXU
11145# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11146# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11147# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11148#endif
11149END
11150
11151 $cat > try.c <<END
11152#include <sys/types.h>
11153#include <sys/ipc.h>
11154#include <sys/sem.h>
11155#include <sys/stat.h>
11156#include <stdio.h>
11157#include <errno.h>
11158#include "try.h"
11159#ifndef errno
11160extern int errno;
11161#endif
11162#$d_union_semun HAS_UNION_SEMUN
11163int main() {
11164 union semun
11165#ifndef HAS_UNION_SEMUN
11166 {
11167 int val;
11168 struct semid_ds *buf;
11169 unsigned short *array;
11170 }
11171#endif
11172 arg;
11173 int sem, st;
11174
11175#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11176 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11177 if (sem > -1) {
11178 struct semid_ds argbuf;
11179 arg.buf = &argbuf;
11180# ifdef IPC_STAT
11181 st = semctl(sem, 0, IPC_STAT, arg);
11182 if (st == 0)
11183 printf("semun\n");
11184 else
11185# endif /* IPC_STAT */
11186 printf("semctl IPC_STAT failed: errno = %d\n", errno);
11187# ifdef IPC_RMID
11188 if (semctl(sem, 0, IPC_RMID, arg) != 0)
11189# endif /* IPC_RMID */
11190 printf("semctl IPC_RMID failed: errno = %d\n", errno);
11191 } else
11192#endif /* IPC_PRIVATE && ... */
11193 printf("semget failed: errno = %d\n", errno);
11194 return 0;
11195}
11196END
11197 val="$undef"
11198 set try
11199 if eval $compile; then
11200 xxx=`./try`
11201 case "$xxx" in
11202 semun) val="$define" ;;
11203 esac
11204 fi
11205 $rm -f try try.c
11206 set d_semctl_semun
11207 eval $setvar
11208 case "$d_semctl_semun" in
11209 $define)
11210 echo "You can use union semun for semctl IPC_STAT." >&4
11211 also='also'
11212 ;;
11213 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
11214 also=''
11215 ;;
11216 esac
11217
11218 : see whether semctl IPC_STAT can use struct semid_ds pointer
11219 $cat > try.c <<'END'
11220#include <sys/types.h>
11221#include <sys/ipc.h>
11222#include <sys/sem.h>
11223#include <sys/stat.h>
11224#include "try.h"
11225#include <stdio.h>
11226#include <errno.h>
11227#ifndef errno
11228extern int errno;
11229#endif
11230int main() {
11231 struct semid_ds arg;
11232 int sem, st;
11233
11234#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11235 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11236 if (sem > -1) {
11237# ifdef IPC_STAT
11238 st = semctl(sem, 0, IPC_STAT, &arg);
11239 if (st == 0)
11240 printf("semid_ds\n");
11241 else
11242# endif /* IPC_STAT */
11243 printf("semctl IPC_STAT failed: errno = %d\n", errno);
11244# ifdef IPC_RMID
11245 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11246# endif /* IPC_RMID */
11247 printf("semctl IPC_RMID failed: errno = %d\n", errno);
11248 } else
11249#endif /* IPC_PRIVATE && ... */
11250 printf("semget failed: errno = %d\n", errno);
11251
11252 return 0;
11253}
11254END
11255 val="$undef"
11256 set try
11257 if eval $compile; then
11258 xxx=`./try`
11259 case "$xxx" in
11260 semid_ds) val="$define" ;;
11261 esac
11262 fi
11263 $rm -f try try.c
11264 set d_semctl_semid_ds
11265 eval $setvar
11266 case "$d_semctl_semid_ds" in
11267 $define)
11268 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11269 ;;
11270 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11271 ;;
11272 esac
11273 $rm -f try.h
11274 ;;
11275*) val="$undef"
11276
11277 # We do not have the full sem*(2) library, so assume we can not
11278 # use either.
11279
11280 set d_semctl_semun
11281 eval $setvar
11282
11283 set d_semctl_semid_ds
11284 eval $setvar
11285 ;;
11286esac
11287
11288: see if setegid exists
11289set setegid d_setegid
11290eval $inlibc
11291
11292: see if seteuid exists
11293set seteuid d_seteuid
11294eval $inlibc
11295
11296: see if setgrent exists
11297set setgrent d_setgrent
11298eval $inlibc
11299
11300: see if sethostent exists
11301set sethostent d_sethent
11302eval $inlibc
11303
11304: see if setlinebuf exists
11305set setlinebuf d_setlinebuf
11306eval $inlibc
11307
11308: see if setlocale exists
11309set setlocale d_setlocale
11310eval $inlibc
11311
11312: see if setnetent exists
11313set setnetent d_setnent
11314eval $inlibc
11315
11316: see if setprotoent exists
11317set setprotoent d_setpent
11318eval $inlibc
11319
11320: see if setpgid exists
11321set setpgid d_setpgid
11322eval $inlibc
11323
11324: see if setpgrp2 exists
11325set setpgrp2 d_setpgrp2
11326eval $inlibc
11327
11328: see if setpriority exists
11329set setpriority d_setprior
11330eval $inlibc
11331
11332: see if setproctitle exists
11333set setproctitle d_setproctitle
11334eval $inlibc
11335
11336: see if setpwent exists
11337set setpwent d_setpwent
11338eval $inlibc
11339
11340: see if setregid exists
11341set setregid d_setregid
11342eval $inlibc
11343set setresgid d_setresgid
11344eval $inlibc
11345
11346: see if setreuid exists
11347set setreuid d_setreuid
11348eval $inlibc
11349set setresuid d_setresuid
11350eval $inlibc
11351
11352: see if setrgid exists
11353set setrgid d_setrgid
11354eval $inlibc
11355
11356: see if setruid exists
11357set setruid d_setruid
11358eval $inlibc
11359
11360: see if setservent exists
11361set setservent d_setsent
11362eval $inlibc
11363
11364: see if setsid exists
11365set setsid d_setsid
11366eval $inlibc
11367
11368: see if setvbuf exists
11369set setvbuf d_setvbuf
11370eval $inlibc
11371
11372: see if sfio.h is available
11373set sfio.h i_sfio
11374eval $inhdr
11375
11376
11377: see if sfio library is available
11378case "$i_sfio" in
11379$define)
11380 val=''
11381 set sfreserve val
11382 eval $inlibc
11383 ;;
11384*)
11385 val="$undef"
11386 ;;
11387esac
11388: Ok, but do we want to use it.
11389case "$val" in
11390$define)
11391 case "$usesfio" in
11392 true|$define|[yY]*) dflt='y';;
11393 *) dflt='n';;
11394 esac
11395 echo "$package can use the sfio library, but it is experimental."
11396 case "$useperlio" in
11397 "$undef")
11398 echo "For sfio also the PerlIO abstraction layer is needed."
11399 echo "Earlier you said you wouldn't want that."
11400 ;;
11401 esac
11402 rp="You seem to have sfio available, do you want to try using it?"
11403 . ./myread
11404 case "$ans" in
11405 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
11406 useperlio="$define"
11407 val="$define"
11408 ;;
11409 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
11410 val="$undef"
11411 : Remove sfio from list of libraries to use
11412 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11413 shift
11414 libs="$*"
11415 echo "libs = $libs" >&4
11416 ;;
11417 esac
11418 ;;
11419*) case "$usesfio" in
11420 true|$define|[yY]*)
11421 echo "Sorry, cannot find sfio on this machine." >&4
11422 echo "Ignoring your setting of usesfio=$usesfio." >&4
11423 val="$undef"
11424 ;;
11425 esac
11426 ;;
11427esac
11428set d_sfio
11429eval $setvar
11430case "$d_sfio" in
11431$define) usesfio='true';;
11432*) usesfio='false';;
11433esac
11434
11435: see if shmctl exists
11436set shmctl d_shmctl
11437eval $inlibc
11438
11439: see if shmget exists
11440set shmget d_shmget
11441eval $inlibc
11442
11443: see if shmat exists
11444set shmat d_shmat
11445eval $inlibc
11446: see what shmat returns
11447case "$d_shmat" in
11448"$define")
11449 $cat >shmat.c <<'END'
11450#include <sys/shm.h>
11451void *shmat();
11452END
11453 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11454 shmattype='void *'
11455 else
11456 shmattype='char *'
11457 fi
11458 echo "and it returns ($shmattype)." >&4
11459 : see if a prototype for shmat is available
11460 xxx=`./findhdr sys/shm.h`
11461 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11462 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11463 val="$define"
11464 else
11465 val="$undef"
11466 fi
11467 $rm -f shmat.[co]
11468 ;;
11469*)
11470 val="$undef"
11471 ;;
11472esac
11473set d_shmatprototype
11474eval $setvar
11475
11476: see if shmdt exists
11477set shmdt d_shmdt
11478eval $inlibc
11479
11480: see how much of the 'shm*(2)' library is present.
11481h_shm=true
11482echo " "
11483case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11484*"$undef"*) h_shm=false;;
11485esac
11486case "$osname" in
11487freebsd)
11488 case "`ipcs 2>&1`" in
11489 "SVID shared memory"*"not configured"*)
11490 echo "Your $osname does not have the shm*(2) configured." >&4
11491 h_shm=false
11492 val="$undef"
11493 set shmctl d_shmctl
11494 evat $setvar
11495 set shmget d_shmget
11496 evat $setvar
11497 set shmat d_shmat
11498 evat $setvar
11499 set shmdt d_shmdt
11500 evat $setvar
11501 ;;
11502 esac
11503 ;;
11504esac
11505: we could also check for sys/ipc.h ...
11506if $h_shm && $test `./findhdr sys/shm.h`; then
11507 echo "You have the full shm*(2) library." >&4
11508 val="$define"
11509else
11510 echo "You don't have the full shm*(2) library." >&4
11511 val="$undef"
11512fi
11513set d_shm
11514eval $setvar
11515
11516echo " "
11517: see if we have sigaction
11518if set sigaction val -f d_sigaction; eval $csym; $val; then
11519 echo 'sigaction() found.' >&4
11520 $cat > try.c <<'EOP'
11521#include <stdio.h>
11522#include <sys/types.h>
11523#include <signal.h>
11524int main()
11525{
11526 struct sigaction act, oact;
11527 act.sa_flags = 0;
11528 oact.sa_handler = 0;
11529 /* so that act and oact are used */
11530 exit(act.sa_flags == 0 && oact.sa_handler == 0);
11531}
11532EOP
11533 set try
11534 if eval $compile_ok; then
11535 val="$define"
11536 else
11537 echo "But you don't seem to have a useable struct sigaction." >&4
11538 val="$undef"
11539 fi
11540else
11541 echo 'sigaction NOT found.' >&4
11542 val="$undef"
11543fi
11544set d_sigaction; eval $setvar
11545$rm -f try try$_o try.c
11546
983dbef6
JH
11547: see if sigprocmask exists
11548set sigprocmask d_sigprocmask
11549eval $inlibc
11550
b4eb6b3d
JH
11551: see if sigsetjmp exists
11552echo " "
11553case "$d_sigsetjmp" in
11554'')
11555 $cat >try.c <<'EOP'
11556#include <setjmp.h>
11557sigjmp_buf env;
11558int set = 1;
11559int main()
11560{
11561 if (sigsetjmp(env,1))
11562 exit(set);
11563 set = 0;
11564 siglongjmp(env, 1);
11565 exit(1);
11566}
11567EOP
11568 set try
11569 if eval $compile; then
11570 if ./try >/dev/null 2>&1; then
11571 echo "POSIX sigsetjmp found." >&4
11572 val="$define"
11573 else
11574 $cat >&4 <<EOM
11575Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11576I'll ignore them.
11577EOM
11578 val="$undef"
11579 fi
11580 else
11581 echo "sigsetjmp not found." >&4
11582 val="$undef"
11583 fi
11584 ;;
11585*) val="$d_sigsetjmp"
11586 case "$d_sigsetjmp" in
11587 $define) echo "POSIX sigsetjmp found." >&4;;
11588 $undef) echo "sigsetjmp not found." >&4;;
11589 esac
11590 ;;
11591esac
11592set d_sigsetjmp
11593eval $setvar
11594$rm -f try.c try
11595
11596: see if socks5_init exists
11597set socks5_init d_socks5_init
11598eval $inlibc
11599
11600: see if sys/stat.h is available
11601set sys/stat.h i_sysstat
11602eval $inhdr
11603
11604
11605: see if stat knows about block sizes
11606echo " "
11607echo "Checking to see if your struct stat has st_blocks field..." >&4
11608set d_statblks stat st_blocks $i_sysstat sys/stat.h
11609eval $hasfield
11610
11611
11612: see if this is a sys/vfs.h system
11613set sys/vfs.h i_sysvfs
11614eval $inhdr
11615
11616
11617: see if this is a sys/statfs.h system
11618set sys/statfs.h i_sysstatfs
11619eval $inhdr
11620
11621
11622echo " "
11623echo "Checking to see if your system supports struct statfs..." >&4
11624set 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
11625eval $hasstruct
11626case "$d_statfs_s" in
11627"$define") echo "Yes, it does." ;;
11628*) echo "No, it doesn't." ;;
11629esac
11630
11631
11632
11633: see if struct statfs knows about f_flags
11634case "$d_statfs_s" in
11635define)
11636 echo " "
11637 echo "Checking to see if your struct statfs has f_flags field..." >&4
11638 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
11639 eval $hasfield
11640 ;;
11641*) val="$undef"
11642 set d_statfs_f_flags
11643 eval $setvar
11644 ;;
11645esac
11646case "$d_statfs_f_flags" in
11647"$define") echo "Yes, it does." ;;
11648*) echo "No, it doesn't." ;;
11649esac
11650
11651: see if _ptr and _cnt from stdio act std
11652echo " "
80f36755
NC
11653
11654if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11655 echo "(Looks like you have stdio.h from BSD.)"
11656 case "$stdio_ptr" in
11657 '') stdio_ptr='((fp)->_p)'
11658 ptr_lval=$define
11659 ;;
11660 *) ptr_lval=$d_stdio_ptr_lval;;
11661 esac
11662 case "$stdio_cnt" in
11663 '') stdio_cnt='((fp)->_r)'
11664 cnt_lval=$define
11665 ;;
11666 *) cnt_lval=$d_stdio_cnt_lval;;
11667 esac
11668 case "$stdio_base" in
11669 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11670 esac
11671 case "$stdio_bufsiz" in
11672 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11673 esac
11674elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
b4eb6b3d
JH
11675 echo "(Looks like you have stdio.h from Linux.)"
11676 case "$stdio_ptr" in
11677 '') stdio_ptr='((fp)->_IO_read_ptr)'
11678 ptr_lval=$define
11679 ;;
11680 *) ptr_lval=$d_stdio_ptr_lval;;
11681 esac
11682 case "$stdio_cnt" in
11683 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11684 cnt_lval=$undef
11685 ;;
11686 *) cnt_lval=$d_stdio_cnt_lval;;
11687 esac
11688 case "$stdio_base" in
11689 '') stdio_base='((fp)->_IO_read_base)';;
11690 esac
11691 case "$stdio_bufsiz" in
11692 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11693 esac
11694else
11695 case "$stdio_ptr" in
11696 '') stdio_ptr='((fp)->_ptr)'
11697 ptr_lval=$define
11698 ;;
11699 *) ptr_lval=$d_stdio_ptr_lval;;
11700 esac
11701 case "$stdio_cnt" in
11702 '') stdio_cnt='((fp)->_cnt)'
11703 cnt_lval=$define
11704 ;;
11705 *) cnt_lval=$d_stdio_cnt_lval;;
11706 esac
11707 case "$stdio_base" in
11708 '') stdio_base='((fp)->_base)';;
11709 esac
11710 case "$stdio_bufsiz" in
11711 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11712 esac
11713fi
80f36755 11714
b4eb6b3d
JH
11715: test whether _ptr and _cnt really work
11716echo "Checking how std your stdio is..." >&4
11717$cat >try.c <<EOP
11718#include <stdio.h>
11719#define FILE_ptr(fp) $stdio_ptr
11720#define FILE_cnt(fp) $stdio_cnt
11721int main() {
11722 FILE *fp = fopen("try.c", "r");
11723 char c = getc(fp);
11724 if (
11725 18 <= FILE_cnt(fp) &&
11726 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11727 )
11728 exit(0);
11729 exit(1);
11730}
11731EOP
11732val="$undef"
11733set try
11734if eval $compile; then
11735 if ./try; then
11736 echo "Your stdio acts pretty std."
11737 val="$define"
11738 else
11739 echo "Your stdio isn't very std."
11740 fi
11741else
11742 echo "Your stdio doesn't appear very std."
11743fi
11744$rm -f try.c try
11745set d_stdstdio
11746eval $setvar
11747
11748: Can _ptr be used as an lvalue?
11749case "$d_stdstdio$ptr_lval" in
11750$define$define) val=$define ;;
11751*) val=$undef ;;
11752esac
11753set d_stdio_ptr_lval
11754eval $setvar
11755
11756: Can _cnt be used as an lvalue?
11757case "$d_stdstdio$cnt_lval" in
11758$define$define) val=$define ;;
11759*) val=$undef ;;
11760esac
11761set d_stdio_cnt_lval
11762eval $setvar
11763
a7ffa9b9
NC
11764
11765: test whether setting _ptr sets _cnt as a side effect
11766d_stdio_ptr_lval_sets_cnt="$undef"
11767d_stdio_ptr_lval_nochange_cnt="$undef"
11768case "$d_stdio_ptr_lval$d_stdstdio" in
11769$define$define)
11770 echo "Checking to see what happens if we set the stdio ptr..." >&4
11771$cat >try.c <<EOP
11772#include <stdio.h>
11773/* Can we scream? */
11774/* Eat dust sed :-) */
c1d9e6fa 11775/* In the buffer space, no one can hear you scream. */
0bbfc344
JH
11776#define FILE_ptr(fp) $stdio_ptr
11777#define FILE_cnt(fp) $stdio_cnt
c1d9e6fa 11778#include <sys/types.h>
a7ffa9b9
NC
11779int main() {
11780 FILE *fp = fopen("try.c", "r");
c1d9e6fa 11781 int c;
a7ffa9b9
NC
11782 char *ptr;
11783 size_t cnt;
c1d9e6fa
JH
11784 if (!fp) {
11785 puts("Fail even to read");
11786 exit(1);
11787 }
11788 c = getc(fp); /* Read away the first # */
11789 if (c == EOF) {
11790 puts("Fail even to read");
11791 exit(1);
11792 }
a7ffa9b9
NC
11793 if (!(
11794 18 <= FILE_cnt(fp) &&
11795 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11796 )) {
11797 puts("Fail even to read");
11798 exit (1);
11799 }
c1d9e6fa
JH
11800 ptr = (char*) FILE_ptr(fp);
11801 cnt = (size_t)FILE_cnt(fp);
a7ffa9b9 11802
c1d9e6fa 11803 FILE_ptr(fp) += 42;
a7ffa9b9 11804
c1d9e6fa 11805 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
a7ffa9b9
NC
11806 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11807 exit (1);
11808 }
11809 if (FILE_cnt(fp) <= 20) {
11810 printf ("Fail (<20 chars to test)");
11811 exit (1);
11812 }
11813 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11814 puts("Fail compare");
11815 exit (1);
11816 }
11817 if (cnt == FILE_cnt(fp)) {
11818 puts("Pass_unchanged");
11819 exit (0);
11820 }
11821 if (FILE_cnt(fp) == (cnt - 42)) {
11822 puts("Pass_changed");
11823 exit (0);
11824 }
11825 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11826 return 1;
11827
11828}
11829EOP
11830 set try
11831 if eval $compile; then
11832 case `./try$exe_ext` in
11833 Pass_changed)
2e32dcfe 11834 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
a7ffa9b9
NC
11835 d_stdio_ptr_lval_sets_cnt="$define" ;;
11836 Pass_unchanged)
11837 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
11838 d_stdio_ptr_lval_nochange_cnt="$define" ;;
11839 Fail*)
11840 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
11841 *)
11842 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11843 esac
11844 else
11845 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
11846 fi
11847 $rm -f try.c try
11848 ;;
11849esac
11850
b4eb6b3d
JH
11851: see if _base is also standard
11852val="$undef"
11853case "$d_stdstdio" in
11854$define)
11855 $cat >try.c <<EOP
11856#include <stdio.h>
11857#define FILE_base(fp) $stdio_base
11858#define FILE_bufsiz(fp) $stdio_bufsiz
11859int main() {
11860 FILE *fp = fopen("try.c", "r");
11861 char c = getc(fp);
11862 if (
11863 19 <= FILE_bufsiz(fp) &&
11864 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11865 )
11866 exit(0);
11867 exit(1);
11868}
11869EOP
11870 set try
11871 if eval $compile; then
11872 if ./try; then
11873 echo "And its _base field acts std."
11874 val="$define"
11875 else
11876 echo "But its _base field isn't std."
11877 fi
11878 else
11879 echo "However, it seems to be lacking the _base field."
11880 fi
11881 $rm -f try.c try
11882 ;;
11883esac
11884set d_stdiobase
11885eval $setvar
11886
11887$cat >&4 <<EOM
11888Checking how to access stdio streams by file descriptor number...
11889EOM
11890case "$stdio_stream_array" in
11891'') $cat >try.c <<EOCP
11892#include <stdio.h>
11893int main() {
11894 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11895 printf("yes\n");
11896}
11897EOCP
11898 for s in _iob __iob __sF
11899 do
11900 set try -DSTDIO_STREAM_ARRAY=$s
11901 if eval $compile; then
11902 case "`./try$exe_ext`" in
11903 yes) stdio_stream_array=$s; break ;;
11904 esac
11905 fi
11906 done
11907 $rm -f try.* try$exe_ext
11908esac
11909case "$stdio_stream_array" in
11910'') $cat >&4 <<EOM
11911I can't figure out how to access stdio streams by file descriptor number.
11912EOM
11913 d_stdio_stream_array="$undef"
11914 ;;
11915*) $cat >&4 <<EOM
11916You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11917EOM
11918 d_stdio_stream_array="$define"
11919 ;;
11920esac
11921
11922: see if strcoll exists
11923set strcoll d_strcoll
11924eval $inlibc
11925
11926: check for structure copying
11927echo " "
11928echo "Checking to see if your C compiler can copy structs..." >&4
11929$cat >try.c <<'EOCP'
11930int main()
11931{
11932 struct blurfl {
11933 int dyick;
11934 } foo, bar;
11935
11936 foo = bar;
11937}
11938EOCP
11939if $cc -c try.c >/dev/null 2>&1 ; then
11940 val="$define"
11941 echo "Yup, it can."
11942else
11943 val="$undef"
11944 echo "Nope, it can't."
11945fi
11946set d_strctcpy
11947eval $setvar
11948$rm -f try.*
11949
11950: see if strerror and/or sys_errlist[] exist
11951echo " "
11952if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11953 if set strerror val -f d_strerror; eval $csym; $val; then
11954 echo 'strerror() found.' >&4
11955 d_strerror="$define"
11956 d_strerrm='strerror(e)'
11957 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11958 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
11959 d_syserrlst="$define"
11960 else
11961 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11962 d_syserrlst="$undef"
11963 fi
11964 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11965 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11966 echo 'strerror() found in string header.' >&4
11967 d_strerror="$define"
11968 d_strerrm='strerror(e)'
11969 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11970 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11971 d_syserrlst="$define"
11972 else
11973 echo "(You don't appear to have any sys_errlist[], how can this be?)"
11974 d_syserrlst="$undef"
11975 fi
11976 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11977 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11978 d_strerror="$undef"
11979 d_syserrlst="$define"
11980 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11981 else
11982 echo 'strerror() and sys_errlist[] NOT found.' >&4
11983 d_strerror="$undef"
11984 d_syserrlst="$undef"
11985 d_strerrm='"unknown"'
11986 fi
11987fi
11988
11989: see if strtod exists
11990set strtod d_strtod
11991eval $inlibc
11992
11993: see if strtol exists
11994set strtol d_strtol
11995eval $inlibc
11996
11997: see if strtold exists
11998set strtold d_strtold
11999eval $inlibc
12000
12001: see if strtoll exists
12002set strtoll d_strtoll
12003eval $inlibc
12004
12005case "$d_longlong-$d_strtoll" in
12006"$define-$define")
12007 $cat <<EOM
12008Checking whether your strtoll() works okay...
12009EOM
12010 $cat >try.c <<'EOCP'
12011#include <errno.h>
12012#ifdef __hpux
12013#define strtoll __strtoll
12014#endif
e75931a7
YST
12015#ifdef __EMX__
12016#define strtoll _strtoll
12017#endif
b4eb6b3d
JH
12018#include <stdio.h>
12019extern long long int strtoll(char *s, char **, int);
12020static int bad = 0;
12021int check(char *s, long long ell, int een) {
12022 long long gll;
12023 errno = 0;
12024 gll = strtoll(s, 0, 10);
12025 if (!((gll == ell) && (errno == een)))
12026 bad++;
12027}
12028int main() {
12029 check(" 1", 1LL, 0);
12030 check(" 0", 0LL, 0);
12031 check("-1", -1LL, 0);
12032 check("-9223372036854775808", -9223372036854775808LL, 0);
12033 check("-9223372036854775808", -9223372036854775808LL, 0);
12034 check(" 9223372036854775807", 9223372036854775807LL, 0);
12035 check("-9223372036854775808", -9223372036854775808LL, 0);
12036 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
12037 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12038 if (!bad)
12039 printf("ok\n");
12040}
12041EOCP
12042 set try
12043 if eval $compile; then
e75931a7
YST
12044 yyy=`./try`
12045 case "$yyy" in
b4eb6b3d
JH
12046 ok) echo "Your strtoll() seems to be working okay." ;;
12047 *) cat <<EOM >&4
12048Your strtoll() doesn't seem to be working okay.
12049EOM
12050 d_strtoll="$undef"
12051 ;;
69eadf66 12052 esac
e75931a7
YST
12053 else
12054 echo "(I can't seem to compile the test program--assuming it doesn't)"
12055 d_strtoll="$undef"
b4eb6b3d
JH
12056 fi
12057 ;;
12058esac
12059
28e5dec8
JH
12060: see if strtoq exists
12061set strtoq d_strtoq
12062eval $inlibc
12063
b4eb6b3d
JH
12064: see if strtoul exists
12065set strtoul d_strtoul
12066eval $inlibc
12067
d0e6d399
NC
12068case "$d_strtoul" in
12069"$define")
12070 $cat <<EOM
12071Checking whether your strtoul() works okay...
12072EOM
12073 $cat >try.c <<'EOCP'
12074#include <errno.h>
12075#include <stdio.h>
12076extern unsigned long int strtoul(char *s, char **, int);
12077static int bad = 0;
12078void check(char *s, unsigned long eul, int een) {
12079 unsigned long gul;
12080 errno = 0;
12081 gul = strtoul(s, 0, 10);
12082 if (!((gul == eul) && (errno == een)))
12083 bad++;
12084}
12085int main() {
12086 check(" 1", 1L, 0);
12087 check(" 0", 0L, 0);
12088EOCP
12089 case "$longsize" in
12090 8)
12091 $cat >>try.c <<'EOCP'
09c0d2c4
JH
12092 check("18446744073709551615", 18446744073709551615UL, 0);
12093 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 12094#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 12095 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
12096 check("-18446744073709551614", 2, 0);
12097 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
12098 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12099 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 12100#endif
d0e6d399
NC
12101EOCP
12102 ;;
12103 4)
12104 $cat >>try.c <<'EOCP'
12105 check("4294967295", 4294967295UL, 0);
12106 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 12107#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
12108 check("-1", 4294967295UL, 0);
12109 check("-4294967294", 2, 0);
12110 check("-4294967295", 1, 0);
12111 check("-4294967296", 4294967295UL, ERANGE);
12112 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 12113#endif
d0e6d399
NC
12114EOCP
12115 ;;
12116 *)
12117: Should we write these tests to be more portable by sprintf-ing
12118: ~0 and then manipulating that char string as input for strtol?
12119 ;;
12120 esac
12121 $cat >>try.c <<'EOCP'
12122 if (!bad)
12123 printf("ok\n");
12124 return 0;
12125}
12126EOCP
12127 set try
12128 if eval $compile; then
12129 case "`./try`" in
12130 ok) echo "Your strtoul() seems to be working okay." ;;
12131 *) cat <<EOM >&4
12132Your strtoul() doesn't seem to be working okay.
12133EOM
12134 d_strtoul="$undef"
12135 ;;
12136 esac
12137 fi
12138 ;;
12139esac
12140
b4eb6b3d
JH
12141: see if strtoull exists
12142set strtoull d_strtoull
12143eval $inlibc
12144
12145case "$d_longlong-$d_strtoull" in
12146"$define-$define")
12147 $cat <<EOM
12148Checking whether your strtoull() works okay...
12149EOM
12150 $cat >try.c <<'EOCP'
12151#include <errno.h>
12152#ifdef __hpux
12153#define strtoull __strtoull
12154#endif
12155#include <stdio.h>
12156extern unsigned long long int strtoull(char *s, char **, int);
12157static int bad = 0;
12158int check(char *s, long long eull, int een) {
12159 long long gull;
12160 errno = 0;
12161 gull = strtoull(s, 0, 10);
12162 if (!((gull == eull) && (errno == een)))
12163 bad++;
12164}
12165int main() {
d0e6d399
NC
12166 check(" 1", 1LL, 0);
12167 check(" 0", 0LL, 0);
12168 check("18446744073709551615", 18446744073709551615ULL, 0);
12169 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 12170#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
12171 check("-1", 18446744073709551615ULL, 0);
12172 check("-18446744073709551614", 2LL, 0);
12173 check("-18446744073709551615", 1LL, 0);
12174 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12175 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 12176#endif
b4eb6b3d
JH
12177 if (!bad)
12178 printf("ok\n");
12179}
12180EOCP
12181 set try
12182 if eval $compile; then
12183 case "`./try`" in
12184 ok) echo "Your strtoull() seems to be working okay." ;;
12185 *) cat <<EOM >&4
12186Your strtoull() doesn't seem to be working okay.
12187EOM
12188 d_strtoull="$undef"
12189 ;;
12190 esac
12191 fi
12192 ;;
12193esac
12194
12195: see if strtouq exists
12196set strtouq d_strtouq
12197eval $inlibc
12198
d0e6d399
NC
12199case "$d_strtouq" in
12200"$define")
12201 $cat <<EOM
12202Checking whether your strtouq() works okay...
12203EOM
12204 $cat >try.c <<'EOCP'
12205#include <errno.h>
12206#include <stdio.h>
12207extern unsigned long long int strtouq(char *s, char **, int);
12208static int bad = 0;
12209void check(char *s, unsigned long long eull, int een) {
12210 unsigned long long gull;
12211 errno = 0;
12212 gull = strtouq(s, 0, 10);
12213 if (!((gull == eull) && (errno == een)))
12214 bad++;
12215}
12216int main() {
12217 check(" 1", 1LL, 0);
12218 check(" 0", 0LL, 0);
12219 check("18446744073709551615", 18446744073709551615ULL, 0);
12220 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 12221#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
12222 check("-1", 18446744073709551615ULL, 0);
12223 check("-18446744073709551614", 2LL, 0);
12224 check("-18446744073709551615", 1LL, 0);
12225 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12226 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 12227#endif
d0e6d399
NC
12228 if (!bad)
12229 printf("ok\n");
12230 return 0;
12231}
12232EOCP
12233 set try
12234 if eval $compile; then
12235 case "`./try`" in
12236 ok) echo "Your strtouq() seems to be working okay." ;;
12237 *) cat <<EOM >&4
12238Your strtouq() doesn't seem to be working okay.
12239EOM
12240 d_strtouq="$undef"
12241 ;;
12242 esac
12243 fi
12244 ;;
12245esac
12246
b4eb6b3d
JH
12247: see if strxfrm exists
12248set strxfrm d_strxfrm
12249eval $inlibc
12250
12251: see if symlink exists
12252set symlink d_symlink
12253eval $inlibc
12254
12255: see if syscall exists
12256set syscall d_syscall
12257eval $inlibc
12258
12259: see if sysconf exists
12260set sysconf d_sysconf
12261eval $inlibc
12262
12263: see if system exists
12264set system d_system
12265eval $inlibc
12266
12267: see if tcgetpgrp exists
12268set tcgetpgrp d_tcgetpgrp
12269eval $inlibc
12270
12271: see if tcsetpgrp exists
12272set tcsetpgrp d_tcsetpgrp
12273eval $inlibc
12274
12275: see if prototype for telldir is available
12276echo " "
12277set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12278eval $hasproto
12279
12280: see if this is a sys/times.h system
12281set sys/times.h i_systimes
12282eval $inhdr
12283
12284: see if times exists
12285echo " "
12286if set times val -f d_times; eval $csym; $val; then
12287 echo 'times() found.' >&4
12288 d_times="$define"
12289 inc=''
12290 case "$i_systimes" in
12291 "$define") inc='sys/times.h';;
12292 esac
12293 rp="What is the type returned by times() on this system?"
12294 set clock_t clocktype long stdio.h sys/types.h $inc
12295 eval $typedef_ask
12296else
12297 echo 'times() NOT found, hope that will do.' >&4
12298 d_times="$undef"
12299 clocktype='int'
12300fi
12301
12302: see if truncate exists
12303set truncate d_truncate
12304eval $inlibc
12305
12306: see if tzname[] exists
12307echo " "
12308if set tzname val -a d_tzname; eval $csym; $val; then
12309 val="$define"
12310 echo 'tzname[] found.' >&4
12311else
12312 val="$undef"
12313 echo 'tzname[] NOT found.' >&4
12314fi
12315set d_tzname
12316eval $setvar
12317
12318: see if umask exists
12319set umask d_umask
12320eval $inlibc
12321
12322: see if ustat exists
12323set ustat d_ustat
12324eval $inlibc
12325
12326: backward compatibility for d_hvfork
12327if test X$d_hvfork != X; then
12328 d_vfork="$d_hvfork"
12329 d_hvfork=''
12330fi
12331: see if there is a vfork
12332val=''
12333set vfork val
12334eval $inlibc
12335
12336: Ok, but do we want to use it. vfork is reportedly unreliable in
12337: perl on Solaris 2.x, and probably elsewhere.
12338case "$val" in
12339$define)
12340 echo " "
12341 case "$usevfork" in
12342 false) dflt='n';;
12343 *) dflt='y';;
12344 esac
12345 cat <<'EOM'
12346
12347Perl can only use a vfork() that doesn't suffer from strict
12348restrictions on calling functions or modifying global data in
12349the child. For example, glibc-2.1 contains such a vfork()
12350that is unsuitable. If your system provides a proper fork()
12351call, chances are that you do NOT want perl to use vfork().
12352
12353EOM
12354 rp="Do you still want to use vfork()?"
12355 . ./myread
12356 case "$ans" in
12357 y|Y) ;;
12358 *)
12359 echo "Ok, we won't use vfork()."
12360 val="$undef"
12361 ;;
12362 esac
12363 ;;
12364esac
12365set d_vfork
12366eval $setvar
12367case "$d_vfork" in
12368$define) usevfork='true';;
12369*) usevfork='false';;
12370esac
12371
12372: see if this is an sysdir system
12373set sys/dir.h i_sysdir
12374eval $inhdr
12375
12376: see if this is an sysndir system
12377set sys/ndir.h i_sysndir
12378eval $inhdr
12379
12380: see if closedir exists
12381set closedir d_closedir
12382eval $inlibc
12383
12384case "$d_closedir" in
12385"$define")
12386 echo " "
12387 echo "Checking whether closedir() returns a status..." >&4
12388 cat > closedir.c <<EOM
12389#$i_dirent I_DIRENT /**/
12390#$i_sysdir I_SYS_DIR /**/
12391#$i_sysndir I_SYS_NDIR /**/
12392#$i_systypes I_SYS_TYPES /**/
12393
12394#if defined(I_SYS_TYPES)
12395#include <sys/types.h>
12396#endif
12397#if defined(I_DIRENT)
12398#include <dirent.h>
12399#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12400#include <sys/dir.h>
12401#endif
12402#else
12403#ifdef I_SYS_NDIR
12404#include <sys/ndir.h>
12405#else
12406#ifdef I_SYS_DIR
12407#ifdef hp9000s500
12408#include <ndir.h> /* may be wrong in the future */
12409#else
12410#include <sys/dir.h>
12411#endif
12412#endif
12413#endif
12414#endif
12415int main() { return closedir(opendir(".")); }
12416EOM
12417 set closedir
12418 if eval $compile_ok; then
12419 if ./closedir > /dev/null 2>&1 ; then
12420 echo "Yes, it does."
12421 val="$undef"
12422 else
12423 echo "No, it doesn't."
12424 val="$define"
12425 fi
12426 else
12427 echo "(I can't seem to compile the test program--assuming it doesn't)"
12428 val="$define"
12429 fi
12430 ;;
12431*)
12432 val="$undef";
12433 ;;
12434esac
12435set d_void_closedir
12436eval $setvar
12437$rm -f closedir*
b4eb6b3d
JH
12438: see if there is a wait4
12439set wait4 d_wait4
12440eval $inlibc
12441
12442: see if waitpid exists
12443set waitpid d_waitpid
12444eval $inlibc
12445
12446: see if wcstombs exists
12447set wcstombs d_wcstombs
12448eval $inlibc
12449
12450: see if wctomb exists
12451set wctomb d_wctomb
12452eval $inlibc
12453
12454: preserve RCS keywords in files with variable substitution, grrr
12455Date='$Date'
12456Id='$Id'
12457Log='$Log'
12458RCSfile='$RCSfile'
12459Revision='$Revision'
12460
12461case "$crosscompile" in
12462''|[nN]*) crosscompile="$undef" ;;
12463esac
12464
12465case "$osname" in
12466next|rhapsody|darwin) multiarch="$define" ;;
12467esac
12468case "$multiarch" in
12469''|[nN]*) multiarch="$undef" ;;
12470esac
12471
12472: check for alignment requirements
12473echo " "
12474case "$crosscompile$multiarch" in
12475*$define*)
12476 $cat <<EOM
12477You seem to be either cross-compiling or doing a multiarchitecture build,
12478skipping the memory alignment check.
12479
12480EOM
12481 case "$alignbytes" in
12482 '') alignbytes=8 ;;
12483 esac
12484 ;;
12485*)
12486 case "$alignbytes" in
12487 '') echo "Checking alignment constraints..." >&4
12488 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12489 $cat >try.c <<'EOCP'
12490typedef long double NV;
12491EOCP
12492 else
12493 $cat >try.c <<'EOCP'
12494typedef double NV;
12495EOCP
12496 fi
12497 $cat >>try.c <<'EOCP'
12498#include <stdio.h>
12499struct foobar {
12500 char foo;
12501 NV bar;
12502} try_algn;
12503int main()
12504{
12505 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12506 return(0);
12507}
12508EOCP
12509 set try
12510 if eval $compile_ok; then
12511 dflt=`./try`
12512 else
12513 dflt='8'
12514 echo "(I can't seem to compile the test program...)"
12515 fi
12516 ;;
12517 *) dflt="$alignbytes"
12518 ;;
12519 esac
12520 rp="Doubles must be aligned on a how-many-byte boundary?"
12521 . ./myread
12522 alignbytes="$ans"
12523 $rm -f try.c try
12524 ;;
12525esac
12526
12527
12528: set the base revision
12529baserev=5.0
12530
12531: check for ordering of bytes in a long
12532echo " "
12533case "$crosscompile$multiarch" in
12534*$define*)
12535 $cat <<EOM
12536You seem to be either cross-compiling or doing a multiarchitecture build,
12537skipping the byteorder check.
12538
12539EOM
12540 byteorder='0xffff'
12541 ;;
12542*)
12543 case "$byteorder" in
12544 '')
12545 $cat <<'EOM'
12546In the following, larger digits indicate more significance. A big-endian
12547machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12548little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12549machines may have weird orders like 3412. A Cray will report 87654321,
12550an Alpha will report 12345678. If the test program works the default is
12551probably right.
12552I'm now running the test program...
12553EOM
12554 $cat >try.c <<'EOCP'
12555#include <stdio.h>
12556int main()
12557{
12558 int i;
12559 union {
12560 unsigned long l;
12561 char c[sizeof(long)];
12562 } u;
12563
12564 if (sizeof(long) > 4)
12565 u.l = (0x08070605L << 32) | 0x04030201L;
12566 else
12567 u.l = 0x04030201L;
12568 for (i = 0; i < sizeof(long); i++)
12569 printf("%c", u.c[i]+'0');
12570 printf("\n");
12571 exit(0);
12572}
12573EOCP
12574 xxx_prompt=y
12575 set try
12576 if eval $compile && ./try > /dev/null; then
12577 dflt=`./try`
12578 case "$dflt" in
12579 [1-4][1-4][1-4][1-4]|12345678|87654321)
12580 echo "(The test program ran ok.)"
12581 echo "byteorder=$dflt"
12582 xxx_prompt=n
12583 ;;
12584 ????|????????) echo "(The test program ran ok.)" ;;
12585 *) echo "(The test program didn't run right for some reason.)" ;;
12586 esac
12587 else
12588 dflt='4321'
12589 cat <<'EOM'
12590(I can't seem to compile the test program. Guessing big-endian...)
12591EOM
12592 fi
12593 case "$xxx_prompt" in
12594 y)
12595 rp="What is the order of bytes in a long?"
12596 . ./myread
12597 byteorder="$ans"
12598 ;;
12599 *) byteorder=$dflt
12600 ;;
12601 esac
12602 ;;
12603 esac
12604 $rm -f try.c try
12605 ;;
12606esac
12607
12608
12609: how do we catenate cpp tokens here?
12610echo " "
12611echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12612$cat >cpp_stuff.c <<'EOCP'
12613#define RCAT(a,b)a/**/b
12614#define ACAT(a,b)a ## b
12615RCAT(Rei,ser)
12616ACAT(Cir,cus)
12617EOCP
12618$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12619if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12620 echo "Oh! Smells like ANSI's been here." >&4
12621 echo "We can catify or stringify, separately or together!"
12622 cpp_stuff=42
12623elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12624 echo "Ah, yes! The good old days!" >&4
12625 echo "However, in the good old days we don't know how to stringify and"
12626 echo "catify at the same time."
12627 cpp_stuff=1
12628else
12629 $cat >&4 <<EOM
12630Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
12631to have to edit the values of CAT[2-5] in config.h...
12632EOM
12633 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12634fi
12635$rm -f cpp_stuff.*
12636
12637: see if this is a db.h system
12638set db.h i_db
12639eval $inhdr
12640
12641case "$i_db" in
12642$define)
12643 : Check db version.
12644 echo " "
12645 echo "Checking Berkeley DB version ..." >&4
12646 $cat >try.c <<EOCP
12647#$d_const HASCONST
12648#ifndef HASCONST
12649#define const
12650#endif
12651#include <sys/types.h>
12652#include <stdio.h>
12653#include <db.h>
12654int main()
12655{
12656#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12657 int Major, Minor, Patch ;
12658 unsigned long Version ;
12659 (void)db_version(&Major, &Minor, &Patch) ;
12660 printf("You have Berkeley DB Version 2 or greater\n");
12661
12662 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12663 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12664 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12665 Major, Minor, Patch) ;
12666
12667 /* check that db.h & libdb are compatible */
12668 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12669 printf("db.h and libdb are incompatible\n") ;
12670 exit(3);
12671 }
12672
12673 printf("db.h and libdb are compatible\n") ;
12674
12675 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12676 + DB_VERSION_PATCH ;
12677
12678 /* needs to be >= 2.3.4 */
12679 if (Version < 2003004) {
12680 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12681 printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12682 exit(2);
12683 }
12684
12685 exit(0);
12686#else
12687#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12688 printf("You have Berkeley DB Version 1\n");
12689 exit(0); /* DB version < 2: the coast is clear. */
12690#else
12691 exit(1); /* <db.h> not Berkeley DB? */
12692#endif
12693#endif
12694}
12695EOCP
12696 set try
12697 if eval $compile_ok && ./try; then
12698 echo 'Looks OK.' >&4
12699 else
12700 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
12701 i_db=$undef
12702 case " $libs " in
12703 *"-ldb "*)
12704 : Remove db from list of libraries to use
12705 echo "Removing unusable -ldb from library list" >&4
12706 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12707 shift
12708 libs="$*"
12709 echo "libs = $libs" >&4
12710 ;;
12711 esac
12712 fi
12713 $rm -f try.*
12714 ;;
12715esac
12716
12717case "$i_db" in
12718define)
12719 : Check the return type needed for hash
12720 echo " "
12721 echo "Checking return type needed for hash for Berkeley DB ..." >&4
12722 $cat >try.c <<EOCP
12723#$d_const HASCONST
12724#ifndef HASCONST
12725#define const
12726#endif
12727#include <sys/types.h>
12728#include <db.h>
12729
12730#ifndef DB_VERSION_MAJOR
12731u_int32_t hash_cb (ptr, size)
12732const void *ptr;
12733size_t size;
12734{
12735}
12736HASHINFO info;
12737int main()
12738{
12739 info.hash = hash_cb;
12740}
12741#endif
12742EOCP
12743 if $cc $ccflags -c try.c >try.out 2>&1 ; then
12744 if $contains warning try.out >>/dev/null 2>&1 ; then
12745 db_hashtype='int'
12746 else
12747 db_hashtype='u_int32_t'
12748 fi
12749 else
12750 : XXX Maybe we should just give up here.
12751 db_hashtype=u_int32_t
12752 $cat try.out >&4
12753 echo "Help: I can't seem to compile the db test program." >&4
12754 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12755 fi
12756 $rm -f try.*
12757 echo "Your version of Berkeley DB uses $db_hashtype for hash."
12758 ;;
12759*) db_hashtype=u_int32_t
12760 ;;
12761esac
12762case "$i_db" in
12763define)
12764 : Check the return type needed for prefix
12765 echo " "
12766 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12767 cat >try.c <<EOCP
12768#$d_const HASCONST
12769#ifndef HASCONST
12770#define const
12771#endif
12772#include <sys/types.h>
12773#include <db.h>
12774
12775#ifndef DB_VERSION_MAJOR
12776size_t prefix_cb (key1, key2)
12777const DBT *key1;
12778const DBT *key2;
12779{
12780}
12781BTREEINFO info;
12782int main()
12783{
12784 info.prefix = prefix_cb;
12785}
12786#endif
12787EOCP
12788 if $cc $ccflags -c try.c >try.out 2>&1 ; then
12789 if $contains warning try.out >>/dev/null 2>&1 ; then
12790 db_prefixtype='int'
12791 else
12792 db_prefixtype='size_t'
12793 fi
12794 else
12795 db_prefixtype='size_t'
12796 : XXX Maybe we should just give up here.
12797 $cat try.out >&4
12798 echo "Help: I can't seem to compile the db test program." >&4
12799 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12800 fi
12801 $rm -f try.*
12802 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12803 ;;
12804*) db_prefixtype='size_t'
12805 ;;
12806esac
12807
12808: check for void type
12809echo " "
12810echo "Checking to see how well your C compiler groks the void type..." >&4
12811case "$voidflags" in
12812'')
12813 $cat >try.c <<'EOCP'
12814#if TRY & 1
12815void sub() {
12816#else
12817sub() {
12818#endif
12819 extern void moo(); /* function returning void */
12820 void (*goo)(); /* ptr to func returning void */
12821#if TRY & 8
12822 void *hue; /* generic ptr */
12823#endif
12824#if TRY & 2
12825 void (*foo[10])();
12826#endif
12827
12828#if TRY & 4
12829 if(goo == moo) {
12830 exit(0);
12831 }
12832#endif
12833 exit(0);
12834}
12835int main() { sub(); }
12836EOCP
12837 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12838 voidflags=$defvoidused
12839 echo "Good. It appears to support void to the level $package wants.">&4
12840 if $contains warning .out >/dev/null 2>&1; then
12841 echo "However, you might get some warnings that look like this:"
12842 $cat .out
12843 fi
12844 else
12845echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12846 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12847 echo "It supports 1..."
12848 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12849 echo "It also supports 2..."
12850 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12851 voidflags=7
12852 echo "And it supports 4 but not 8 definitely."
12853 else
12854 echo "It doesn't support 4..."
12855 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12856 voidflags=11
12857 echo "But it supports 8."
12858 else
12859 voidflags=3
12860 echo "Neither does it support 8."
12861 fi
12862 fi
12863 else
12864 echo "It does not support 2..."
12865 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12866 voidflags=13
12867 echo "But it supports 4 and 8."
12868 else
12869 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12870 voidflags=5
12871 echo "And it supports 4 but has not heard about 8."
12872 else
12873 echo "However it supports 8 but not 4."
12874 fi
12875 fi
12876 fi
12877 else
12878 echo "There is no support at all for void."
12879 voidflags=0
12880 fi
12881 fi
12882esac
12883case "$voidflags" in
12884"$defvoidused") ;;
12885*) $cat >&4 <<'EOM'
12886 Support flag bits are:
12887 1: basic void declarations.
12888 2: arrays of pointers to functions returning void.
12889 4: operations between pointers to and addresses of void functions.
12890 8: generic void pointers.
12891EOM
12892 dflt="$voidflags";
12893 rp="Your void support flags add up to what?"
12894 . ./myread
12895 voidflags="$ans"
12896 ;;
12897esac
12898$rm -f try.* .out
12899
12900
12901: How can we generate normalized random numbers ?
12902echo " "
12903echo "Looking for a random number function..." >&4
12904case "$randfunc" in
12905'')
12906 if set drand48 val -f; eval $csym; $val; then
12907 dflt="drand48"
12908 echo "Good, found drand48()." >&4
12909 elif set random val -f; eval $csym; $val; then
12910 dflt="random"
12911 echo "OK, found random()." >&4
12912 else
12913 dflt="rand"
12914 echo "Yick, looks like I have to use rand()." >&4
12915 fi
12916 echo " "
12917 ;;
12918*)
12919 dflt="$randfunc"
12920 ;;
12921esac
12922cont=true
12923
12924case "$ccflags" in
12925*-Dmy_rand=*|*-Dmy_srand=*)
12926 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12927 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12928 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12929 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12930 ;;
12931esac
12932
12933while $test "$cont"; do
12934 rp="Use which function to generate random numbers?"
12935 . ./myread
12936 if $test "$ans" = "$dflt"; then
12937 : null
12938 else
12939 randbits=''
12940 fi
12941 randfunc="$ans"
12942 if set $ans val -f; eval $csym; $val; then
12943 cont=''
12944 else
12945 dflt=y
12946 rp="I cannot find function $ans. Use that name anyway?"
12947 . ./myread
12948 dflt=rand
12949 case "$ans" in
12950 [yY]*) cont='';;
12951 esac
12952 fi
12953 case "$cont" in
12954 '')
12955 case "$randfunc" in
12956 drand48)
12957 drand01="drand48()"
12958 seedfunc="srand48"
12959 randbits=48
12960 randseedtype=long
12961 ;;
12962 rand|random)
12963 case "$randbits" in
12964 '')
12965echo "Checking to see how many bits your $randfunc() function produces..." >&4
12966 $cat >try.c <<EOCP
12967#$i_unistd I_UNISTD
12968#$i_stdlib I_STDLIB
12969#include <stdio.h>
12970#ifdef I_UNISTD
12971# include <unistd.h>
12972#endif
12973#ifdef I_STDLIB
12974# include <stdlib.h>
12975#endif
12976int main()
12977{
12978 register int i;
12979 register unsigned long tmp;
12980 register unsigned long max = 0L;
12981
12982 for (i = 1000; i; i--) {
12983 tmp = (unsigned long) $randfunc();
12984 if (tmp > max) max = tmp;
12985 }
12986 for (i = 0; max; i++)
12987 max /= 2;
12988 printf("%d\n",i);
12989}
12990EOCP
12991 set try
12992 if eval $compile_ok; then
12993 dflt=`try`
12994 else
12995 dflt='?'
12996 echo "(I can't seem to compile the test program...)"
12997 fi
12998 ;;
12999 *)
13000 dflt="$randbits"
13001 ;;
13002 esac
13003 rp="How many bits does your $randfunc() function produce?"
13004 . ./myread
13005 randbits="$ans"
13006 $rm -f try.c try
13007 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13008 seedfunc="s$randfunc"
13009 randseedtype=unsigned
13010 ;;
13011 *)
13012 dflt="31"
13013 rp="How many bits does your $randfunc() function produce?"
13014 . ./myread
13015 randbits="$ans"
13016 seedfunc="s$randfunc"
13017 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13018 if set $seedfunc val -f; eval $csym; $val; then
13019 echo "(Using $seedfunc() to seed random generator)"
13020 else
13021 echo "(Warning: no $seedfunc() to seed random generator)"
13022 seedfunc=rand
13023 fi
13024 randseedtype=unsigned
13025 ;;
13026 esac
13027 ;;
13028 esac
13029done
13030
13031echo " "
13032echo "Determining whether or not we are on an EBCDIC system..." >&4
13033$cat >tebcdic.c <<'EOM'
13034int main()
13035{
13036 if ('M'==0xd4) return 0;
13037 return 1;
13038}
13039EOM
13040
13041val=$undef
13042set tebcdic
13043if eval $compile_ok; then
13044 if ./tebcdic; then
13045 echo "You seem to speak EBCDIC." >&4
13046 val="$define"
13047 else
13048 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13049 fi
13050else
13051 echo "I'm unable to compile the test program." >&4
13052 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13053fi
13054$rm -f tebcdic.c tebcdic
13055set ebcdic
13056eval $setvar
13057
13058echo " "
13059$cat >&4 <<EOM
13060Checking how to flush all pending stdio output...
13061EOM
13062# I only know how to find the first 32 possibly open files on SunOS.
13063# See also hints/sunos_4_1.sh and util.c --AD
13064case "$osname" in
13065sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13066esac
13067$cat >>try.c <<EOCP
13068#include <stdio.h>
13069#$i_unistd I_UNISTD
13070#ifdef I_UNISTD
13071# include <unistd.h>
13072#endif
13073#$d_sysconf HAS_SYSCONF
13074#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13075#ifdef HAS_STDIO_STREAM_ARRAY
13076# define STDIO_STREAM_ARRAY $stdio_stream_array
13077#endif
13078int main() {
13079 FILE* p = fopen("try.out", "w");
13080#ifdef TRY_FPUTC
13081 fputc('x', p);
13082#else
13083# ifdef TRY_FPRINTF
13084 fprintf(p, "x");
13085# endif
13086#endif
13087#ifdef TRY_FFLUSH_NULL
13088 fflush(NULL);
13089#endif
13090#ifdef TRY_FFLUSH_ALL
13091 {
13092 long open_max = -1;
13093# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13094 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13095# else
13096# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13097 open_max = sysconf(_SC_OPEN_MAX);
13098# else
13099# ifdef FOPEN_MAX
13100 open_max = FOPEN_MAX;
13101# else
13102# ifdef OPEN_MAX
13103 open_max = OPEN_MAX;
13104# else
13105# ifdef _NFILE
13106 open_max = _NFILE;
13107# endif
13108# endif
13109# endif
13110# endif
13111# endif
13112# ifdef HAS_STDIO_STREAM_ARRAY
13113 if (open_max > 0) {
13114 long i;
13115 for (i = 0; i < open_max; i++)
13116 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13117 STDIO_STREAM_ARRAY[i]._file < open_max &&
13118 STDIO_STREAM_ARRAY[i]._flag)
13119 fflush(&STDIO_STREAM_ARRAY[i]);
13120 }
13121 }
13122# endif
13123#endif
13124 _exit(42);
13125}
13126EOCP
13127: first we have to find out how _not_ to flush
13128if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13129 output=''
13130 set try -DTRY_FPUTC
13131 if eval $compile; then
13132 $rm -f try.out
13133 ./try$exe_ext 2>/dev/null
13134 if $test ! -s try.out -a "X$?" = X42; then
13135 output=-DTRY_FPUTC
13136 fi
13137 fi
13138 case "$output" in
13139 '')
13140 set try -DTRY_FPRINTF
13141 $rm -f try.out
13142 if eval $compile; then
13143 $rm -f try.out
13144 ./try$exe_ext 2>/dev/null
13145 if $test ! -s try.out -a "X$?" = X42; then
13146 output=-DTRY_FPRINTF
13147 fi
13148 fi
13149 ;;
13150 esac
13151fi
13152: check for fflush NULL behaviour
13153case "$fflushNULL" in
13154'') set try -DTRY_FFLUSH_NULL $output
13155 if eval $compile; then
13156 $rm -f try.out
13157 ./try$exe_ext 2>/dev/null
13158 code="$?"
13159 if $test -s try.out -a "X$code" = X42; then
13160 fflushNULL="`$cat try.out`"
13161 else
13162 if $test "X$code" != X42; then
13163 $cat >&4 <<EOM
13164(If this test failed, don't worry, we'll try another method shortly.)
13165EOM
13166 fi
13167 fi
13168 fi
13169 $rm -f core try.core core.try.*
13170 case "$fflushNULL" in
13171 x) $cat >&4 <<EOM
13172Your fflush(NULL) works okay for output streams.
13173Let's see if it clobbers input pipes...
13174EOM
13175# As of mid-March 2000 all versions of Solaris appear to have a stdio
13176# bug that improperly flushes the input end of pipes. So we avoid the
13177# autoflush on fork/system/exec support for now. :-(
13178$cat >tryp.c <<EOCP
13179#include <stdio.h>
13180int
13181main(int argc, char **argv)
13182{
13183 char buf[1024];
13184 int i;
13185 char *bp = buf;
13186 while (1) {
13187 while ((i = getc(stdin)) != -1
13188 && (*bp++ = i) != '\n'
13189 && bp < &buf[1024])
13190 /* DO NOTHING */ ;
13191 *bp = '\0';
13192 fprintf(stdout, "%s", buf);
13193 fflush(NULL);
13194 if (i == -1)
13195 return 0;
13196 bp = buf;
13197 }
13198}
13199EOCP
13200 fflushNULL="$define"
13201 set tryp
13202 if eval $compile; then
13203 $rm -f tryp.out
13204 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13205 if cmp tryp.c tryp.out >/dev/null 2>&1; then
13206 $cat >&4 <<EOM
13207fflush(NULL) seems to behave okay with input streams.
13208EOM
13209 fflushNULL="$define"
13210 else
13211 $cat >&4 <<EOM
13212Ouch, fflush(NULL) clobbers input pipes! We will not use it.
13213EOM
13214 fflushNULL="$undef"
13215 fi
13216 fi
13217 $rm -f core tryp.c tryp.core core.tryp.*
13218 ;;
13219 '') $cat >&4 <<EOM
13220Your fflush(NULL) isn't working (contrary to ANSI C).
13221EOM
13222 fflushNULL="$undef"
13223 ;;
13224 *) $cat >&4 <<EOM
13225Cannot figure out whether your fflush(NULL) works or not.
13226I'm assuming it doesn't (contrary to ANSI C).
13227EOM
13228 fflushNULL="$undef"
13229 ;;
13230 esac
13231 ;;
13232$define|true|[yY]*)
13233 fflushNULL="$define"
13234 ;;
13235*)
13236 fflushNULL="$undef"
13237 ;;
13238esac
13239: check explicit looping only if NULL did not work, and if the pipe
13240: bug does not show up on an explicit flush too
13241case "$fflushNULL" in
13242"$undef")
13243 $cat >tryp.c <<EOCP
13244#include <stdio.h>
13245int
13246main(int argc, char **argv)
13247{
13248 char buf[1024];
13249 int i;
13250 char *bp = buf;
13251 while (1) {
13252 while ((i = getc(stdin)) != -1
13253 && (*bp++ = i) != '\n'
13254 && bp < &buf[1024])
13255 /* DO NOTHING */ ;
13256 *bp = '\0';
13257 fprintf(stdout, "%s", buf);
13258 fflush(stdin);
13259 if (i == -1)
13260 return 0;
13261 bp = buf;
13262 }
13263}
13264EOCP
13265 set tryp
13266 if eval $compile; then
13267 $rm -f tryp.out
13268 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13269 if cmp tryp.c tryp.out >/dev/null 2>&1; then
13270 $cat >&4 <<EOM
13271Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13272EOM
13273 : now check for fflushall behaviour
13274 case "$fflushall" in
13275 '') set try -DTRY_FFLUSH_ALL $output
13276 if eval $compile; then
13277 $cat >&4 <<EOM
13278(Now testing the other method--but note that this also may fail.)
13279EOM
13280 $rm -f try.out
13281 ./try$exe_ext 2>/dev/null
13282 if $test -s try.out -a "X$?" = X42; then
13283 fflushall="`$cat try.out`"
13284 fi
13285 fi
13286 $rm -f core try.core core.try.*
13287 case "$fflushall" in
13288 x) $cat >&4 <<EOM
13289Whew. Flushing explicitly all the stdio streams works.
13290EOM
13291 fflushall="$define"
13292 ;;
13293 '') $cat >&4 <<EOM
13294Sigh. Flushing explicitly all the stdio streams doesn't work.
13295EOM
13296 fflushall="$undef"
13297 ;;
13298 *) $cat >&4 <<EOM
13299Cannot figure out whether flushing stdio streams explicitly works or not.
13300I'm assuming it doesn't.
13301EOM
13302 fflushall="$undef"
13303 ;;
13304 esac
13305 ;;
13306 "$define"|true|[yY]*)
13307 fflushall="$define"
13308 ;;
13309 *)
13310 fflushall="$undef"
13311 ;;
13312 esac
13313 else
13314 $cat >&4 <<EOM
13315All is futile. Even fflush(stdin) clobbers input pipes!
13316EOM
13317 fflushall="$undef"
13318 fi
13319 else
13320 fflushall="$undef"
13321 fi
13322 $rm -f core tryp.c tryp.core core.tryp.*
13323 ;;
13324*) fflushall="$undef"
13325 ;;
13326esac
13327
13328case "$fflushNULL$fflushall" in
13329undefundef)
13330 $cat <<EOM
13331OK, I give up. I cannot figure out how to flush pending stdio output.
13332We won't be flushing handles at all before fork/exec/popen.
13333EOM
13334 ;;
13335esac
13336$rm -f try.* try$exe_ext
13337
13338: Store the full pathname to the ar program for use in the C program
13339: Respect a hint or command line value for full_ar.
13340case "$full_ar" in
13341'') full_ar=$ar ;;
13342esac
13343
13344: Store the full pathname to the sed program for use in the C program
13345full_sed=$sed
13346
13347: see what type gids are declared as in the kernel
13348echo " "
13349echo "Looking for the type for group ids returned by getgid()."
13350set gid_t gidtype xxx stdio.h sys/types.h
13351eval $typedef
13352case "$gidtype" in
13353xxx)
13354 xxx=`./findhdr sys/user.h`
13355 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13356 case $1 in
13357 unsigned) dflt="$1 $2" ;;
13358 *) dflt="$1" ;;
13359 esac
13360 ;;
13361*) dflt="$gidtype";;
13362esac
13363case "$gidtype" in
13364gid_t) echo "gid_t found." ;;
13365*) rp="What is the type for group ids returned by getgid()?"
13366 . ./myread
13367 gidtype="$ans"
13368 ;;
13369esac
13370
13371echo " "
13372case "$gidtype" in
13373*_t) zzz="$gidtype" ;;
13374*) zzz="gid" ;;
13375esac
13376echo "Checking the size of $zzz..." >&4
13377cat > try.c <<EOCP
13378#include <sys/types.h>
13379#include <stdio.h>
13380int main() {
13381 printf("%d\n", (int)sizeof($gidtype));
13382 exit(0);
13383}
13384EOCP
13385set try
13386if eval $compile_ok; then
13387 yyy=`./try`
13388 case "$yyy" in
13389 '') gidsize=4
13390 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13391 ;;
13392 *) gidsize=$yyy
13393 echo "Your $zzz is $gidsize bytes long."
13394 ;;
13395 esac
13396else
13397 gidsize=4
13398 echo "(I can't compile the test program--guessing $gidsize.)" >&4
13399fi
13400
13401
13402echo " "
13403case "$gidtype" in
13404*_t) zzz="$gidtype" ;;
13405*) zzz="gid" ;;
13406esac
13407echo "Checking the sign of $zzz..." >&4
13408cat > try.c <<EOCP
13409#include <sys/types.h>
13410#include <stdio.h>
13411int main() {
13412 $gidtype foo = -1;
13413 if (foo < 0)
13414 printf("-1\n");
13415 else
13416 printf("1\n");
13417}
13418EOCP
13419set try
13420if eval $compile; then
13421 yyy=`./try`
13422 case "$yyy" in
13423 '') gidsign=1
13424 echo "(I can't execute the test program--guessing unsigned.)" >&4
13425 ;;
13426 *) gidsign=$yyy
13427 case "$gidsign" in
13428 1) echo "Your $zzz is unsigned." ;;
13429 -1) echo "Your $zzz is signed." ;;
13430 esac
13431 ;;
13432 esac
13433else
13434 gidsign=1
13435 echo "(I can't compile the test program--guessing unsigned.)" >&4
13436fi
13437
13438
13439echo " "
13440
13441if $test X"$quadtype" != X; then
13442
13443echo "Checking how to print 64-bit integers..." >&4
13444
13445if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13446 $cat >try.c <<'EOCP'
13447#include <sys/types.h>
13448#include <stdio.h>
13449int main() {
13450 int q = 12345678901;
13451 printf("%ld\n", q);
13452}
13453EOCP
13454 set try
13455 if eval $compile; then
13456 yyy=`./try$exe_ext`
13457 case "$yyy" in
13458 12345678901)
13459 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13460 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13461 echo "We will use %d."
13462 ;;
13463 esac
13464 fi
13465fi
13466
13467if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13468 $cat >try.c <<'EOCP'
13469#include <sys/types.h>
13470#include <stdio.h>
13471int main() {
13472 long q = 12345678901;
13473 printf("%ld\n", q);
13474}
13475EOCP
13476 set try
13477 if eval $compile; then
13478 yyy=`./try$exe_ext`
13479 case "$yyy" in
13480 12345678901)
13481 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13482 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13483 echo "We will use %ld."
13484 ;;
13485 esac
13486 fi
13487fi
13488
13489if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13490 $cat >try.c <<'EOCP'
13491#include <sys/types.h>
13492#include <inttypes.h>
13493#include <stdio.h>
13494int main() {
13495 int64_t q = 12345678901;
13496 printf("%" PRId64 "\n", q);
13497}
13498EOCP
13499 set try
13500 if eval $compile; then
13501 yyy=`./try$exe_ext`
13502 case "$yyy" in
13503 12345678901)
13504 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13505 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13506 echo "We will use the C9X style."
13507 ;;
13508 esac
13509 fi
13510fi
13511
13512if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13513 $cat >try.c <<'EOCP'
13514#include <sys/types.h>
13515#include <stdio.h>
13516int main() {
13517 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13518 printf("%lld\n", q);
13519}
13520EOCP
13521 set try
13522 if eval $compile; then
13523 yyy=`./try$exe_ext`
13524 case "$yyy" in
13525 12345678901)
13526 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13527 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13528 echo "We will use the %lld style."
13529 ;;
13530 esac
13531 fi
13532fi
13533
13534if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13535 $cat >try.c <<EOCP
13536#include <sys/types.h>
13537#include <stdio.h>
13538int main() {
13539 $quadtype q = 12345678901;
13540 printf("%Ld\n", q);
13541}
13542EOCP
13543 set try
13544 if eval $compile; then
13545 yyy=`./try$exe_ext`
13546 case "$yyy" in
13547 12345678901)
13548 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13549 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13550 echo "We will use %Ld."
13551 ;;
13552 esac
13553 fi
13554fi
13555
13556if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13557 $cat >try.c <<EOCP
13558#include <sys/types.h>
13559#include <stdio.h>
13560int main() {
13561 $quadtype q = 12345678901;
13562 printf("%qd\n", q);
13563}
13564EOCP
13565 set try
13566 if eval $compile; then
13567 yyy=`./try$exe_ext`
13568 case "$yyy" in
13569 12345678901)
13570 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13571 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13572 echo "We will use %qd."
13573 ;;
13574 esac
13575 fi
13576fi
13577
13578if $test X"$sPRId64" = X; then
13579 echo "Cannot figure out how to print 64-bit integers." >&4
13580fi
13581
13582$rm -f try try.*
13583
13584fi
13585
13586case "$sPRId64" in
13587'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
13588 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
13589 ;;
13590*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
13591 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
13592 ;;
13593esac
13594
13595
13596echo " "
13597$echo "Checking the format strings to be used for Perl's internal types..." >&4
13598
13599if $test X"$ivsize" = X8; then
13600 ivdformat="$sPRId64"
13601 uvuformat="$sPRIu64"
13602 uvoformat="$sPRIo64"
13603 uvxformat="$sPRIx64"
13604 uvXUformat="$sPRIXU64"
13605else
13606 if $test X"$ivsize" = X"$longsize"; then
13607 ivdformat='"ld"'
13608 uvuformat='"lu"'
13609 uvoformat='"lo"'
13610 uvxformat='"lx"'
13611 uvXUformat='"lX"'
13612 else
13613 if $test X"$ivsize" = X"$intsize"; then
13614 ivdformat='"d"'
13615 uvuformat='"u"'
13616 uvoformat='"o"'
13617 uvxformat='"x"'
13618 uvXUformat='"X"'
13619 else
13620 : far out
13621 if $test X"$ivsize" = X"$shortsize"; then
13622 ivdformat='"hd"'
13623 uvuformat='"hu"'
13624 uvoformat='"ho"'
13625 uvxformat='"hx"'
13626 uvXUformat='"hX"'
13627 fi
13628 fi
13629 fi
13630fi
13631
13632if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13633 nveformat="$sPRIeldbl"
13634 nvfformat="$sPRIfldbl"
13635 nvgformat="$sPRIgldbl"
13636 nvEUformat="$sPRIEUldbl"
13637 nvFUformat="$sPRIFUldbl"
13638 nvGUformat="$sPRIGUldbl"
13639else
13640 nveformat='"e"'
13641 nvfformat='"f"'
13642 nvgformat='"g"'
13643 nvEUformat='"E"'
13644 nvFUformat='"F"'
13645 nvGUformat='"G"'
13646fi
13647
13648case "$ivdformat" in
13649'') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13650 exit 1
13651 ;;
13652esac
13653
13654
13655echo " "
13656$echo "Checking the format string to be used for gids..." >&4
13657
13658case "$gidsign" in
13659-1) if $test X"$gidsize" = X"$ivsize"; then
13660 gidformat="$ivdformat"
13661 else
13662 if $test X"$gidsize" = X"$longsize"; then
13663 gidformat='"ld"'
13664 else
13665 if $test X"$gidsize" = X"$intsize"; then
13666 gidformat='"d"'
13667 else
13668 if $test X"$gidsize" = X"$shortsize"; then
13669 gidformat='"hd"'
13670 fi
13671 fi
13672 fi
13673 fi
13674 ;;
13675*) if $test X"$gidsize" = X"$uvsize"; then
13676 gidformat="$uvuformat"
13677 else
13678 if $test X"$gidsize" = X"$longsize"; then
13679 gidformat='"lu"'
13680 else
13681 if $test X"$gidsize" = X"$intsize"; then
13682 gidformat='"u"'
13683 else
13684 if $test X"$gidsize" = X"$shortsize"; then
13685 gidformat='"hu"'
13686 fi
13687 fi
13688 fi
13689 fi
13690 ;;
13691esac
13692
13693: see if getgroups exists
13694set getgroups d_getgrps
13695eval $inlibc
13696
13697: see if setgroups exists
13698set setgroups d_setgrps
13699eval $inlibc
13700
13701
13702: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13703echo " "
13704case "$d_getgrps$d_setgrps" in
13705*define*)
13706 case "$groupstype" in
13707 '') dflt="$gidtype" ;;
13708 *) dflt="$groupstype" ;;
13709 esac
13710 $cat <<EOM
13711What type of pointer is the second argument to getgroups() and setgroups()?
13712Usually this is the same as group ids, $gidtype, but not always.
13713
13714EOM
13715 rp='What type pointer is the second argument to getgroups() and setgroups()?'
13716 . ./myread
13717 groupstype="$ans"
13718 ;;
13719*) groupstype="$gidtype";;
13720esac
13721
13722echo " "
13723echo "Checking if your $make program sets \$(MAKE)..." >&4
13724case "$make_set_make" in
13725'')
13726 $sed 's/^X //' > testmake.mak << 'EOF'
13727Xall:
13728X @echo 'maketemp="$(MAKE)"'
13729EOF
13730 case "`$make -f testmake.mak 2>/dev/null`" in
13731 *maketemp=*) make_set_make='#' ;;
13732 *) make_set_make="MAKE=$make" ;;
13733 esac
13734 $rm -f testmake.mak
13735 ;;
13736esac
13737case "$make_set_make" in
13738'#') echo "Yup, it does.";;
13739*) echo "Nope, it doesn't.";;
13740esac
13741
13742: see what type is used for mode_t
13743rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13744set mode_t modetype int stdio.h sys/types.h
13745eval $typedef_ask
13746
2cc61e15
DD
13747: see if stdarg is available
13748echo " "
13749if $test `./findhdr stdarg.h`; then
13750 echo "<stdarg.h> found." >&4
13751 valstd="$define"
13752else
13753 echo "<stdarg.h> NOT found." >&4
13754 valstd="$undef"
13755fi
13756
13757: see if varags is available
13758echo " "
13759if $test `./findhdr varargs.h`; then
13760 echo "<varargs.h> found." >&4
13761else
13762 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13763fi
13764
13765: set up the varargs testing programs
13766$cat > varargs.c <<EOP
13767#ifdef I_STDARG
13768#include <stdarg.h>
13769#endif
13770#ifdef I_VARARGS
13771#include <varargs.h>
13772#endif
13773
13774#ifdef I_STDARG
13775int f(char *p, ...)
13776#else
13777int f(va_alist)
13778va_dcl
13779#endif
13780{
13781 va_list ap;
13782#ifndef I_STDARG
13783 char *p;
13784#endif
13785#ifdef I_STDARG
13786 va_start(ap,p);
13787#else
13788 va_start(ap);
13789 p = va_arg(ap, char *);
13790#endif
13791 va_end(ap);
13792}
13793EOP
13794$cat > varargs <<EOP
13795$startsh
13796if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13797 echo "true"
13798else
13799 echo "false"
13800fi
13801$rm -f varargs$_o
13802EOP
13803chmod +x varargs
13804
13805: now check which varargs header should be included
13806echo " "
13807i_varhdr=''
13808case "$valstd" in
13809"$define")
13810 if `./varargs I_STDARG`; then
13811 val='stdarg.h'
13812 elif `./varargs I_VARARGS`; then
13813 val='varargs.h'
13814 fi
13815 ;;
13816*)
13817 if `./varargs I_VARARGS`; then
13818 val='varargs.h'
13819 fi
13820 ;;
13821esac
13822case "$val" in
13823'')
13824echo "I could not find the definition for va_dcl... You have problems..." >&4
13825 val="$undef"; set i_stdarg; eval $setvar
13826 val="$undef"; set i_varargs; eval $setvar
13827 ;;
13828*)
13829 set i_varhdr
13830 eval $setvar
13831 case "$i_varhdr" in
13832 stdarg.h)
13833 val="$define"; set i_stdarg; eval $setvar
13834 val="$undef"; set i_varargs; eval $setvar
13835 ;;
13836 varargs.h)
13837 val="$undef"; set i_stdarg; eval $setvar
13838 val="$define"; set i_varargs; eval $setvar
13839 ;;
13840 esac
13841 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13842esac
13843$rm -f varargs*
13844
13845: see if we need va_copy
13846echo " "
13847case "$i_stdarg" in
13848"$define")
13849 $cat >try.c <<EOCP
13850#include <stdarg.h>
13851#include <stdio.h>
85c8a686
DD
13852#$i_stdlib I_STDLIB
13853#ifdef I_STDLIB
13854#include <stdlib.h>
13855#endif
13856#include <signal.h>
2cc61e15
DD
13857
13858int
13859ivfprintf(FILE *f, const char *fmt, va_list *valp)
13860{
13861 return vfprintf(f, fmt, *valp);
13862}
13863
13864int
13865myvfprintf(FILE *f, const char *fmt, va_list val)
13866{
13867 return ivfprintf(f, fmt, &val);
13868}
13869
13870int
13871myprintf(char *fmt, ...)
13872{
13873 va_list val;
13874 va_start(val, fmt);
13875 return myvfprintf(stdout, fmt, val);
13876}
13877
13878int
13879main(int ac, char **av)
13880{
85c8a686
DD
13881 signal(SIGSEGV, exit);
13882
2cc61e15
DD
13883 myprintf("%s%cs all right, then\n", "that", '\'');
13884 exit(0);
13885}
13886EOCP
13887 set try
d50de4df 13888 if eval $compile && ./try 2>&1 >/dev/null; then
2cc61e15
DD
13889 case "`./try`" in
13890 "that's all right, then")
13891 okay=yes
13892 ;;
13893 esac
13894 fi
13895 case "$okay" in
13896 yes) echo "It seems that you don't need va_copy()." >&4
13897 need_va_copy="$undef"
13898 ;;
13899 *) echo "It seems that va_copy() or similar will be needed." >&4
13900 need_va_copy="$define"
13901 ;;
13902 esac
13903 $rm -f try.* core core.* *.core *.core.*
13904 ;;
13905*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
13906 ;;
13907esac
13908
b4eb6b3d
JH
13909: define a fucntion to check prototypes
13910$cat > protochk <<EOSH
13911$startsh
13912cc="$cc"
13913optimize="$optimize"
13914ccflags="$ccflags"
13915prototype="$prototype"
13916define="$define"
13917rm=$rm
13918EOSH
13919
13920$cat >> protochk <<'EOSH'
13921
13922$rm -f try.c
13923foo="$1"
13924shift
13925while test $# -ge 2; do
13926 case "$1" in
13927 $define) echo "#include <$2>" >> try.c ;;
13928 literal) echo "$2" >> try.c ;;
13929 esac
13930 shift 2
13931done
13932test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
13933cat >> try.c <<'EOCP'
13934#ifdef CAN_PROTOTYPE
13935#define _(args) args
13936#else
13937#define _(args) ()
13938#endif
13939EOCP
13940echo "$foo" >> try.c
13941echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13942$cc $optimize $ccflags -c try.c > /dev/null 2>&1
13943status=$?
13944$rm -f try.[co]
13945exit $status
13946EOSH
13947chmod +x protochk
13948$eunicefix protochk
13949
13950: see what type is used for size_t
13951rp="What is the type used for the length parameter for string functions?"
13952set size_t sizetype 'unsigned int' stdio.h sys/types.h
13953eval $typedef_ask
13954
13955: check for type of arguments to gethostbyaddr.
13956if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13957 case "$d_gethbyaddr" in
13958 $define)
13959 $cat <<EOM
13960
13961Checking to see what type of arguments are accepted by gethostbyaddr().
13962EOM
13963 hdrs="$define sys/types.h
13964 $d_socket sys/socket.h
13965 $i_niin netinet/in.h
13966 $i_netdb netdb.h
13967 $i_unistd unistd.h"
13968 : The first arg can 'char *' or 'void *'
13969 : The second arg is some of integral type
13970 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13971 for yyy in size_t long int; do
13972 case "$netdb_host_type" in
13973 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13974 if ./protochk "$try" $hdrs; then
13975 echo "Your system accepts $xxx for the first arg."
13976 echo "...and $yyy for the second arg."
13977 netdb_host_type="$xxx"
13978 netdb_hlen_type="$yyy"
13979 fi
13980 ;;
13981 esac
13982 done
13983 done
13984 : In case none of those worked, prompt the user.
13985 case "$netdb_host_type" in
13986 '') rp='What is the type for the 1st argument to gethostbyaddr?'
13987 dflt='char *'
13988 . ./myread
13989 netdb_host_type=$ans
13990 rp='What is the type for the 2nd argument to gethostbyaddr?'
13991 dflt="$sizetype"
13992 . ./myread
13993 netdb_hlen_type=$ans
13994 ;;
13995 esac
13996 ;;
13997 *) : no gethostbyaddr, so pick harmless defaults
13998 netdb_host_type='char *'
13999 netdb_hlen_type="$sizetype"
14000 ;;
14001 esac
14002 # Remove the "const" if needed. -- but then we'll have a
14003 # prototype clash!
14004 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14005fi
14006
14007: check for type of argument to gethostbyname.
14008if test "X$netdb_name_type" = X ; then
14009 case "$d_gethbyname" in
14010 $define)
14011 $cat <<EOM
14012
14013Checking to see what type of argument is accepted by gethostbyname().
14014EOM
14015 hdrs="$define sys/types.h
14016 $d_socket sys/socket.h
14017 $i_niin netinet/in.h
14018 $i_netdb netdb.h
14019 $i_unistd unistd.h"
14020 for xxx in "const char *" "char *"; do
14021 case "$netdb_name_type" in
14022 '') try="extern struct hostent *gethostbyname($xxx);"
14023 if ./protochk "$try" $hdrs; then
14024 echo "Your system accepts $xxx."
14025 netdb_name_type="$xxx"
14026 fi
14027 ;;
14028 esac
14029 done
14030 : In case none of those worked, prompt the user.
14031 case "$netdb_name_type" in
14032 '') rp='What is the type for the 1st argument to gethostbyname?'
14033 dflt='char *'
14034 . ./myread
14035 netdb_name_type=$ans
14036 ;;
14037 esac
14038 ;;
14039 *) : no gethostbyname, so pick harmless default
14040 netdb_name_type='char *'
14041 ;;
14042 esac
14043fi
14044
14045: check for type of 1st argument to getnetbyaddr.
14046if test "X$netdb_net_type" = X ; then
14047 case "$d_getnbyaddr" in
14048 $define)
14049 $cat <<EOM
14050
14051Checking to see what type of 1st argument is accepted by getnetbyaddr().
14052EOM
14053 hdrs="$define sys/types.h
14054 $d_socket sys/socket.h
14055 $i_niin netinet/in.h
14056 $i_netdb netdb.h
14057 $i_unistd unistd.h"
14058 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14059 case "$netdb_net_type" in
14060 '') try="extern struct netent *getnetbyaddr($xxx, int);"
14061 if ./protochk "$try" $hdrs; then
14062 echo "Your system accepts $xxx."
14063 netdb_net_type="$xxx"
14064 fi
14065 ;;
14066 esac
14067 done
14068 : In case none of those worked, prompt the user.
14069 case "$netdb_net_type" in
14070 '') rp='What is the type for the 1st argument to getnetbyaddr?'
14071 dflt='long'
14072 . ./myread
14073 netdb_net_type=$ans
14074 ;;
14075 esac
14076 ;;
14077 *) : no getnetbyaddr, so pick harmless default
14078 netdb_net_type='long'
14079 ;;
14080 esac
14081fi
14082: locate the preferred pager for this system
14083case "$pager" in
14084'')
14085 dflt=''
14086 case "$pg" in
14087 /*) dflt=$pg;;
14088 [a-zA-Z]:/*) dflt=$pg;;
14089 esac
14090 case "$more" in
14091 /*) dflt=$more;;
14092 [a-zA-Z]:/*) dflt=$more;;
14093 esac
14094 case "$less" in
14095 /*) dflt=$less;;
14096 [a-zA-Z]:/*) dflt=$less;;
14097 esac
14098 case "$dflt" in
14099 '') dflt=/usr/ucb/more;;
14100 esac
14101 ;;
14102*) dflt="$pager";;
14103esac
14104echo " "
14105fn=f/
14106rp='What pager is used on your system?'
14107. ./getfile
14108pager="$ans"
14109
14110: see what type pids are declared as in the kernel
14111rp="What is the type of process ids on this system?"
14112set pid_t pidtype int stdio.h sys/types.h
14113eval $typedef_ask
14114
14115: Find earliest binary compatible site_perl subdirectory perl can use.
14116case "$bincompat5005" in
14117"$define") xs_apiversion='5.005' ;;
14118*) xs_apiversion=$version ;; # The current site_perl version.
14119esac
14120: Find earliest pure perl site_perl subdirectory perl can use.
14121: The versioned directories started at 5.005.
14122pm_apiversion='5.005'
14123
14124: check for length of pointer
14125echo " "
14126case "$ptrsize" in
14127'')
14128 echo "Checking to see how big your pointers are..." >&4
14129 if test "$voidflags" -gt 7; then
14130 echo '#define VOID_PTR char *' > try.c
14131 else
14132 echo '#define VOID_PTR void *' > try.c
14133 fi
14134 $cat >>try.c <<'EOCP'
14135#include <stdio.h>
14136int main()
14137{
14138 printf("%d\n", (int)sizeof(VOID_PTR));
14139 exit(0);
14140}
14141EOCP
14142 set try
14143 if eval $compile_ok; then
14144 ptrsize=`./try`
14145 echo "Your pointers are $ptrsize bytes long."
14146 else
14147 dflt='4'
14148 echo "(I can't seem to compile the test program. Guessing...)" >&4
14149 rp="What is the size of a pointer (in bytes)?"
14150 . ./myread
14151 ptrsize="$ans"
14152 fi
14153 ;;
14154esac
14155$rm -f try.c try
14156
14157: see if ar generates random libraries by itself
14158echo " "
14159echo "Checking how to generate random libraries on your machine..." >&4
14160echo 'int bar1() { return bar2(); }' > bar1.c
14161echo 'int bar2() { return 2; }' > bar2.c
14162$cat > foo.c <<'EOP'
14163int main() { printf("%d\n", bar1()); exit(0); }
14164EOP
14165$cc $ccflags -c bar1.c >/dev/null 2>&1
14166$cc $ccflags -c bar2.c >/dev/null 2>&1
14167$cc $ccflags -c foo.c >/dev/null 2>&1
14168$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 14169if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
b4eb6b3d
JH
14170 ./foobar >/dev/null 2>&1; then
14171 echo "$ar appears to generate random libraries itself."
14172 orderlib=false
14173 ranlib=":"
14174elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 14175 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
b4eb6b3d
JH
14176 ./foobar >/dev/null 2>&1; then
14177 echo "a table of contents needs to be added with '$ar ts'."
14178 orderlib=false
14179 ranlib="$ar ts"
14180else
14181 case "$ranlib" in
14182 :) ranlib='';;
14183 '')
14184 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14185 $test -f $ranlib || ranlib=''
14186 ;;
14187 esac
14188 if $test -n "$ranlib"; then
14189 echo "your system has '$ranlib'; we'll use that."
14190 orderlib=false
14191 else
14192 echo "your system doesn't seem to support random libraries"
14193 echo "so we'll use lorder and tsort to order the libraries."
14194 orderlib=true
14195 ranlib=":"
14196 fi
14197fi
14198$rm -f foo* bar*
14199
14200: check for type of arguments to select.
14201case "$selecttype" in
14202'') case "$d_select" in
14203 $define)
14204 echo " "
14205 $cat <<EOM
14206Checking to see what type of arguments are accepted by select().
14207EOM
14208 hdrs="$define sys/types.h
14209 $i_systime sys/time.h
14210 $i_sysselct sys/select.h
14211 $d_socket sys/socket.h"
14212 : The first arg can be int, unsigned, or size_t
14213 : The last arg may or may not be 'const'
14214 val=''
14215 : void pointer has been seen but using that
14216 : breaks the selectminbits test
14217 for xxx in 'fd_set *' 'int *'; do
14218 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14219 for tmo in 'struct timeval *' 'const struct timeval *'; do
14220 case "$val" in
14221 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14222 if ./protochk "$try" $hdrs; then
14223 echo "Your system accepts $xxx."
14224 val="$xxx"
14225 fi
14226 ;;
14227 esac
14228 done
14229 done
14230 done
14231 case "$val" in
14232 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14233 case "$d_fd_set" in
14234 $define) dflt="fd_set *" ;;
14235 *) dflt="int *" ;;
14236 esac
14237 . ./myread
14238 val=$ans
14239 ;;
14240 esac
14241 selecttype="$val"
14242 ;;
14243 *) : no select, so pick a harmless default
14244 selecttype='int *'
14245 ;;
14246 esac
14247 ;;
14248esac
14249
14250: check for the select 'width'
14251case "$selectminbits" in
14252'') case "$d_select" in
14253 $define)
14254 $cat <<EOM
14255
14256Checking to see on how many bits at a time your select() operates...
14257EOM
14258 $cat >try.c <<EOCP
14259#include <sys/types.h>
14260#$i_time I_TIME
14261#$i_systime I_SYS_TIME
14262#$i_systimek I_SYS_TIME_KERNEL
14263#ifdef I_TIME
14264# include <time.h>
14265#endif
14266#ifdef I_SYS_TIME
14267# ifdef I_SYS_TIME_KERNEL
14268# define KERNEL
14269# endif
14270# include <sys/time.h>
14271# ifdef I_SYS_TIME_KERNEL
14272# undef KERNEL
14273# endif
14274#endif
14275#$i_sysselct I_SYS_SELECT
14276#ifdef I_SYS_SELECT
14277#include <sys/select.h>
14278#endif
14279#$d_socket HAS_SOCKET
14280#ifdef HAS_SOCKET
14281# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14282#endif
14283#include <stdio.h>
14284$selecttype b;
14285#define S sizeof(*(b))
14286#define MINBITS 64
14287#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14288#define NBITS (NBYTES * 8)
14289int main() {
14290 char s[NBYTES];
14291 struct timeval t;
14292 int i;
14293 FILE* fp;
14294 int fd;
14295
14296 fclose(stdin);
14297 fp = fopen("try.c", "r");
14298 if (fp == 0)
14299 exit(1);
14300 fd = fileno(fp);
14301 if (fd < 0)
14302 exit(2);
14303 b = ($selecttype)s;
14304 for (i = 0; i < NBITS; i++)
14305 FD_SET(i, b);
14306 t.tv_sec = 0;
14307 t.tv_usec = 0;
14308 select(fd + 1, b, 0, 0, &t);
14309 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14310 printf("%d\n", i + 1);
14311 return 0;
14312}
14313EOCP
14314 set try
14315 if eval $compile_ok; then
14316 selectminbits=`./try`
14317 case "$selectminbits" in
14318 '') cat >&4 <<EOM
14319Cannot figure out on how many bits at a time your select() operates.
14320I'll play safe and guess it is 32 bits.
14321EOM
14322 selectminbits=32
14323 bits="32 bits"
14324 ;;
14325 1) bits="1 bit" ;;
14326 *) bits="$selectminbits bits" ;;
14327 esac
14328 echo "Your select() operates on $bits at a time." >&4
14329 else
14330 rp='What is the minimum number of bits your select() operates on?'
14331 case "$byteorder" in
14332 1234|12345678) dflt=32 ;;
14333 *) dflt=1 ;;
14334 esac
14335 . ./myread
14336 val=$ans
14337 selectminbits="$val"
14338 fi
14339 $rm -f try.* try
14340 ;;
14341 *) : no select, so pick a harmless default
14342 selectminbits='32'
14343 ;;
14344 esac
14345 ;;
14346esac
14347
14348: Trace out the files included by signal.h, then look for SIGxxx names.
14349: Remove SIGARRAYSIZE used by HPUX.
14350: Remove SIGSTKSIZE used by Linux.
14351: Remove SIGSTKSZ used by Posix.
14352: Remove SIGTYP void lines used by OS2.
14353: Some cpps, like os390, dont give the file name anywhere
14354if [ "X$fieldn" = X ]; then
14355 : Just make some guesses. We check them later.
14356 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14357else
14358 xxx=`echo '#include <signal.h>' |
14359 $cppstdin $cppminus $cppflags 2>/dev/null |
14360 $grep '^[ ]*#.*include' |
14361 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
14362fi
14363: Check this list of files to be sure we have parsed the cpp output ok.
14364: This will also avoid potentially non-existent files, such
14365: as ../foo/bar.h
14366xxxfiles=''
14367for xx in $xxx /dev/null ; do
14368 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14369done
14370: If we have found no files, at least try signal.h
14371case "$xxxfiles" in
14372'') xxxfiles=`./findhdr signal.h` ;;
14373esac
14374xxx=`awk '
14375$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14376 print substr($2, 4, 20)
14377}
14378$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14379 print substr($3, 4, 20)
14380}' $xxxfiles`
14381: Append some common names just in case the awk scan failed.
14382xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14383xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14384xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14385xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14386xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14387
14388: generate a few handy files for later
14389$cat > signal.c <<'EOCP'
14390#include <sys/types.h>
14391#include <signal.h>
14392#include <stdio.h>
14393int main() {
14394
14395/* Strange style to avoid deeply-nested #if/#else/#endif */
14396#ifndef NSIG
14397# ifdef _NSIG
14398# define NSIG (_NSIG)
14399# endif
14400#endif
14401
14402#ifndef NSIG
14403# ifdef SIGMAX
14404# define NSIG (SIGMAX+1)
14405# endif
14406#endif
14407
14408#ifndef NSIG
14409# ifdef SIG_MAX
14410# define NSIG (SIG_MAX+1)
14411# endif
14412#endif
14413
14414#ifndef NSIG
14415# ifdef MAXSIG
14416# define NSIG (MAXSIG+1)
14417# endif
14418#endif
14419
14420#ifndef NSIG
14421# ifdef MAX_SIG
14422# define NSIG (MAX_SIG+1)
14423# endif
14424#endif
14425
14426#ifndef NSIG
14427# ifdef SIGARRAYSIZE
14428# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14429# endif
14430#endif
14431
14432#ifndef NSIG
14433# ifdef _sys_nsig
14434# define NSIG (_sys_nsig) /* Solaris 2.5 */
14435# endif
14436#endif
14437
14438/* Default to some arbitrary number that's big enough to get most
14439 of the common signals.
14440*/
14441#ifndef NSIG
14442# define NSIG 50
14443#endif
14444
14445printf("NSIG %d\n", NSIG);
14446
14447#ifndef JUST_NSIG
14448
14449EOCP
14450
14451echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14452{
14453 printf "#ifdef SIG"; printf $1; printf "\n"
14454 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14455 printf $1; printf ");\n"
14456 printf "#endif\n"
14457}
14458END {
14459 printf "#endif /* JUST_NSIG */\n";
14460 printf "exit(0);\n}\n";
14461}
14462' >>signal.c
14463$cat >signal.awk <<'EOP'
14464BEGIN { ndups = 0 }
14465$1 ~ /^NSIG$/ { nsig = $2 }
14466($1 !~ /^NSIG$/) && (NF == 2) {
14467 if ($2 > maxsig) { maxsig = $2 }
14468 if (sig_name[$2]) {
14469 dup_name[ndups] = $1
14470 dup_num[ndups] = $2
14471 ndups++
14472 }
14473 else {
14474 sig_name[$2] = $1
14475 sig_num[$2] = $2
14476 }
14477}
14478END {
14479 if (nsig == 0) {
14480 nsig = maxsig + 1
14481 }
14482 printf("NSIG %d\n", nsig);
14483 for (n = 1; n < nsig; n++) {
14484 if (sig_name[n]) {
14485 printf("%s %d\n", sig_name[n], sig_num[n])
14486 }
14487 else {
14488 printf("NUM%d %d\n", n, n)
14489 }
14490 }
14491 for (n = 0; n < ndups; n++) {
14492 printf("%s %d\n", dup_name[n], dup_num[n])
14493 }
14494}
14495EOP
14496$cat >signal_cmd <<EOS
14497$startsh
14498if $test -s signal.lst; then
14499 echo "Using your existing signal.lst file"
14500 exit 0
14501fi
14502xxx="$xxx"
14503EOS
14504$cat >>signal_cmd <<'EOS'
14505
14506set signal
14507if eval $compile_ok; then
14508 ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14509else
14510 echo "(I can't seem be able to compile the whole test program)" >&4
14511 echo "(I'll try it in little pieces.)" >&4
14512 set signal -DJUST_NSIG
14513 if eval $compile_ok; then
14514 ./signal$_exe > signal.nsg
14515 $cat signal.nsg
14516 else
14517 echo "I can't seem to figure out how many signals you have." >&4
14518 echo "Guessing 50." >&4
14519 echo 'NSIG 50' > signal.nsg
14520 fi
14521 : Now look at all the signal names, one at a time.
14522 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14523 $cat > signal.c <<EOCP
14524#include <sys/types.h>
14525#include <signal.h>
14526#include <stdio.h>
14527int main() {
14528printf("$xx %d\n", SIG${xx});
14529return 0;
14530}
14531EOCP
14532 set signal
14533 if eval $compile; then
14534 echo "SIG${xx} found."
14535 ./signal$_exe >> signal.ls1
14536 else
14537 echo "SIG${xx} NOT found."
14538 fi
14539 done
14540 if $test -s signal.ls1; then
14541 $cat signal.nsg signal.ls1 |
14542 $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14543 fi
14544
14545fi
14546if $test -s signal.lst; then
14547 :
14548else
14549 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14550 echo 'kill -l' >signal
14551 set X `csh -f <signal`
14552 $rm -f signal
14553 shift
14554 case $# in
14555 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14556 esac
14557 echo $@ | $tr ' ' $trnl | \
14558 $awk '{ printf "%s %d\n", $1, ++s; }
14559 END { printf "NSIG %d\n", ++s }' >signal.lst
14560fi
14561$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14562EOS
14563chmod a+x signal_cmd
14564$eunicefix signal_cmd
14565
14566: generate list of signal names
14567echo " "
14568case "$sig_name_init" in
14569'') doinit=yes ;;
14570*) case "$sig_num_init" in
14571 ''|*,*) doinit=yes ;;
14572 esac ;;
14573esac
14574case "$doinit" in
14575yes)
14576 echo "Generating a list of signal names and numbers..." >&4
14577 . ./signal_cmd
14578 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14579 sig_name=`$awk 'BEGIN { printf "ZERO " }
14580 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14581 sig_num=`$awk 'BEGIN { printf "0 " }
14582 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14583 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
14584 !/^NSIG/ { printf "\"%s\", ", $1 }
14585 END { printf "0\n" }' signal.lst`
14586 sig_num_init=`$awk 'BEGIN { printf "0, " }
14587 !/^NSIG/ { printf "%d, ", $2}
14588 END { printf "0\n"}' signal.lst`
14589 ;;
14590esac
14591echo "The following $sig_count signals are available:"
14592echo " "
14593echo $sig_name | $awk \
14594'BEGIN { linelen = 0 }
14595{
14596 for (i = 1; i <= NF; i++) {
14597 name = "SIG" $i " "
14598 linelen = linelen + length(name)
14599 if (linelen > 70) {
14600 printf "\n"
14601 linelen = length(name)
14602 }
14603 printf "%s", name
14604 }
14605 printf "\n"
14606}'
76d3c696 14607sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
14608$rm -f signal signal.c signal.awk signal.lst signal_cmd
14609
14610echo " "
14611case "$sizetype" in
14612*_t) zzz="$sizetype" ;;
14613*) zzz="filesize" ;;
14614esac
14615echo "Checking the size of $zzz..." >&4
14616cat > try.c <<EOCP
14617#include <sys/types.h>
14618#include <stdio.h>
14619int main() {
14620 printf("%d\n", (int)sizeof($sizetype));
14621 exit(0);
14622}
14623EOCP
14624set try
14625if eval $compile_ok; then
14626 yyy=`./try`
14627 case "$yyy" in
14628 '') sizesize=4
14629 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14630 ;;
14631 *) sizesize=$yyy
14632 echo "Your $zzz size is $sizesize bytes."
14633 ;;
14634 esac
14635else
14636 sizesize=4
14637 echo "(I can't compile the test program--guessing $sizesize.)" >&4
14638fi
14639
14640
14641: check for socklen_t
14642echo " "
14643echo "Checking to see if you have socklen_t..." >&4
14644$cat >try.c <<EOCP
14645#include <sys/types.h>
14646#$d_socket HAS_SOCKET
14647#ifdef HAS_SOCKET
14648#include <sys/socket.h>
14649#endif
14650int main() { socklen_t x = 16; }
14651EOCP
14652set try
14653if eval $compile; then
14654 val="$define"
14655 echo "You have socklen_t."
14656else
14657 val="$undef"
14658 echo "You do not have socklen_t."
14659 case "$sizetype" in
14660 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14661 esac
14662fi
14663$rm -f try try.*
14664set d_socklen_t
14665eval $setvar
14666
a7710f8d
JH
14667: see if this is a socks.h system
14668set socks.h i_socks
14669eval $inhdr
14670
b4eb6b3d
JH
14671: check for type of the size argument to socket calls
14672case "$d_socket" in
14673"$define")
14674 $cat <<EOM
14675
14676Checking to see what type is the last argument of accept().
14677EOM
b4eb6b3d
JH
14678 yyy=''
14679 case "$d_socklen_t" in
14680 "$define") yyy="$yyy socklen_t"
14681 esac
14682 yyy="$yyy $sizetype int long unsigned"
14683 for xxx in $yyy; do
14684 case "$socksizetype" in
14685 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
14686 case "$usesocks" in
14687 "$define")
14688 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14689 echo "Your system accepts '$xxx *' for the last argument of accept()."
14690 socksizetype="$xxx"
14691 fi
14692 ;;
14693 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
14694 echo "Your system accepts '$xxx *' for the last argument of accept()."
14695 socksizetype="$xxx"
14696 fi
14697 ;;
14698 esac
b4eb6b3d
JH
14699 ;;
14700 esac
14701 done
14702: In case none of those worked, prompt the user.
14703 case "$socksizetype" in
14704 '') rp='What is the type for socket address structure sizes?'
14705 dflt='int'
14706 . ./myread
14707 socksizetype=$ans
14708 ;;
14709 esac
14710 ;;
14711*) : no sockets, so pick relatively harmless default
14712 socksizetype='int'
14713 ;;
14714esac
14715
14716: see what type is used for signed size_t
14717set ssize_t ssizetype int stdio.h sys/types.h
14718eval $typedef
14719dflt="$ssizetype"
14720$cat > ssize.c <<EOM
14721#include <stdio.h>
14722#include <sys/types.h>
14723#define Size_t $sizetype
14724#define SSize_t $dflt
14725int main()
14726{
14727 if (sizeof(Size_t) == sizeof(SSize_t))
14728 printf("$dflt\n");
14729 else if (sizeof(Size_t) == sizeof(int))
14730 printf("int\n");
14731 else
14732 printf("long\n");
14733 exit(0);
14734}
14735EOM
14736echo " "
14737set ssize
14738if eval $compile_ok && ./ssize > /dev/null; then
14739 ssizetype=`./ssize`
14740 echo "I'll be using $ssizetype for functions returning a byte count." >&4
14741else
14742 $cat >&4 <<EOM
14743Help! I can't compile and run the ssize_t test program: please enlighten me!
14744(This is probably a misconfiguration in your system or libraries, and
14745you really ought to fix it. Still, I'll try anyway.)
14746
14747I need a type that is the same size as $sizetype, but is guaranteed to
14748be signed. Common values are ssize_t, int and long.
14749
14750EOM
14751 rp="What signed type is the same size as $sizetype?"
14752 . ./myread
14753 ssizetype="$ans"
14754fi
14755$rm -f ssize ssize.*
14756
14757: see what type of char stdio uses.
14758echo " "
aa517f50
JH
14759echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
14760if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
14761 echo "Your stdio uses unsigned chars." >&4
14762 stdchar="unsigned char"
14763else
aa517f50
JH
14764 echo "Your stdio uses signed chars." >&4
14765 stdchar="char"
b4eb6b3d 14766fi
aa517f50
JH
14767$rm -f stdioh
14768
14769
b4eb6b3d
JH
14770
14771: see if time exists
14772echo " "
14773if test "X$d_time" = X -o X"$timetype" = X; then
14774 if set time val -f d_time; eval $csym; $val; then
14775 echo 'time() found.' >&4
14776 val="$define"
14777 rp="What is the type returned by time() on this system?"
14778 set time_t timetype long stdio.h sys/types.h
14779 eval $typedef_ask
14780 else
14781 echo 'time() not found, hope that will do.' >&4
14782 val="$undef"
14783 timetype='int';
14784 fi
14785 set d_time
14786 eval $setvar
14787fi
14788
14789: see what type uids are declared as in the kernel
14790echo " "
14791echo "Looking for the type for user ids returned by getuid()."
14792set uid_t uidtype xxx stdio.h sys/types.h
14793eval $typedef
14794case "$uidtype" in
14795xxx)
14796 xxx=`./findhdr sys/user.h`
14797 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14798 case $1 in
14799 unsigned) dflt="$1 $2" ;;
14800 *) dflt="$1" ;;
14801 esac
14802 ;;
14803*) dflt="$uidtype";;
14804esac
14805case "$uidtype" in
14806uid_t) echo "uid_t found." ;;
14807*) rp="What is the type for user ids returned by getuid()?"
14808 . ./myread
14809 uidtype="$ans"
14810 ;;
14811esac
14812
14813echo " "
14814case "$uidtype" in
14815*_t) zzz="$uidtype" ;;
14816*) zzz="uid" ;;
14817esac
14818echo "Checking the size of $zzz..." >&4
14819cat > try.c <<EOCP
14820#include <sys/types.h>
14821#include <stdio.h>
14822int main() {
14823 printf("%d\n", (int)sizeof($uidtype));
14824 exit(0);
14825}
14826EOCP
14827set try
14828if eval $compile_ok; then
14829 yyy=`./try`
14830 case "$yyy" in
14831 '') uidsize=4
14832 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14833 ;;
14834 *) uidsize=$yyy
14835 echo "Your $zzz is $uidsize bytes long."
14836 ;;
14837 esac
14838else
14839 uidsize=4
14840 echo "(I can't compile the test program--guessing $uidsize.)" >&4
14841fi
14842
14843echo " "
14844case "$uidtype" in
14845*_t) zzz="$uidtype" ;;
14846*) zzz="uid" ;;
14847esac
14848echo "Checking the sign of $zzz..." >&4
14849cat > try.c <<EOCP
14850#include <sys/types.h>
14851#include <stdio.h>
14852int main() {
14853 $uidtype foo = -1;
14854 if (foo < 0)
14855 printf("-1\n");
14856 else
14857 printf("1\n");
14858}
14859EOCP
14860set try
14861if eval $compile; then
14862 yyy=`./try`
14863 case "$yyy" in
14864 '') uidsign=1
14865 echo "(I can't execute the test program--guessing unsigned.)" >&4
14866 ;;
14867 *) uidsign=$yyy
14868 case "$uidsign" in
14869 1) echo "Your $zzz is unsigned." ;;
14870 -1) echo "Your $zzz is signed." ;;
14871 esac
14872 ;;
14873 esac
14874else
14875 uidsign=1
14876 echo "(I can't compile the test program--guessing unsigned.)" >&4
14877fi
14878
14879
14880
14881echo " "
14882$echo "Checking the format string to be used for uids..." >&4
14883
14884case "$uidsign" in
14885-1) if $test X"$uidsize" = X"$ivsize"; then
14886 uidformat="$ivdformat"
14887 else
14888 if $test X"$uidsize" = X"$longsize"; then
14889 uidformat='"ld"'
14890 else
14891 if $test X"$uidsize" = X"$intsize"; then
14892 uidformat='"d"'
14893 else
14894 if $test X"$uidsize" = X"$shortsize"; then
14895 uidformat='"hd"'
14896 fi
14897 fi
14898 fi
14899 fi
14900 ;;
14901*) if $test X"$uidsize" = X"$uvsize"; then
14902 uidformat="$uvuformat"
14903 else
14904 if $test X"$uidsize" = X"$longsize"; then
14905 uidformat='"lu"'
14906 else
14907 if $test X"$uidsize" = X"$intsize"; then
14908 uidformat='"u"'
14909 else
14910 if $test X"$uidsize" = X"$shortsize"; then
14911 uidformat='"hu"'
14912 fi
14913 fi
14914 fi
14915 fi
14916 ;;
14917esac
14918
14919: see if dbm.h is available
14920: see if dbmclose exists
14921set dbmclose d_dbmclose
14922eval $inlibc
14923
14924case "$d_dbmclose" in
14925$define)
14926 set dbm.h i_dbm
14927 eval $inhdr
14928 case "$i_dbm" in
14929 $define)
14930 val="$undef"
14931 set i_rpcsvcdbm
14932 eval $setvar
14933 ;;
14934 *) set rpcsvc/dbm.h i_rpcsvcdbm
14935 eval $inhdr
14936 ;;
14937 esac
14938 ;;
14939*) echo "We won't be including <dbm.h>"
14940 val="$undef"
14941 set i_dbm
14942 eval $setvar
14943 val="$undef"
14944 set i_rpcsvcdbm
14945 eval $setvar
14946 ;;
14947esac
14948
14949: see if this is a sys/file.h system
14950val=''
14951set sys/file.h val
14952eval $inhdr
14953
14954: do we need to include sys/file.h ?
14955case "$val" in
14956"$define")
14957 echo " "
14958 if $h_sysfile; then
14959 val="$define"
14960 echo "We'll be including <sys/file.h>." >&4
14961 else
14962 val="$undef"
14963 echo "We won't be including <sys/file.h>." >&4
14964 fi
14965 ;;
14966*)
14967 h_sysfile=false
14968 ;;
14969esac
14970set i_sysfile
14971eval $setvar
14972
14973: see if fcntl.h is there
14974val=''
14975set fcntl.h val
14976eval $inhdr
14977
14978: see if we can include fcntl.h
14979case "$val" in
14980"$define")
14981 echo " "
14982 if $h_fcntl; then
14983 val="$define"
14984 echo "We'll be including <fcntl.h>." >&4
14985 else
14986 val="$undef"
14987 if $h_sysfile; then
14988 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14989 else
14990 echo "We won't be including <fcntl.h>." >&4
14991 fi
14992 fi
14993 ;;
14994*)
14995 h_fcntl=false
14996 val="$undef"
14997 ;;
14998esac
14999set i_fcntl
15000eval $setvar
15001
15002: see if this is a iconv.h system
15003set iconv.h i_iconv
15004eval $inhdr
15005
15006: see if this is a ieeefp.h system
15007set ieeefp.h i_ieeefp
15008eval $inhdr
15009
15010: see if this is a libutil.h system
15011set libutil.h i_libutil
15012eval $inhdr
15013
15014: see if locale.h is available
15015set locale.h i_locale
15016eval $inhdr
15017
15018: see if mach cthreads are available
15019if test "X$usethreads" = "X$define"; then
15020 set mach/cthreads.h i_machcthr
15021 eval $inhdr
15022else
15023 i_machcthr="$undef"
15024fi
15025
15026
15027
15028: see if this is a math.h system
15029set math.h i_math
15030eval $inhdr
15031
15032: see if this is a mntent.h system
15033set mntent.h i_mntent
15034eval $inhdr
15035
15036: see if ndbm.h is available
15037set ndbm.h t_ndbm
15038eval $inhdr
15039case "$t_ndbm" in
15040$define)
15041 : see if dbm_open exists
15042 set dbm_open d_dbm_open
15043 eval $inlibc
15044 case "$d_dbm_open" in
15045 $undef)
15046 t_ndbm="$undef"
15047 echo "We won't be including <ndbm.h>"
15048 ;;
15049 esac
15050 ;;
15051esac
15052val="$t_ndbm"
15053set i_ndbm
15054eval $setvar
15055
15056: see if net/errno.h is available
15057val=''
15058set net/errno.h val
15059eval $inhdr
15060
15061: Unfortunately, it causes problems on some systems. Arrgh.
15062case "$val" in
15063$define)
15064 cat > try.c <<'EOM'
15065#include <stdio.h>
15066#include <errno.h>
15067#include <net/errno.h>
15068int func()
15069{
15070 return ENOTSOCK;
15071}
15072EOM
15073 if $cc $ccflags -c try.c >/dev/null 2>&1; then
15074 echo "We'll be including <net/errno.h>." >&4
15075 else
15076 echo "We won't be including <net/errno.h>." >&4
15077 val="$undef"
15078 fi
15079 $rm -f try.* try
15080 ;;
15081esac
15082set i_neterrno
15083eval $setvar
15084
15085: see if netinet/tcp.h is available
15086set netinet/tcp.h i_netinettcp
15087eval $inhdr
15088
15089: see if this is a poll.h system
15090set poll.h i_poll
15091eval $inhdr
15092
15093: see if this is a prot.h system
15094set prot.h i_prot
15095eval $inhdr
15096
15097echo " "
15098$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
15099$cat <<'EOSH' > Cppsym.know
15100a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15101AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15102alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
15103ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
15104BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15105BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15106bull c cadmus clipper CMU COFF COMPILER_VERSION
15107concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15108CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15109Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15110FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15111GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15112H3050R H3050RX hbullx20 hcx host_mips
15113hp200 hp300 hp700 HP700 hp800 hp9000
15114hp9000s200 hp9000s300 hp9000s400 hp9000s500
15115hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15116i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15117iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15118INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15119LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15120LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15121Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15122LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15123M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15124M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15125M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15126MATH_HAS_NO_SIDE_EFFECTS
15127mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15128mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15129mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15130MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15131mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15132NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 15133news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
15134ns32016 ns32332 ns32k nsc32000
15135OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15136pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15137pc532 pdp11 PGC PIC plexus PORTAR posix
15138POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15139POSIX_C_SOURCE POSIX_SOURCE POWER
15140PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15141riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
15142SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15143sony sony_news sonyrisc sparc sparclite spectrum
15144stardent stdc STDC_EXT stratos sun sun3 sun386
15145Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15146SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15147SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15148sysV68 sysV88 Tek4132 Tek4300 titan
15149tower tower32 tower32_200 tower32_600 tower32_700
15150tower32_800 tower32_850 tss
15151u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15152ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15153unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15154Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15155XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15156XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15157z8000
15158EOSH
15159# Maybe put other stuff here too.
15160cat <<EOSH >>Cppsym.know
15161$osname
15162EOSH
15163./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15164./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15165$cat Cppsym.know > Cppsym.c
381aa1ff 15166$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
15167$rm -f Cppsym.a Cppsym.b Cppsym.c
15168cat <<EOSH > Cppsym
15169$startsh
15170if $test \$# -gt 0; then
15171 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15172 if $test -s Cppsym.got; then
15173 $rm -f Cppsym.got
15174 exit 0
15175 fi
15176 $rm -f Cppsym.got
15177 exit 1
15178else
15179 $tr " " "$trnl" | ./Cppsym.try
15180 exit 0
15181fi
15182EOSH
15183chmod +x Cppsym
15184$eunicefix Cppsym
15185cat <<EOSH > Cppsym.try
15186$startsh
15187cat <<'EOCP' > try.c
15188#include <stdio.h>
15189int main() {
15190EOCP
15191$awk \\
15192EOSH
15193cat <<'EOSH' >> Cppsym.try
15194'length($1) > 0 {
15195 printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", %s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15196 printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", _%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15197 printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", __%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15198 printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", __%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15199}' >> try.c
15200echo '}' >> try.c
15201EOSH
15202cat <<EOSH >> Cppsym.try
15203ccflags="$ccflags"
15204case "$osname-$gccversion" in
15205irix-) ccflags="\$ccflags -woff 1178" ;;
15206os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15207esac
7a282f6d 15208$cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
b4eb6b3d
JH
15209EOSH
15210chmod +x Cppsym.try
15211$eunicefix Cppsym.try
15212./Cppsym < Cppsym.know > Cppsym.true
15213: now check the C compiler for additional symbols
15214postprocess_cc_v=''
15215case "$osname" in
15216aix) postprocess_cc_v="|$tr , ' '" ;;
15217esac
15218$cat >ccsym <<EOS
15219$startsh
15220$cat >tmp.c <<EOF
15221extern int foo;
15222EOF
15223for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15224do
15225 case "\$i" in
15226 -D*) echo "\$i" | $sed 's/^-D//';;
15227 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15228 esac
15229done
15230$rm -f try.c
15231EOS
15232postprocess_cc_v=''
15233chmod +x ccsym
15234$eunicefix ccsym
15235./ccsym > ccsym1.raw
15236if $test -s ccsym1.raw; then
15237 $sort ccsym1.raw | $uniq >ccsym.raw
15238else
15239 mv ccsym1.raw ccsym.raw
15240fi
15241
15242$awk '/\=/ { print $0; next }
15243 { print $0"=1" }' ccsym.raw >ccsym.list
15244$awk '/\=/ { print $0; next }
15245 { print $0"=1" }' Cppsym.true >ccsym.true
15246$comm -13 ccsym.true ccsym.list >ccsym.own
15247$comm -12 ccsym.true ccsym.list >ccsym.com
15248$comm -23 ccsym.true ccsym.list >ccsym.cpp
15249also=''
15250if $test -z ccsym.raw; then
15251 echo "Your C compiler doesn't seem to define any symbols!" >&4
15252 echo " "
15253 echo "However, your C preprocessor defines the following symbols:"
15254 $cat Cppsym.true
15255 ccsymbols=''
15256 cppsymbols=`$cat Cppsym.true`
15257 cppsymbols=`echo $cppsymbols`
15258 cppccsymbols="$cppsymbols"
15259else
15260 if $test -s ccsym.com; then
15261 echo "Your C compiler and pre-processor define these symbols:"
15262 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15263 also='also '
15264 symbols='ones'
15265 cppccsymbols=`$cat ccsym.com`
15266 cppccsymbols=`echo $cppccsymbols`
15267 $test "$silent" || sleep 1
15268 fi
15269 if $test -s ccsym.cpp; then
15270 $test "$also" && echo " "
15271 echo "Your C pre-processor ${also}defines the following symbols:"
15272 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15273 also='further '
15274 cppsymbols=`$cat ccsym.cpp`
15275 cppsymbols=`echo $cppsymbols`
15276 $test "$silent" || sleep 1
15277 fi
15278 if $test -s ccsym.own; then
15279 $test "$also" && echo " "
15280 echo "Your C compiler ${also}defines the following cpp symbols:"
15281 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15282 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15283 ccsymbols=`$cat ccsym.own`
15284 ccsymbols=`echo $ccsymbols`
15285 $test "$silent" || sleep 1
15286 fi
15287fi
15288$rm -f ccsym* Cppsym.*
15289
15290: see if this is a termio system
15291val="$undef"
15292val2="$undef"
15293val3="$undef"
15294if $test `./findhdr termios.h`; then
15295 set tcsetattr i_termios
15296 eval $inlibc
15297 val3="$i_termios"
15298fi
15299echo " "
15300case "$val3" in
15301"$define") echo "You have POSIX termios.h... good!" >&4;;
15302*) if ./Cppsym pyr; then
15303 case "`/bin/universe`" in
15304 ucb) if $test `./findhdr sgtty.h`; then
15305 val2="$define"
15306 echo "<sgtty.h> found." >&4
15307 else
15308 echo "System is pyramid with BSD universe."
15309 echo "<sgtty.h> not found--you could have problems." >&4
15310 fi;;
15311 *) if $test `./findhdr termio.h`; then
15312 val="$define"
15313 echo "<termio.h> found." >&4
15314 else
15315 echo "System is pyramid with USG universe."
15316 echo "<termio.h> not found--you could have problems." >&4
15317 fi;;
15318 esac
15319 elif ./usg; then
15320 if $test `./findhdr termio.h`; then
15321 echo "<termio.h> found." >&4
15322 val="$define"
15323 elif $test `./findhdr sgtty.h`; then
15324 echo "<sgtty.h> found." >&4
15325 val2="$define"
15326 else
15327echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15328 fi
15329 else
15330 if $test `./findhdr sgtty.h`; then
15331 echo "<sgtty.h> found." >&4
15332 val2="$define"
15333 elif $test `./findhdr termio.h`; then
15334 echo "<termio.h> found." >&4
15335 val="$define"
15336 else
15337echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15338 fi
15339 fi;;
15340esac
15341set i_termio; eval $setvar
15342val=$val2; set i_sgtty; eval $setvar
15343val=$val3; set i_termios; eval $setvar
15344
15345: see if this is a shadow.h system
15346set shadow.h i_shadow
15347eval $inhdr
15348
b4eb6b3d
JH
15349: see if stddef is available
15350set stddef.h i_stddef
15351eval $inhdr
923fc586 15352
b4eb6b3d
JH
15353: see if this is a sunmath.h system
15354set sunmath.h i_sunmath
15355eval $inhdr
5f80c64f 15356
b4eb6b3d
JH
15357: see if sys/access.h is available
15358set sys/access.h i_sysaccess
15359eval $inhdr
15360
15361: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15362set sys/filio.h i_sysfilio
15363eval $inhdr
15364echo " "
15365if $test `./findhdr sys/ioctl.h`; then
15366 val="$define"
15367 echo '<sys/ioctl.h> found.' >&4
15368else
15369 val="$undef"
15370 if $test $i_sysfilio = "$define"; then
15371 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 15372 else
b4eb6b3d
JH
15373 $test $i_sgtty = "$define" && xxx="sgtty.h"
15374 $test $i_termio = "$define" && xxx="termio.h"
15375 $test $i_termios = "$define" && xxx="termios.h"
15376echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15377 fi
15378fi
15379set i_sysioctl
15380eval $setvar
15381
15382
15383: see if this is a syslog.h system
15384set syslog.h i_syslog
15385eval $inhdr
15386
15387
15388: see if this is a sys/mode.h system
15389set sys/mode.h i_sysmode
15390eval $inhdr
15391
15392: see if sys/resource.h has to be included
15393set sys/resource.h i_sysresrc
15394eval $inhdr
15395
15396: see if sys/security.h is available
15397set sys/security.h i_syssecrt
15398eval $inhdr
15399
15400: see if this is a sys/statvfs.h system
15401set sys/statvfs.h i_sysstatvfs
15402eval $inhdr
15403
15404: see if this is a sys/uio.h system
15405set sys/uio.h i_sysuio
15406eval $inhdr
15407
15408: see if this is a sys/un.h system
15409set sys/un.h i_sysun
15410eval $inhdr
15411
15412
15413: see if this is a sys/utsname.h system
15414set sys/utsname.h i_sysutsname
15415eval $inhdr
15416
15417: see if this is a syswait system
15418set sys/wait.h i_syswait
15419eval $inhdr
15420
15421: see if this is a ustat.h system
15422set ustat.h i_ustat
15423eval $inhdr
15424
15425: see if this is an utime system
15426set utime.h i_utime
15427eval $inhdr
15428
15429: see if this is a values.h system
15430set values.h i_values
15431eval $inhdr
15432
15433: see if this is a vfork system
15434case "$d_vfork" in
15435"$define")
15436 set vfork.h i_vfork
15437 eval $inhdr
15438 ;;
15439*)
15440 i_vfork="$undef"
15441 ;;
15442esac
15443
15444: see if gdbm.h is available
15445set gdbm.h t_gdbm
15446eval $inhdr
15447case "$t_gdbm" in
15448$define)
15449 : see if gdbm_open exists
15450 set gdbm_open d_gdbm_open
15451 eval $inlibc
15452 case "$d_gdbm_open" in
15453 $undef)
15454 t_gdbm="$undef"
15455 echo "We won't be including <gdbm.h>"
5f80c64f 15456 ;;
b4eb6b3d
JH
15457 esac
15458 ;;
15459esac
15460val="$t_gdbm"
15461set i_gdbm
15462eval $setvar
15463
15464echo " "
15465echo "Looking for extensions..." >&4
15466: If we are using the old config.sh, known_extensions may contain
15467: old or inaccurate or duplicate values.
15468known_extensions=''
15469nonxs_extensions=''
15470: We do not use find because it might not be available.
15471: We do not just use MANIFEST because the user may have dropped
15472: some additional extensions into the source tree and expect them
15473: to be built.
15474
15475: Function to recursively find available extensions, ignoring DynaLoader
15476: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15477find_extensions='
15478 for xxx in *; do
15479 case "$xxx" in
15480 DynaLoader|dynaload) ;;
15481 *)
15482 if $test -f $xxx/$xxx.xs; then
15483 known_extensions="$known_extensions $1$xxx";
15484 elif $test -f $xxx/Makefile.PL; then
15485 nonxs_extensions="$nonxs_extensions $1$xxx";
15486 else
15487 if $test -d $xxx -a $# -lt 10; then
15488 set $1$xxx/ $*;
15489 cd $xxx;
15490 eval $find_extensions;
15491 cd ..;
15492 shift;
15493 fi;
15494 fi
15495 ;;
15496 esac;
15497 done'
15498tdir=`pwd`
15499cd $rsrc/ext
15500set X
15501shift
15502eval $find_extensions
15503set X $nonxs_extensions
15504shift
15505nonxs_extensions="$*"
15506set X $known_extensions
15507shift
15508known_extensions="$*"
15509cd $tdir
15510
15511: Now see which are supported on this system.
15512avail_ext=''
15513for xxx in $known_extensions ; do
15514 case "$xxx" in
15515 DB_File|db_file)
15516 case "$i_db" in
15517 $define) avail_ext="$avail_ext $xxx" ;;
15518 esac
15519 ;;
15520 GDBM_File|gdbm_fil)
15521 case "$i_gdbm" in
15522 $define) avail_ext="$avail_ext $xxx" ;;
15523 esac
15524 ;;
15525 NDBM_File|ndbm_fil)
15526 case "$i_ndbm" in
15527 $define)
15528 case "$osname-$use64bitint" in
15529 hpux-define)
15530 case "$libs" in
15531 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15532 esac
15533 ;;
15534 *) avail_ext="$avail_ext $xxx" ;;
15535 esac
15536 ;;
15537 esac
15538 ;;
15539 ODBM_File|odbm_fil)
15540 case "${i_dbm}${i_rpcsvcdbm}" in
15541 *"${define}"*)
15542 case "$osname-$use64bitint" in
15543 hpux-define)
15544 case "$libs" in
15545 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15546 esac
15547 ;;
15548 *) avail_ext="$avail_ext $xxx" ;;
15549 esac
15550 ;;
15551 esac
15552 ;;
15553 POSIX|posix)
15554 case "$useposix" in
15555 true|define|y) avail_ext="$avail_ext $xxx" ;;
15556 esac
15557 ;;
15558 Opcode|opcode)
15559 case "$useopcode" in
15560 true|define|y) avail_ext="$avail_ext $xxx" ;;
15561 esac
15562 ;;
15563 Socket|socket)
15564 case "$d_socket" in
15565 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15566 esac
15567 ;;
15568 Sys/Syslog|sys/syslog)
15569 : XXX syslog requires socket
15570 case "$d_socket" in
15571 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15572 esac
15573 ;;
15574 Thread|thread)
15575 case "$usethreads" in
15576 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15577 esac
15578 ;;
15579 IPC/SysV|ipc/sysv)
15580 : XXX Do we need a useipcsysv variable here
15581 case "${d_msg}${d_sem}${d_shm}" in
15582 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15583 esac
15584 ;;
15585 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
15586 ;;
15587 esac
b4eb6b3d 15588done
5f80c64f 15589
b4eb6b3d
JH
15590set X $avail_ext
15591shift
15592avail_ext="$*"
5f80c64f 15593
b4eb6b3d
JH
15594: Now see which nonxs extensions are supported on this system.
15595: For now assume all are.
15596nonxs_ext=''
15597for xxx in $nonxs_extensions ; do
15598 case "$xxx" in
15599 *) nonxs_ext="$nonxs_ext $xxx"
15600 ;;
15601 esac
15602done
5f80c64f 15603
b4eb6b3d
JH
15604set X $nonxs_ext
15605shift
15606nonxs_ext="$*"
15607
15608case $usedl in
15609$define)
15610 $cat <<EOM
15611A number of extensions are supplied with $package. You may choose to
15612compile these extensions for dynamic loading (the default), compile
15613them into the $package executable (static loading), or not include
15614them at all. Answer "none" to include no extensions.
15615Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
15616
15617EOM
b4eb6b3d
JH
15618 case "$dynamic_ext" in
15619 '') dflt="$avail_ext" ;;
15620 *) dflt="$dynamic_ext"
15621 # Perhaps we are reusing an old out-of-date config.sh.
15622 case "$hint" in
15623 previous)
15624 if test X"$dynamic_ext" != X"$avail_ext"; then
15625 $cat <<EOM
15626NOTICE: Your previous config.sh list may be incorrect.
15627The extensions now available to you are
15628 ${avail_ext}
15629but the default list from your previous config.sh is
15630 ${dynamic_ext}
9c839522 15631
b4eb6b3d
JH
15632EOM
15633 fi
9c839522
PM
15634 ;;
15635 esac
b4eb6b3d
JH
15636 ;;
15637 esac
5f80c64f 15638 case "$dflt" in
b4eb6b3d
JH
15639 '') dflt=none;;
15640 esac
15641 rp="What extensions do you wish to load dynamically?"
15642 . ./myread
15643 case "$ans" in
15644 none) dynamic_ext=' ' ;;
15645 *) dynamic_ext="$ans" ;;
5f80c64f 15646 esac
5f80c64f 15647
b4eb6b3d
JH
15648 case "$static_ext" in
15649 '')
15650 : Exclude those already listed in dynamic linking
15651 dflt=''
15652 for xxx in $avail_ext; do
15653 case " $dynamic_ext " in
15654 *" $xxx "*) ;;
15655 *) dflt="$dflt $xxx" ;;
15656 esac
15657 done
15658 set X $dflt
15659 shift
15660 dflt="$*"
15661 ;;
15662 *) dflt="$static_ext"
15663 ;;
15664 esac
9c839522 15665
b4eb6b3d
JH
15666 case "$dflt" in
15667 '') dflt=none;;
15668 esac
15669 rp="What extensions do you wish to load statically?"
15670 . ./myread
15671 case "$ans" in
15672 none) static_ext=' ' ;;
15673 *) static_ext="$ans" ;;
15674 esac
15675 ;;
15676*)
15677 $cat <<EOM
15678A number of extensions are supplied with $package. Answer "none"
15679to include no extensions.
15680Note that DynaLoader is always built and need not be mentioned here.
9c839522 15681
b4eb6b3d
JH
15682EOM
15683 case "$static_ext" in
15684 '') dflt="$avail_ext" ;;
15685 *) dflt="$static_ext"
15686 # Perhaps we are reusing an old out-of-date config.sh.
15687 case "$hint" in
15688 previous)
15689 if test X"$static_ext" != X"$avail_ext"; then
15690 $cat <<EOM
15691NOTICE: Your previous config.sh list may be incorrect.
15692The extensions now available to you are
15693 ${avail_ext}
15694but the default list from your previous config.sh is
15695 ${static_ext}
5f80c64f
JH
15696
15697EOM
b4eb6b3d
JH
15698 fi
15699 ;;
15700 esac
15701 ;;
15702 esac
15703 : Exclude those that are not xs extensions
15704 case "$dflt" in
15705 '') dflt=none;;
15706 esac
15707 rp="What extensions do you wish to include?"
15708 . ./myread
15709 case "$ans" in
15710 none) static_ext=' ' ;;
15711 *) static_ext="$ans" ;;
15712 esac
15713 ;;
5f80c64f
JH
15714esac
15715
b4eb6b3d
JH
15716set X $dynamic_ext $static_ext $nonxs_ext
15717shift
15718extensions="$*"
15719
9c839522
PM
15720: Remove libraries needed only for extensions
15721: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
15722: The exception is SunOS 4.x, which needs them.
15723case "${osname}X${osvers}" in
15724sunos*X4*)
15725 perllibs="$libs"
15726 ;;
15727*) case "$usedl" in
15728 $define|true|[yY]*)
15729 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
15730 shift
15731 perllibs="$*"
15732 ;;
15733 *) perllibs="$libs"
15734 ;;
15735 esac
15736 ;;
9c839522 15737esac
5f80c64f
JH
15738
15739: Remove build directory name from cppstdin so it can be used from
15740: either the present location or the final installed location.
15741echo " "
15742: Get out of the UU directory to get correct path name.
15743cd ..
15744case "$cppstdin" in
15745`pwd`/cppstdin)
15746 echo "Stripping down cppstdin path name"
15747 cppstdin=cppstdin
15748 ;;
15749esac
15750cd UU
15751
15752: end of configuration questions
15753echo " "
15754echo "End of configuration questions."
15755echo " "
15756
15757: back to where it started
15758if test -d ../UU; then
15759 cd ..
15760fi
15761
15762: configuration may be patched via a 'config.over' file
15763if $test -f config.over; then
15764 echo " "
15765 dflt=y
15766 rp='I see a config.over file. Do you wish to load it?'
15767 . UU/myread
15768 case "$ans" in
15769 n*) echo "OK, I'll ignore it.";;
15770 *) . ./config.over
15771 echo "Configuration override changes have been loaded."
15772 ;;
15773 esac
15774fi
15775
15776: in case they want portability, strip down executable paths
15777case "$d_portable" in
15778"$define")
15779 echo " "
15780 echo "Stripping down executable paths..." >&4
15781 for file in $loclist $trylist; do
534ac15a
JH
15782 eval temp=\$$file
15783 eval $file=`basename $temp`
5f80c64f
JH
15784 done
15785 ;;
15786esac
15787
15788: create config.sh file
15789echo " "
15790echo "Creating config.sh..." >&4
15791$spitshell <<EOT >config.sh
15792$startsh
15793#
15794# This file was produced by running the Configure script. It holds all the
15795# definitions figured out by Configure. Should you modify one of these values,
15796# do not forget to propagate your changes by running "Configure -der". You may
15797# instead choose to run each of the .SH files by yourself, or "Configure -S".
15798#
15799
15800# Package name : $package
15801# Source directory : $src
15802# Configuration time: $cf_time
15803# Configured by : $cf_by
15804# Target system : $myuname
15805
15806Author='$Author'
15807Date='$Date'
15808Header='$Header'
15809Id='$Id'
15810Locker='$Locker'
15811Log='$Log'
15812Mcc='$Mcc'
15813RCSfile='$RCSfile'
15814Revision='$Revision'
15815Source='$Source'
15816State='$State'
15817_a='$_a'
15818_exe='$_exe'
15819_o='$_o'
b4eb6b3d
JH
15820afs='$afs'
15821alignbytes='$alignbytes'
15822ansi2knr='$ansi2knr'
15823aphostname='$aphostname'
15824api_revision='$api_revision'
15825api_subversion='$api_subversion'
15826api_version='$api_version'
15827api_versionstring='$api_versionstring'
5f80c64f 15828ar='$ar'
b4eb6b3d
JH
15829archlib='$archlib'
15830archlibexp='$archlibexp'
15831archname64='$archname64'
15832archname='$archname'
5f80c64f
JH
15833archobjs='$archobjs'
15834awk='$awk'
b4eb6b3d 15835baserev='$baserev'
5f80c64f 15836bash='$bash'
b4eb6b3d
JH
15837bin='$bin'
15838bincompat5005='$bincompat5005'
15839binexp='$binexp'
5f80c64f
JH
15840bison='$bison'
15841byacc='$byacc'
b4eb6b3d 15842byteorder='$byteorder'
5f80c64f 15843c='$c'
b4eb6b3d 15844castflags='$castflags'
5f80c64f
JH
15845cat='$cat'
15846cc='$cc'
15847cccdlflags='$cccdlflags'
15848ccdlflags='$ccdlflags'
15849ccflags='$ccflags'
b4eb6b3d 15850ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 15851ccname='$ccname'
b4eb6b3d 15852ccsymbols='$ccsymbols'
6b356c8e 15853ccversion='$ccversion'
5f80c64f 15854cf_by='$cf_by'
b4eb6b3d 15855cf_email='$cf_email'
5f80c64f 15856cf_time='$cf_time'
b4eb6b3d 15857charsize='$charsize'
5f80c64f
JH
15858chgrp='$chgrp'
15859chmod='$chmod'
15860chown='$chown'
b4eb6b3d 15861clocktype='$clocktype'
5f80c64f
JH
15862comm='$comm'
15863compress='$compress'
15864contains='$contains'
15865cp='$cp'
15866cpio='$cpio'
15867cpp='$cpp'
b4eb6b3d
JH
15868cpp_stuff='$cpp_stuff'
15869cppccsymbols='$cppccsymbols'
5f80c64f
JH
15870cppflags='$cppflags'
15871cpplast='$cpplast'
15872cppminus='$cppminus'
15873cpprun='$cpprun'
15874cppstdin='$cppstdin'
b4eb6b3d
JH
15875cppsymbols='$cppsymbols'
15876crosscompile='$crosscompile'
15877cryptlib='$cryptlib'
5f80c64f 15878csh='$csh'
b4eb6b3d
JH
15879d_Gconvert='$d_Gconvert'
15880d_PRIEUldbl='$d_PRIEUldbl'
15881d_PRIFUldbl='$d_PRIFUldbl'
15882d_PRIGUldbl='$d_PRIGUldbl'
15883d_PRIXU64='$d_PRIXU64'
15884d_PRId64='$d_PRId64'
15885d_PRIeldbl='$d_PRIeldbl'
15886d_PRIfldbl='$d_PRIfldbl'
15887d_PRIgldbl='$d_PRIgldbl'
15888d_PRIi64='$d_PRIi64'
15889d_PRIo64='$d_PRIo64'
15890d_PRIu64='$d_PRIu64'
15891d_PRIx64='$d_PRIx64'
15892d_SCNfldbl='$d_SCNfldbl'
74cac757 15893d__fwalk='$d__fwalk'
b4eb6b3d
JH
15894d_access='$d_access'
15895d_accessx='$d_accessx'
15896d_alarm='$d_alarm'
15897d_archlib='$d_archlib'
15898d_atolf='$d_atolf'
15899d_atoll='$d_atoll'
15900d_attribut='$d_attribut'
15901d_bcmp='$d_bcmp'
15902d_bcopy='$d_bcopy'
15903d_bincompat5005='$d_bincompat5005'
5f80c64f 15904d_bsd='$d_bsd'
b4eb6b3d
JH
15905d_bsdgetpgrp='$d_bsdgetpgrp'
15906d_bsdsetpgrp='$d_bsdsetpgrp'
15907d_bzero='$d_bzero'
15908d_casti32='$d_casti32'
15909d_castneg='$d_castneg'
15910d_charvspr='$d_charvspr'
15911d_chown='$d_chown'
15912d_chroot='$d_chroot'
15913d_chsize='$d_chsize'
15914d_closedir='$d_closedir'
15915d_const='$d_const'
15916d_crypt='$d_crypt'
15917d_csh='$d_csh'
15918d_cuserid='$d_cuserid'
15919d_dbl_dig='$d_dbl_dig'
15920d_difftime='$d_difftime'
15921d_dirnamlen='$d_dirnamlen'
15922d_dlerror='$d_dlerror'
5f80c64f 15923d_dlopen='$d_dlopen'
b4eb6b3d
JH
15924d_dlsymun='$d_dlsymun'
15925d_dosuid='$d_dosuid'
15926d_drand48proto='$d_drand48proto'
15927d_dup2='$d_dup2'
15928d_eaccess='$d_eaccess'
15929d_endgrent='$d_endgrent'
15930d_endhent='$d_endhent'
15931d_endnent='$d_endnent'
15932d_endpent='$d_endpent'
15933d_endpwent='$d_endpwent'
15934d_endsent='$d_endsent'
15935d_eofnblk='$d_eofnblk'
5f80c64f 15936d_eunice='$d_eunice'
b4eb6b3d
JH
15937d_fchmod='$d_fchmod'
15938d_fchown='$d_fchown'
15939d_fcntl='$d_fcntl'
9d9004a9 15940d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
15941d_fd_macros='$d_fd_macros'
15942d_fd_set='$d_fd_set'
15943d_fds_bits='$d_fds_bits'
15944d_fgetpos='$d_fgetpos'
15945d_flexfnam='$d_flexfnam'
15946d_flock='$d_flock'
15947d_fork='$d_fork'
15948d_fpathconf='$d_fpathconf'
15949d_fpos64_t='$d_fpos64_t'
15950d_frexpl='$d_frexpl'
15951d_fs_data_s='$d_fs_data_s'
15952d_fseeko='$d_fseeko'
15953d_fsetpos='$d_fsetpos'
15954d_fstatfs='$d_fstatfs'
15955d_fstatvfs='$d_fstatvfs'
411ab01c 15956d_fsync='$d_fsync'
b4eb6b3d
JH
15957d_ftello='$d_ftello'
15958d_ftime='$d_ftime'
15959d_getcwd='$d_getcwd'
15960d_getespwnam='$d_getespwnam'
15961d_getfsstat='$d_getfsstat'
15962d_getgrent='$d_getgrent'
15963d_getgrps='$d_getgrps'
15964d_gethbyaddr='$d_gethbyaddr'
15965d_gethbyname='$d_gethbyname'
15966d_gethent='$d_gethent'
15967d_gethname='$d_gethname'
15968d_gethostprotos='$d_gethostprotos'
15969d_getlogin='$d_getlogin'
15970d_getmnt='$d_getmnt'
15971d_getmntent='$d_getmntent'
15972d_getnbyaddr='$d_getnbyaddr'
15973d_getnbyname='$d_getnbyname'
15974d_getnent='$d_getnent'
15975d_getnetprotos='$d_getnetprotos'
0c0643d0 15976d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
15977d_getpbyname='$d_getpbyname'
15978d_getpbynumber='$d_getpbynumber'
15979d_getpent='$d_getpent'
15980d_getpgid='$d_getpgid'
15981d_getpgrp2='$d_getpgrp2'
15982d_getpgrp='$d_getpgrp'
15983d_getppid='$d_getppid'
15984d_getprior='$d_getprior'
15985d_getprotoprotos='$d_getprotoprotos'
15986d_getprpwnam='$d_getprpwnam'
15987d_getpwent='$d_getpwent'
15988d_getsbyname='$d_getsbyname'
15989d_getsbyport='$d_getsbyport'
15990d_getsent='$d_getsent'
15991d_getservprotos='$d_getservprotos'
15992d_getspnam='$d_getspnam'
15993d_gettimeod='$d_gettimeod'
5f80c64f 15994d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
15995d_grpasswd='$d_grpasswd'
15996d_hasmntopt='$d_hasmntopt'
15997d_htonl='$d_htonl'
15998d_iconv='$d_iconv'
15999d_index='$d_index'
16000d_inetaton='$d_inetaton'
16001d_int64_t='$d_int64_t'
16002d_isascii='$d_isascii'
16003d_isnan='$d_isnan'
16004d_isnanl='$d_isnanl'
16005d_killpg='$d_killpg'
16006d_lchown='$d_lchown'
16007d_ldbl_dig='$d_ldbl_dig'
16008d_link='$d_link'
16009d_locconv='$d_locconv'
16010d_lockf='$d_lockf'
16011d_longdbl='$d_longdbl'
16012d_longlong='$d_longlong'
16013d_lseekproto='$d_lseekproto'
16014d_lstat='$d_lstat'
16015d_madvise='$d_madvise'
16016d_mblen='$d_mblen'
16017d_mbstowcs='$d_mbstowcs'
16018d_mbtowc='$d_mbtowc'
16019d_memchr='$d_memchr'
16020d_memcmp='$d_memcmp'
16021d_memcpy='$d_memcpy'
16022d_memmove='$d_memmove'
16023d_memset='$d_memset'
16024d_mkdir='$d_mkdir'
16025d_mkdtemp='$d_mkdtemp'
16026d_mkfifo='$d_mkfifo'
16027d_mkstemp='$d_mkstemp'
16028d_mkstemps='$d_mkstemps'
16029d_mktime='$d_mktime'
16030d_mmap='$d_mmap'
16031d_modfl='$d_modfl'
16032d_mprotect='$d_mprotect'
16033d_msg='$d_msg'
16034d_msg_ctrunc='$d_msg_ctrunc'
16035d_msg_dontroute='$d_msg_dontroute'
16036d_msg_oob='$d_msg_oob'
16037d_msg_peek='$d_msg_peek'
16038d_msg_proxy='$d_msg_proxy'
16039d_msgctl='$d_msgctl'
16040d_msgget='$d_msgget'
16041d_msgrcv='$d_msgrcv'
16042d_msgsnd='$d_msgsnd'
16043d_msync='$d_msync'
16044d_munmap='$d_munmap'
16045d_mymalloc='$d_mymalloc'
16046d_nice='$d_nice'
16047d_nv_preserves_uv='$d_nv_preserves_uv'
16048d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16049d_off64_t='$d_off64_t'
16050d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16051d_oldpthreads='$d_oldpthreads'
16052d_oldsock='$d_oldsock'
16053d_open3='$d_open3'
16054d_pathconf='$d_pathconf'
16055d_pause='$d_pause'
16056d_perl_otherlibdirs='$d_perl_otherlibdirs'
16057d_phostname='$d_phostname'
16058d_pipe='$d_pipe'
16059d_poll='$d_poll'
5f80c64f 16060d_portable='$d_portable'
b4eb6b3d
JH
16061d_pthread_yield='$d_pthread_yield'
16062d_pwage='$d_pwage'
16063d_pwchange='$d_pwchange'
16064d_pwclass='$d_pwclass'
16065d_pwcomment='$d_pwcomment'
16066d_pwexpire='$d_pwexpire'
16067d_pwgecos='$d_pwgecos'
16068d_pwpasswd='$d_pwpasswd'
16069d_pwquota='$d_pwquota'
16070d_qgcvt='$d_qgcvt'
16071d_quad='$d_quad'
16072d_readdir='$d_readdir'
16073d_readlink='$d_readlink'
16074d_rename='$d_rename'
16075d_rewinddir='$d_rewinddir'
16076d_rmdir='$d_rmdir'
16077d_safebcpy='$d_safebcpy'
16078d_safemcpy='$d_safemcpy'
16079d_sanemcmp='$d_sanemcmp'
ef9f17be 16080d_sbrkproto='$d_sbrkproto'
b4eb6b3d
JH
16081d_sched_yield='$d_sched_yield'
16082d_scm_rights='$d_scm_rights'
16083d_seekdir='$d_seekdir'
16084d_select='$d_select'
16085d_sem='$d_sem'
16086d_semctl='$d_semctl'
16087d_semctl_semid_ds='$d_semctl_semid_ds'
16088d_semctl_semun='$d_semctl_semun'
16089d_semget='$d_semget'
16090d_semop='$d_semop'
16091d_setegid='$d_setegid'
16092d_seteuid='$d_seteuid'
16093d_setgrent='$d_setgrent'
16094d_setgrps='$d_setgrps'
16095d_sethent='$d_sethent'
16096d_setlinebuf='$d_setlinebuf'
16097d_setlocale='$d_setlocale'
16098d_setnent='$d_setnent'
16099d_setpent='$d_setpent'
16100d_setpgid='$d_setpgid'
16101d_setpgrp2='$d_setpgrp2'
16102d_setpgrp='$d_setpgrp'
16103d_setprior='$d_setprior'
16104d_setproctitle='$d_setproctitle'
16105d_setpwent='$d_setpwent'
16106d_setregid='$d_setregid'
16107d_setresgid='$d_setresgid'
16108d_setresuid='$d_setresuid'
16109d_setreuid='$d_setreuid'
16110d_setrgid='$d_setrgid'
16111d_setruid='$d_setruid'
16112d_setsent='$d_setsent'
16113d_setsid='$d_setsid'
16114d_setvbuf='$d_setvbuf'
16115d_sfio='$d_sfio'
16116d_shm='$d_shm'
16117d_shmat='$d_shmat'
16118d_shmatprototype='$d_shmatprototype'
16119d_shmctl='$d_shmctl'
16120d_shmdt='$d_shmdt'
16121d_shmget='$d_shmget'
16122d_sigaction='$d_sigaction'
983dbef6 16123d_sigprocmask='$d_sigprocmask'
b4eb6b3d
JH
16124d_sigsetjmp='$d_sigsetjmp'
16125d_socket='$d_socket'
16126d_socklen_t='$d_socklen_t'
16127d_sockpair='$d_sockpair'
16128d_socks5_init='$d_socks5_init'
16129d_sqrtl='$d_sqrtl'
16130d_statblks='$d_statblks'
16131d_statfs_f_flags='$d_statfs_f_flags'
16132d_statfs_s='$d_statfs_s'
16133d_statvfs='$d_statvfs'
16134d_stdio_cnt_lval='$d_stdio_cnt_lval'
16135d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
16136d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16137d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
16138d_stdio_stream_array='$d_stdio_stream_array'
16139d_stdiobase='$d_stdiobase'
16140d_stdstdio='$d_stdstdio'
16141d_strchr='$d_strchr'
16142d_strcoll='$d_strcoll'
16143d_strctcpy='$d_strctcpy'
16144d_strerrm='$d_strerrm'
16145d_strerror='$d_strerror'
16146d_strtod='$d_strtod'
16147d_strtol='$d_strtol'
16148d_strtold='$d_strtold'
16149d_strtoll='$d_strtoll'
28e5dec8 16150d_strtoq='$d_strtoq'
b4eb6b3d
JH
16151d_strtoul='$d_strtoul'
16152d_strtoull='$d_strtoull'
16153d_strtouq='$d_strtouq'
16154d_strxfrm='$d_strxfrm'
16155d_suidsafe='$d_suidsafe'
16156d_symlink='$d_symlink'
16157d_syscall='$d_syscall'
16158d_sysconf='$d_sysconf'
16159d_sysernlst='$d_sysernlst'
16160d_syserrlst='$d_syserrlst'
16161d_system='$d_system'
16162d_tcgetpgrp='$d_tcgetpgrp'
16163d_tcsetpgrp='$d_tcsetpgrp'
16164d_telldir='$d_telldir'
16165d_telldirproto='$d_telldirproto'
16166d_time='$d_time'
16167d_times='$d_times'
16168d_truncate='$d_truncate'
16169d_tzname='$d_tzname'
16170d_umask='$d_umask'
16171d_uname='$d_uname'
16172d_union_semun='$d_union_semun'
16173d_ustat='$d_ustat'
16174d_vendorarch='$d_vendorarch'
16175d_vendorbin='$d_vendorbin'
16176d_vendorlib='$d_vendorlib'
16177d_vfork='$d_vfork'
16178d_void_closedir='$d_void_closedir'
16179d_voidsig='$d_voidsig'
16180d_voidtty='$d_voidtty'
16181d_volatile='$d_volatile'
16182d_vprintf='$d_vprintf'
16183d_wait4='$d_wait4'
16184d_waitpid='$d_waitpid'
16185d_wcstombs='$d_wcstombs'
16186d_wctomb='$d_wctomb'
5f80c64f
JH
16187d_xenix='$d_xenix'
16188date='$date'
b4eb6b3d
JH
16189db_hashtype='$db_hashtype'
16190db_prefixtype='$db_prefixtype'
16191defvoidused='$defvoidused'
16192direntrytype='$direntrytype'
16193dlext='$dlext'
5f80c64f 16194dlsrc='$dlsrc'
b4eb6b3d
JH
16195doublesize='$doublesize'
16196drand01='$drand01'
16197dynamic_ext='$dynamic_ext'
16198eagain='$eagain'
16199ebcdic='$ebcdic'
5f80c64f
JH
16200echo='$echo'
16201egrep='$egrep'
16202emacs='$emacs'
16203eunicefix='$eunicefix'
16204exe_ext='$exe_ext'
16205expr='$expr'
b4eb6b3d
JH
16206extensions='$extensions'
16207fflushNULL='$fflushNULL'
16208fflushall='$fflushall'
5f80c64f
JH
16209find='$find'
16210firstmakefile='$firstmakefile'
16211flex='$flex'
b4eb6b3d
JH
16212fpossize='$fpossize'
16213fpostype='$fpostype'
16214freetype='$freetype'
16215full_ar='$full_ar'
16216full_csh='$full_csh'
16217full_sed='$full_sed'
5b463ca7 16218gccosandvers='$gccosandvers'
5f80c64f 16219gccversion='$gccversion'
b4eb6b3d
JH
16220gidformat='$gidformat'
16221gidsign='$gidsign'
16222gidsize='$gidsize'
16223gidtype='$gidtype'
5f80c64f
JH
16224glibpth='$glibpth'
16225grep='$grep'
b4eb6b3d
JH
16226groupcat='$groupcat'
16227groupstype='$groupstype'
5f80c64f 16228gzip='$gzip'
b4eb6b3d
JH
16229h_fcntl='$h_fcntl'
16230h_sysfile='$h_sysfile'
5f80c64f 16231hint='$hint'
b4eb6b3d
JH
16232hostcat='$hostcat'
16233i16size='$i16size'
16234i16type='$i16type'
16235i32size='$i32size'
16236i32type='$i32type'
16237i64size='$i64size'
16238i64type='$i64type'
16239i8size='$i8size'
16240i8type='$i8type'
16241i_arpainet='$i_arpainet'
16242i_bsdioctl='$i_bsdioctl'
16243i_db='$i_db'
16244i_dbm='$i_dbm'
16245i_dirent='$i_dirent'
5f80c64f 16246i_dld='$i_dld'
b4eb6b3d
JH
16247i_dlfcn='$i_dlfcn'
16248i_fcntl='$i_fcntl'
16249i_float='$i_float'
16250i_gdbm='$i_gdbm'
16251i_grp='$i_grp'
16252i_iconv='$i_iconv'
16253i_ieeefp='$i_ieeefp'
16254i_inttypes='$i_inttypes'
16255i_libutil='$i_libutil'
16256i_limits='$i_limits'
16257i_locale='$i_locale'
16258i_machcthr='$i_machcthr'
16259i_malloc='$i_malloc'
16260i_math='$i_math'
16261i_memory='$i_memory'
16262i_mntent='$i_mntent'
16263i_ndbm='$i_ndbm'
16264i_netdb='$i_netdb'
16265i_neterrno='$i_neterrno'
16266i_netinettcp='$i_netinettcp'
16267i_niin='$i_niin'
16268i_poll='$i_poll'
16269i_prot='$i_prot'
16270i_pthread='$i_pthread'
16271i_pwd='$i_pwd'
16272i_rpcsvcdbm='$i_rpcsvcdbm'
16273i_sfio='$i_sfio'
16274i_sgtty='$i_sgtty'
16275i_shadow='$i_shadow'
16276i_socks='$i_socks'
16277i_stdarg='$i_stdarg'
16278i_stddef='$i_stddef'
16279i_stdlib='$i_stdlib'
16280i_string='$i_string'
16281i_sunmath='$i_sunmath'
16282i_sysaccess='$i_sysaccess'
16283i_sysdir='$i_sysdir'
16284i_sysfile='$i_sysfile'
16285i_sysfilio='$i_sysfilio'
16286i_sysin='$i_sysin'
16287i_sysioctl='$i_sysioctl'
16288i_syslog='$i_syslog'
16289i_sysmman='$i_sysmman'
16290i_sysmode='$i_sysmode'
16291i_sysmount='$i_sysmount'
16292i_sysndir='$i_sysndir'
16293i_sysparam='$i_sysparam'
16294i_sysresrc='$i_sysresrc'
16295i_syssecrt='$i_syssecrt'
16296i_sysselct='$i_sysselct'
16297i_syssockio='$i_syssockio'
16298i_sysstat='$i_sysstat'
16299i_sysstatfs='$i_sysstatfs'
16300i_sysstatvfs='$i_sysstatvfs'
16301i_systime='$i_systime'
16302i_systimek='$i_systimek'
16303i_systimes='$i_systimes'
16304i_systypes='$i_systypes'
16305i_sysuio='$i_sysuio'
16306i_sysun='$i_sysun'
16307i_sysutsname='$i_sysutsname'
16308i_sysvfs='$i_sysvfs'
16309i_syswait='$i_syswait'
16310i_termio='$i_termio'
16311i_termios='$i_termios'
16312i_time='$i_time'
16313i_unistd='$i_unistd'
16314i_ustat='$i_ustat'
16315i_utime='$i_utime'
16316i_values='$i_values'
16317i_varargs='$i_varargs'
16318i_varhdr='$i_varhdr'
16319i_vfork='$i_vfork'
5f80c64f 16320ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
16321inc_version_list='$inc_version_list'
16322inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
16323incpath='$incpath'
16324inews='$inews'
b4eb6b3d
JH
16325installarchlib='$installarchlib'
16326installbin='$installbin'
16327installman1dir='$installman1dir'
16328installman3dir='$installman3dir'
16329installprefix='$installprefix'
16330installprefixexp='$installprefixexp'
16331installprivlib='$installprivlib'
16332installscript='$installscript'
16333installsitearch='$installsitearch'
16334installsitebin='$installsitebin'
16335installsitelib='$installsitelib'
16336installstyle='$installstyle'
16337installusrbinperl='$installusrbinperl'
16338installvendorarch='$installvendorarch'
16339installvendorbin='$installvendorbin'
16340installvendorlib='$installvendorlib'
16341intsize='$intsize'
4b661809 16342issymlink='$issymlink'
b4eb6b3d
JH
16343ivdformat='$ivdformat'
16344ivsize='$ivsize'
16345ivtype='$ivtype'
16346known_extensions='$known_extensions'
5f80c64f 16347ksh='$ksh'
5f80c64f
JH
16348ld='$ld'
16349lddlflags='$lddlflags'
16350ldflags='$ldflags'
b4eb6b3d
JH
16351ldflags_uselargefiles='$ldflags_uselargefiles'
16352ldlibpthname='$ldlibpthname'
5f80c64f
JH
16353less='$less'
16354lib_ext='$lib_ext'
16355libc='$libc'
b4eb6b3d 16356libperl='$libperl'
5f80c64f
JH
16357libpth='$libpth'
16358libs='$libs'
43999f95
JH
16359libsdirs='$libsdirs'
16360libsfiles='$libsfiles'
16361libsfound='$libsfound'
13b3f787 16362libspath='$libspath'
5f80c64f 16363libswanted='$libswanted'
b4eb6b3d 16364libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
16365line='$line'
16366lint='$lint'
16367lkflags='$lkflags'
16368ln='$ln'
16369lns='$lns'
16370locincpth='$locincpth'
16371loclibpth='$loclibpth'
b4eb6b3d
JH
16372longdblsize='$longdblsize'
16373longlongsize='$longlongsize'
16374longsize='$longsize'
5f80c64f
JH
16375lp='$lp'
16376lpr='$lpr'
16377ls='$ls'
b4eb6b3d
JH
16378lseeksize='$lseeksize'
16379lseektype='$lseektype'
5f80c64f
JH
16380mail='$mail'
16381mailx='$mailx'
16382make='$make'
16383make_set_make='$make_set_make'
b4eb6b3d
JH
16384mallocobj='$mallocobj'
16385mallocsrc='$mallocsrc'
16386malloctype='$malloctype'
16387man1dir='$man1dir'
16388man1direxp='$man1direxp'
16389man1ext='$man1ext'
16390man3dir='$man3dir'
16391man3direxp='$man3direxp'
16392man3ext='$man3ext'
5f80c64f
JH
16393mips_type='$mips_type'
16394mkdir='$mkdir'
b4eb6b3d
JH
16395mmaptype='$mmaptype'
16396modetype='$modetype'
5f80c64f 16397more='$more'
b4eb6b3d 16398multiarch='$multiarch'
5f80c64f 16399mv='$mv'
b4eb6b3d
JH
16400myarchname='$myarchname'
16401mydomain='$mydomain'
16402myhostname='$myhostname'
5f80c64f
JH
16403myuname='$myuname'
16404n='$n'
2cc61e15 16405need_va_copy='$need_va_copy'
b4eb6b3d
JH
16406netdb_hlen_type='$netdb_hlen_type'
16407netdb_host_type='$netdb_host_type'
16408netdb_name_type='$netdb_name_type'
16409netdb_net_type='$netdb_net_type'
5f80c64f
JH
16410nm='$nm'
16411nm_opt='$nm_opt'
16412nm_so_opt='$nm_so_opt'
b4eb6b3d 16413nonxs_ext='$nonxs_ext'
5f80c64f 16414nroff='$nroff'
b4eb6b3d
JH
16415nvEUformat='$nvEUformat'
16416nvFUformat='$nvFUformat'
16417nvGUformat='$nvGUformat'
16418nveformat='$nveformat'
16419nvfformat='$nvfformat'
16420nvgformat='$nvgformat'
16421nvsize='$nvsize'
16422nvtype='$nvtype'
16423o_nonblock='$o_nonblock'
5f80c64f 16424obj_ext='$obj_ext'
b4eb6b3d 16425old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 16426optimize='$optimize'
b4eb6b3d 16427orderlib='$orderlib'
5f80c64f
JH
16428osname='$osname'
16429osvers='$osvers'
b4eb6b3d 16430otherlibdirs='$otherlibdirs'
5f80c64f 16431package='$package'
b4eb6b3d
JH
16432pager='$pager'
16433passcat='$passcat'
16434patchlevel='$patchlevel'
5f80c64f 16435path_sep='$path_sep'
b4eb6b3d 16436perl5='$perl5'
5f80c64f 16437perl='$perl'
b4eb6b3d 16438perladmin='$perladmin'
9c839522 16439perllibs='$perllibs'
b4eb6b3d 16440perlpath='$perlpath'
5f80c64f 16441pg='$pg'
b4eb6b3d
JH
16442phostname='$phostname'
16443pidtype='$pidtype'
5f80c64f 16444plibpth='$plibpth'
b4eb6b3d 16445pm_apiversion='$pm_apiversion'
5f80c64f
JH
16446pmake='$pmake'
16447pr='$pr'
b4eb6b3d
JH
16448prefix='$prefix'
16449prefixexp='$prefixexp'
16450privlib='$privlib'
16451privlibexp='$privlibexp'
16452prototype='$prototype'
16453ptrsize='$ptrsize'
16454quadkind='$quadkind'
16455quadtype='$quadtype'
16456randbits='$randbits'
16457randfunc='$randfunc'
16458randseedtype='$randseedtype'
16459ranlib='$ranlib'
16460rd_nodata='$rd_nodata'
16461revision='$revision'
5f80c64f
JH
16462rm='$rm'
16463rmail='$rmail'
16464runnm='$runnm'
b4eb6b3d
JH
16465sPRIEUldbl='$sPRIEUldbl'
16466sPRIFUldbl='$sPRIFUldbl'
16467sPRIGUldbl='$sPRIGUldbl'
16468sPRIXU64='$sPRIXU64'
16469sPRId64='$sPRId64'
16470sPRIeldbl='$sPRIeldbl'
16471sPRIfldbl='$sPRIfldbl'
16472sPRIgldbl='$sPRIgldbl'
16473sPRIi64='$sPRIi64'
16474sPRIo64='$sPRIo64'
16475sPRIu64='$sPRIu64'
16476sPRIx64='$sPRIx64'
16477sSCNfldbl='$sSCNfldbl'
16478sched_yield='$sched_yield'
16479scriptdir='$scriptdir'
16480scriptdirexp='$scriptdirexp'
5f80c64f 16481sed='$sed'
b4eb6b3d
JH
16482seedfunc='$seedfunc'
16483selectminbits='$selectminbits'
16484selecttype='$selecttype'
5f80c64f
JH
16485sendmail='$sendmail'
16486sh='$sh'
16487shar='$shar'
16488sharpbang='$sharpbang'
b4eb6b3d
JH
16489shmattype='$shmattype'
16490shortsize='$shortsize'
16491shrpenv='$shrpenv'
5f80c64f 16492shsharp='$shsharp'
b4eb6b3d
JH
16493sig_count='$sig_count'
16494sig_name='$sig_name'
16495sig_name_init='$sig_name_init'
16496sig_num='$sig_num'
16497sig_num_init='$sig_num_init'
76d3c696 16498sig_size='$sig_size'
b4eb6b3d
JH
16499signal_t='$signal_t'
16500sitearch='$sitearch'
16501sitearchexp='$sitearchexp'
16502sitebin='$sitebin'
16503sitebinexp='$sitebinexp'
16504sitelib='$sitelib'
16505sitelib_stem='$sitelib_stem'
16506sitelibexp='$sitelibexp'
16507siteprefix='$siteprefix'
16508siteprefixexp='$siteprefixexp'
16509sizesize='$sizesize'
16510sizetype='$sizetype'
5f80c64f
JH
16511sleep='$sleep'
16512smail='$smail'
5f80c64f 16513so='$so'
b4eb6b3d
JH
16514sockethdr='$sockethdr'
16515socketlib='$socketlib'
16516socksizetype='$socksizetype'
5f80c64f
JH
16517sort='$sort'
16518spackage='$spackage'
16519spitshell='$spitshell'
5f80c64f 16520src='$src'
b4eb6b3d
JH
16521ssizetype='$ssizetype'
16522startperl='$startperl'
5f80c64f 16523startsh='$startsh'
b4eb6b3d
JH
16524static_ext='$static_ext'
16525stdchar='$stdchar'
16526stdio_base='$stdio_base'
16527stdio_bufsiz='$stdio_bufsiz'
16528stdio_cnt='$stdio_cnt'
16529stdio_filbuf='$stdio_filbuf'
16530stdio_ptr='$stdio_ptr'
16531stdio_stream_array='$stdio_stream_array'
16532strings='$strings'
5f80c64f 16533submit='$submit'
b4eb6b3d
JH
16534subversion='$subversion'
16535sysman='$sysman'
5f80c64f
JH
16536tail='$tail'
16537tar='$tar'
16538tbl='$tbl'
16539tee='$tee'
16540test='$test'
b4eb6b3d
JH
16541timeincl='$timeincl'
16542timetype='$timetype'
5f80c64f
JH
16543touch='$touch'
16544tr='$tr'
16545trnl='$trnl'
16546troff='$troff'
b4eb6b3d
JH
16547u16size='$u16size'
16548u16type='$u16type'
16549u32size='$u32size'
16550u32type='$u32type'
16551u64size='$u64size'
16552u64type='$u64type'
16553u8size='$u8size'
16554u8type='$u8type'
16555uidformat='$uidformat'
16556uidsign='$uidsign'
16557uidsize='$uidsize'
16558uidtype='$uidtype'
5f80c64f
JH
16559uname='$uname'
16560uniq='$uniq'
b4eb6b3d
JH
16561uquadtype='$uquadtype'
16562use5005threads='$use5005threads'
16563use64bitall='$use64bitall'
16564use64bitint='$use64bitint'
5f80c64f 16565usedl='$usedl'
b4eb6b3d
JH
16566useithreads='$useithreads'
16567uselargefiles='$uselargefiles'
16568uselongdouble='$uselongdouble'
16569usemorebits='$usemorebits'
16570usemultiplicity='$usemultiplicity'
16571usemymalloc='$usemymalloc'
5f80c64f 16572usenm='$usenm'
b4eb6b3d
JH
16573useopcode='$useopcode'
16574useperlio='$useperlio'
16575useposix='$useposix'
16576usesfio='$usesfio'
16577useshrplib='$useshrplib'
29209bc5 16578usesocks='$usesocks'
b4eb6b3d
JH
16579usethreads='$usethreads'
16580usevendorprefix='$usevendorprefix'
16581usevfork='$usevfork'
5f80c64f
JH
16582usrinc='$usrinc'
16583uuname='$uuname'
b4eb6b3d
JH
16584uvXUformat='$uvXUformat'
16585uvoformat='$uvoformat'
16586uvsize='$uvsize'
16587uvtype='$uvtype'
16588uvuformat='$uvuformat'
16589uvxformat='$uvxformat'
16590vendorarch='$vendorarch'
16591vendorarchexp='$vendorarchexp'
16592vendorbin='$vendorbin'
16593vendorbinexp='$vendorbinexp'
16594vendorlib='$vendorlib'
16595vendorlib_stem='$vendorlib_stem'
16596vendorlibexp='$vendorlibexp'
16597vendorprefix='$vendorprefix'
16598vendorprefixexp='$vendorprefixexp'
16599version='$version'
d56c5707 16600versiononly='$versiononly'
5f80c64f 16601vi='$vi'
b4eb6b3d 16602voidflags='$voidflags'
5f80c64f 16603xlibpth='$xlibpth'
b4eb6b3d 16604xs_apiversion='$xs_apiversion'
5f80c64f
JH
16605zcat='$zcat'
16606zip='$zip'
16607EOT
16608
16609: Add in command line options if available
16610$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16611
16612: add special variables
16613$test -f $src/patchlevel.h && \
d00b958f 16614awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
2000072c 16615echo "CONFIGDOTSH=true" >>config.sh
5f80c64f
JH
16616
16617: propagate old symbols
16618if $test -f UU/config.sh; then
381aa1ff 16619 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 16620 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 16621 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
16622 set X `cat UU/oldsyms`
16623 shift
16624 case $# in
16625 0) ;;
16626 *)
16627 cat <<EOM
16628Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16629EOM
16630 echo "# Variables propagated from previous config.sh file." >>config.sh
16631 for sym in `cat UU/oldsyms`; do
16632 echo " Propagating $hint variable "'$'"$sym..."
16633 eval 'tmp="$'"${sym}"'"'
16634 echo "$tmp" | \
16635 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16636 done
16637 ;;
16638 esac
16639fi
16640
16641: Finish up by extracting the .SH files
16642case "$alldone" in
16643exit)
16644 $rm -rf UU
16645 echo "Done."
16646 exit 0
16647 ;;
16648cont)
16649 ;;
16650'')
16651 dflt=''
16652 nostick=true
16653 $cat <<EOM
16654
16655If you'd like to make any changes to the config.sh file before I begin
16656to configure things, do it as a shell escape now (e.g. !vi config.sh).
16657
16658EOM
16659 rp="Press return or use a shell escape to edit config.sh:"
16660 . UU/myread
16661 nostick=''
16662 case "$ans" in
16663 '') ;;
16664 *) : in case they cannot read
16665 sh 1>&4 -c "$ans";;
16666 esac
16667 ;;
16668esac
16669
16670: if this fails, just run all the .SH files by hand
16671. ./config.sh
16672
16673echo " "
16674exec 1>&4
16675. ./UU/extract
16676
16677if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16678 dflt=y
16679 case "$silent" in
16680 true) ;;
16681 *)
16682 $cat <<EOM
16683
16684Now you need to generate make dependencies by running "$make depend".
16685You might prefer to run it in background: "$make depend > makedepend.out &"
16686It can take a while, so you might not want to run it right now.
16687
16688EOM
16689 ;;
16690 esac
16691 rp="Run $make depend now?"
16692 . UU/myread
16693 case "$ans" in
16694 y*)
3d5d58b1 16695 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
16696 ;;
16697 *)
16698 echo "You must run '$make depend' then '$make'."
16699 ;;
16700 esac
16701elif test -f [Mm]akefile; then
16702 echo " "
16703 echo "Now you must run a $make."
16704else
16705 echo "Done."
16706fi
16707
16708if $test -f Policy.sh; then
16709 $cat <<EOM
16710
16711If you compile $package on a different machine or from a different object
16712directory, copy the Policy.sh file from this object directory to the
16713new one before you run Configure -- this will help you with most of
16714the policy defaults.
16715
16716EOM
16717fi
16718if $test -f config.msg; then
16719 echo "Hmm. I also noted the following information while running:"
16720 echo " "
16721 $cat config.msg >&4
16722 $rm -f config.msg
16723fi
16724$rm -f kit*isdone ark*isdone
16725$rm -rf UU
16726
16727: End of Configure
16728