This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate changes #10450 and #10451 from maintperl:
[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#
24ccb310 23# Generated on Tue Jun 5 04:50:23 EET DST 2001 [metaconfig 3.0 PL70]
7f2de2d2 24# (with additional metaconfig patches by perlbug@perl.org)
2304df62 25
283fdd21 26cat >c1$$ <<EOF
2304df62
AD
27ARGGGHHHH!!!!!
28
29SCO csh still thinks true is false. Write to SCO today and tell them that next
30year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
33we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35[End of diatribe. We now return you to your regularly scheduled programming...]
36EOF
283fdd21 37cat >c2$$ <<EOF
2304df62
AD
38
39OOPS! You naughty creature! You didn't run Configure with sh!
40I will attempt to remedy the situation by running sh for you...
41EOF
42
283fdd21 43true || cat c1$$ c2$$
2304df62
AD
44true || exec sh $0 $argv:q
45
283fdd21 46(exit $?0) || cat c2$$
2304df62 47(exit $?0) || exec sh $0 $argv:q
283fdd21 48rm -f c1$$ c2$$
2304df62 49
a0d0e21e
LW
50: compute my invocation name
51me=$0
52case "$0" in
53*/*)
54 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55 test "$me" || me=$0
56 ;;
57esac
58
dfe9444c 59: Proper separator for the PATH environment variable
8e07c86e
AD
60p_=:
61: On OS/2 this directory should exist if this is not floppy only system :-]
dfe9444c
AD
62if test -d c:/. ; then
63 if test -n "$OS2_SHELL"; then
64 p_=\;
65 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
c4f23d77 67 elif test -n "$DJGPP"; then
dfe9444c
AD
68 p_=\;
69 fi
39e571d4 70fi
a0d0e21e
LW
71
72: Proper PATH setting
73paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 74paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 75paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 76paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e
AD
77paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80paths="$paths /sbin /usr/sbin /usr/libexec"
a0d0e21e
LW
81
82for p in $paths
83do
8e07c86e
AD
84 case "$p_$PATH$p_" in
85 *$p_$p$p_*) ;;
86 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
87 esac
88done
89
8e07c86e 90PATH=.$p_$PATH
2304df62
AD
91export PATH
92
dfe9444c
AD
93: shall we be using ksh?
94inksh=''
95needksh=''
96avoidksh=''
97newsh=/bin/ksh
98changesh=''
ff0cee69 99if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
100 inksh=true
101fi
102if test -f /hp-ux -a -f /bin/ksh; then
103 needksh='to avoid sh bug in "here document" expansion'
104fi
105if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106 if test X`/usr/bin/uname -v` = X4; then
107 avoidksh="to avoid AIX 4's /bin/sh"
108 newsh=/usr/bin/bsh
2304df62 109 fi
dfe9444c 110fi
cf04f91f
JH
111if test -f /osf_boot -a -f /usr/sbin/setld; then
112 if test X`/usr/bin/uname -s` = XOSF1; then
113 avoidksh="to avoid Digital UNIX' ksh"
114 newsh=/bin/sh
115 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116 fi
117fi
dfe9444c
AD
118case "$inksh/$needksh" in
119/[a-z]*)
c4f23d77 120 ENV=''
dfe9444c
AD
121 changesh=true
122 reason="$needksh"
123 ;;
124esac
125case "$inksh/$avoidksh" in
126true/[a-z]*)
127 changesh=true
128 reason="$avoidksh"
129 ;;
130esac
131case "$inksh/$needksh-$avoidksh-" in
132true/--)
a0d0e21e
LW
133 cat <<EOM
134(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 135mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 136EOM
dfe9444c
AD
137 ;;
138esac
139case "$changesh" in
140true)
141 echo "(Feeding myself to $newsh $reason.)"
142 case "$0" in
143 Configure|*/Configure) exec $newsh $0 "$@";;
144 *) exec $newsh Configure "$@";;
145 esac
146 ;;
147esac
2304df62 148
bfb7748a
AD
149: if needed set CDPATH to a harmless value that is not chatty
150: avoid bash 2.02 problems with empty CDPATH.
151case "$CDPATH" in
152'') ;;
153*) case "$SHELL" in
154 *bash*) CDPATH='.' ;;
155 *) CDPATH='' ;;
156 esac
157 ;;
158esac
2304df62
AD
159: Configure runs within the UU subdirectory
160test -d UU || mkdir UU
8e07c86e 161cd UU && rm -f ./*
2304df62 162
6b356c8e
JH
163ccname=''
164ccversion=''
b4eb6b3d
JH
165ccsymbols=''
166cppccsymbols=''
167cppsymbols=''
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 275afs=''
a6d26a0d 276afsroot=''
b4eb6b3d
JH
277alignbytes=''
278ansi2knr=''
279archlib=''
280archlibexp=''
281d_archlib=''
282installarchlib=''
283archname=''
284myarchname=''
285d_atolf=''
286d_atoll=''
287baserev=''
288bin=''
289binexp=''
290installbin=''
291bincompat5005=''
292d_bincompat5005=''
293byteorder=''
2304df62 294cc=''
2304df62
AD
295ccflags=''
296cppflags=''
297ldflags=''
298lkflags=''
8e07c86e 299locincpth=''
2304df62 300optimize=''
b4eb6b3d 301cf_email=''
2304df62
AD
302cf_by=''
303cf_time=''
b4eb6b3d 304charsize=''
2304df62 305contains=''
b4eb6b3d 306cpp_stuff=''
2304df62
AD
307cpplast=''
308cppminus=''
309cpprun=''
310cppstdin=''
b4eb6b3d 311crosscompile=''
74cac757 312d__fwalk=''
b4eb6b3d
JH
313d_access=''
314d_accessx=''
315d_alarm=''
316d_attribut=''
317d_bcmp=''
318d_bcopy=''
319d_bzero=''
320d_casti32=''
321castflags=''
322d_castneg=''
323d_chown=''
324d_chroot=''
325d_chsize=''
326d_closedir=''
327d_void_closedir=''
4e0554ec 328d_cmsghdr_s=''
b4eb6b3d
JH
329d_const=''
330cryptlib=''
331d_crypt=''
332d_csh=''
333full_csh=''
334d_cuserid=''
335d_dbl_dig=''
2ef53570 336d_dbminitproto=''
b4eb6b3d
JH
337d_difftime=''
338d_dlerror=''
a0d0e21e 339d_dlopen=''
b4eb6b3d
JH
340d_dlsymun=''
341d_dosuid=''
342d_suidsafe=''
343d_drand48proto=''
344d_dup2=''
345d_eaccess=''
346d_endgrent=''
347d_endhent=''
348d_endnent=''
349d_endpent=''
350d_endpwent=''
351d_endsent=''
352d_fchmod=''
353d_fchown=''
354d_fcntl=''
9d9004a9 355d_fcntl_can_lock=''
b4eb6b3d
JH
356d_fd_macros=''
357d_fd_set=''
358d_fds_bits=''
359d_fgetpos=''
360d_flexfnam=''
361d_flock=''
2ef53570 362d_flockproto=''
b4eb6b3d
JH
363d_fork=''
364d_fpos64_t=''
365d_frexpl=''
366d_fs_data_s=''
367d_fseeko=''
368d_fsetpos=''
369d_fstatfs=''
411ab01c 370d_fsync=''
b4eb6b3d
JH
371d_ftello=''
372d_ftime=''
373d_gettimeod=''
374d_Gconvert=''
375d_getcwd=''
376d_getespwnam=''
377d_getfsstat=''
378d_getgrent=''
379d_getgrps=''
380d_gethbyaddr=''
381d_gethbyname=''
382d_gethent=''
383aphostname=''
384d_gethname=''
385d_phostname=''
386d_uname=''
387d_gethostprotos=''
4e0554ec 388d_getitimer=''
b4eb6b3d
JH
389d_getlogin=''
390d_getmnt=''
391d_getmntent=''
392d_getnbyaddr=''
393d_getnbyname=''
394d_getnent=''
395d_getnetprotos=''
0c0643d0 396d_getpagsz=''
b4eb6b3d
JH
397d_getpent=''
398d_getpgid=''
399d_getpgrp2=''
400d_bsdgetpgrp=''
401d_getpgrp=''
402d_getppid=''
403d_getprior=''
404d_getpbyname=''
405d_getpbynumber=''
406d_getprotoprotos=''
407d_getprpwnam=''
408d_getpwent=''
409d_getsent=''
410d_getservprotos=''
411d_getspnam=''
412d_getsbyname=''
413d_getsbyport=''
a4f3eea9 414d_gnulibc=''
b4eb6b3d
JH
415d_hasmntopt=''
416d_htonl=''
417d_iconv=''
418d_inetaton=''
419d_int64_t=''
420d_isascii=''
421d_isnan=''
422d_isnanl=''
423d_killpg=''
424d_lchown=''
425d_ldbl_dig=''
426d_link=''
427d_locconv=''
428d_lockf=''
429d_longdbl=''
430longdblsize=''
431d_longlong=''
432longlongsize=''
433d_lseekproto=''
434d_lstat=''
435d_madvise=''
436d_mblen=''
437d_mbstowcs=''
438d_mbtowc=''
439d_memchr=''
440d_memcmp=''
441d_memcpy=''
442d_memmove=''
443d_memset=''
444d_mkdir=''
445d_mkdtemp=''
446d_mkfifo=''
447d_mkstemp=''
448d_mkstemps=''
449d_mktime=''
450d_mmap=''
451mmaptype=''
452d_modfl=''
453d_mprotect=''
454d_msg=''
455d_msgctl=''
456d_msgget=''
4e0554ec 457d_msghdr_s=''
b4eb6b3d
JH
458d_msgrcv=''
459d_msgsnd=''
460d_msync=''
461d_munmap=''
462d_nice=''
463d_off64_t=''
464d_open3=''
465d_fpathconf=''
466d_pathconf=''
467d_pause=''
468d_pipe=''
469d_poll=''
2304df62 470d_portable=''
b4eb6b3d
JH
471d_old_pthread_create_joinable=''
472old_pthread_create_joinable=''
473d_pthread_yield=''
474d_sched_yield=''
475sched_yield=''
476d_qgcvt=''
477d_readdir=''
478d_rewinddir=''
479d_seekdir=''
480d_telldir=''
481d_readlink=''
4e0554ec 482d_readv=''
640374d0 483d_realpath=''
4e0554ec 484d_recvmsg=''
b4eb6b3d
JH
485d_rename=''
486d_rmdir=''
487d_safebcpy=''
488d_safemcpy=''
489d_sanemcmp=''
ef9f17be 490d_sbrkproto=''
b4eb6b3d
JH
491d_select=''
492d_sem=''
493d_semctl=''
494d_semget=''
495d_semop=''
4e0554ec 496d_sendmsg=''
b4eb6b3d
JH
497d_setegid=''
498d_seteuid=''
499d_setgrent=''
500d_setgrps=''
501d_sethent=''
4e0554ec 502d_setitimer=''
b4eb6b3d
JH
503d_setlinebuf=''
504d_setlocale=''
505d_setnent=''
506d_setpent=''
507d_setpgid=''
508d_setpgrp2=''
509d_bsdsetpgrp=''
510d_setpgrp=''
511d_setprior=''
512d_setproctitle=''
513d_setpwent=''
514d_setregid=''
515d_setresgid=''
516d_setresuid=''
517d_setreuid=''
518d_setrgid=''
519d_setruid=''
520d_setsent=''
521d_setsid=''
522d_setvbuf=''
523d_sfio=''
524usesfio=''
525d_shm=''
526d_shmat=''
527d_shmatprototype=''
528shmattype=''
529d_shmctl=''
530d_shmdt=''
531d_shmget=''
532d_sigaction=''
983dbef6 533d_sigprocmask=''
b4eb6b3d 534d_sigsetjmp=''
49a78c82 535d_sockatmark=''
2ef53570 536d_sockatmarkproto=''
b4eb6b3d
JH
537d_msg_ctrunc=''
538d_msg_dontroute=''
539d_msg_oob=''
540d_msg_peek=''
541d_msg_proxy=''
542d_oldsock=''
543d_scm_rights=''
544d_socket=''
545d_sockpair=''
546sockethdr=''
547socketlib=''
548d_socklen_t=''
549d_socks5_init=''
550d_sqrtl=''
eef837ea 551d_sresgproto=''
640374d0 552d_sresuproto=''
b4eb6b3d
JH
553d_statblks=''
554d_statfs_f_flags=''
555d_statfs_s=''
556d_fstatvfs=''
557d_statvfs=''
558d_stdio_cnt_lval=''
559d_stdio_ptr_lval=''
a7ffa9b9
NC
560d_stdio_ptr_lval_nochange_cnt=''
561d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
562d_stdiobase=''
563d_stdstdio=''
564stdio_base=''
565stdio_bufsiz=''
566stdio_cnt=''
567stdio_filbuf=''
568stdio_ptr=''
569d_index=''
570d_strchr=''
571d_strcoll=''
572d_strctcpy=''
573d_strerrm=''
574d_strerror=''
575d_sysernlst=''
576d_syserrlst=''
b3c85772 577d_strftime=''
b4eb6b3d
JH
578d_strtod=''
579d_strtol=''
580d_strtold=''
581d_strtoll=''
28e5dec8 582d_strtoq=''
b4eb6b3d
JH
583d_strtoul=''
584d_strtoull=''
585d_strtouq=''
586d_strxfrm=''
587d_symlink=''
588d_syscall=''
2ef53570 589d_syscallproto=''
b4eb6b3d
JH
590d_sysconf=''
591d_system=''
592d_tcgetpgrp=''
593d_tcsetpgrp=''
594d_telldirproto=''
595d_time=''
596timetype=''
597clocktype=''
598d_times=''
599d_truncate=''
600d_tzname=''
4e0554ec
JH
601d_u32align=''
602d_ualarm=''
b4eb6b3d
JH
603d_umask=''
604d_semctl_semid_ds=''
605d_semctl_semun=''
606d_union_semun=''
4e0554ec 607d_usleep=''
2ef53570 608d_usleepproto=''
b4eb6b3d
JH
609d_ustat=''
610d_vfork=''
611usevfork=''
612d_voidsig=''
613signal_t=''
614d_volatile=''
615d_charvspr=''
616d_vprintf=''
617d_wait4=''
618d_waitpid=''
619d_wcstombs=''
620d_wctomb=''
4e0554ec 621d_writev=''
b4eb6b3d 622dlext=''
85e6fe83
LW
623cccdlflags=''
624ccdlflags=''
2304df62 625dlsrc=''
232e078e 626ld=''
85e6fe83 627lddlflags=''
2304df62 628usedl=''
b4eb6b3d
JH
629doublesize=''
630ebcdic=''
631fflushNULL=''
632fflushall=''
633fpossize=''
634fpostype=''
5b463ca7 635gccosandvers=''
8a27cf78 636gccversion=''
b4eb6b3d
JH
637gidformat=''
638gidsign=''
639gidsize=''
640gidtype=''
641groupstype=''
642h_fcntl=''
643h_sysfile=''
644i_arpainet=''
645db_hashtype=''
646db_prefixtype=''
640374d0
JH
647db_version_major=''
648db_version_minor=''
649db_version_patch=''
b4eb6b3d
JH
650i_db=''
651i_dbm=''
652i_rpcsvcdbm=''
653d_dirnamlen=''
654direntrytype=''
655i_dirent=''
a0d0e21e 656i_dld=''
b4eb6b3d
JH
657i_dlfcn=''
658i_fcntl=''
659i_float=''
660i_gdbm=''
661d_grpasswd=''
662i_grp=''
663i_iconv=''
664i_ieeefp=''
665i_inttypes=''
666i_libutil=''
667i_limits=''
668i_locale=''
669i_machcthr=''
670i_malloc=''
671i_math=''
672i_memory=''
673i_mntent=''
674i_ndbm=''
675i_netdb=''
676i_neterrno=''
677i_netinettcp=''
678i_niin=''
679i_sysin=''
680i_poll=''
681i_prot=''
682i_pthread=''
683d_pwage=''
684d_pwchange=''
685d_pwclass=''
686d_pwcomment=''
687d_pwexpire=''
688d_pwgecos=''
689d_pwpasswd=''
690d_pwquota=''
691i_pwd=''
692i_sfio=''
693i_shadow=''
694i_socks=''
695i_stddef=''
696i_stdlib=''
697i_string=''
698strings=''
699i_sunmath=''
700i_sysaccess=''
701i_sysdir=''
702i_sysfile=''
703d_voidtty=''
704i_bsdioctl=''
705i_sysfilio=''
706i_sysioctl=''
707i_syssockio=''
708i_syslog=''
709i_sysmman=''
710i_sysmode=''
711i_sysmount=''
712i_sysndir=''
713i_sysparam=''
714i_sysresrc=''
715i_syssecrt=''
716i_sysselct=''
717i_sysstat=''
718i_sysstatfs=''
719i_sysstatvfs=''
720i_systimes=''
721i_systypes=''
722i_sysuio=''
723i_sysun=''
724i_sysutsname=''
725i_sysvfs=''
726i_syswait=''
727i_sgtty=''
728i_termio=''
729i_termios=''
730i_systime=''
731i_systimek=''
732i_time=''
733timeincl=''
734i_unistd=''
735i_ustat=''
736i_utime=''
737i_values=''
738i_stdarg=''
739i_varargs=''
740i_varhdr=''
741i_vfork=''
742inc_version_list=''
743inc_version_list_init=''
744installprefix=''
745installprefixexp=''
746installstyle=''
747installusrbinperl=''
748intsize=''
749longsize=''
750shortsize=''
4b661809 751issymlink=''
2304df62 752libc=''
b4eb6b3d
JH
753ldlibpthname=''
754libperl=''
755shrpenv=''
756useshrplib=''
a0d0e21e 757glibpth=''
2304df62 758libpth=''
8e07c86e 759loclibpth=''
2304df62
AD
760plibpth=''
761xlibpth=''
1cfa4ec7 762ignore_versioned_solibs=''
2304df62 763libs=''
43999f95
JH
764libsdirs=''
765libsfiles=''
766libsfound=''
13b3f787 767libspath=''
85e6fe83 768lns=''
b4eb6b3d
JH
769d_PRIEUldbl=''
770d_PRIFUldbl=''
771d_PRIGUldbl=''
772d_PRIeldbl=''
773d_PRIfldbl=''
774d_PRIgldbl=''
775d_SCNfldbl=''
776sPRIEUldbl=''
777sPRIFUldbl=''
778sPRIGUldbl=''
779sPRIeldbl=''
780sPRIfldbl=''
781sPRIgldbl=''
782sSCNfldbl=''
783lseeksize=''
784lseektype=''
8ff267be 785make_set_make=''
b4eb6b3d
JH
786d_mymalloc=''
787freetype=''
788mallocobj=''
789mallocsrc=''
790malloctype=''
791usemymalloc=''
792installman1dir=''
793man1dir=''
794man1direxp=''
795man1ext=''
796installman3dir=''
797man3dir=''
798man3direxp=''
799man3ext=''
800modetype=''
801multiarch=''
802mydomain=''
803myhostname=''
804phostname=''
2304df62
AD
805c=''
806n=''
b4eb6b3d
JH
807d_eofnblk=''
808eagain=''
809o_nonblock=''
810rd_nodata=''
2cc61e15 811need_va_copy=''
b4eb6b3d
JH
812netdb_hlen_type=''
813netdb_host_type=''
814netdb_name_type=''
815netdb_net_type=''
816groupcat=''
817hostcat=''
818passcat=''
819orderlib=''
820ranlib=''
821d_perl_otherlibdirs=''
822otherlibdirs=''
2304df62
AD
823package=''
824spackage=''
b4eb6b3d
JH
825pager=''
826api_revision=''
827api_subversion=''
828api_version=''
829api_versionstring=''
830patchlevel=''
151e6568 831perl_patchlevel=''
b4eb6b3d
JH
832revision=''
833subversion=''
834version=''
835perl5=''
836perladmin=''
837perlpath=''
838d_nv_preserves_uv=''
839d_nv_preserves_uv_bits=''
840i16size=''
841i16type=''
842i32size=''
843i32type=''
844i64size=''
845i64type=''
846i8size=''
847i8type=''
848ivsize=''
849ivtype=''
850nvsize=''
851nvtype=''
852u16size=''
853u16type=''
854u32size=''
855u32type=''
856u64size=''
857u64type=''
858u8size=''
859u8type=''
860uvsize=''
861uvtype=''
862ivdformat=''
863nvEUformat=''
864nvFUformat=''
865nvGUformat=''
866nveformat=''
867nvfformat=''
868nvgformat=''
869uvXUformat=''
870uvoformat=''
871uvuformat=''
872uvxformat=''
873pidtype=''
874prefix=''
875prefixexp=''
876installprivlib=''
877privlib=''
878privlibexp=''
879prototype=''
880ptrsize=''
881d_PRIXU64=''
882d_PRId64=''
883d_PRIi64=''
884d_PRIo64=''
885d_PRIu64=''
886d_PRIx64=''
887sPRIXU64=''
888sPRId64=''
889sPRIi64=''
890sPRIo64=''
891sPRIu64=''
892sPRIx64=''
893d_quad=''
894quadkind=''
895quadtype=''
896uquadtype=''
897drand01=''
898randbits=''
899randfunc=''
900randseedtype=''
901seedfunc=''
902installscript=''
903scriptdir=''
904scriptdirexp=''
905selectminbits=''
906selecttype=''
8ff267be 907sh=''
b4eb6b3d
JH
908sig_count=''
909sig_name=''
910sig_name_init=''
911sig_num=''
912sig_num_init=''
76d3c696 913sig_size=''
b4eb6b3d
JH
914installsitearch=''
915sitearch=''
916sitearchexp=''
917installsitebin=''
918sitebin=''
919sitebinexp=''
920installsitelib=''
921sitelib=''
922sitelib_stem=''
923sitelibexp=''
924siteprefix=''
925siteprefixexp=''
926sizesize=''
927sizetype=''
a0d0e21e 928so=''
b4eb6b3d 929socksizetype=''
2304df62
AD
930sharpbang=''
931shsharp=''
932spitshell=''
dfe9444c 933src=''
b4eb6b3d
JH
934ssizetype=''
935startperl=''
2304df62 936startsh=''
b4eb6b3d
JH
937stdchar=''
938d_stdio_stream_array=''
939stdio_stream_array=''
940sysman=''
5ff3f7a4 941trnl=''
b4eb6b3d
JH
942uidformat=''
943uidsign=''
944uidsize=''
945uidtype=''
946archname64=''
947use64bitall=''
948use64bitint=''
949ccflags_uselargefiles=''
950ldflags_uselargefiles=''
951libswanted_uselargefiles=''
952uselargefiles=''
953uselongdouble=''
954usemorebits=''
955usemultiplicity=''
2304df62 956nm_opt=''
40a7a20a 957nm_so_opt=''
2304df62
AD
958runnm=''
959usenm=''
b4eb6b3d 960useperlio=''
29209bc5 961usesocks=''
b4eb6b3d
JH
962d_oldpthreads=''
963use5005threads=''
964useithreads=''
965usethreads=''
2304df62 966incpath=''
2304df62
AD
967mips_type=''
968usrinc=''
b4eb6b3d
JH
969d_vendorarch=''
970installvendorarch=''
971vendorarch=''
972vendorarchexp=''
973d_vendorbin=''
974installvendorbin=''
975vendorbin=''
976vendorbinexp=''
977d_vendorlib=''
978installvendorlib=''
979vendorlib=''
980vendorlib_stem=''
981vendorlibexp=''
982usevendorprefix=''
983vendorprefix=''
984vendorprefixexp=''
d56c5707 985versiononly=''
b4eb6b3d
JH
986defvoidused=''
987voidflags=''
988pm_apiversion=''
989xs_apiversion=''
3659ebf1
JH
990yacc=''
991yaccflags=''
2304df62
AD
992CONFIG=''
993
ecfc5424
AD
994define='define'
995undef='undef'
996smallmach='pdp11 i8086 z8000 i80286 iAPX286'
997rmlist=''
998
999: We must find out about Eunice early
1000eunicefix=':'
1001if test -f /etc/unixtovms; then
1002 eunicefix=/etc/unixtovms
1003fi
1004if test -f /etc/unixtovms.exe; then
1005 eunicefix=/etc/unixtovms.exe
1006fi
1007
b4eb6b3d 1008i_whoami=''
6b356c8e
JH
1009ccname=''
1010ccversion=''
9c839522 1011perllibs=''
b4eb6b3d
JH
1012: set useposix=false in your hint file to disable the POSIX extension.
1013useposix=true
1014: set useopcode=false in your hint file to disable the Opcode extension.
1015useopcode=true
dfe9444c 1016: Trailing extension. Override this in a hint file, if needed.
4e2a5f63 1017_exe=''
dfe9444c
AD
1018: Extra object files, if any, needed on this platform.
1019archobjs=''
b4eb6b3d 1020archname=''
ff935051
JH
1021: Possible local include directories to search.
1022: Set locincpth to "" in a hint file to defeat local include searches.
1023locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1024locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1025:
1026: no include file wanted by default
1027inclwanted=''
1028
b4eb6b3d 1029groupstype=''
732c9516
JH
1030: change the next line if compiling for Xenix/286 on Xenix/386
1031xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1032: Possible local library directories to search.
1033loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1034loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1035
1036: general looking path for locating libraries
5869b1f1 1037glibpth="/lib /usr/lib $xlibpth"
732c9516 1038glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1039test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1040test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1041
1042: Private path used by Configure to find libraries. Its value
1043: is prepended to libpth. This variable takes care of special
1044: machines, like the mips. Usually, it should be empty.
1045plibpth=''
1046
1cfa4ec7
GS
1047: default library list
1048libswanted=''
921b2963 1049: some systems want to use only the non-versioned libso:s
1cfa4ec7 1050ignore_versioned_solibs=''
b4eb6b3d
JH
1051archname64=''
1052ccflags_uselargefiles=''
1053ldflags_uselargefiles=''
1054libswanted_uselargefiles=''
1055: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1056: set usesocks on the Configure command line to enable socks.
b4eb6b3d
JH
1057: set usethreads on the Configure command line to enable threads.
1058: full support for void wanted by default
1059defvoidused=15
1060
ecfc5424 1061: List of libraries we want.
693762b4 1062: If anyone needs -lnet, put it in a hint file.
997d70a2 1063libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
69e84d1d 1064libswanted="$libswanted dld ld sun m c cposix posix"
f1066039 1065libswanted="$libswanted ndir dir crypt sec"
0c9177ab 1066libswanted="$libswanted ucb bsd BSD PW x iconv util"
1aef975c 1067: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1068: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1069glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1070glibpth="/usr/shlib $glibpth"
1071: Do not use vfork unless overridden by a hint file.
1072usevfork=false
1073
8ff267be 1074: Find the basic shell for Bourne shell scripts
1075case "$sh" in
1076'')
8ff267be 1077 case "$SYSTYPE" in
1078 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1079 *) xxx='/bin/sh';;
1080 esac
1081 if test -f "$xxx"; then
1082 sh="$xxx"
1083 else
1084 : Build up a list and do a single loop so we can 'break' out.
1085 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1086 for xxx in sh bash ksh pdksh ash; do
1087 for p in $pth; do
1088 try="$try ${p}/${xxx}"
1089 done
1090 done
1091 for xxx in $try; do
1092 if test -f "$xxx"; then
1093 sh="$xxx";
8ff267be 1094 break
1095 elif test -f "$xxx.exe"; then
1096 sh="$xxx";
8ff267be 1097 break
1098 fi
1099 done
1100 fi
1101 ;;
1102esac
1103
1104case "$sh" in
1105'') cat <<EOM >&2
1106$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1107
8ff267be 1108Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1109Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1110we'll try to straighten this all out.
8ff267be 1111EOM
1112 exit 1
1113 ;;
1114esac
1115
760ac839 1116: see if sh knows # comments
73614538 1117if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1118 shsharp=true
1119 spitshell=cat
760ac839
LW
1120 xcat=/bin/cat
1121 test -f $xcat || xcat=/usr/bin/cat
1122 echo "#!$xcat" >try
1123 $eunicefix try
1124 chmod +x try
1125 ./try > today
1126 if test -s today; then
760ac839
LW
1127 sharpbang='#!'
1128 else
1129 echo "#! $xcat" > try
1130 $eunicefix try
1131 chmod +x try
1132 ./try > today
1133 if test -s today; then
760ac839
LW
1134 sharpbang='#! '
1135 else
760ac839
LW
1136 sharpbang=': use '
1137 fi
1138 fi
1139else
dfe9444c 1140 echo " "
8ff267be 1141 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1142 shsharp=false
1143 cd ..
1144 echo "exec grep -v '^[ ]*#'" >spitshell
1145 chmod +x spitshell
1146 $eunicefix spitshell
1147 spitshell=`pwd`/spitshell
1148 cd UU
1149 echo "I presume that if # doesn't work, #! won't work either!"
1150 sharpbang=': use '
1151fi
1152rm -f try today
1153
1154: figure out how to guarantee sh startup
8ff267be 1155case "$startsh" in
1156'') startsh=${sharpbang}${sh} ;;
1157*)
760ac839 1158esac
760ac839
LW
1159cat >try <<EOSS
1160$startsh
1161set abc
1162test "$?abc" != 1
1163EOSS
1164
1165chmod +x try
1166$eunicefix try
1167if ./try; then
8ff267be 1168 : echo "Yup, it does."
760ac839 1169else
dfe9444c
AD
1170 echo "Hmm... '$startsh' does not guarantee sh startup..."
1171 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839
LW
1172fi
1173rm -f try
1174
aebf16e7
AD
1175
1176: Save command line options in file UU/cmdline.opt for later use in
1177: generating config.sh.
1178cat > cmdline.opt <<EOSH
1179# Configure command line arguments.
1180config_arg0='$0'
1181config_args='$*'
1182config_argc=$#
1183EOSH
1184argn=1
1185for arg in "$@"; do
1186 cat >>cmdline.opt <<EOSH
1187config_arg$argn='$arg'
1188EOSH
1189 argn=`expr $argn + 1`
1190done
1191
2304df62
AD
1192: produce awk script to parse command line options
1193cat >options.awk <<'EOF'
1194BEGIN {
02e93a22 1195 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1196
1197 len = length(optstr);
1198 for (i = 1; i <= len; i++) {
1199 c = substr(optstr, i, 1);
1200 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1201 if (a == ":") {
1202 arg[c] = 1;
1203 i++;
1204 }
1205 opt[c] = 1;
1206 }
1207}
1208{
1209 expect = 0;
1210 str = $0;
1211 if (substr(str, 1, 1) != "-") {
1212 printf("'%s'\n", str);
1213 next;
1214 }
1215 len = length($0);
1216 for (i = 2; i <= len; i++) {
1217 c = substr(str, i, 1);
1218 if (!opt[c]) {
1219 printf("-%s\n", substr(str, i));
1220 next;
1221 }
1222 printf("-%s\n", c);
1223 if (arg[c]) {
1224 if (i < len)
1225 printf("'%s'\n", substr(str, i + 1));
1226 else
1227 expect = 1;
1228 next;
1229 }
1230 }
1231}
1232END {
1233 if (expect)
1234 print "?";
1235}
1236EOF
1237
1238: process the command line options
4633a7c4
LW
1239set X `for arg in "$@"; do echo "X$arg"; done |
1240 sed -e s/X// | awk -f options.awk`
2304df62
AD
1241eval "set $*"
1242shift
1243rm -f options.awk
1244
1245: set up default values
1246fastread=''
1247reuseval=false
1248config_sh=''
1249alldone=''
1250error=''
1251silent=''
1252extractsh=''
ecfc5424 1253override=''
16d20bd9 1254knowitall=''
02e93a22 1255rm -f optdef.sh posthint.sh
28757baa 1256cat >optdef.sh <<EOS
1257$startsh
1258EOS
2304df62 1259
dfe9444c 1260
2304df62
AD
1261: option parsing
1262while test $# -gt 0; do
1263 case "$1" in
1264 -d) shift; fastread=yes;;
1265 -e) shift; alldone=cont;;
1266 -f)
1267 shift
1268 cd ..
1269 if test -r "$1"; then
1270 config_sh="$1"
1271 else
a0d0e21e 1272 echo "$me: cannot read config file $1." >&2
2304df62
AD
1273 error=true
1274 fi
1275 cd UU
1276 shift;;
1277 -h) shift; error=true;;
1278 -r) shift; reuseval=true;;
dfe9444c 1279 -s) shift; silent=true; realsilent=true;;
2304df62 1280 -E) shift; alldone=exit;;
16d20bd9 1281 -K) shift; knowitall=true;;
ecfc5424 1282 -O) shift; override=true;;
dfe9444c 1283 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1284 -D)
1285 shift
1286 case "$1" in
1287 *=)
1288 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1289 echo "$me: ignoring -D $1" >&2
1290 ;;
ecfc5424 1291 *=*) echo "$1" | \
1aef975c
AD
1292 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1293 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1294 esac
1295 shift
1296 ;;
1297 -U)
1298 shift
1299 case "$1" in
1aef975c 1300 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1301 *=*)
1302 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1303 echo "$me: ignoring -U $1" >&2
1304 ;;
1aef975c 1305 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1306 esac
1307 shift
1308 ;;
02e93a22
JH
1309 -A)
1310 shift
1311 xxx=''
1312 yyy="$1"
02e93a22 1313 zzz=''
5f83a3e9 1314 uuu=undef
02e93a22 1315 case "$yyy" in
5f83a3e9
JH
1316 *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1317 case "$zzz" in
1318 *:*) zzz='' ;;
1319 *) xxx=append
1320 zzz=" "`echo $yyy|sed 's!^[^=]*=!!'`
1321 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1322 esac
1323 ;;
1324 esac
1325 case "$xxx" in
1326 '') case "$yyy" in
1327 *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1328 yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1329 zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1330 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1331 *) xxx=`echo $yyy|sed 's!:.*!!'`
1332 yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1333 esac
1334 ;;
1335 esac
02e93a22
JH
1336 case "$xxx" in
1337 append)
5f83a3e9 1338 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1339 clear)
5f83a3e9 1340 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1341 define)
1342 case "$zzz" in
1343 '') zzz=define ;;
1344 esac
5f83a3e9 1345 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1346 eval)
5f83a3e9 1347 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1348 prepend)
5f83a3e9 1349 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1350 undef)
1351 case "$zzz" in
1352 '') zzz="$uuu" ;;
1353 esac
5f83a3e9
JH
1354 echo "$yyy=$zzz" >> posthint.sh ;;
1355 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1356 esac
bde6b06b 1357 shift
02e93a22 1358 ;;
dfe9444c 1359 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1360 exit 0;;
2304df62 1361 --) break;;
a0d0e21e 1362 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1363 *) break;;
1364 esac
1365done
1366
1367case "$error" in
1368true)
1369 cat >&2 <<EOM
2afac517 1370Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1371 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1372 -d : use defaults for all answers.
1373 -e : go on without questioning past the production of config.sh.
1374 -f : specify an alternate default configuration file.
1375 -h : print this help message and exit (with an error status).
1376 -r : reuse C symbols value if possible (skips costly nm extraction).
1377 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1378 -D : define symbol to have some value:
1379 -D symbol symbol gets the value 'define'
1380 -D symbol=value symbol gets the value 'value'
2304df62 1381 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1382 -K : do not use unless you know what you are doing.
ecfc5424 1383 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1384 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1385 -U : undefine symbol:
1386 -U symbol symbol gets the value 'undef'
1387 -U symbol= symbol gets completely empty
02e93a22 1388 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1389 -A symbol=value append " "value to symbol
02e93a22
JH
1390 -A append:symbol=value append value to symbol
1391 -A define:symbol=value define symbol to have value
02e93a22
JH
1392 -A clear:symbol define symbol to be ''
1393 -A define:symbol define symbol to be 'define'
1394 -A eval:symbol=value define symbol to be eval of value
1395 -A prepend:symbol=value prepend value to symbol
1396 -A undef:symbol define symbol to be 'undef'
1397 -A undef:symbol= define symbol to be ''
2304df62
AD
1398 -V : print version number and exit (with a zero status).
1399EOM
1400 exit 1
1401 ;;
1402esac
1403
dfe9444c
AD
1404: Sanity checks
1405case "$fastread$alldone" in
1406yescont|yesexit) ;;
1407*)
aaeb8e51
GS
1408 case "$extractsh" in
1409 true) ;;
1410 *)
1411 if test ! -t 0; then
1412 echo "Say 'sh Configure', not 'sh <Configure'"
1413 exit 1
1414 fi
1415 ;;
1416 esac
dfe9444c
AD
1417 ;;
1418esac
1419
2304df62
AD
1420exec 4>&1
1421case "$silent" in
1422true) exec 1>/dev/null;;
1423esac
1424
ecfc5424 1425: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1426touch optdef.sh
1427. ./optdef.sh
02e93a22
JH
1428: create the posthint manipulation script and leave the file out there...
1429touch posthint.sh
a0d0e21e 1430
2304df62 1431: set package name
85e6fe83 1432package=perl5
b4eb6b3d
JH
1433first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1434last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1435case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1436ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1437*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1438esac
2304df62 1439
2304df62
AD
1440: Some greps do not return status, grrr.
1441echo "grimblepritz" >grimble
1442if grep blurfldyick grimble >/dev/null 2>&1 ; then
1443 contains=contains
1444elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1445 contains=grep
1446else
1447 contains=contains
1448fi
1449rm -f grimble
1450: the following should work in any shell
1451case "$contains" in
1452contains*)
1453 echo " "
1454 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1455 cat >contains <<'EOSS'
1456grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1457EOSS
1458chmod +x contains
1459esac
1460
dfe9444c
AD
1461: Find the path to the source tree
1462case "$src" in
1463'') case "$0" in
b233458b
JH
1464 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1465 case "$src" in
1466 /*) ;;
8504afb7 1467 .) ;;
b233458b
JH
1468 *) src=`cd ../$src && pwd` ;;
1469 esac
1470 ;;
dfe9444c
AD
1471 *) src='.';;
1472 esac;;
1473esac
1474case "$src" in
1475'') src=/
1476 rsrc=/
1477 ;;
1478/*) rsrc="$src";;
1479*) rsrc="../$src";;
1480esac
1481if test -f $rsrc/Configure && \
1482 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1483then
1484 : found it, so we are ok.
1485else
1486 rsrc=''
1487 for src in . .. ../.. ../../.. ../../../..; do
1488 if test -f ../$src/Configure && \
1489 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1490 then
1491 rsrc=../$src
1492 break
1493 fi
1494 done
1495fi
1496case "$rsrc" in
1497'')
1498 cat <<EOM >&4
1499
1500Sorry, I can't seem to locate the source dir for $package. Please start
1501Configure with an explicit path -- i.e. /some/path/Configure.
1502
1503EOM
1504 exit 1
1505 ;;
1506../.) rsrc='..';;
1507*)
1508 echo " "
1509 echo "Sources for $package found in \"$src\"." >&4
1510 ;;
1511esac
1512
1513: script used to extract .SH files with variable substitutions
1514cat >extract <<'EOS'
a02608de 1515PERL_CONFIG_SH=true
dfe9444c 1516echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1517if test -f MANIFEST; then
1518 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1519else
1520 echo "(Looking for .SH files under the source directory.)"
1521 set x `(cd $src; find . -name "*.SH" -print)`
1522fi
1523shift
1524case $# in
15250) set x `(cd $src; echo *.SH)`; shift;;
1526esac
1527if test ! -f $src/$1; then
1528 shift
1529fi
1530mkdir_p='
1531name=$1;
1532create="";
1533while test $name; do
1534 if test ! -d "$name"; then
1535 create="$name $create";
1536 name=`echo $name | sed -e "s|^[^/]*$||"`;
1537 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1538 else
1539 name="";
1540 fi;
1541done;
1542for file in $create; do
1543 mkdir $file;
1544done
1545'
1546for file in $*; do
1547 case "$src" in
1548 ".")
1549 case "$file" in
1550 */*)
1551 dir=`expr X$file : 'X\(.*\)/'`
1552 file=`expr X$file : 'X.*/\(.*\)'`
1553 (cd $dir && . ./$file)
1554 ;;
1555 *)
1556 . ./$file
1557 ;;
1558 esac
1559 ;;
1560 *)
1561 case "$file" in
1562 */*)
1563 dir=`expr X$file : 'X\(.*\)/'`
1564 file=`expr X$file : 'X.*/\(.*\)'`
1565 (set x $dir; shift; eval $mkdir_p)
1566 sh <$src/$dir/$file
1567 ;;
1568 *)
1569 sh <$src/$file
1570 ;;
1571 esac
1572 ;;
1573 esac
1574done
1575if test -f $src/config_h.SH; then
1576 if test ! -f config.h; then
1577 : oops, they left it out of MANIFEST, probably, so do it anyway.
1578 . $src/config_h.SH
1579 fi
1580fi
1581EOS
1582
1583: extract files and exit if asked to do so
1584case "$extractsh" in
1585true)
1586 case "$realsilent" in
1587 true) ;;
1588 *) exec 1>&4;;
1589 esac
1590 case "$config_sh" in
1591 '') config_sh='config.sh';;
1592 esac
1593 echo " "
1594 echo "Fetching answers from $config_sh..."
1595 cd ..
1596 . $config_sh
1597 test "$override" && . ./optdef.sh
1598 echo " "
1599 . UU/extract
1600 rm -rf UU
24ccb310 1601 echo "Extraction done."
dfe9444c
AD
1602 exit 0
1603 ;;
1604esac
1605
1606: Eunice requires " " instead of "", can you believe it
1607echo " "
1608: Here we go...
1609echo "Beginning of configuration questions for $package."
1610
1611trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1612
2304df62
AD
1613: first determine how to suppress newline on echo command
1614echo " "
1615echo "Checking echo to see how to suppress newlines..."
1616(echo "hi there\c" ; echo " ") >.echotmp
1617if $contains c .echotmp >/dev/null 2>&1 ; then
1618 echo "...using -n."
1619 n='-n'
1620 c=''
1621else
1622 cat <<'EOM'
1623...using \c
1624EOM
1625 n=''
1626 c='\c'
1627fi
1628echo $n "The star should be here-->$c"
1629echo '*'
1630rm -f .echotmp
1631
1632: Now test for existence of everything in MANIFEST
1633echo " "
dfe9444c 1634if test -f $rsrc/MANIFEST; then
2304df62 1635 echo "First let's make sure your kit is complete. Checking..." >&4
dfe9444c 1636 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
2304df62 1637 rm -f missing
dfe9444c 1638 tmppwd=`pwd`
2304df62 1639 for filelist in x??; do
dfe9444c 1640 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
2304df62
AD
1641 done
1642 if test -s missing; then
1643 cat missing >&4
1644 cat >&4 <<'EOM'
1645
1646THIS PACKAGE SEEMS TO BE INCOMPLETE.
1647
1648You have the option of continuing the configuration process, despite the
1649distinct possibility that your kit is damaged, by typing 'y'es. If you
1650do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1651and contact the author (perlbug@perl.org).
2304df62
AD
1652
1653EOM
1654 echo $n "Continue? [n] $c" >&4
1655 read ans
1656 case "$ans" in
1657 y*)
1658 echo "Continuing..." >&4
1659 rm -f missing
1660 ;;
1661 *)
1662 echo "ABORTING..." >&4
1663 kill $$
1664 ;;
1665 esac
1666 else
dfe9444c 1667 echo "Looks good..."
2304df62
AD
1668 fi
1669else
1670 echo "There is no MANIFEST file. I hope your kit is complete !"
1671fi
1672rm -f missing x??
1673
5ff3f7a4
GS
1674echo " "
1675: Find the appropriate value for a newline for tr
1676if test -n "$DJGPP"; then
1677 trnl='\012'
1678fi
1679if test X"$trnl" = X; then
1680 case "`echo foo|tr '\n' x 2>/dev/null`" in
1681 foox) trnl='\n' ;;
1682 esac
1683fi
1684if test X"$trnl" = X; then
1685 case "`echo foo|tr '\012' x 2>/dev/null`" in
1686 foox) trnl='\012' ;;
1687 esac
1688fi
1689if test X"$trnl" = X; then
1690 cat <<EOM >&2
1691
1692$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1693
1694EOM
1695 exit 1
1696fi
1697
2304df62
AD
1698: compute the number of columns on the terminal for proper question formatting
1699case "$COLUMNS" in
1700'') COLUMNS='80';;
1701esac
1702
1703: set up the echo used in my read
1704myecho="case \"\$xxxm\" in
1705'') echo $n \"\$rp $c\" >&4;;
1706*) case \"\$rp\" in
1707 '') echo $n \"[\$xxxm] $c\";;
1708 *)
1709 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1710 echo \"\$rp\" >&4
1711 echo $n \"[\$xxxm] $c\" >&4
1712 else
1713 echo $n \"\$rp [\$xxxm] $c\" >&4
1714 fi
1715 ;;
1716 esac;;
1717esac"
1718
1719: now set up to do reads with possible shell escape and default assignment
1720cat <<EOSC >myread
28757baa 1721$startsh
2304df62
AD
1722xxxm=\$dflt
1723$myecho
1724ans='!'
1725case "\$fastread" in
1726yes) case "\$dflt" in
1727 '') ;;
1728 *) ans='';
1729 case "\$silent-\$rp" in
1730 true-) ;;
1731 *) echo " " >&4;;
1732 esac;;
1733 esac;;
1734*) case "\$silent" in
1735 true) case "\$rp" in
1736 '') ans='';;
1737 esac;;
1738 esac;;
1739esac
1740while expr "X\$ans" : "X!" >/dev/null; do
1741 read answ
1742 set x \$xxxm
1743 shift
dfe9444c 1744 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1745 case "\$answ" in
dfe9444c
AD
1746 "!")
1747 sh 1>&4
1748 echo " "
1749 $myecho
1750 ;;
1751 !*)
1752 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1753 shift
1754 sh 1>&4 -c "\$*"
1755 echo " "
1756 $myecho
1757 ;;
2304df62
AD
1758 "\$ans")
1759 case "\$ans" in
ecfc5424
AD
1760 \\&*)
1761 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1762 shift
1763 case "\$1" in
1764 -d)
1765 fastread=yes
40a7a20a 1766 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1767 ;;
1768 -*)
40a7a20a 1769 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1770 ;;
1771 esac
1772 $myecho
1773 ans=!
1774 ;;
2304df62
AD
1775 esac;;
1776 *)
1777 case "\$aok" in
1778 y)
1779 echo "*** Substitution done -- please confirm."
1780 xxxm="\$ans"
c9795ab7 1781 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1782 xxxm="\$ans"
1783 ans=!
1784 ;;
1785 *)
1786 echo "*** Error -- try again."
1787 ans=!
1788 ;;
1789 esac
1790 $myecho
1791 ;;
1792 esac
1793 case "\$ans\$xxxm\$nostick" in
1794 '')
1795 ans=!
1796 $myecho
1797 ;;
1798 esac
1799done
1800case "\$ans" in
1801'') ans="\$xxxm";;
1802esac
1803EOSC
1804
1805: create .config dir to save info across Configure sessions
1806test -d ../.config || mkdir ../.config
1807cat >../.config/README <<EOF
1808This directory created by Configure to save information that should
dfe9444c 1809persist across sessions for $package.
2304df62
AD
1810
1811You may safely delete it if you wish.
1812EOF
1813
9507cadf 1814xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 1815case "$usedevel" in
0107c034 1816$define|true|[yY]*) ;;
9507cadf 1817*) case "$xversion" in
0107c034
JH
1818 *[13579])
1819 cat >&4 <<EOH
1820*** WHOA THERE!!! ***
1821
1822 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
1823 The version of this $package distribution is $xversion, that is, odd,
1824 (as opposed to even) and that signifies a development release.
3d5d58b1 1825 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
1826
1827 Do ***NOT*** install this into production use.
1828 Data corruption and crashes are possible.
1829
1830 It is most seriously suggested that you do not continue any further
1831 unless you want to help in developing and debugging Perl.
1832
6adc6a45
JH
1833 If you *still* want to build perl, you can answer 'y' now,
1834 or pass -Dusedevel to Configure.
1835
0107c034
JH
1836EOH
1837 rp='Do you really want to continue?'
1838 dflt='n'
1839 . ./myread
1840 case "$ans" in
8feeef0e
JH
1841 [yY]) echo >&4 "Okay, continuing."
1842 usedevel="$define" ;;
0107c034
JH
1843 *) echo >&4 "Okay, bye."
1844 exit 1
1845 ;;
1846 esac
1847 ;;
1848 esac
1849 ;;
1850esac
8feeef0e
JH
1851case "$usedevel" in
1852$define|true|[yY]*)
1853 case "$versiononly" in
1854 '') versiononly="$define" ;;
1855 esac
1856 case "$installusrbinperl" in
1857 '') installusrbinperl="$undef" ;;
1858 esac
1859 ;;
1860esac
0107c034 1861
2304df62
AD
1862: general instructions
1863needman=true
1864firsttime=true
760ac839 1865user=`(logname) 2>/dev/null`
dfe9444c
AD
1866case "$user" in
1867'') user=`whoami 2>&1`;;
760ac839 1868esac
2304df62
AD
1869if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1870 firsttime=false
1871 echo " "
1872 rp='Would you like to see the instructions?'
1873 dflt=n
1874 . ./myread
1875 case "$ans" in
1876 [yY]*) ;;
1877 *) needman=false;;
1878 esac
1879fi
1880if $needman; then
1881 cat <<EOH
4e2a5f63 1882
2304df62 1883This installation shell script will examine your system and ask you questions
a0d0e21e 1884to determine how the perl5 package should be installed. If you get
2304df62
AD
1885stuck on a question, you may use a ! shell escape to start a subshell or
1886execute a command. Many of the questions will have default answers in square
1887brackets; typing carriage return will give you the default.
1888
1889On some of the questions which ask for file or directory names you are allowed
1890to use the ~name construct to specify the login directory belonging to "name",
1891even if you don't have a shell which knows about that. Questions where this is
1892allowed will be marked "(~name ok)".
1893
1894EOH
1895 rp=''
1896 dflt='Type carriage return to continue'
1897 . ./myread
1898 cat <<'EOH'
1899
1900The prompter used in this script allows you to use shell variables and
1901backticks in your answers. You may use $1, $2, etc... to refer to the words
1902in the default answer, as if the default line was a set of arguments given to a
1903script shell. This means you may also use $* to repeat the whole default line,
1904so you do not have to re-type everything to add something to the default.
1905
1906Everytime there is a substitution, you will have to confirm. If there is an
1907error (e.g. an unmatched backtick), the default answer will remain unchanged
1908and you will be prompted again.
1909
1910If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1911the questions and use the computed defaults (or the previous answers if there
1912was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1913You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1914on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1915
1916EOH
1917 . ./myread
1918 cat <<EOH
1919
1920Much effort has been expended to ensure that this shell script will run on any
1921Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1922Configure and run it again. If you can't run Configure for some reason,
1923you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 1924have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
1925
1926This installation script affects things in two ways:
1927
19281) it may do direct variable substitutions on some of the files included
1929 in this kit.
19302) it builds a config.h file for inclusion in C programs. You may edit
1931 any of these files as the need arises after running this script.
1932
1933If you make a mistake on a question, there is no easy way to back up to it
1934currently. The easiest thing to do is to edit config.sh and rerun all the SH
1935files. Configure will offer to let you do this before it runs the SH files.
1936
1937EOH
1938 dflt='Type carriage return to continue'
1939 . ./myread
1940 case "$firsttime" in
1941 true) echo $user >>../.config/instruct;;
1942 esac
1943fi
1944
2304df62
AD
1945: find out where common programs are
1946echo " "
1947echo "Locating common programs..." >&4
1948cat <<EOSC >loc
1949$startsh
1950case \$# in
19510) exit 1;;
1952esac
1953thing=\$1
1954shift
1955dflt=\$1
1956shift
1957for dir in \$*; do
1958 case "\$thing" in
1959 .)
1960 if test -d \$dir/\$thing; then
1961 echo \$dir
1962 exit 0
1963 fi
1964 ;;
1965 *)
a0d0e21e 1966 for thisthing in \$dir/\$thing; do
ecfc5424 1967 : just loop through to pick last item
a0d0e21e 1968 done
25f94b33 1969 if test -f \$thisthing; then
a0d0e21e 1970 echo \$thisthing
2304df62
AD
1971 exit 0
1972 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
1973 if test -n "$DJGPP"; then
1974 echo \$dir/\$thing.exe
1975 else
1976 : on Eunice apparently
1977 echo \$dir/\$thing
1978 fi
2304df62
AD
1979 exit 0
1980 fi
1981 ;;
1982 esac
1983done
1984echo \$dflt
1985exit 1
1986EOSC
1987chmod +x loc
1988$eunicefix loc
1989loclist="
1990awk
1991cat
b4eb6b3d
JH
1992comm
1993cp
2304df62
AD
1994echo
1995expr
1996grep
a0d0e21e 1997ls
dfe9444c 1998make
b4eb6b3d 1999mkdir
2304df62
AD
2000rm
2001sed
b4eb6b3d 2002sort
85e6fe83 2003touch
2304df62 2004tr
b4eb6b3d 2005uniq
2304df62
AD
2006"
2007trylist="
2008Mcc
dfe9444c 2009ar
3659ebf1 2010bison
b4eb6b3d 2011byacc
2304df62 2012cpp
b4eb6b3d 2013csh
2304df62
AD
2014date
2015egrep
8ff267be 2016gzip
b4eb6b3d 2017less
8ff267be 2018ln
b4eb6b3d 2019more
693762b4 2020nm
b4eb6b3d
JH
2021nroff
2022pg
2304df62
AD
2023test
2024uname
8ff267be 2025zip
2304df62 2026"
8e07c86e 2027pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2028pth="$pth /lib /usr/lib"
2029for file in $loclist; do
dfe9444c
AD
2030 eval xxx=\$$file
2031 case "$xxx" in
2032 /*|?:[\\/]*)
2033 if test -f "$xxx"; then
2034 : ok
2035 else
2036 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2037 xxx=`./loc $file $file $pth`
2038 fi
2039 ;;
2040 '') xxx=`./loc $file $file $pth`;;
2041 *) xxx=`./loc $xxx $xxx $pth`;;
2042 esac
2304df62
AD
2043 eval $file=$xxx
2044 eval _$file=$xxx
2045 case "$xxx" in
2046 /*)
2047 echo $file is in $xxx.
2048 ;;
8e07c86e
AD
2049 ?:[\\/]*)
2050 echo $file is in $xxx.
2051 ;;
2304df62 2052 *)
25f94b33
AD
2053 echo "I don't know where '$file' is, and my life depends on it." >&4
2054 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2055 exit 1
2304df62
AD
2056 ;;
2057 esac
2058done
2059echo " "
2060echo "Don't worry if any of the following aren't found..."
2061say=offhand
2062for file in $trylist; do
dfe9444c
AD
2063 eval xxx=\$$file
2064 case "$xxx" in
2065 /*|?:[\\/]*)
2066 if test -f "$xxx"; then
2067 : ok
2068 else
2069 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2070 xxx=`./loc $file $file $pth`
2071 fi
2072 ;;
2073 '') xxx=`./loc $file $file $pth`;;
2074 *) xxx=`./loc $xxx $xxx $pth`;;
2075 esac
2304df62
AD
2076 eval $file=$xxx
2077 eval _$file=$xxx
2078 case "$xxx" in
2079 /*)
2080 echo $file is in $xxx.
2081 ;;
8e07c86e
AD
2082 ?:[\\/]*)
2083 echo $file is in $xxx.
2084 ;;
2304df62
AD
2085 *)
2086 echo "I don't see $file out there, $say."
2087 say=either
2088 ;;
2089 esac
2090done
2091case "$egrep" in
2092egrep)
2093 echo "Substituting grep for egrep."
2094 egrep=$grep
2095 ;;
2096esac
8ff267be 2097case "$ln" in
2098ln)
2099 echo "Substituting cp for ln."
2100 ln=$cp
2101 ;;
2102esac
2304df62
AD
2103case "$test" in
2104test)
2105 echo "Hopefully test is built into your sh."
2106 ;;
2107*)
73614538 2108 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2109 echo "Using the test built into your sh."
2304df62
AD
2110 test=test
2111 _test=test
2112 fi
2113 ;;
2114esac
2115case "$echo" in
2116echo)
2117 echo "Hopefully echo is built into your sh."
2118 ;;
2119'') ;;
2120*)
2121 echo " "
2122echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2123 $echo $n "hi there$c" >foo1
2124 echo $n "hi there$c" >foo2
2125 if cmp foo1 foo2 >/dev/null 2>&1; then
2126 echo "They are compatible. In fact, they may be identical."
2127 else
2128 case "$n" in
2129 '-n') n='' c='\c';;
2130 *) n='-n' c='';;
2131 esac
2132 cat <<FOO
2133They are not compatible! You are probably running ksh on a non-USG system.
2134I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2135have echo built in and we may have to run some Bourne shell scripts. That
2136means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2137
2138FOO
2139 $echo $n "The star should be here-->$c"
2140 $echo "*"
2141 fi
2142 $rm -f foo1 foo2
2143 ;;
2144esac
2145
2573c5f9
JH
2146cat <<EOS >checkcc
2147$startsh
2148EOS
2149cat <<'EOSC' >>checkcc
2150case "$cc" in
2151'') ;;
2152*) $rm -f try try.*
2153 $cat >try.c <<EOM
2154int main(int argc, char *argv[]) {
2155 return 0;
2156}
2157EOM
e4778687 2158 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2159 :
2160 else
2161 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2162 despair=yes
2163 trygcc=yes
2164 case "$cc" in
2165 *gcc*) trygcc=no ;;
2166 esac
2167 case "`$cc -v -c try.c 2>&1`" in
2168 *gcc*) trygcc=no ;;
2169 esac
2170 if $test X"$trygcc" = Xyes; then
2171 if gcc -o try -c try.c; then
2172 echo " "
2173 echo "You seem to have a working gcc, though." >&4
2174 rp="Would you like to use it?"
2175 dflt=y
2176 if $test -f myread; then
2177 . ./myread
2178 else
2179 if $test -f UU/myread; then
2180 . ./UU/myread
2181 else
2182 echo "Cannot find myread, sorry. Aborting." >&2
2183 exit 1
2184 fi
2185 fi
2186 case "$ans" in
e723fc21 2187 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2573c5f9
JH
2188 esac
2189 fi
2190 fi
2191 if $test X"$despair" = Xyes; then
5dd4fbdf
MB
2192 $cat >&4 <<EOM
2193You need to find a working C compiler.
2194Either (purchase and) install the C compiler supplied by your OS vendor,
2195or for a free C compiler try http://gcc.gnu.org/
2196I cannot continue any further, aborting.
2197EOM
2573c5f9
JH
2198 exit 1
2199 fi
2200 fi
2201 $rm -f try try.*
2202 ;;
2203esac
2204EOSC
2205
a0d0e21e
LW
2206: determine whether symbolic links are supported
2207echo " "
2208$touch blurfl
2209if $ln -s blurfl sym > /dev/null 2>&1 ; then
2210 echo "Symbolic links are supported." >&4
2211 lns="$ln -s"
2212else
2213 echo "Symbolic links are NOT supported." >&4
2214 lns="$ln"
2215fi
2216$rm -f blurfl sym
2217
dafca956
JH
2218: determine whether symbolic links are supported
2219echo " "
2220case "$lns" in
2221*"ln -s")
2222 echo "Checking how to test for symbolic links..." >&4
2223 $lns blurfl sym
4b661809 2224 if $test "X$issymlink" = X; then
73614538 2225 sh -c "PATH= test -h sym" >/dev/null 2>&1
5d644a95
MB
2226 if test $? = 0; then
2227 issymlink="test -h"
2228 fi
2229 fi
2230 if $test "X$issymlink" = X; then
73614538 2231 if $test -h >/dev/null 2>&1; then
5d644a95
MB
2232 issymlink="$test -h"
2233 echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2234 fi
dafca956 2235 fi
4b661809 2236 if $test "X$issymlink" = X; then
dafca956 2237 if $test -L sym 2>/dev/null; then
5d644a95 2238 issymlink="$test -L"
dafca956
JH
2239 fi
2240 fi
4b661809 2241 if $test "X$issymlink" != X; then
5d644a95 2242 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2243 else
2244 echo "I do not know how you can test for symbolic links." >&4
2245 fi
2246 $rm -f blurfl sym
2247 ;;
2248*) echo "No symbolic links, so not testing for their testing..." >&4
2249 ;;
2250esac
2251echo " "
2252
2253
2254case "$mksymlinks" in
2255$define|true|[yY]*)
2256 case "$src" in
2257 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2258 exit 1
2259 ;;
4b661809 2260 *) case "$lns:$issymlink" in
7a800fca 2261 *"ln -s:"*"test -"?)
dafca956
JH
2262 echo "Creating the symbolic links..." >&4
2263 echo "(First creating the subdirectories...)" >&4
2264 cd ..
2265 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2266 read directory
2267 test -z "$directory" && break
2268 mkdir -p $directory
2269 done
2270 # Sanity check 1.
2271 if test ! -d t/base; then
2272 echo "Failed to create the subdirectories. Aborting." >&4
2273 exit 1
2274 fi
2275 echo "(Then creating the symlinks...)" >&4
2276 awk '{print $1}' $src/MANIFEST | while true; do
2277 read filename
2278 test -z "$filename" && break
2279 if test -f $filename; then
5d644a95 2280 if $issymlink $filename; then
dafca956
JH
2281 rm -f $filename
2282 fi
2283 fi
2284 if test -f $filename; then
2285 echo "$filename already exists, not symlinking."
2286 else
2287 ln -s $src/$filename $filename
2288 fi
2289 done
2290 # Sanity check 2.
2291 if test ! -f t/base/commonsense.t; then
2292 echo "Failed to create the symlinks. Aborting." >&4
2293 exit 1
2294 fi
2295 cd UU
2296 ;;
2297 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2298 ;;
2299 esac
2300 ;;
2301 esac
2302 ;;
2303esac
2304
ecfc5424
AD
2305: see whether [:lower:] and [:upper:] are supported character classes
2306echo " "
ecfc5424
AD
2307case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2308ABYZ)
2309 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2310 up='[:upper:]'
2311 low='[:lower:]'
2312 ;;
28e8609d
JH
2313*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2314 # (0xc9 and 0xd1), therefore that is a nice testing point.
2315 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2316 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2317 ij) up='[A-Z]'
2318 low='[a-z]'
2319 ;;
2320 esac
2321 fi
2322 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2323 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2324 ij) up='A-Z'
2325 low='a-z'
2326 ;;
2327 esac
2328 fi
2329 if test "X$up" = X -o "X$low" = X; then
2330 case "`echo IJ | od -x 2>/dev/null`" in
2331 *C9D1*|*c9d1*)
2332 echo "Hey, this might be EBCDIC." >&4
2333 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2334 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2335 ij) up='[A-IJ-RS-Z]'
2336 low='[a-ij-rs-z]'
2337 ;;
2338 esac
2339 fi
2340 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2341 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2342 ij) up='A-IJ-RS-Z'
2343 low='a-ij-rs-z'
2344 ;;
2345 esac
2346 fi
2347 ;;
2348 esac
2349 fi
2350esac
3eaeeeae 2351case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2352ij)
2353 echo "Using $up and $low to convert case." >&4
2354 ;;
ecfc5424 2355*)
28e8609d
JH
2356 echo "I don't know how to translate letters from upper to lower case." >&4
2357 echo "Your tr is not acting any way I know of." >&4
2358 exit 1
2359 ;;
ecfc5424
AD
2360esac
2361: set up the translation script tr, must be called with ./tr of course
2362cat >tr <<EOSC
2363$startsh
2364case "\$1\$2" in
2365'[A-Z][a-z]') exec $tr '$up' '$low';;
2366'[a-z][A-Z]') exec $tr '$low' '$up';;
2367esac
2368exec $tr "\$@"
2369EOSC
2370chmod +x tr
2371$eunicefix tr
2372
2304df62
AD
2373: Try to determine whether config.sh was made on this system
2374case "$config_sh" in
2375'')
43999f95
JH
2376myuname=`$uname -a 2>/dev/null`
2377$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2378# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2379# because the A-Z/a-z are not consecutive.
a0d0e21e 2380myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2381 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2382newmyuname="$myuname"
2304df62 2383dflt=n
16d20bd9
AD
2384case "$knowitall" in
2385'')
2386 if test -f ../config.sh; then
2387 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2388 eval "`grep myuname= ../config.sh`"
2389 fi
2390 if test "X$myuname" = "X$newmyuname"; then
2391 dflt=y
2392 fi
2304df62 2393 fi
16d20bd9
AD
2394 ;;
2395*) dflt=y;;
2396esac
2304df62
AD
2397
2398: Get old answers from old config file if Configure was run on the
2399: same system, otherwise use the hints.
2400hint=default
2401cd ..
2402if test -f config.sh; then
16d20bd9
AD
2403 echo " "
2404 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2405 . UU/myread
2406 case "$ans" in
f83701cd
AD
2407 n*|N*) echo "OK, I'll ignore it."
2408 mv config.sh config.sh.old
2409 myuname="$newmyuname"
2410 ;;
2304df62 2411 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2412 tmp_n="$n"
2413 tmp_c="$c"
85cad39c 2414 tmp_sh="$sh"
2304df62
AD
2415 . ./config.sh
2416 cp config.sh UU
ecfc5424
AD
2417 n="$tmp_n"
2418 c="$tmp_c"
85cad39c 2419 : Older versions did not always set $sh. Catch re-use of such
2420 : an old config.sh.
2421 case "$sh" in
2422 '') sh="$tmp_sh" ;;
2423 esac
2304df62
AD
2424 hint=previous
2425 ;;
2426 esac
2427fi
2573c5f9 2428. ./UU/checkcc
2304df62
AD
2429if test ! -f config.sh; then
2430 $cat <<EOM
2431
4e2a5f63
AD
2432First time through, eh? I have some defaults handy for some systems
2433that need some extra help getting the Configure answers right:
2304df62
AD
2434
2435EOM
dfe9444c 2436 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2437 dflt=''
2438 : Half the following guesses are probably wrong... If you have better
7f2de2d2 2439 : tests or hints, please send them to perlbug@perl.org
2304df62 2440 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2441 $test -f /irix && osname=irix
85e6fe83
LW
2442 $test -f /xenix && osname=sco_xenix
2443 $test -f /dynix && osname=dynix
2444 $test -f /dnix && osname=dnix
5f05dabc 2445 $test -f /lynx.os && osname=lynxos
2446 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2447 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2448 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2449 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2450 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2451 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2452 $test -d /usr/apollo/bin && osname=apollo
2453 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2454 $test -d /usr/include/minix && osname=minix
e060872b 2455 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2456 osname=machten
4633a7c4 2457 if $test -x /sbin/version; then
dfe9444c 2458 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2459 $sed -e 's/[A-Za-z]$//'`
2460 elif $test -x /usr/etc/version; then
dfe9444c 2461 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2462 $sed -e 's/[A-Za-z]$//'`
2463 else
2464 osvers="$2.$3"
2465 fi
2466 fi
aaacdc8b
GS
2467
2468 $test -f /sys/posix.dll &&
2469 $test -f /usr/bin/what &&
2470 set X `/usr/bin/what /sys/posix.dll` &&
2471 $test "$3" = UWIN &&
2472 osname=uwin &&
2473 osvers="$5"
2474
2304df62
AD
2475 if $test -f $uname; then
2476 set X $myuname
2477 shift
2478
2304df62 2479 case "$5" in
85e6fe83 2480 fps*) osname=fps ;;
2304df62
AD
2481 mips*)
2482 case "$4" in
85e6fe83
LW
2483 umips) osname=umips ;;
2484 *) osname=mips ;;
2304df62 2485 esac;;
85e6fe83
LW
2486 [23]100) osname=mips ;;
2487 next*) osname=next ;;
ecfc5424 2488 i386*)
c6912327
JH
2489 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2490 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2491 osname='sco'
2492 osvers=$tmp
2493 elif $test -f /etc/kconfig; then
ecfc5424 2494 osname=isc
bd628c73 2495 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2496 osvers=4
2497 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2498 osvers=3
2304df62 2499 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2500 osvers=2
ecfc5424
AD
2501 fi
2502 fi
2000072c 2503 tmp=''
ecfc5424 2504 ;;
c4f23d77
AD
2505 pc*)
2506 if test -n "$DJGPP"; then
2507 osname=dos
2508 osvers=djgpp
2509 fi
2510 ;;
2304df62
AD
2511 esac
2512
2513 case "$1" in
a0d0e21e
LW
2514 aix) osname=aix
2515 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2516 case "$tmp" in
1aef975c 2517 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2518 '<3240'|'<>3240') osvers=3.2.0 ;;
2519 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2520 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2521 *) osvers=$tmp;;
a0d0e21e
LW
2522 esac
2523 ;;
aaacdc8b
GS
2524 bsd386) osname=bsd386
2525 osvers=`$uname -r`
2526 ;;
2527 cygwin*) osname=cygwin
2528 osvers="$3"
2529 ;;
23f87696
SZ
2530 *dc.osx) osname=dcosx
2531 osvers="$3"
2532 ;;
a0d0e21e
LW
2533 dnix) osname=dnix
2534 osvers="$3"
2535 ;;
2536 domainos) osname=apollo
2537 osvers="$3"
2538 ;;
2539 dgux) osname=dgux
2540 osvers="$3"
2541 ;;
760ac839 2542 dynixptx*) osname=dynixptx
e58e581d 2543 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2544 ;;
a0d0e21e
LW
2545 freebsd) osname=freebsd
2546 osvers="$3" ;;
2547 genix) osname=genix ;;
2548 hp*) osname=hpux
bfb7748a 2549 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2550 ;;
a78b0d02 2551 irix*) osname=irix
a0d0e21e
LW
2552 case "$3" in
2553 4*) osvers=4 ;;
2554 5*) osvers=5 ;;
ecfc5424 2555 *) osvers="$3" ;;
a0d0e21e
LW
2556 esac
2557 ;;
2558 linux) osname=linux
2559 case "$3" in
a0d0e21e
LW
2560 *) osvers="$3" ;;
2561 esac
2562 ;;
28e8609d
JH
2563 MiNT) osname=mint
2564 ;;
2565 netbsd*) osname=netbsd
ecfc5424
AD
2566 osvers="$3"
2567 ;;
4e81affe
MM
2568 news-os) osvers="$3"
2569 case "$3" in
2570 4*) osname=newsos4 ;;
2571 *) osname=newsos ;;
2572 esac
2573 ;;
aaacdc8b 2574 next*) osname=next ;;
28bb1e2c 2575 nonstop-ux) osname=nonstopux ;;
aaacdc8b
GS
2576 POSIX-BC | posix-bc ) osname=posix-bc
2577 osvers="$3"
a0d0e21e 2578 ;;
ae3afa4e
TH
2579 powerux | power_ux | powermax_os | powermaxos | \
2580 powerunix | power_unix) osname=powerux
2581 osvers="$3"
2582 ;;
aaacdc8b
GS
2583 qnx) osname=qnx
2584 osvers="$4"
2585 ;;
a0d0e21e
LW
2586 solaris) osname=solaris
2587 case "$3" in
2588 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2589 *) osvers="$3" ;;
a0d0e21e
LW
2590 esac
2591 ;;
85e6fe83
LW
2592 sunos) osname=sunos
2593 case "$3" in
85e6fe83
LW
2594 5*) osname=solaris
2595 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2596 *) osvers="$3" ;;
2304df62
AD
2597 esac
2598 ;;
a0d0e21e 2599 titanos) osname=titanos
85e6fe83 2600 case "$3" in
a0d0e21e
LW
2601 1*) osvers=1 ;;
2602 2*) osvers=2 ;;
2603 3*) osvers=3 ;;
2604 4*) osvers=4 ;;
ecfc5424 2605 *) osvers="$3" ;;
2304df62
AD
2606 esac
2607 ;;
85e6fe83 2608 ultrix) osname=ultrix
ecfc5424 2609 osvers="$3"
2304df62 2610 ;;
28757baa 2611 osf1|mls+) case "$5" in
fed7345c
AD
2612 alpha)
2613 osname=dec_osf
2aa76180
JH
2614 osvers=`sizer -v | awk '{print $3}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2615 case "$osvers" in
2616 [1-9].[0-9]*) ;;
2617 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2618 esac
ecfc5424
AD
2619 ;;
2620 hp*) osname=hp_osf1 ;;
2621 mips) osname=mips_osf1 ;;
85e6fe83
LW
2622 esac
2623 ;;
0337d152
BG
2624 unixware) osname=svr5
2625 osvers="$4"
2626 ;;
2627 uts) osname=uts
a0d0e21e
LW
2628 osvers="$3"
2629 ;;
85e6fe83 2630 $2) case "$osname" in
2304df62 2631 *isc*) ;;
a0d0e21e 2632 *freebsd*) ;;
5f05dabc 2633 svr*)
a0d0e21e
LW
2634 : svr4.x or possibly later
2635 case "svr$3" in
2636 ${osname}*)
2637 osname=svr$3
2638 osvers=$4
2639 ;;
2640 esac
2641 case "$osname" in
2642 svr4.0)
2643 : Check for ESIX
2644 if test -f /stand/boot ; then
2645 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2646 if test -n "$INITPROG" -a -f "$INITPROG"; then
2647 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2648 if test -n "$isesix"; then
a0d0e21e
LW
2649 osname=esix4
2650 fi
2651 fi
2652 fi
2653 ;;
2654 esac
2655 ;;
2304df62 2656 *) if test -f /etc/systemid; then
a0d0e21e
LW
2657 osname=sco
2658 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2659 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2660 osvers=$1.$2.$3
c4f23d77 2661 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2662 osvers=$1.$2
c4f23d77 2663 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2664 osvers=$1
2304df62 2665 fi
a0d0e21e
LW
2666 else
2667 case "$osname" in
2668 '') : Still unknown. Probably a generic Sys V.
2669 osname="sysv"
2670 osvers="$3"
2671 ;;
2672 esac
2304df62
AD
2673 fi
2674 ;;
2675 esac
2676 ;;
a0d0e21e
LW
2677 *) case "$osname" in
2678 '') : Still unknown. Probably a generic BSD.
2679 osname="$1"
2680 osvers="$3"
2681 ;;
2682 esac
2683 ;;
2304df62
AD
2684 esac
2685 else
dfe9444c
AD
2686 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2687 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2688 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2689 osname=news_os
2304df62 2690 fi
dfe9444c 2691 $rm -f UU/kernel.what
8e07c86e
AD
2692 elif test -d c:/.; then
2693 set X $myuname
2694 osname=os2
2695 osvers="$5"
2304df62
AD
2696 fi
2697 fi
85e6fe83 2698
a0d0e21e
LW
2699 : Now look for a hint file osname_osvers, unless one has been
2700 : specified already.
2701 case "$hintfile" in
2702 ''|' ')
1e127011 2703 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 2704 : Also try without trailing minor version numbers.
1e127011
DD
2705 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2706 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2707 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2708 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
2709 case "$file" in
2710 '') dflt=none ;;
2711 *) case "$osvers" in
2712 '') dflt=$file
2713 ;;
dfe9444c 2714 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 2715 dflt=$file
dfe9444c 2716 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 2717 dflt=$xfile
dfe9444c 2718 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 2719 dflt=$xxfile
dfe9444c 2720 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 2721 dflt=$xxxfile
dfe9444c 2722 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 2723 dflt=$xxxxfile
dfe9444c 2724 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
2725 dflt="${osname}"
2726 else
2727 dflt=none
2728 fi
2729 ;;
2730 esac
85e6fe83
LW
2731 ;;
2732 esac
4e2a5f63
AD
2733 if $test -f Policy.sh ; then
2734 case "$dflt" in
2735 *Policy*) ;;
2736 none) dflt="Policy" ;;
2737 *) dflt="Policy $dflt" ;;
2738 esac
2739 fi
85e6fe83 2740 ;;
a0d0e21e 2741 *)
ecfc5424 2742 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 2743 ;;
2304df62 2744 esac
1aef975c 2745
4e2a5f63
AD
2746 if $test -f Policy.sh ; then
2747 $cat <<EOM
2748
2749There's also a Policy hint file available, which should make the
2750site-specific (policy) questions easier to answer.
2751EOM
2752
2753 fi
2754
2304df62
AD
2755 $cat <<EOM
2756
2757You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 2758A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 2759is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
2760
2761EOM
4e2a5f63 2762
2304df62 2763 rp="Which of these apply, if any?"
dfe9444c 2764 . UU/myread
85e6fe83
LW
2765 tans=$ans
2766 for file in $tans; do
4e2a5f63
AD
2767 if $test X$file = XPolicy -a -f Policy.sh; then
2768 . Policy.sh
2769 $cat Policy.sh >> UU/config.sh
2770 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
2771 . $src/hints/$file.sh
2772 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83 2773 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
2774 : nothing
2775 else
85e6fe83
LW
2776 : Give one chance to correct a possible typo.
2777 echo "$file.sh does not exist"
2778 dflt=$file
2779 rp="hint to use instead?"
dfe9444c 2780 . UU/myread
85e6fe83 2781 for file in $ans; do
dfe9444c
AD
2782 if $test -f "$src/hints/$file.sh"; then
2783 . $src/hints/$file.sh
2784 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
2785 elif $test X$ans = X -o X$ans = Xnone ; then
2786 : nothing
2787 else
2788 echo "$file.sh does not exist -- ignored."
2789 fi
2790 done
2304df62
AD
2791 fi
2792 done
85e6fe83 2793
2304df62 2794 hint=recommended
85e6fe83 2795 : Remember our hint file for later.
dfe9444c 2796 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 2797 hintfile="$file"
85e6fe83 2798 else
a0d0e21e 2799 hintfile=''
85e6fe83 2800 fi
2304df62
AD
2801fi
2802cd UU
2803;;
2804*)
2805 echo " "
2806 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
2807 tmp_n="$n"
2808 tmp_c="$c"
2304df62
AD
2809 cd ..
2810 cp $config_sh config.sh 2>/dev/null
a78b0d02 2811 chmod +w config.sh
2304df62
AD
2812 . ./config.sh
2813 cd UU
2814 cp ../config.sh .
ecfc5424
AD
2815 n="$tmp_n"
2816 c="$tmp_c"
2304df62
AD
2817 hint=previous
2818 ;;
2819esac
1aef975c 2820test "$override" && . ./optdef.sh
2304df62
AD
2821
2822: Restore computed paths
2823for file in $loclist $trylist; do
2824 eval $file="\$_$file"
2825done
2826
85e6fe83 2827cat << EOM
a0d0e21e 2828
85e6fe83 2829Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
2830The default value is probably right if the name rings a bell. Otherwise,
2831since spelling matters for me, either accept the default or answer "none"
2832to leave it blank.
a0d0e21e 2833
85e6fe83 2834EOM
85e6fe83 2835case "$osname" in
a0d0e21e 2836 ''|' ')
85e6fe83 2837 case "$hintfile" in
a0d0e21e 2838 ''|' '|none) dflt=none ;;
ecfc5424 2839 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
2840 esac
2841 ;;
2842 *) dflt="$osname" ;;
2843esac
2844rp="Operating system name?"
2845. ./myread
2846case "$ans" in
ecfc5424
AD
2847none) osname='' ;;
2848*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 2849esac
8ff267be 2850echo " "
2851case "$osvers" in
2852 ''|' ')
2853 case "$hintfile" in
2854 ''|' '|none) dflt=none ;;
2855 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2856 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2857 case "$dflt" in
2858 ''|' ') dflt=none ;;
2859 esac
2860 ;;
2861 esac
2862 ;;
2863 *) dflt="$osvers" ;;
2864esac
2865rp="Operating system version?"
2866. ./myread
2867case "$ans" in
2868none) osvers='' ;;
2869*) osvers="$ans" ;;
2870esac
2871
02e93a22
JH
2872
2873. ./posthint.sh
2874
2304df62 2875: who configured the system
59b83a6f 2876cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 2877cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
2878case "$cf_by" in
2879"")
8ff267be 2880 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
2881 case "$cf_by" in
2882 "") cf_by=unknown ;;
8ff267be 2883 esac ;;
2884esac
2304df62 2885
b4eb6b3d
JH
2886: set up the script used to warn in case of inconsistency
2887cat <<EOS >whoa
2888$startsh
2889EOS
2890cat <<'EOSC' >>whoa
2891dflt=y
2892echo " "
2893echo "*** WHOA THERE!!! ***" >&4
2894echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2895rp=" Keep the $hint value?"
2896. ./myread
2897case "$ans" in
2898y) td=$was; tu=$was;;
2899esac
2900EOSC
2901
2902: function used to set $1 to $val
2903setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2904case "$val$was" in
2905$define$undef) . ./whoa; eval "$var=\$td";;
2906$undef$define) . ./whoa; eval "$var=\$tu";;
2907*) eval "$var=$val";;
2908esac'
2909
2910case "$usethreads" in
2911$define|true|[yY]*) dflt='y';;
2912*) dflt='n';;
2913esac
2914cat <<EOM
2915
2916Perl can be built to take advantage of threads on some systems.
2917To do so, Configure can be run with -Dusethreads.
2918
2919Note that threading is a highly experimental feature, and
2920some known race conditions still remain. If you choose to try
2921it, be very sure to not actually deploy it for production
2922purposes. README.threads has more details, and is required
2923reading if you enable threads.
2924
2925If this doesn't make any sense to you, just accept the default '$dflt'.
2926EOM
2927rp='Build a threading Perl?'
2928. ./myread
2929case "$ans" in
2930y|Y) val="$define" ;;
2931*) val="$undef" ;;
2932esac
2933set usethreads
2934eval $setvar
2935
2936case "$usethreads" in
2937$define)
2938 $cat <<EOM
2939
2940As of 5.5.640, Perl has two different internal threading implementations,
2941the 5.005 version (5005threads) and an interpreter-based version
2942(ithreads) that has one interpreter per thread. Both are very
2943experimental. This arrangement exists to help developers work out
2944which one is better.
2945
2946If you're a casual user, you probably don't want interpreter-threads
2947at this time. There doesn't yet exist a way to create threads from
2948within Perl in this model, i.e., "use Thread;" will NOT work.
2949EOM
2950 : Default to ithreads unless overridden on command line or with
2951 : old config.sh
2952 dflt='y'
2953 case "$use5005threads" in
2954 $define|true|[yY]*) dflt='n';;
2955 esac
2956 case "$useithreads" in
2957 $undef|false|[nN]*) dflt='n';;
2958 esac
2959 rp='Use interpreter-based ithreads?'
2960 . ./myread
2961 case "$ans" in
2962 y|Y) val="$define" ;;
2963 *) val="$undef" ;;
2964 esac
2965 set useithreads
2966 eval $setvar
2967 : Now set use5005threads to the opposite value.
2968 case "$useithreads" in
2969 $define) val="$undef" ;;
2970 *) val="$define" ;;
2971 esac
2972 set use5005threads
2973 eval $setvar
2974 ;;
2975*)
2976 useithreads="$undef"
2977 use5005threads="$undef"
2978 ;;
2979esac
2980
c915ce7f
JH
2981case "$useithreads$use5005threads" in
2982"$define$define")
2983 $cat >&4 <<EOM
2984
2985You cannot have both the ithreads and the 5.005 threads enabled
2986at the same time. Disabling the 5.005 threads since they are
2987much less stable than the ithreads.
2988
2989EOM
2990 use5005threads="$undef"
2991 ;;
2992esac
2993
b4eb6b3d
JH
2994case "$d_oldpthreads" in
2995'') : Configure tests would be welcome here. For now, assume undef.
2996 val="$undef" ;;
2997*) val="$d_oldpthreads" ;;
2998esac
2999set d_oldpthreads
3000eval $setvar
3001
3002
3003case "$usethreads" in
3004"$define"|true|[yY]*)
3005: Look for a hint-file generated 'call-back-unit'. If the
3006: user has specified that a threading perl is to be built,
3007: we may need to set or change some other defaults.
3008 if $test -f usethreads.cbu; then
3009 echo "Your platform has some specific hints for threaded builds, using them..."
3010 . ./usethreads.cbu
3011 else
3012 $cat <<EOM
3013(Your platform doesn't have any specific hints for threaded builds.
3014 Assuming POSIX threads, then.)
3015EOM
3016 fi
3017 ;;
3018esac
3019
3020cat <<EOM
3021
3022Perl can be built so that multiple Perl interpreters can coexist
3023within the same Perl executable.
3024EOM
3025
3026case "$useithreads" in
3027$define)
3028 cat <<EOM
3029This multiple interpreter support is required for interpreter-based threads.
3030EOM
3031 val="$define"
3032 ;;
3033*) case "$usemultiplicity" in
3034 $define|true|[yY]*) dflt='y';;
3035 *) dflt='n';;
3036 esac
3037 echo " "
3038 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3039 rp='Build Perl for multiplicity?'
3040 . ./myread
3041 case "$ans" in
3042 y|Y) val="$define" ;;
3043 *) val="$undef" ;;
3044 esac
3045 ;;
3046esac
3047set usemultiplicity
3048eval $setvar
3049
e5e20432
JH
3050: make some quick guesses about what we are up against
3051echo " "
3052$echo $n "Hmm... $c"
3053echo exit 1 >bsd
3054echo exit 1 >usg
3055echo exit 1 >v7
3056echo exit 1 >osf1
3057echo exit 1 >eunice
3058echo exit 1 >xenix
3059echo exit 1 >venix
3060echo exit 1 >os2
3061d_bsd="$undef"
3062$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3063if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3064then
3065 echo "Looks kind of like an OSF/1 system, but we'll see..."
3066 echo exit 0 >osf1
381aa1ff 3067elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3068 xxx=`./loc addbib blurfl $pth`
3069 if $test -f $xxx; then
3070 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3071 echo exit 0 >bsd
3072 echo exit 0 >usg
3073 else
3074 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3075 echo "Looks kind of like an extended USG system, but we'll see..."
3076 else
3077 echo "Looks kind of like a USG system, but we'll see..."
3078 fi
3079 echo exit 0 >usg
3080 fi
3081elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3082 echo "Looks kind of like a BSD system, but we'll see..."
3083 d_bsd="$define"
3084 echo exit 0 >bsd
3085else
3086 echo "Looks kind of like a Version 7 system, but we'll see..."
3087 echo exit 0 >v7
3088fi
3089case "$eunicefix" in
3090*unixtovms*)
3091 $cat <<'EOI'
3092There is, however, a strange, musty smell in the air that reminds me of
3093something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3094EOI
3095 echo exit 0 >eunice
3096 d_eunice="$define"
3097: it so happens the Eunice I know will not run shell scripts in Unix format
3098 ;;
3099*)
3100 echo " "
3101 echo "Congratulations. You aren't running Eunice."
3102 d_eunice="$undef"
3103 ;;
3104esac
3105: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3106: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3107: semicolon as a patch separator
e5e20432
JH
3108case "$p_" in
3109:) ;;
3110*)
3111 $cat <<'EOI'
3112I have the feeling something is not exactly right, however...don't tell me...
3113lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3114(Or you may be running DOS with DJGPP.)
e5e20432
JH
3115EOI
3116 echo exit 0 >os2
3117 ;;
3118esac
3119if test -f /xenix; then
3120 echo "Actually, this looks more like a XENIX system..."
3121 echo exit 0 >xenix
3122 d_xenix="$define"
3123else
3124 echo " "
3125 echo "It's not Xenix..."
3126 d_xenix="$undef"
3127fi
3128chmod +x xenix
3129$eunicefix xenix
3130if test -f /venix; then
3131 echo "Actually, this looks more like a VENIX system..."
3132 echo exit 0 >venix
3133else
3134 echo " "
3135 if ./xenix; then
3136 : null
3137 else
3138 echo "Nor is it Venix..."
3139 fi
3140fi
3141chmod +x bsd usg v7 osf1 eunice xenix venix os2
3142$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3143$rm -f foo
3144
5869b1f1
JH
3145case "$cc" in
3146'') dflt=cc;;
3147*) dflt="$cc";;
3148esac
3149rp="Use which C compiler?"
3150. ./myread
3151cc="$ans"
e5e20432
JH
3152: Look for a hint-file generated 'call-back-unit'. Now that the
3153: user has specified the compiler, we may need to set or change some
3154: other defaults.
3155if $test -f cc.cbu; then
3156 . ./cc.cbu
3157fi
2573c5f9 3158. ./checkcc
8a27cf78 3159
e5e20432
JH
3160echo " "
3161echo "Checking for GNU cc in disguise and/or its version number..." >&4
3162$cat >gccvers.c <<EOM
3163#include <stdio.h>
3164int main() {
3165#ifdef __GNUC__
3166#ifdef __VERSION__
3167 printf("%s\n", __VERSION__);
3168#else
3169 printf("%s\n", "1");
3170#endif
3171#endif
3172 exit(0);
3173}
3174EOM
2d967e39 3175if $cc -o gccvers $ccflags $ldflags gccvers.c; then
e5e20432
JH
3176 gccversion=`./gccvers`
3177 case "$gccversion" in
3178 '') echo "You are not using GNU cc." ;;
fc68435e 3179 *) echo "You are using GNU cc $gccversion."
e723fc21 3180 ccname=gcc
fc68435e 3181 ;;
e5e20432
JH
3182 esac
3183else
3184 echo " "
3185 echo "*** WHOA THERE!!! ***" >&4
3186 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3187 case "$knowitall" in
3188 '')
3189 echo " You'd better start hunting for one and let me know about it." >&4
3190 exit 1
3191 ;;
3192 esac
3193fi
3194$rm -f gccvers*
3195case "$gccversion" in
31961*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3197esac
5b463ca7
KS
3198case "$gccversion" in
3199'') gccosandvers='' ;;
10b4ebb5
JH
3200*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3201 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3202 gccshortvers=''
5b463ca7 3203 case "$gccosandvers" in
02903077
JH
3204 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3205 $osname$osvers) ;; # looking good
5b463ca7
KS
3206 $osname*) cat <<EOM >&4
3207
3208*** WHOA THERE!!! ***
3209
3210 Your gcc has not been compiled for the exact release of
3211 your operating system ($gccosandvers versus $osname$osvers).
3212
3213 In general it is a good idea to keep gcc synchronized with
3214 the operating system because otherwise serious problems
3215 may ensue when trying to compile software, like Perl.
3216
3217 I'm trying to be optimistic here, though, and will continue.
3218 If later during the configuration and build icky compilation
02903077
JH
3219 problems appear (headerfile conflicts being the most common
3220 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3221 your operating system release.
3222
3223EOM
3224 ;;
81575342 3225 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3226 esac
3227 ;;
3228esac
e723fc21
JH
3229case "$ccname" in
3230'') ccname="$cc" ;;
3231esac
e5e20432 3232
640374d0
JH
3233case "$gccversion" in
3234'') ;;
3235*) case "$ccflags" in
3236 *-Wall*) ;;
a126002e 3237 *) ccflags="$ccflags -Wall" ;;
640374d0
JH
3238 esac
3239 ;;
3240esac
3241
8a27cf78
JH
3242: see how we invoke the C preprocessor
3243echo " "
3244echo "Now, how can we feed standard input to your C preprocessor..." >&4
3245cat <<'EOT' >testcpp.c
3246#define ABC abc
3247#define XYZ xyz
3248ABC.XYZ
3249EOT
3250cd ..
3251if test ! -f cppstdin; then
3252 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3253 # AIX cc -E doesn't show the absolute headerfile
3254 # locations but we'll cheat by using the -M flag.
3255 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
3256 else
3257 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3258 fi
3259else
3260 echo "Keeping your $hint cppstdin wrapper."
3261fi
3262chmod 755 cppstdin
3263wrapper=`pwd`/cppstdin
3264ok='false'
3265cd UU
3266
3267if $test "X$cppstdin" != "X" && \
3268 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3269 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3270then
3271 echo "You used to use $cppstdin $cppminus so we'll use that again."
3272 case "$cpprun" in
3273 '') echo "But let's see if we can live without a wrapper..." ;;
3274 *)
3275 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3276 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3277 then
3278 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3279 ok='true'
3280 else
3281 echo "(However, $cpprun $cpplast does not work, let's see...)"
3282 fi
3283 ;;
3284 esac
3285else
3286 case "$cppstdin" in
3287 '') ;;
3288 *)
3289 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3290 ;;
3291 esac
3292fi
3293
3294if $ok; then
3295 : nothing
3296elif echo 'Maybe "'"$cc"' -E" will work...'; \
3297 $cc -E <testcpp.c >testcpp.out 2>&1; \
3298 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3299 echo "Yup, it does."
3300 x_cpp="$cc -E"
3301 x_minus='';
3302elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3303 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3304 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3305 echo "Yup, it does."
3306 x_cpp="$cc -E"
3307 x_minus='-';
3308elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3309 $cc -P <testcpp.c >testcpp.out 2>&1; \
3310 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3311 echo "Yipee, that works!"
3312 x_cpp="$cc -P"
3313 x_minus='';
3314elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3315 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3316 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3317 echo "At long last!"
3318 x_cpp="$cc -P"
3319 x_minus='-';
3320elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3321 $cpp <testcpp.c >testcpp.out 2>&1; \
3322 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3323 echo "It works!"
3324 x_cpp="$cpp"
3325 x_minus='';
3326elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3327 $cpp - <testcpp.c >testcpp.out 2>&1; \
3328 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3329 echo "Hooray, it works! I was beginning to wonder."
3330 x_cpp="$cpp"
3331 x_minus='-';
3332elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3333 $wrapper <testcpp.c >testcpp.out 2>&1; \
3334 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3335 x_cpp="$wrapper"
3336 x_minus=''
3337 echo "Eureka!"
3338else
3339 dflt=''
3340 rp="No dice. I can't find a C preprocessor. Name one:"
3341 . ./myread
3342 x_cpp="$ans"
3343 x_minus=''
3344 $x_cpp <testcpp.c >testcpp.out 2>&1
3345 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3346 echo "OK, that will do." >&4
3347 else
3348echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3349 exit 1
3350 fi
3351fi
3352
3353case "$ok" in
3354false)
3355 cppstdin="$x_cpp"
3356 cppminus="$x_minus"
3357 cpprun="$x_cpp"
3358 cpplast="$x_minus"
3359 set X $x_cpp
3360 shift
3361 case "$1" in
3362 "$cpp")
3363 echo "Perhaps can we force $cc -E using a wrapper..."
3364 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3365 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3366 then
3367 echo "Yup, we can."
3368 cppstdin="$wrapper"
3369 cppminus='';
3370 else
3371 echo "Nope, we'll have to live without it..."
3372 fi
3373 ;;
3374 esac
3375 case "$cpprun" in
3376 "$wrapper")
3377 cpprun=''
3378 cpplast=''
3379 ;;
3380 esac
3381 ;;
3382esac
3383
3384case "$cppstdin" in
3385"$wrapper"|'cppstdin') ;;
3386*) $rm -f $wrapper;;
3387esac
3388$rm -f testcpp.c testcpp.out
3389
bd9b35c9
JH
3390: decide how portable to be. Allow command line overrides.
3391case "$d_portable" in
3392"$undef") ;;
3393*) d_portable="$define" ;;
104d25b7 3394esac
85ab1d1d 3395
bd9b35c9
JH
3396: set up shell script to do ~ expansion
3397cat >filexp <<EOSS
3398$startsh
3399: expand filename
3400case "\$1" in
3401 ~/*|~)
3402 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3403 ;;
3404 ~*)
3405 if $test -f /bin/csh; then
3406 /bin/csh -f -c "glob \$1"
3407 failed=\$?
3408 echo ""
3409 exit \$failed
e5e20432 3410 else
bd9b35c9
JH
3411 name=\`$expr x\$1 : '..\([^/]*\)'\`
3412 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3413 if $test ! -d "\$dir"; then
3414 me=\`basename \$0\`
3415 echo "\$me: can't locate home directory for: \$name" >&2
3416 exit 1
3417 fi
3418 case "\$1" in
3419 */*)
3420 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3421 ;;
3422 *)
3423 echo \$dir
e5e20432
JH
3424 ;;
3425 esac
3426 fi
b691c02f 3427 ;;
4633a7c4 3428*)
bd9b35c9 3429 echo \$1
2304df62
AD
3430 ;;
3431esac
4633a7c4
LW
3432EOSS
3433chmod +x filexp
3434$eunicefix filexp
2304df62
AD
3435
3436: now set up to get a file name
28757baa 3437cat <<EOS >getfile
3438$startsh
3439EOS
3440cat <<'EOSC' >>getfile
2304df62
AD
3441tilde=''
3442fullpath=''
3443already=''
3444skip=''
3445none_ok=''
3446exp_file=''
a0d0e21e 3447nopath_ok=''
2304df62
AD
3448orig_rp="$rp"
3449orig_dflt="$dflt"
b233458b
JH
3450case "$gfpth" in
3451'') gfpth='.' ;;
3452esac
2304df62
AD
3453
3454case "$fn" in
ecfc5424 3455*\(*)
381aa1ff 3456 expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
3457 fn=`echo $fn | sed 's/(.*)//'`
3458 ;;
3459esac
3460
3461case "$fn" in
a0d0e21e
LW
3462*:*)
3463 loc_file=`expr $fn : '.*:\(.*\)'`
3464 fn=`expr $fn : '\(.*\):.*'`
3465 ;;
3466esac
3467
3468case "$fn" in
2304df62
AD
3469*~*) tilde=true;;
3470esac
3471case "$fn" in
3472*/*) fullpath=true;;
3473esac
3474case "$fn" in
3475*+*) skip=true;;
3476esac
3477case "$fn" in
3478*n*) none_ok=true;;
3479esac
3480case "$fn" in
3481*e*) exp_file=true;;
3482esac
a0d0e21e
LW
3483case "$fn" in
3484*p*) nopath_ok=true;;
3485esac
2304df62
AD
3486
3487case "$fn" in
3488*f*) type='File';;
3489*d*) type='Directory';;
a0d0e21e 3490*l*) type='Locate';;
2304df62
AD
3491esac
3492
3493what="$type"
3494case "$what" in
3495Locate) what='File';;
3496esac
3497
3498case "$exp_file" in
3499'')
3500 case "$d_portable" in
3501 "$define") ;;
3502 *) exp_file=true;;
3503 esac
3504 ;;
3505esac
3506
3507cd ..
3508while test "$type"; do
3509 redo=''
3510 rp="$orig_rp"
3511 dflt="$orig_dflt"
3512 case "$tilde" in
3513 true) rp="$rp (~name ok)";;
3514 esac
3515 . UU/myread
ecfc5424
AD
3516 if test -f UU/getfile.ok && \
3517 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3518 then
3519 value="$ans"
3520 ansexp="$ans"
3521 break
3522 fi
2304df62
AD
3523 case "$ans" in
3524 none)
3525 value=''
3526 ansexp=''
3527 case "$none_ok" in
3528 true) type='';;
3529 esac
3530 ;;
3531 *)
3532 case "$tilde" in
3533 '') value="$ans"
3534 ansexp="$ans";;
3535 *)
3536 value=`UU/filexp $ans`
3537 case $? in
3538 0)
3539 if test "$ans" != "$value"; then
ecfc5424 3540 echo "(That expands to $value on this system.)"
2304df62
AD
3541 fi
3542 ;;
3543 *) value="$ans";;
3544 esac
3545 ansexp="$value"
3546 case "$exp_file" in
3547 '') value="$ans";;
3548 esac
3549 ;;
3550 esac
3551 case "$fullpath" in
3552 true)
3553 case "$ansexp" in
3554 /*) value="$ansexp" ;;
23da6c43 3555 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
3556 *)
3557 redo=true
3558 case "$already" in
3559 true)
3560 echo "I shall only accept a full path name, as in /bin/ls." >&4
3561 echo "Use a ! shell escape if you wish to check pathnames." >&4
3562 ;;
3563 *)
3564 echo "Please give a full path name, starting with slash." >&4
3565 case "$tilde" in
3566 true)
3567 echo "Note that using ~name is ok provided it expands well." >&4
3568 already=true
3569 ;;
3570 esac
3571 esac
3572 ;;
3573 esac
3574 ;;
3575 esac
3576 case "$redo" in
3577 '')
3578 case "$type" in
3579 File)
b233458b
JH
3580 for fp in $gfpth; do
3581 if test "X$fp" = X.; then
3582 pf="$ansexp"
3583 else
3584 pf="$fp/$ansexp"
3585 fi
3586 if test -f "$pf"; then
3587 type=''
3588 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3589 then
3590 echo "($value is not a plain file, but that's ok.)"
3591 type=''
3592 fi
3593 if test X"$type" = X; then
3594 value="$pf"
3595 break
3596 fi
3597 done
2304df62
AD
3598 ;;
3599 Directory)
b233458b
JH
3600 for fp in $gfpth; do
3601 if test "X$fp" = X.; then
f78bfc9c
JH
3602 dir="$ans"
3603 direxp="$ansexp"
b233458b 3604 else
dd858076 3605 dir="$fp/$ansexp"
f78bfc9c 3606 direxp="$fp/$ansexp"
b233458b 3607 fi
f78bfc9c 3608 if test -d "$direxp"; then
b233458b 3609 type=''
f78bfc9c 3610 value="$dir"
b233458b
JH
3611 break
3612 fi
3613 done
2304df62
AD
3614 ;;
3615 Locate)
40000a8c 3616 if test -d "$ansexp"; then
a0d0e21e
LW
3617 echo "(Looking for $loc_file in directory $value.)"
3618 value="$value/$loc_file"
40000a8c 3619 ansexp="$ansexp/$loc_file"
2304df62 3620 fi
40000a8c 3621 if test -f "$ansexp"; then
2304df62
AD
3622 type=''
3623 fi
a0d0e21e
LW
3624 case "$nopath_ok" in
3625 true) case "$value" in
3626 */*) ;;
3627 *) echo "Assuming $value will be in people's path."
3628 type=''
3629 ;;
3630 esac
3631 ;;
3632 esac
2304df62
AD
3633 ;;
3634 esac
3635
3636 case "$skip" in
3637 true) type='';
3638 esac
3639
3640 case "$type" in
3641 '') ;;
3642 *)
3643 if test "$fastread" = yes; then
3644 dflt=y
3645 else
3646 dflt=n
3647 fi
3648 rp="$what $value doesn't exist. Use that name anyway?"
3649 . UU/myread
3650 dflt=''
3651 case "$ans" in
3652 y*) type='';;
3653 *) echo " ";;
3654 esac
3655 ;;
3656 esac
3657 ;;
3658 esac
3659 ;;
3660 esac
3661done
3662cd UU
3663ans="$value"
3664rp="$orig_rp"
3665dflt="$orig_dflt"
ecfc5424 3666rm -f getfile.ok
b233458b 3667test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3668EOSC
3669
bd9b35c9
JH
3670: What should the include directory be ?
3671echo " "
3672$echo $n "Hmm... $c"
3673dflt='/usr/include'
3674incpath=''
3675mips_type=''
3676if $test -f /bin/mips && /bin/mips; then
3677 echo "Looks like a MIPS system..."
3678 $cat >usr.c <<'EOCP'
3679#ifdef SYSTYPE_BSD43
3680/bsd43
3681#endif
3682EOCP
8a27cf78 3683 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
3684 dflt='/bsd43/usr/include'
3685 incpath='/bsd43'
3686 mips_type='BSD 4.3'
3687 else
3688 mips_type='System V'
3689 fi
3690 $rm -f usr.c usr.out
3691 echo "and you're compiling with the $mips_type compiler and libraries."
3692 xxx_prompt=y
3693 echo "exit 0" >mips
3694else
3695 echo "Doesn't look like a MIPS system."
3696 xxx_prompt=n
3697 echo "exit 1" >mips
3698fi
3699chmod +x mips
3700$eunicefix mips
3701case "$usrinc" in
3702'') ;;
3703*) dflt="$usrinc";;
3704esac
3705case "$xxx_prompt" in
3706y) fn=d/
3707 echo " "
3708 rp='Where are the include files you want to use?'
3709 . ./getfile
3710 usrinc="$ans"
8e07c86e 3711 ;;
bd9b35c9 3712*) usrinc="$dflt"
8e07c86e
AD
3713 ;;
3714esac
2304df62 3715
bd9b35c9
JH
3716: Set private lib path
3717case "$plibpth" in
3718'') if ./mips; then
3719 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3720 fi;;
3721esac
3722case "$libpth" in
3723' ') dlist='';;
3724'') dlist="$loclibpth $plibpth $glibpth";;
3725*) dlist="$libpth";;
3726esac
3727
3728: Now check and see which directories actually exist, avoiding duplicates
3729libpth=''
3730for xxx in $dlist
3731do
3732 if $test -d $xxx; then
3733 case " $libpth " in
3734 *" $xxx "*) ;;
3735 *) libpth="$libpth $xxx";;
3736 esac
3737 fi
3738done
3739$cat <<'EOM'
3740
3741Some systems have incompatible or broken versions of libraries. Among
3742the directories listed in the question below, please remove any you
3743know not to be holding relevant libraries, and add any that are needed.
3744Say "none" for none.
8e07c86e
AD
3745
3746EOM
bd9b35c9
JH
3747case "$libpth" in
3748'') dflt='none';;
8e07c86e 3749*)
bd9b35c9
JH
3750 set X $libpth
3751 shift
3752 dflt=${1+"$@"}
8e07c86e 3753 ;;
a0d0e21e 3754esac
bd9b35c9
JH
3755rp="Directories to use for library searches?"
3756. ./myread
3757case "$ans" in
3758none) libpth=' ';;
3759*) libpth="$ans";;
3760esac
a0d0e21e 3761
bd9b35c9
JH
3762: compute shared library extension
3763case "$so" in
3764'')
3765 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3766 dflt='sl'
dd4e71fd 3767 else
bd9b35c9 3768 dflt='so'
dd4e71fd
JH
3769 fi
3770 ;;
bd9b35c9 3771*) dflt="$so";;
dd4e71fd 3772esac
dd4e71fd
JH
3773$cat <<EOM
3774
bd9b35c9 3775On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 3776you want to suppress searching of shared libraries for the remainder
bd9b35c9 3777of this configuration.
dd4e71fd
JH
3778
3779EOM
bd9b35c9
JH
3780rp='What is the file extension used for shared libraries?'
3781. ./myread
3782so="$ans"
dd4e71fd 3783
bd9b35c9
JH
3784: Define several unixisms.
3785: Hints files or command line option can be used to override them.
3786: The convoluted testing is in case hints files set either the old
3787: or the new name.
3788case "$_exe" in
3789'') case "$exe_ext" in
3790 '') ;;
3791 *) _exe="$exe_ext" ;;
dd4e71fd 3792 esac
bd9b35c9 3793 ;;
bfb7748a 3794esac
bd9b35c9
JH
3795case "$_a" in
3796'') case "$lib_ext" in
3797 '') _a='.a';;
3798 *) _a="$lib_ext" ;;
dd4e71fd
JH
3799 esac
3800 ;;
dd4e71fd 3801esac
bd9b35c9
JH
3802case "$_o" in
3803'') case "$obj_ext" in
3804 '') _o='.o';;
3805 *) _o="$obj_ext";;
3806 esac
3807 ;;
3808esac
3809case "$p_" in
3810'') case "$path_sep" in
3811 '') p_=':';;
3812 *) p_="$path_sep";;
3813 esac
3814 ;;
3815esac
3816exe_ext=$_exe
3817lib_ext=$_a
3818obj_ext=$_o
3819path_sep=$p_
dd4e71fd 3820
b4eb6b3d
JH
3821: Which makefile gets called first. This is used by make depend.
3822case "$firstmakefile" in
3823'') firstmakefile='makefile';;
4633a7c4 3824esac
4633a7c4 3825
0f0995ae
JH
3826case "$usesocks" in
3827$define|true|[yY]*) dflt='y';;
3828*) dflt='n';;
3829esac
bd9b35c9 3830cat <<EOM
4633a7c4 3831
bd9b35c9 3832Perl can be built to use the SOCKS proxy protocol library. To do so,
cf829ab0
JH
3833Configure must be run with -Dusesocks. If you use SOCKS you also need
3834to use the PerlIO abstraction layer, this will be implicitly selected.
4633a7c4 3835
0f0995ae 3836If this doesn't make any sense to you, just accept the default '$dflt'.
bd9b35c9 3837EOM
bd9b35c9
JH
3838rp='Build Perl for SOCKS?'
3839. ./myread
3840case "$ans" in
3841y|Y) val="$define" ;;
3842*) val="$undef" ;;
3843esac
3844set usesocks
3845eval $setvar
3846
cf829ab0
JH
3847case "$usesocks" in
3848$define|true|[yY]*) useperlio="$define";;
3849esac
3850
bd9b35c9
JH
3851: Looking for optional libraries
3852echo " "
3853echo "Checking for optional libraries..." >&4
3854case "$libs" in
3855' '|'') dflt='';;
3856*) dflt="$libs";;
3857esac
3858case "$libswanted" in
3859'') libswanted='c_s';;
3860esac
3861case "$usesocks" in
923fc586 3862"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 3863esac
68435ea7
JH
3864libsfound=''
3865libsfiles=''
3866libsdirs=''
13b3f787
JH
3867libspath=''
3868for thisdir in $libpth $xlibpth; do
3869 test -d $thisdir && libspath="$libspath $thisdir"
3870done
bd9b35c9 3871for thislib in $libswanted; do
13b3f787 3872 for thisdir in $libspath; do
f7dd4e7f
JH
3873 xxx=''
3874 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3875 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3876 $test -f "$xxx" && eval $libscheck
3877 $test -f "$xxx" && libstyle=shared
3878 fi
3879 if test ! -f "$xxx"; then
3880 xxx=$thisdir/lib$thislib.$so
3881 $test -f "$xxx" && eval $libscheck
3882 $test -f "$xxx" && libstyle=shared
3883 fi
3884 if test ! -f "$xxx"; then
3885 xxx=$thisdir/lib$thislib$_a
3886 $test -f "$xxx" && eval $libscheck
3887 $test -f "$xxx" && libstyle=static
3888 fi
3889 if test ! -f "$xxx"; then
3890 xxx=$thisdir/$thislib$_a
3891 $test -f "$xxx" && eval $libscheck
3892 $test -f "$xxx" && libstyle=static
3893 fi
3894 if test ! -f "$xxx"; then
3895 xxx=$thisdir/lib${thislib}_s$_a
3896 $test -f "$xxx" && eval $libscheck
3897 $test -f "$xxx" && libstyle=static
09ea5ba9 3898 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
3899 fi
3900 if test ! -f "$xxx"; then
3901 xxx=$thisdir/Slib$thislib$_a
3902 $test -f "$xxx" && eval $libscheck
3903 $test -f "$xxx" && libstyle=static
3904 fi
3905 if $test -f "$xxx"; then
43999f95 3906 case "$libstyle" in
f7dd4e7f
JH
3907 shared) echo "Found -l$thislib (shared)." ;;
3908 static) echo "Found -l$thislib." ;;
3909 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 3910 esac
bd9b35c9
JH
3911 case " $dflt " in
3912 *"-l$thislib "*);;
f7dd4e7f 3913 *) dflt="$dflt -l$thislib"
43999f95
JH
3914 libsfound="$libsfound $xxx"
3915 yyy=`basename $xxx`
3916 libsfiles="$libsfiles $yyy"
1e127011 3917 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
3918 case " $libsdirs " in
3919 *" $yyy "*) ;;
3920 *) libsdirs="$libsdirs $yyy" ;;
3921 esac
3922 ;;
bd9b35c9 3923 esac
f7dd4e7f
JH
3924 break
3925 fi
3926 done
3927 if $test ! -f "$xxx"; then
3928 echo "No -l$thislib."
bd9b35c9
JH
3929 fi
3930done
3931set X $dflt
3932shift
3933dflt="$*"
3934case "$libs" in
3935'') dflt="$dflt";;
3936*) dflt="$libs";;
3937esac
3938case "$dflt" in
3939' '|'') dflt='none';;
3940esac
4633a7c4 3941
bd9b35c9 3942$cat <<EOM
4633a7c4 3943
bd9b35c9
JH
3944In order to compile $package on your machine, a number of libraries
3945are usually needed. Include any other special libraries here as well.
3946Say "none" for none. The default list is almost always right.
8e07c86e 3947EOM
8e07c86e 3948
bd9b35c9
JH
3949echo " "
3950rp="What libraries to use?"
3951. ./myread
3952case "$ans" in
3953none) libs=' ';;
3954*) libs="$ans";;
3955esac
d71b2b6b 3956
bd9b35c9
JH
3957: determine optimization, if desired, or use for debug flag also
3958case "$optimize" in
3959' '|$undef) dflt='none';;
3960'') dflt='-O';;
3961*) dflt="$optimize";;
3962esac
3963$cat <<EOH
d71b2b6b 3964
bd9b35c9
JH
3965By default, $package compiles with the -O flag to use the optimizer.
3966Alternately, you might want to use the symbolic debugger, which uses
3967the -g flag (on traditional Unix systems). Either flag can be
3968specified here. To use neither flag, specify the word "none".
d71b2b6b 3969
bd9b35c9
JH
3970EOH
3971rp="What optimizer/debugger flag should be used?"
3972. ./myread
3973optimize="$ans"
3974case "$optimize" in
3975'none') optimize=" ";;
3976esac
3977
3978dflt=''
3979: We will not override a previous value, but we might want to
3980: augment a hint file
3981case "$hint" in
3982default|recommended)
3983 case "$gccversion" in
3984 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 3985 esac
bd9b35c9
JH
3986 case "$optimize" in
3987 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 3988 esac
bd9b35c9
JH
3989 case "$gccversion" in
3990 2*) if test -d /etc/conf/kconfig.d &&
3991 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3992 then
3993 dflt="$dflt -posix"
3994 fi
f0d04425 3995 ;;
bd9b35c9
JH
3996 esac
3997 case "$gccversion" in
3998 1*) ;;
3999 2.[0-8]*) ;;
4000 ?*) echo " "
4001 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4002 echo 'int main(void) { return 0; }' > gcctest.c
4003 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4004 echo "Yes, it does." 2>&1
4005 case "$ccflags" in
4006 *strict-aliasing*)
4007 echo "Leaving current flags $ccflags alone." 2>&1
4008 ;;
4009 *) dflt="$dflt -fno-strict-aliasing" ;;
4010 esac
4011 else
4012 echo "Nope, it doesn't, but that's ok." 2>&1
4013 fi
f0d04425 4014 ;;
e5e20432
JH
4015 esac
4016 ;;
4017esac
4018
bd9b35c9
JH
4019case "$mips_type" in
4020*BSD*|'') inclwanted="$locincpth $usrinc";;
4021*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4022esac
4023for thisincl in $inclwanted; do
4024 if $test -d $thisincl; then
4025 if $test x$thisincl != x$usrinc; then
4026 case "$dflt" in
422af00a
LC
4027 *" -I$thisincl "*);;
4028 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
4029 esac
4030 fi
4031 fi
4032done
40a7a20a 4033
bd9b35c9
JH
4034inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4035 xxx=true;
4036elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4037 xxx=true;
4038else
4039 xxx=false;
4040fi;
4041if $xxx; then
4042 case "$dflt" in
4043 *$2*);;
4044 *) dflt="$dflt -D$2";;
4045 esac;
4046fi'
40a7a20a 4047
bd9b35c9 4048set signal.h LANGUAGE_C; eval $inctest
40a7a20a 4049
bd9b35c9
JH
4050case "$usesocks" in
4051$define)
4052 ccflags="$ccflags -DSOCKS"
4053 ;;
4054esac
40a7a20a 4055
bd9b35c9
JH
4056case "$hint" in
4057default|recommended) dflt="$ccflags $dflt" ;;
4058*) dflt="$ccflags";;
4059esac
40a7a20a 4060
bd9b35c9
JH
4061case "$dflt" in
4062''|' ') dflt=none;;
4063esac
422af00a 4064
bd9b35c9 4065$cat <<EOH
40a7a20a 4066
bd9b35c9
JH
4067Your C compiler may want other flags. For this question you should include
4068-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4069but you should NOT include libraries or ld flags like -lwhatever. If you
4070want $package to honor its debug switch, you should include -DDEBUGGING here.
4071Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 4072
bd9b35c9 4073To use no flags, specify the word "none".
40a7a20a 4074
bd9b35c9
JH
4075EOH
4076set X $dflt
4077shift
4078dflt=${1+"$@"}
4079rp="Any additional cc flags?"
4080. ./myread
4081case "$ans" in
4082none) ccflags='';;
4083*) ccflags="$ans";;
4084esac
8e07c86e 4085
bd9b35c9 4086: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
4087case "$cppflags" in
4088'') cppflags="$ccflags" ;;
4089*) cppflags="$cppflags $ccflags" ;;
4090esac
bd9b35c9
JH
4091case "$gccversion" in
40921*) cppflags="$cppflags -D__GNUC__"
4633a7c4 4093esac
bd9b35c9
JH
4094case "$mips_type" in
4095'');;
4096*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4097esac
4098case "$cppflags" in
4099'');;
4100*)
4101 echo " "
4102 echo "Let me guess what the preprocessor flags are..." >&4
4103 set X $cppflags
4104 shift
4105 cppflags=''
4106 $cat >cpp.c <<'EOM'
4107#define BLURFL foo
8e07c86e 4108
bd9b35c9
JH
4109BLURFL xx LFRULB
4110EOM
4111 previous=''
4112 for flag in $*
4113 do
4114 case "$flag" in
4115 -*) ftry="$flag";;
4116 *) ftry="$previous $flag";;
4117 esac
4118 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4119 >cpp1.out 2>/dev/null && \
4120 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4121 >cpp2.out 2>/dev/null && \
4122 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4123 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4124 then
4125 cppflags="$cppflags $ftry"
4126 previous=''
4127 else
4128 previous="$flag"
4129 fi
4130 done
4131 set X $cppflags
4132 shift
4133 cppflags=${1+"$@"}
4134 case "$cppflags" in
4135 *-*) echo "They appear to be: $cppflags";;
4136 esac
4137 $rm -f cpp.c cpp?.out
2afac517 4138 ;;
4139esac
8e07c86e 4140
bd9b35c9
JH
4141: flags used in final linking phase
4142case "$ldflags" in
4143'') if ./venix; then
4144 dflt='-i -z'
10a23457 4145 else
bd9b35c9 4146 dflt=''
10a23457 4147 fi
bd9b35c9
JH
4148 case "$ccflags" in
4149 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 4150 esac
bd9b35c9
JH
4151 ;;
4152*) dflt="$ldflags";;
4153esac
4154
4155: Try to guess additional flags to pick up local libraries.
4156for thislibdir in $libpth; do
4157 case " $loclibpth " in
4158 *" $thislibdir "*)
4159 case "$dflt " in
4160 *"-L$thislibdir "*) ;;
4161 *) dflt="$dflt -L$thislibdir" ;;
4162 esac
c4f23d77
AD
4163 ;;
4164 esac
bd9b35c9 4165done
c4f23d77 4166
bd9b35c9
JH
4167case "$dflt" in
4168'') dflt='none' ;;
4169esac
c4f23d77 4170
bd9b35c9
JH
4171$cat <<EOH
4172
4173Your C linker may need flags. For this question you should
4174include -L/whatever and any other flags used by the C linker, but you
4175should NOT include libraries like -lwhatever.
4176
4177Make sure you include the appropriate -L/path flags if your C linker
4178does not normally search all of the directories you specified above,
4179namely
4180 $libpth
4181To use no flags, specify the word "none".
4182
4183EOH
4184
4185rp="Any additional ld flags (NOT including libraries)?"
4186. ./myread
4187case "$ans" in
4188none) ldflags='';;
4189*) ldflags="$ans";;
4190esac
4191rmlist="$rmlist pdp11"
4192
4193: coherency check
4194echo " "
4195echo "Checking your choice of C compiler and flags for coherency..." >&4
4196$cat > try.c <<'EOF'
4197#include <stdio.h>
4198int main() { printf("Ok\n"); exit(0); }
4199EOF
7a282f6d 4200set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
4201shift
4202$cat >try.msg <<'EOM'
4203I've tried to compile and run the following simple program:
4204
4205EOM
4206$cat try.c >> try.msg
4207
4208$cat >> try.msg <<EOM
4209
4210I used the command:
4211
4212 $*
4213 ./try
4214
4215and I got the following output:
4216
4217EOM
4218dflt=y
73614538
JH
4219if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4220 if $sh -c './try' >>try.msg 2>&1; then
bd9b35c9
JH
4221 xxx=`./try`
4222 case "$xxx" in
4223 "Ok") dflt=n ;;
4224 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4225 case " $libs " in
4226 *" -lsfio "*)
4227 cat >> try.msg <<'EOQS'
4228If $libs contains -lsfio, and sfio is mis-configured, then it
4229sometimes (apparently) runs and exits with a 0 status, but with no
4230output! It may have to do with sfio's use of _exit vs. exit.
4231
4232EOQS
4233 rp="You have a big problem. Shall I abort Configure"
4234 dflt=y
4235 ;;
4236 esac
4237 ;;
4238 esac
4239 else
4240 echo "The program compiled OK, but exited with status $?." >>try.msg
4241 rp="You have a problem. Shall I abort Configure"
4242 dflt=y
4243 fi
4244else
4245 echo "I can't compile the test program." >>try.msg
4246 rp="You have a BIG problem. Shall I abort Configure"
4247 dflt=y
4248fi
4249case "$dflt" in
4250y)
4251 $cat try.msg >&4
4252 case "$knowitall" in
4253 '')
4254 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 4255 ;;
bd9b35c9 4256 *) dflt=n;;
c4f23d77 4257 esac
bd9b35c9
JH
4258 echo " "
4259 . ./myread
4260 case "$ans" in
4261 n*|N*) ;;
4262 *) echo "Ok. Stopping Configure." >&4
4263 exit 1
c4f23d77
AD
4264 ;;
4265 esac
4266 ;;
bd9b35c9 4267n) echo "OK, that should do.";;
c4f23d77 4268esac
bd9b35c9 4269$rm -f try try.* core
c4f23d77 4270
b4eb6b3d
JH
4271: define an is-a-typedef? function
4272typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4273case "$inclist" in
4274"") inclist="sys/types.h";;
4275esac;
4276eval "varval=\$$var";
4277case "$varval" in
4278"")
4279 $rm -f temp.c;
4280 for inc in $inclist; do
4281 echo "#include <$inc>" >>temp.c;
4282 done;
4283 echo "#ifdef $type" >> temp.c;
4284 echo "printf(\"We have $type\");" >> temp.c;
4285 echo "#endif" >> temp.c;
4286 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4287 if $contains $type temp.E >/dev/null 2>&1; then
4288 eval "$var=\$type";
4289 else
4290 eval "$var=\$def";
4291 fi;
4292 $rm -f temp.?;;
4293*) eval "$var=\$varval";;
4294esac'
4295
4296: define an is-a-typedef? function that prompts if the type is not available.
4297typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4298case "$inclist" in
4299"") inclist="sys/types.h";;
4300esac;
4301eval "varval=\$$var";
4302case "$varval" in
4303"")
4304 $rm -f temp.c;
4305 for inc in $inclist; do
4306 echo "#include <$inc>" >>temp.c;
4307 done;
4308 echo "#ifdef $type" >> temp.c;
4309 echo "printf(\"We have $type\");" >> temp.c;
4310 echo "#endif" >> temp.c;
4311 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4312 echo " " ;
4313 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4314 if $contains $type temp.E >/dev/null 2>&1; then
4315 echo "$type found." >&4;
4316 eval "$var=\$type";
4317 else
4318 echo "$type NOT found." >&4;
4319 dflt="$def";
4320 . ./myread ;
4321 eval "$var=\$ans";
4322 fi;
4323 $rm -f temp.?;;
4324*) eval "$var=\$varval";;
4325esac'
4326
bd9b35c9
JH
4327: define a shorthand compile call
4328compile='
4329mc_file=$1;
4330shift;
08413ebc 4331$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
4332: define a shorthand compile call for compilations that should be ok.
4333compile_ok='
4334mc_file=$1;
4335shift;
7a282f6d 4336$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 4337
b4eb6b3d 4338: check for lengths of integral types
bd9b35c9 4339echo " "
b4eb6b3d
JH
4340case "$intsize" in
4341'')
4342 echo "Checking to see how big your integers are..." >&4
4343 $cat >intsize.c <<'EOCP'
bd9b35c9
JH
4344#include <stdio.h>
4345int main()
4346{
b4eb6b3d
JH
4347 printf("intsize=%d;\n", (int)sizeof(int));
4348 printf("longsize=%d;\n", (int)sizeof(long));
4349 printf("shortsize=%d;\n", (int)sizeof(short));
4350 exit(0);
bd9b35c9 4351}
b4eb6b3d
JH
4352EOCP
4353 set intsize
4354 if eval $compile_ok && ./intsize > /dev/null; then
4355 eval `./intsize`
4356 echo "Your integers are $intsize bytes long."
4357 echo "Your long integers are $longsize bytes long."
4358 echo "Your short integers are $shortsize bytes long."
4359 else
4360 $cat >&4 <<EOM
4361!
4362Help! I can't compile and run the intsize test program: please enlighten me!
4363(This is probably a misconfiguration in your system or libraries, and
4364you really ought to fix it. Still, I'll try anyway.)
4365!
bd9b35c9 4366EOM
b4eb6b3d
JH
4367 dflt=4
4368 rp="What is the size of an integer (in bytes)?"
4369 . ./myread
4370 intsize="$ans"
4371 dflt=$intsize
4372 rp="What is the size of a long integer (in bytes)?"
4373 . ./myread
4374 longsize="$ans"
4375 dflt=2
4376 rp="What is the size of a short integer (in bytes)?"
4377 . ./myread
4378 shortsize="$ans"
4379 fi
4380 ;;
4381esac
4382$rm -f intsize intsize.*
c1a7f87b 4383
b4eb6b3d
JH
4384: see what type lseek is declared as in the kernel
4385rp="What is the type used for lseek's offset on this system?"
4386set off_t lseektype long stdio.h sys/types.h
4387eval $typedef_ask
4388
4389echo " "
4390echo "Checking to see how big your file offsets are..." >&4
4391$cat >try.c <<EOCP
4392#include <sys/types.h>
4393#include <stdio.h>
4394int main()
4395{
4396 printf("%d\n", (int)sizeof($lseektype));
4397 return(0);
4398}
4399EOCP
4400set try
4401if eval $compile_ok; then
4402 lseeksize=`./try`
4403 echo "Your file offsets are $lseeksize bytes long."
4404else
4405 dflt=$longsize
4406 echo " "
4407 echo "(I can't seem to compile the test program. Guessing...)"
4408 rp="What is the size of your file offsets (in bytes)?"
4409 . ./myread
4410 lseeksize="$ans"
4411fi
4412$rm -f try.c try
4413
4414: see what type file positions are declared as in the library
4415rp="What is the type for file position used by fsetpos()?"
4416set fpos_t fpostype long stdio.h sys/types.h
4417eval $typedef_ask
4418
4419echo " "
4420case "$fpostype" in
4421*_t) zzz="$fpostype" ;;
4422*) zzz="fpos_t" ;;
4423esac
4424echo "Checking the size of $zzz..." >&4
4425cat > try.c <<EOCP
4426#include <sys/types.h>
4427#include <stdio.h>
4428int main() {
4429 printf("%d\n", (int)sizeof($fpostype));
4430 exit(0);
4431}
4432EOCP
4433set try
4434if eval $compile_ok; then
4435 yyy=`./try`
4436 case "$yyy" in
4437 '') fpossize=4
4438 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4439 ;;
4440 *) fpossize=$yyy
4441 echo "Your $zzz is $fpossize bytes long."
4442 ;;
4443 esac
4444else
4445 dflt="$longsize"
4446 echo " " >&4
4447 echo "(I can't compile the test program. Guessing...)" >&4
4448 rp="What is the size of your file positions (in bytes)?"
4449 . ./myread
4450 fpossize="$ans"
4451fi
4452
4453
4454
4455# Backward compatibility (uselfs is deprecated).
4456case "$uselfs" in
4457"$define"|true|[yY]*)
4458 cat <<EOM >&4
4459
4460*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4461EOM
4462 uselargefiles="$define"
4463 ;;
4464esac
4465
4466case "$lseeksize:$fpossize" in
44678:8) cat <<EOM
4468
4469You can have files larger than 2 gigabytes.
4470EOM
4471 val="$define" ;;
4472*) case "$uselargefiles" in
4473 "$undef"|false|[nN]*) dflt='n' ;;
4474 *) dflt='y' ;;
4475 esac
4476 cat <<EOM
4477
4478Perl can be built to understand large files (files larger than 2 gigabytes)
4479on some systems. To do so, Configure can be run with -Duselargefiles.
4480
4481If this doesn't make any sense to you, just accept the default '$dflt'.
4482EOM
4483 rp='Try to understand large files, if available?'
4484 . ./myread
4485 case "$ans" in
4486 y|Y) val="$define" ;;
4487 *) val="$undef" ;;
4488 esac
4489 ;;
4490esac
4491set uselargefiles
4492eval $setvar
4493case "$uselargefiles" in
4494"$define")
4495: Look for a hint-file generated 'call-back-unit'. If the
4496: user has specified that a large files perl is to be built,
4497: we may need to set or change some other defaults.
4498 if $test -f uselargefiles.cbu; then
4499 echo "Your platform has some specific hints for large file builds, using them..."
4500 . ./uselargefiles.cbu
4501 echo " "
4502 echo "Rechecking to see how big your file offsets are..." >&4
4503 $cat >try.c <<EOCP
4504#include <sys/types.h>
4505#include <stdio.h>
4506int main()
4507{
4508 printf("%d\n", (int)sizeof($lseektype));
4509 return(0);
4510}
4511EOCP
4512 set try
4513 if eval $compile_ok; then
4514 lseeksize=`./try`
4515 $echo "Your file offsets are now $lseeksize bytes long."
4516 else
4517 dflt="$lseeksize"
4518 echo " "
4519 echo "(I can't seem to compile the test program. Guessing...)"
4520 rp="What is the size of your file offsets (in bytes)?"
4521 . ./myread
4522 lseeksize="$ans"
4523 fi
4524 case "$fpostype" in
4525 *_t) zzz="$fpostype" ;;
4526 *) zzz="fpos_t" ;;
4527 esac
4528 $echo $n "Rechecking the size of $zzz...$c" >&4
4529 $cat > try.c <<EOCP
4530#include <sys/types.h>
4531#include <stdio.h>
4532int main() {
4533 printf("%d\n", (int)sizeof($fpostype));
4534 exit(0);
4535}
4536EOCP
4537 set try
4538 if eval $compile_ok; then
4539 yyy=`./try`
4540 dflt="$lseeksize"
4541 case "$yyy" in
4542 '') echo " "
4543 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4544 ;;
4545 *) fpossize=$yyy
4546 echo " $fpossize bytes." >&4
4547 ;;
4548 esac
4549 else
4550 dflt="$fpossize"
4551 echo " "
4552 echo "(I can't compile the test program. Guessing...)" >&4
4553 rp="What is the size of your file positions (in bytes)?"
4554 . ./myread
4555 fpossize="$ans"
4556 fi
4557 $rm -f try.c try
4558 fi
4559 ;;
4560esac
4561
4562
4563case "$usemorebits" in
4564"$define"|true|[yY]*)
4565 use64bitint="$define"
4566 uselongdouble="$define"
4567 usemorebits="$define"
4568 ;;
4569*) usemorebits="$undef"
4570 ;;
4571esac
4572
8dfa8df9
JH
4573: check for void type
4574echo " "
4575echo "Checking to see how well your C compiler groks the void type..." >&4
4576case "$voidflags" in
4577'')
4578 $cat >try.c <<'EOCP'
4579#if TRY & 1
4580void sub() {
4581#else
4582sub() {
4583#endif
4584 extern void moo(); /* function returning void */
4585 void (*goo)(); /* ptr to func returning void */
4586#if TRY & 8
4587 void *hue; /* generic ptr */
4588#endif
4589#if TRY & 2
4590 void (*foo[10])();
4591#endif
4592
4593#if TRY & 4
4594 if(goo == moo) {
4595 exit(0);
4596 }
4597#endif
4598 exit(0);
4599}
4600int main() { sub(); }
4601EOCP
4602 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4603 voidflags=$defvoidused
4604 echo "Good. It appears to support void to the level $package wants.">&4
4605 if $contains warning .out >/dev/null 2>&1; then
4606 echo "However, you might get some warnings that look like this:"
4607 $cat .out
4608 fi
4609 else
4610echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4611 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4612 echo "It supports 1..."
4613 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4614 echo "It also supports 2..."
4615 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4616 voidflags=7
4617 echo "And it supports 4 but not 8 definitely."
4618 else
4619 echo "It doesn't support 4..."
4620 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4621 voidflags=11
4622 echo "But it supports 8."
4623 else
4624 voidflags=3
4625 echo "Neither does it support 8."
4626 fi
4627 fi
4628 else
4629 echo "It does not support 2..."
4630 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4631 voidflags=13
4632 echo "But it supports 4 and 8."
4633 else
4634 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4635 voidflags=5
4636 echo "And it supports 4 but has not heard about 8."
4637 else
4638 echo "However it supports 8 but not 4."
4639 fi
4640 fi
4641 fi
4642 else
4643 echo "There is no support at all for void."
4644 voidflags=0
4645 fi
4646 fi
4647esac
4648case "$voidflags" in
4649"$defvoidused") ;;
4650*) $cat >&4 <<'EOM'
4651 Support flag bits are:
4652 1: basic void declarations.
4653 2: arrays of pointers to functions returning void.
4654 4: operations between pointers to and addresses of void functions.
4655 8: generic void pointers.
4656EOM
4657 dflt="$voidflags";
4658 rp="Your void support flags add up to what?"
4659 . ./myread
4660 voidflags="$ans"
4661 ;;
4662esac
4663$rm -f try.* .out
4664
4665: check for length of pointer
4666echo " "
4667case "$ptrsize" in
4668'')
4669 echo "Checking to see how big your pointers are..." >&4
4670 if test "$voidflags" -gt 7; then
4671 echo '#define VOID_PTR char *' > try.c
4672 else
4673 echo '#define VOID_PTR void *' > try.c
4674 fi
4675 $cat >>try.c <<'EOCP'
4676#include <stdio.h>
4677int main()
4678{
4679 printf("%d\n", (int)sizeof(VOID_PTR));
4680 exit(0);
4681}
4682EOCP
4683 set try
4684 if eval $compile_ok; then
4685 ptrsize=`./try`
4686 echo "Your pointers are $ptrsize bytes long."
4687 else
4688 dflt='4'
4689 echo "(I can't seem to compile the test program. Guessing...)" >&4
4690 rp="What is the size of a pointer (in bytes)?"
4691 . ./myread
4692 ptrsize="$ans"
4693 fi
4694 ;;
4695esac
4696$rm -f try.c try
4697
4698: check for long long
4699echo " "
4700echo "Checking to see if you have long long..." >&4
4701echo 'int main() { long long x = 7; return 0; }' > try.c
4702set try
4703if eval $compile; then
4704 val="$define"
4705 echo "You have long long."
4706else
4707 val="$undef"
4708 echo "You do not have long long."
4709fi
4710$rm try.*
4711set d_longlong
4712eval $setvar
4713
4714: check for length of long long
4715case "${d_longlong}${longlongsize}" in
4716$define)
4717 echo " "
4718 echo "Checking to see how big your long longs are..." >&4
4719 $cat >try.c <<'EOCP'
4720#include <stdio.h>
4721int main()
4722{
4723 printf("%d\n", (int)sizeof(long long));
4724 return(0);
4725}
4726EOCP
4727 set try
4728 if eval $compile_ok; then
4729 longlongsize=`./try$exe_ext`
4730 echo "Your long longs are $longlongsize bytes long."
4731 else
4732 dflt='8'
4733 echo " "
4734 echo "(I can't seem to compile the test program. Guessing...)"
4735 rp="What is the size of a long long (in bytes)?"
4736 . ./myread
4737 longlongsize="$ans"
4738 fi
4739 if $test "X$longsize" = "X$longlongsize"; then
4740 echo "(That isn't any different from an ordinary long.)"
4741 fi
4742 ;;
4743esac
4744$rm -f try.* try
4745
4746: determine filename position in cpp output
4747echo " "
4748echo "Computing filename position in cpp output for #include directives..." >&4
4749echo '#include <stdio.h>' > foo.c
4750$cat >fieldn <<EOF
4751$startsh
4752$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4753$grep '^[ ]*#.*stdio\.h' | \
4754while read cline; do
4755 pos=1
4756 set \$cline
4757 while $test \$# -gt 0; do
4758 if $test -r \`echo \$1 | $tr -d '"'\`; then
4759 echo "\$pos"
4760 exit 0
4761 fi
4762 shift
4763 pos=\`expr \$pos + 1\`
4764 done
4765done
4766EOF
4767chmod +x fieldn
4768fieldn=`./fieldn`
4769$rm -f foo.c fieldn
4770case $fieldn in
4771'') pos='???';;
47721) pos=first;;
47732) pos=second;;
47743) pos=third;;
4775*) pos="${fieldn}th";;
4776esac
4777echo "Your cpp writes the filename in the $pos field of the line."
4778
4779: locate header file
4780$cat >findhdr <<EOF
4781$startsh
4782wanted=\$1
4783name=''
4784for usrincdir in $usrinc
4785do
4786 if test -f \$usrincdir/\$wanted; then
4787 echo "\$usrincdir/\$wanted"
4788 exit 0
4789 fi
4790done
4791awkprg='{ print \$$fieldn }'
4792echo "#include <\$wanted>" > foo\$\$.c
4793$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4794$grep "^[ ]*#.*\$wanted" | \
4795while read cline; do
4796 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4797 case "\$name" in
4798 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4799 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4800 *) exit 2;;
4801 esac;
4802done;
4803#
4804# status = 0: grep returned 0 lines, case statement not executed
4805# status = 1: headerfile found
4806# status = 2: while loop executed, no headerfile found
4807#
4808status=\$?
4809$rm -f foo\$\$.c;
4810if test \$status -eq 1; then
4811 exit 0;
4812fi
4813exit 1
4814EOF
4815chmod +x findhdr
4816
4817: define an alternate in-header-list? function
4818inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4819cont=true; xxf="echo \"<\$1> found.\" >&4";
4820case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4821*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4822esac;
4823case $# in 4) instead=instead;; *) instead="at last";; esac;
4824while $test "$cont"; do
4825 xxx=`./findhdr $1`
4826 var=$2; eval "was=\$$2";
4827 if $test "$xxx" && $test -r "$xxx";
4828 then eval $xxf;
4829 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4830 cont="";
4831 else eval $xxnf;
4832 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4833 set $yyy; shift; shift; yyy=$@;
4834 case $# in 0) cont="";;
4835 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4836 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4837 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4838 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4839 esac;
4840done;
4841while $test "$yyy";
4842do set $yyy; var=$2; eval "was=\$$2";
4843 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4844 set $yyy; shift; shift; yyy=$@;
4845done'
4846
4847: see if inttypes.h is available
4848: we want a real compile instead of Inhdr because some systems
4849: have an inttypes.h which includes non-existent headers
4850echo " "
4851$cat >try.c <<EOCP
4852#include <inttypes.h>
4853int main() {
4854 static int32_t foo32 = 0x12345678;
4855}
4856EOCP
4857set try
4858if eval $compile; then
4859 echo "<inttypes.h> found." >&4
4860 val="$define"
4861else
4862 echo "<inttypes.h> NOT found." >&4
4863 val="$undef"
4864fi
4865$rm -f try.c try
4866set i_inttypes
4867eval $setvar
4868
4869: check for int64_t
4870echo " "
4871echo "Checking to see if you have int64_t..." >&4
4872$cat >try.c <<EOCP
4873#include <sys/types.h>
4874#$i_inttypes I_INTTYPES
4875#ifdef I_INTTYPES
4876#include <inttypes.h>
4877#endif
4878int main() { int64_t x = 7; }
4879EOCP
4880set try
4881if eval $compile; then
4882 val="$define"
4883 echo "You have int64_t."
4884else
4885 val="$undef"
4886 echo "You do not have int64_t."
4887fi
4888$rm -f try try.*
4889set d_int64_t
4890eval $setvar
4891
4892
4893echo " "
4894echo "Checking which 64-bit integer type we could use..." >&4
4895
4896case "$intsize" in
48978) val=int
4898 set quadtype
4899 eval $setvar
4900 val='"unsigned int"'
4901 set uquadtype
4902 eval $setvar
4903 quadkind=1
4904 ;;
4905*) case "$longsize" in
4906 8) val=long
4907 set quadtype
4908 eval $setvar
4909 val='"unsigned long"'
4910 set uquadtype
4911 eval $setvar
4912 quadkind=2
4913 ;;
4914 *) case "$d_longlong:$longlongsize" in
4915 define:8)
4916 val='"long long"'
4917 set quadtype
4918 eval $setvar
4919 val='"unsigned long long"'
4920 set uquadtype
4921 eval $setvar
4922 quadkind=3
4923 ;;
4924 *) case "$d_int64_t" in
4925 define)
4926 val=int64_t
4927 set quadtype
4928 eval $setvar
4929 val=uint64_t
4930 set uquadtype
4931 eval $setvar
4932 quadkind=4
4933 ;;
4934 esac
4935 ;;
4936 esac
4937 ;;
4938 esac
4939 ;;
4940esac
4941
4942case "$quadtype" in
4943'') echo "Alas, no 64-bit integer types in sight." >&4
4944 d_quad="$undef"
4945 ;;
4946*) echo "We could use '$quadtype' for 64-bit integers." >&4
4947 d_quad="$define"
4948 ;;
4949esac
4950
b4eb6b3d
JH
4951
4952case "$uselonglong" in
4953"$define"|true|[yY]*)
4954 cat <<EOM >&4
4955
4956*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4957EOM
4958 use64bitint="$define"
4959 ;;
4960esac
4961case "$use64bits" in
4962"$define"|true|[yY]*)
4963 cat <<EOM >&4
4964
4965*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4966EOM
4967 use64bitint="$define"
4968 ;;
4969esac
4970case "$use64bitints" in
4971"$define"|true|[yY]*)
4972 cat <<EOM >&4
4973
4974*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4975EOM
4976 use64bitint="$define"
4977 ;;
4978esac
4979case "$use64bitsint" in
4980"$define"|true|[yY]*)
4981 cat <<EOM >&4
4982
4983*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4984EOM
4985 use64bitint="$define"
4986 ;;
4987esac
4988case "$uselonglongs" in
4989"$define"|true|[yY]*)
4990 cat <<EOM >&4
4991
4992*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4993EOM
4994 use64bitint="$define"
4995 ;;
4996esac
4997case "$use64bitsall" in
4998"$define"|true|[yY]*)
4999 cat <<EOM >&4
5000
5001*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5002EOM
5003 use64bitall="$define"
5004 ;;
5005esac
5006
5007case "$ccflags" in
5008*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5009esac
5010case "$use64bitall" in
5011"$define"|true|[yY]*) use64bitint="$define" ;;
5012esac
5013
5014case "$longsize" in
50158) cat <<EOM
5016
5017You have natively 64-bit long integers.
5018EOM
5019 val="$define"
5020 ;;
5021*) case "$use64bitint" in
5022 "$define"|true|[yY]*) dflt='y';;
5023 *) dflt='n';;
5024 esac
8dfa8df9
JH
5025 case "$d_quad" in
5026 "$define") ;;
5027 *) dflt='n' ;;
5028 esac
b4eb6b3d
JH
5029 cat <<EOM
5030
5031Perl can be built to take advantage of 64-bit integer types
5032on some systems. To do so, Configure can be run with -Duse64bitint.
5033Choosing this option will most probably introduce binary incompatibilities.
5034
5035If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5036(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5037EOM
5038 rp='Try to use 64-bit integers, if available?'
5039 . ./myread
5040 case "$ans" in
5041 [yY]*) val="$define" ;;
5042 *) val="$undef" ;;
5043 esac
5044 ;;
5045esac
5046set use64bitint
5047eval $setvar
5048
5049case "$use64bitall" in
5050"$define"|true|[yY]*) dflt='y' ;;
5051*) case "$longsize" in
5052 8) dflt='y' ;;
5053 *) dflt='n' ;;
5054 esac
5055 ;;
5056esac
5057cat <<EOM
5058
5059You may also choose to try maximal 64-bitness. It means using as much
506064-bitness as possible on the platform. This in turn means even more
5061binary incompatibilities. On the other hand, your platform may not
5062have any more 64-bitness available than what you already have chosen.
5063
5064If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5065(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5066EOM
5067rp='Try to use maximal 64-bit support, if available?'
5068. ./myread
5069case "$ans" in
5070[yY]*) val="$define" ;;
5071*) val="$undef" ;;
5072esac
5073set use64bitall
5074eval $setvar
5075case "$use64bitall" in
5076"$define")
5077 case "$use64bitint" in
5078 "$undef")
5079 cat <<EOM
5080
5081Since you have chosen a maximally 64-bit build, I'm also turning on
5082the use of 64-bit integers.
5083EOM
5084 use64bitint="$define" ;;
5085 esac
5086 ;;
5087esac
5088
8dfa8df9
JH
5089case "$use64bitall" in
5090"$define"|true|[yY]*)
5091 case "$ptrsize" in
5092 4) cat <<EOM >&4
5093
5094*** You have chosen a maximally 64-bit build, but your pointers
5095*** are only 4 bytes wide, disabling maximal 64-bitness.
5096
5097EOM
5098 use64bitall="$undef"
5099 case "$use64bitint" in
5100 "$define"|true|[yY]*) ;;
5101 *) cat <<EOM >&4
5102
5103*** Downgrading from maximal 64-bitness to using 64-bit integers.
5104
5105EOM
5106 use64bitint="$define"
5107 ;;
5108 esac
5109 ;;
5110 esac
5111 ;;
5112esac
5113
b4eb6b3d
JH
5114case "$use64bitint" in
5115"$define"|true|[yY]*)
5116: Look for a hint-file generated 'call-back-unit'. If the
5117: user has specified that a 64-bit perl is to be built,
5118: we may need to set or change some other defaults.
5119 if $test -f use64bitint.cbu; then
5120 echo "Your platform has some specific hints for 64-bit integers, using them..."
5121 . ./use64bitint.cbu
5122 fi
5123 case "$longsize" in
5124 4) case "$archname64" in
5125 '') archname64=64int ;;
5126 esac
5127 ;;
5128 esac
5129 ;;
5130esac
5131
5132case "$use64bitall" in
5133"$define"|true|[yY]*)
5134: Look for a hint-file generated 'call-back-unit'. If the
5135: user has specified that a maximally 64-bit perl is to be built,
5136: we may need to set or change some other defaults.
5137 if $test -f use64bitall.cbu; then
5138 echo "Your platform has some specific hints for 64-bit builds, using them..."
5139 . ./use64bitall.cbu
5140 fi
5141 case "$longsize" in
5142 4) case "$archname64" in
5143 ''|64int) archname64=64all ;;
5144 esac
5145 ;;
5146 esac
5147 ;;
5148esac
5149
5150echo " "
5151echo "Checking for GNU C Library..." >&4
5152cat >gnulibc.c <<EOM
5153#include <stdio.h>
5154int main()
5155{
5156#ifdef __GLIBC__
5157 exit(0);
5158#else
5159 exit(1);
5160#endif
5161}
5162EOM
5163set gnulibc
5164if eval $compile_ok && ./gnulibc; then
5165 val="$define"
5166 echo "You are using the GNU C Library"
5167else
5168 val="$undef"
5169 echo "You are not using the GNU C Library"
5170fi
5171$rm -f gnulibc*
5172set d_gnulibc
5173eval $setvar
5174
5175: see if nm is to be used to determine whether a symbol is defined or not
5176case "$usenm" in
5177'')
5178 dflt=''
c1a7f87b
JH
5179 case "$d_gnulibc" in
5180 "$define")
5181 echo " "
5182 echo "nm probably won't work on the GNU C Library." >&4
5183 dflt=n
bd9b35c9 5184 ;;
c1a7f87b
JH
5185 esac
5186 case "$dflt" in
5187 '')
5188 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5189 echo " "
5190 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
5191 echo "'nm' won't be sufficient on this sytem." >&4
5192 dflt=n
5193 fi
5194 ;;
5195 esac
5196 case "$dflt" in
5197 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5198 if $test $dflt -gt 20; then
5199 dflt=y
5200 else
5201 dflt=n
5202 fi
bd9b35c9
JH
5203 ;;
5204 esac
bd9b35c9
JH
5205 ;;
5206*)
c1a7f87b
JH
5207 case "$usenm" in
5208 true|$define) dflt=y;;
5209 *) dflt=n;;
5210 esac
bd9b35c9
JH
5211 ;;
5212esac
5213$cat <<EOM
5214
c1a7f87b
JH
5215I can use $nm to extract the symbols from your C libraries. This
5216is a time consuming task which may generate huge output on the disk (up
5217to 3 megabytes) but that should make the symbols extraction faster. The
5218alternative is to skip the 'nm' extraction part and to compile a small
5219test program instead to determine whether each symbol is present. If
5220you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5221this may be the best solution.
5222
5223You probably shouldn't let me use 'nm' if you are using the GNU C Library.
bd9b35c9
JH
5224
5225EOM
c1a7f87b
JH
5226rp="Shall I use $nm to extract C symbols from the libraries?"
5227. ./myread
5228case "$ans" in
5229[Nn]*) usenm=false;;
5230*) usenm=true;;
bd9b35c9 5231esac
bd9b35c9 5232
c1a7f87b
JH
5233runnm=$usenm
5234case "$reuseval" in
5235true) runnm=false;;
8e07c86e 5236esac
29209bc5 5237
c1a7f87b
JH
5238: nm options which may be necessary
5239case "$nm_opt" in
5240'') if $test -f /mach_boot; then
5241 nm_opt='' # Mach
5242 elif $test -d /usr/ccs/lib; then
5243 nm_opt='-p' # Solaris (and SunOS?)
5244 elif $test -f /dgux; then
5245 nm_opt='-p' # DG-UX
5246 elif $test -f /lib64/rld; then
5247 nm_opt='-p' # 64-bit Irix
5248 else
5249 nm_opt=''
5250 fi;;
5251esac
bd9b35c9 5252
c1a7f87b
JH
5253: nm options which may be necessary for shared libraries but illegal
5254: for archive libraries. Thank you, Linux.
5255case "$nm_so_opt" in
5256'') case "$myuname" in
5257 *linux*)
5258 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5259 nm_so_opt='--dynamic'
5260 fi
5261 ;;
bd9b35c9 5262 esac
c1a7f87b
JH
5263 ;;
5264esac
8e07c86e 5265
c1a7f87b
JH
5266case "$runnm" in
5267true)
5268: get list of predefined functions in a handy place
5269echo " "
5270case "$libc" in
5271'') libc=unknown
5272 case "$libs" in
5273 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
bd9b35c9 5274 esac
ff935051
JH
5275 ;;
5276esac
c1a7f87b
JH
5277libnames='';
5278case "$libs" in
5279'') ;;
5280*) for thislib in $libs; do
5281 case "$thislib" in
5282 -lc|-lc_s)
5283 : Handle C library specially below.
5284 ;;
5285 -l*)
5286 thislib=`echo $thislib | $sed -e 's/^-l//'`
5287 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5288 :
5289 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5290 :
5291 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5292 :
5293 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5294 :
5295 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5296 :
5297 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5298 :
5299 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5300 :
5301 else
5302 try=''
5303 fi
5304 libnames="$libnames $try"
5305 ;;
5306 *) libnames="$libnames $thislib" ;;
34d1710f 5307 esac
c1a7f87b 5308 done
4633a7c4
LW
5309 ;;
5310esac
c1a7f87b
JH
5311xxx=normal
5312case "$libc" in
5313unknown)
5314 set /lib/libc.$so
5315 for xxx in $libpth; do
5316 $test -r $1 || set $xxx/libc.$so
5317 : The messy sed command sorts on library version numbers.
5318 $test -r $1 || \
5319 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5320 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5321 h
5322 s/[0-9][0-9]*/0000&/g
5323 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5324 G
5325 s/\n/ /' | \
381aa1ff 5326 $sort | $sed -e 's/^.* //'`
c1a7f87b
JH
5327 eval set \$$#
5328 done
5329 $test -r $1 || set /usr/ccs/lib/libc.$so
5330 $test -r $1 || set /lib/libsys_s$_a
5331 ;;
5332*)
5333 set blurfl
5334 ;;
a4f3eea9 5335esac
c1a7f87b
JH
5336if $test -r "$1"; then
5337 echo "Your (shared) C library seems to be in $1."
5338 libc="$1"
5339elif $test -r /lib/libc && $test -r /lib/clib; then
5340 echo "Your C library seems to be in both /lib/clib and /lib/libc."
5341 xxx=apollo
5342 libc='/lib/clib /lib/libc'
5343 if $test -r /lib/syslib; then
5344 echo "(Your math library is in /lib/syslib.)"
5345 libc="$libc /lib/syslib"
5346 fi
5347elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5348 echo "Your C library seems to be in $libc, as you said before."
5349elif $test -r $incpath/usr/lib/libc$_a; then
5350 libc=$incpath/usr/lib/libc$_a;
5351 echo "Your C library seems to be in $libc. That's fine."
5352elif $test -r /lib/libc$_a; then
5353 libc=/lib/libc$_a;
5354 echo "Your C library seems to be in $libc. You're normal."
5355else
5356 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5357 :
5358 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5359 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5360 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5361 :
5362 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5363 :
5364 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5365 :
5366 else
5367 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5368 fi
5369 if $test -r "$tans"; then
5370 echo "Your C library seems to be in $tans, of all places."
5371 libc=$tans
5372 else
5373 libc='blurfl'
5374 fi
5375fi
5376if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5377 dflt="$libc"
5378 cat <<EOM
a4f3eea9 5379
c1a7f87b
JH
5380If the guess above is wrong (which it might be if you're using a strange
5381compiler, or your machine supports multiple models), you can override it here.
bd9b35c9
JH
5382
5383EOM
a4f3eea9 5384else
c1a7f87b 5385 dflt=''
381aa1ff 5386 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
c1a7f87b
JH
5387 cat >&4 <<EOM
5388I can't seem to find your C library. I've looked in the following places:
a4f3eea9 5389
c1a7f87b
JH
5390EOM
5391 $sed 's/^/ /' libpath
5392 cat <<EOM
29209bc5 5393
c1a7f87b 5394None of these seems to contain your C library. I need to get its name...
a4f3eea9 5395
bd9b35c9 5396EOM
bd9b35c9 5397fi
c1a7f87b
JH
5398fn=f
5399rp='Where is your C library?'
5400. ./getfile
5401libc="$ans"
a4f3eea9 5402
c1a7f87b 5403echo " "
381aa1ff 5404echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
c1a7f87b
JH
5405set X `cat libnames`
5406shift
5407xxx=files
5408case $# in 1) xxx=file; esac
5409echo "Extracting names from the following $xxx for later perusal:" >&4
5410echo " "
5411$sed 's/^/ /' libnames >&4
5412echo " "
5413$echo $n "This may take a while...$c" >&4
a4f3eea9 5414
c1a7f87b
JH
5415for file in $*; do
5416 case $file in
5417 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5418 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 5419 esac
c1a7f87b 5420done >libc.tmp
a4f3eea9 5421
c1a7f87b
JH
5422$echo $n ".$c"
5423$grep fprintf libc.tmp > libc.ptf
5424xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5425xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5426xxx='[ADTSIW]'
5427if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
5428 eval $xscan;\
5429 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5430 eval $xrun
5431elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5432 eval $xscan;\
5433 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5434 eval $xrun
5435elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5436 eval $xscan;\
5437 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5438 eval $xrun
5439elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5440 eval $xscan;\
5441 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5442 eval $xrun
5443elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5444 eval $xscan;\
5445 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5446 eval $xrun
5447elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5448 eval $xscan;\
5449 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5450 eval $xrun
5451elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5452 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
5453 eval $xscan;\
5454 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5455 eval $xrun
5456elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5457 eval $xscan;\
5458 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5459 eval $xrun
5460elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5461 eval $xscan;\
5462 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5463 eval $xrun
5464elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5465 eval $xscan;\
5466 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5467 eval $xrun
5468elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5469 eval $xscan;\
5470 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5471 eval $xrun
5472elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5473 eval $xscan;\
5474 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5475 eval $xrun
5476elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5477 eval $xscan;\
5478 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5479 eval $xrun
5480elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
5481 eval $xscan;\
5482 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5483 eval $xrun
5484else
5485 $nm -p $* 2>/dev/null >libc.tmp
5486 $grep fprintf libc.tmp > libc.ptf
5487 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5488 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5489 then
5490 nm_opt='-p'
5491 eval $xrun
bd9b35c9 5492 else
c1a7f87b
JH
5493 echo " "
5494 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5495 com=''
5496 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5497 for thisname in $libnames $libc; do
5498 $ar t $thisname >>libc.tmp
5499 done
5500 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5501 echo "Ok." >&4
5502 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5503 # Repeat libc to extract forwarders to DLL entries too
5504 for thisname in $libnames $libc; do
5505 $ar tv $thisname >>libc.tmp
5506 # Revision 50 of EMX has bug in $ar.
5507 # it will not extract forwarders to DLL entries
5508 # Use emximp which will extract exactly them.
5509 emximp -o tmp.imp $thisname \
5510 2>/dev/null && \
5511 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5512 < tmp.imp >>libc.tmp
5513 $rm tmp.imp
5514 done
5515 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5516 echo "Ok." >&4
5517 else
5518 echo "$ar didn't seem to work right." >&4
5519 echo "Maybe this is a Cray...trying bld instead..." >&4
5520 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5521 then
5522 for thisname in $libnames; do
5523 bld t $libnames | \
5524 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5525 $ar t $thisname >>libc.tmp
5526 done
5527 echo "Ok." >&4
bd9b35c9 5528 else
c1a7f87b
JH
5529 echo "That didn't work either. Giving up." >&4
5530 exit 1
bd9b35c9 5531 fi
c1a7f87b 5532 fi
a4f3eea9 5533 fi
a4f3eea9 5534fi
c1a7f87b
JH
5535nm_extract="$com"
5536if $test -f /lib/syscalls.exp; then
5537 echo " "
5538 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5539 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5540fi
5541;;
5542esac
5543$rm -f libnames libpath
bd9b35c9 5544
c1a7f87b
JH
5545: is a C symbol defined?
5546csym='tlook=$1;
5547case "$3" in
5548-v) tf=libc.tmp; tc=""; tdc="";;
5549-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5550*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5551esac;
5552tx=yes;
5553case "$reuseval-$4" in
5554true-) ;;
5555true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5556esac;
5557case "$tx" in
5558yes)
5559 case "$runnm" in
5560 true)
5561 if $contains $tlook $tf >/dev/null 2>&1;
5562 then tval=true;
5563 else tval=false;
5564 fi;;
5565 *)
5566 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
7a282f6d 5567 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
c1a7f87b
JH
5568 then tval=true;
5569 else tval=false;
5570 fi;
5571 $rm -f t t.c;;
5572 esac;;
5573*)
5574 case "$tval" in
5575 $define) tval=true;;
5576 *) tval=false;;
5577 esac;;
5578esac;
5579eval "$2=$tval"'
bd9b35c9 5580
c1a7f87b
JH
5581: define an is-in-libc? function
5582inlibc='echo " "; td=$define; tu=$undef;
5583sym=$1; var=$2; eval "was=\$$2";
5584tx=yes;
5585case "$reuseval$was" in
5586true) ;;
5587true*) tx=no;;
5588esac;
5589case "$tx" in
5590yes)
5591 set $sym tres -f;
5592 eval $csym;
5593 case "$tres" in
5594 true)
5595 echo "$sym() found." >&4;
5596 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5597 *)
5598 echo "$sym() NOT found." >&4;
5599 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5600 esac;;
bd9b35c9 5601*)
c1a7f87b
JH
5602 case "$was" in
5603 $define) echo "$sym() found." >&4;;
5604 *) echo "$sym() NOT found." >&4;;
5605 esac;;
5606esac'
5607
b4eb6b3d
JH
5608: see if sqrtl exists
5609set sqrtl d_sqrtl
c1a7f87b
JH
5610eval $inlibc
5611
b4eb6b3d
JH
5612case "$ccflags" in
5613*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
c1a7f87b 5614esac
b4eb6b3d
JH
5615
5616case "$uselongdouble" in
5617$define|true|[yY]*) dflt='y';;
5618*) dflt='n';;
5619esac
5620cat <<EOM
5621
5622Perl can be built to take advantage of long doubles which
5623(if available) may give more accuracy and range for floating point numbers.
5624
5625If this doesn't make any sense to you, just accept the default '$dflt'.
5626EOM
5627rp='Try to use long doubles if available?'
c1a7f87b
JH
5628. ./myread
5629case "$ans" in
b4eb6b3d
JH
5630y|Y) val="$define" ;;
5631*) val="$undef" ;;
5632esac
5633set uselongdouble
5634eval $setvar
bfb7748a 5635
b4eb6b3d
JH
5636case "$uselongdouble" in
5637true|[yY]*) uselongdouble="$define" ;;
5638esac
bfb7748a 5639
b4eb6b3d
JH
5640case "$uselongdouble" in
5641$define)
5642: Look for a hint-file generated 'call-back-unit'. If the
5643: user has specified that long doubles should be used,
5644: we may need to set or change some other defaults.
5645 if $test -f uselongdouble.cbu; then
5646 echo "Your platform has some specific hints for long doubles, using them..."
5647 . ./uselongdouble.cbu
5648 else
5649 $cat <<EOM
5650(Your platform doesn't have any specific hints for long doubles.)
c1a7f87b 5651EOM
b4eb6b3d
JH
5652 fi
5653 ;;
5654esac
5655
5656case "$uselongdouble:$d_sqrtl" in
5657$define:$undef)
5658 $cat <<EOM >&4
5659
5660*** You requested the use of long doubles but you do not seem to have
5661*** the mathematic functions for long doubles. I'm disabling the use
5662*** of long doubles.
5663
5664EOM
5665 uselongdouble=$undef
5666 ;;
5667esac
5668
5669: check for length of double
5670echo " "
5671case "$doublesize" in
5672'')
5673 echo "Checking to see how big your double precision numbers are..." >&4
5674 $cat >try.c <<'EOCP'
5675#include <stdio.h>
5676int main()
5677{
5678 printf("%d\n", (int)sizeof(double));
5679 exit(0);
5680}
5681EOCP
5682 set try
5683 if eval $compile_ok; then
5684 doublesize=`./try`
5685 echo "Your double is $doublesize bytes long."
5686 else
5687 dflt='8'
5688 echo "(I can't seem to compile the test program. Guessing...)"
5689 rp="What is the size of a double precision number (in bytes)?"
5690 . ./myread
5691 doublesize="$ans"
5692 fi
5693 ;;
5694esac
5695$rm -f try.c try
5696
5697: check for long doubles
5698echo " "
5699echo "Checking to see if you have long double..." >&4
5700echo 'int main() { long double x = 7.0; }' > try.c
5701set try
5702if eval $compile; then
5703 val="$define"
5704 echo "You have long double."
5705else
5706 val="$undef"
5707 echo "You do not have long double."
5708fi
5709$rm try.*
5710set d_longdbl
5711eval $setvar
5712
5713: check for length of long double
5714case "${d_longdbl}${longdblsize}" in
5715$define)
5716 echo " "
5717 echo "Checking to see how big your long doubles are..." >&4
5718 $cat >try.c <<'EOCP'
5719#include <stdio.h>
5720int main()
5721{
5722 printf("%d\n", sizeof(long double));
5723}
5724EOCP
5725 set try
5726 set try
5727 if eval $compile; then
5728 longdblsize=`./try$exe_ext`
5729 echo "Your long doubles are $longdblsize bytes long."
5730 else
5731 dflt='8'
5732 echo " "
5733 echo "(I can't seem to compile the test program. Guessing...)" >&4
5734 rp="What is the size of a long double (in bytes)?"
5735 . ./myread
5736 longdblsize="$ans"
5737 fi
5738 if $test "X$doublesize" = "X$longdblsize"; then
5739 echo "(That isn't any different from an ordinary double.)"
5740 fi
5741 ;;
5742esac
5743$rm -f try.* try
5744
51de783f 5745case "$useperlio" in
5a3a8a02 5746$define|true|[yY]*|'') dflt='y';;
51de783f
JH
5747*) dflt='n';;
5748esac
5749cat <<EOM
5750
5751Previous version of $package used the standard IO mechanisms as
5a3a8a02 5752defined in <stdio.h>. Versions 5.003_02 and later of $package allow
51de783f 5753alternate IO mechanisms via the PerlIO abstraction layer, but the
5a3a8a02
JH
5754stdio mechanism is still available if needed. The abstraction layer
5755can use AT&T's sfio (if you already have sfio installed) or regular stdio.
51de783f
JH
5756Using PerlIO with sfio may cause problems with some extension modules.
5757
5758If this doesn't make any sense to you, just accept the default '$dflt'.
5759EOM
5a3a8a02 5760rp='Use the PerlIO abstraction layer?'
51de783f
JH
5761. ./myread
5762case "$ans" in
5763y|Y)
5764 val="$define"
5a3a8a02 5765 ;;
51de783f
JH
5766*)
5767 echo "Ok, doing things the stdio way."
5768 val="$undef"
5769 ;;
5770esac
5771set useperlio
5772eval $setvar
5773
5774case "$usesocks" in
5775$define|true|[yY]*)
5776 case "$useperlio" in
5777 $define|true|[yY]*) ;;
5778 *) cat >&4 <<EOM
5779
5780You are using the SOCKS proxy protocol library which means that you
5781should also use the PerlIO layer. You may be headed for trouble.
5782
5783EOM
5784 ;;
5785 esac
5786 ;;
5787esac
5788
5789
b4eb6b3d
JH
5790: determine the architecture name
5791echo " "
5792if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5793 tarch=`arch`"-$osname"
5794elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5795 if uname -m > tmparch 2>&1 ; then
5796 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5797 -e 's/$/'"-$osname/" tmparch`
5798 else
5799 tarch="$osname"
5800 fi
5801 $rm -f tmparch
5802else
5803 tarch="$osname"
5804fi
5805case "$myarchname" in
5806''|"$tarch") ;;
5807*)
5808 echo "(Your architecture name used to be $myarchname.)"
5809 archname=''
5810 ;;
5811esac
5812myarchname="$tarch"
5813case "$archname" in
5814'') dflt="$tarch";;
5815*) dflt="$archname";;
5816esac
5817rp='What is your architecture name'
5818. ./myread
5819archname="$ans"
5820case "$usethreads" in
5821$define)
5822 echo "Threads selected." >&4
5823 case "$archname" in
5824 *-thread*) echo "...and architecture name already has -thread." >&4
5825 ;;
5826 *) archname="$archname-thread"
5827 echo "...setting architecture name to $archname." >&4
5828 ;;
5829 esac
5830 ;;
5831esac
5832case "$usemultiplicity" in
5833$define)
5834 echo "Multiplicity selected." >&4
5835 case "$archname" in
5836 *-multi*) echo "...and architecture name already has -multi." >&4
5837 ;;
5838 *) archname="$archname-multi"
5839 echo "...setting architecture name to $archname." >&4
5840 ;;
5841 esac
5842 ;;
5843esac
5844case "$use64bitint$use64bitall" in
5845*"$define"*)
5846 case "$archname64" in
5847 '')
5848 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5849 ;;
5850 *)
5851 case "$use64bitint" in
5852 "$define") echo "64 bit integers selected." >&4 ;;
5853 esac
5854 case "$use64bitall" in
5855 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5856 esac
5857 case "$archname" in
5858 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5859 ;;
5860 *) archname="$archname-$archname64"
5861 echo "...setting architecture name to $archname." >&4
5862 ;;
5863 esac
5864 ;;
5865 esac
5866esac
5867case "$uselongdouble" in
5868$define)
5869 echo "Long doubles selected." >&4
5870 case "$longdblsize" in
5871 $doublesize)
5872 "...but long doubles are equal to doubles, not changing architecture name." >&4
5873 ;;
5874 *)
5875 case "$archname" in
5876 *-ld*) echo "...and architecture name already has -ld." >&4
5877 ;;
5878 *) archname="$archname-ld"
5879 echo "...setting architecture name to $archname." >&4
5880 ;;
5881 esac
5882 ;;
5883 esac
5884 ;;
5885esac
51de783f
JH
5886case "$useperlio" in
5887$define)
5888 echo "Perlio selected." >&4
d46c9a2d
JH
5889 ;;
5890*)
5891 echo "Perlio not selected, using stdio." >&4
51de783f 5892 case "$archname" in
d46c9a2d 5893 *-stdio*) echo "...and architecture name already has -stdio." >&4
51de783f 5894 ;;
d46c9a2d 5895 *) archname="$archname-stdio"
51de783f
JH
5896 echo "...setting architecture name to $archname." >&4
5897 ;;
5898 esac
5899 ;;
5900esac
b4eb6b3d
JH
5901
5902: determine root of directory hierarchy where package will be installed.
5903case "$prefix" in
5904'')
5905 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5906 ;;
5907*)
5908 dflt="$prefix"
5909 ;;
5910esac
5911$cat <<EOM
5912
5913By default, $package will be installed in $dflt/bin, manual pages
5914under $dflt/man, etc..., i.e. with $dflt as prefix for all
5915installation directories. Typically this is something like /usr/local.
5916If you wish to have binaries under /usr/bin but other parts of the
5917installation under /usr/local, that's ok: you will be prompted
5918separately for each of the installation directories, the prefix being
5919only used to set the defaults.
5920
5921EOM
5922fn=d~
5923rp='Installation prefix to use?'
5924. ./getfile
5925oldprefix=''
5926case "$prefix" in
5927'') ;;
5928*)
5929 case "$ans" in
5930 "$prefix") ;;
5931 *) oldprefix="$prefix";;
5932 esac
5933 ;;
5934esac
5935prefix="$ans"
5936prefixexp="$ansexp"
5937
a6d26a0d
JH
5938case "$afsroot" in
5939'') afsroot=/afs ;;
5940*) afsroot=$afsroot ;;
5941esac
5942
b4eb6b3d
JH
5943: is AFS running?
5944echo " "
5945case "$afs" in
5946$define|true) afs=true ;;
5947$undef|false) afs=false ;;
a6d26a0d 5948*) if test -d $afsroot; then
b4eb6b3d
JH
5949 afs=true
5950 else
5951 afs=false
5952 fi
5953 ;;
5954esac
5955if $afs; then
5956 echo "AFS may be running... I'll be extra cautious then..." >&4
5957else
5958 echo "AFS does not seem to be running..." >&4
5959fi
5960
5961: determine installation prefix for where package is to be installed.
5962if $afs; then
5963$cat <<EOM
5964
5965Since you are running AFS, I need to distinguish the directory in which
5966files will reside from the directory in which they are installed (and from
5967which they are presumably copied to the former directory by occult means).
5968
5969EOM
5970 case "$installprefix" in
5971 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5972 *) dflt="$installprefix";;
5973 esac
5974else
5975$cat <<EOM
5976
5977In some special cases, particularly when building $package for distribution,
5978it is convenient to distinguish between the directory in which files should
5979be installed from the directory ($prefix) in which they
5980will eventually reside. For most users, these two directories are the same.
5981
5982EOM
5983 case "$installprefix" in
5984 '') dflt=$prefix ;;
5985 *) dflt=$installprefix;;
5986 esac
5987fi
5988fn=d~
5989rp='What installation prefix should I use for installing files?'
5990. ./getfile
5991installprefix="$ans"
5992installprefixexp="$ansexp"
5993
5994: set the prefixit variable, to compute a suitable default value
5995prefixit='case "$3" in
5996""|none)
5997 case "$oldprefix" in
5998 "") eval "$1=\"\$$2\"";;
5999 *)
6000 case "$3" in
6001 "") eval "$1=";;
6002 none)
6003 eval "tp=\"\$$2\"";
6004 case "$tp" in
6005 ""|" ") eval "$1=\"\$$2\"";;
6006 *) eval "$1=";;
6007 esac;;
6008 esac;;
6009 esac;;
6010*)
6011 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6012 case "$tp" in
6013 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6014 /*-$oldprefix/*|\~*-$oldprefix/*)
6015 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6016 *) eval "$1=\"\$$2\"";;
6017 esac;;
6018esac'
6019
6020
6021: get the patchlevel
6022echo " "
6023echo "Getting the current patchlevel..." >&4
6024if $test -r $rsrc/patchlevel.h;then
6025 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6026 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6027 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6028 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6029 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6030 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
151e6568 6031 perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
b4eb6b3d
JH
6032else
6033 revision=0
6034 patchlevel=0
6035 subversion=0
6036 api_revision=0
6037 api_version=0
6038 api_subversion=0
151e6568
MB
6039 perl_patchlevel=0
6040 $echo "(You do not have patchlevel.h. Eek.)"
b4eb6b3d 6041fi
151e6568
MB
6042if $test -r $rsrc/.patch ; then
6043 if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6044 perl_patchlevel=`cat $rsrc/.patch`
6045 fi
6046fi
6047case "$perl_patchlevel" in
60480) ;;
6049'') $echo "(You have $package version $patchlevel subversion $subversion.)" ;;
6050*) $echo "(You have $package version $patchlevel subversion $subversion patchlevel $perl_patchlevel.)" ;;
6051esac
b4eb6b3d
JH
6052case "$osname" in
6053dos|vms)
6054 : XXX Should be a Configure test for double-dots in filenames.
6055 version=`echo $revision $patchlevel $subversion | \
6056 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6057 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6058 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6059 ;;
6060*)
6061 version=`echo $revision $patchlevel $subversion | \
6062 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6063 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6064 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6065 ;;
6066esac
6067: Special case the 5.005_xx maintenance series, which used 5.005
6068: without any subversion label as a subdirectory in $sitelib
6069if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6070 api_versionstring='5.005'
6071fi
6072
6073: determine installation style
6074: For now, try to deduce it from prefix unless it is already set.
6075: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6076case "$installstyle" in
6077'') case "$prefix" in
6078 *perl*) dflt='lib';;
6079 *) dflt='lib/perl5' ;;
6080 esac
6081 ;;
6082*) dflt="$installstyle" ;;
6083esac
6084: Probably not worth prompting for this since we prompt for all
6085: the directories individually, and the prompt would be too long and
6086: confusing anyway.
6087installstyle=$dflt
6088
6089: determine where private library files go
6090: Usual default is /usr/local/lib/perl5/$version.
6091: Also allow things like /opt/perl/lib/$version, since
6092: /opt/perl/lib/perl5... would be redundant.
6093: The default "style" setting is made in installstyle.U
6094case "$installstyle" in
6095*lib/perl5*) set dflt privlib lib/$package/$version ;;
6096*) set dflt privlib lib/$version ;;
6097esac
6098eval $prefixit
6099$cat <<EOM
6100
6101There are some auxiliary files for $package that need to be put into a
6102private library directory that is accessible by everyone.
6103
6104EOM
6105fn=d~+
6106rp='Pathname where the private library files will reside?'
6107. ./getfile
6108privlib="$ans"
6109privlibexp="$ansexp"
6110: Change installation prefix, if necessary.
6111if $test X"$prefix" != X"$installprefix"; then
6112 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6113else
6114 installprivlib="$privlibexp"
6115fi
6116
6117: set the prefixup variable, to restore leading tilda escape
6118prefixup='case "$prefixexp" in
6119"$prefix") ;;
6120*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6121esac'
6122
6123: determine where public architecture dependent libraries go
6124set archlib archlib
6125eval $prefixit
6126: privlib default is /usr/local/lib/$package/$version
6127: archlib default is /usr/local/lib/$package/$version/$archname
6128: privlib may have an optional trailing /share.
6129tdflt=`echo $privlib | $sed 's,/share$,,'`
6130tdflt=$tdflt/$archname
6131case "$archlib" in
6132'') dflt=$tdflt
6133 ;;
6134*) dflt="$archlib"
6135 ;;
6136esac
6137$cat <<EOM
6138
6139$spackage contains architecture-dependent library files. If you are
6140sharing libraries in a heterogeneous environment, you might store
6141these files in a separate location. Otherwise, you can just include
6142them with the rest of the public library files.
6143
6144EOM
6145fn=d+~
6146rp='Where do you want to put the public architecture-dependent libraries?'
6147. ./getfile
6148archlib="$ans"
6149archlibexp="$ansexp"
6150if $test X"$archlib" = X"$privlib"; then
6151 d_archlib="$undef"
6152else
6153 d_archlib="$define"
6154fi
6155: Change installation prefix, if necessary.
6156if $test X"$prefix" != X"$installprefix"; then
6157 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6158else
6159 installarchlib="$archlibexp"
6160fi
6161
6162
6163: Binary compatibility with 5.005 is not possible for builds
6164: with advanced features
6165case "$usethreads$usemultiplicity" in
6166*define*)
6167 bincompat5005="$undef"
6168 d_bincompat5005="$undef"
6169 ;;
6170*) $cat <<EOM
6171
6172This version of Perl can be compiled for binary compatibility with 5.005.
6173If you decide to do so, you will be able to continue using most of the
6174extensions that were compiled for Perl 5.005.
6175
6176EOM
6177 case "$bincompat5005$d_bincompat5005" in
6178 *"$undef"*) dflt=n ;;
6179 *) dflt=y ;;
6180 esac
6181 rp='Binary compatibility with Perl 5.005?'
6182 . ./myread
6183 case "$ans" in
6184 y*) val="$define" ;;
6185 *) val="$undef" ;;
6186 esac
6187 set d_bincompat5005
6188 eval $setvar
6189 case "$d_bincompat5005" in
6190 "$define")
6191 bincompat5005="$define"
6192 ;;
6193 *) bincompat5005="$undef"
6194 d_bincompat5005="$undef"
6195 ;;
6196 esac
6197 ;;
6198esac
6199
6200
6201: see if setuid scripts can be secure
6202$cat <<EOM
6203
6204Some kernels have a bug that prevents setuid #! scripts from being
6205secure. Some sites have disabled setuid #! scripts because of this.
6206
6207First let's decide if your kernel supports secure setuid #! scripts.
6208(If setuid #! scripts would be secure but have been disabled anyway,
6209don't say that they are secure if asked.)
6210
6211EOM
6212
6213val="$undef"
6214if $test -d /dev/fd; then
6215 echo "#!$ls" >reflect
6216 chmod +x,u+s reflect
6217 ./reflect >flect 2>&1
6218 if $contains "/dev/fd" flect >/dev/null; then
6219 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6220 val="$define"
6221 else
6222 $cat <<EOM
6223If you are not sure if they are secure, I can check but I'll need a
6224username and password different from the one you are using right now.
6225If you don't have such a username or don't want me to test, simply
6226enter 'none'.
6227
6228EOM
6229 rp='Other username to test security of setuid scripts with?'
6230 dflt='none'
6231 . ./myread
6232 case "$ans" in
6233 n|none)
6234 case "$d_suidsafe" in
6235 '') echo "I'll assume setuid scripts are *not* secure." >&4
6236 dflt=n;;
6237 "$undef")
6238 echo "Well, the $hint value is *not* secure." >&4
6239 dflt=n;;
6240 *) echo "Well, the $hint value *is* secure." >&4
6241 dflt=y;;
6242 esac
c1a7f87b 6243 ;;
b4eb6b3d
JH
6244 *)
6245 $rm -f reflect flect
6246 echo "#!$ls" >reflect
6247 chmod +x,u+s reflect
6248 echo >flect
6249 chmod a+w flect
6250 echo '"su" will (probably) prompt you for '"$ans's password."
6251 su $ans -c './reflect >flect'
6252 if $contains "/dev/fd" flect >/dev/null; then
6253 echo "Okay, it looks like setuid scripts are secure." >&4
6254 dflt=y
6255 else
6256 echo "I don't think setuid scripts are secure." >&4
6257 dflt=n
6258 fi
6259 ;;
6260 esac
6261 rp='Does your kernel have *secure* setuid scripts?'
6262 . ./myread
6263 case "$ans" in
6264 [yY]*) val="$define";;
6265 *) val="$undef";;
6266 esac
6267 fi
6268else
6269 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6270 echo "(That's for file descriptors, not floppy disks.)"
6271 val="$undef"
6272fi
6273set d_suidsafe
6274eval $setvar
6275
6276$rm -f reflect flect
6277
6278: now see if they want to do setuid emulation
6279echo " "
6280val="$undef"
6281case "$d_suidsafe" in
6282"$define")
6283 val="$undef"
6284 echo "No need to emulate SUID scripts since they are secure here." >& 4
6285 ;;
6286*)
6287 $cat <<EOM
6288Some systems have disabled setuid scripts, especially systems where
6289setuid scripts cannot be secure. On systems where setuid scripts have
6290been disabled, the setuid/setgid bits on scripts are currently
6291useless. It is possible for $package to detect those bits and emulate
6292setuid/setgid in a secure fashion. This emulation will only work if
6293setuid scripts have been disabled in your kernel.
6294
6295EOM
6296 case "$d_dosuid" in
6297 "$define") dflt=y ;;
6298 *) dflt=n ;;
6299 esac
6300 rp="Do you want to do setuid/setgid emulation?"
6301 . ./myread
6302 case "$ans" in
6303 [yY]*) val="$define";;
6304 *) val="$undef";;
6305 esac
6306 ;;
6307esac
6308set d_dosuid
6309eval $setvar
6310
b4eb6b3d
JH
6311: see if this is a malloc.h system
6312set malloc.h i_malloc
6313eval $inhdr
6314
6315: see if stdlib is available
6316set stdlib.h i_stdlib
6317eval $inhdr
6318
6319: determine which malloc to compile in
6320echo " "
6321case "$usemymalloc" in
c4163172
JH
6322[yY]*|true|$define) dflt='y' ;;
6323[nN]*|false|$undef) dflt='n' ;;
6324*) case "$ptrsize" in
6325 4) dflt='y' ;;
6326 *) dflt='n' ;;
6327 esac
6328 ;;
8dfa8df9 6329esac
b4eb6b3d
JH
6330rp="Do you wish to attempt to use the malloc that comes with $package?"
6331. ./myread
6332usemymalloc="$ans"
6333case "$ans" in
6334y*|true)
6335 usemymalloc='y'
6336 mallocsrc='malloc.c'
6337 mallocobj="malloc$_o"
6338 d_mymalloc="$define"
6339 case "$libs" in
6340 *-lmalloc*)
6341 : Remove malloc from list of libraries to use
6342 echo "Removing unneeded -lmalloc from library list" >&4
6343 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6344 shift
6345 libs="$*"
6346 echo "libs = $libs" >&4
6347 ;;
6348 esac
6349 ;;
6350*)
6351 usemymalloc='n'
6352 mallocsrc=''
6353 mallocobj=''
6354 d_mymalloc="$undef"
6355 ;;
6356esac
6357
6358: compute the return types of malloc and free
6359echo " "
6360$cat >malloc.c <<END
6361#$i_malloc I_MALLOC
6362#$i_stdlib I_STDLIB
6363#include <stdio.h>
6364#include <sys/types.h>
6365#ifdef I_MALLOC
6366#include <malloc.h>
6367#endif
6368#ifdef I_STDLIB
6369#include <stdlib.h>
6370#endif
6371#ifdef TRY_MALLOC
6372void *malloc();
6373#endif
6374#ifdef TRY_FREE
6375void free();
6376#endif
6377END
6378case "$malloctype" in
6379'')
6380 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6381 malloctype='void *'
6382 else
6383 malloctype='char *'
6384 fi
6385 ;;
6386esac
6387echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6388
6389case "$freetype" in
6390'')
6391 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6392 freetype='void'
6393 else
6394 freetype='int'
6395 fi
6396 ;;
6397esac
6398echo "Your system uses $freetype free(), it would seem." >&4
6399$rm -f malloc.[co]
6400$cat <<EOM
6401
6402After $package is installed, you may wish to install various
6403add-on modules and utilities. Typically, these add-ons will
6404be installed under $prefix with the rest
6405of this package. However, you may wish to install such add-ons
6406elsewhere under a different prefix.
6407
6408If you do not wish to put everything under a single prefix, that's
6409ok. You will be prompted for the individual locations; this siteprefix
6410is only used to suggest the defaults.
6411
6412The default should be fine for most people.
6413
6414EOM
6415fn=d~+
6416rp='Installation prefix to use for add-on modules and utilities?'
6417: XXX Here might be another good place for an installstyle setting.
6418case "$siteprefix" in
6419'') dflt=$prefix ;;
6420*) dflt=$siteprefix ;;
6421esac
6422. ./getfile
6423: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6424oldsiteprefix=''
6425case "$siteprefix" in
6426'') ;;
6427*) case "$ans" in
6428 "$prefix") ;;
6429 *) oldsiteprefix="$prefix";;
6430 esac
6431 ;;
6432esac
6433siteprefix="$ans"
6434siteprefixexp="$ansexp"
6435
6436: determine where site specific libraries go.
6437: Usual default is /usr/local/lib/perl5/site_perl/$version
6438: The default "style" setting is made in installstyle.U
6439: XXX No longer works with Prefixit stuff.
6440prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6441case "$sitelib" in
6442'') case "$installstyle" in
6443 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6444 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6445 esac
6446 ;;
6447*) dflt="$sitelib"
6448 ;;
6449esac
6450$cat <<EOM
6451
6452The installation process will create a directory for
6453site-specific extensions and modules. Most users find it convenient
6454to place all site-specific files in this directory rather than in the
6455main distribution directory.
6456
6457EOM
6458fn=d~+
6459rp='Pathname for the site-specific library files?'
6460. ./getfile
6461sitelib="$ans"
6462sitelibexp="$ansexp"
6463sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6464: Change installation prefix, if necessary.
6465if $test X"$prefix" != X"$installprefix"; then
6466 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6467else
6468 installsitelib="$sitelibexp"
6469fi
6470
6471: determine where site specific architecture-dependent libraries go.
6472: sitelib default is /usr/local/lib/perl5/site_perl/$version
6473: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6474: sitelib may have an optional trailing /share.
6475case "$sitearch" in
6476'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6477 dflt="$dflt/$archname"
6478 ;;
6479*) dflt="$sitearch"
6480 ;;
6481esac
6482set sitearch sitearch none
6483eval $prefixit
6484$cat <<EOM
6485
6486The installation process will also create a directory for
6487architecture-dependent site-specific extensions and modules.
6488
6489EOM
6490fn=d~+
6491rp='Pathname for the site-specific architecture-dependent library files?'
6492. ./getfile
6493sitearch="$ans"
6494sitearchexp="$ansexp"
6495: Change installation prefix, if necessary.
6496if $test X"$prefix" != X"$installprefix"; then
6497 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6498else
6499 installsitearch="$sitearchexp"
6500fi
6501
6502$cat <<EOM
6503
6504The installation process will also create a directory for
6505vendor-supplied add-ons. Vendors who supply perl with their system
6506may find it convenient to place all vendor-supplied files in this
6507directory rather than in the main distribution directory. This will
6508ease upgrades between binary-compatible maintenance versions of perl.
6509
6510Of course you may also use these directories in whatever way you see
6511fit. For example, you might use them to access modules shared over a
6512company-wide network.
6513
6514The default answer should be fine for most people.
6515This causes further questions about vendor add-ons to be skipped
6516and no vendor-specific directories will be configured for perl.
6517
6518EOM
6519rp='Do you want to configure vendor-specific add-on directories?'
6520case "$usevendorprefix" in
6521define|true|[yY]*) dflt=y ;;
6522*) : User may have set vendorprefix directly on Configure command line.
6523 case "$vendorprefix" in
6524 ''|' ') dflt=n ;;
6525 *) dflt=y ;;
6526 esac
6527 ;;
6528esac
6529. ./myread
6530case "$ans" in
6531[yY]*) fn=d~+
6532 rp='Installation prefix to use for vendor-supplied add-ons?'
6533 case "$vendorprefix" in
6534 '') dflt='' ;;
6535 *) dflt=$vendorprefix ;;
6536 esac
6537 . ./getfile
6538 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6539 oldvendorprefix=''
6540 case "$vendorprefix" in
6541 '') ;;
6542 *) case "$ans" in
6543 "$prefix") ;;
6544 *) oldvendorprefix="$prefix";;
6545 esac
6546 ;;
6547 esac
6548 usevendorprefix="$define"
6549 vendorprefix="$ans"
6550 vendorprefixexp="$ansexp"
6551 ;;
6552*) usevendorprefix="$undef"
6553 vendorprefix=''
6554 vendorprefixexp=''
6555 ;;
6556esac
6557
6558case "$vendorprefix" in
6559'') d_vendorlib="$undef"
6560 vendorlib=''
6561 vendorlibexp=''
6562 ;;
6563*) d_vendorlib="$define"
6564 : determine where vendor-supplied modules go.
6565 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6566 case "$vendorlib" in
6567 '')
6568 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6569 case "$installstyle" in
6570 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6571 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6572 esac
6573 ;;
6574 *) dflt="$vendorlib"
6575 ;;
6576 esac
6577 fn=d~+
6578 rp='Pathname for the vendor-supplied library files?'
6579 . ./getfile
6580 vendorlib="$ans"
6581 vendorlibexp="$ansexp"
6582 ;;
6583esac
6584vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6585: Change installation prefix, if necessary.
6586if $test X"$prefix" != X"$installprefix"; then
6587 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6588else
6589 installvendorlib="$vendorlibexp"
6590fi
6591
6592case "$vendorprefix" in
6593'') d_vendorarch="$undef"
6594 vendorarch=''
6595 vendorarchexp=''
6596 ;;
6597*) d_vendorarch="$define"
6598 : determine where vendor-supplied architecture-dependent libraries go.
6599 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6600 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6601 : vendorlib may have an optional trailing /share.
6602 case "$vendorarch" in
6603 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6604 dflt="$dflt/$archname"
6605 ;;
6606 *) dflt="$vendorarch" ;;
6607 esac
6608 fn=d~+
6609 rp='Pathname for vendor-supplied architecture-dependent files?'
6610 . ./getfile
6611 vendorarch="$ans"
6612 vendorarchexp="$ansexp"
6613 ;;
6614esac
6615: Change installation prefix, if necessary.
6616if $test X"$prefix" != X"$installprefix"; then
6617 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6618else
6619 installvendorarch="$vendorarchexp"
6620fi
6621
6622: Final catch-all directories to search
6623$cat <<EOM
6624
6625Lastly, you can have perl look in other directories for extensions and
6626modules in addition to those already specified.
6627These directories will be searched after
6628 $sitearch
6629 $sitelib
6630EOM
6631test X"$vendorlib" != "X" && echo ' ' $vendorlib
6632test X"$vendorarch" != "X" && echo ' ' $vendorarch
6633echo ' '
6634case "$otherlibdirs" in
6635''|' ') dflt='none' ;;
6636*) dflt="$otherlibdirs" ;;
6637esac
6638$cat <<EOM
6639Enter a colon-separated set of extra paths to include in perl's @INC
6640search path, or enter 'none' for no extra paths.
6641
6642EOM
6643
6644rp='Colon-separated list of additional directories for perl to search?'
6645. ./myread
6646case "$ans" in
6647' '|''|none) otherlibdirs=' ' ;;
6648*) otherlibdirs="$ans" ;;
6649esac
6650case "$otherlibdirs" in
6651' ') val=$undef ;;
6652*) val=$define ;;
6653esac
6654set d_perl_otherlibdirs
6655eval $setvar
6656
6657: Cruising for prototypes
6658echo " "
6659echo "Checking out function prototypes..." >&4
6660$cat >prototype.c <<'EOCP'
6661int main(int argc, char *argv[]) {
6662 exit(0);}
6663EOCP
6664if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6665 echo "Your C compiler appears to support function prototypes."
6666 val="$define"
6667else
6668 echo "Your C compiler doesn't seem to understand function prototypes."
6669 val="$undef"
6670fi
6671set prototype
6672eval $setvar
6673$rm -f prototype*
6674
6675case "$prototype" in
6676"$define") ;;
6677*) ansi2knr='ansi2knr'
6678 echo " "
6679 cat <<EOM >&4
6680
6681$me: FATAL ERROR:
6682This version of $package can only be compiled by a compiler that
6683understands function prototypes. Unfortunately, your C compiler
6684 $cc $ccflags
6685doesn't seem to understand them. Sorry about that.
6686
6687If GNU cc is available for your system, perhaps you could try that instead.
6688
6689Eventually, we hope to support building Perl with pre-ANSI compilers.
6690If you would like to help in that effort, please contact <perlbug@perl.org>.
6691
6692Aborting Configure now.
6693EOM
6694 exit 2
6695 ;;
6696esac
6697
6698: determine where public executables go
6699echo " "
6700set dflt bin bin
6701eval $prefixit
6702fn=d~
6703rp='Pathname where the public executables will reside?'
6704. ./getfile
6705if $test "X$ansexp" != "X$binexp"; then
6706 installbin=''
6707fi
6708bin="$ans"
6709binexp="$ansexp"
6710: Change installation prefix, if necessary.
6711: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6712if $test X"$prefix" != X"$installprefix"; then
6713 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6714else
6715 installbin="$binexp"
6716fi
6717
6718: Find perl5.005 or later.
6719echo "Looking for a previously installed perl5.005 or later... "
6720case "$perl5" in
a938a3bb 6721'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
b4eb6b3d 6722 : Check if this perl is recent and can load a simple module
a938a3bb 6723 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
b4eb6b3d
JH
6724 perl5=$tdir/perl
6725 break;
a938a3bb
IZ
6726 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6727 perl5=$tdir/perl5
b4eb6b3d
JH
6728 break;
6729 fi
6730 done
6731 ;;
6732*) perl5="$perl5"
6733 ;;
6734esac
6735case "$perl5" in
6736'') echo "None found. That's ok.";;
6737*) echo "Using $perl5." ;;
6738esac
6739
6740: Determine list of previous versions to include in @INC
6741$cat > getverlist <<EOPL
6742#!$perl5 -w
6743use File::Basename;
6744\$api_versionstring = "$api_versionstring";
6745\$version = "$version";
6746\$stem = "$sitelib_stem";
6747\$archname = "$archname";
6748EOPL
6749 $cat >> getverlist <<'EOPL'
6750# Can't have leading @ because metaconfig interprets it as a command!
6751;@inc_version_list=();
6752# XXX Redo to do opendir/readdir?
6753if (-d $stem) {
6754 chdir($stem);
6755 ;@candidates = glob("5.*");
6756}
6757else {
6758 ;@candidates = ();
6759}
6760
6761# XXX ToDo: These comparisons must be reworked when two-digit
6762# subversions come along, so that 5.7.10 compares as greater than
6763# 5.7.3! By that time, hope that 5.6.x is sufficiently
6764# widespread that we can use the built-in version vectors rather
6765# than reinventing them here. For 5.6.0, however, we must
6766# assume this script will likely be run by 5.005_0x. --AD 1/2000.
6767foreach $d (@candidates) {
6768 if ($d lt $version) {
6769 if ($d ge $api_versionstring) {
6770 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6771 }
6772 elsif ($d ge "5.005") {
6773 unshift(@inc_version_list, grep { -d } $d);
6774 }
6775 }
6776 else {
6777 # Skip newer version. I.e. don't look in
6778 # 5.7.0 if we're installing 5.6.1.
6779 }
6780}
6781
6782if (@inc_version_list) {
6783 print join(' ', @inc_version_list);
6784}
6785else {
6786 # Blank space to preserve value for next Configure run.
6787 print " ";
6788}
6789EOPL
6790chmod +x getverlist
6791case "$inc_version_list" in
a938a3bb 6792'') if test -x "$perl5$exe_ext"; then
b4eb6b3d
JH
6793 dflt=`$perl5 getverlist`
6794 else
6795 dflt='none'
6796 fi
6797 ;;
6798$undef) dflt='none' ;;
6d1a7737 6799*) eval dflt=\"$inc_version_list\" ;;
b4eb6b3d
JH
6800esac
6801case "$dflt" in
6802''|' ') dflt=none ;;
6803esac
6804case "$dflt" in
68055.005) case "$bincompat5005" in
6806 $define|true|[yY]*) ;;
6807 *) dflt=none ;;
6808 esac
6809 ;;
6810esac
6811$cat <<'EOM'
6812
6813In order to ease the process of upgrading, this version of perl
6814can be configured to use modules built and installed with earlier
6815versions of perl that were installed under $prefix. Specify here
6816the list of earlier versions that this version of perl should check.
6817If Configure detected no earlier versions of perl installed under
6818$prefix, then the list will be empty. Answer 'none' to tell perl
6819to not search earlier versions.
6820
6821The default should almost always be sensible, so if you're not sure,
6822just accept the default.
6823EOM
6824
6825rp='List of earlier versions to include in @INC?'
6826. ./myread
6827case "$ans" in
6828[Nn]one|''|' ') inc_version_list=' ' ;;
6829*) inc_version_list="$ans" ;;
6830esac
6831case "$inc_version_list" in
6832''|' ')
6833 inc_version_list_init='0';;
6834*) inc_version_list_init=`echo $inc_version_list |
6835 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6836 ;;
6837esac
6838$rm -f getverlist
6839
6840: determine whether to install perl also as /usr/bin/perl
6841
6842echo " "
6843if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6844 $cat <<EOM
6845Many scripts expect perl to be installed as /usr/bin/perl.
6846I can install the perl you are about to compile also as /usr/bin/perl
6847(in addition to $installbin/perl).
6848EOM
6849 case "$installusrbinperl" in
6850 "$undef"|[nN]*) dflt='n';;
6851 *) dflt='y';;
6852 esac
6853 rp="Do you want to install perl as /usr/bin/perl?"
6854 . ./myread
6855 case "$ans" in
6856 [yY]*) val="$define";;
6857 *) val="$undef" ;;
6858 esac
6859else
6860 val="$undef"
6861fi
6862set installusrbinperl
6863eval $setvar
6864
6865: see if dld is available
6866set dld.h i_dld
6867eval $inhdr
6868
6869: see if dlopen exists
6870xxx_runnm="$runnm"
6871runnm=false
6872set dlopen d_dlopen
6873eval $inlibc
6874runnm="$xxx_runnm"
6875
6876: determine which dynamic loading, if any, to compile in
6877echo " "
6878dldir="ext/DynaLoader"
6879case "$usedl" in
6880$define|y|true)
6881 dflt='y'
6882 usedl="$define"
6883 ;;
6884$undef|n|false)
6885 dflt='n'
6886 usedl="$undef"
6887 ;;
6888*)
6889 dflt='n'
6890 case "$d_dlopen" in
6891 $define) dflt='y' ;;
6892 esac
6893 case "$i_dld" in
6894 $define) dflt='y' ;;
6895 esac
6896 : Does a dl_xxx.xs file exist for this operating system
6897 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6898 ;;
6899esac
6900rp="Do you wish to use dynamic loading?"
6901. ./myread
6902usedl="$ans"
6903case "$ans" in
6904y*) usedl="$define"
6905 case "$dlsrc" in
6906 '')
6907 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6908 dflt="$dldir/dl_${osname}.xs"
6909 elif $test "$d_dlopen" = "$define" ; then
6910 dflt="$dldir/dl_dlopen.xs"
6911 elif $test "$i_dld" = "$define" ; then
6912 dflt="$dldir/dl_dld.xs"
6913 else
6914 dflt=''
6915 fi
6916 ;;
6917 *) dflt="$dldir/$dlsrc"
6918 ;;
6919 esac
6920 echo "The following dynamic loading files are available:"
6921 : Can not go over to $dldir because getfile has path hard-coded in.
6922 tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6923 rp="Source file to use for dynamic loading"
6924 fn="fne"
6925 gfpth="$src"
6926 . ./getfile
6927 usedl="$define"
6928 : emulate basename
6929 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6930
6931 $cat << EOM
6932
6933Some systems may require passing special flags to $cc -c to
6934compile modules that will be used to create a shared library.
6935To use no flags, say "none".
6936
6937EOM
6938 case "$cccdlflags" in
6939 '') case "$gccversion" in
6940 '') case "$osname" in
6941 hpux) dflt='+z' ;;
6942 next) dflt='none' ;;
6943 irix*) dflt='-KPIC' ;;
48bcfe03 6944 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
6945 sunos) dflt='-pic' ;;
6946 *) dflt='none' ;;
6947 esac
6948 ;;
6949 *) case "$osname" in
48bcfe03 6950 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
6951 *) dflt='-fpic' ;;
6952 esac ;;
6953 esac ;;
6954 ' ') dflt='none' ;;
6955 *) dflt="$cccdlflags" ;;
6956 esac
6957 rp="Any special flags to pass to $cc -c to compile shared library modules?"
6958 . ./myread
6959 case "$ans" in
6960 none) cccdlflags=' ' ;;
6961 *) cccdlflags="$ans" ;;
6962 esac
6963
6964 cat << EOM
6965
6966Some systems use ld to create libraries that can be dynamically loaded,
6967while other systems (such as those using ELF) use $cc.
6968
6969EOM
6970 case "$ld" in
6971 '') $cat >try.c <<'EOM'
6972/* Test for whether ELF binaries are produced */
6973#include <fcntl.h>
6974#include <stdlib.h>
6975int main() {
6976 char b[4];
6977 int i = open("a.out",O_RDONLY);
6978 if(i == -1)
6979 exit(1); /* fail */
6980 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6981 exit(0); /* succeed (yes, it's ELF) */
6982 else
6983 exit(1); /* fail */
6984}
6985EOM
e4778687 6986 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && ./a.out; then
b4eb6b3d
JH
6987 cat <<EOM
6988You appear to have ELF support. I'll use $cc to build dynamic libraries.
6989EOM
6990 dflt="$cc"
6991 else
6992 echo "I'll use ld to build dynamic libraries."
6993 dflt='ld'
6994 fi
6995 rm -f try.c a.out
6996 ;;
6997 *) dflt="$ld"
6998 ;;
6999 esac
7000
7001 rp="What command should be used to create dynamic libraries?"
7002 . ./myread
7003 ld="$ans"
7004
7005 cat << EOM
7006
7007Some systems may require passing special flags to $ld to create a
7008library that can be dynamically loaded. If your ld flags include
7009-L/other/path options to locate libraries outside your loader's normal
7010search path, you may need to specify those -L options here as well. To
7011use no flags, say "none".
7012
7013EOM
7014 case "$lddlflags" in
7015 '') case "$osname" in
7016 beos) dflt='-nostart' ;;
7017 hpux) dflt='-b';
7018 case "$gccversion" in
7019 '') dflt="$dflt +vnocompatwarnings" ;;
7020 esac
7021 ;;
7022 linux|irix*) dflt='-shared' ;;
7023 next) dflt='none' ;;
7024 solaris) dflt='-G' ;;
7025 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7026 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7027 *) dflt='none' ;;
7028 esac
7029 ;;
7030 *) dflt="$lddlflags" ;;
7031 esac
7032
7033 : Try to guess additional flags to pick up local libraries.
7034 : Be careful not to append to a plain 'none'
7035 case "$dflt" in
7036 none) dflt='' ;;
7037 esac
7038 for thisflag in $ldflags; do
7039 case "$thisflag" in
7040 -L*|-R*)
7041 case " $dflt " in
7042 *" $thisflag "*) ;;
7043 *) dflt="$dflt $thisflag" ;;
7044 esac
7045 ;;
7046 esac
7047 done
7048
7049 case "$dflt" in
7050 ''|' ') dflt='none' ;;
7051 esac
7052
7053 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7054 . ./myread
7055 case "$ans" in
7056 none) lddlflags=' ' ;;
7057 *) lddlflags="$ans" ;;
7058 esac
7059
7060 cat <<EOM
7061
7062Some systems may require passing special flags to $cc to indicate that
7063the resulting executable will use dynamic linking. To use no flags,
7064say "none".
7065
7066EOM
7067 case "$ccdlflags" in
7068 '') case "$osname" in
7069 hpux) dflt='-Wl,-E' ;;
7070 linux) dflt='-rdynamic' ;;
7071 next) dflt='none' ;;
7072 sunos) dflt='none' ;;
7073 *) dflt='none' ;;
7074 esac ;;
7075 ' ') dflt='none' ;;
7076 *) dflt="$ccdlflags" ;;
7077 esac
7078 rp="Any special flags to pass to $cc to use dynamic linking?"
7079 . ./myread
7080 case "$ans" in
7081 none) ccdlflags=' ' ;;
7082 *) ccdlflags="$ans" ;;
7083 esac
7084 ;;
7085*) usedl="$undef"
7086 ld='ld'
7087 dlsrc='dl_none.xs'
7088 lddlflags=''
7089 ccdlflags=''
7090 ;;
7091esac
7092
7093also=''
7094case "$usedl" in
7095$undef)
7096 # No dynamic loading being used, so don't bother even to prompt.
7097 useshrplib='false'
7098 ;;
7099*) case "$useshrplib" in
7100 '') case "$osname" in
48bcfe03 7101 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7102 dflt=y
7103 also='Building a shared libperl is required for dynamic loading to work on your system.'
7104 ;;
7105 next*)
7106 case "$osvers" in
7107 4*) dflt=y
7108 also='Building a shared libperl is needed for MAB support.'
7109 ;;
7110 *) dflt=n
7111 ;;
7112 esac
7113 ;;
7114 *) dflt=n
7115 ;;
7116 esac
7117 ;;
7118 $define|true|[Yy]*)
7119 dflt=y
7120 ;;
7121 *) dflt=n
7122 ;;
7123 esac
7124 $cat << EOM
7125
7126The perl executable is normally obtained by linking perlmain.c with
7127libperl${_a}, any static extensions (usually just DynaLoader), and
7128any other libraries needed on this system (such as -lm, etc.). Since
7129your system supports dynamic loading, it is probably possible to build
7130a shared libperl.$so. If you will have more than one executable linked
7131to libperl.$so, this will significantly reduce the size of each
7132executable, but it may have a noticeable affect on performance. The
7133default is probably sensible for your system.
7134$also
7135
7136EOM
7137 rp="Build a shared libperl.$so (y/n)"
7138 . ./myread
7139 case "$ans" in
7140 true|$define|[Yy]*)
7141 useshrplib='true' ;;
7142 *) useshrplib='false' ;;
7143 esac
7144 ;;
7145esac
7146
7147case "$useshrplib" in
7148true)
7149 case "$libperl" in
7150 '')
7151 # Figure out a good name for libperl.so. Since it gets stored in
7152 # a version-specific architecture-dependent library, the version
7153 # number isn't really that important, except for making cc/ld happy.
7154 #
7155 # A name such as libperl.so.3.1
7156 majmin="libperl.$so.$patchlevel.$subversion"
7157 # A name such as libperl.so.301
7158 majonly=`echo $patchlevel $subversion |
7159 $awk '{printf "%d%02d", $1, $2}'`
7160 majonly=libperl.$so.$majonly
7161 # I'd prefer to keep the os-specific stuff here to a minimum, and
7162 # rely on figuring it out from the naming of libc.
7163 case "${osname}${osvers}" in
7164 next4*)
7165 dflt=libperl.5.$so
7166 # XXX How handle the --version stuff for MAB?
7167 ;;
7168 linux*) # ld won't link with a bare -lperl otherwise.
7169 dflt=libperl.$so
7170 ;;
7171 cygwin*) # include version
7172 dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7173 ;;
7174 *) # Try to guess based on whether libc has major.minor.
7175 case "$libc" in
7176 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7177 *libc.$so.[0-9]*) dflt=$majonly ;;
7178 *) dflt=libperl.$so ;;
7179 esac
7180 ;;
7181 esac
7182 ;;
7183 *) dflt=$libperl
7184 ;;
7185 esac
7186 cat << EOM
7187
7188I need to select a good name for the shared libperl. If your system uses
7189library names with major and minor numbers, then you might want something
7190like $majmin. Alternatively, if your system uses a single version
7191number for shared libraries, then you might want to use $majonly.
7192Or, your system might be quite happy with a simple libperl.$so.
7193
7194Since the shared libperl will get installed into a version-specific
7195architecture-dependent directory, the version number of the shared perl
7196library probably isn't important, so the default should be o.k.
7197
7198EOM
7199 rp='What name do you want to give to the shared libperl?'
7200 . ./myread
7201 libperl=$ans
7202 echo "Ok, I'll use $libperl"
7203 ;;
7204*)
7205 libperl="libperl${_a}"
7206 ;;
7207esac
7208
7209# Detect old use of shrpdir via undocumented Configure -Dshrpdir
7210case "$shrpdir" in
7211'') ;;
7212*) $cat >&4 <<EOM
7213WARNING: Use of the shrpdir variable for the installation location of
7214the shared $libperl is not supported. It was never documented and
7215will not work in this version. Let me (perlbug@perl.org)
7216know of any problems this may cause.
7217
7218EOM
7219 case "$shrpdir" in
7220 "$archlibexp/CORE")
7221 $cat >&4 <<EOM
7222But your current setting of $shrpdir is
7223the default anyway, so it's harmless.
7224EOM
7225 ;;
7226 *)
7227 $cat >&4 <<EOM
7228Further, your current attempted setting of $shrpdir
7229conflicts with the value of $archlibexp/CORE
7230that installperl will use.
7231EOM
7232 ;;
7233 esac
7234 ;;
7235esac
7236
7237# How will the perl executable find the installed shared $libperl?
7238# Add $xxx to ccdlflags.
7239# If we can't figure out a command-line option, use $shrpenv to
7240# set env LD_RUN_PATH. The main perl makefile uses this.
7241shrpdir=$archlibexp/CORE
7242xxx=''
7243tmp_shrpenv=''
7244if "$useshrplib"; then
7245 case "$osname" in
7246 aix)
7247 # We'll set it in Makefile.SH...
7248 ;;
7249 solaris|netbsd)
7250 xxx="-R $shrpdir"
7251 ;;
7252 freebsd)
7253 xxx="-Wl,-R$shrpdir"
7254 ;;
7255 linux|irix*|dec_osf)
7256 xxx="-Wl,-rpath,$shrpdir"
7257 ;;
7258 next)
7259 # next doesn't like the default...
7260 ;;
7261 beos)
7262 # beos doesn't like the default, either.
7263 ;;
7264 hpux*)
7265 # hpux doesn't like the default, either.
7266 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7267 ;;
7268 *)
7269 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7270 ;;
7271 esac
7272 case "$xxx" in
7273 '') ;;
7274 *)
7275 # Only add $xxx if it isn't already in ccdlflags.
7276 case " $ccdlflags " in
7277 *" $xxx "*) ;;
7278 *) ccdlflags="$ccdlflags $xxx"
7279 cat <<EOM >&4
7280
7281Adding $xxx to the flags
7282passed to $ld so that the perl executable will find the
7283installed shared $libperl.
7284
7285EOM
7286 ;;
7287 esac
7288 ;;
7289 esac
7290fi
7291# Fix ccdlflags in AIX for building external extensions.
7292# (For building Perl itself bare -bE:perl.exp is needed,
7293# Makefile.SH takes care of this.)
7294case "$osname" in
7295aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7296esac
7297# Respect a hint or command-line value.
7298case "$shrpenv" in
7299'') shrpenv="$tmp_shrpenv" ;;
7300esac
7301case "$ldlibpthname" in
7302'') ldlibpthname=LD_LIBRARY_PATH ;;
7303none) ldlibpthname='' ;;
7304esac
7305
7306: determine where manual pages are on this system
7307echo " "
7308case "$sysman" in
7309'')
7310 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
7311 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
7312 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7313 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7314 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7315 sysman=`./loc . /usr/man/man1 $syspath`
7316 ;;
7317esac
7318if $test -d "$sysman"; then
7319 echo "System manual is in $sysman." >&4
7320else
7321 echo "Could not find manual pages in source form." >&4
7322fi
7323
7324: determine where manual pages go
7325set man1dir man1dir none
7326eval $prefixit
7327$cat <<EOM
7328
7329$spackage has manual pages available in source form.
7330EOM
7331case "$nroff" in
7332nroff)
7333 echo "However, you don't have nroff, so they're probably useless to you."
7334 case "$man1dir" in
7335 '') man1dir="none";;
7336 esac;;
7337esac
7338echo "If you don't want the manual sources installed, answer 'none'."
7339case "$man1dir" in
7340' ') dflt=none
7341 ;;
7342'')
7343 lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
7344 lookpath="$lookpath $prefixexp/man/p_man/man1"
7345 lookpath="$lookpath $prefixexp/man/u_man/man1"
7346 lookpath="$lookpath $prefixexp/man/man.1"
7347 case "$sysman" in
7348 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7349 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7350 esac
7351 set dflt
7352 eval $prefixup
7353 ;;
7354*) dflt="$man1dir"
7355 ;;
7356esac
7357echo " "
7358fn=dn+~
7359rp="Where do the main $spackage manual pages (source) go?"
7360. ./getfile
7361if $test "X$man1direxp" != "X$ansexp"; then
7362 installman1dir=''
7363fi
7364man1dir="$ans"
7365man1direxp="$ansexp"
7366case "$man1dir" in
7367'') man1dir=' '
7368 installman1dir='';;
7369esac
7370
7371: Change installation prefix, if necessary.
7372if $test X"$prefix" != X"$installprefix"; then
7373 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7374else
7375 installman1dir="$man1direxp"
7376fi
7377
7378: What suffix to use on installed man pages
7379
7380case "$man1dir" in
7381' ')
7382 man1ext='0'
7383 ;;
7384*)
7385 rp="What suffix should be used for the main $spackage man pages?"
7386 case "$man1ext" in
7387 '') case "$man1dir" in
7388 *1) dflt=1 ;;
7389 *1p) dflt=1p ;;
7390 *1pm) dflt=1pm ;;
7391 *l) dflt=l;;
7392 *n) dflt=n;;
7393 *o) dflt=o;;
7394 *p) dflt=p;;
7395 *C) dflt=C;;
7396 *L) dflt=L;;
7397 *L1) dflt=L1;;
7398 *) dflt=1;;
7399 esac
7400 ;;
7401 *) dflt="$man1ext";;
7402 esac
7403 . ./myread
7404 man1ext="$ans"
7405 ;;
7406esac
7407
7408: see if we can have long filenames
7409echo " "
7410first=123456789abcdef
7411$rm -f $first
7412if (echo hi >$first) 2>/dev/null; then
7413 if $test -f 123456789abcde; then
7414 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
7415 val="$undef"
7416 else
7417 echo 'You can have filenames longer than 14 characters.'>&4
7418 val="$define"
7419 fi
7420else
7421 $cat <<'EOM'
7422You can't have filenames longer than 14 chars.
7423You can't even think about them!
7424EOM
7425 val="$undef"
7426fi
7427set d_flexfnam
7428eval $setvar
7429$rm -rf 123456789abcde*
7430
7431: determine where library module manual pages go
7432set man3dir man3dir none
7433eval $prefixit
7434$cat <<EOM
7435
7436$spackage has manual pages for many of the library modules.
7437EOM
7438
7439case "$nroff" in
7440nroff)
7441 $cat <<'EOM'
7442However, you don't have nroff, so they're probably useless to you.
7443EOM
7444 case "$man3dir" in
7445 '') man3dir="none";;
7446 esac;;
7447esac
7448
7449case "$d_flexfnam" in
7450undef)
7451 $cat <<'EOM'
7452However, your system can't handle the long file names like File::Basename.3.
7453EOM
7454 case "$man3dir" in
7455 '') man3dir="none";;
7456 esac;;
7457esac
7458
7459echo "If you don't want the manual sources installed, answer 'none'."
7460prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7461case "$man3dir" in
7462'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7463 if $test -d "$privlib/man/man3"; then
7464 cat <<EOM >&4
7465
7466WARNING: Previous versions of perl installed man3 pages into
7467$privlib/man/man3. This version will suggest a
7468new default of $dflt.
7469EOM
7470 tdflt=$dflt
7471 dflt='n'
7472 rp='Do you wish to preserve the old behavior?(y/n)'
7473 . ./myread
7474 case "$ans" in
7475 y*) dflt="$privlib/man/man3" ;;
7476 *) dflt=$tdflt ;;
7477 esac
7478 fi
7479 ;;
7480*) dflt="$man3dir" ;;
7481esac
7482case "$dflt" in
7483' ') dflt=none ;;
7484esac
7485echo " "
7486fn=dn+~
7487rp="Where do the $package library man pages (source) go?"
7488. ./getfile
7489man3dir="$ans"
7490man3direxp="$ansexp"
7491case "$man3dir" in
7492'') man3dir=' '
7493 installman3dir='';;
7494esac
7495
7496: Change installation prefix, if necessary.
7497if $test X"$prefix" != X"$installprefix"; then
7498 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7499else
7500 installman3dir="$man3direxp"
7501fi
7502
7503: What suffix to use on installed man pages
7504case "$man3dir" in
7505' ')
7506 man3ext='0'
7507 ;;
7508*)
7509 rp="What suffix should be used for the $package library man pages?"
7510 case "$man3ext" in
7511 '') case "$man3dir" in
7512 *3) dflt=3 ;;
7513 *3p) dflt=3p ;;
7514 *3pm) dflt=3pm ;;
7515 *l) dflt=l;;
7516 *n) dflt=n;;
7517 *o) dflt=o;;
7518 *p) dflt=p;;
7519 *C) dflt=C;;
7520 *L) dflt=L;;
7521 *L3) dflt=L3;;
7522 *) dflt=3;;
7523 esac
7524 ;;
7525 *) dflt="$man3ext";;
7526 esac
7527 . ./myread
7528 man3ext="$ans"
7529 ;;
7530esac
7531
7532: see if we have to deal with yellow pages, now NIS.
7533if $test -d /usr/etc/yp || $test -d /etc/yp; then
7534 if $test -f /usr/etc/nibindd; then
7535 echo " "
7536 echo "I'm fairly confident you're on a NeXT."
7537 echo " "
7538 rp='Do you get the hosts file via NetInfo?'
7539 dflt=y
7540 case "$hostcat" in
7541 nidump*) ;;
7542 '') ;;
7543 *) dflt=n;;
7544 esac
7545 . ./myread
7546 case "$ans" in
7547 y*) hostcat='nidump hosts .';;
7548 *) case "$hostcat" in
7549 nidump*) hostcat='';;
7550 esac
7551 ;;
7552 esac
7553 fi
7554 case "$hostcat" in
7555 nidump*) ;;
7556 *)
7557 case "$hostcat" in
7558 *ypcat*) dflt=y;;
7559 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7560 dflt=y
7561 else
7562 dflt=n
7563 fi;;
7564 *) dflt=n;;
7565 esac
7566 echo " "
7567 rp='Are you getting the hosts file via yellow pages?'
7568 . ./myread
7569 case "$ans" in
7570 y*) hostcat='ypcat hosts';;
7571 *) hostcat='cat /etc/hosts';;
7572 esac
7573 ;;
7574 esac
7575fi
7576case "$hostcat" in
7577'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7578esac
7579case "$groupcat" in
7580'') test -f /etc/group && groupcat='cat /etc/group';;
7581esac
7582case "$passcat" in
7583'') test -f /etc/passwd && passcat='cat /etc/passwd';;
7584esac
7585
7586: now get the host name
7587echo " "
7588echo "Figuring out host name..." >&4
7589case "$myhostname" in
7590'') cont=true
7591 echo 'Maybe "hostname" will work...'
73614538 7592 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
7593 myhostname=$tans
7594 phostname=hostname
7595 cont=''
7596 fi
7597 ;;
7598*) cont='';;
7599esac
7600if $test "$cont"; then
7601 if ./xenix; then
7602 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
7603 if tans=`cat /etc/systemid 2>&1` ; then
7604 myhostname=$tans
7605 phostname='cat /etc/systemid'
7606 echo "Whadyaknow. Xenix always was a bit strange..."
7607 cont=''
7608 fi
7609 elif $test -r /etc/systemid; then
7610 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7611 fi
7612fi
7613if $test "$cont"; then
7614 echo 'No, maybe "uuname -l" will work...'
73614538 7615 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
7616 myhostname=$tans
7617 phostname='uuname -l'
7618 else
7619 echo 'Strange. Maybe "uname -n" will work...'
73614538 7620 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
7621 myhostname=$tans
7622 phostname='uname -n'
7623 else
7624 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 7625 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
7626 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7627 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7628 else
7629 case "$myhostname" in
7630 '') echo "Does this machine have an identity crisis or something?"
7631 phostname='';;
7632 *)
7633 echo "Well, you said $myhostname before..."
7634 phostname='echo $myhostname';;
7635 esac
7636 fi
7637 fi
7638 fi
7639fi
7640: you do not want to know about this
7641set $myhostname
7642myhostname=$1
7643
7644: verify guess
7645if $test "$myhostname" ; then
7646 dflt=y
7647 rp='Your host name appears to be "'$myhostname'".'" Right?"
7648 . ./myread
7649 case "$ans" in
7650 y*) ;;
7651 *) myhostname='';;
7652 esac
7653fi
7654
7655: bad guess or no guess
7656while $test "X$myhostname" = X ; do
7657 dflt=''
7658 rp="Please type the (one word) name of your host:"
7659 . ./myread
7660 myhostname="$ans"
7661done
7662
7663: translate upper to lower if necessary
7664case "$myhostname" in
7665*[A-Z]*)
7666 echo "(Normalizing case in your host name)"
7667 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7668 ;;
7669esac
7670
7671case "$myhostname" in
7672*.*)
7673 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7674 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7675 echo "(Trimming domain name from host name--host name is now $myhostname)"
7676 ;;
7677*) case "$mydomain" in
7678 '')
7679 {
7680 test "X$hostcat" = "Xypcat hosts" &&
7681 ypmatch "$myhostname" hosts 2>/dev/null |\
7682 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
7683 $test -s hosts
7684 } || {
7685 test "X$hostcat" != "X" &&
7686 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
7687 /[ ]$myhostname[ . ]/p" > hosts
7688 }
7689 tmp_re="[ . ]"
f08cbdd1
PP
7690 if $test -f hosts; then
7691 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 7692 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
7693 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7694 hosts | $sort | $uniq | \
7695 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7696 case `$echo X$dflt` in
7697 X*\ *) echo "(Several hosts in the database matched hostname)"
7698 dflt=.
7699 ;;
7700 X.) echo "(You do not have fully-qualified names in the hosts database)"
7701 ;;
7702 esac
7703 else
7704 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 7705 dflt=.
f08cbdd1 7706 fi
b4eb6b3d
JH
7707 case "$dflt" in
7708 .)
7709 tans=`./loc resolv.conf X /etc /usr/etc`
7710 if $test -f "$tans"; then
7711 echo "(Attempting domain name extraction from $tans)"
7712 dflt=.`$sed -n -e 's/ / /g' \
7713 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
7714 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7715 case "$dflt" in
7716 .) dflt=.`$sed -n -e 's/ / /g' \
7717 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
7718 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7719 ;;
7720 esac
7721 fi
7722 ;;
7723 esac
7724 case "$dflt" in
7725 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 7726 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
7727 case "$dflt" in
7728 '') dflt='.';;
7729 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7730 esac
7731 ;;
7732 esac
59c9e5d6
PP
7733 case "$dflt$osname" in
7734 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 7735 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
7736 ;;
7737 esac
b4eb6b3d
JH
7738 case "$dflt" in
7739 .) echo "(Lost all hope -- silly guess then)"
7740 dflt='.uucp'
7741 ;;
7742 esac
7743 $rm -f hosts
7744 ;;
7745 *) dflt="$mydomain";;
7746 esac;;
7747esac
7748echo " "
7749rp="What is your domain name?"
7750. ./myread
7751tans="$ans"
7752case "$ans" in
7753'') ;;
7754.*) ;;
7755*) tans=".$tans";;
7756esac
7757mydomain="$tans"
7758
7759: translate upper to lower if necessary
7760case "$mydomain" in
7761*[A-Z]*)
7762 echo "(Normalizing case in your domain name)"
7763 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7764 ;;
7765esac
7766
7767: a little sanity check here
7768case "$phostname" in
7769'') ;;
7770*)
7771 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7772 $myhostname$mydomain|$myhostname) ;;
7773 *)
7774 case "$phostname" in
7775 sed*)
7776 echo "(That doesn't agree with your whoami.h file, by the way.)"
7777 ;;
7778 *)
7779 echo "(That doesn't agree with your $phostname command, by the way.)"
7780 ;;
7781 esac
7782 ;;
7783 esac
7784 ;;
7785esac
7786
7787$cat <<EOM
7788
7789I need to get your e-mail address in Internet format if possible, i.e.
7790something like user@host.domain. Please answer accurately since I have
7791no easy means to double check it. The default value provided below
7792is most probably close to reality but may not be valid from outside
7793your organization...
7794
7795EOM
7796cont=x
7797while test "$cont"; do
7798 case "$cf_email" in
7799 '') dflt="$cf_by@$myhostname$mydomain";;
7800 *) dflt="$cf_email";;
7801 esac
7802 rp='What is your e-mail address?'
7803 . ./myread
7804 cf_email="$ans"
7805 case "$cf_email" in
7806 *@*.*) cont='' ;;
7807 *)
7808 rp='Address does not look like an Internet one. Use it anyway?'
7809 case "$fastread" in
7810 yes) dflt=y ;;
7811 *) dflt=n ;;
7812 esac
7813 . ./myread
7814 case "$ans" in
7815 y*) cont='' ;;
7816 *) echo " " ;;
7817 esac
7818 ;;
7819 esac
7820done
7821
7822$cat <<EOM
7823
7824If you or somebody else will be maintaining perl at your site, please
7825fill in the correct e-mail address here so that they may be contacted
7826if necessary. Currently, the "perlbug" program included with perl
7827will send mail to this address in addition to perlbug@perl.org. You may
7828enter "none" for no administrator.
7829
7830EOM
7831case "$perladmin" in
7832'') dflt="$cf_email";;
7833*) dflt="$perladmin";;
7834esac
7835rp='Perl administrator e-mail address'
7836. ./myread
7837perladmin="$ans"
7838
674912d7
RB
7839: determine whether to only install version-specific parts.
7840echo " "
7841$cat <<EOM
7842Do you want to install only the version-specific parts of the perl
7843distribution? Usually you do *not* want to do this.
7844EOM
7845case "$versiononly" in
7846"$define"|[Yy]*|true) dflt='y' ;;
7847*) dflt='n';
7848esac
7849rp="Do you want to install only the version-specific parts of perl?"
7850. ./myread
7851case "$ans" in
7852[yY]*) val="$define";;
7853*) val="$undef" ;;
7854esac
7855set versiononly
7856eval $setvar
7857
b4eb6b3d
JH
7858: figure out how to guarantee perl startup
7859case "$startperl" in
7860'')
7861 case "$sharpbang" in
7862 *!)
7863 $cat <<EOH
7864
7865I can use the #! construct to start perl on your system. This will
7866make startup of perl scripts faster, but may cause problems if you
7867want to share those scripts and perl is not in a standard place
7868($binexp/perl) on all your platforms. The alternative is to force
7869a shell by starting the script with a single ':' character.
7870
7871EOH
674912d7
RB
7872 case "$versiononly" in
7873 "$define") dflt="$binexp/perl$version";;
7874 *) dflt="$binexp/perl";;
7875 esac
b4eb6b3d
JH
7876 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7877 . ./myread
7878 case "$ans" in
7879 none) startperl=": # use perl";;
7880 *) startperl="#!$ans"
7881 if $test 30 -lt `echo "$ans" | wc -c`; then
7882 $cat >&4 <<EOM
7883
7884WARNING: Some systems limit the #! command to 32 characters.
7885If you experience difficulty running Perl scripts with #!, try
7886installing Perl in a directory with a shorter pathname.
7887
7888EOM
7889 fi ;;
7890 esac
7891 ;;
7892 *) startperl=": # use perl"
7893 ;;
7894 esac
7895 ;;
7896esac
7897echo "I'll use $startperl to start perl scripts."
7898
7899: figure best path for perl in scripts
7900case "$perlpath" in
7901'')
7902 perlpath="$binexp/perl"
7903 case "$startperl" in
7904 *!*) ;;
7905 *)
7906 $cat <<EOH
7907
7908I will use the "eval 'exec'" idiom to start Perl on your system.
7909I can use the full path of your Perl binary for this purpose, but
7910doing so may cause problems if you want to share those scripts and
7911Perl is not always in a standard place ($binexp/perl).
7912
7913EOH
7914 dflt="$binexp/perl"
7915 rp="What path shall I use in \"eval 'exec'\"?"
7916 . ./myread
7917 perlpath="$ans"
7918 ;;
7919 esac
7920 ;;
7921esac
7922case "$startperl" in
7923*!*) ;;
7924*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7925esac
7926
7927: determine where public executable scripts go
7928set scriptdir scriptdir
7929eval $prefixit
7930case "$scriptdir" in
7931'')
7932 dflt="$bin"
7933 : guess some guesses
7934 $test -d /usr/share/scripts && dflt=/usr/share/scripts
7935 $test -d /usr/share/bin && dflt=/usr/share/bin
7936 $test -d /usr/local/script && dflt=/usr/local/script
7937 $test -d /usr/local/scripts && dflt=/usr/local/scripts
7938 $test -d $prefixexp/script && dflt=$prefixexp/script
7939 set dflt
7940 eval $prefixup
7941 ;;
7942*) dflt="$scriptdir"
7943 ;;
7944esac
7945$cat <<EOM
7946
7947Some installations have a separate directory just for executable scripts so
7948that they can mount it across multiple architectures but keep the scripts in
7949one spot. You might, for example, have a subdirectory of /usr/share for this.
7950Or you might just lump your scripts in with all your other executables.
7951
7952EOM
7953fn=d~
7954rp='Where do you keep publicly executable scripts?'
7955. ./getfile
7956if $test "X$ansexp" != "X$scriptdirexp"; then
7957 installscript=''
7958fi
7959scriptdir="$ans"
7960scriptdirexp="$ansexp"
7961: Change installation prefix, if necessary.
7962if $test X"$prefix" != X"$installprefix"; then
7963 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7964else
7965 installscript="$scriptdirexp"
7966fi
7967
7968: determine where add-on public executables go
7969case "$sitebin" in
7970'') dflt=$siteprefix/bin ;;
7971*) dflt=$sitebin ;;
7972esac
7973fn=d~
7974rp='Pathname where the add-on public executables should be installed?'
7975. ./getfile
7976sitebin="$ans"
7977sitebinexp="$ansexp"
7978: Change installation prefix, if necessary.
7979if $test X"$prefix" != X"$installprefix"; then
7980 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7981else
7982 installsitebin="$sitebinexp"
7983fi
7984
b4eb6b3d
JH
7985case "$vendorprefix" in
7986'') d_vendorbin="$undef"
7987 vendorbin=''
7988 vendorbinexp=''
7989 ;;
7990*) d_vendorbin="$define"
7991 : determine where vendor-supplied executables go.
7992 case "$vendorbin" in
7993 '') dflt=$vendorprefix/bin ;;
7994 *) dflt="$vendorbin" ;;
7995 esac
7996 fn=d~+
7997 rp='Pathname for the vendor-supplied executables directory?'
7998 . ./getfile
7999 vendorbin="$ans"
8000 vendorbinexp="$ansexp"
8001 ;;
8002esac
8003: Change installation prefix, if necessary.
8004if $test X"$prefix" != X"$installprefix"; then
8005 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8006else
8007 installvendorbin="$vendorbinexp"
8008fi
8009
8010: see if qgcvt exists
8011set qgcvt d_qgcvt
8012eval $inlibc
8013
8014echo " "
8015
8016if $test X"$d_longdbl" = X"$define"; then
8017
8018echo "Checking how to print long doubles..." >&4
8019
8020if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
8021 $cat >try.c <<'EOCP'
8022#include <sys/types.h>
8023#include <stdio.h>
8024int main() {
8025 double d = 123.456;
8026 printf("%.3f\n", d);
8027}
8028EOCP
8029 set try
8030 if eval $compile; then
8031 yyy=`./try$exe_ext`
8032 case "$yyy" in
8033 123.456)
8034 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
8035 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
8036 echo "We will use %f."
8037 ;;
8038 esac
8039 fi
8040fi
8041
8042if $test X"$sPRIfldbl" = X; then
8043 $cat >try.c <<'EOCP'
8044#include <sys/types.h>
8045#include <stdio.h>
8046int main() {
8047 long double d = 123.456;
2ef53570 8048 printf("%.3Lf\n", d);
b4eb6b3d
JH
8049}
8050EOCP
8051 set try
8052 if eval $compile; then
8053 yyy=`./try$exe_ext`
8054 case "$yyy" in
8055 123.456)
2ef53570
JH
8056 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8057 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8058 echo "We will use %Lf."
b4eb6b3d
JH
8059 ;;
8060 esac
8061 fi
8062fi
8063
8064if $test X"$sPRIfldbl" = X; then
8065 $cat >try.c <<'EOCP'
8066#include <sys/types.h>
8067#include <stdio.h>
8068int main() {
8069 long double d = 123.456;
2ef53570 8070 printf("%.3llf\n", d);
b4eb6b3d
JH
8071}
8072EOCP
8073 set try
8074 if eval $compile; then
8075 yyy=`./try$exe_ext`
8076 case "$yyy" in
8077 123.456)
2ef53570
JH
8078 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8079 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8080 echo "We will use %llf."
b4eb6b3d
JH
8081 ;;
8082 esac
8083 fi
8084fi
8085
8086if $test X"$sPRIfldbl" = X; then
8087 $cat >try.c <<'EOCP'
8088#include <sys/types.h>
8089#include <stdio.h>
8090int main() {
8091 long double d = 123.456;
8092 printf("%.3lf\n", d);
8093}
8094EOCP
8095 set try
8096 if eval $compile; then
8097 yyy=`./try$exe_ext`
8098 case "$yyy" in
8099 123.456)
8100 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8101 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8102 echo "We will use %lf."
8103 ;;
8104 esac
8105 fi
8106fi
8107
8108if $test X"$sPRIfldbl" = X; then
8109 echo "Cannot figure out how to print long doubles." >&4
8110else
8111 sSCNfldbl=$sPRIfldbl # expect consistency
8112fi
8113
8114$rm -f try try.*
8115
8116fi # d_longdbl
8117
8118case "$sPRIfldbl" in
8119'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
8120 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
8121 d_SCNfldbl="$undef";
8122 ;;
8123*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
8124 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
8125 d_SCNfldbl="$define";
8126 ;;
8127esac
8128
8129: Check how to convert floats to strings.
8130echo " "
8131echo "Checking for an efficient way to convert floats to strings."
8132echo " " > try.c
8133case "$uselongdouble" in
8134"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8135esac
8136case "$d_longdbl" in
8137"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8138esac
8139case "$d_PRIgldbl" in
8140"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
8141esac
8142$cat >>try.c <<EOP
8143#ifdef TRY_gconvert
8144#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8145char *myname = "gconvert";
8146#endif
8147#ifdef TRY_gcvt
8148#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8149char *myname = "gcvt";
8150#endif
8151#ifdef TRY_qgcvt
8152#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8153char *myname = "qgcvt";
8154#define DOUBLETYPE long double
8155#endif
8156#ifdef TRY_sprintf
8157#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8158#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8159#else
8160#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8161#endif
8162char *myname = "sprintf";
8163#endif
8164
8165#ifndef DOUBLETYPE
8166#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8167#define DOUBLETYPE long double
8168#else
8169#define DOUBLETYPE double
8170#endif
8171#endif
8172
8173#include <stdio.h>
8174
8175#define I_STDLIB $i_stdlib
8176#ifdef I_STDLIB
8177#include <stdlib.h>
8178#endif
8179
8180int
8181checkit(expect, got)
8182char *expect;
8183char *got;
8184{
8185 if (strcmp(expect, got)) {
8186 printf("%s oddity: Expected %s, got %s\n",
8187 myname, expect, got);
8188 exit(1);
8189 }
8190}
8191
8192int main()
8193{
8194 char buf[64];
8195 buf[63] = '\0';
8196
8197 /* This must be 1st test on (which?) platform */
8198 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8199 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8200 checkit("0.1", buf);
8201
8202 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
8203 checkit("1", buf);
8204
8205 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
8206 checkit("1.1", buf);
8207
8208 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
8209 checkit("1.01", buf);
8210
8211 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
8212 checkit("1.001", buf);
8213
8214 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
8215 checkit("1.0001", buf);
8216
8217 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
8218 checkit("1.00001", buf);
8219
8220 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
8221 checkit("1.000001", buf);
8222
8223 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
8224 checkit("0", buf);
8225
8226 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
8227 checkit("-1", buf);
8228
8229 /* Some Linux gcvt's give 1.e+5 here. */
8230 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
8231 checkit("100000", buf);
8232
8233 /* Some Linux gcvt's give -1.e+5 here. */
8234 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
8235 checkit("-100000", buf);
8236
8237 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
8238 checkit("123.456", buf);
8239
8240 exit(0);
8241}
8242EOP
8243case "$d_Gconvert" in
8244gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8245gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8246sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8247*) xxx_list='gconvert gcvt sprintf' ;;
8248esac
8249
8250case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8251"$define$define$define")
8252 # for long doubles prefer first qgcvt, then sprintf
8253 xxx_list="`echo $xxx_list|sed s/sprintf//`"
8254 xxx_list="sprintf $xxx_list"
8255 case "$d_qgcvt" in
8256 "$define") xxx_list="qgcvt $xxx_list" ;;
8257 esac
8258 ;;
8259esac
8260
8261for xxx_convert in $xxx_list; do
8262 echo "Trying $xxx_convert..."
8263 $rm -f try try$_o
8264 set try -DTRY_$xxx_convert
8265 if eval $compile; then
8266 echo "$xxx_convert() found." >&4
8267 if ./try; then
8268 echo "I'll use $xxx_convert to convert floats into a string." >&4
8269 break;
8270 else
8271 echo "...But $xxx_convert didn't work as I expected."
8272 fi
8273 else
8274 echo "$xxx_convert NOT found." >&4
8275 fi
8276done
8277
8278case "$xxx_convert" in
8279gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8280gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8281qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8282*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8283 "$define$define$define")
8284 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8285 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8286 esac
8287 ;;
8288esac
8289
74cac757
JH
8290: see if _fwalk exists
8291set fwalk d__fwalk
8292eval $inlibc
8293
b4eb6b3d
JH
8294: Initialize h_fcntl
8295h_fcntl=false
8296
8297: Initialize h_sysfile
8298h_sysfile=false
8299
8300: access call always available on UNIX
8301set access d_access
8302eval $inlibc
8303
8304: locate the flags for 'access()'
8305case "$d_access" in
8306"$define")
8307 echo " "
8308 $cat >access.c <<'EOCP'
8309#include <sys/types.h>
8310#ifdef I_FCNTL
8311#include <fcntl.h>
8312#endif
8313#ifdef I_SYS_FILE
8314#include <sys/file.h>
8315#endif
8316#ifdef I_UNISTD
8317#include <unistd.h>
8318#endif
8319int main() {
8320 exit(R_OK);
8321}
8322EOCP
8323 : check sys/file.h first, no particular reason here
8324 if $test `./findhdr sys/file.h` && \
7a282f6d 8325 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
8326 h_sysfile=true;
8327 echo "<sys/file.h> defines the *_OK access constants." >&4
8328 elif $test `./findhdr fcntl.h` && \
7a282f6d 8329 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
8330 h_fcntl=true;
8331 echo "<fcntl.h> defines the *_OK access constants." >&4
8332 elif $test `./findhdr unistd.h` && \
7a282f6d 8333 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
8334 echo "<unistd.h> defines the *_OK access constants." >&4
8335 else
8336 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8337 fi
8338 ;;
8339esac
8340$rm -f access*
8341
8342: see if accessx exists
8343set accessx d_accessx
8344eval $inlibc
8345
8346: see if alarm exists
8347set alarm d_alarm
8348eval $inlibc
8349
8350: see if atolf exists
8351set atolf d_atolf
8352eval $inlibc
8353
8354: see if atoll exists
8355set atoll d_atoll
8356eval $inlibc
8357
8358: Look for GNU-cc style attribute checking
8359echo " "
8360echo "Checking whether your compiler can handle __attribute__ ..." >&4
8361$cat >attrib.c <<'EOCP'
8362#include <stdio.h>
8363void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8364EOCP
8365if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8366 if $contains 'warning' attrib.out >/dev/null 2>&1; then
8367 echo "Your C compiler doesn't fully support __attribute__."
8368 val="$undef"
8369 else
8370 echo "Your C compiler supports __attribute__."
8371 val="$define"
8372 fi
8373else
8374 echo "Your C compiler doesn't seem to understand __attribute__ at all."
8375 val="$undef"
8376fi
8377set d_attribut
8378eval $setvar
8379$rm -f attrib*
8380
8381: see if bcmp exists
8382set bcmp d_bcmp
8383eval $inlibc
8384
8385: see if bcopy exists
8386set bcopy d_bcopy
8387eval $inlibc
8388
8389: see if this is a unistd.h system
8390set unistd.h i_unistd
8391eval $inhdr
8392
8393: see if getpgrp exists
8394set getpgrp d_getpgrp
8395eval $inlibc
8396
8397case "$d_getpgrp" in
8398"$define")
8399 echo " "
8400 echo "Checking to see which flavor of getpgrp is in use..."
8401 $cat >set.c <<EOP
8402#$i_unistd I_UNISTD
8403#include <sys/types.h>
8404#ifdef I_UNISTD
8405# include <unistd.h>
8406#endif
8407int main()
8408{
8409 if (getuid() == 0) {
8410 printf("(I see you are running Configure as super-user...)\n");
8411 setuid(1);
8412 }
8413#ifdef TRY_BSD_PGRP
8414 if (getpgrp(1) == 0)
8415 exit(0);
8416#else
8417 if (getpgrp() > 0)
8418 exit(0);
8419#endif
8420 exit(1);
8421}
8422EOP
7a282f6d 8423 if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
8424 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8425 val="$define"
7a282f6d 8426 elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
8427 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8428 val="$undef"
8429 else
8430 echo "I can't seem to compile and run the test program."
8431 if ./usg; then
8432 xxx="a USG one, i.e. you use getpgrp()."
8433 else
8434 # SVR4 systems can appear rather BSD-ish.
8435 case "$i_unistd" in
8436 $undef)
8437 xxx="a BSD one, i.e. you use getpgrp(pid)."
8438 val="$define"
8439 ;;
8440 $define)
8441 xxx="probably a USG one, i.e. you use getpgrp()."
8442 val="$undef"
8443 ;;
8444 esac
8445 fi
8446 echo "Assuming your getpgrp is $xxx" >&4
8447 fi
8448 ;;
8449*) val="$undef";;
8450esac
8451set d_bsdgetpgrp
8452eval $setvar
8453$rm -f set set.c
8454
8455: see if setpgrp exists
8456set setpgrp d_setpgrp
8457eval $inlibc
8458
8459case "$d_setpgrp" in
8460"$define")
8461 echo " "
8462 echo "Checking to see which flavor of setpgrp is in use..."
8463 $cat >set.c <<EOP
8464#$i_unistd I_UNISTD
8465#include <sys/types.h>
8466#ifdef I_UNISTD
8467# include <unistd.h>
8468#endif
8469int main()
8470{
8471 if (getuid() == 0) {
8472 printf("(I see you are running Configure as super-user...)\n");
8473 setuid(1);
8474 }
8475#ifdef TRY_BSD_PGRP
8476 if (-1 == setpgrp(1, 1))
8477 exit(0);
8478#else
8479 if (setpgrp() != -1)
8480 exit(0);
8481#endif
8482 exit(1);
8483}
8484EOP
7a282f6d 8485 if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
8486 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8487 val="$define"
7a282f6d 8488 elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
8489 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8490 val="$undef"
8491 else
8492 echo "(I can't seem to compile and run the test program.)"
8493 if ./usg; then
8494 xxx="a USG one, i.e. you use setpgrp()."
8495 else
8496 # SVR4 systems can appear rather BSD-ish.
8497 case "$i_unistd" in
8498 $undef)
8499 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8500 val="$define"
8501 ;;
8502 $define)
8503 xxx="probably a USG one, i.e. you use setpgrp()."
8504 val="$undef"
8505 ;;
8506 esac
8507 fi
8508 echo "Assuming your setpgrp is $xxx" >&4
8509 fi
8510 ;;
8511*) val="$undef";;
8512esac
8513set d_bsdsetpgrp
8514eval $setvar
8515$rm -f set set.c
8516: see if bzero exists
8517set bzero d_bzero
8518eval $inlibc
8519
8520: see if signal is declared as pointer to function returning int or void
8521echo " "
8522xxx=`./findhdr signal.h`
8523$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8524if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
8525 echo "You have int (*signal())() instead of void." >&4
8526 val="$undef"
8527elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
8528 echo "You have void (*signal())()." >&4
8529 val="$define"
8530elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8531 echo "You have int (*signal())() instead of void." >&4
8532 val="$undef"
8533elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8534 echo "You have void (*signal())()." >&4
8535 val="$define"
8536else
8537 case "$d_voidsig" in
8538 '')
8539 echo "I can't determine whether signal handler returns void or int..." >&4
8540 dflt=void
8541 rp="What type does your signal handler return?"
8542 . ./myread
8543 case "$ans" in
8544 v*) val="$define";;
8545 *) val="$undef";;
8546 esac;;
8547 "$define")
8548 echo "As you already told me, signal handler returns void." >&4
8549 val="$define"
8550 ;;
8551 *) echo "As you already told me, signal handler returns int." >&4
8552 val="$undef"
8553 ;;
8554 esac
8555fi
8556set d_voidsig
8557eval $setvar
8558case "$d_voidsig" in
8559"$define") signal_t="void";;
8560*) signal_t="int";;
8561esac
8562$rm -f $$.tmp
8563
8564: check for ability to cast large floats to 32-bit ints.
8565echo " "
8566echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8567if $test "$intsize" -ge 4; then
8568 xxx=int
8569else
8570 xxx=long
8571fi
8572$cat >try.c <<EOCP
8573#include <stdio.h>
8574#include <sys/types.h>
8575#include <signal.h>
8576$signal_t blech(s) int s; { exit(3); }
8577int main()
8578{
8579 $xxx i32;
8580 double f, g;
8581 int result = 0;
8582 char str[16];
8583 signal(SIGFPE, blech);
8584
8585 /* Don't let compiler optimize the test away. Store the number
8586 in a writable string for gcc to pass to sscanf under HP/UX.
8587 */
8588 sprintf(str, "2147483647");
8589 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8590 g = 10 * f;
8591 i32 = ($xxx) g;
8592
8593 /* x86 processors will probably give 0x8000 0000, which is a
8594 sign change. We don't want that. We want to mimic SPARC
8595 behavior here, which is to preserve the sign and give
8596 back 0x7fff ffff.
8597 */
8598 if (i32 != ($xxx) f)
8599 result |= 1;
8600 exit(result);
8601}
8602EOCP
8603set try
8604if eval $compile_ok; then
8605 ./try
8606 yyy=$?
8607else
8608 echo "(I can't seem to compile the test program--assuming it can't)"
8609 yyy=1
8610fi
8611case "$yyy" in
86120) val="$define"
8613 echo "Yup, it can."
8614 ;;
8615*) val="$undef"
8616 echo "Nope, it can't."
8617 ;;
8618esac
8619set d_casti32
8620eval $setvar
8621$rm -f try try.*
8622
8623: check for ability to cast negative floats to unsigned
8624echo " "
8625echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8626$cat >try.c <<EOCP
8627#include <stdio.h>
8628#include <sys/types.h>
8629#include <signal.h>
8630$signal_t blech(s) int s; { exit(7); }
8631$signal_t blech_in_list(s) int s; { exit(4); }
8632unsigned long dummy_long(p) unsigned long p; { return p; }
8633unsigned int dummy_int(p) unsigned int p; { return p; }
8634unsigned short dummy_short(p) unsigned short p; { return p; }
8635int main()
8636{
8637 double f;
8638 unsigned long along;
8639 unsigned int aint;
8640 unsigned short ashort;
8641 int result = 0;
8642 char str[16];
8643
8644 /* Frustrate gcc-2.7.2's optimizer which failed this test with
8645 a direct f = -123. assignment. gcc-2.8.0 reportedly
8646 optimized the whole file away
8647 */
8648 /* Store the number in a writable string for gcc to pass to
8649 sscanf under HP/UX.
8650 */
8651 sprintf(str, "-123");
8652 sscanf(str, "%lf", &f); /* f = -123.; */
8653
8654 signal(SIGFPE, blech);
8655 along = (unsigned long)f;
8656 aint = (unsigned int)f;
8657 ashort = (unsigned short)f;
8658 if (along != (unsigned long)-123)
8659 result |= 1;
8660 if (aint != (unsigned int)-123)
8661 result |= 1;
8662 if (ashort != (unsigned short)-123)
8663 result |= 1;
8664 sprintf(str, "1073741824.");
8665 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8666 f = f + f;
8667 along = 0;
8668 along = (unsigned long)f;
8669 if (along != 0x80000000)
8670 result |= 2;
8671 f -= 1.;
8672 along = 0;
8673 along = (unsigned long)f;
8674 if (along != 0x7fffffff)
8675 result |= 1;
8676 f += 2.;
8677 along = 0;
8678 along = (unsigned long)f;
8679 if (along != 0x80000001)
8680 result |= 2;
8681 if (result)
8682 exit(result);
8683 signal(SIGFPE, blech_in_list);
8684 sprintf(str, "123.");
8685 sscanf(str, "%lf", &f); /* f = 123.; */
8686 along = dummy_long((unsigned long)f);
8687 aint = dummy_int((unsigned int)f);
8688 ashort = dummy_short((unsigned short)f);
8689 if (along != (unsigned long)123)
8690 result |= 4;
8691 if (aint != (unsigned int)123)
8692 result |= 4;
8693 if (ashort != (unsigned short)123)
8694 result |= 4;
8695 exit(result);
8696
8697}
8698EOCP
8699set try
8700if eval $compile_ok; then
8701 ./try
8702 castflags=$?
8703else
8704 echo "(I can't seem to compile the test program--assuming it can't)"
8705 castflags=7
8706fi
8707case "$castflags" in
87080) val="$define"
8709 echo "Yup, it can."
8710 ;;
8711*) val="$undef"
8712 echo "Nope, it can't."
8713 ;;
8714esac
8715set d_castneg
8716eval $setvar
8717$rm -f try.*
8718
8719: see if vprintf exists
8720echo " "
8721if set vprintf val -f d_vprintf; eval $csym; $val; then
8722 echo 'vprintf() found.' >&4
8723 val="$define"
8724 $cat >vprintf.c <<'EOF'
8725#include <varargs.h>
8726
8727int main() { xxx("foo"); }
8728
8729xxx(va_alist)
8730va_dcl
8731{
8732 va_list args;
8733 char buf[10];
8734
8735 va_start(args);
8736 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8737}
8738EOF
8739 set vprintf
8740 if eval $compile && ./vprintf; then
8741 echo "Your vsprintf() returns (int)." >&4
8742 val2="$undef"
8743 else
8744 echo "Your vsprintf() returns (char*)." >&4
8745 val2="$define"
8746 fi
8747else
8748 echo 'vprintf() NOT found.' >&4
8749 val="$undef"
8750 val2="$undef"
8751fi
8752set d_vprintf
8753eval $setvar
8754val=$val2
8755set d_charvspr
8756eval $setvar
8757
8758: see if chown exists
8759set chown d_chown
8760eval $inlibc
8761
8762: see if chroot exists
8763set chroot d_chroot
8764eval $inlibc
8765
8766: see if chsize exists
8767set chsize d_chsize
8768eval $inlibc
8769
4e0554ec
JH
8770hasstruct='varname=$1; struct=$2; shift; shift;
8771while $test $# -ge 2; do
8772 case "$1" in
8773 $define) echo "#include <$2>";;
8774 esac ;
8775 shift 2;
8776done > try.c;
8777echo "int main () { struct $struct foo; }" >> try.c;
8778set try;
8779if eval $compile; then
8780 val="$define";
8781else
8782 val="$undef";
8783fi;
8784set $varname;
8785eval $setvar;
8786$rm -f try.c try.o'
8787
8788: see if sys/types.h has to be included
8789set sys/types.h i_systypes
8790eval $inhdr
8791
8792hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8793while $test $# -ge 2; do
8794 case "$1" in
8795 $define) echo "#include <$2>";;
8796 esac ;
8797 shift 2;
8798done > try.c;
8799echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8800set try;
8801if eval $compile; then
8802 val="$define";
8803else
8804 val="$undef";
8805fi;
8806set $varname;
8807eval $setvar;
8808$rm -f try.c try.o'
8809
8810socketlib=''
8811sockethdr=''
8812: see whether socket exists
8813echo " "
8814$echo $n "Hmm... $c" >&4
8815if set socket val -f d_socket; eval $csym; $val; then
8816 echo "Looks like you have Berkeley networking support." >&4
8817 d_socket="$define"
8818 if set setsockopt val -f; eval $csym; $val; then
8819 d_oldsock="$undef"
8820 else
8821 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8822 d_oldsock="$define"
8823 fi
8824else
8825 if $contains socklib libc.list >/dev/null 2>&1; then
8826 echo "Looks like you have Berkeley networking support." >&4
8827 d_socket="$define"
8828 : we will have to assume that it supports the 4.2 BSD interface
8829 d_oldsock="$undef"
8830 else
8831 echo "You don't have Berkeley networking in libc$_a..." >&4
8832 if test "X$d_socket" = "X$define"; then
8833 echo "...but you seem to believe that you have sockets." >&4
8834 else
8835 for net in net socket
8836 do
8837 if test -f /usr/lib/lib$net$_a; then
8838 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
8839 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8840 if $contains socket libc.list >/dev/null 2>&1; then
8841 d_socket="$define"
8842 socketlib="-l$net"
8843 case "$net" in
8844 net)
8845 echo "...but the Wollongong group seems to have hacked it in." >&4
8846 sockethdr="-I/usr/netinclude"
8847 ;;
8848 esac
8849 echo "Found Berkeley sockets interface in lib$net." >& 4
8850 if $contains setsockopt libc.list >/dev/null 2>&1; then
8851 d_oldsock="$undef"
8852 else
8853 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8854 d_oldsock="$define"
8855 fi
8856 break
8857 fi
8858 fi
8859 done
8860 if test "X$d_socket" != "X$define"; then
8861 echo "or anywhere else I see." >&4
8862 d_socket="$undef"
8863 d_oldsock="$undef"
8864 fi
8865 fi
8866 fi
8867fi
8868
8869: see if socketpair exists
8870set socketpair d_sockpair
8871eval $inlibc
8872
8873
8874echo " "
8875echo "Checking the availability of certain socket constants..." >& 4
8876for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8877 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8878 $cat >try.c <<EOF
8879#include <sys/types.h>
8880#include <sys/socket.h>
8881int main() {
8882 int i = $ENUM;
8883}
8884EOF
8885 val="$undef"
8886 set try; if eval $compile; then
8887 val="$define"
8888 fi
8889 set d_${enum}; eval $setvar
8890 $rm -f try.c try
8891done
8892
8893: see if this is a sys/uio.h system
8894set sys/uio.h i_sysuio
8895eval $inhdr
8896
8897
8898echo " "
8899echo "Checking to see if your system supports struct cmsghdr..." >&4
8900set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
8901eval $hasstruct
8902case "$d_cmsghdr_s" in
8903"$define") echo "Yes, it does." ;;
8904*) echo "No, it doesn't." ;;
8905esac
8906
8907
b4eb6b3d
JH
8908: check for const keyword
8909echo " "
8910echo 'Checking to see if your C compiler knows about "const"...' >&4
8911$cat >const.c <<'EOCP'
8912typedef struct spug { int drokk; } spug;
8913int main()
8914{
8915 const char *foo;
8916 const spug y;
8917}
8918EOCP
8919if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8920 val="$define"
8921 echo "Yup, it does."
8922else
8923 val="$undef"
8924 echo "Nope, it doesn't."
8925fi
8926set d_const
8927eval $setvar
8928
8929: see if crypt exists
8930echo " "
8931if set crypt val -f d_crypt; eval $csym; $val; then
8932 echo 'crypt() found.' >&4
8933 val="$define"
8934 cryptlib=''
8935else
8936 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8937 if $test -z "$cryptlib"; then
8938 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8939 else
8940 cryptlib=-lcrypt
8941 fi
8942 if $test -z "$cryptlib"; then
8943 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8944 else
8945 cryptlib=-lcrypt
8946 fi
8947 if $test -z "$cryptlib"; then
8948 cryptlib=`./loc libcrypt$_a "" $libpth`
8949 else
8950 cryptlib=-lcrypt
8951 fi
8952 if $test -z "$cryptlib"; then
8953 echo 'crypt() NOT found.' >&4
8954 val="$undef"
8955 else
8956 val="$define"
8957 fi
8958fi
8959set d_crypt
8960eval $setvar
8961
8962: get csh whereabouts
8963case "$csh" in
8964'csh') val="$undef" ;;
8965*) val="$define" ;;
8966esac
8967set d_csh
8968eval $setvar
8969: Respect a hint or command line value for full_csh.
8970case "$full_csh" in
8971'') full_csh=$csh ;;
8972esac
8973
8974: see if cuserid exists
8975set cuserid d_cuserid
8976eval $inlibc
8977
8978: see if this is a limits.h system
8979set limits.h i_limits
8980eval $inhdr
8981
8982: see if this is a float.h system
8983set float.h i_float
8984eval $inhdr
8985
8986: See if number of significant digits in a double precision number is known
8987echo " "
8988$cat >dbl_dig.c <<EOM
8989#$i_limits I_LIMITS
8990#$i_float I_FLOAT
8991#ifdef I_LIMITS
8992#include <limits.h>
8993#endif
8994#ifdef I_FLOAT
8995#include <float.h>
8996#endif
8997#ifdef DBL_DIG
8998printf("Contains DBL_DIG");
8999#endif
9000EOM
9001$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
9002if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
9003 echo "DBL_DIG found." >&4
9004 val="$define"
9005else
9006 echo "DBL_DIG NOT found." >&4
9007 val="$undef"
9008fi
9009$rm -f dbl_dig.?
9010set d_dbl_dig
9011eval $setvar
9012
2ef53570
JH
9013hasproto='varname=$1; func=$2; shift; shift;
9014while $test $# -ge 2; do
9015 case "$1" in
9016 $define) echo "#include <$2>";;
9017 esac ;
9018 shift 2;
9019done > try.c;
9020$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9021if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9022 echo "$func() prototype found.";
9023 val="$define";
9024else
9025 echo "$func() prototype NOT found.";
9026 val="$undef";
9027fi;
9028set $varname;
9029eval $setvar;
9030$rm -f try.c tryout.c'
9031
9032: see if dbm.h is available
9033: see if dbmclose exists
9034set dbmclose d_dbmclose
9035eval $inlibc
9036
9037case "$d_dbmclose" in
9038$define)
9039 set dbm.h i_dbm
9040 eval $inhdr
9041 case "$i_dbm" in
9042 $define)
9043 val="$undef"
9044 set i_rpcsvcdbm
9045 eval $setvar
9046 ;;
9047 *) set rpcsvc/dbm.h i_rpcsvcdbm
9048 eval $inhdr
9049 ;;
9050 esac
9051 ;;
9052*) echo "We won't be including <dbm.h>"
9053 val="$undef"
9054 set i_dbm
9055 eval $setvar
9056 val="$undef"
9057 set i_rpcsvcdbm
9058 eval $setvar
9059 ;;
9060esac
9061
9062: see if prototype for dbminit is available
9063echo " "
9064set d_dbminitproto dbminit $i_dbm dbm.h
9065eval $hasproto
9066
b4eb6b3d
JH
9067: see if difftime exists
9068set difftime d_difftime
9069eval $inlibc
9070
9071: see if this is a dirent system
9072echo " "
9073if xinc=`./findhdr dirent.h`; $test "$xinc"; then
9074 val="$define"
9075 echo "<dirent.h> found." >&4
9076else
9077 val="$undef"
9078 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
9079 echo "<sys/dir.h> found." >&4
9080 echo " "
9081 else
9082 xinc=`./findhdr sys/ndir.h`
9083 fi
9084 echo "<dirent.h> NOT found." >&4
9085fi
9086set i_dirent
9087eval $setvar
9088
9089: Look for type of directory structure.
9090echo " "
9091$cppstdin $cppflags $cppminus < "$xinc" > try.c
9092
9093case "$direntrytype" in
9094''|' ')
9095 case "$i_dirent" in
9096 $define) guess1='struct dirent' ;;
9097 *) guess1='struct direct' ;;
9098 esac
9099 ;;
9100*) guess1="$direntrytype"
9101 ;;
9102esac
9103
9104case "$guess1" in
9105'struct dirent') guess2='struct direct' ;;
9106*) guess2='struct dirent' ;;
9107esac
9108
9109if $contains "$guess1" try.c >/dev/null 2>&1; then
9110 direntrytype="$guess1"
9111 echo "Your directory entries are $direntrytype." >&4
9112elif $contains "$guess2" try.c >/dev/null 2>&1; then
9113 direntrytype="$guess2"
9114 echo "Your directory entries seem to be $direntrytype." >&4
9115else
9116 echo "I don't recognize your system's directory entries." >&4
9117 rp="What type is used for directory entries on this system?"
9118 dflt="$guess1"
9119 . ./myread
9120 direntrytype="$ans"
9121fi
9122$rm -f try.c
9123
9124
9125: see if the directory entry stores field length
9126echo " "
9127$cppstdin $cppflags $cppminus < "$xinc" > try.c
9128if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9129 echo "Good, your directory entry keeps length information in d_namlen." >&4
9130 val="$define"
9131else
9132 echo "Your directory entry does not know about the d_namlen field." >&4
9133 val="$undef"
9134fi
9135set d_dirnamlen
9136eval $setvar
9137$rm -f try.c
9138
9139: see if dlerror exists
9140xxx_runnm="$runnm"
9141runnm=false
9142set dlerror d_dlerror
9143eval $inlibc
9144runnm="$xxx_runnm"
9145
9146: see if dlfcn is available
9147set dlfcn.h i_dlfcn
9148eval $inhdr
9149
9150case "$usedl" in
9151$define|y|true)
9152 $cat << EOM
9153
9154On a few systems, the dynamically loaded modules that perl generates and uses
9155will need a different extension than shared libs. The default will probably
9156be appropriate.
9157
9158EOM
9159 case "$dlext" in
9160 '') dflt="$so" ;;
9161 *) dflt="$dlext" ;;
9162 esac
9163 rp='What is the extension of dynamically loaded modules'
9164 . ./myread
9165 dlext="$ans"
9166 ;;
9167*)
9168 dlext="none"
9169 ;;
9170esac
9171
9172: Check if dlsym need a leading underscore
9173echo " "
9174val="$undef"
9175
9176case "$dlsrc" in
9177dl_dlopen.xs)
9178 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9179 $cat >dyna.c <<'EOM'
9180fred () { }
9181EOM
9182
9183$cat >fred.c<<EOM
9184
9185#include <stdio.h>
9186#$i_dlfcn I_DLFCN
9187#ifdef I_DLFCN
9188#include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
9189#else
9190#include <sys/types.h>
9191#include <nlist.h>
9192#include <link.h>
9193#endif
9194
9195extern int fred() ;
9196
9197int main()
9198{
9199 void * handle ;
9200 void * symbol ;
9201#ifndef RTLD_LAZY
9202 int mode = 1 ;
9203#else
9204 int mode = RTLD_LAZY ;
9205#endif
9206 handle = dlopen("./dyna.$dlext", mode) ;
9207 if (handle == NULL) {
9208 printf ("1\n") ;
9209 fflush (stdout) ;
9210 exit(0);
9211 }
9212 symbol = dlsym(handle, "fred") ;
9213 if (symbol == NULL) {
9214 /* try putting a leading underscore */
9215 symbol = dlsym(handle, "_fred") ;
9216 if (symbol == NULL) {
9217 printf ("2\n") ;
9218 fflush (stdout) ;
9219 exit(0);
9220 }
9221 printf ("3\n") ;
9222 }
9223 else
9224 printf ("4\n") ;
9225 fflush (stdout) ;
9226 exit(0);
9227}
9228EOM
9229 : Call the object file tmp-dyna.o in case dlext=o.
9230 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
9231 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 9232 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
7a282f6d 9233 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
b4eb6b3d
JH
9234 xxx=`./fred`
9235 case $xxx in
9236 1) echo "Test program failed using dlopen." >&4
9237 echo "Perhaps you should not use dynamic loading." >&4;;
9238 2) echo "Test program failed using dlsym." >&4
9239 echo "Perhaps you should not use dynamic loading." >&4;;
9240 3) echo "dlsym needs a leading underscore" >&4
9241 val="$define" ;;
9242 4) echo "dlsym doesn't need a leading underscore." >&4;;
9243 esac
9244 else
9245 echo "I can't compile and run the test program." >&4
9246 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9247 fi
9248 ;;
9249esac
9250
9251$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
9252
9253set d_dlsymun
9254eval $setvar
9255
b4eb6b3d
JH
9256: see if prototype for drand48 is available
9257echo " "
9258set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9259eval $hasproto
9260
9261: see if dup2 exists
9262set dup2 d_dup2
9263eval $inlibc
9264
9265: see if eaccess exists
9266set eaccess d_eaccess
9267eval $inlibc
9268
9269: see if endgrent exists
9270set endgrent d_endgrent
9271eval $inlibc
9272
9273: see if endhostent exists
9274set endhostent d_endhent
9275eval $inlibc
9276
9277: see if endnetent exists
9278set endnetent d_endnent
9279eval $inlibc
9280
9281: see if endprotoent exists
9282set endprotoent d_endpent
9283eval $inlibc
9284
9285: see if endpwent exists
9286set endpwent d_endpwent
9287eval $inlibc
9288
9289: see if endservent exists
9290set endservent d_endsent
9291eval $inlibc
9292
9293: Locate the flags for 'open()'
9294echo " "
9295$cat >open3.c <<'EOCP'
9296#include <sys/types.h>
9297#ifdef I_FCNTL
9298#include <fcntl.h>
9299#endif
9300#ifdef I_SYS_FILE
9301#include <sys/file.h>
9302#endif
9303int main() {
9304 if(O_RDONLY);
9305#ifdef O_TRUNC
9306 exit(0);
9307#else
9308 exit(1);
9309#endif
9310}
9311EOCP
9312: check sys/file.h first to get FREAD on Sun
9313if $test `./findhdr sys/file.h` && \
9314 set open3 -DI_SYS_FILE && eval $compile; then
9315 h_sysfile=true;
9316 echo "<sys/file.h> defines the O_* constants..." >&4
9317 if ./open3; then
9318 echo "and you have the 3 argument form of open()." >&4
9319 val="$define"
9320 else
9321 echo "but not the 3 argument form of open(). Oh, well." >&4
9322 val="$undef"
9323 fi
9324elif $test `./findhdr fcntl.h` && \
9325 set open3 -DI_FCNTL && eval $compile; then
9326 h_fcntl=true;
9327 echo "<fcntl.h> defines the O_* constants..." >&4
9328 if ./open3; then
9329 echo "and you have the 3 argument form of open()." >&4
9330 val="$define"
9331 else
9332 echo "but not the 3 argument form of open(). Oh, well." >&4
9333 val="$undef"
9334 fi
9335else
9336 val="$undef"
9337 echo "I can't find the O_* constant definitions! You got problems." >&4
9338fi
9339set d_open3
9340eval $setvar
9341$rm -f open3*
9342
9343: see which of string.h or strings.h is needed
9344echo " "
9345strings=`./findhdr string.h`
9346if $test "$strings" && $test -r "$strings"; then
9347 echo "Using <string.h> instead of <strings.h>." >&4
9348 val="$define"
9349else
9350 val="$undef"
9351 strings=`./findhdr strings.h`
9352 if $test "$strings" && $test -r "$strings"; then
9353 echo "Using <strings.h> instead of <string.h>." >&4
9354 else
9355 echo "No string header found -- You'll surely have problems." >&4
9356 fi
9357fi
9358set i_string
9359eval $setvar
9360case "$i_string" in
9361"$undef") strings=`./findhdr strings.h`;;
9362*) strings=`./findhdr string.h`;;
9363esac
9364
9365: check for non-blocking I/O stuff
9366case "$h_sysfile" in
a0acbdc3
JH
9367true) echo "#include <sys/file.h>" > head.c;;
9368*)
9369 case "$h_fcntl" in
9370 true) echo "#include <fcntl.h>" > head.c;;
9371 *) echo "#include <sys/fcntl.h>" > head.c;;
9372 esac
9373 ;;
b4eb6b3d
JH
9374esac
9375echo " "
9376echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9377case "$o_nonblock" in
9378'')
9379 $cat head.c > try.c
9380 $cat >>try.c <<'EOCP'
9381#include <stdio.h>
9382int main() {
9383#ifdef O_NONBLOCK
9384 printf("O_NONBLOCK\n");
9385 exit(0);
9386#endif
9387#ifdef O_NDELAY
9388 printf("O_NDELAY\n");
9389 exit(0);
9390#endif
9391#ifdef FNDELAY
9392 printf("FNDELAY\n");
9393 exit(0);
9394#endif
9395 exit(0);
9396}
9397EOCP
9398 set try
9399 if eval $compile_ok; then
9400 o_nonblock=`./try`
9401 case "$o_nonblock" in
9402 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9403 *) echo "Seems like we can use $o_nonblock.";;
9404 esac
9405 else
9406 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9407 fi
9408 ;;
9409*) echo "Using $hint value $o_nonblock.";;
9410esac
9411$rm -f try try.* .out core
9412
9413echo " "
9414echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9415case "$eagain" in
9416'')
9417 $cat head.c > try.c
9418 $cat >>try.c <<EOCP
9419#include <errno.h>
9420#include <sys/types.h>
9421#include <signal.h>
9422#include <stdio.h>
9423#define MY_O_NONBLOCK $o_nonblock
9424#ifndef errno /* XXX need better Configure test */
9425extern int errno;
9426#endif
9427#$i_unistd I_UNISTD
9428#ifdef I_UNISTD
9429#include <unistd.h>
9430#endif
9431#$i_string I_STRING
9432#ifdef I_STRING
9433#include <string.h>
9434#else
9435#include <strings.h>
9436#endif
9437$signal_t blech(x) int x; { exit(3); }
9438EOCP
9439 $cat >> try.c <<'EOCP'
9440int main()
9441{
9442 int pd[2];
9443 int pu[2];
9444 char buf[1];
9445 char string[100];
9446
9447 pipe(pd); /* Down: child -> parent */
9448 pipe(pu); /* Up: parent -> child */
9449 if (0 != fork()) {
9450 int ret;
9451 close(pd[1]); /* Parent reads from pd[0] */
9452 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 9453#ifdef F_SETFL
b4eb6b3d
JH
9454 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
9455 exit(1);
a0acbdc3
JH
9456#else
9457 exit(4);
9458#endif
b4eb6b3d
JH
9459 signal(SIGALRM, blech);
9460 alarm(5);
9461 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
9462 exit(2);
9463 sprintf(string, "%d\n", ret);
9464 write(2, string, strlen(string));
9465 alarm(0);
9466#ifdef EAGAIN
9467 if (errno == EAGAIN) {
9468 printf("EAGAIN\n");
9469 goto ok;
9470 }
9471#endif
9472#ifdef EWOULDBLOCK
9473 if (errno == EWOULDBLOCK)
9474 printf("EWOULDBLOCK\n");
9475#endif
9476 ok:
9477 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
9478 sleep(2); /* Give it time to close our pipe */
9479 alarm(5);
9480 ret = read(pd[0], buf, 1); /* Should read EOF */
9481 alarm(0);
9482 sprintf(string, "%d\n", ret);
9483 write(3, string, strlen(string));
9484 exit(0);
9485 }
9486
9487 close(pd[0]); /* We write to pd[1] */
9488 close(pu[1]); /* We read from pu[0] */
9489 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
9490 close(pd[1]); /* Pipe pd is now fully closed! */
9491 exit(0); /* Bye bye, thank you for playing! */
9492}
9493EOCP
9494 set try
9495 if eval $compile_ok; then
9496 echo "$startsh" >mtry
9497 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
9498 chmod +x mtry
9499 ./mtry >/dev/null 2>&1
9500 case $? in
9501 0) eagain=`$cat try.out`;;
9502 1) echo "Could not perform non-blocking setting!";;
9503 2) echo "I did a successful read() for something that was not there!";;
9504 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 9505 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
9506 *) echo "Something terribly wrong happened during testing.";;
9507 esac
9508 rd_nodata=`$cat try.ret`
9509 echo "A read() system call with no data present returns $rd_nodata."
9510 case "$rd_nodata" in
9511 0|-1) ;;
9512 *)
9513 echo "(That's peculiar, fixing that to be -1.)"
9514 rd_nodata=-1
9515 ;;
9516 esac
9517 case "$eagain" in
9518 '')
9519 echo "Forcing errno EAGAIN on read() with no data available."
9520 eagain=EAGAIN
9521 ;;
9522 *)
9523 echo "Your read() sets errno to $eagain when no data is available."
9524 ;;
9525 esac
9526 status=`$cat try.err`
9527 case "$status" in
9528 0) echo "And it correctly returns 0 to signal EOF.";;
9529 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
9530 *) echo "However, your read() returns '$status' on EOF??";;
9531 esac
9532 val="$define"
9533 if test "$status" = "$rd_nodata"; then
9534 echo "WARNING: you can't distinguish between EOF and no data!"
9535 val="$undef"
9536 fi
9537 else
9538 echo "I can't compile the test program--assuming errno EAGAIN will do."
9539 eagain=EAGAIN
9540 fi
9541 set d_eofnblk
9542 eval $setvar
9543 ;;
9544*)
9545 echo "Using $hint value $eagain."
9546 echo "Your read() returns $rd_nodata when no data is present."
9547 case "$d_eofnblk" in
9548 "$define") echo "And you can see EOF because read() returns 0.";;
9549 "$undef") echo "But you can't see EOF status from read() returned value.";;
9550 *)
9551 echo "(Assuming you can't see EOF status from read anyway.)"
9552 d_eofnblk=$undef
9553 ;;
9554 esac
9555 ;;
9556esac
9557$rm -f try try.* .out core head.c mtry
9558
9559: see if fchmod exists
9560set fchmod d_fchmod
9561eval $inlibc
9562
9563: see if fchown exists
9564set fchown d_fchown
9565eval $inlibc
9566
9567: see if this is an fcntl system
9568set fcntl d_fcntl
9569eval $inlibc
9570
9d9004a9
AD
9571echo " "
9572: See if fcntl-based locking works.
9573$cat >try.c <<'EOCP'
9574#include <stdlib.h>
9575#include <unistd.h>
9576#include <fcntl.h>
9577int main() {
9578#if defined(F_SETLK) && defined(F_SETLKW)
9579 struct flock flock;
9580 int retval, fd;
9581 fd = open("try.c", O_RDONLY);
9582 flock.l_type = F_RDLCK;
9583 flock.l_whence = SEEK_SET;
9584 flock.l_start = flock.l_len = 0;
9585 retval = fcntl(fd, F_SETLK, &flock);
9586 close(fd);
9587 (retval < 0 ? exit(2) : exit(0));
9588#else
9589 exit(2);
9590#endif
9591}
9592EOCP
9593echo "Checking if fcntl-based file locking works... "
9594case "$d_fcntl" in
9595"$define")
9596 set try
9597 if eval $compile_ok; then
9598 if ./try; then
9599 echo "Yes, it seems to work."
9600 val="$define"
9601 else
9602 echo "Nope, it didn't work."
9603 val="$undef"
9604 fi
9605 else
9606 echo "I'm unable to compile the test program, so I'll assume not."
9607 val="$undef"
9608 fi
9609 ;;
9610*) val="$undef";
9611 echo "Nope, since you don't even have fcntl()."
9612 ;;
9613esac
9614set d_fcntl_can_lock
9615eval $setvar
9616$rm -f try*
9617
9618
b4eb6b3d
JH
9619: see if sys/select.h has to be included
9620set sys/select.h i_sysselct
9621eval $inhdr
9622
9623: see if we should include time.h, sys/time.h, or both
9624echo " "
9625if test "X$timeincl" = X; then
9626 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9627 $echo $n "I'm now running the test program...$c"
9628 $cat >try.c <<'EOCP'
9629#include <sys/types.h>
9630#ifdef I_TIME
9631#include <time.h>
9632#endif
9633#ifdef I_SYSTIME
9634#ifdef SYSTIMEKERNEL
9635#define KERNEL
9636#endif
9637#include <sys/time.h>
9638#endif
9639#ifdef I_SYSSELECT
9640#include <sys/select.h>
9641#endif
9642int main()
9643{
9644 struct tm foo;
9645#ifdef S_TIMEVAL
9646 struct timeval bar;
9647#endif
9648#ifdef S_TIMEZONE
9649 struct timezone tzp;
9650#endif
9651 if (foo.tm_sec == foo.tm_sec)
9652 exit(0);
9653#ifdef S_TIMEVAL
9654 if (bar.tv_sec == bar.tv_sec)
9655 exit(0);
9656#endif
9657 exit(1);
9658}
9659EOCP
9660 flags=''
9661 for s_timezone in '-DS_TIMEZONE' ''; do
9662 sysselect=''
9663 for s_timeval in '-DS_TIMEVAL' ''; do
9664 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9665 for i_time in '' '-DI_TIME'; do
9666 for i_systime in '-DI_SYSTIME' ''; do
9667 case "$flags" in
9668 '') $echo $n ".$c"
9669 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9670 if eval $compile; then
9671 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9672 shift
9673 flags="$*"
9674 echo " "
9675 $echo $n "Succeeded with $flags$c"
9676 fi
9677 ;;
9678 esac
9679 done
9680 done
9681 done
9682 done
9683 done
9684 timeincl=''
9685 echo " "
9686 case "$flags" in
9687 *SYSTIMEKERNEL*) i_systimek="$define"
9688 timeincl=`./findhdr sys/time.h`
9689 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9690 *) i_systimek="$undef";;
9691 esac
9692 case "$flags" in
9693 *I_TIME*) i_time="$define"
9694 timeincl=`./findhdr time.h`" $timeincl"
9695 echo "We'll include <time.h>." >&4;;
9696 *) i_time="$undef";;
9697 esac
9698 case "$flags" in
9699 *I_SYSTIME*) i_systime="$define"
9700 timeincl=`./findhdr sys/time.h`" $timeincl"
9701 echo "We'll include <sys/time.h>." >&4;;
9702 *) i_systime="$undef";;
9703 esac
9704 $rm -f try.c try
9705fi
9706
9707: check for fd_set items
9708$cat <<EOM
9709
9710Checking to see how well your C compiler handles fd_set and friends ...
9711EOM
9712$cat >fd_set.c <<EOCP
9713#$i_systime I_SYS_TIME
9714#$i_sysselct I_SYS_SELECT
9715#$d_socket HAS_SOCKET
9716#include <sys/types.h>
9717#ifdef HAS_SOCKET
9718#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9719#endif
9720#ifdef I_SYS_TIME
9721#include <sys/time.h>
9722#endif
9723#ifdef I_SYS_SELECT
9724#include <sys/select.h>
9725#endif
9726int main() {
9727 fd_set fds;
9728
9729#ifdef TRYBITS
9730 if(fds.fds_bits);
9731#endif
9732
9733#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9734 exit(0);
9735#else
9736 exit(1);
9737#endif
9738}
9739EOCP
9740set fd_set -DTRYBITS
9741if eval $compile; then
9742 d_fds_bits="$define"
9743 d_fd_set="$define"
9744 echo "Well, your system knows about the normal fd_set typedef..." >&4
9745 if ./fd_set; then
9746 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9747 d_fd_macros="$define"
9748 else
9749 $cat >&4 <<'EOM'
9750but not the normal fd_set macros! Gaaack! I'll have to cover for you.
9751EOM
9752 d_fd_macros="$undef"
9753 fi
9754else
9755 $cat <<'EOM'
9756Hmm, your compiler has some difficulty with fd_set. Checking further...
9757EOM
9758 set fd_set
9759 if eval $compile; then
9760 d_fds_bits="$undef"
9761 d_fd_set="$define"
9762 echo "Well, your system has some sort of fd_set available..." >&4
9763 if ./fd_set; then
9764 echo "and you have the normal fd_set macros." >&4
9765 d_fd_macros="$define"
9766 else
9767 $cat <<'EOM'
9768but not the normal fd_set macros! Gross! More work for me...
9769EOM
9770 d_fd_macros="$undef"
9771 fi
9772 else
9773 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
9774 d_fd_set="$undef"
9775 d_fds_bits="$undef"
9776 d_fd_macros="$undef"
9777 fi
9778fi
9779$rm -f fd_set*
9780
9781: see if fgetpos exists
9782set fgetpos d_fgetpos
9783eval $inlibc
9784
9785: see if flock exists
9786set flock d_flock
9787eval $inlibc
9788
2ef53570
JH
9789: see if this is a sys/file.h system
9790val=''
9791set sys/file.h val
9792eval $inhdr
9793
9794: do we need to include sys/file.h ?
9795case "$val" in
9796"$define")
9797 echo " "
9798 if $h_sysfile; then
9799 val="$define"
9800 echo "We'll be including <sys/file.h>." >&4
9801 else
9802 val="$undef"
9803 echo "We won't be including <sys/file.h>." >&4
9804 fi
9805 ;;
9806*)
9807 h_sysfile=false
9808 ;;
9809esac
9810set i_sysfile
9811eval $setvar
9812
9813: see if prototype for flock is available
9814echo " "
9815set d_flockproto flock $i_sysfile sys/file.h
9816eval $hasproto
9817
b4eb6b3d
JH
9818: see if fork exists
9819set fork d_fork
9820eval $inlibc
9821
9822: see if pathconf exists
9823set pathconf d_pathconf
9824eval $inlibc
9825
9826: see if fpathconf exists
9827set fpathconf d_fpathconf
9828eval $inlibc
9829
9830
9831: check for fpos64_t
9832echo " "
9833echo "Checking to see if you have fpos64_t..." >&4
9834$cat >try.c <<EOCP
9835#include <stdio.h>
9836int main() { fpos64_t x = 7; }
9837EOCP
9838set try
9839if eval $compile; then
9840 val="$define"
9841 echo "You have fpos64_t."
9842else
9843 val="$undef"
9844 echo "You do not have fpos64_t."
9845 case "$fpossize" in
9846 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9847 esac
9848fi
9849$rm -f try.* try
9850set d_fpos64_t
9851eval $setvar
9852
9853: see if frexpl exists
9854set frexpl d_frexpl
9855eval $inlibc
9856
b4eb6b3d
JH
9857: see if this is a sys/param system
9858set sys/param.h i_sysparam
9859eval $inhdr
9860
9861: see if this is a sys/mount.h system
9862set sys/mount.h i_sysmount
9863eval $inhdr
9864
b4eb6b3d
JH
9865
9866echo " "
9867echo "Checking to see if your system supports struct fs_data..." >&4
9868set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9869eval $hasstruct
9870case "$d_fs_data_s" in
9871"$define") echo "Yes, it does." ;;
9872*) echo "No, it doesn't." ;;
9873esac
9874
9875: see if fseeko exists
9876set fseeko d_fseeko
9877eval $inlibc
9878case "$longsize" in
98798) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9880esac
9881
9882: see if fsetpos exists
9883set fsetpos d_fsetpos
9884eval $inlibc
9885
9886
9887: see if fstatfs exists
9888set fstatfs d_fstatfs
9889eval $inlibc
9890
9891
9892: see if statvfs exists
9893set statvfs d_statvfs
9894eval $inlibc
9895
9896: see if fstatvfs exists
9897set fstatvfs d_fstatvfs
9898eval $inlibc
9899
9900
411ab01c
JH
9901: see if fsync exists
9902set fsync d_fsync
9903eval $inlibc
9904
b4eb6b3d
JH
9905: see if ftello exists
9906set ftello d_ftello
9907eval $inlibc
9908case "$longsize" in
99098) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9910esac
9911
9912: see if getcwd exists
9913set getcwd d_getcwd
9914eval $inlibc
9915
9916: see if getespwnam exists
9917set getespwnam d_getespwnam
9918eval $inlibc
9919
9920
9921: see if getfsstat exists
9922set getfsstat d_getfsstat
9923eval $inlibc
9924
9925: see if getgrent exists
9926set getgrent d_getgrent
9927eval $inlibc
9928
9929: see if gethostbyaddr exists
9930set gethostbyaddr d_gethbyaddr
9931eval $inlibc
9932
9933: see if gethostbyname exists
9934set gethostbyname d_gethbyname
9935eval $inlibc
9936
9937: see if gethostent exists
9938set gethostent d_gethent
9939eval $inlibc
9940
9941: see how we will look up host name
9942echo " "
9943call=''
9944if set gethostname val -f d_gethname; eval $csym; $val; then
9945 echo 'gethostname() found.' >&4
9946 d_gethname="$define"
9947 call=gethostname
9948fi
9949if set uname val -f d_uname; eval $csym; $val; then
9950 if ./xenix; then
9951 $cat <<'EOM'
9952uname() was found, but you're running xenix, and older versions of xenix
9953have a broken uname(). If you don't really know whether your xenix is old
9954enough to have a broken system call, use the default answer.
9955
9956EOM
9957 dflt=y
9958 case "$d_uname" in
9959 "$define") dflt=n;;
9960 esac
9961 rp='Is your uname() broken?'
9962 . ./myread
9963 case "$ans" in
9964 n*) d_uname="$define"; call=uname;;
9965 esac
9966 else
9967 echo 'uname() found.' >&4
9968 d_uname="$define"
9969 case "$call" in
9970 '') call=uname ;;
9971 esac
9972 fi
9973fi
9974case "$d_gethname" in
9975'') d_gethname="$undef";;
9976esac
9977case "$d_uname" in
9978'') d_uname="$undef";;
9979esac
9980case "$d_uname$d_gethname" in
9981*define*)
9982 dflt=n
9983 cat <<EOM
9984
9985Every now and then someone has a $call() that lies about the hostname
9986but can't be fixed for political or economic reasons. If you wish, I can
9987pretend $call() isn't there and maybe compute hostname at run-time
9988thanks to the '$phostname' command.
9989
9990EOM
9991 rp="Shall I ignore $call() from now on?"
9992 . ./myread
9993 case "$ans" in
9994 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9995 esac;;
9996esac
9997case "$phostname" in
9998'') aphostname='';;
9999*) case "$aphostname" in
10000 /*) ;;
10001 *) set X $phostname
10002 shift
10003 file=$1
10004 shift
10005 file=`./loc $file $file $pth`
10006 aphostname=`echo $file $*`
10007 ;;
10008 esac
10009 ;;
10010esac
10011case "$d_uname$d_gethname" in
10012*define*) ;;
10013*)
10014 case "$phostname" in
10015 '')
10016 echo "There will be no way for $package to get your hostname." >&4;;
10017 *)
10018 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
10019 ;;
10020 esac;;
10021esac
10022case "$d_phostname" in
10023'') d_phostname="$undef";;
10024esac
10025
10026: see if this is a netdb.h system
10027set netdb.h i_netdb
10028eval $inhdr
10029
10030: see if prototypes for various gethostxxx netdb.h functions are available
10031echo " "
10032set d_gethostprotos gethostent $i_netdb netdb.h
10033eval $hasproto
10034
4e0554ec
JH
10035: see if getitimer exists
10036set getitimer d_getitimer
10037eval $inlibc
10038
b4eb6b3d
JH
10039: see if getlogin exists
10040set getlogin d_getlogin
10041eval $inlibc
10042
10043: see if getmnt exists
10044set getmnt d_getmnt
10045eval $inlibc
10046
10047: see if getmntent exists
10048set getmntent d_getmntent
10049eval $inlibc
10050
10051: see if getnetbyaddr exists
10052set getnetbyaddr d_getnbyaddr
10053eval $inlibc
10054
10055: see if getnetbyname exists
10056set getnetbyname d_getnbyname
10057eval $inlibc
10058
10059: see if getnetent exists
10060set getnetent d_getnent
10061eval $inlibc
10062
10063: see if prototypes for various getnetxxx netdb.h functions are available
10064echo " "
10065set d_getnetprotos getnetent $i_netdb netdb.h
10066eval $hasproto
10067
0c0643d0
JH
10068: see if getpagesize exists
10069set getpagesize d_getpagsz
10070eval $inlibc
10071
b4eb6b3d
JH
10072
10073: see if getprotobyname exists
10074set getprotobyname d_getpbyname
10075eval $inlibc
10076
10077: see if getprotobynumber exists
10078set getprotobynumber d_getpbynumber
10079eval $inlibc
10080
10081: see if getprotoent exists
10082set getprotoent d_getpent
10083eval $inlibc
10084
10085: see if getpgid exists
10086set getpgid d_getpgid
10087eval $inlibc
10088
10089: see if getpgrp2 exists
10090set getpgrp2 d_getpgrp2
10091eval $inlibc
10092
10093: see if getppid exists
10094set getppid d_getppid
10095eval $inlibc
10096
10097: see if getpriority exists
10098set getpriority d_getprior
10099eval $inlibc
10100
10101: see if prototypes for various getprotoxxx netdb.h functions are available
10102echo " "
10103set d_getprotoprotos getprotoent $i_netdb netdb.h
10104eval $hasproto
10105
10106: see if getprpwnam exists
10107set getprpwnam d_getprpwnam
10108eval $inlibc
10109
10110: see if getpwent exists
10111set getpwent d_getpwent
10112eval $inlibc
10113
10114
10115: see if getservbyname exists
10116set getservbyname d_getsbyname
10117eval $inlibc
10118
10119: see if getservbyport exists
10120set getservbyport d_getsbyport
10121eval $inlibc
10122
10123: see if getservent exists
10124set getservent d_getsent
10125eval $inlibc
10126
10127: see if prototypes for various getservxxx netdb.h functions are available
10128echo " "
10129set d_getservprotos getservent $i_netdb netdb.h
10130eval $hasproto
10131
10132: see if getspnam exists
10133set getspnam d_getspnam
10134eval $inlibc
10135
10136: see if gettimeofday or ftime exists
10137set gettimeofday d_gettimeod
10138eval $inlibc
10139case "$d_gettimeod" in
10140"$undef")
10141 set ftime d_ftime
10142 eval $inlibc
10143 ;;
10144*)
10145 val="$undef"; set d_ftime; eval $setvar
10146 ;;
10147esac
10148case "$d_gettimeod$d_ftime" in
10149"$undef$undef")
10150 echo " "
10151 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10152 ;;
10153esac
10154
10155: see if this is an grp system
10156set grp.h i_grp
10157eval $inhdr
10158
10159case "$i_grp" in
10160$define)
10161 xxx=`./findhdr grp.h`
10162 $cppstdin $cppflags $cppminus < $xxx >$$.h
10163
10164 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10165 val="$define"
10166 else
10167 val="$undef"
10168 fi
10169 set d_grpasswd
10170 eval $setvar
10171
10172 $rm -f $$.h
10173 ;;
10174*)
10175 val="$undef";
10176 set d_grpasswd; eval $setvar
10177 ;;
10178esac
10179
10180: see if hasmntopt exists
10181set hasmntopt d_hasmntopt
10182eval $inlibc
10183
10184: see if this is a netinet/in.h or sys/in.h system
10185set netinet/in.h i_niin sys/in.h i_sysin
10186eval $inhdr
10187
10188: see if arpa/inet.h has to be included
10189set arpa/inet.h i_arpainet
10190eval $inhdr
10191
10192: see if htonl --and friends-- exists
10193val=''
10194set htonl val
10195eval $inlibc
10196
10197: Maybe they are macros.
10198case "$val" in
10199$undef)
10200 $cat >htonl.c <<EOM
10201#include <stdio.h>
10202#include <sys/types.h>
10203#$i_niin I_NETINET_IN
10204#$i_sysin I_SYS_IN
10205#$i_arpainet I_ARPA_INET
10206#ifdef I_NETINET_IN
10207#include <netinet/in.h>
10208#endif
10209#ifdef I_SYS_IN
10210#include <sys/in.h>
10211#endif
10212#ifdef I_ARPA_INET
10213#include <arpa/inet.h>
10214#endif
10215#ifdef htonl
10216printf("Defined as a macro.");
10217#endif
10218EOM
10219 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10220 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10221 val="$define"
10222 echo "But it seems to be defined as a macro." >&4
10223 fi
10224 $rm -f htonl.?
10225 ;;
10226esac
10227set d_htonl
10228eval $setvar
10229
10230: see if iconv exists
10231set iconv d_iconv
10232eval $inlibc
10233
10234: index or strchr
10235echo " "
10236if set index val -f; eval $csym; $val; then
10237 if set strchr val -f d_strchr; eval $csym; $val; then
10238 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10239 val="$define"
10240 vali="$undef"
10241 echo "strchr() found." >&4
10242 else
10243 val="$undef"
10244 vali="$define"
10245 echo "index() found." >&4
10246 fi
10247 else
10248 val="$undef"
10249 vali="$define"
8dfa8df9
JH
10250 echo "index() found." >&4
10251 fi
b4eb6b3d 10252else
8dfa8df9
JH
10253 if set strchr val -f d_strchr; eval $csym; $val; then
10254 val="$define"
10255 vali="$undef"
10256 echo "strchr() found." >&4
10257 else
10258 echo "No index() or strchr() found!" >&4
10259 val="$undef"
10260 vali="$undef"
10261 fi
b4eb6b3d 10262fi
8dfa8df9
JH
10263set d_strchr; eval $setvar
10264val="$vali"
10265set d_index; eval $setvar
10266
10267: check whether inet_aton exists
10268set inet_aton d_inetaton
10269eval $inlibc
b4eb6b3d
JH
10270
10271: Look for isascii
10272echo " "
10273$cat >isascii.c <<'EOCP'
10274#include <stdio.h>
10275#include <ctype.h>
10276int main() {
10277 int c = 'A';
10278 if (isascii(c))
10279 exit(0);
10280 else
10281 exit(1);
10282}
10283EOCP
10284set isascii
10285if eval $compile; then
10286 echo "isascii() found." >&4
10287 val="$define"
10288else
10289 echo "isascii() NOT found." >&4
10290 val="$undef"
10291fi
10292set d_isascii
10293eval $setvar
10294$rm -f isascii*
10295
10296: see if isnan exists
10297set isnan d_isnan
10298eval $inlibc
10299
10300: see if isnanl exists
10301set isnanl d_isnanl
10302eval $inlibc
10303
10304: see if killpg exists
10305set killpg d_killpg
10306eval $inlibc
10307
10308: see if lchown exists
10309echo " "
10310$cat > try.c <<'EOCP'
10311/* System header to define __stub macros and hopefully few prototypes,
10312 which can conflict with char lchown(); below. */
10313#include <assert.h>
10314/* Override any gcc2 internal prototype to avoid an error. */
10315/* We use char because int might match the return type of a gcc2
10316 builtin and then its argument prototype would still apply. */
10317char lchown();
10318int main() {
10319 /* The GNU C library defines this for functions which it implements
10320 to always fail with ENOSYS. Some functions are actually named
10321 something starting with __ and the normal name is an alias. */
10322#if defined (__stub_lchown) || defined (__stub___lchown)
10323choke me
10324#else
10325lchown();
10326#endif
10327; return 0; }
10328EOCP
10329set try
10330if eval $compile; then
10331 $echo "lchown() found." >&4
10332 val="$define"
10333else
10334 $echo "lchown() NOT found." >&4
10335 val="$undef"
10336fi
10337set d_lchown
10338eval $setvar
10339
10340: See if number of significant digits in a double precision number is known
10341echo " "
10342$cat >ldbl_dig.c <<EOM
10343#$i_limits I_LIMITS
10344#$i_float I_FLOAT
10345#ifdef I_LIMITS
10346#include <limits.h>
10347#endif
10348#ifdef I_FLOAT
10349#include <float.h>
10350#endif
10351#ifdef LDBL_DIG
10352printf("Contains LDBL_DIG");
10353#endif
10354EOM
10355$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10356if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10357 echo "LDBL_DIG found." >&4
10358 val="$define"
10359else
10360 echo "LDBL_DIG NOT found." >&4
10361 val="$undef"
10362fi
10363$rm -f ldbl_dig.?
10364set d_ldbl_dig
10365eval $setvar
10366
10367: see if link exists
10368set link d_link
10369eval $inlibc
10370
10371: see if localeconv exists
10372set localeconv d_locconv
10373eval $inlibc
10374
10375: see if lockf exists
10376set lockf d_lockf
10377eval $inlibc
10378
b4eb6b3d
JH
10379: see if prototype for lseek is available
10380echo " "
10381set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10382eval $hasproto
10383
10384: see if lstat exists
10385set lstat d_lstat
10386eval $inlibc
10387
10388: see if madvise exists
10389set madvise d_madvise
10390eval $inlibc
10391
10392: see if mblen exists
10393set mblen d_mblen
10394eval $inlibc
10395
10396: see if mbstowcs exists
10397set mbstowcs d_mbstowcs
10398eval $inlibc
10399
10400: see if mbtowc exists
10401set mbtowc d_mbtowc
10402eval $inlibc
10403
10404: see if memchr exists
10405set memchr d_memchr
10406eval $inlibc
10407
10408: see if memcmp exists
10409set memcmp d_memcmp
10410eval $inlibc
10411
10412: see if memcpy exists
10413set memcpy d_memcpy
10414eval $inlibc
10415
10416: see if memmove exists
10417set memmove d_memmove
10418eval $inlibc
10419
10420: see if memset exists
10421set memset d_memset
10422eval $inlibc
10423
10424: see if mkdir exists
10425set mkdir d_mkdir
10426eval $inlibc
10427
10428: see if mkdtemp exists
10429set mkdtemp d_mkdtemp
10430eval $inlibc
10431
10432: see if mkfifo exists
10433set mkfifo d_mkfifo
10434eval $inlibc
10435
10436: see if mkstemp exists
10437set mkstemp d_mkstemp
10438eval $inlibc
10439
10440: see if mkstemps exists
10441set mkstemps d_mkstemps
10442eval $inlibc
10443
10444: see if mktime exists
10445set mktime d_mktime
10446eval $inlibc
10447
10448: see if this is a sys/mman.h system
10449set sys/mman.h i_sysmman
10450eval $inhdr
10451
10452: see if mmap exists
10453set mmap d_mmap
10454eval $inlibc
10455: see what shmat returns
10456: default to something harmless
10457mmaptype='void *'
10458case "$i_sysmman$d_mmap" in
10459"$define$define")
10460 $cat >mmap.c <<'END'
10461#include <sys/mman.h>
10462void *mmap();
10463END
10464 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10465 mmaptype='void *'
10466 else
10467 mmaptype='caddr_t'
10468 fi
10469 echo "and it returns ($mmaptype)." >&4
10470 ;;
10471esac
10472
10473
10474
10475: see if modfl exists
10476set modfl d_modfl
10477eval $inlibc
10478
10479: see if mprotect exists
10480set mprotect d_mprotect
10481eval $inlibc
10482
10483: see if msgctl exists
10484set msgctl d_msgctl
10485eval $inlibc
10486
10487: see if msgget exists
10488set msgget d_msgget
10489eval $inlibc
10490
10491: see if msgsnd exists
10492set msgsnd d_msgsnd
10493eval $inlibc
10494
10495: see if msgrcv exists
10496set msgrcv d_msgrcv
10497eval $inlibc
10498
10499: see how much of the 'msg*(2)' library is present.
10500h_msg=true
10501echo " "
10502case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10503*"$undef"*) h_msg=false;;
10504esac
10505case "$osname" in
10506freebsd)
10507 case "`ipcs 2>&1`" in
10508 "SVID messages"*"not configured"*)
10509 echo "Your $osname does not have the msg*(2) configured." >&4
10510 h_msg=false
10511 val="$undef"
10512 set msgctl d_msgctl
10513 eval $setvar
10514 set msgget d_msgget
10515 eval $setvar
10516 set msgsnd d_msgsnd
10517 eval $setvar
10518 set msgrcv d_msgrcv
10519 eval $setvar
10520 ;;
10521 esac
10522 ;;
10523esac
10524: we could also check for sys/ipc.h ...
10525if $h_msg && $test `./findhdr sys/msg.h`; then
10526 echo "You have the full msg*(2) library." >&4
10527 val="$define"
10528else
10529 echo "You don't have the full msg*(2) library." >&4
10530 val="$undef"
10531fi
10532set d_msg
10533eval $setvar
10534
4e0554ec
JH
10535
10536echo " "
10537echo "Checking to see if your system supports struct msghdr..." >&4
10538set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10539eval $hasstruct
10540case "$d_msghdr_s" in
10541"$define") echo "Yes, it does." ;;
10542*) echo "No, it doesn't." ;;
10543esac
10544
10545
b4eb6b3d
JH
10546: see if msync exists
10547set msync d_msync
10548eval $inlibc
10549
10550: see if munmap exists
10551set munmap d_munmap
10552eval $inlibc
10553
10554: see if nice exists
10555set nice d_nice
10556eval $inlibc
10557
b4eb6b3d
JH
10558: check for length of character
10559echo " "
10560case "$charsize" in
10561'')
10562 echo "Checking to see how big your characters are (hey, you never know)..." >&4
10563 $cat >try.c <<'EOCP'
10564#include <stdio.h>
10565int main()
10566{
10567 printf("%d\n", (int)sizeof(char));
10568 exit(0);
10569}
10570EOCP
10571 set try
10572 if eval $compile_ok; then
10573 dflt=`./try`
10574 else
10575 dflt='1'
10576 echo "(I can't seem to compile the test program. Guessing...)"
10577 fi
10578 ;;
10579*)
10580 dflt="$charsize"
10581 ;;
10582esac
10583rp="What is the size of a character (in bytes)?"
10584. ./myread
10585charsize="$ans"
10586$rm -f try.c try
10587
1d1be0dc
NC
10588: check for volatile keyword
10589echo " "
10590echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10591$cat >try.c <<'EOCP'
10592int main()
10593{
10594 typedef struct _goo_struct goo_struct;
10595 goo_struct * volatile goo = ((goo_struct *)0);
10596 struct _goo_struct {
10597 long long_int;
10598 int reg_int;
10599 char char_var;
10600 };
10601 typedef unsigned short foo_t;
10602 char *volatile foo;
10603 volatile int bar;
10604 volatile foo_t blech;
10605 foo = foo;
10606}
10607EOCP
10608if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10609 val="$define"
10610 echo "Yup, it does."
10611else
10612 val="$undef"
10613 echo "Nope, it doesn't."
10614fi
10615set d_volatile
10616eval $setvar
10617$rm -f try.*
10618
b4eb6b3d
JH
10619
10620echo " "
10621$echo "Choosing the C types to be used for Perl's internal types..." >&4
10622
10623case "$use64bitint:$d_quad:$quadtype" in
10624define:define:?*)
10625 ivtype="$quadtype"
10626 uvtype="$uquadtype"
10627 ivsize=8
10628 uvsize=8
10629 ;;
10630*) ivtype="long"
10631 uvtype="unsigned long"
10632 ivsize=$longsize
10633 uvsize=$longsize
10634 ;;
10635esac
10636
10637case "$uselongdouble:$d_longdbl" in
10638define:define)
10639 nvtype="long double"
10640 nvsize=$longdblsize
10641 ;;
10642*) nvtype=double
10643 nvsize=$doublesize
10644 ;;
10645esac
10646
10647$echo "(IV will be "$ivtype", $ivsize bytes)"
10648$echo "(UV will be "$uvtype", $uvsize bytes)"
10649$echo "(NV will be "$nvtype", $nvsize bytes)"
10650
10651$cat >try.c <<EOCP
10652#$i_inttypes I_INTTYPES
10653#ifdef I_INTTYPES
10654#include <inttypes.h>
10655#endif
10656#include <stdio.h>
10657int main() {
10658#ifdef INT8
10659 int8_t i = INT8_MAX;
10660 uint8_t u = UINT8_MAX;
10661 printf("int8_t\n");
10662#endif
10663#ifdef INT16
10664 int16_t i = INT16_MAX;
10665 uint16_t i = UINT16_MAX;
10666 printf("int16_t\n");
10667#endif
10668#ifdef INT32
10669 int32_t i = INT32_MAX;
10670 uint32_t u = UINT32_MAX;
10671 printf("int32_t\n");
10672#endif
10673}
10674EOCP
10675
10676case "$i8type" in
10677'') case "$charsize" in
10678 1) i8type=char
10679 u8type="unsigned char"
10680 i8size=$charsize
10681 u8size=$charsize
10682 ;;
10683 esac
10684 ;;
10685esac
10686case "$i8type" in
10687'') set try -DINT8
10688 if eval $compile; then
10689 case "`./try$exe_ext`" in
10690 int8_t) i8type=int8_t
10691 u8type=uint8_t
10692 i8size=1
10693 u8size=1
10694 ;;
10695 esac
10696 fi
10697 ;;
10698esac
10699case "$i8type" in
10700'') if $test $charsize -ge 1; then
10701 i8type=char
10702 u8type="unsigned char"
10703 i8size=$charsize
10704 u8size=$charsize
10705 fi
10706 ;;
10707esac
10708
10709case "$i16type" in
10710'') case "$shortsize" in
10711 2) i16type=short
10712 u16type="unsigned short"
10713 i16size=$shortsize
10714 u16size=$shortsize
10715 ;;
10716 esac
10717 ;;
10718esac
10719case "$i16type" in
10720'') set try -DINT16
10721 if eval $compile; then
10722 case "`./try$exe_ext`" in
10723 int16_t)
10724 i16type=int16_t
10725 u16type=uint16_t
10726 i16size=2
10727 u16size=2
10728 ;;
10729 esac
10730 fi
10731 ;;
10732esac
10733case "$i16type" in
10734'') if $test $shortsize -ge 2; then
10735 i16type=short
10736 u16type="unsigned short"
10737 i16size=$shortsize
10738 u16size=$shortsize
10739 fi
10740 ;;
10741esac
10742
10743case "$i32type" in
10744'') case "$longsize" in
10745 4) i32type=long
10746 u32type="unsigned long"
10747 i32size=$longsize
10748 u32size=$longsize
10749 ;;
10750 *) case "$intsize" in
10751 4) i32type=int
10752 u32type="unsigned int"
10753 i32size=$intsize
10754 u32size=$intsize
10755 ;;
10756 esac
10757 ;;
10758 esac
10759 ;;
10760esac
10761case "$i32type" in
10762'') set try -DINT32
10763 if eval $compile; then
10764 case "`./try$exe_ext`" in
10765 int32_t)
10766 i32type=int32_t
10767 u32type=uint32_t
10768 i32size=4
10769 u32size=4
10770 ;;
10771 esac
10772 fi
10773 ;;
10774esac
10775case "$i32type" in
10776'') if $test $intsize -ge 4; then
10777 i32type=int
10778 u32type="unsigned int"
10779 i32size=$intsize
10780 u32size=$intsize
10781 fi
10782 ;;
10783esac
10784
10785case "$i64type" in
10786'') case "$d_quad:$quadtype" in
10787 define:?*)
10788 i64type="$quadtype"
10789 u64type="$uquadtype"
10790 i64size=8
10791 u64size=8
10792 ;;
10793 esac
10794 ;;
10795esac
10796
1d1be0dc
NC
10797$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10798: volatile so that the compiler has to store it out to memory.
10799if test X"$d_volatile" = X"$define"; then
10800 volatile=volatile
10801fi
b4eb6b3d
JH
10802$cat <<EOP >try.c
10803#include <stdio.h>
1d1be0dc
NC
10804#include <sys/types.h>
10805#include <signal.h>
10806#ifdef SIGFPE
10807$volatile int bletched = 0;
10808$signal_t blech(s) int s; { bletched = 1; }
10809#endif
b4eb6b3d
JH
10810int main() {
10811 $uvtype u = 0;
1d1be0dc 10812 $nvtype d;
b4eb6b3d
JH
10813 int n = 8 * $uvsize;
10814 int i;
1d1be0dc
NC
10815#ifdef SIGFPE
10816 signal(SIGFPE, blech);
10817#endif
10818
b4eb6b3d
JH
10819 for (i = 0; i < n; i++) {
10820 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
10821 d = ($nvtype)u;
10822 if (($uvtype)d != u)
b4eb6b3d 10823 break;
1d1be0dc
NC
10824 if (d <= 0)
10825 break;
10826 d = ($nvtype)(u - 1);
10827 if (($uvtype)d != (u - 1))
10828 break;
10829#ifdef SIGFPE
10830 if (bletched) {
10831 break;
10832#endif
10833 }
b4eb6b3d 10834 }
efd1522b 10835 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
10836 exit(0);
10837}
10838EOP
1d1be0dc
NC
10839set try
10840
10841d_nv_preserves_uv="$undef"
10842if eval $compile; then
10843 d_nv_preserves_uv_bits="`./try$exe_ext`"
10844fi
10845case "$d_nv_preserves_uv_bits" in
10846\-[1-9]*)
10847 d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10848 $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs." 2>&1
10849 d_nv_preserves_uv="$define"
b4eb6b3d 10850 ;;
1d1be0dc
NC
10851[1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs." 2>&1
10852 d_nv_preserves_uv="$undef" ;;
10853*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
10854 d_nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
10855esac
10856
1d1be0dc
NC
10857$rm -f try.* try
10858
b4eb6b3d
JH
10859
10860: check for off64_t
10861echo " "
10862echo "Checking to see if you have off64_t..." >&4
10863$cat >try.c <<EOCP
10864#include <sys/types.h>
10865#include <unistd.h>
10866int main() { off64_t x = 7; }
10867EOCP
10868set try
10869if eval $compile; then
10870 val="$define"
10871 echo "You have off64_t."
10872else
10873 val="$undef"
10874 echo "You do not have off64_t."
10875 case "$lseeksize" in
10876 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10877 esac
10878fi
10879$rm -f try.* try
10880set d_off64_t
10881eval $setvar
10882
10883: see if POSIX threads are available
10884set pthread.h i_pthread
10885eval $inhdr
10886
10887
10888
10889
10890: how to create joinable pthreads
10891if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10892 echo " "
10893 echo "Checking what constant to use for creating joinable pthreads..." >&4
10894 $cat >try.c <<'EOCP'
10895#include <pthread.h>
10896int main() {
10897 int detachstate = JOINABLE;
10898}
10899EOCP
10900 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10901 if eval $compile; then
10902 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10903 val="$undef" # Yes, undef.
10904 set d_old_pthread_create_joinable
10905 eval $setvar
10906 val=""
10907 set old_pthread_create_joinable
10908 eval $setvar
10909 else
10910 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10911 if eval $compile; then
10912 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10913 val="$define"
10914 set d_old_pthread_create_joinable
10915 eval $setvar
10916 val=PTHREAD_CREATE_UNDETACHED
10917 set old_pthread_create_joinable
10918 eval $setvar
10919 else
10920 set try -DJOINABLE=__UNDETACHED
10921 if eval $compile; then
10922 echo "You seem to use __UNDETACHED." >&4
10923 val="$define"
10924 set d_old_pthread_create_joinable
10925 eval $setvar
10926 val=__UNDETACHED
10927 set old_pthread_create_joinable
10928 eval $setvar
10929 else
10930 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
10931 val="$define"
10932 set d_old_pthread_create_joinable
10933 eval $setvar
10934 val=0
10935 set old_pthread_create_joinable
10936 eval $setvar
10937 fi
10938 fi
10939 fi
10940 $rm -f try try.*
10941else
10942 d_old_pthread_create_joinable="$undef"
10943 old_pthread_create_joinable=""
10944fi
10945
10946: see if pause exists
10947set pause d_pause
10948eval $inlibc
10949
10950: see if pipe exists
10951set pipe d_pipe
10952eval $inlibc
10953
10954: see if poll exists
10955set poll d_poll
10956eval $inlibc
10957
10958
10959: see whether the various POSIXish _yields exist
10960$cat >try.c <<EOP
10961#include <pthread.h>
10962#include <stdio.h>
10963int main() {
10964#ifdef SCHED_YIELD
10965 sched_yield();
10966#else
10967#ifdef PTHREAD_YIELD
10968 pthread_yield();
10969#else
10970#ifdef PTHREAD_YIELD_NULL
10971 pthread_yield(NULL);
10972#endif
10973#endif
10974#endif
10975}
10976EOP
10977: see if sched_yield exists
10978set try -DSCHED_YIELD
10979if eval $compile; then
10980 val="$define"
10981 sched_yield='sched_yield()'
10982else
10983 val="$undef"
10984fi
10985case "$usethreads" in
10986$define)
10987 case "$val" in
10988 $define) echo 'sched_yield() found.' >&4 ;;
10989 *) echo 'sched_yield() NOT found.' >&4 ;;
10990 esac
10991esac
10992set d_sched_yield
10993eval $setvar
10994
10995: see if pthread_yield exists
10996set try -DPTHREAD_YIELD
10997if eval $compile; then
10998 val="$define"
10999 case "$sched_yield" in
11000 '') sched_yield='pthread_yield()' ;;
11001 esac
11002else
11003 set try -DPTHREAD_YIELD_NULL
11004 if eval $compile; then
11005 val="$define"
11006 case "$sched_yield" in
11007 '') sched_yield='pthread_yield(NULL)' ;;
11008 esac
11009 else
11010 val="$undef"
11011 fi
11012fi
11013case "$usethreads" in
11014$define)
11015 case "$val" in
11016 $define) echo 'pthread_yield() found.' >&4 ;;
11017 *) echo 'pthread_yield() NOT found.' >&4 ;;
11018 esac
11019 ;;
11020esac
11021set d_pthread_yield
11022eval $setvar
11023
11024case "$sched_yield" in
11025'') sched_yield=undef ;;
11026esac
11027
11028$rm -f try try.*
11029
11030: see if this is a pwd.h system
11031set pwd.h i_pwd
11032eval $inhdr
11033
11034case "$i_pwd" in
11035$define)
11036 xxx=`./findhdr pwd.h`
11037 $cppstdin $cppflags $cppminus < $xxx >$$.h
11038
11039 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11040 val="$define"
11041 else
11042 val="$undef"
11043 fi
11044 set d_pwquota
11045 eval $setvar
11046
11047 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11048 val="$define"
11049 else
11050 val="$undef"
11051 fi
11052 set d_pwage
11053 eval $setvar
11054
11055 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11056 val="$define"
11057 else
11058 val="$undef"
11059 fi
11060 set d_pwchange
11061 eval $setvar
11062
11063 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11064 val="$define"
11065 else
11066 val="$undef"
11067 fi
11068 set d_pwclass
11069 eval $setvar
11070
11071 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11072 val="$define"
11073 else
11074 val="$undef"
11075 fi
11076 set d_pwexpire
11077 eval $setvar
11078
11079 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11080 val="$define"
11081 else
11082 val="$undef"
11083 fi
11084 set d_pwcomment
11085 eval $setvar
11086
11087 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11088 val="$define"
11089 else
11090 val="$undef"
11091 fi
11092 set d_pwgecos
11093 eval $setvar
11094
11095 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11096 val="$define"
11097 else
11098 val="$undef"
11099 fi
11100 set d_pwpasswd
11101 eval $setvar
11102
11103 $rm -f $$.h
11104 ;;
11105*)
11106 val="$undef";
11107 set d_pwquota; eval $setvar
11108 set d_pwage; eval $setvar
11109 set d_pwchange; eval $setvar
11110 set d_pwclass; eval $setvar
11111 set d_pwexpire; eval $setvar
11112 set d_pwcomment; eval $setvar
11113 set d_pwgecos; eval $setvar
11114 set d_pwpasswd; eval $setvar
11115 ;;
11116esac
11117
11118: see if readdir and friends exist
11119set readdir d_readdir
11120eval $inlibc
11121set seekdir d_seekdir
11122eval $inlibc
11123set telldir d_telldir
11124eval $inlibc
11125set rewinddir d_rewinddir
11126eval $inlibc
11127
11128: see if readlink exists
11129set readlink d_readlink
11130eval $inlibc
11131
4e0554ec
JH
11132: see if readv exists
11133set readv d_readv
11134eval $inlibc
11135
640374d0
JH
11136: see if realpath exists
11137set realpath d_realpath
11138eval $inlibc
11139
4e0554ec
JH
11140: see if recvmsg exists
11141set recvmsg d_recvmsg
11142eval $inlibc
11143
b4eb6b3d
JH
11144: see if rename exists
11145set rename d_rename
11146eval $inlibc
11147
11148: see if rmdir exists
11149set rmdir d_rmdir
11150eval $inlibc
11151
11152: see if memory.h is available.
11153val=''
11154set memory.h val
11155eval $inhdr
11156
11157: See if it conflicts with string.h
11158case "$val" in
11159$define)
11160 case "$strings" in
11161 '') ;;
11162 *)
11163 $cppstdin $cppflags $cppminus < $strings > mem.h
11164 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11165 echo " "
11166 echo "We won't be including <memory.h>."
11167 val="$undef"
11168 fi
11169 $rm -f mem.h
11170 ;;
11171 esac
11172esac
11173set i_memory
11174eval $setvar
11175
11176: can bcopy handle overlapping blocks?
11177val="$undef"
11178case "$d_bcopy" in
11179"$define")
11180 echo " "
11181 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
11182 $cat >try.c <<EOCP
11183#$i_memory I_MEMORY
11184#$i_stdlib I_STDLIB
11185#$i_string I_STRING
11186#$i_unistd I_UNISTD
11187EOCP
11188 $cat >>try.c <<'EOCP'
11189#include <stdio.h>
11190#ifdef I_MEMORY
11191# include <memory.h>
11192#endif
11193#ifdef I_STDLIB
11194# include <stdlib.h>
11195#endif
11196#ifdef I_STRING
11197# include <string.h>
11198#else
11199# include <strings.h>
11200#endif
11201#ifdef I_UNISTD
11202# include <unistd.h> /* Needed for NetBSD */
11203#endif
11204int main()
11205{
11206char buf[128], abc[128];
11207char *b;
11208int len;
11209int off;
11210int align;
11211
11212bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11213
11214for (align = 7; align >= 0; align--) {
11215 for (len = 36; len; len--) {
11216 b = buf+align;
11217 bcopy(abc, b, len);
11218 for (off = 1; off <= len; off++) {
11219 bcopy(b, b+off, len);
11220 bcopy(b+off, b, len);
11221 if (bcmp(b, abc, len))
11222 exit(1);
11223 }
11224 }
11225}
11226exit(0);
11227}
11228EOCP
11229 set try
11230 if eval $compile_ok; then
11231 if ./try 2>/dev/null; then
11232 echo "Yes, it can."
11233 val="$define"
11234 else
11235 echo "It can't, sorry."
11236 case "$d_memmove" in
11237 "$define") echo "But that's Ok since you have memmove()." ;;
11238 esac
11239 fi
11240 else
11241 echo "(I can't compile the test program, so we'll assume not...)"
11242 case "$d_memmove" in
11243 "$define") echo "But that's Ok since you have memmove()." ;;
11244 esac
11245 fi
11246 ;;
11247esac
11248$rm -f try.* try core
11249set d_safebcpy
11250eval $setvar
11251
11252: can memcpy handle overlapping blocks?
11253val="$undef"
11254case "$d_memcpy" in
11255"$define")
11256 echo " "
11257 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
11258 $cat >try.c <<EOCP
11259#$i_memory I_MEMORY
11260#$i_stdlib I_STDLIB
11261#$i_string I_STRING
11262#$i_unistd I_UNISTD
11263EOCP
11264 $cat >>try.c <<'EOCP'
11265#include <stdio.h>
11266#ifdef I_MEMORY
11267# include <memory.h>
11268#endif
11269#ifdef I_STDLIB
11270# include <stdlib.h>
11271#endif
11272#ifdef I_STRING
11273# include <string.h>
11274#else
11275# include <strings.h>
11276#endif
11277#ifdef I_UNISTD
11278# include <unistd.h> /* Needed for NetBSD */
11279#endif
11280int main()
11281{
11282char buf[128], abc[128];
11283char *b;
11284int len;
11285int off;
11286int align;
11287
11288/* Copy "abcde..." string to char abc[] so that gcc doesn't
11289 try to store the string in read-only memory. */
11290memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11291
11292for (align = 7; align >= 0; align--) {
11293 for (len = 36; len; len--) {
11294 b = buf+align;
11295 memcpy(b, abc, len);
11296 for (off = 1; off <= len; off++) {
11297 memcpy(b+off, b, len);
11298 memcpy(b, b+off, len);
11299 if (memcmp(b, abc, len))
11300 exit(1);
11301 }
11302 }
11303}
11304exit(0);
11305}
11306EOCP
11307 set try
11308 if eval $compile_ok; then
11309 if ./try 2>/dev/null; then
11310 echo "Yes, it can."
11311 val="$define"
11312 else
11313 echo "It can't, sorry."
11314 case "$d_memmove" in
11315 "$define") echo "But that's Ok since you have memmove()." ;;
11316 esac
11317 fi
11318 else
11319 echo "(I can't compile the test program, so we'll assume not...)"
11320 case "$d_memmove" in
11321 "$define") echo "But that's Ok since you have memmove()." ;;
11322 esac
11323 fi
11324 ;;
11325esac
11326$rm -f try.* try core
11327set d_safemcpy
11328eval $setvar
11329
11330: can memcmp be trusted to compare relative magnitude?
11331val="$undef"
11332case "$d_memcmp" in
11333"$define")
11334 echo " "
11335 echo "Checking if your memcmp() can compare relative magnitude..." >&4
11336 $cat >try.c <<EOCP
11337#$i_memory I_MEMORY
11338#$i_stdlib I_STDLIB
11339#$i_string I_STRING
11340#$i_unistd I_UNISTD
11341EOCP
11342 $cat >>try.c <<'EOCP'
11343#include <stdio.h>
11344#ifdef I_MEMORY
11345# include <memory.h>
11346#endif
11347#ifdef I_STDLIB
11348# include <stdlib.h>
11349#endif
11350#ifdef I_STRING
11351# include <string.h>
11352#else
11353# include <strings.h>
11354#endif
11355#ifdef I_UNISTD
11356# include <unistd.h> /* Needed for NetBSD */
11357#endif
11358int main()
11359{
11360char a = -1;
11361char b = 0;
11362if ((a < b) && memcmp(&a, &b, 1) < 0)
11363 exit(1);
11364exit(0);
11365}
11366EOCP
11367 set try
11368 if eval $compile_ok; then
11369 if ./try 2>/dev/null; then
11370 echo "Yes, it can."
11371 val="$define"
11372 else
11373 echo "No, it can't (it uses signed chars)."
11374 fi
11375 else
11376 echo "(I can't compile the test program, so we'll assume not...)"
11377 fi
11378 ;;
11379esac
11380$rm -f try.* try core
11381set d_sanemcmp
11382eval $setvar
11383
ef9f17be
JH
11384: see if prototype for sbrk is available
11385echo " "
11386set d_sbrkproto sbrk $i_unistd unistd.h
11387eval $hasproto
11388
b4eb6b3d
JH
11389: see if select exists
11390set select d_select
11391eval $inlibc
11392
11393: see if semctl exists
11394set semctl d_semctl
11395eval $inlibc
11396
11397: see if semget exists
11398set semget d_semget
11399eval $inlibc
11400
11401: see if semop exists
11402set semop d_semop
11403eval $inlibc
11404
11405: see how much of the 'sem*(2)' library is present.
11406h_sem=true
11407echo " "
11408case "$d_semctl$d_semget$d_semop" in
11409*"$undef"*) h_sem=false;;
11410esac
11411case "$osname" in
11412freebsd)
11413 case "`ipcs 2>&1`" in
11414 "SVID messages"*"not configured"*)
11415 echo "Your $osname does not have the sem*(2) configured." >&4
11416 h_sem=false
11417 val="$undef"
11418 set semctl d_semctl
11419 eval $setvar
11420 set semget d_semget
11421 eval $setvar
11422 set semop d_semop
11423 eval $setvar
11424 ;;
11425 esac
11426 ;;
11427esac
11428: we could also check for sys/ipc.h ...
11429if $h_sem && $test `./findhdr sys/sem.h`; then
11430 echo "You have the full sem*(2) library." >&4
11431 val="$define"
11432else
11433 echo "You don't have the full sem*(2) library." >&4
11434 val="$undef"
11435fi
11436set d_sem
11437eval $setvar
11438
11439: see whether sys/sem.h defines union semun
11440echo " "
11441$cat > try.c <<'END'
11442#include <sys/types.h>
11443#include <sys/ipc.h>
11444#include <sys/sem.h>
11445int main () { union semun semun; semun.buf = 0; }
11446END
11447set try
11448if eval $compile; then
11449 echo "You have union semun in <sys/sem.h>." >&4
11450 val="$define"
11451else
11452 echo "You do not have union semun in <sys/sem.h>." >&4
11453 val="$undef"
11454fi
11455$rm -f try try.c try.h
11456set d_union_semun
11457eval $setvar
11458
11459: see how to do semctl IPC_STAT
11460case "$d_sem" in
11461$define)
11462 : see whether semctl IPC_STAT can use union semun
11463 echo " "
11464 $cat > try.h <<END
11465#ifndef S_IRUSR
11466# ifdef S_IREAD
11467# define S_IRUSR S_IREAD
11468# define S_IWUSR S_IWRITE
11469# define S_IXUSR S_IEXEC
11470# else
11471# define S_IRUSR 0400
11472# define S_IWUSR 0200
11473# define S_IXUSR 0100
11474# endif
11475# define S_IRGRP (S_IRUSR>>3)
11476# define S_IWGRP (S_IWUSR>>3)
11477# define S_IXGRP (S_IXUSR>>3)
11478# define S_IROTH (S_IRUSR>>6)
11479# define S_IWOTH (S_IWUSR>>6)
11480# define S_IXOTH (S_IXUSR>>6)
11481#endif
11482#ifndef S_IRWXU
11483# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11484# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11485# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11486#endif
11487END
11488
11489 $cat > try.c <<END
11490#include <sys/types.h>
11491#include <sys/ipc.h>
11492#include <sys/sem.h>
11493#include <sys/stat.h>
11494#include <stdio.h>
11495#include <errno.h>
11496#include "try.h"
11497#ifndef errno
11498extern int errno;
11499#endif
11500#$d_union_semun HAS_UNION_SEMUN
11501int main() {
11502 union semun
11503#ifndef HAS_UNION_SEMUN
11504 {
11505 int val;
11506 struct semid_ds *buf;
11507 unsigned short *array;
11508 }
11509#endif
11510 arg;
11511 int sem, st;
11512
11513#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11514 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11515 if (sem > -1) {
11516 struct semid_ds argbuf;
11517 arg.buf = &argbuf;
11518# ifdef IPC_STAT
11519 st = semctl(sem, 0, IPC_STAT, arg);
11520 if (st == 0)
11521 printf("semun\n");
11522 else
11523# endif /* IPC_STAT */
11524 printf("semctl IPC_STAT failed: errno = %d\n", errno);
11525# ifdef IPC_RMID
11526 if (semctl(sem, 0, IPC_RMID, arg) != 0)
11527# endif /* IPC_RMID */
11528 printf("semctl IPC_RMID failed: errno = %d\n", errno);
11529 } else
11530#endif /* IPC_PRIVATE && ... */
11531 printf("semget failed: errno = %d\n", errno);
11532 return 0;
11533}
11534END
11535 val="$undef"
11536 set try
11537 if eval $compile; then
11538 xxx=`./try`
11539 case "$xxx" in
11540 semun) val="$define" ;;
11541 esac
11542 fi
11543 $rm -f try try.c
11544 set d_semctl_semun
11545 eval $setvar
11546 case "$d_semctl_semun" in
11547 $define)
11548 echo "You can use union semun for semctl IPC_STAT." >&4
11549 also='also'
11550 ;;
11551 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
11552 also=''
11553 ;;
11554 esac
11555
11556 : see whether semctl IPC_STAT can use struct semid_ds pointer
11557 $cat > try.c <<'END'
11558#include <sys/types.h>
11559#include <sys/ipc.h>
11560#include <sys/sem.h>
11561#include <sys/stat.h>
11562#include "try.h"
11563#include <stdio.h>
11564#include <errno.h>
11565#ifndef errno
11566extern int errno;
11567#endif
11568int main() {
11569 struct semid_ds arg;
11570 int sem, st;
11571
11572#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11573 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11574 if (sem > -1) {
11575# ifdef IPC_STAT
11576 st = semctl(sem, 0, IPC_STAT, &arg);
11577 if (st == 0)
11578 printf("semid_ds\n");
11579 else
11580# endif /* IPC_STAT */
11581 printf("semctl IPC_STAT failed: errno = %d\n", errno);
11582# ifdef IPC_RMID
11583 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11584# endif /* IPC_RMID */
11585 printf("semctl IPC_RMID failed: errno = %d\n", errno);
11586 } else
11587#endif /* IPC_PRIVATE && ... */
11588 printf("semget failed: errno = %d\n", errno);
11589
11590 return 0;
11591}
11592END
11593 val="$undef"
11594 set try
11595 if eval $compile; then
11596 xxx=`./try`
11597 case "$xxx" in
11598 semid_ds) val="$define" ;;
11599 esac
11600 fi
11601 $rm -f try try.c
11602 set d_semctl_semid_ds
11603 eval $setvar
11604 case "$d_semctl_semid_ds" in
11605 $define)
11606 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11607 ;;
11608 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11609 ;;
11610 esac
11611 $rm -f try.h
11612 ;;
11613*) val="$undef"
11614
11615 # We do not have the full sem*(2) library, so assume we can not
11616 # use either.
11617
11618 set d_semctl_semun
11619 eval $setvar
11620
11621 set d_semctl_semid_ds
11622 eval $setvar
11623 ;;
11624esac
11625
4e0554ec
JH
11626: see if sendmsg exists
11627set sendmsg d_sendmsg
11628eval $inlibc
11629
b4eb6b3d
JH
11630: see if setegid exists
11631set setegid d_setegid
11632eval $inlibc
11633
11634: see if seteuid exists
11635set seteuid d_seteuid
11636eval $inlibc
11637
11638: see if setgrent exists
11639set setgrent d_setgrent
11640eval $inlibc
11641
11642: see if sethostent exists
11643set sethostent d_sethent
11644eval $inlibc
11645
4e0554ec
JH
11646: see if setitimer exists
11647set setitimer d_setitimer
11648eval $inlibc
11649
b4eb6b3d
JH
11650: see if setlinebuf exists
11651set setlinebuf d_setlinebuf
11652eval $inlibc
11653
11654: see if setlocale exists
11655set setlocale d_setlocale
11656eval $inlibc
11657
11658: see if setnetent exists
11659set setnetent d_setnent
11660eval $inlibc
11661
11662: see if setprotoent exists
11663set setprotoent d_setpent
11664eval $inlibc
11665
11666: see if setpgid exists
11667set setpgid d_setpgid
11668eval $inlibc
11669
11670: see if setpgrp2 exists
11671set setpgrp2 d_setpgrp2
11672eval $inlibc
11673
11674: see if setpriority exists
11675set setpriority d_setprior
11676eval $inlibc
11677
11678: see if setproctitle exists
11679set setproctitle d_setproctitle
11680eval $inlibc
11681
11682: see if setpwent exists
11683set setpwent d_setpwent
11684eval $inlibc
11685
11686: see if setregid exists
11687set setregid d_setregid
11688eval $inlibc
11689set setresgid d_setresgid
11690eval $inlibc
11691
11692: see if setreuid exists
11693set setreuid d_setreuid
11694eval $inlibc
11695set setresuid d_setresuid
11696eval $inlibc
11697
11698: see if setrgid exists
11699set setrgid d_setrgid
11700eval $inlibc
11701
11702: see if setruid exists
11703set setruid d_setruid
11704eval $inlibc
11705
11706: see if setservent exists
11707set setservent d_setsent
11708eval $inlibc
11709
11710: see if setsid exists
11711set setsid d_setsid
11712eval $inlibc
11713
11714: see if setvbuf exists
11715set setvbuf d_setvbuf
11716eval $inlibc
11717
11718: see if sfio.h is available
11719set sfio.h i_sfio
11720eval $inhdr
11721
11722
11723: see if sfio library is available
11724case "$i_sfio" in
11725$define)
11726 val=''
11727 set sfreserve val
11728 eval $inlibc
11729 ;;
11730*)
11731 val="$undef"
11732 ;;
11733esac
11734: Ok, but do we want to use it.
11735case "$val" in
11736$define)
11737 case "$usesfio" in
11738 true|$define|[yY]*) dflt='y';;
11739 *) dflt='n';;
11740 esac
11741 echo "$package can use the sfio library, but it is experimental."
11742 case "$useperlio" in
11743 "$undef")
11744 echo "For sfio also the PerlIO abstraction layer is needed."
11745 echo "Earlier you said you wouldn't want that."
11746 ;;
11747 esac
11748 rp="You seem to have sfio available, do you want to try using it?"
11749 . ./myread
11750 case "$ans" in
11751 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
11752 useperlio="$define"
11753 val="$define"
11754 ;;
11755 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
11756 val="$undef"
b4eb6b3d
JH
11757 ;;
11758 esac
11759 ;;
11760*) case "$usesfio" in
11761 true|$define|[yY]*)
11762 echo "Sorry, cannot find sfio on this machine." >&4
11763 echo "Ignoring your setting of usesfio=$usesfio." >&4
11764 val="$undef"
11765 ;;
11766 esac
11767 ;;
11768esac
11769set d_sfio
11770eval $setvar
11771case "$d_sfio" in
11772$define) usesfio='true';;
11773*) usesfio='false';;
11774esac
3659ebf1
JH
11775case "$d_sfio" in
11776$define) ;;
11777*) : Remove sfio from list of libraries to use
11778 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11779 shift
11780 libs="$*"
11781 echo "libs = $libs" >&4
11782;;
11783esac
11784
b4eb6b3d
JH
11785
11786: see if shmctl exists
11787set shmctl d_shmctl
11788eval $inlibc
11789
11790: see if shmget exists
11791set shmget d_shmget
11792eval $inlibc
11793
11794: see if shmat exists
11795set shmat d_shmat
11796eval $inlibc
11797: see what shmat returns
11798case "$d_shmat" in
11799"$define")
11800 $cat >shmat.c <<'END'
11801#include <sys/shm.h>
11802void *shmat();
11803END
11804 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11805 shmattype='void *'
11806 else
11807 shmattype='char *'
11808 fi
11809 echo "and it returns ($shmattype)." >&4
11810 : see if a prototype for shmat is available
11811 xxx=`./findhdr sys/shm.h`
11812 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11813 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11814 val="$define"
11815 else
11816 val="$undef"
11817 fi
11818 $rm -f shmat.[co]
11819 ;;
11820*)
11821 val="$undef"
11822 ;;
11823esac
11824set d_shmatprototype
11825eval $setvar
11826
11827: see if shmdt exists
11828set shmdt d_shmdt
11829eval $inlibc
11830
11831: see how much of the 'shm*(2)' library is present.
11832h_shm=true
11833echo " "
11834case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11835*"$undef"*) h_shm=false;;
11836esac
11837case "$osname" in
11838freebsd)
11839 case "`ipcs 2>&1`" in
11840 "SVID shared memory"*"not configured"*)
11841 echo "Your $osname does not have the shm*(2) configured." >&4
11842 h_shm=false
11843 val="$undef"
11844 set shmctl d_shmctl
11845 evat $setvar
11846 set shmget d_shmget
11847 evat $setvar
11848 set shmat d_shmat
11849 evat $setvar
11850 set shmdt d_shmdt
11851 evat $setvar
11852 ;;
11853 esac
11854 ;;
11855esac
11856: we could also check for sys/ipc.h ...
11857if $h_shm && $test `./findhdr sys/shm.h`; then
11858 echo "You have the full shm*(2) library." >&4
11859 val="$define"
11860else
11861 echo "You don't have the full shm*(2) library." >&4
11862 val="$undef"
11863fi
11864set d_shm
11865eval $setvar
11866
11867echo " "
11868: see if we have sigaction
11869if set sigaction val -f d_sigaction; eval $csym; $val; then
11870 echo 'sigaction() found.' >&4
11871 $cat > try.c <<'EOP'
11872#include <stdio.h>
11873#include <sys/types.h>
11874#include <signal.h>
11875int main()
11876{
11877 struct sigaction act, oact;
11878 act.sa_flags = 0;
11879 oact.sa_handler = 0;
11880 /* so that act and oact are used */
11881 exit(act.sa_flags == 0 && oact.sa_handler == 0);
11882}
11883EOP
11884 set try
11885 if eval $compile_ok; then
11886 val="$define"
11887 else
11888 echo "But you don't seem to have a useable struct sigaction." >&4
11889 val="$undef"
11890 fi
11891else
11892 echo 'sigaction NOT found.' >&4
11893 val="$undef"
11894fi
11895set d_sigaction; eval $setvar
11896$rm -f try try$_o try.c
11897
983dbef6
JH
11898: see if sigprocmask exists
11899set sigprocmask d_sigprocmask
11900eval $inlibc
11901
b4eb6b3d
JH
11902: see if sigsetjmp exists
11903echo " "
11904case "$d_sigsetjmp" in
11905'')
11906 $cat >try.c <<'EOP'
11907#include <setjmp.h>
11908sigjmp_buf env;
11909int set = 1;
11910int main()
11911{
11912 if (sigsetjmp(env,1))
11913 exit(set);
11914 set = 0;
11915 siglongjmp(env, 1);
11916 exit(1);
11917}
11918EOP
11919 set try
11920 if eval $compile; then
11921 if ./try >/dev/null 2>&1; then
11922 echo "POSIX sigsetjmp found." >&4
11923 val="$define"
11924 else
11925 $cat >&4 <<EOM
11926Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11927I'll ignore them.
11928EOM
11929 val="$undef"
11930 fi
11931 else
11932 echo "sigsetjmp not found." >&4
11933 val="$undef"
11934 fi
11935 ;;
11936*) val="$d_sigsetjmp"
11937 case "$d_sigsetjmp" in
11938 $define) echo "POSIX sigsetjmp found." >&4;;
11939 $undef) echo "sigsetjmp not found." >&4;;
11940 esac
11941 ;;
11942esac
11943set d_sigsetjmp
11944eval $setvar
11945$rm -f try.c try
11946
49a78c82
JH
11947: see if sockatmark exists
11948set sockatmark d_sockatmark
11949eval $inlibc
11950
2ef53570
JH
11951: see if prototype for sockatmark is available
11952echo " "
11953set d_sockatmarkproto sockatmark $d_socket sys/socket.h
11954eval $hasproto
11955
b4eb6b3d
JH
11956: see if socks5_init exists
11957set socks5_init d_socks5_init
11958eval $inlibc
11959
eef837ea
JH
11960: see if prototype for setresgid is available
11961echo " "
11962set d_sresgproto setresgid $i_unistd unistd.h
11963eval $hasproto
11964
640374d0
JH
11965: see if prototype for setresuid is available
11966echo " "
11967set d_sresuproto setresuid $i_unistd unistd.h
11968eval $hasproto
11969
b4eb6b3d
JH
11970: see if sys/stat.h is available
11971set sys/stat.h i_sysstat
11972eval $inhdr
11973
11974
11975: see if stat knows about block sizes
11976echo " "
11977echo "Checking to see if your struct stat has st_blocks field..." >&4
11978set d_statblks stat st_blocks $i_sysstat sys/stat.h
11979eval $hasfield
11980
11981
11982: see if this is a sys/vfs.h system
11983set sys/vfs.h i_sysvfs
11984eval $inhdr
11985
11986
11987: see if this is a sys/statfs.h system
11988set sys/statfs.h i_sysstatfs
11989eval $inhdr
11990
11991
11992echo " "
11993echo "Checking to see if your system supports struct statfs..." >&4
11994set 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
11995eval $hasstruct
11996case "$d_statfs_s" in
11997"$define") echo "Yes, it does." ;;
11998*) echo "No, it doesn't." ;;
11999esac
12000
12001
12002
12003: see if struct statfs knows about f_flags
12004case "$d_statfs_s" in
12005define)
12006 echo " "
12007 echo "Checking to see if your struct statfs has f_flags field..." >&4
12008 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
12009 eval $hasfield
12010 ;;
12011*) val="$undef"
12012 set d_statfs_f_flags
12013 eval $setvar
12014 ;;
12015esac
12016case "$d_statfs_f_flags" in
12017"$define") echo "Yes, it does." ;;
12018*) echo "No, it doesn't." ;;
12019esac
12020
12021: see if _ptr and _cnt from stdio act std
12022echo " "
80f36755
NC
12023
12024if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12025 echo "(Looks like you have stdio.h from BSD.)"
12026 case "$stdio_ptr" in
12027 '') stdio_ptr='((fp)->_p)'
12028 ptr_lval=$define
12029 ;;
12030 *) ptr_lval=$d_stdio_ptr_lval;;
12031 esac
12032 case "$stdio_cnt" in
12033 '') stdio_cnt='((fp)->_r)'
12034 cnt_lval=$define
12035 ;;
12036 *) cnt_lval=$d_stdio_cnt_lval;;
12037 esac
12038 case "$stdio_base" in
12039 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12040 esac
12041 case "$stdio_bufsiz" in
12042 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12043 esac
12044elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
b4eb6b3d
JH
12045 echo "(Looks like you have stdio.h from Linux.)"
12046 case "$stdio_ptr" in
12047 '') stdio_ptr='((fp)->_IO_read_ptr)'
12048 ptr_lval=$define
12049 ;;
12050 *) ptr_lval=$d_stdio_ptr_lval;;
12051 esac
12052 case "$stdio_cnt" in
12053 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12054 cnt_lval=$undef
12055 ;;
12056 *) cnt_lval=$d_stdio_cnt_lval;;
12057 esac
12058 case "$stdio_base" in
12059 '') stdio_base='((fp)->_IO_read_base)';;
12060 esac
12061 case "$stdio_bufsiz" in
12062 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12063 esac
12064else
12065 case "$stdio_ptr" in
12066 '') stdio_ptr='((fp)->_ptr)'
12067 ptr_lval=$define
12068 ;;
12069 *) ptr_lval=$d_stdio_ptr_lval;;
12070 esac
12071 case "$stdio_cnt" in
12072 '') stdio_cnt='((fp)->_cnt)'
12073 cnt_lval=$define
12074 ;;
12075 *) cnt_lval=$d_stdio_cnt_lval;;
12076 esac
12077 case "$stdio_base" in
12078 '') stdio_base='((fp)->_base)';;
12079 esac
12080 case "$stdio_bufsiz" in
12081 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12082 esac
12083fi
80f36755 12084
b4eb6b3d
JH
12085: test whether _ptr and _cnt really work
12086echo "Checking how std your stdio is..." >&4
12087$cat >try.c <<EOP
12088#include <stdio.h>
12089#define FILE_ptr(fp) $stdio_ptr
12090#define FILE_cnt(fp) $stdio_cnt
12091int main() {
12092 FILE *fp = fopen("try.c", "r");
12093 char c = getc(fp);
12094 if (
12095 18 <= FILE_cnt(fp) &&
12096 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12097 )
12098 exit(0);
12099 exit(1);
12100}
12101EOP
12102val="$undef"
12103set try
12104if eval $compile; then
12105 if ./try; then
12106 echo "Your stdio acts pretty std."
12107 val="$define"
12108 else
12109 echo "Your stdio isn't very std."
12110 fi
12111else
12112 echo "Your stdio doesn't appear very std."
12113fi
12114$rm -f try.c try
12115set d_stdstdio
12116eval $setvar
12117
12118: Can _ptr be used as an lvalue?
12119case "$d_stdstdio$ptr_lval" in
12120$define$define) val=$define ;;
12121*) val=$undef ;;
12122esac
12123set d_stdio_ptr_lval
12124eval $setvar
12125
12126: Can _cnt be used as an lvalue?
12127case "$d_stdstdio$cnt_lval" in
12128$define$define) val=$define ;;
12129*) val=$undef ;;
12130esac
12131set d_stdio_cnt_lval
12132eval $setvar
12133
a7ffa9b9
NC
12134
12135: test whether setting _ptr sets _cnt as a side effect
12136d_stdio_ptr_lval_sets_cnt="$undef"
12137d_stdio_ptr_lval_nochange_cnt="$undef"
12138case "$d_stdio_ptr_lval$d_stdstdio" in
12139$define$define)
12140 echo "Checking to see what happens if we set the stdio ptr..." >&4
12141$cat >try.c <<EOP
12142#include <stdio.h>
12143/* Can we scream? */
12144/* Eat dust sed :-) */
c1d9e6fa 12145/* In the buffer space, no one can hear you scream. */
0bbfc344
JH
12146#define FILE_ptr(fp) $stdio_ptr
12147#define FILE_cnt(fp) $stdio_cnt
c1d9e6fa 12148#include <sys/types.h>
a7ffa9b9
NC
12149int main() {
12150 FILE *fp = fopen("try.c", "r");
c1d9e6fa 12151 int c;
a7ffa9b9
NC
12152 char *ptr;
12153 size_t cnt;
c1d9e6fa
JH
12154 if (!fp) {
12155 puts("Fail even to read");
12156 exit(1);
12157 }
12158 c = getc(fp); /* Read away the first # */
12159 if (c == EOF) {
12160 puts("Fail even to read");
12161 exit(1);
12162 }
a7ffa9b9
NC
12163 if (!(
12164 18 <= FILE_cnt(fp) &&
12165 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12166 )) {
12167 puts("Fail even to read");
12168 exit (1);
12169 }
c1d9e6fa
JH
12170 ptr = (char*) FILE_ptr(fp);
12171 cnt = (size_t)FILE_cnt(fp);
a7ffa9b9 12172
c1d9e6fa 12173 FILE_ptr(fp) += 42;
a7ffa9b9 12174
c1d9e6fa 12175 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
a7ffa9b9
NC
12176 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12177 exit (1);
12178 }
12179 if (FILE_cnt(fp) <= 20) {
12180 printf ("Fail (<20 chars to test)");
12181 exit (1);
12182 }
12183 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12184 puts("Fail compare");
12185 exit (1);
12186 }
12187 if (cnt == FILE_cnt(fp)) {
12188 puts("Pass_unchanged");
12189 exit (0);
12190 }
12191 if (FILE_cnt(fp) == (cnt - 42)) {
12192 puts("Pass_changed");
12193 exit (0);
12194 }
12195 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12196 return 1;
12197
12198}
12199EOP
12200 set try
12201 if eval $compile; then
12202 case `./try$exe_ext` in
12203 Pass_changed)
2e32dcfe 12204 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
a7ffa9b9
NC
12205 d_stdio_ptr_lval_sets_cnt="$define" ;;
12206 Pass_unchanged)
12207 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12208 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12209 Fail*)
12210 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12211 *)
12212 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12213 esac
12214 else
12215 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12216 fi
12217 $rm -f try.c try
12218 ;;
12219esac
12220
b4eb6b3d
JH
12221: see if _base is also standard
12222val="$undef"
12223case "$d_stdstdio" in
12224$define)
12225 $cat >try.c <<EOP
12226#include <stdio.h>
12227#define FILE_base(fp) $stdio_base
12228#define FILE_bufsiz(fp) $stdio_bufsiz
12229int main() {
12230 FILE *fp = fopen("try.c", "r");
12231 char c = getc(fp);
12232 if (
12233 19 <= FILE_bufsiz(fp) &&
12234 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12235 )
12236 exit(0);
12237 exit(1);
12238}
12239EOP
12240 set try
12241 if eval $compile; then
12242 if ./try; then
12243 echo "And its _base field acts std."
12244 val="$define"
12245 else
12246 echo "But its _base field isn't std."
12247 fi
12248 else
12249 echo "However, it seems to be lacking the _base field."
12250 fi
12251 $rm -f try.c try
12252 ;;
12253esac
12254set d_stdiobase
12255eval $setvar
12256
12257$cat >&4 <<EOM
12258Checking how to access stdio streams by file descriptor number...
12259EOM
12260case "$stdio_stream_array" in
12261'') $cat >try.c <<EOCP
12262#include <stdio.h>
12263int main() {
12264 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12265 printf("yes\n");
12266}
12267EOCP
12268 for s in _iob __iob __sF
12269 do
12270 set try -DSTDIO_STREAM_ARRAY=$s
12271 if eval $compile; then
12272 case "`./try$exe_ext`" in
12273 yes) stdio_stream_array=$s; break ;;
12274 esac
12275 fi
12276 done
12277 $rm -f try.* try$exe_ext
12278esac
12279case "$stdio_stream_array" in
12280'') $cat >&4 <<EOM
12281I can't figure out how to access stdio streams by file descriptor number.
12282EOM
12283 d_stdio_stream_array="$undef"
12284 ;;
12285*) $cat >&4 <<EOM
12286You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12287EOM
12288 d_stdio_stream_array="$define"
12289 ;;
12290esac
12291
12292: see if strcoll exists
12293set strcoll d_strcoll
12294eval $inlibc
12295
12296: check for structure copying
12297echo " "
12298echo "Checking to see if your C compiler can copy structs..." >&4
12299$cat >try.c <<'EOCP'
12300int main()
12301{
12302 struct blurfl {
12303 int dyick;
12304 } foo, bar;
12305
12306 foo = bar;
12307}
12308EOCP
12309if $cc -c try.c >/dev/null 2>&1 ; then
12310 val="$define"
12311 echo "Yup, it can."
12312else
12313 val="$undef"
12314 echo "Nope, it can't."
12315fi
12316set d_strctcpy
12317eval $setvar
12318$rm -f try.*
12319
12320: see if strerror and/or sys_errlist[] exist
12321echo " "
12322if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12323 if set strerror val -f d_strerror; eval $csym; $val; then
12324 echo 'strerror() found.' >&4
12325 d_strerror="$define"
12326 d_strerrm='strerror(e)'
12327 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12328 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
12329 d_syserrlst="$define"
12330 else
12331 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12332 d_syserrlst="$undef"
12333 fi
12334 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12335 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12336 echo 'strerror() found in string header.' >&4
12337 d_strerror="$define"
12338 d_strerrm='strerror(e)'
12339 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12340 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12341 d_syserrlst="$define"
12342 else
12343 echo "(You don't appear to have any sys_errlist[], how can this be?)"
12344 d_syserrlst="$undef"
12345 fi
12346 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12347 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12348 d_strerror="$undef"
12349 d_syserrlst="$define"
12350 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12351 else
12352 echo 'strerror() and sys_errlist[] NOT found.' >&4
12353 d_strerror="$undef"
12354 d_syserrlst="$undef"
12355 d_strerrm='"unknown"'
12356 fi
12357fi
12358
b3c85772
JH
12359: see if strftime exists
12360set strftime d_strftime
12361eval $inlibc
12362
b4eb6b3d
JH
12363: see if strtod exists
12364set strtod d_strtod
12365eval $inlibc
12366
12367: see if strtol exists
12368set strtol d_strtol
12369eval $inlibc
12370
12371: see if strtold exists
12372set strtold d_strtold
12373eval $inlibc
12374
12375: see if strtoll exists
12376set strtoll d_strtoll
12377eval $inlibc
12378
12379case "$d_longlong-$d_strtoll" in
12380"$define-$define")
12381 $cat <<EOM
12382Checking whether your strtoll() works okay...
12383EOM
12384 $cat >try.c <<'EOCP'
12385#include <errno.h>
12386#ifdef __hpux
12387#define strtoll __strtoll
12388#endif
e75931a7
YST
12389#ifdef __EMX__
12390#define strtoll _strtoll
12391#endif
b4eb6b3d
JH
12392#include <stdio.h>
12393extern long long int strtoll(char *s, char **, int);
12394static int bad = 0;
12395int check(char *s, long long ell, int een) {
12396 long long gll;
12397 errno = 0;
12398 gll = strtoll(s, 0, 10);
12399 if (!((gll == ell) && (errno == een)))
12400 bad++;
12401}
12402int main() {
12403 check(" 1", 1LL, 0);
12404 check(" 0", 0LL, 0);
12405 check("-1", -1LL, 0);
12406 check("-9223372036854775808", -9223372036854775808LL, 0);
12407 check("-9223372036854775808", -9223372036854775808LL, 0);
12408 check(" 9223372036854775807", 9223372036854775807LL, 0);
12409 check("-9223372036854775808", -9223372036854775808LL, 0);
12410 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
12411 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12412 if (!bad)
12413 printf("ok\n");
12414}
12415EOCP
12416 set try
12417 if eval $compile; then
e75931a7
YST
12418 yyy=`./try`
12419 case "$yyy" in
b4eb6b3d
JH
12420 ok) echo "Your strtoll() seems to be working okay." ;;
12421 *) cat <<EOM >&4
12422Your strtoll() doesn't seem to be working okay.
12423EOM
12424 d_strtoll="$undef"
12425 ;;
69eadf66 12426 esac
e75931a7
YST
12427 else
12428 echo "(I can't seem to compile the test program--assuming it doesn't)"
12429 d_strtoll="$undef"
b4eb6b3d
JH
12430 fi
12431 ;;
12432esac
12433
28e5dec8
JH
12434: see if strtoq exists
12435set strtoq d_strtoq
12436eval $inlibc
12437
b4eb6b3d
JH
12438: see if strtoul exists
12439set strtoul d_strtoul
12440eval $inlibc
12441
d0e6d399
NC
12442case "$d_strtoul" in
12443"$define")
12444 $cat <<EOM
12445Checking whether your strtoul() works okay...
12446EOM
12447 $cat >try.c <<'EOCP'
12448#include <errno.h>
12449#include <stdio.h>
12450extern unsigned long int strtoul(char *s, char **, int);
12451static int bad = 0;
12452void check(char *s, unsigned long eul, int een) {
12453 unsigned long gul;
12454 errno = 0;
12455 gul = strtoul(s, 0, 10);
12456 if (!((gul == eul) && (errno == een)))
12457 bad++;
12458}
12459int main() {
12460 check(" 1", 1L, 0);
12461 check(" 0", 0L, 0);
12462EOCP
12463 case "$longsize" in
12464 8)
12465 $cat >>try.c <<'EOCP'
09c0d2c4
JH
12466 check("18446744073709551615", 18446744073709551615UL, 0);
12467 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 12468#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 12469 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
12470 check("-18446744073709551614", 2, 0);
12471 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
12472 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12473 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 12474#endif
d0e6d399
NC
12475EOCP
12476 ;;
12477 4)
12478 $cat >>try.c <<'EOCP'
12479 check("4294967295", 4294967295UL, 0);
12480 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 12481#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
12482 check("-1", 4294967295UL, 0);
12483 check("-4294967294", 2, 0);
12484 check("-4294967295", 1, 0);
12485 check("-4294967296", 4294967295UL, ERANGE);
12486 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 12487#endif
d0e6d399
NC
12488EOCP
12489 ;;
12490 *)
12491: Should we write these tests to be more portable by sprintf-ing
12492: ~0 and then manipulating that char string as input for strtol?
12493 ;;
12494 esac
12495 $cat >>try.c <<'EOCP'
12496 if (!bad)
12497 printf("ok\n");
12498 return 0;
12499}
12500EOCP
12501 set try
12502 if eval $compile; then
12503 case "`./try`" in
12504 ok) echo "Your strtoul() seems to be working okay." ;;
12505 *) cat <<EOM >&4
12506Your strtoul() doesn't seem to be working okay.
12507EOM
12508 d_strtoul="$undef"
12509 ;;
12510 esac
12511 fi
12512 ;;
12513esac
12514
b4eb6b3d
JH
12515: see if strtoull exists
12516set strtoull d_strtoull
12517eval $inlibc
12518
12519case "$d_longlong-$d_strtoull" in
12520"$define-$define")
12521 $cat <<EOM
12522Checking whether your strtoull() works okay...
12523EOM
12524 $cat >try.c <<'EOCP'
12525#include <errno.h>
12526#ifdef __hpux
12527#define strtoull __strtoull
12528#endif
12529#include <stdio.h>
12530extern unsigned long long int strtoull(char *s, char **, int);
12531static int bad = 0;
12532int check(char *s, long long eull, int een) {
12533 long long gull;
12534 errno = 0;
12535 gull = strtoull(s, 0, 10);
12536 if (!((gull == eull) && (errno == een)))
12537 bad++;
12538}
12539int main() {
d0e6d399
NC
12540 check(" 1", 1LL, 0);
12541 check(" 0", 0LL, 0);
12542 check("18446744073709551615", 18446744073709551615ULL, 0);
12543 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 12544#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
12545 check("-1", 18446744073709551615ULL, 0);
12546 check("-18446744073709551614", 2LL, 0);
12547 check("-18446744073709551615", 1LL, 0);
12548 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12549 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 12550#endif
b4eb6b3d
JH
12551 if (!bad)
12552 printf("ok\n");
12553}
12554EOCP
12555 set try
12556 if eval $compile; then
12557 case "`./try`" in
12558 ok) echo "Your strtoull() seems to be working okay." ;;
12559 *) cat <<EOM >&4
12560Your strtoull() doesn't seem to be working okay.
12561EOM
12562 d_strtoull="$undef"
12563 ;;
12564 esac
12565 fi
12566 ;;
12567esac
12568
12569: see if strtouq exists
12570set strtouq d_strtouq
12571eval $inlibc
12572
d0e6d399
NC
12573case "$d_strtouq" in
12574"$define")
12575 $cat <<EOM
12576Checking whether your strtouq() works okay...
12577EOM
12578 $cat >try.c <<'EOCP'
12579#include <errno.h>
12580#include <stdio.h>
12581extern unsigned long long int strtouq(char *s, char **, int);
12582static int bad = 0;
12583void check(char *s, unsigned long long eull, int een) {
12584 unsigned long long gull;
12585 errno = 0;
12586 gull = strtouq(s, 0, 10);
12587 if (!((gull == eull) && (errno == een)))
12588 bad++;
12589}
12590int main() {
12591 check(" 1", 1LL, 0);
12592 check(" 0", 0LL, 0);
12593 check("18446744073709551615", 18446744073709551615ULL, 0);
12594 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 12595#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
12596 check("-1", 18446744073709551615ULL, 0);
12597 check("-18446744073709551614", 2LL, 0);
12598 check("-18446744073709551615", 1LL, 0);
12599 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12600 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 12601#endif
d0e6d399
NC
12602 if (!bad)
12603 printf("ok\n");
12604 return 0;
12605}
12606EOCP
12607 set try
12608 if eval $compile; then
12609 case "`./try`" in
12610 ok) echo "Your strtouq() seems to be working okay." ;;
12611 *) cat <<EOM >&4
12612Your strtouq() doesn't seem to be working okay.
12613EOM
12614 d_strtouq="$undef"
12615 ;;
12616 esac
12617 fi
12618 ;;
12619esac
12620
b4eb6b3d
JH
12621: see if strxfrm exists
12622set strxfrm d_strxfrm
12623eval $inlibc
12624
12625: see if symlink exists
12626set symlink d_symlink
12627eval $inlibc
12628
12629: see if syscall exists
12630set syscall d_syscall
12631eval $inlibc
12632
2ef53570
JH
12633: see if prototype for syscall is available
12634echo " "
12635set d_syscallproto syscall $i_unistd unistd.h
12636eval $hasproto
12637
b4eb6b3d
JH
12638: see if sysconf exists
12639set sysconf d_sysconf
12640eval $inlibc
12641
12642: see if system exists
12643set system d_system
12644eval $inlibc
12645
12646: see if tcgetpgrp exists
12647set tcgetpgrp d_tcgetpgrp
12648eval $inlibc
12649
12650: see if tcsetpgrp exists
12651set tcsetpgrp d_tcsetpgrp
12652eval $inlibc
12653
12654: see if prototype for telldir is available
12655echo " "
12656set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12657eval $hasproto
12658
12659: see if this is a sys/times.h system
12660set sys/times.h i_systimes
12661eval $inhdr
12662
12663: see if times exists
12664echo " "
12665if set times val -f d_times; eval $csym; $val; then
12666 echo 'times() found.' >&4
12667 d_times="$define"
12668 inc=''
12669 case "$i_systimes" in
12670 "$define") inc='sys/times.h';;
12671 esac
12672 rp="What is the type returned by times() on this system?"
12673 set clock_t clocktype long stdio.h sys/types.h $inc
12674 eval $typedef_ask
12675else
12676 echo 'times() NOT found, hope that will do.' >&4
12677 d_times="$undef"
12678 clocktype='int'
12679fi
12680
12681: see if truncate exists
12682set truncate d_truncate
12683eval $inlibc
12684
12685: see if tzname[] exists
12686echo " "
12687if set tzname val -a d_tzname; eval $csym; $val; then
12688 val="$define"
12689 echo 'tzname[] found.' >&4
12690else
12691 val="$undef"
12692 echo 'tzname[] NOT found.' >&4
12693fi
12694set d_tzname
12695eval $setvar
12696
4e0554ec
JH
12697case "$crosscompile" in
12698''|[nN]*) crosscompile="$undef" ;;
12699esac
12700
12701case "$osname" in
12702next|rhapsody|darwin) multiarch="$define" ;;
12703esac
12704case "$multiarch" in
12705''|[nN]*) multiarch="$undef" ;;
12706esac
12707
12708: check for ordering of bytes in a long
12709echo " "
12710case "$crosscompile$multiarch" in
12711*$define*)
12712 $cat <<EOM
12713You seem to be either cross-compiling or doing a multiarchitecture build,
12714skipping the byteorder check.
12715
12716EOM
12717 byteorder='0xffff'
12718 ;;
12719*)
12720 case "$byteorder" in
12721 '')
12722 $cat <<'EOM'
12723In the following, larger digits indicate more significance. A big-endian
12724machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12725little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12726machines may have weird orders like 3412. A Cray will report 87654321,
12727an Alpha will report 12345678. If the test program works the default is
12728probably right.
12729I'm now running the test program...
12730EOM
12731 $cat >try.c <<'EOCP'
12732#include <stdio.h>
12733int main()
12734{
12735 int i;
12736 union {
12737 unsigned long l;
12738 char c[sizeof(long)];
12739 } u;
12740
12741 if (sizeof(long) > 4)
12742 u.l = (0x08070605L << 32) | 0x04030201L;
12743 else
12744 u.l = 0x04030201L;
12745 for (i = 0; i < sizeof(long); i++)
12746 printf("%c", u.c[i]+'0');
12747 printf("\n");
12748 exit(0);
12749}
12750EOCP
12751 xxx_prompt=y
12752 set try
12753 if eval $compile && ./try > /dev/null; then
12754 dflt=`./try`
12755 case "$dflt" in
12756 [1-4][1-4][1-4][1-4]|12345678|87654321)
12757 echo "(The test program ran ok.)"
12758 echo "byteorder=$dflt"
12759 xxx_prompt=n
12760 ;;
12761 ????|????????) echo "(The test program ran ok.)" ;;
12762 *) echo "(The test program didn't run right for some reason.)" ;;
12763 esac
12764 else
12765 dflt='4321'
12766 cat <<'EOM'
12767(I can't seem to compile the test program. Guessing big-endian...)
12768EOM
12769 fi
12770 case "$xxx_prompt" in
12771 y)
12772 rp="What is the order of bytes in a long?"
12773 . ./myread
12774 byteorder="$ans"
12775 ;;
12776 *) byteorder=$dflt
12777 ;;
12778 esac
12779 ;;
12780 esac
12781 $rm -f try.c try
12782 ;;
12783esac
12784
12785
12786$cat <<EOM
12787
12788Checking to see whether you can access character data unalignedly...
12789EOM
12790$cat >try.c <<EOCP
12791#include <stdio.h>
12792#define U32 $u32type
12793#define BYTEORDER $byteorder
12794int main() {
12795#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
12796 U8 buf[] = "\0\0\0\1\0\0\0\0";
12797 U32 *up;
12798 int i;
12799
12800 if (sizeof(U32) != 4) {
12801 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
12802 exit(1);
12803 }
12804
12805 fflush(stdout);
12806
12807 for (i = 0; i < 4; i++) {
12808 up = (U32*)(buf + i);
12809 if (! ((*up == 1 << (8*i)) || /* big-endian */
12810 (*up == 1 << (8*(3-i))) /* little-endian */
12811 )
12812 )
12813 {
12814 printf("read failed (%x)\n", *up);
12815 exit(2);
12816 }
12817 }
12818
12819 /* write test */
12820 for (i = 0; i < 4; i++) {
12821 up = (U32*)(buf + i);
12822 *up = 0xBeef;
12823 if (*up != 0xBeef) {
12824 printf("write failed (%x)\n", *up);
12825 exit(3);
12826 }
12827 }
12828
12829 exit(0);
12830#else
12831 printf("1\n");
12832 exit(1);
12833#endif
12834 return 0;
12835}
12836EOCP
12837set try
12838if eval $compile_ok; then
12839 echo "(This test may dump core.)" >&4
12840 ./try >&2 >/dev/null
12841 case "$?" in
12842 0) cat >&4 <<EOM
12843You can access character data pretty unalignedly.
12844EOM
12845 d_u32align="$undef"
12846 ;;
12847 *) cat >&4 <<EOM
12848It seems that you must access character data in an aligned manner.
12849EOM
12850 d_u32align="$define"
12851 ;;
12852 esac
12853 $rm -f core core.try.* try.core
12854else
12855 rp='Can you access character data at unaligned addresses?'
12856 dflt='n'
12857 . ./myread
12858 case "$ans" in
12859 [yY]*) d_u32align="$undef" ;;
12860 *) d_u32align="$define" ;;
12861 esac
12862fi
12863
12864: see if ualarm exists
12865set ualarm d_ualarm
12866eval $inlibc
12867
b4eb6b3d
JH
12868: see if umask exists
12869set umask d_umask
12870eval $inlibc
12871
4e0554ec
JH
12872: see if usleep exists
12873set usleep d_usleep
12874eval $inlibc
12875
2ef53570
JH
12876: see if prototype for usleep is available
12877echo " "
12878set d_usleepproto usleep $i_unistd unistd.h
12879eval $hasproto
12880
b4eb6b3d
JH
12881: see if ustat exists
12882set ustat d_ustat
12883eval $inlibc
12884
12885: backward compatibility for d_hvfork
12886if test X$d_hvfork != X; then
12887 d_vfork="$d_hvfork"
12888 d_hvfork=''
12889fi
12890: see if there is a vfork
12891val=''
12892set vfork val
12893eval $inlibc
12894
12895: Ok, but do we want to use it. vfork is reportedly unreliable in
12896: perl on Solaris 2.x, and probably elsewhere.
12897case "$val" in
12898$define)
12899 echo " "
12900 case "$usevfork" in
12901 false) dflt='n';;
12902 *) dflt='y';;
12903 esac
12904 cat <<'EOM'
12905
12906Perl can only use a vfork() that doesn't suffer from strict
12907restrictions on calling functions or modifying global data in
12908the child. For example, glibc-2.1 contains such a vfork()
12909that is unsuitable. If your system provides a proper fork()
12910call, chances are that you do NOT want perl to use vfork().
12911
12912EOM
12913 rp="Do you still want to use vfork()?"
12914 . ./myread
12915 case "$ans" in
12916 y|Y) ;;
12917 *)
12918 echo "Ok, we won't use vfork()."
12919 val="$undef"
12920 ;;
12921 esac
12922 ;;
12923esac
12924set d_vfork
12925eval $setvar
12926case "$d_vfork" in
12927$define) usevfork='true';;
12928*) usevfork='false';;
12929esac
12930
12931: see if this is an sysdir system
12932set sys/dir.h i_sysdir
12933eval $inhdr
12934
12935: see if this is an sysndir system
12936set sys/ndir.h i_sysndir
12937eval $inhdr
12938
12939: see if closedir exists
12940set closedir d_closedir
12941eval $inlibc
12942
12943case "$d_closedir" in
12944"$define")
12945 echo " "
12946 echo "Checking whether closedir() returns a status..." >&4
12947 cat > closedir.c <<EOM
12948#$i_dirent I_DIRENT /**/
12949#$i_sysdir I_SYS_DIR /**/
12950#$i_sysndir I_SYS_NDIR /**/
12951#$i_systypes I_SYS_TYPES /**/
12952
12953#if defined(I_SYS_TYPES)
12954#include <sys/types.h>
12955#endif
12956#if defined(I_DIRENT)
12957#include <dirent.h>
12958#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12959#include <sys/dir.h>
12960#endif
12961#else
12962#ifdef I_SYS_NDIR
12963#include <sys/ndir.h>
12964#else
12965#ifdef I_SYS_DIR
12966#ifdef hp9000s500
12967#include <ndir.h> /* may be wrong in the future */
12968#else
12969#include <sys/dir.h>
12970#endif
12971#endif
12972#endif
12973#endif
12974int main() { return closedir(opendir(".")); }
12975EOM
12976 set closedir
12977 if eval $compile_ok; then
12978 if ./closedir > /dev/null 2>&1 ; then
12979 echo "Yes, it does."
12980 val="$undef"
12981 else
12982 echo "No, it doesn't."
12983 val="$define"
12984 fi
12985 else
12986 echo "(I can't seem to compile the test program--assuming it doesn't)"
12987 val="$define"
12988 fi
12989 ;;
12990*)
12991 val="$undef";
12992 ;;
12993esac
12994set d_void_closedir
12995eval $setvar
12996$rm -f closedir*
b4eb6b3d
JH
12997: see if there is a wait4
12998set wait4 d_wait4
12999eval $inlibc
13000
13001: see if waitpid exists
13002set waitpid d_waitpid
13003eval $inlibc
13004
13005: see if wcstombs exists
13006set wcstombs d_wcstombs
13007eval $inlibc
13008
13009: see if wctomb exists
13010set wctomb d_wctomb
13011eval $inlibc
13012
4e0554ec
JH
13013: see if writev exists
13014set writev d_writev
13015eval $inlibc
13016
b4eb6b3d
JH
13017: preserve RCS keywords in files with variable substitution, grrr
13018Date='$Date'
13019Id='$Id'
13020Log='$Log'
13021RCSfile='$RCSfile'
13022Revision='$Revision'
13023
b4eb6b3d
JH
13024: check for alignment requirements
13025echo " "
13026case "$crosscompile$multiarch" in
13027*$define*)
13028 $cat <<EOM
13029You seem to be either cross-compiling or doing a multiarchitecture build,
13030skipping the memory alignment check.
13031
13032EOM
13033 case "$alignbytes" in
13034 '') alignbytes=8 ;;
13035 esac
13036 ;;
13037*)
13038 case "$alignbytes" in
13039 '') echo "Checking alignment constraints..." >&4
13040 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
13041 $cat >try.c <<'EOCP'
13042typedef long double NV;
13043EOCP
13044 else
13045 $cat >try.c <<'EOCP'
13046typedef double NV;
13047EOCP
13048 fi
13049 $cat >>try.c <<'EOCP'
13050#include <stdio.h>
13051struct foobar {
13052 char foo;
13053 NV bar;
13054} try_algn;
13055int main()
13056{
13057 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
13058 return(0);
13059}
13060EOCP
13061 set try
13062 if eval $compile_ok; then
13063 dflt=`./try`
13064 else
13065 dflt='8'
13066 echo "(I can't seem to compile the test program...)"
13067 fi
13068 ;;
13069 *) dflt="$alignbytes"
13070 ;;
13071 esac
13072 rp="Doubles must be aligned on a how-many-byte boundary?"
13073 . ./myread
13074 alignbytes="$ans"
13075 $rm -f try.c try
13076 ;;
13077esac
13078
13079
13080: set the base revision
13081baserev=5.0
13082
b4eb6b3d
JH
13083: how do we catenate cpp tokens here?
13084echo " "
13085echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
13086$cat >cpp_stuff.c <<'EOCP'
13087#define RCAT(a,b)a/**/b
13088#define ACAT(a,b)a ## b
13089RCAT(Rei,ser)
13090ACAT(Cir,cus)
13091EOCP
13092$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
13093if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
13094 echo "Oh! Smells like ANSI's been here." >&4
13095 echo "We can catify or stringify, separately or together!"
13096 cpp_stuff=42
13097elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
13098 echo "Ah, yes! The good old days!" >&4
13099 echo "However, in the good old days we don't know how to stringify and"
13100 echo "catify at the same time."
13101 cpp_stuff=1
13102else
13103 $cat >&4 <<EOM
13104Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
13105to have to edit the values of CAT[2-5] in config.h...
13106EOM
13107 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
13108fi
13109$rm -f cpp_stuff.*
13110
13111: see if this is a db.h system
13112set db.h i_db
13113eval $inhdr
13114
13115case "$i_db" in
13116$define)
13117 : Check db version.
13118 echo " "
13119 echo "Checking Berkeley DB version ..." >&4
13120 $cat >try.c <<EOCP
13121#$d_const HASCONST
13122#ifndef HASCONST
13123#define const
13124#endif
13125#include <sys/types.h>
13126#include <stdio.h>
13127#include <db.h>
640374d0 13128int main(int argc, char *argv[])
b4eb6b3d
JH
13129{
13130#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
13131 int Major, Minor, Patch ;
13132 unsigned long Version ;
13133 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
13134 if (argc == 2) {
13135 printf("%d %d %d %d %d %d\n",
13136 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
13137 Major, Minor, Patch);
13138 exit(0);
13139 }
13140 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
13141
13142 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13143 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13144 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13145 Major, Minor, Patch) ;
13146
13147 /* check that db.h & libdb are compatible */
13148 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 13149 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
13150 exit(3);
13151 }
13152
640374d0 13153 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
13154
13155 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13156 + DB_VERSION_PATCH ;
13157
13158 /* needs to be >= 2.3.4 */
13159 if (Version < 2003004) {
13160 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 13161 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
13162 exit(2);
13163 }
13164
13165 exit(0);
13166#else
13167#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
13168 if (argc == 2) {
13169 printf("1 0 0\n");
13170 exit(0);
13171 }
13172 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
13173 exit(0); /* DB version < 2: the coast is clear. */
13174#else
13175 exit(1); /* <db.h> not Berkeley DB? */
13176#endif
13177#endif
13178}
13179EOCP
13180 set try
13181 if eval $compile_ok && ./try; then
13182 echo 'Looks OK.' >&4
640374d0
JH
13183 set `./try 1`
13184 db_version_major=$1
13185 db_version_minor=$2
13186 db_version_patch=$3
b4eb6b3d
JH
13187 else
13188 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
13189 i_db=$undef
13190 case " $libs " in
13191 *"-ldb "*)
13192 : Remove db from list of libraries to use
13193 echo "Removing unusable -ldb from library list" >&4
13194 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13195 shift
13196 libs="$*"
13197 echo "libs = $libs" >&4
13198 ;;
13199 esac
13200 fi
13201 $rm -f try.*
13202 ;;
13203esac
13204
13205case "$i_db" in
13206define)
13207 : Check the return type needed for hash
13208 echo " "
13209 echo "Checking return type needed for hash for Berkeley DB ..." >&4
13210 $cat >try.c <<EOCP
13211#$d_const HASCONST
13212#ifndef HASCONST
13213#define const
13214#endif
13215#include <sys/types.h>
13216#include <db.h>
13217
13218#ifndef DB_VERSION_MAJOR
13219u_int32_t hash_cb (ptr, size)
13220const void *ptr;
13221size_t size;
13222{
13223}
13224HASHINFO info;
13225int main()
13226{
13227 info.hash = hash_cb;
13228}
13229#endif
13230EOCP
13231 if $cc $ccflags -c try.c >try.out 2>&1 ; then
13232 if $contains warning try.out >>/dev/null 2>&1 ; then
13233 db_hashtype='int'
13234 else
13235 db_hashtype='u_int32_t'
13236 fi
13237 else
13238 : XXX Maybe we should just give up here.
13239 db_hashtype=u_int32_t
13240 $cat try.out >&4
13241 echo "Help: I can't seem to compile the db test program." >&4
13242 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13243 fi
13244 $rm -f try.*
13245 echo "Your version of Berkeley DB uses $db_hashtype for hash."
13246 ;;
13247*) db_hashtype=u_int32_t
13248 ;;
13249esac
13250case "$i_db" in
13251define)
13252 : Check the return type needed for prefix
13253 echo " "
13254 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13255 cat >try.c <<EOCP
13256#$d_const HASCONST
13257#ifndef HASCONST
13258#define const
13259#endif
13260#include <sys/types.h>
13261#include <db.h>
13262
13263#ifndef DB_VERSION_MAJOR
13264size_t prefix_cb (key1, key2)
13265const DBT *key1;
13266const DBT *key2;
13267{
13268}
13269BTREEINFO info;
13270int main()
13271{
13272 info.prefix = prefix_cb;
13273}
13274#endif
13275EOCP
13276 if $cc $ccflags -c try.c >try.out 2>&1 ; then
13277 if $contains warning try.out >>/dev/null 2>&1 ; then
13278 db_prefixtype='int'
13279 else
13280 db_prefixtype='size_t'
13281 fi
13282 else
13283 db_prefixtype='size_t'
13284 : XXX Maybe we should just give up here.
13285 $cat try.out >&4
13286 echo "Help: I can't seem to compile the db test program." >&4
13287 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13288 fi
13289 $rm -f try.*
13290 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13291 ;;
13292*) db_prefixtype='size_t'
13293 ;;
13294esac
13295
b4eb6b3d
JH
13296
13297: How can we generate normalized random numbers ?
13298echo " "
13299echo "Looking for a random number function..." >&4
13300case "$randfunc" in
13301'')
13302 if set drand48 val -f; eval $csym; $val; then
13303 dflt="drand48"
13304 echo "Good, found drand48()." >&4
13305 elif set random val -f; eval $csym; $val; then
13306 dflt="random"
13307 echo "OK, found random()." >&4
13308 else
13309 dflt="rand"
13310 echo "Yick, looks like I have to use rand()." >&4
13311 fi
13312 echo " "
13313 ;;
13314*)
13315 dflt="$randfunc"
13316 ;;
13317esac
13318cont=true
13319
13320case "$ccflags" in
13321*-Dmy_rand=*|*-Dmy_srand=*)
13322 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13323 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13324 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13325 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13326 ;;
13327esac
13328
13329while $test "$cont"; do
13330 rp="Use which function to generate random numbers?"
13331 . ./myread
13332 if $test "$ans" = "$dflt"; then
13333 : null
13334 else
13335 randbits=''
13336 fi
13337 randfunc="$ans"
13338 if set $ans val -f; eval $csym; $val; then
13339 cont=''
13340 else
13341 dflt=y
13342 rp="I cannot find function $ans. Use that name anyway?"
13343 . ./myread
13344 dflt=rand
13345 case "$ans" in
13346 [yY]*) cont='';;
13347 esac
13348 fi
13349 case "$cont" in
13350 '')
13351 case "$randfunc" in
13352 drand48)
13353 drand01="drand48()"
13354 seedfunc="srand48"
13355 randbits=48
13356 randseedtype=long
13357 ;;
13358 rand|random)
13359 case "$randbits" in
13360 '')
13361echo "Checking to see how many bits your $randfunc() function produces..." >&4
13362 $cat >try.c <<EOCP
13363#$i_unistd I_UNISTD
13364#$i_stdlib I_STDLIB
13365#include <stdio.h>
13366#ifdef I_UNISTD
13367# include <unistd.h>
13368#endif
13369#ifdef I_STDLIB
13370# include <stdlib.h>
13371#endif
13372int main()
13373{
13374 register int i;
13375 register unsigned long tmp;
13376 register unsigned long max = 0L;
13377
13378 for (i = 1000; i; i--) {
13379 tmp = (unsigned long) $randfunc();
13380 if (tmp > max) max = tmp;
13381 }
13382 for (i = 0; max; i++)
13383 max /= 2;
13384 printf("%d\n",i);
13385}
13386EOCP
13387 set try
13388 if eval $compile_ok; then
13389 dflt=`try`
13390 else
13391 dflt='?'
13392 echo "(I can't seem to compile the test program...)"
13393 fi
13394 ;;
13395 *)
13396 dflt="$randbits"
13397 ;;
13398 esac
13399 rp="How many bits does your $randfunc() function produce?"
13400 . ./myread
13401 randbits="$ans"
13402 $rm -f try.c try
13403 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13404 seedfunc="s$randfunc"
13405 randseedtype=unsigned
13406 ;;
13407 *)
13408 dflt="31"
13409 rp="How many bits does your $randfunc() function produce?"
13410 . ./myread
13411 randbits="$ans"
13412 seedfunc="s$randfunc"
13413 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13414 if set $seedfunc val -f; eval $csym; $val; then
13415 echo "(Using $seedfunc() to seed random generator)"
13416 else
13417 echo "(Warning: no $seedfunc() to seed random generator)"
13418 seedfunc=rand
13419 fi
13420 randseedtype=unsigned
13421 ;;
13422 esac
13423 ;;
13424 esac
13425done
13426
13427echo " "
13428echo "Determining whether or not we are on an EBCDIC system..." >&4
13429$cat >tebcdic.c <<'EOM'
13430int main()
13431{
13432 if ('M'==0xd4) return 0;
13433 return 1;
13434}
13435EOM
13436
13437val=$undef
13438set tebcdic
13439if eval $compile_ok; then
13440 if ./tebcdic; then
13441 echo "You seem to speak EBCDIC." >&4
13442 val="$define"
13443 else
13444 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13445 fi
13446else
13447 echo "I'm unable to compile the test program." >&4
13448 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13449fi
13450$rm -f tebcdic.c tebcdic
13451set ebcdic
13452eval $setvar
13453
13454echo " "
13455$cat >&4 <<EOM
13456Checking how to flush all pending stdio output...
13457EOM
13458# I only know how to find the first 32 possibly open files on SunOS.
13459# See also hints/sunos_4_1.sh and util.c --AD
13460case "$osname" in
13461sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13462esac
13463$cat >>try.c <<EOCP
13464#include <stdio.h>
13465#$i_unistd I_UNISTD
13466#ifdef I_UNISTD
13467# include <unistd.h>
13468#endif
13469#$d_sysconf HAS_SYSCONF
13470#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13471#ifdef HAS_STDIO_STREAM_ARRAY
13472# define STDIO_STREAM_ARRAY $stdio_stream_array
13473#endif
13474int main() {
13475 FILE* p = fopen("try.out", "w");
13476#ifdef TRY_FPUTC
13477 fputc('x', p);
13478#else
13479# ifdef TRY_FPRINTF
13480 fprintf(p, "x");
13481# endif
13482#endif
13483#ifdef TRY_FFLUSH_NULL
13484 fflush(NULL);
13485#endif
13486#ifdef TRY_FFLUSH_ALL
13487 {
13488 long open_max = -1;
13489# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13490 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13491# else
13492# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13493 open_max = sysconf(_SC_OPEN_MAX);
13494# else
13495# ifdef FOPEN_MAX
13496 open_max = FOPEN_MAX;
13497# else
13498# ifdef OPEN_MAX
13499 open_max = OPEN_MAX;
13500# else
13501# ifdef _NFILE
13502 open_max = _NFILE;
13503# endif
13504# endif
13505# endif
13506# endif
13507# endif
13508# ifdef HAS_STDIO_STREAM_ARRAY
13509 if (open_max > 0) {
13510 long i;
13511 for (i = 0; i < open_max; i++)
13512 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13513 STDIO_STREAM_ARRAY[i]._file < open_max &&
13514 STDIO_STREAM_ARRAY[i]._flag)
13515 fflush(&STDIO_STREAM_ARRAY[i]);
13516 }
13517 }
13518# endif
13519#endif
13520 _exit(42);
13521}
13522EOCP
13523: first we have to find out how _not_ to flush
13524if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13525 output=''
13526 set try -DTRY_FPUTC
13527 if eval $compile; then
13528 $rm -f try.out
13529 ./try$exe_ext 2>/dev/null
13530 if $test ! -s try.out -a "X$?" = X42; then
13531 output=-DTRY_FPUTC
13532 fi
13533 fi
13534 case "$output" in
13535 '')
13536 set try -DTRY_FPRINTF
13537 $rm -f try.out
13538 if eval $compile; then
13539 $rm -f try.out
13540 ./try$exe_ext 2>/dev/null
13541 if $test ! -s try.out -a "X$?" = X42; then
13542 output=-DTRY_FPRINTF
13543 fi
13544 fi
13545 ;;
13546 esac
13547fi
13548: check for fflush NULL behaviour
13549case "$fflushNULL" in
13550'') set try -DTRY_FFLUSH_NULL $output
13551 if eval $compile; then
13552 $rm -f try.out
13553 ./try$exe_ext 2>/dev/null
13554 code="$?"
13555 if $test -s try.out -a "X$code" = X42; then
13556 fflushNULL="`$cat try.out`"
13557 else
13558 if $test "X$code" != X42; then
13559 $cat >&4 <<EOM
13560(If this test failed, don't worry, we'll try another method shortly.)
13561EOM
13562 fi
13563 fi
13564 fi
13565 $rm -f core try.core core.try.*
13566 case "$fflushNULL" in
13567 x) $cat >&4 <<EOM
13568Your fflush(NULL) works okay for output streams.
13569Let's see if it clobbers input pipes...
13570EOM
13571# As of mid-March 2000 all versions of Solaris appear to have a stdio
13572# bug that improperly flushes the input end of pipes. So we avoid the
13573# autoflush on fork/system/exec support for now. :-(
13574$cat >tryp.c <<EOCP
13575#include <stdio.h>
13576int
13577main(int argc, char **argv)
13578{
13579 char buf[1024];
13580 int i;
13581 char *bp = buf;
13582 while (1) {
13583 while ((i = getc(stdin)) != -1
13584 && (*bp++ = i) != '\n'
13585 && bp < &buf[1024])
13586 /* DO NOTHING */ ;
13587 *bp = '\0';
13588 fprintf(stdout, "%s", buf);
13589 fflush(NULL);
13590 if (i == -1)
13591 return 0;
13592 bp = buf;
13593 }
13594}
13595EOCP
13596 fflushNULL="$define"
13597 set tryp
13598 if eval $compile; then
13599 $rm -f tryp.out
13600 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13601 if cmp tryp.c tryp.out >/dev/null 2>&1; then
13602 $cat >&4 <<EOM
13603fflush(NULL) seems to behave okay with input streams.
13604EOM
13605 fflushNULL="$define"
13606 else
13607 $cat >&4 <<EOM
13608Ouch, fflush(NULL) clobbers input pipes! We will not use it.
13609EOM
13610 fflushNULL="$undef"
13611 fi
13612 fi
13613 $rm -f core tryp.c tryp.core core.tryp.*
13614 ;;
13615 '') $cat >&4 <<EOM
13616Your fflush(NULL) isn't working (contrary to ANSI C).
13617EOM
13618 fflushNULL="$undef"
13619 ;;
13620 *) $cat >&4 <<EOM
13621Cannot figure out whether your fflush(NULL) works or not.
13622I'm assuming it doesn't (contrary to ANSI C).
13623EOM
13624 fflushNULL="$undef"
13625 ;;
13626 esac
13627 ;;
13628$define|true|[yY]*)
13629 fflushNULL="$define"
13630 ;;
13631*)
13632 fflushNULL="$undef"
13633 ;;
13634esac
13635: check explicit looping only if NULL did not work, and if the pipe
13636: bug does not show up on an explicit flush too
13637case "$fflushNULL" in
13638"$undef")
13639 $cat >tryp.c <<EOCP
13640#include <stdio.h>
13641int
13642main(int argc, char **argv)
13643{
13644 char buf[1024];
13645 int i;
13646 char *bp = buf;
13647 while (1) {
13648 while ((i = getc(stdin)) != -1
13649 && (*bp++ = i) != '\n'
13650 && bp < &buf[1024])
13651 /* DO NOTHING */ ;
13652 *bp = '\0';
13653 fprintf(stdout, "%s", buf);
13654 fflush(stdin);
13655 if (i == -1)
13656 return 0;
13657 bp = buf;
13658 }
13659}
13660EOCP
13661 set tryp
13662 if eval $compile; then
13663 $rm -f tryp.out
13664 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13665 if cmp tryp.c tryp.out >/dev/null 2>&1; then
13666 $cat >&4 <<EOM
13667Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13668EOM
13669 : now check for fflushall behaviour
13670 case "$fflushall" in
13671 '') set try -DTRY_FFLUSH_ALL $output
13672 if eval $compile; then
13673 $cat >&4 <<EOM
13674(Now testing the other method--but note that this also may fail.)
13675EOM
13676 $rm -f try.out
13677 ./try$exe_ext 2>/dev/null
13678 if $test -s try.out -a "X$?" = X42; then
13679 fflushall="`$cat try.out`"
13680 fi
13681 fi
13682 $rm -f core try.core core.try.*
13683 case "$fflushall" in
13684 x) $cat >&4 <<EOM
13685Whew. Flushing explicitly all the stdio streams works.
13686EOM
13687 fflushall="$define"
13688 ;;
13689 '') $cat >&4 <<EOM
13690Sigh. Flushing explicitly all the stdio streams doesn't work.
13691EOM
13692 fflushall="$undef"
13693 ;;
13694 *) $cat >&4 <<EOM
13695Cannot figure out whether flushing stdio streams explicitly works or not.
13696I'm assuming it doesn't.
13697EOM
13698 fflushall="$undef"
13699 ;;
13700 esac
13701 ;;
13702 "$define"|true|[yY]*)
13703 fflushall="$define"
13704 ;;
13705 *)
13706 fflushall="$undef"
13707 ;;
13708 esac
13709 else
13710 $cat >&4 <<EOM
13711All is futile. Even fflush(stdin) clobbers input pipes!
13712EOM
13713 fflushall="$undef"
13714 fi
13715 else
13716 fflushall="$undef"
13717 fi
13718 $rm -f core tryp.c tryp.core core.tryp.*
13719 ;;
13720*) fflushall="$undef"
13721 ;;
13722esac
13723
13724case "$fflushNULL$fflushall" in
13725undefundef)
13726 $cat <<EOM
13727OK, I give up. I cannot figure out how to flush pending stdio output.
13728We won't be flushing handles at all before fork/exec/popen.
13729EOM
13730 ;;
13731esac
13732$rm -f try.* try$exe_ext
13733
13734: Store the full pathname to the ar program for use in the C program
13735: Respect a hint or command line value for full_ar.
13736case "$full_ar" in
13737'') full_ar=$ar ;;
13738esac
13739
13740: Store the full pathname to the sed program for use in the C program
13741full_sed=$sed
13742
13743: see what type gids are declared as in the kernel
13744echo " "
13745echo "Looking for the type for group ids returned by getgid()."
13746set gid_t gidtype xxx stdio.h sys/types.h
13747eval $typedef
13748case "$gidtype" in
13749xxx)
13750 xxx=`./findhdr sys/user.h`
13751 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13752 case $1 in
13753 unsigned) dflt="$1 $2" ;;
13754 *) dflt="$1" ;;
13755 esac
13756 ;;
13757*) dflt="$gidtype";;
13758esac
13759case "$gidtype" in
13760gid_t) echo "gid_t found." ;;
13761*) rp="What is the type for group ids returned by getgid()?"
13762 . ./myread
13763 gidtype="$ans"
13764 ;;
13765esac
13766
13767echo " "
13768case "$gidtype" in
13769*_t) zzz="$gidtype" ;;
13770*) zzz="gid" ;;
13771esac
13772echo "Checking the size of $zzz..." >&4
13773cat > try.c <<EOCP
13774#include <sys/types.h>
13775#include <stdio.h>
13776int main() {
13777 printf("%d\n", (int)sizeof($gidtype));
13778 exit(0);
13779}
13780EOCP
13781set try
13782if eval $compile_ok; then
13783 yyy=`./try`
13784 case "$yyy" in
13785 '') gidsize=4
13786 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13787 ;;
13788 *) gidsize=$yyy
13789 echo "Your $zzz is $gidsize bytes long."
13790 ;;
13791 esac
13792else
13793 gidsize=4
13794 echo "(I can't compile the test program--guessing $gidsize.)" >&4
13795fi
13796
13797
13798echo " "
13799case "$gidtype" in
13800*_t) zzz="$gidtype" ;;
13801*) zzz="gid" ;;
13802esac
13803echo "Checking the sign of $zzz..." >&4
13804cat > try.c <<EOCP
13805#include <sys/types.h>
13806#include <stdio.h>
13807int main() {
13808 $gidtype foo = -1;
13809 if (foo < 0)
13810 printf("-1\n");
13811 else
13812 printf("1\n");
13813}
13814EOCP
13815set try
13816if eval $compile; then
13817 yyy=`./try`
13818 case "$yyy" in
13819 '') gidsign=1
13820 echo "(I can't execute the test program--guessing unsigned.)" >&4
13821 ;;
13822 *) gidsign=$yyy
13823 case "$gidsign" in
13824 1) echo "Your $zzz is unsigned." ;;
13825 -1) echo "Your $zzz is signed." ;;
13826 esac
13827 ;;
13828 esac
13829else
13830 gidsign=1
13831 echo "(I can't compile the test program--guessing unsigned.)" >&4
13832fi
13833
13834
13835echo " "
13836
13837if $test X"$quadtype" != X; then
13838
13839echo "Checking how to print 64-bit integers..." >&4
13840
13841if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13842 $cat >try.c <<'EOCP'
13843#include <sys/types.h>
13844#include <stdio.h>
13845int main() {
13846 int q = 12345678901;
13847 printf("%ld\n", q);
13848}
13849EOCP
13850 set try
13851 if eval $compile; then
13852 yyy=`./try$exe_ext`
13853 case "$yyy" in
13854 12345678901)
13855 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13856 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13857 echo "We will use %d."
13858 ;;
13859 esac
13860 fi
13861fi
13862
13863if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13864 $cat >try.c <<'EOCP'
13865#include <sys/types.h>
13866#include <stdio.h>
13867int main() {
13868 long q = 12345678901;
13869 printf("%ld\n", q);
13870}
13871EOCP
13872 set try
13873 if eval $compile; then
13874 yyy=`./try$exe_ext`
13875 case "$yyy" in
13876 12345678901)
13877 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13878 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13879 echo "We will use %ld."
13880 ;;
13881 esac
13882 fi
13883fi
13884
13885if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13886 $cat >try.c <<'EOCP'
13887#include <sys/types.h>
13888#include <inttypes.h>
13889#include <stdio.h>
13890int main() {
13891 int64_t q = 12345678901;
13892 printf("%" PRId64 "\n", q);
13893}
13894EOCP
13895 set try
13896 if eval $compile; then
13897 yyy=`./try$exe_ext`
13898 case "$yyy" in
13899 12345678901)
13900 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13901 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13902 echo "We will use the C9X style."
13903 ;;
13904 esac
13905 fi
13906fi
13907
2ef53570
JH
13908if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13909 $cat >try.c <<EOCP
b4eb6b3d
JH
13910#include <sys/types.h>
13911#include <stdio.h>
13912int main() {
2ef53570
JH
13913 $quadtype q = 12345678901;
13914 printf("%Ld\n", q);
b4eb6b3d
JH
13915}
13916EOCP
13917 set try
13918 if eval $compile; then
13919 yyy=`./try$exe_ext`
13920 case "$yyy" in
13921 12345678901)
2ef53570
JH
13922 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13923 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13924 echo "We will use %Ld."
b4eb6b3d
JH
13925 ;;
13926 esac
13927 fi
13928fi
13929
2ef53570
JH
13930if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13931 $cat >try.c <<'EOCP'
b4eb6b3d
JH
13932#include <sys/types.h>
13933#include <stdio.h>
13934int main() {
2ef53570
JH
13935 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13936 printf("%lld\n", q);
b4eb6b3d
JH
13937}
13938EOCP
13939 set try
13940 if eval $compile; then
13941 yyy=`./try$exe_ext`
13942 case "$yyy" in
13943 12345678901)
2ef53570
JH
13944 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13945 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13946 echo "We will use the %lld style."
b4eb6b3d
JH
13947 ;;
13948 esac
13949 fi
13950fi
13951
13952if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13953 $cat >try.c <<EOCP
13954#include <sys/types.h>
13955#include <stdio.h>
13956int main() {
13957 $quadtype q = 12345678901;
13958 printf("%qd\n", q);
13959}
13960EOCP
13961 set try
13962 if eval $compile; then
13963 yyy=`./try$exe_ext`
13964 case "$yyy" in
13965 12345678901)
13966 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13967 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13968 echo "We will use %qd."
13969 ;;
13970 esac
13971 fi
13972fi
13973
13974if $test X"$sPRId64" = X; then
13975 echo "Cannot figure out how to print 64-bit integers." >&4
13976fi
13977
13978$rm -f try try.*
13979
13980fi
13981
13982case "$sPRId64" in
13983'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
13984 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
13985 ;;
13986*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
13987 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
13988 ;;
13989esac
13990
13991
13992echo " "
13993$echo "Checking the format strings to be used for Perl's internal types..." >&4
13994
13995if $test X"$ivsize" = X8; then
13996 ivdformat="$sPRId64"
13997 uvuformat="$sPRIu64"
13998 uvoformat="$sPRIo64"
13999 uvxformat="$sPRIx64"
14000 uvXUformat="$sPRIXU64"
14001else
14002 if $test X"$ivsize" = X"$longsize"; then
14003 ivdformat='"ld"'
14004 uvuformat='"lu"'
14005 uvoformat='"lo"'
14006 uvxformat='"lx"'
14007 uvXUformat='"lX"'
14008 else
14009 if $test X"$ivsize" = X"$intsize"; then
14010 ivdformat='"d"'
14011 uvuformat='"u"'
14012 uvoformat='"o"'
14013 uvxformat='"x"'
14014 uvXUformat='"X"'
14015 else
14016 : far out
14017 if $test X"$ivsize" = X"$shortsize"; then
14018 ivdformat='"hd"'
14019 uvuformat='"hu"'
14020 uvoformat='"ho"'
14021 uvxformat='"hx"'
14022 uvXUformat='"hX"'
14023 fi
14024 fi
14025 fi
14026fi
14027
14028if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
14029 nveformat="$sPRIeldbl"
14030 nvfformat="$sPRIfldbl"
14031 nvgformat="$sPRIgldbl"
14032 nvEUformat="$sPRIEUldbl"
14033 nvFUformat="$sPRIFUldbl"
14034 nvGUformat="$sPRIGUldbl"
14035else
14036 nveformat='"e"'
14037 nvfformat='"f"'
14038 nvgformat='"g"'
14039 nvEUformat='"E"'
14040 nvFUformat='"F"'
14041 nvGUformat='"G"'
14042fi
14043
14044case "$ivdformat" in
14045'') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
14046 exit 1
14047 ;;
14048esac
14049
14050
14051echo " "
14052$echo "Checking the format string to be used for gids..." >&4
14053
14054case "$gidsign" in
14055-1) if $test X"$gidsize" = X"$ivsize"; then
14056 gidformat="$ivdformat"
14057 else
14058 if $test X"$gidsize" = X"$longsize"; then
14059 gidformat='"ld"'
14060 else
14061 if $test X"$gidsize" = X"$intsize"; then
14062 gidformat='"d"'
14063 else
14064 if $test X"$gidsize" = X"$shortsize"; then
14065 gidformat='"hd"'
14066 fi
14067 fi
14068 fi
14069 fi
14070 ;;
14071*) if $test X"$gidsize" = X"$uvsize"; then
14072 gidformat="$uvuformat"
14073 else
14074 if $test X"$gidsize" = X"$longsize"; then
14075 gidformat='"lu"'
14076 else
14077 if $test X"$gidsize" = X"$intsize"; then
14078 gidformat='"u"'
14079 else
14080 if $test X"$gidsize" = X"$shortsize"; then
14081 gidformat='"hu"'
14082 fi
14083 fi
14084 fi
14085 fi
14086 ;;
14087esac
14088
14089: see if getgroups exists
14090set getgroups d_getgrps
14091eval $inlibc
14092
14093: see if setgroups exists
14094set setgroups d_setgrps
14095eval $inlibc
14096
14097
14098: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
14099echo " "
14100case "$d_getgrps$d_setgrps" in
14101*define*)
14102 case "$groupstype" in
14103 '') dflt="$gidtype" ;;
14104 *) dflt="$groupstype" ;;
14105 esac
14106 $cat <<EOM
14107What type of pointer is the second argument to getgroups() and setgroups()?
14108Usually this is the same as group ids, $gidtype, but not always.
14109
14110EOM
14111 rp='What type pointer is the second argument to getgroups() and setgroups()?'
14112 . ./myread
14113 groupstype="$ans"
14114 ;;
14115*) groupstype="$gidtype";;
14116esac
14117
14118echo " "
14119echo "Checking if your $make program sets \$(MAKE)..." >&4
14120case "$make_set_make" in
14121'')
14122 $sed 's/^X //' > testmake.mak << 'EOF'
14123Xall:
14124X @echo 'maketemp="$(MAKE)"'
14125EOF
14126 case "`$make -f testmake.mak 2>/dev/null`" in
14127 *maketemp=*) make_set_make='#' ;;
14128 *) make_set_make="MAKE=$make" ;;
14129 esac
14130 $rm -f testmake.mak
14131 ;;
14132esac
14133case "$make_set_make" in
14134'#') echo "Yup, it does.";;
14135*) echo "Nope, it doesn't.";;
14136esac
14137
14138: see what type is used for mode_t
14139rp="What is the type used for file modes for system calls (e.g. fchmod())?"
14140set mode_t modetype int stdio.h sys/types.h
14141eval $typedef_ask
14142
2cc61e15
DD
14143: see if stdarg is available
14144echo " "
14145if $test `./findhdr stdarg.h`; then
14146 echo "<stdarg.h> found." >&4
14147 valstd="$define"
14148else
14149 echo "<stdarg.h> NOT found." >&4
14150 valstd="$undef"
14151fi
14152
14153: see if varags is available
14154echo " "
14155if $test `./findhdr varargs.h`; then
14156 echo "<varargs.h> found." >&4
14157else
14158 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14159fi
14160
14161: set up the varargs testing programs
14162$cat > varargs.c <<EOP
14163#ifdef I_STDARG
14164#include <stdarg.h>
14165#endif
14166#ifdef I_VARARGS
14167#include <varargs.h>
14168#endif
14169
14170#ifdef I_STDARG
14171int f(char *p, ...)
14172#else
14173int f(va_alist)
14174va_dcl
14175#endif
14176{
14177 va_list ap;
14178#ifndef I_STDARG
14179 char *p;
14180#endif
14181#ifdef I_STDARG
14182 va_start(ap,p);
14183#else
14184 va_start(ap);
14185 p = va_arg(ap, char *);
14186#endif
14187 va_end(ap);
14188}
14189EOP
14190$cat > varargs <<EOP
14191$startsh
14192if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14193 echo "true"
14194else
14195 echo "false"
14196fi
14197$rm -f varargs$_o
14198EOP
14199chmod +x varargs
14200
14201: now check which varargs header should be included
14202echo " "
14203i_varhdr=''
14204case "$valstd" in
14205"$define")
14206 if `./varargs I_STDARG`; then
14207 val='stdarg.h'
14208 elif `./varargs I_VARARGS`; then
14209 val='varargs.h'
14210 fi
14211 ;;
14212*)
14213 if `./varargs I_VARARGS`; then
14214 val='varargs.h'
14215 fi
14216 ;;
14217esac
14218case "$val" in
14219'')
14220echo "I could not find the definition for va_dcl... You have problems..." >&4
14221 val="$undef"; set i_stdarg; eval $setvar
14222 val="$undef"; set i_varargs; eval $setvar
14223 ;;
14224*)
14225 set i_varhdr
14226 eval $setvar
14227 case "$i_varhdr" in
14228 stdarg.h)
14229 val="$define"; set i_stdarg; eval $setvar
14230 val="$undef"; set i_varargs; eval $setvar
14231 ;;
14232 varargs.h)
14233 val="$undef"; set i_stdarg; eval $setvar
14234 val="$define"; set i_varargs; eval $setvar
14235 ;;
14236 esac
14237 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14238esac
14239$rm -f varargs*
14240
14241: see if we need va_copy
14242echo " "
14243case "$i_stdarg" in
14244"$define")
14245 $cat >try.c <<EOCP
14246#include <stdarg.h>
14247#include <stdio.h>
85c8a686
DD
14248#$i_stdlib I_STDLIB
14249#ifdef I_STDLIB
14250#include <stdlib.h>
14251#endif
14252#include <signal.h>
2cc61e15
DD
14253
14254int
14255ivfprintf(FILE *f, const char *fmt, va_list *valp)
14256{
14257 return vfprintf(f, fmt, *valp);
14258}
14259
14260int
14261myvfprintf(FILE *f, const char *fmt, va_list val)
14262{
14263 return ivfprintf(f, fmt, &val);
14264}
14265
14266int
14267myprintf(char *fmt, ...)
14268{
14269 va_list val;
14270 va_start(val, fmt);
14271 return myvfprintf(stdout, fmt, val);
14272}
14273
14274int
14275main(int ac, char **av)
14276{
85c8a686
DD
14277 signal(SIGSEGV, exit);
14278
2cc61e15
DD
14279 myprintf("%s%cs all right, then\n", "that", '\'');
14280 exit(0);
14281}
14282EOCP
14283 set try
d50de4df 14284 if eval $compile && ./try 2>&1 >/dev/null; then
2cc61e15
DD
14285 case "`./try`" in
14286 "that's all right, then")
14287 okay=yes
14288 ;;
14289 esac
14290 fi
14291 case "$okay" in
14292 yes) echo "It seems that you don't need va_copy()." >&4
14293 need_va_copy="$undef"
14294 ;;
14295 *) echo "It seems that va_copy() or similar will be needed." >&4
14296 need_va_copy="$define"
14297 ;;
14298 esac
14299 $rm -f try.* core core.* *.core *.core.*
14300 ;;
14301*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14302 ;;
14303esac
14304
b4eb6b3d
JH
14305: define a fucntion to check prototypes
14306$cat > protochk <<EOSH
14307$startsh
14308cc="$cc"
14309optimize="$optimize"
14310ccflags="$ccflags"
14311prototype="$prototype"
14312define="$define"
14313rm=$rm
14314EOSH
14315
14316$cat >> protochk <<'EOSH'
14317
14318$rm -f try.c
14319foo="$1"
14320shift
14321while test $# -ge 2; do
14322 case "$1" in
14323 $define) echo "#include <$2>" >> try.c ;;
14324 literal) echo "$2" >> try.c ;;
14325 esac
14326 shift 2
14327done
14328test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
14329cat >> try.c <<'EOCP'
14330#ifdef CAN_PROTOTYPE
14331#define _(args) args
14332#else
14333#define _(args) ()
14334#endif
14335EOCP
14336echo "$foo" >> try.c
14337echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14338$cc $optimize $ccflags -c try.c > /dev/null 2>&1
14339status=$?
14340$rm -f try.[co]
14341exit $status
14342EOSH
14343chmod +x protochk
14344$eunicefix protochk
14345
14346: see what type is used for size_t
14347rp="What is the type used for the length parameter for string functions?"
14348set size_t sizetype 'unsigned int' stdio.h sys/types.h
14349eval $typedef_ask
14350
14351: check for type of arguments to gethostbyaddr.
14352if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14353 case "$d_gethbyaddr" in
14354 $define)
14355 $cat <<EOM
14356
14357Checking to see what type of arguments are accepted by gethostbyaddr().
14358EOM
14359 hdrs="$define sys/types.h
14360 $d_socket sys/socket.h
14361 $i_niin netinet/in.h
14362 $i_netdb netdb.h
14363 $i_unistd unistd.h"
14364 : The first arg can 'char *' or 'void *'
14365 : The second arg is some of integral type
14366 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14367 for yyy in size_t long int; do
14368 case "$netdb_host_type" in
14369 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14370 if ./protochk "$try" $hdrs; then
14371 echo "Your system accepts $xxx for the first arg."
14372 echo "...and $yyy for the second arg."
14373 netdb_host_type="$xxx"
14374 netdb_hlen_type="$yyy"
14375 fi
14376 ;;
14377 esac
14378 done
14379 done
14380 : In case none of those worked, prompt the user.
14381 case "$netdb_host_type" in
14382 '') rp='What is the type for the 1st argument to gethostbyaddr?'
14383 dflt='char *'
14384 . ./myread
14385 netdb_host_type=$ans
14386 rp='What is the type for the 2nd argument to gethostbyaddr?'
14387 dflt="$sizetype"
14388 . ./myread
14389 netdb_hlen_type=$ans
14390 ;;
14391 esac
14392 ;;
14393 *) : no gethostbyaddr, so pick harmless defaults
14394 netdb_host_type='char *'
14395 netdb_hlen_type="$sizetype"
14396 ;;
14397 esac
14398 # Remove the "const" if needed. -- but then we'll have a
14399 # prototype clash!
14400 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14401fi
14402
14403: check for type of argument to gethostbyname.
14404if test "X$netdb_name_type" = X ; then
14405 case "$d_gethbyname" in
14406 $define)
14407 $cat <<EOM
14408
14409Checking to see what type of argument is accepted by gethostbyname().
14410EOM
14411 hdrs="$define sys/types.h
14412 $d_socket sys/socket.h
14413 $i_niin netinet/in.h
14414 $i_netdb netdb.h
14415 $i_unistd unistd.h"
14416 for xxx in "const char *" "char *"; do
14417 case "$netdb_name_type" in
14418 '') try="extern struct hostent *gethostbyname($xxx);"
14419 if ./protochk "$try" $hdrs; then
14420 echo "Your system accepts $xxx."
14421 netdb_name_type="$xxx"
14422 fi
14423 ;;
14424 esac
14425 done
14426 : In case none of those worked, prompt the user.
14427 case "$netdb_name_type" in
14428 '') rp='What is the type for the 1st argument to gethostbyname?'
14429 dflt='char *'
14430 . ./myread
14431 netdb_name_type=$ans
14432 ;;
14433 esac
14434 ;;
14435 *) : no gethostbyname, so pick harmless default
14436 netdb_name_type='char *'
14437 ;;
14438 esac
14439fi
14440
14441: check for type of 1st argument to getnetbyaddr.
14442if test "X$netdb_net_type" = X ; then
14443 case "$d_getnbyaddr" in
14444 $define)
14445 $cat <<EOM
14446
14447Checking to see what type of 1st argument is accepted by getnetbyaddr().
14448EOM
14449 hdrs="$define sys/types.h
14450 $d_socket sys/socket.h
14451 $i_niin netinet/in.h
14452 $i_netdb netdb.h
14453 $i_unistd unistd.h"
14454 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14455 case "$netdb_net_type" in
14456 '') try="extern struct netent *getnetbyaddr($xxx, int);"
14457 if ./protochk "$try" $hdrs; then
14458 echo "Your system accepts $xxx."
14459 netdb_net_type="$xxx"
14460 fi
14461 ;;
14462 esac
14463 done
14464 : In case none of those worked, prompt the user.
14465 case "$netdb_net_type" in
14466 '') rp='What is the type for the 1st argument to getnetbyaddr?'
14467 dflt='long'
14468 . ./myread
14469 netdb_net_type=$ans
14470 ;;
14471 esac
14472 ;;
14473 *) : no getnetbyaddr, so pick harmless default
14474 netdb_net_type='long'
14475 ;;
14476 esac
14477fi
14478: locate the preferred pager for this system
14479case "$pager" in
14480'')
14481 dflt=''
14482 case "$pg" in
14483 /*) dflt=$pg;;
14484 [a-zA-Z]:/*) dflt=$pg;;
14485 esac
14486 case "$more" in
14487 /*) dflt=$more;;
14488 [a-zA-Z]:/*) dflt=$more;;
14489 esac
14490 case "$less" in
14491 /*) dflt=$less;;
14492 [a-zA-Z]:/*) dflt=$less;;
14493 esac
14494 case "$dflt" in
14495 '') dflt=/usr/ucb/more;;
14496 esac
14497 ;;
14498*) dflt="$pager";;
14499esac
14500echo " "
14501fn=f/
14502rp='What pager is used on your system?'
14503. ./getfile
14504pager="$ans"
14505
14506: see what type pids are declared as in the kernel
14507rp="What is the type of process ids on this system?"
14508set pid_t pidtype int stdio.h sys/types.h
14509eval $typedef_ask
14510
14511: Find earliest binary compatible site_perl subdirectory perl can use.
14512case "$bincompat5005" in
14513"$define") xs_apiversion='5.005' ;;
14514*) xs_apiversion=$version ;; # The current site_perl version.
14515esac
14516: Find earliest pure perl site_perl subdirectory perl can use.
14517: The versioned directories started at 5.005.
14518pm_apiversion='5.005'
14519
b4eb6b3d
JH
14520: see if ar generates random libraries by itself
14521echo " "
14522echo "Checking how to generate random libraries on your machine..." >&4
14523echo 'int bar1() { return bar2(); }' > bar1.c
14524echo 'int bar2() { return 2; }' > bar2.c
14525$cat > foo.c <<'EOP'
14526int main() { printf("%d\n", bar1()); exit(0); }
14527EOP
14528$cc $ccflags -c bar1.c >/dev/null 2>&1
14529$cc $ccflags -c bar2.c >/dev/null 2>&1
14530$cc $ccflags -c foo.c >/dev/null 2>&1
14531$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 14532if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
b4eb6b3d
JH
14533 ./foobar >/dev/null 2>&1; then
14534 echo "$ar appears to generate random libraries itself."
14535 orderlib=false
14536 ranlib=":"
14537elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 14538 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
b4eb6b3d
JH
14539 ./foobar >/dev/null 2>&1; then
14540 echo "a table of contents needs to be added with '$ar ts'."
14541 orderlib=false
14542 ranlib="$ar ts"
14543else
14544 case "$ranlib" in
14545 :) ranlib='';;
14546 '')
14547 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14548 $test -f $ranlib || ranlib=''
14549 ;;
14550 esac
14551 if $test -n "$ranlib"; then
14552 echo "your system has '$ranlib'; we'll use that."
14553 orderlib=false
14554 else
14555 echo "your system doesn't seem to support random libraries"
14556 echo "so we'll use lorder and tsort to order the libraries."
14557 orderlib=true
14558 ranlib=":"
14559 fi
14560fi
14561$rm -f foo* bar*
14562
14563: check for type of arguments to select.
14564case "$selecttype" in
14565'') case "$d_select" in
14566 $define)
14567 echo " "
14568 $cat <<EOM
14569Checking to see what type of arguments are accepted by select().
14570EOM
14571 hdrs="$define sys/types.h
14572 $i_systime sys/time.h
14573 $i_sysselct sys/select.h
14574 $d_socket sys/socket.h"
14575 : The first arg can be int, unsigned, or size_t
14576 : The last arg may or may not be 'const'
14577 val=''
14578 : void pointer has been seen but using that
14579 : breaks the selectminbits test
14580 for xxx in 'fd_set *' 'int *'; do
14581 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14582 for tmo in 'struct timeval *' 'const struct timeval *'; do
14583 case "$val" in
14584 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14585 if ./protochk "$try" $hdrs; then
14586 echo "Your system accepts $xxx."
14587 val="$xxx"
14588 fi
14589 ;;
14590 esac
14591 done
14592 done
14593 done
14594 case "$val" in
14595 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14596 case "$d_fd_set" in
14597 $define) dflt="fd_set *" ;;
14598 *) dflt="int *" ;;
14599 esac
14600 . ./myread
14601 val=$ans
14602 ;;
14603 esac
14604 selecttype="$val"
14605 ;;
14606 *) : no select, so pick a harmless default
14607 selecttype='int *'
14608 ;;
14609 esac
14610 ;;
14611esac
14612
14613: check for the select 'width'
14614case "$selectminbits" in
14615'') case "$d_select" in
14616 $define)
14617 $cat <<EOM
14618
14619Checking to see on how many bits at a time your select() operates...
14620EOM
14621 $cat >try.c <<EOCP
14622#include <sys/types.h>
14623#$i_time I_TIME
14624#$i_systime I_SYS_TIME
14625#$i_systimek I_SYS_TIME_KERNEL
14626#ifdef I_TIME
14627# include <time.h>
14628#endif
14629#ifdef I_SYS_TIME
14630# ifdef I_SYS_TIME_KERNEL
14631# define KERNEL
14632# endif
14633# include <sys/time.h>
14634# ifdef I_SYS_TIME_KERNEL
14635# undef KERNEL
14636# endif
14637#endif
14638#$i_sysselct I_SYS_SELECT
14639#ifdef I_SYS_SELECT
14640#include <sys/select.h>
14641#endif
14642#$d_socket HAS_SOCKET
14643#ifdef HAS_SOCKET
14644# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14645#endif
14646#include <stdio.h>
14647$selecttype b;
14648#define S sizeof(*(b))
14649#define MINBITS 64
14650#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14651#define NBITS (NBYTES * 8)
14652int main() {
14653 char s[NBYTES];
14654 struct timeval t;
14655 int i;
14656 FILE* fp;
14657 int fd;
14658
14659 fclose(stdin);
14660 fp = fopen("try.c", "r");
14661 if (fp == 0)
14662 exit(1);
14663 fd = fileno(fp);
14664 if (fd < 0)
14665 exit(2);
14666 b = ($selecttype)s;
14667 for (i = 0; i < NBITS; i++)
14668 FD_SET(i, b);
14669 t.tv_sec = 0;
14670 t.tv_usec = 0;
14671 select(fd + 1, b, 0, 0, &t);
14672 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14673 printf("%d\n", i + 1);
14674 return 0;
14675}
14676EOCP
14677 set try
14678 if eval $compile_ok; then
14679 selectminbits=`./try`
14680 case "$selectminbits" in
14681 '') cat >&4 <<EOM
14682Cannot figure out on how many bits at a time your select() operates.
14683I'll play safe and guess it is 32 bits.
14684EOM
14685 selectminbits=32
14686 bits="32 bits"
14687 ;;
14688 1) bits="1 bit" ;;
14689 *) bits="$selectminbits bits" ;;
14690 esac
14691 echo "Your select() operates on $bits at a time." >&4
14692 else
14693 rp='What is the minimum number of bits your select() operates on?'
14694 case "$byteorder" in
14695 1234|12345678) dflt=32 ;;
14696 *) dflt=1 ;;
14697 esac
14698 . ./myread
14699 val=$ans
14700 selectminbits="$val"
14701 fi
14702 $rm -f try.* try
14703 ;;
14704 *) : no select, so pick a harmless default
14705 selectminbits='32'
14706 ;;
14707 esac
14708 ;;
14709esac
14710
14711: Trace out the files included by signal.h, then look for SIGxxx names.
14712: Remove SIGARRAYSIZE used by HPUX.
14713: Remove SIGSTKSIZE used by Linux.
14714: Remove SIGSTKSZ used by Posix.
14715: Remove SIGTYP void lines used by OS2.
14716: Some cpps, like os390, dont give the file name anywhere
14717if [ "X$fieldn" = X ]; then
14718 : Just make some guesses. We check them later.
14719 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14720else
14721 xxx=`echo '#include <signal.h>' |
14722 $cppstdin $cppminus $cppflags 2>/dev/null |
14723 $grep '^[ ]*#.*include' |
a938a3bb 14724 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
14725fi
14726: Check this list of files to be sure we have parsed the cpp output ok.
14727: This will also avoid potentially non-existent files, such
14728: as ../foo/bar.h
14729xxxfiles=''
14730for xx in $xxx /dev/null ; do
14731 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14732done
14733: If we have found no files, at least try signal.h
14734case "$xxxfiles" in
14735'') xxxfiles=`./findhdr signal.h` ;;
14736esac
14737xxx=`awk '
14738$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14739 print substr($2, 4, 20)
14740}
14741$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14742 print substr($3, 4, 20)
14743}' $xxxfiles`
14744: Append some common names just in case the awk scan failed.
14745xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14746xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14747xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14748xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14749xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14750
14751: generate a few handy files for later
14752$cat > signal.c <<'EOCP'
14753#include <sys/types.h>
14754#include <signal.h>
14755#include <stdio.h>
14756int main() {
14757
14758/* Strange style to avoid deeply-nested #if/#else/#endif */
14759#ifndef NSIG
14760# ifdef _NSIG
14761# define NSIG (_NSIG)
14762# endif
14763#endif
14764
14765#ifndef NSIG
14766# ifdef SIGMAX
14767# define NSIG (SIGMAX+1)
14768# endif
14769#endif
14770
14771#ifndef NSIG
14772# ifdef SIG_MAX
14773# define NSIG (SIG_MAX+1)
14774# endif
14775#endif
14776
14777#ifndef NSIG
14778# ifdef MAXSIG
14779# define NSIG (MAXSIG+1)
14780# endif
14781#endif
14782
14783#ifndef NSIG
14784# ifdef MAX_SIG
14785# define NSIG (MAX_SIG+1)
14786# endif
14787#endif
14788
14789#ifndef NSIG
14790# ifdef SIGARRAYSIZE
14791# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14792# endif
14793#endif
14794
14795#ifndef NSIG
14796# ifdef _sys_nsig
14797# define NSIG (_sys_nsig) /* Solaris 2.5 */
14798# endif
14799#endif
14800
14801/* Default to some arbitrary number that's big enough to get most
14802 of the common signals.
14803*/
14804#ifndef NSIG
14805# define NSIG 50
14806#endif
14807
14808printf("NSIG %d\n", NSIG);
14809
14810#ifndef JUST_NSIG
14811
14812EOCP
14813
14814echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14815{
14816 printf "#ifdef SIG"; printf $1; printf "\n"
14817 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14818 printf $1; printf ");\n"
14819 printf "#endif\n"
14820}
14821END {
14822 printf "#endif /* JUST_NSIG */\n";
14823 printf "exit(0);\n}\n";
14824}
14825' >>signal.c
14826$cat >signal.awk <<'EOP'
14827BEGIN { ndups = 0 }
14828$1 ~ /^NSIG$/ { nsig = $2 }
14829($1 !~ /^NSIG$/) && (NF == 2) {
14830 if ($2 > maxsig) { maxsig = $2 }
14831 if (sig_name[$2]) {
14832 dup_name[ndups] = $1
14833 dup_num[ndups] = $2
14834 ndups++
14835 }
14836 else {
14837 sig_name[$2] = $1
14838 sig_num[$2] = $2
14839 }
14840}
14841END {
14842 if (nsig == 0) {
14843 nsig = maxsig + 1
14844 }
14845 printf("NSIG %d\n", nsig);
14846 for (n = 1; n < nsig; n++) {
14847 if (sig_name[n]) {
14848 printf("%s %d\n", sig_name[n], sig_num[n])
14849 }
14850 else {
14851 printf("NUM%d %d\n", n, n)
14852 }
14853 }
14854 for (n = 0; n < ndups; n++) {
14855 printf("%s %d\n", dup_name[n], dup_num[n])
14856 }
14857}
14858EOP
14859$cat >signal_cmd <<EOS
14860$startsh
14861if $test -s signal.lst; then
14862 echo "Using your existing signal.lst file"
14863 exit 0
14864fi
14865xxx="$xxx"
14866EOS
14867$cat >>signal_cmd <<'EOS'
14868
14869set signal
14870if eval $compile_ok; then
14871 ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14872else
14873 echo "(I can't seem be able to compile the whole test program)" >&4
14874 echo "(I'll try it in little pieces.)" >&4
14875 set signal -DJUST_NSIG
14876 if eval $compile_ok; then
14877 ./signal$_exe > signal.nsg
14878 $cat signal.nsg
14879 else
14880 echo "I can't seem to figure out how many signals you have." >&4
14881 echo "Guessing 50." >&4
14882 echo 'NSIG 50' > signal.nsg
14883 fi
14884 : Now look at all the signal names, one at a time.
14885 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14886 $cat > signal.c <<EOCP
14887#include <sys/types.h>
14888#include <signal.h>
14889#include <stdio.h>
14890int main() {
14891printf("$xx %d\n", SIG${xx});
14892return 0;
14893}
14894EOCP
14895 set signal
14896 if eval $compile; then
14897 echo "SIG${xx} found."
14898 ./signal$_exe >> signal.ls1
14899 else
14900 echo "SIG${xx} NOT found."
14901 fi
14902 done
14903 if $test -s signal.ls1; then
14904 $cat signal.nsg signal.ls1 |
14905 $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14906 fi
14907
14908fi
14909if $test -s signal.lst; then
14910 :
14911else
14912 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14913 echo 'kill -l' >signal
14914 set X `csh -f <signal`
14915 $rm -f signal
14916 shift
14917 case $# in
14918 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14919 esac
14920 echo $@ | $tr ' ' $trnl | \
14921 $awk '{ printf "%s %d\n", $1, ++s; }
14922 END { printf "NSIG %d\n", ++s }' >signal.lst
14923fi
14924$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14925EOS
14926chmod a+x signal_cmd
14927$eunicefix signal_cmd
14928
14929: generate list of signal names
14930echo " "
14931case "$sig_name_init" in
14932'') doinit=yes ;;
14933*) case "$sig_num_init" in
14934 ''|*,*) doinit=yes ;;
14935 esac ;;
14936esac
14937case "$doinit" in
14938yes)
14939 echo "Generating a list of signal names and numbers..." >&4
14940 . ./signal_cmd
14941 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14942 sig_name=`$awk 'BEGIN { printf "ZERO " }
14943 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14944 sig_num=`$awk 'BEGIN { printf "0 " }
14945 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14946 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
14947 !/^NSIG/ { printf "\"%s\", ", $1 }
14948 END { printf "0\n" }' signal.lst`
14949 sig_num_init=`$awk 'BEGIN { printf "0, " }
14950 !/^NSIG/ { printf "%d, ", $2}
14951 END { printf "0\n"}' signal.lst`
14952 ;;
14953esac
14954echo "The following $sig_count signals are available:"
14955echo " "
14956echo $sig_name | $awk \
14957'BEGIN { linelen = 0 }
14958{
14959 for (i = 1; i <= NF; i++) {
14960 name = "SIG" $i " "
14961 linelen = linelen + length(name)
14962 if (linelen > 70) {
14963 printf "\n"
14964 linelen = length(name)
14965 }
14966 printf "%s", name
14967 }
14968 printf "\n"
14969}'
76d3c696 14970sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
14971$rm -f signal signal.c signal.awk signal.lst signal_cmd
14972
14973echo " "
14974case "$sizetype" in
14975*_t) zzz="$sizetype" ;;
14976*) zzz="filesize" ;;
14977esac
14978echo "Checking the size of $zzz..." >&4
14979cat > try.c <<EOCP
14980#include <sys/types.h>
14981#include <stdio.h>
14982int main() {
14983 printf("%d\n", (int)sizeof($sizetype));
14984 exit(0);
14985}
14986EOCP
14987set try
14988if eval $compile_ok; then
14989 yyy=`./try`
14990 case "$yyy" in
14991 '') sizesize=4
14992 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14993 ;;
14994 *) sizesize=$yyy
14995 echo "Your $zzz size is $sizesize bytes."
14996 ;;
14997 esac
14998else
14999 sizesize=4
15000 echo "(I can't compile the test program--guessing $sizesize.)" >&4
15001fi
15002
15003
15004: check for socklen_t
15005echo " "
15006echo "Checking to see if you have socklen_t..." >&4
15007$cat >try.c <<EOCP
15008#include <sys/types.h>
15009#$d_socket HAS_SOCKET
15010#ifdef HAS_SOCKET
15011#include <sys/socket.h>
15012#endif
15013int main() { socklen_t x = 16; }
15014EOCP
15015set try
15016if eval $compile; then
15017 val="$define"
15018 echo "You have socklen_t."
15019else
15020 val="$undef"
15021 echo "You do not have socklen_t."
15022 case "$sizetype" in
15023 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
15024 esac
15025fi
15026$rm -f try try.*
15027set d_socklen_t
15028eval $setvar
15029
a7710f8d
JH
15030: see if this is a socks.h system
15031set socks.h i_socks
15032eval $inhdr
15033
b4eb6b3d
JH
15034: check for type of the size argument to socket calls
15035case "$d_socket" in
15036"$define")
15037 $cat <<EOM
15038
15039Checking to see what type is the last argument of accept().
15040EOM
b4eb6b3d
JH
15041 yyy=''
15042 case "$d_socklen_t" in
15043 "$define") yyy="$yyy socklen_t"
15044 esac
15045 yyy="$yyy $sizetype int long unsigned"
15046 for xxx in $yyy; do
15047 case "$socksizetype" in
15048 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
15049 case "$usesocks" in
15050 "$define")
15051 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
15052 echo "Your system accepts '$xxx *' for the last argument of accept()."
15053 socksizetype="$xxx"
15054 fi
15055 ;;
15056 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
15057 echo "Your system accepts '$xxx *' for the last argument of accept()."
15058 socksizetype="$xxx"
15059 fi
15060 ;;
15061 esac
b4eb6b3d
JH
15062 ;;
15063 esac
15064 done
15065: In case none of those worked, prompt the user.
15066 case "$socksizetype" in
15067 '') rp='What is the type for socket address structure sizes?'
15068 dflt='int'
15069 . ./myread
15070 socksizetype=$ans
15071 ;;
15072 esac
15073 ;;
15074*) : no sockets, so pick relatively harmless default
15075 socksizetype='int'
15076 ;;
15077esac
15078
15079: see what type is used for signed size_t
15080set ssize_t ssizetype int stdio.h sys/types.h
15081eval $typedef
15082dflt="$ssizetype"
15083$cat > ssize.c <<EOM
15084#include <stdio.h>
15085#include <sys/types.h>
15086#define Size_t $sizetype
15087#define SSize_t $dflt
15088int main()
15089{
15090 if (sizeof(Size_t) == sizeof(SSize_t))
15091 printf("$dflt\n");
15092 else if (sizeof(Size_t) == sizeof(int))
15093 printf("int\n");
15094 else
15095 printf("long\n");
15096 exit(0);
15097}
15098EOM
15099echo " "
15100set ssize
15101if eval $compile_ok && ./ssize > /dev/null; then
15102 ssizetype=`./ssize`
15103 echo "I'll be using $ssizetype for functions returning a byte count." >&4
15104else
15105 $cat >&4 <<EOM
15106Help! I can't compile and run the ssize_t test program: please enlighten me!
15107(This is probably a misconfiguration in your system or libraries, and
15108you really ought to fix it. Still, I'll try anyway.)
15109
15110I need a type that is the same size as $sizetype, but is guaranteed to
15111be signed. Common values are ssize_t, int and long.
15112
15113EOM
15114 rp="What signed type is the same size as $sizetype?"
15115 . ./myread
15116 ssizetype="$ans"
15117fi
15118$rm -f ssize ssize.*
15119
15120: see what type of char stdio uses.
15121echo " "
aa517f50
JH
15122echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
15123if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
15124 echo "Your stdio uses unsigned chars." >&4
15125 stdchar="unsigned char"
15126else
aa517f50
JH
15127 echo "Your stdio uses signed chars." >&4
15128 stdchar="char"
b4eb6b3d 15129fi
aa517f50
JH
15130$rm -f stdioh
15131
15132
b4eb6b3d
JH
15133
15134: see if time exists
15135echo " "
15136if test "X$d_time" = X -o X"$timetype" = X; then
15137 if set time val -f d_time; eval $csym; $val; then
15138 echo 'time() found.' >&4
15139 val="$define"
15140 rp="What is the type returned by time() on this system?"
15141 set time_t timetype long stdio.h sys/types.h
15142 eval $typedef_ask
15143 else
15144 echo 'time() not found, hope that will do.' >&4
15145 val="$undef"
15146 timetype='int';
15147 fi
15148 set d_time
15149 eval $setvar
15150fi
15151
15152: see what type uids are declared as in the kernel
15153echo " "
15154echo "Looking for the type for user ids returned by getuid()."
15155set uid_t uidtype xxx stdio.h sys/types.h
15156eval $typedef
15157case "$uidtype" in
15158xxx)
15159 xxx=`./findhdr sys/user.h`
15160 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15161 case $1 in
15162 unsigned) dflt="$1 $2" ;;
15163 *) dflt="$1" ;;
15164 esac
15165 ;;
15166*) dflt="$uidtype";;
15167esac
15168case "$uidtype" in
15169uid_t) echo "uid_t found." ;;
15170*) rp="What is the type for user ids returned by getuid()?"
15171 . ./myread
15172 uidtype="$ans"
15173 ;;
15174esac
15175
15176echo " "
15177case "$uidtype" in
15178*_t) zzz="$uidtype" ;;
15179*) zzz="uid" ;;
15180esac
15181echo "Checking the size of $zzz..." >&4
15182cat > try.c <<EOCP
15183#include <sys/types.h>
15184#include <stdio.h>
15185int main() {
15186 printf("%d\n", (int)sizeof($uidtype));
15187 exit(0);
15188}
15189EOCP
15190set try
15191if eval $compile_ok; then
15192 yyy=`./try`
15193 case "$yyy" in
15194 '') uidsize=4
15195 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15196 ;;
15197 *) uidsize=$yyy
15198 echo "Your $zzz is $uidsize bytes long."
15199 ;;
15200 esac
15201else
15202 uidsize=4
15203 echo "(I can't compile the test program--guessing $uidsize.)" >&4
15204fi
15205
15206echo " "
15207case "$uidtype" in
15208*_t) zzz="$uidtype" ;;
15209*) zzz="uid" ;;
15210esac
15211echo "Checking the sign of $zzz..." >&4
15212cat > try.c <<EOCP
15213#include <sys/types.h>
15214#include <stdio.h>
15215int main() {
15216 $uidtype foo = -1;
15217 if (foo < 0)
15218 printf("-1\n");
15219 else
15220 printf("1\n");
15221}
15222EOCP
15223set try
15224if eval $compile; then
15225 yyy=`./try`
15226 case "$yyy" in
15227 '') uidsign=1
15228 echo "(I can't execute the test program--guessing unsigned.)" >&4
15229 ;;
15230 *) uidsign=$yyy
15231 case "$uidsign" in
15232 1) echo "Your $zzz is unsigned." ;;
15233 -1) echo "Your $zzz is signed." ;;
15234 esac
15235 ;;
15236 esac
15237else
15238 uidsign=1
15239 echo "(I can't compile the test program--guessing unsigned.)" >&4
15240fi
15241
15242
15243
15244echo " "
15245$echo "Checking the format string to be used for uids..." >&4
15246
15247case "$uidsign" in
15248-1) if $test X"$uidsize" = X"$ivsize"; then
15249 uidformat="$ivdformat"
15250 else
15251 if $test X"$uidsize" = X"$longsize"; then
15252 uidformat='"ld"'
15253 else
15254 if $test X"$uidsize" = X"$intsize"; then
15255 uidformat='"d"'
15256 else
15257 if $test X"$uidsize" = X"$shortsize"; then
15258 uidformat='"hd"'
15259 fi
15260 fi
15261 fi
15262 fi
15263 ;;
15264*) if $test X"$uidsize" = X"$uvsize"; then
15265 uidformat="$uvuformat"
15266 else
15267 if $test X"$uidsize" = X"$longsize"; then
15268 uidformat='"lu"'
15269 else
15270 if $test X"$uidsize" = X"$intsize"; then
15271 uidformat='"u"'
15272 else
15273 if $test X"$uidsize" = X"$shortsize"; then
15274 uidformat='"hu"'
15275 fi
15276 fi
15277 fi
15278 fi
15279 ;;
15280esac
15281
3659ebf1
JH
15282: determine compiler compiler
15283case "$yacc" in
15284'')
15285 dflt=yacc;;
15286*)
15287 dflt="$yacc";;
15288esac
15289echo " "
15290comp='yacc'
15291if $test -f "$byacc"; then
15292 dflt="$byacc"
15293 comp="byacc or $comp"
15294fi
15295if $test -f "$bison"; then
15296 comp="$comp or bison -y"
15297fi
15298rp="Which compiler compiler ($comp) shall I use?"
15299. ./myread
15300yacc="$ans"
15301case "$yacc" in
15302*bis*)
15303 case "$yacc" in
15304 *-y*) ;;
15305 *)
15306 yacc="$yacc -y"
15307 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15308 ;;
15309 esac
15310 ;;
15311esac
15312
b4eb6b3d
JH
15313: see if fcntl.h is there
15314val=''
15315set fcntl.h val
15316eval $inhdr
15317
15318: see if we can include fcntl.h
15319case "$val" in
15320"$define")
15321 echo " "
15322 if $h_fcntl; then
15323 val="$define"
15324 echo "We'll be including <fcntl.h>." >&4
15325 else
15326 val="$undef"
15327 if $h_sysfile; then
15328 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15329 else
15330 echo "We won't be including <fcntl.h>." >&4
15331 fi
15332 fi
15333 ;;
15334*)
15335 h_fcntl=false
15336 val="$undef"
15337 ;;
15338esac
15339set i_fcntl
15340eval $setvar
15341
15342: see if this is a iconv.h system
15343set iconv.h i_iconv
15344eval $inhdr
15345
15346: see if this is a ieeefp.h system
15347set ieeefp.h i_ieeefp
15348eval $inhdr
15349
15350: see if this is a libutil.h system
15351set libutil.h i_libutil
15352eval $inhdr
15353
15354: see if locale.h is available
15355set locale.h i_locale
15356eval $inhdr
15357
15358: see if mach cthreads are available
15359if test "X$usethreads" = "X$define"; then
15360 set mach/cthreads.h i_machcthr
15361 eval $inhdr
15362else
15363 i_machcthr="$undef"
15364fi
15365
15366
15367
15368: see if this is a math.h system
15369set math.h i_math
15370eval $inhdr
15371
15372: see if this is a mntent.h system
15373set mntent.h i_mntent
15374eval $inhdr
15375
15376: see if ndbm.h is available
15377set ndbm.h t_ndbm
15378eval $inhdr
15379case "$t_ndbm" in
15380$define)
15381 : see if dbm_open exists
15382 set dbm_open d_dbm_open
15383 eval $inlibc
15384 case "$d_dbm_open" in
15385 $undef)
15386 t_ndbm="$undef"
15387 echo "We won't be including <ndbm.h>"
15388 ;;
15389 esac
15390 ;;
15391esac
15392val="$t_ndbm"
15393set i_ndbm
15394eval $setvar
15395
15396: see if net/errno.h is available
15397val=''
15398set net/errno.h val
15399eval $inhdr
15400
15401: Unfortunately, it causes problems on some systems. Arrgh.
15402case "$val" in
15403$define)
15404 cat > try.c <<'EOM'
15405#include <stdio.h>
15406#include <errno.h>
15407#include <net/errno.h>
15408int func()
15409{
15410 return ENOTSOCK;
15411}
15412EOM
15413 if $cc $ccflags -c try.c >/dev/null 2>&1; then
15414 echo "We'll be including <net/errno.h>." >&4
15415 else
15416 echo "We won't be including <net/errno.h>." >&4
15417 val="$undef"
15418 fi
15419 $rm -f try.* try
15420 ;;
15421esac
15422set i_neterrno
15423eval $setvar
15424
15425: see if netinet/tcp.h is available
15426set netinet/tcp.h i_netinettcp
15427eval $inhdr
15428
15429: see if this is a poll.h system
15430set poll.h i_poll
15431eval $inhdr
15432
15433: see if this is a prot.h system
15434set prot.h i_prot
15435eval $inhdr
15436
15437echo " "
15438$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
15439$cat <<'EOSH' > Cppsym.know
15440a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15441AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
d46c9a2d
JH
15442alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15443ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15444BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
15445BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15446bull c cadmus clipper CMU COFF COMPILER_VERSION
15447concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15448CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15449Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15450FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15451GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15452H3050R H3050RX hbullx20 hcx host_mips
15453hp200 hp300 hp700 HP700 hp800 hp9000
15454hp9000s200 hp9000s300 hp9000s400 hp9000s500
15455hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15456i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 15457IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
15458INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15459LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15460LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15461Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15462LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15463M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15464M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15465M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15466MATH_HAS_NO_SIDE_EFFECTS
15467mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15468mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15469mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15470MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15471mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15472NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 15473news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
15474ns32016 ns32332 ns32k nsc32000
15475OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15476pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15477pc532 pdp11 PGC PIC plexus PORTAR posix
15478POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15479POSIX_C_SOURCE POSIX_SOURCE POWER
15480PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 15481riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
15482SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15483sony sony_news sonyrisc sparc sparclite spectrum
15484stardent stdc STDC_EXT stratos sun sun3 sun386
15485Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15486SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15487SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15488sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 15489TM3200 TM5400 TM5600
b4eb6b3d
JH
15490tower tower32 tower32_200 tower32_600 tower32_700
15491tower32_800 tower32_850 tss
15492u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15493ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15494unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15495Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15496XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15497XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15498z8000
15499EOSH
15500# Maybe put other stuff here too.
15501cat <<EOSH >>Cppsym.know
15502$osname
15503EOSH
15504./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15505./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15506$cat Cppsym.know > Cppsym.c
381aa1ff 15507$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
15508$rm -f Cppsym.a Cppsym.b Cppsym.c
15509cat <<EOSH > Cppsym
15510$startsh
15511if $test \$# -gt 0; then
15512 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15513 if $test -s Cppsym.got; then
15514 $rm -f Cppsym.got
15515 exit 0
15516 fi
15517 $rm -f Cppsym.got
15518 exit 1
15519else
15520 $tr " " "$trnl" | ./Cppsym.try
15521 exit 0
15522fi
15523EOSH
15524chmod +x Cppsym
15525$eunicefix Cppsym
15526cat <<EOSH > Cppsym.try
15527$startsh
15528cat <<'EOCP' > try.c
15529#include <stdio.h>
15530int main() {
15531EOCP
15532$awk \\
15533EOSH
15534cat <<'EOSH' >> Cppsym.try
15535'length($1) > 0 {
2ef53570
JH
15536 printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15537 printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15538 printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15539 printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
b4eb6b3d 15540}' >> try.c
2ef53570 15541echo 'return 0;}' >> try.c
b4eb6b3d
JH
15542EOSH
15543cat <<EOSH >> Cppsym.try
15544ccflags="$ccflags"
15545case "$osname-$gccversion" in
15546irix-) ccflags="\$ccflags -woff 1178" ;;
15547os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15548esac
7a282f6d 15549$cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
b4eb6b3d
JH
15550EOSH
15551chmod +x Cppsym.try
15552$eunicefix Cppsym.try
15553./Cppsym < Cppsym.know > Cppsym.true
15554: now check the C compiler for additional symbols
15555postprocess_cc_v=''
15556case "$osname" in
15557aix) postprocess_cc_v="|$tr , ' '" ;;
15558esac
15559$cat >ccsym <<EOS
15560$startsh
15561$cat >tmp.c <<EOF
15562extern int foo;
15563EOF
15564for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15565do
15566 case "\$i" in
15567 -D*) echo "\$i" | $sed 's/^-D//';;
15568 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15569 esac
15570done
15571$rm -f try.c
15572EOS
15573postprocess_cc_v=''
15574chmod +x ccsym
15575$eunicefix ccsym
15576./ccsym > ccsym1.raw
15577if $test -s ccsym1.raw; then
15578 $sort ccsym1.raw | $uniq >ccsym.raw
15579else
15580 mv ccsym1.raw ccsym.raw
15581fi
15582
15583$awk '/\=/ { print $0; next }
15584 { print $0"=1" }' ccsym.raw >ccsym.list
15585$awk '/\=/ { print $0; next }
15586 { print $0"=1" }' Cppsym.true >ccsym.true
15587$comm -13 ccsym.true ccsym.list >ccsym.own
15588$comm -12 ccsym.true ccsym.list >ccsym.com
15589$comm -23 ccsym.true ccsym.list >ccsym.cpp
15590also=''
15591if $test -z ccsym.raw; then
15592 echo "Your C compiler doesn't seem to define any symbols!" >&4
15593 echo " "
15594 echo "However, your C preprocessor defines the following symbols:"
15595 $cat Cppsym.true
15596 ccsymbols=''
15597 cppsymbols=`$cat Cppsym.true`
15598 cppsymbols=`echo $cppsymbols`
15599 cppccsymbols="$cppsymbols"
15600else
15601 if $test -s ccsym.com; then
15602 echo "Your C compiler and pre-processor define these symbols:"
15603 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15604 also='also '
15605 symbols='ones'
15606 cppccsymbols=`$cat ccsym.com`
15607 cppccsymbols=`echo $cppccsymbols`
15608 $test "$silent" || sleep 1
15609 fi
15610 if $test -s ccsym.cpp; then
15611 $test "$also" && echo " "
15612 echo "Your C pre-processor ${also}defines the following symbols:"
15613 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15614 also='further '
15615 cppsymbols=`$cat ccsym.cpp`
15616 cppsymbols=`echo $cppsymbols`
15617 $test "$silent" || sleep 1
15618 fi
15619 if $test -s ccsym.own; then
15620 $test "$also" && echo " "
15621 echo "Your C compiler ${also}defines the following cpp symbols:"
15622 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15623 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15624 ccsymbols=`$cat ccsym.own`
15625 ccsymbols=`echo $ccsymbols`
15626 $test "$silent" || sleep 1
15627 fi
15628fi
15629$rm -f ccsym* Cppsym.*
15630
15631: see if this is a termio system
15632val="$undef"
15633val2="$undef"
15634val3="$undef"
15635if $test `./findhdr termios.h`; then
15636 set tcsetattr i_termios
15637 eval $inlibc
15638 val3="$i_termios"
15639fi
15640echo " "
15641case "$val3" in
15642"$define") echo "You have POSIX termios.h... good!" >&4;;
15643*) if ./Cppsym pyr; then
15644 case "`/bin/universe`" in
15645 ucb) if $test `./findhdr sgtty.h`; then
15646 val2="$define"
15647 echo "<sgtty.h> found." >&4
15648 else
15649 echo "System is pyramid with BSD universe."
15650 echo "<sgtty.h> not found--you could have problems." >&4
15651 fi;;
15652 *) if $test `./findhdr termio.h`; then
15653 val="$define"
15654 echo "<termio.h> found." >&4
15655 else
15656 echo "System is pyramid with USG universe."
15657 echo "<termio.h> not found--you could have problems." >&4
15658 fi;;
15659 esac
15660 elif ./usg; then
15661 if $test `./findhdr termio.h`; then
15662 echo "<termio.h> found." >&4
15663 val="$define"
15664 elif $test `./findhdr sgtty.h`; then
15665 echo "<sgtty.h> found." >&4
15666 val2="$define"
15667 else
15668echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15669 fi
15670 else
15671 if $test `./findhdr sgtty.h`; then
15672 echo "<sgtty.h> found." >&4
15673 val2="$define"
15674 elif $test `./findhdr termio.h`; then
15675 echo "<termio.h> found." >&4
15676 val="$define"
15677 else
15678echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15679 fi
15680 fi;;
15681esac
15682set i_termio; eval $setvar
15683val=$val2; set i_sgtty; eval $setvar
15684val=$val3; set i_termios; eval $setvar
15685
15686: see if this is a shadow.h system
15687set shadow.h i_shadow
15688eval $inhdr
15689
b4eb6b3d
JH
15690: see if stddef is available
15691set stddef.h i_stddef
15692eval $inhdr
923fc586 15693
b4eb6b3d
JH
15694: see if this is a sunmath.h system
15695set sunmath.h i_sunmath
15696eval $inhdr
5f80c64f 15697
b4eb6b3d
JH
15698: see if sys/access.h is available
15699set sys/access.h i_sysaccess
15700eval $inhdr
15701
15702: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15703set sys/filio.h i_sysfilio
15704eval $inhdr
15705echo " "
15706if $test `./findhdr sys/ioctl.h`; then
15707 val="$define"
15708 echo '<sys/ioctl.h> found.' >&4
15709else
15710 val="$undef"
15711 if $test $i_sysfilio = "$define"; then
15712 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 15713 else
b4eb6b3d
JH
15714 $test $i_sgtty = "$define" && xxx="sgtty.h"
15715 $test $i_termio = "$define" && xxx="termio.h"
15716 $test $i_termios = "$define" && xxx="termios.h"
15717echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15718 fi
15719fi
15720set i_sysioctl
15721eval $setvar
15722
49a78c82
JH
15723: see if socket ioctl defs are in sys/sockio.h
15724echo " "
15725xxx=`./findhdr sys/sockio.h`
15726if $test "$xxx"; then
15727 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
15728 val="$define"
15729 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
15730 else
15731 val="$undef"
15732 echo "No socket ioctls found in <sys/sockio.h>." >&4
15733 fi
15734else
15735 val="$undef"
15736 $cat <<EOM
15737<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
15738EOM
15739fi
15740set i_syssockio
15741eval $setvar
15742
b4eb6b3d
JH
15743
15744: see if this is a syslog.h system
15745set syslog.h i_syslog
15746eval $inhdr
15747
15748
15749: see if this is a sys/mode.h system
15750set sys/mode.h i_sysmode
15751eval $inhdr
15752
15753: see if sys/resource.h has to be included
15754set sys/resource.h i_sysresrc
15755eval $inhdr
15756
15757: see if sys/security.h is available
15758set sys/security.h i_syssecrt
15759eval $inhdr
15760
15761: see if this is a sys/statvfs.h system
15762set sys/statvfs.h i_sysstatvfs
15763eval $inhdr
15764
b4eb6b3d
JH
15765: see if this is a sys/un.h system
15766set sys/un.h i_sysun
15767eval $inhdr
15768
15769
15770: see if this is a sys/utsname.h system
15771set sys/utsname.h i_sysutsname
15772eval $inhdr
15773
15774: see if this is a syswait system
15775set sys/wait.h i_syswait
15776eval $inhdr
15777
15778: see if this is a ustat.h system
15779set ustat.h i_ustat
15780eval $inhdr
15781
15782: see if this is an utime system
15783set utime.h i_utime
15784eval $inhdr
15785
15786: see if this is a values.h system
15787set values.h i_values
15788eval $inhdr
15789
15790: see if this is a vfork system
15791case "$d_vfork" in
15792"$define")
15793 set vfork.h i_vfork
15794 eval $inhdr
15795 ;;
15796*)
15797 i_vfork="$undef"
15798 ;;
15799esac
15800
15801: see if gdbm.h is available
15802set gdbm.h t_gdbm
15803eval $inhdr
15804case "$t_gdbm" in
15805$define)
15806 : see if gdbm_open exists
15807 set gdbm_open d_gdbm_open
15808 eval $inlibc
15809 case "$d_gdbm_open" in
15810 $undef)
15811 t_gdbm="$undef"
15812 echo "We won't be including <gdbm.h>"
5f80c64f 15813 ;;
b4eb6b3d
JH
15814 esac
15815 ;;
15816esac
15817val="$t_gdbm"
15818set i_gdbm
15819eval $setvar
15820
15821echo " "
15822echo "Looking for extensions..." >&4
15823: If we are using the old config.sh, known_extensions may contain
15824: old or inaccurate or duplicate values.
15825known_extensions=''
15826nonxs_extensions=''
15827: We do not use find because it might not be available.
15828: We do not just use MANIFEST because the user may have dropped
15829: some additional extensions into the source tree and expect them
15830: to be built.
15831
15832: Function to recursively find available extensions, ignoring DynaLoader
15833: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15834find_extensions='
15835 for xxx in *; do
15836 case "$xxx" in
15837 DynaLoader|dynaload) ;;
15838 *)
15839 if $test -f $xxx/$xxx.xs; then
15840 known_extensions="$known_extensions $1$xxx";
15841 elif $test -f $xxx/Makefile.PL; then
15842 nonxs_extensions="$nonxs_extensions $1$xxx";
15843 else
15844 if $test -d $xxx -a $# -lt 10; then
15845 set $1$xxx/ $*;
15846 cd $xxx;
15847 eval $find_extensions;
15848 cd ..;
15849 shift;
15850 fi;
15851 fi
15852 ;;
15853 esac;
15854 done'
15855tdir=`pwd`
15856cd $rsrc/ext
15857set X
15858shift
15859eval $find_extensions
15860set X $nonxs_extensions
15861shift
15862nonxs_extensions="$*"
15863set X $known_extensions
15864shift
15865known_extensions="$*"
15866cd $tdir
15867
15868: Now see which are supported on this system.
15869avail_ext=''
15870for xxx in $known_extensions ; do
15871 case "$xxx" in
15872 DB_File|db_file)
15873 case "$i_db" in
15874 $define) avail_ext="$avail_ext $xxx" ;;
15875 esac
15876 ;;
15877 GDBM_File|gdbm_fil)
15878 case "$i_gdbm" in
15879 $define) avail_ext="$avail_ext $xxx" ;;
15880 esac
15881 ;;
15882 NDBM_File|ndbm_fil)
15883 case "$i_ndbm" in
15884 $define)
15885 case "$osname-$use64bitint" in
15886 hpux-define)
15887 case "$libs" in
15888 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15889 esac
15890 ;;
15891 *) avail_ext="$avail_ext $xxx" ;;
15892 esac
15893 ;;
15894 esac
15895 ;;
15896 ODBM_File|odbm_fil)
15897 case "${i_dbm}${i_rpcsvcdbm}" in
15898 *"${define}"*)
15899 case "$osname-$use64bitint" in
15900 hpux-define)
15901 case "$libs" in
15902 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15903 esac
15904 ;;
15905 *) avail_ext="$avail_ext $xxx" ;;
15906 esac
15907 ;;
15908 esac
15909 ;;
15910 POSIX|posix)
15911 case "$useposix" in
15912 true|define|y) avail_ext="$avail_ext $xxx" ;;
15913 esac
15914 ;;
15915 Opcode|opcode)
15916 case "$useopcode" in
15917 true|define|y) avail_ext="$avail_ext $xxx" ;;
15918 esac
15919 ;;
15920 Socket|socket)
15921 case "$d_socket" in
15922 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15923 esac
15924 ;;
15925 Sys/Syslog|sys/syslog)
15926 : XXX syslog requires socket
15927 case "$d_socket" in
15928 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15929 esac
15930 ;;
15931 Thread|thread)
15932 case "$usethreads" in
15933 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15934 esac
15935 ;;
15936 IPC/SysV|ipc/sysv)
15937 : XXX Do we need a useipcsysv variable here
15938 case "${d_msg}${d_sem}${d_shm}" in
15939 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15940 esac
15941 ;;
15942 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
15943 ;;
15944 esac
b4eb6b3d 15945done
5f80c64f 15946
b4eb6b3d
JH
15947set X $avail_ext
15948shift
15949avail_ext="$*"
5f80c64f 15950
b4eb6b3d
JH
15951: Now see which nonxs extensions are supported on this system.
15952: For now assume all are.
15953nonxs_ext=''
15954for xxx in $nonxs_extensions ; do
15955 case "$xxx" in
15956 *) nonxs_ext="$nonxs_ext $xxx"
15957 ;;
15958 esac
15959done
5f80c64f 15960
b4eb6b3d
JH
15961set X $nonxs_ext
15962shift
15963nonxs_ext="$*"
15964
15965case $usedl in
15966$define)
15967 $cat <<EOM
15968A number of extensions are supplied with $package. You may choose to
15969compile these extensions for dynamic loading (the default), compile
15970them into the $package executable (static loading), or not include
15971them at all. Answer "none" to include no extensions.
15972Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
15973
15974EOM
b4eb6b3d
JH
15975 case "$dynamic_ext" in
15976 '') dflt="$avail_ext" ;;
15977 *) dflt="$dynamic_ext"
15978 # Perhaps we are reusing an old out-of-date config.sh.
15979 case "$hint" in
15980 previous)
15981 if test X"$dynamic_ext" != X"$avail_ext"; then
15982 $cat <<EOM
15983NOTICE: Your previous config.sh list may be incorrect.
15984The extensions now available to you are
15985 ${avail_ext}
15986but the default list from your previous config.sh is
15987 ${dynamic_ext}
9c839522 15988
b4eb6b3d
JH
15989EOM
15990 fi
9c839522
PM
15991 ;;
15992 esac
b4eb6b3d
JH
15993 ;;
15994 esac
5f80c64f 15995 case "$dflt" in
b4eb6b3d
JH
15996 '') dflt=none;;
15997 esac
15998 rp="What extensions do you wish to load dynamically?"
15999 . ./myread
16000 case "$ans" in
16001 none) dynamic_ext=' ' ;;
16002 *) dynamic_ext="$ans" ;;
5f80c64f 16003 esac
5f80c64f 16004
b4eb6b3d
JH
16005 case "$static_ext" in
16006 '')
16007 : Exclude those already listed in dynamic linking
16008 dflt=''
16009 for xxx in $avail_ext; do
16010 case " $dynamic_ext " in
16011 *" $xxx "*) ;;
16012 *) dflt="$dflt $xxx" ;;
16013 esac
16014 done
16015 set X $dflt
16016 shift
16017 dflt="$*"
16018 ;;
16019 *) dflt="$static_ext"
16020 ;;
16021 esac
9c839522 16022
b4eb6b3d
JH
16023 case "$dflt" in
16024 '') dflt=none;;
16025 esac
16026 rp="What extensions do you wish to load statically?"
16027 . ./myread
16028 case "$ans" in
16029 none) static_ext=' ' ;;
16030 *) static_ext="$ans" ;;
16031 esac
16032 ;;
16033*)
16034 $cat <<EOM
16035A number of extensions are supplied with $package. Answer "none"
16036to include no extensions.
16037Note that DynaLoader is always built and need not be mentioned here.
9c839522 16038
b4eb6b3d
JH
16039EOM
16040 case "$static_ext" in
16041 '') dflt="$avail_ext" ;;
16042 *) dflt="$static_ext"
16043 # Perhaps we are reusing an old out-of-date config.sh.
16044 case "$hint" in
16045 previous)
16046 if test X"$static_ext" != X"$avail_ext"; then
16047 $cat <<EOM
16048NOTICE: Your previous config.sh list may be incorrect.
16049The extensions now available to you are
16050 ${avail_ext}
16051but the default list from your previous config.sh is
16052 ${static_ext}
5f80c64f
JH
16053
16054EOM
b4eb6b3d
JH
16055 fi
16056 ;;
16057 esac
16058 ;;
16059 esac
16060 : Exclude those that are not xs extensions
16061 case "$dflt" in
16062 '') dflt=none;;
16063 esac
16064 rp="What extensions do you wish to include?"
16065 . ./myread
16066 case "$ans" in
16067 none) static_ext=' ' ;;
16068 *) static_ext="$ans" ;;
16069 esac
16070 ;;
5f80c64f
JH
16071esac
16072
b4eb6b3d
JH
16073set X $dynamic_ext $static_ext $nonxs_ext
16074shift
16075extensions="$*"
16076
9c839522
PM
16077: Remove libraries needed only for extensions
16078: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
16079: The exception is SunOS 4.x, which needs them.
16080case "${osname}X${osvers}" in
16081sunos*X4*)
16082 perllibs="$libs"
16083 ;;
16084*) case "$usedl" in
16085 $define|true|[yY]*)
16086 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
16087 shift
16088 perllibs="$*"
16089 ;;
16090 *) perllibs="$libs"
16091 ;;
16092 esac
16093 ;;
9c839522 16094esac
5f80c64f
JH
16095
16096: Remove build directory name from cppstdin so it can be used from
16097: either the present location or the final installed location.
16098echo " "
16099: Get out of the UU directory to get correct path name.
16100cd ..
16101case "$cppstdin" in
16102`pwd`/cppstdin)
16103 echo "Stripping down cppstdin path name"
16104 cppstdin=cppstdin
16105 ;;
16106esac
16107cd UU
16108
16109: end of configuration questions
16110echo " "
16111echo "End of configuration questions."
16112echo " "
16113
16114: back to where it started
16115if test -d ../UU; then
16116 cd ..
16117fi
16118
16119: configuration may be patched via a 'config.over' file
16120if $test -f config.over; then
16121 echo " "
16122 dflt=y
16123 rp='I see a config.over file. Do you wish to load it?'
16124 . UU/myread
16125 case "$ans" in
16126 n*) echo "OK, I'll ignore it.";;
16127 *) . ./config.over
16128 echo "Configuration override changes have been loaded."
16129 ;;
16130 esac
16131fi
16132
16133: in case they want portability, strip down executable paths
16134case "$d_portable" in
16135"$define")
16136 echo " "
16137 echo "Stripping down executable paths..." >&4
16138 for file in $loclist $trylist; do
534ac15a
JH
16139 eval temp=\$$file
16140 eval $file=`basename $temp`
5f80c64f
JH
16141 done
16142 ;;
16143esac
16144
16145: create config.sh file
16146echo " "
16147echo "Creating config.sh..." >&4
16148$spitshell <<EOT >config.sh
16149$startsh
16150#
16151# This file was produced by running the Configure script. It holds all the
16152# definitions figured out by Configure. Should you modify one of these values,
16153# do not forget to propagate your changes by running "Configure -der". You may
16154# instead choose to run each of the .SH files by yourself, or "Configure -S".
16155#
16156
16157# Package name : $package
16158# Source directory : $src
16159# Configuration time: $cf_time
16160# Configured by : $cf_by
16161# Target system : $myuname
16162
16163Author='$Author'
16164Date='$Date'
16165Header='$Header'
16166Id='$Id'
16167Locker='$Locker'
16168Log='$Log'
16169Mcc='$Mcc'
16170RCSfile='$RCSfile'
16171Revision='$Revision'
16172Source='$Source'
16173State='$State'
16174_a='$_a'
16175_exe='$_exe'
16176_o='$_o'
b4eb6b3d 16177afs='$afs'
a6d26a0d 16178afsroot='$afsroot'
b4eb6b3d
JH
16179alignbytes='$alignbytes'
16180ansi2knr='$ansi2knr'
16181aphostname='$aphostname'
16182api_revision='$api_revision'
16183api_subversion='$api_subversion'
16184api_version='$api_version'
16185api_versionstring='$api_versionstring'
5f80c64f 16186ar='$ar'
b4eb6b3d
JH
16187archlib='$archlib'
16188archlibexp='$archlibexp'
16189archname64='$archname64'
16190archname='$archname'
5f80c64f
JH
16191archobjs='$archobjs'
16192awk='$awk'
b4eb6b3d 16193baserev='$baserev'
5f80c64f 16194bash='$bash'
b4eb6b3d
JH
16195bin='$bin'
16196bincompat5005='$bincompat5005'
16197binexp='$binexp'
5f80c64f
JH
16198bison='$bison'
16199byacc='$byacc'
b4eb6b3d 16200byteorder='$byteorder'
5f80c64f 16201c='$c'
b4eb6b3d 16202castflags='$castflags'
5f80c64f
JH
16203cat='$cat'
16204cc='$cc'
16205cccdlflags='$cccdlflags'
16206ccdlflags='$ccdlflags'
16207ccflags='$ccflags'
b4eb6b3d 16208ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 16209ccname='$ccname'
b4eb6b3d 16210ccsymbols='$ccsymbols'
6b356c8e 16211ccversion='$ccversion'
5f80c64f 16212cf_by='$cf_by'
b4eb6b3d 16213cf_email='$cf_email'
5f80c64f 16214cf_time='$cf_time'
b4eb6b3d 16215charsize='$charsize'
5f80c64f
JH
16216chgrp='$chgrp'
16217chmod='$chmod'
16218chown='$chown'
b4eb6b3d 16219clocktype='$clocktype'
5f80c64f
JH
16220comm='$comm'
16221compress='$compress'
16222contains='$contains'
16223cp='$cp'
16224cpio='$cpio'
16225cpp='$cpp'
b4eb6b3d
JH
16226cpp_stuff='$cpp_stuff'
16227cppccsymbols='$cppccsymbols'
5f80c64f
JH
16228cppflags='$cppflags'
16229cpplast='$cpplast'
16230cppminus='$cppminus'
16231cpprun='$cpprun'
16232cppstdin='$cppstdin'
b4eb6b3d
JH
16233cppsymbols='$cppsymbols'
16234crosscompile='$crosscompile'
16235cryptlib='$cryptlib'
5f80c64f 16236csh='$csh'
b4eb6b3d
JH
16237d_Gconvert='$d_Gconvert'
16238d_PRIEUldbl='$d_PRIEUldbl'
16239d_PRIFUldbl='$d_PRIFUldbl'
16240d_PRIGUldbl='$d_PRIGUldbl'
16241d_PRIXU64='$d_PRIXU64'
16242d_PRId64='$d_PRId64'
16243d_PRIeldbl='$d_PRIeldbl'
16244d_PRIfldbl='$d_PRIfldbl'
16245d_PRIgldbl='$d_PRIgldbl'
16246d_PRIi64='$d_PRIi64'
16247d_PRIo64='$d_PRIo64'
16248d_PRIu64='$d_PRIu64'
16249d_PRIx64='$d_PRIx64'
16250d_SCNfldbl='$d_SCNfldbl'
74cac757 16251d__fwalk='$d__fwalk'
b4eb6b3d
JH
16252d_access='$d_access'
16253d_accessx='$d_accessx'
16254d_alarm='$d_alarm'
16255d_archlib='$d_archlib'
16256d_atolf='$d_atolf'
16257d_atoll='$d_atoll'
16258d_attribut='$d_attribut'
16259d_bcmp='$d_bcmp'
16260d_bcopy='$d_bcopy'
16261d_bincompat5005='$d_bincompat5005'
5f80c64f 16262d_bsd='$d_bsd'
b4eb6b3d
JH
16263d_bsdgetpgrp='$d_bsdgetpgrp'
16264d_bsdsetpgrp='$d_bsdsetpgrp'
16265d_bzero='$d_bzero'
16266d_casti32='$d_casti32'
16267d_castneg='$d_castneg'
16268d_charvspr='$d_charvspr'
16269d_chown='$d_chown'
16270d_chroot='$d_chroot'
16271d_chsize='$d_chsize'
16272d_closedir='$d_closedir'
4e0554ec 16273d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d
JH
16274d_const='$d_const'
16275d_crypt='$d_crypt'
16276d_csh='$d_csh'
16277d_cuserid='$d_cuserid'
16278d_dbl_dig='$d_dbl_dig'
2ef53570 16279d_dbminitproto='$d_dbminitproto'
b4eb6b3d
JH
16280d_difftime='$d_difftime'
16281d_dirnamlen='$d_dirnamlen'
16282d_dlerror='$d_dlerror'
5f80c64f 16283d_dlopen='$d_dlopen'
b4eb6b3d
JH
16284d_dlsymun='$d_dlsymun'
16285d_dosuid='$d_dosuid'
16286d_drand48proto='$d_drand48proto'
16287d_dup2='$d_dup2'
16288d_eaccess='$d_eaccess'
16289d_endgrent='$d_endgrent'
16290d_endhent='$d_endhent'
16291d_endnent='$d_endnent'
16292d_endpent='$d_endpent'
16293d_endpwent='$d_endpwent'
16294d_endsent='$d_endsent'
16295d_eofnblk='$d_eofnblk'
5f80c64f 16296d_eunice='$d_eunice'
b4eb6b3d
JH
16297d_fchmod='$d_fchmod'
16298d_fchown='$d_fchown'
16299d_fcntl='$d_fcntl'
9d9004a9 16300d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
16301d_fd_macros='$d_fd_macros'
16302d_fd_set='$d_fd_set'
16303d_fds_bits='$d_fds_bits'
16304d_fgetpos='$d_fgetpos'
16305d_flexfnam='$d_flexfnam'
16306d_flock='$d_flock'
2ef53570 16307d_flockproto='$d_flockproto'
b4eb6b3d
JH
16308d_fork='$d_fork'
16309d_fpathconf='$d_fpathconf'
16310d_fpos64_t='$d_fpos64_t'
16311d_frexpl='$d_frexpl'
16312d_fs_data_s='$d_fs_data_s'
16313d_fseeko='$d_fseeko'
16314d_fsetpos='$d_fsetpos'
16315d_fstatfs='$d_fstatfs'
16316d_fstatvfs='$d_fstatvfs'
411ab01c 16317d_fsync='$d_fsync'
b4eb6b3d
JH
16318d_ftello='$d_ftello'
16319d_ftime='$d_ftime'
16320d_getcwd='$d_getcwd'
16321d_getespwnam='$d_getespwnam'
16322d_getfsstat='$d_getfsstat'
16323d_getgrent='$d_getgrent'
16324d_getgrps='$d_getgrps'
16325d_gethbyaddr='$d_gethbyaddr'
16326d_gethbyname='$d_gethbyname'
16327d_gethent='$d_gethent'
16328d_gethname='$d_gethname'
16329d_gethostprotos='$d_gethostprotos'
4e0554ec 16330d_getitimer='$d_getitimer'
b4eb6b3d
JH
16331d_getlogin='$d_getlogin'
16332d_getmnt='$d_getmnt'
16333d_getmntent='$d_getmntent'
16334d_getnbyaddr='$d_getnbyaddr'
16335d_getnbyname='$d_getnbyname'
16336d_getnent='$d_getnent'
16337d_getnetprotos='$d_getnetprotos'
0c0643d0 16338d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
16339d_getpbyname='$d_getpbyname'
16340d_getpbynumber='$d_getpbynumber'
16341d_getpent='$d_getpent'
16342d_getpgid='$d_getpgid'
16343d_getpgrp2='$d_getpgrp2'
16344d_getpgrp='$d_getpgrp'
16345d_getppid='$d_getppid'
16346d_getprior='$d_getprior'
16347d_getprotoprotos='$d_getprotoprotos'
16348d_getprpwnam='$d_getprpwnam'
16349d_getpwent='$d_getpwent'
16350d_getsbyname='$d_getsbyname'
16351d_getsbyport='$d_getsbyport'
16352d_getsent='$d_getsent'
16353d_getservprotos='$d_getservprotos'
16354d_getspnam='$d_getspnam'
16355d_gettimeod='$d_gettimeod'
5f80c64f 16356d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
16357d_grpasswd='$d_grpasswd'
16358d_hasmntopt='$d_hasmntopt'
16359d_htonl='$d_htonl'
16360d_iconv='$d_iconv'
16361d_index='$d_index'
16362d_inetaton='$d_inetaton'
16363d_int64_t='$d_int64_t'
16364d_isascii='$d_isascii'
16365d_isnan='$d_isnan'
16366d_isnanl='$d_isnanl'
16367d_killpg='$d_killpg'
16368d_lchown='$d_lchown'
16369d_ldbl_dig='$d_ldbl_dig'
16370d_link='$d_link'
16371d_locconv='$d_locconv'
16372d_lockf='$d_lockf'
16373d_longdbl='$d_longdbl'
16374d_longlong='$d_longlong'
16375d_lseekproto='$d_lseekproto'
16376d_lstat='$d_lstat'
16377d_madvise='$d_madvise'
16378d_mblen='$d_mblen'
16379d_mbstowcs='$d_mbstowcs'
16380d_mbtowc='$d_mbtowc'
16381d_memchr='$d_memchr'
16382d_memcmp='$d_memcmp'
16383d_memcpy='$d_memcpy'
16384d_memmove='$d_memmove'
16385d_memset='$d_memset'
16386d_mkdir='$d_mkdir'
16387d_mkdtemp='$d_mkdtemp'
16388d_mkfifo='$d_mkfifo'
16389d_mkstemp='$d_mkstemp'
16390d_mkstemps='$d_mkstemps'
16391d_mktime='$d_mktime'
16392d_mmap='$d_mmap'
16393d_modfl='$d_modfl'
16394d_mprotect='$d_mprotect'
16395d_msg='$d_msg'
16396d_msg_ctrunc='$d_msg_ctrunc'
16397d_msg_dontroute='$d_msg_dontroute'
16398d_msg_oob='$d_msg_oob'
16399d_msg_peek='$d_msg_peek'
16400d_msg_proxy='$d_msg_proxy'
16401d_msgctl='$d_msgctl'
16402d_msgget='$d_msgget'
4e0554ec 16403d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
16404d_msgrcv='$d_msgrcv'
16405d_msgsnd='$d_msgsnd'
16406d_msync='$d_msync'
16407d_munmap='$d_munmap'
16408d_mymalloc='$d_mymalloc'
16409d_nice='$d_nice'
16410d_nv_preserves_uv='$d_nv_preserves_uv'
16411d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16412d_off64_t='$d_off64_t'
16413d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16414d_oldpthreads='$d_oldpthreads'
16415d_oldsock='$d_oldsock'
16416d_open3='$d_open3'
16417d_pathconf='$d_pathconf'
16418d_pause='$d_pause'
16419d_perl_otherlibdirs='$d_perl_otherlibdirs'
16420d_phostname='$d_phostname'
16421d_pipe='$d_pipe'
16422d_poll='$d_poll'
5f80c64f 16423d_portable='$d_portable'
b4eb6b3d
JH
16424d_pthread_yield='$d_pthread_yield'
16425d_pwage='$d_pwage'
16426d_pwchange='$d_pwchange'
16427d_pwclass='$d_pwclass'
16428d_pwcomment='$d_pwcomment'
16429d_pwexpire='$d_pwexpire'
16430d_pwgecos='$d_pwgecos'
16431d_pwpasswd='$d_pwpasswd'
16432d_pwquota='$d_pwquota'
16433d_qgcvt='$d_qgcvt'
16434d_quad='$d_quad'
16435d_readdir='$d_readdir'
16436d_readlink='$d_readlink'
4e0554ec 16437d_readv='$d_readv'
640374d0 16438d_realpath='$d_realpath'
4e0554ec 16439d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
16440d_rename='$d_rename'
16441d_rewinddir='$d_rewinddir'
16442d_rmdir='$d_rmdir'
16443d_safebcpy='$d_safebcpy'
16444d_safemcpy='$d_safemcpy'
16445d_sanemcmp='$d_sanemcmp'
ef9f17be 16446d_sbrkproto='$d_sbrkproto'
b4eb6b3d
JH
16447d_sched_yield='$d_sched_yield'
16448d_scm_rights='$d_scm_rights'
16449d_seekdir='$d_seekdir'
16450d_select='$d_select'
16451d_sem='$d_sem'
16452d_semctl='$d_semctl'
16453d_semctl_semid_ds='$d_semctl_semid_ds'
16454d_semctl_semun='$d_semctl_semun'
16455d_semget='$d_semget'
16456d_semop='$d_semop'
4e0554ec 16457d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
16458d_setegid='$d_setegid'
16459d_seteuid='$d_seteuid'
16460d_setgrent='$d_setgrent'
16461d_setgrps='$d_setgrps'
16462d_sethent='$d_sethent'
4e0554ec 16463d_setitimer='$d_setitimer'
b4eb6b3d
JH
16464d_setlinebuf='$d_setlinebuf'
16465d_setlocale='$d_setlocale'
16466d_setnent='$d_setnent'
16467d_setpent='$d_setpent'
16468d_setpgid='$d_setpgid'
16469d_setpgrp2='$d_setpgrp2'
16470d_setpgrp='$d_setpgrp'
16471d_setprior='$d_setprior'
16472d_setproctitle='$d_setproctitle'
16473d_setpwent='$d_setpwent'
16474d_setregid='$d_setregid'
16475d_setresgid='$d_setresgid'
16476d_setresuid='$d_setresuid'
16477d_setreuid='$d_setreuid'
16478d_setrgid='$d_setrgid'
16479d_setruid='$d_setruid'
16480d_setsent='$d_setsent'
16481d_setsid='$d_setsid'
16482d_setvbuf='$d_setvbuf'
16483d_sfio='$d_sfio'
16484d_shm='$d_shm'
16485d_shmat='$d_shmat'
16486d_shmatprototype='$d_shmatprototype'
16487d_shmctl='$d_shmctl'
16488d_shmdt='$d_shmdt'
16489d_shmget='$d_shmget'
16490d_sigaction='$d_sigaction'
983dbef6 16491d_sigprocmask='$d_sigprocmask'
b4eb6b3d 16492d_sigsetjmp='$d_sigsetjmp'
49a78c82 16493d_sockatmark='$d_sockatmark'
2ef53570 16494d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
16495d_socket='$d_socket'
16496d_socklen_t='$d_socklen_t'
16497d_sockpair='$d_sockpair'
16498d_socks5_init='$d_socks5_init'
16499d_sqrtl='$d_sqrtl'
eef837ea 16500d_sresgproto='$d_sresgproto'
640374d0 16501d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
16502d_statblks='$d_statblks'
16503d_statfs_f_flags='$d_statfs_f_flags'
16504d_statfs_s='$d_statfs_s'
16505d_statvfs='$d_statvfs'
16506d_stdio_cnt_lval='$d_stdio_cnt_lval'
16507d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
16508d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16509d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
16510d_stdio_stream_array='$d_stdio_stream_array'
16511d_stdiobase='$d_stdiobase'
16512d_stdstdio='$d_stdstdio'
16513d_strchr='$d_strchr'
16514d_strcoll='$d_strcoll'
16515d_strctcpy='$d_strctcpy'
16516d_strerrm='$d_strerrm'
16517d_strerror='$d_strerror'
b3c85772 16518d_strftime='$d_strftime'
b4eb6b3d
JH
16519d_strtod='$d_strtod'
16520d_strtol='$d_strtol'
16521d_strtold='$d_strtold'
16522d_strtoll='$d_strtoll'
28e5dec8 16523d_strtoq='$d_strtoq'
b4eb6b3d
JH
16524d_strtoul='$d_strtoul'
16525d_strtoull='$d_strtoull'
16526d_strtouq='$d_strtouq'
16527d_strxfrm='$d_strxfrm'
16528d_suidsafe='$d_suidsafe'
16529d_symlink='$d_symlink'
16530d_syscall='$d_syscall'
2ef53570 16531d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
16532d_sysconf='$d_sysconf'
16533d_sysernlst='$d_sysernlst'
16534d_syserrlst='$d_syserrlst'
16535d_system='$d_system'
16536d_tcgetpgrp='$d_tcgetpgrp'
16537d_tcsetpgrp='$d_tcsetpgrp'
16538d_telldir='$d_telldir'
16539d_telldirproto='$d_telldirproto'
16540d_time='$d_time'
16541d_times='$d_times'
16542d_truncate='$d_truncate'
16543d_tzname='$d_tzname'
4e0554ec
JH
16544d_u32align='$d_u32align'
16545d_ualarm='$d_ualarm'
b4eb6b3d
JH
16546d_umask='$d_umask'
16547d_uname='$d_uname'
16548d_union_semun='$d_union_semun'
4e0554ec 16549d_usleep='$d_usleep'
2ef53570 16550d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
16551d_ustat='$d_ustat'
16552d_vendorarch='$d_vendorarch'
16553d_vendorbin='$d_vendorbin'
16554d_vendorlib='$d_vendorlib'
16555d_vfork='$d_vfork'
16556d_void_closedir='$d_void_closedir'
16557d_voidsig='$d_voidsig'
16558d_voidtty='$d_voidtty'
16559d_volatile='$d_volatile'
16560d_vprintf='$d_vprintf'
16561d_wait4='$d_wait4'
16562d_waitpid='$d_waitpid'
16563d_wcstombs='$d_wcstombs'
16564d_wctomb='$d_wctomb'
4e0554ec 16565d_writev='$d_writev'
5f80c64f
JH
16566d_xenix='$d_xenix'
16567date='$date'
b4eb6b3d
JH
16568db_hashtype='$db_hashtype'
16569db_prefixtype='$db_prefixtype'
640374d0
JH
16570db_version_major='$db_version_major'
16571db_version_minor='$db_version_minor'
16572db_version_patch='$db_version_patch'
b4eb6b3d
JH
16573defvoidused='$defvoidused'
16574direntrytype='$direntrytype'
16575dlext='$dlext'
5f80c64f 16576dlsrc='$dlsrc'
b4eb6b3d
JH
16577doublesize='$doublesize'
16578drand01='$drand01'
16579dynamic_ext='$dynamic_ext'
16580eagain='$eagain'
16581ebcdic='$ebcdic'
5f80c64f
JH
16582echo='$echo'
16583egrep='$egrep'
16584emacs='$emacs'
16585eunicefix='$eunicefix'
16586exe_ext='$exe_ext'
16587expr='$expr'
b4eb6b3d
JH
16588extensions='$extensions'
16589fflushNULL='$fflushNULL'
16590fflushall='$fflushall'
5f80c64f
JH
16591find='$find'
16592firstmakefile='$firstmakefile'
16593flex='$flex'
b4eb6b3d
JH
16594fpossize='$fpossize'
16595fpostype='$fpostype'
16596freetype='$freetype'
16597full_ar='$full_ar'
16598full_csh='$full_csh'
16599full_sed='$full_sed'
5b463ca7 16600gccosandvers='$gccosandvers'
5f80c64f 16601gccversion='$gccversion'
b4eb6b3d
JH
16602gidformat='$gidformat'
16603gidsign='$gidsign'
16604gidsize='$gidsize'
16605gidtype='$gidtype'
5f80c64f
JH
16606glibpth='$glibpth'
16607grep='$grep'
b4eb6b3d
JH
16608groupcat='$groupcat'
16609groupstype='$groupstype'
5f80c64f 16610gzip='$gzip'
b4eb6b3d
JH
16611h_fcntl='$h_fcntl'
16612h_sysfile='$h_sysfile'
5f80c64f 16613hint='$hint'
b4eb6b3d
JH
16614hostcat='$hostcat'
16615i16size='$i16size'
16616i16type='$i16type'
16617i32size='$i32size'
16618i32type='$i32type'
16619i64size='$i64size'
16620i64type='$i64type'
16621i8size='$i8size'
16622i8type='$i8type'
16623i_arpainet='$i_arpainet'
16624i_bsdioctl='$i_bsdioctl'
16625i_db='$i_db'
16626i_dbm='$i_dbm'
16627i_dirent='$i_dirent'
5f80c64f 16628i_dld='$i_dld'
b4eb6b3d
JH
16629i_dlfcn='$i_dlfcn'
16630i_fcntl='$i_fcntl'
16631i_float='$i_float'
16632i_gdbm='$i_gdbm'
16633i_grp='$i_grp'
16634i_iconv='$i_iconv'
16635i_ieeefp='$i_ieeefp'
16636i_inttypes='$i_inttypes'
16637i_libutil='$i_libutil'
16638i_limits='$i_limits'
16639i_locale='$i_locale'
16640i_machcthr='$i_machcthr'
16641i_malloc='$i_malloc'
16642i_math='$i_math'
16643i_memory='$i_memory'
16644i_mntent='$i_mntent'
16645i_ndbm='$i_ndbm'
16646i_netdb='$i_netdb'
16647i_neterrno='$i_neterrno'
16648i_netinettcp='$i_netinettcp'
16649i_niin='$i_niin'
16650i_poll='$i_poll'
16651i_prot='$i_prot'
16652i_pthread='$i_pthread'
16653i_pwd='$i_pwd'
16654i_rpcsvcdbm='$i_rpcsvcdbm'
16655i_sfio='$i_sfio'
16656i_sgtty='$i_sgtty'
16657i_shadow='$i_shadow'
16658i_socks='$i_socks'
16659i_stdarg='$i_stdarg'
16660i_stddef='$i_stddef'
16661i_stdlib='$i_stdlib'
16662i_string='$i_string'
16663i_sunmath='$i_sunmath'
16664i_sysaccess='$i_sysaccess'
16665i_sysdir='$i_sysdir'
16666i_sysfile='$i_sysfile'
16667i_sysfilio='$i_sysfilio'
16668i_sysin='$i_sysin'
16669i_sysioctl='$i_sysioctl'
16670i_syslog='$i_syslog'
16671i_sysmman='$i_sysmman'
16672i_sysmode='$i_sysmode'
16673i_sysmount='$i_sysmount'
16674i_sysndir='$i_sysndir'
16675i_sysparam='$i_sysparam'
16676i_sysresrc='$i_sysresrc'
16677i_syssecrt='$i_syssecrt'
16678i_sysselct='$i_sysselct'
16679i_syssockio='$i_syssockio'
16680i_sysstat='$i_sysstat'
16681i_sysstatfs='$i_sysstatfs'
16682i_sysstatvfs='$i_sysstatvfs'
16683i_systime='$i_systime'
16684i_systimek='$i_systimek'
16685i_systimes='$i_systimes'
16686i_systypes='$i_systypes'
16687i_sysuio='$i_sysuio'
16688i_sysun='$i_sysun'
16689i_sysutsname='$i_sysutsname'
16690i_sysvfs='$i_sysvfs'
16691i_syswait='$i_syswait'
16692i_termio='$i_termio'
16693i_termios='$i_termios'
16694i_time='$i_time'
16695i_unistd='$i_unistd'
16696i_ustat='$i_ustat'
16697i_utime='$i_utime'
16698i_values='$i_values'
16699i_varargs='$i_varargs'
16700i_varhdr='$i_varhdr'
16701i_vfork='$i_vfork'
5f80c64f 16702ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
16703inc_version_list='$inc_version_list'
16704inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
16705incpath='$incpath'
16706inews='$inews'
b4eb6b3d
JH
16707installarchlib='$installarchlib'
16708installbin='$installbin'
16709installman1dir='$installman1dir'
16710installman3dir='$installman3dir'
16711installprefix='$installprefix'
16712installprefixexp='$installprefixexp'
16713installprivlib='$installprivlib'
16714installscript='$installscript'
16715installsitearch='$installsitearch'
16716installsitebin='$installsitebin'
16717installsitelib='$installsitelib'
16718installstyle='$installstyle'
16719installusrbinperl='$installusrbinperl'
16720installvendorarch='$installvendorarch'
16721installvendorbin='$installvendorbin'
16722installvendorlib='$installvendorlib'
16723intsize='$intsize'
4b661809 16724issymlink='$issymlink'
b4eb6b3d
JH
16725ivdformat='$ivdformat'
16726ivsize='$ivsize'
16727ivtype='$ivtype'
16728known_extensions='$known_extensions'
5f80c64f 16729ksh='$ksh'
5f80c64f
JH
16730ld='$ld'
16731lddlflags='$lddlflags'
16732ldflags='$ldflags'
b4eb6b3d
JH
16733ldflags_uselargefiles='$ldflags_uselargefiles'
16734ldlibpthname='$ldlibpthname'
5f80c64f
JH
16735less='$less'
16736lib_ext='$lib_ext'
16737libc='$libc'
b4eb6b3d 16738libperl='$libperl'
5f80c64f
JH
16739libpth='$libpth'
16740libs='$libs'
43999f95
JH
16741libsdirs='$libsdirs'
16742libsfiles='$libsfiles'
16743libsfound='$libsfound'
13b3f787 16744libspath='$libspath'
5f80c64f 16745libswanted='$libswanted'
b4eb6b3d 16746libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
16747line='$line'
16748lint='$lint'
16749lkflags='$lkflags'
16750ln='$ln'
16751lns='$lns'
16752locincpth='$locincpth'
16753loclibpth='$loclibpth'
b4eb6b3d
JH
16754longdblsize='$longdblsize'
16755longlongsize='$longlongsize'
16756longsize='$longsize'
5f80c64f
JH
16757lp='$lp'
16758lpr='$lpr'
16759ls='$ls'
b4eb6b3d
JH
16760lseeksize='$lseeksize'
16761lseektype='$lseektype'
5f80c64f
JH
16762mail='$mail'
16763mailx='$mailx'
16764make='$make'
16765make_set_make='$make_set_make'
b4eb6b3d
JH
16766mallocobj='$mallocobj'
16767mallocsrc='$mallocsrc'
16768malloctype='$malloctype'
16769man1dir='$man1dir'
16770man1direxp='$man1direxp'
16771man1ext='$man1ext'
16772man3dir='$man3dir'
16773man3direxp='$man3direxp'
16774man3ext='$man3ext'
5f80c64f
JH
16775mips_type='$mips_type'
16776mkdir='$mkdir'
b4eb6b3d
JH
16777mmaptype='$mmaptype'
16778modetype='$modetype'
5f80c64f 16779more='$more'
b4eb6b3d 16780multiarch='$multiarch'
5f80c64f 16781mv='$mv'
b4eb6b3d
JH
16782myarchname='$myarchname'
16783mydomain='$mydomain'
16784myhostname='$myhostname'
5f80c64f
JH
16785myuname='$myuname'
16786n='$n'
2cc61e15 16787need_va_copy='$need_va_copy'
b4eb6b3d
JH
16788netdb_hlen_type='$netdb_hlen_type'
16789netdb_host_type='$netdb_host_type'
16790netdb_name_type='$netdb_name_type'
16791netdb_net_type='$netdb_net_type'
5f80c64f
JH
16792nm='$nm'
16793nm_opt='$nm_opt'
16794nm_so_opt='$nm_so_opt'
b4eb6b3d 16795nonxs_ext='$nonxs_ext'
5f80c64f 16796nroff='$nroff'
b4eb6b3d
JH
16797nvEUformat='$nvEUformat'
16798nvFUformat='$nvFUformat'
16799nvGUformat='$nvGUformat'
16800nveformat='$nveformat'
16801nvfformat='$nvfformat'
16802nvgformat='$nvgformat'
16803nvsize='$nvsize'
16804nvtype='$nvtype'
16805o_nonblock='$o_nonblock'
5f80c64f 16806obj_ext='$obj_ext'
b4eb6b3d 16807old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 16808optimize='$optimize'
b4eb6b3d 16809orderlib='$orderlib'
5f80c64f
JH
16810osname='$osname'
16811osvers='$osvers'
b4eb6b3d 16812otherlibdirs='$otherlibdirs'
5f80c64f 16813package='$package'
b4eb6b3d
JH
16814pager='$pager'
16815passcat='$passcat'
16816patchlevel='$patchlevel'
5f80c64f 16817path_sep='$path_sep'
b4eb6b3d 16818perl5='$perl5'
5f80c64f 16819perl='$perl'
151e6568 16820perl_patchlevel='$perl_patchlevel'
b4eb6b3d 16821perladmin='$perladmin'
9c839522 16822perllibs='$perllibs'
b4eb6b3d 16823perlpath='$perlpath'
5f80c64f 16824pg='$pg'
b4eb6b3d
JH
16825phostname='$phostname'
16826pidtype='$pidtype'
5f80c64f 16827plibpth='$plibpth'
b4eb6b3d 16828pm_apiversion='$pm_apiversion'
5f80c64f
JH
16829pmake='$pmake'
16830pr='$pr'
b4eb6b3d
JH
16831prefix='$prefix'
16832prefixexp='$prefixexp'
16833privlib='$privlib'
16834privlibexp='$privlibexp'
16835prototype='$prototype'
16836ptrsize='$ptrsize'
16837quadkind='$quadkind'
16838quadtype='$quadtype'
16839randbits='$randbits'
16840randfunc='$randfunc'
16841randseedtype='$randseedtype'
16842ranlib='$ranlib'
16843rd_nodata='$rd_nodata'
16844revision='$revision'
5f80c64f
JH
16845rm='$rm'
16846rmail='$rmail'
16847runnm='$runnm'
b4eb6b3d
JH
16848sPRIEUldbl='$sPRIEUldbl'
16849sPRIFUldbl='$sPRIFUldbl'
16850sPRIGUldbl='$sPRIGUldbl'
16851sPRIXU64='$sPRIXU64'
16852sPRId64='$sPRId64'
16853sPRIeldbl='$sPRIeldbl'
16854sPRIfldbl='$sPRIfldbl'
16855sPRIgldbl='$sPRIgldbl'
16856sPRIi64='$sPRIi64'
16857sPRIo64='$sPRIo64'
16858sPRIu64='$sPRIu64'
16859sPRIx64='$sPRIx64'
16860sSCNfldbl='$sSCNfldbl'
16861sched_yield='$sched_yield'
16862scriptdir='$scriptdir'
16863scriptdirexp='$scriptdirexp'
5f80c64f 16864sed='$sed'
b4eb6b3d
JH
16865seedfunc='$seedfunc'
16866selectminbits='$selectminbits'
16867selecttype='$selecttype'
5f80c64f
JH
16868sendmail='$sendmail'
16869sh='$sh'
16870shar='$shar'
16871sharpbang='$sharpbang'
b4eb6b3d
JH
16872shmattype='$shmattype'
16873shortsize='$shortsize'
16874shrpenv='$shrpenv'
5f80c64f 16875shsharp='$shsharp'
b4eb6b3d
JH
16876sig_count='$sig_count'
16877sig_name='$sig_name'
16878sig_name_init='$sig_name_init'
16879sig_num='$sig_num'
16880sig_num_init='$sig_num_init'
76d3c696 16881sig_size='$sig_size'
b4eb6b3d
JH
16882signal_t='$signal_t'
16883sitearch='$sitearch'
16884sitearchexp='$sitearchexp'
16885sitebin='$sitebin'
16886sitebinexp='$sitebinexp'
16887sitelib='$sitelib'
16888sitelib_stem='$sitelib_stem'
16889sitelibexp='$sitelibexp'
16890siteprefix='$siteprefix'
16891siteprefixexp='$siteprefixexp'
16892sizesize='$sizesize'
16893sizetype='$sizetype'
5f80c64f
JH
16894sleep='$sleep'
16895smail='$smail'
5f80c64f 16896so='$so'
b4eb6b3d
JH
16897sockethdr='$sockethdr'
16898socketlib='$socketlib'
16899socksizetype='$socksizetype'
5f80c64f
JH
16900sort='$sort'
16901spackage='$spackage'
16902spitshell='$spitshell'
5f80c64f 16903src='$src'
b4eb6b3d
JH
16904ssizetype='$ssizetype'
16905startperl='$startperl'
5f80c64f 16906startsh='$startsh'
b4eb6b3d
JH
16907static_ext='$static_ext'
16908stdchar='$stdchar'
16909stdio_base='$stdio_base'
16910stdio_bufsiz='$stdio_bufsiz'
16911stdio_cnt='$stdio_cnt'
16912stdio_filbuf='$stdio_filbuf'
16913stdio_ptr='$stdio_ptr'
16914stdio_stream_array='$stdio_stream_array'
16915strings='$strings'
5f80c64f 16916submit='$submit'
b4eb6b3d
JH
16917subversion='$subversion'
16918sysman='$sysman'
5f80c64f
JH
16919tail='$tail'
16920tar='$tar'
16921tbl='$tbl'
16922tee='$tee'
16923test='$test'
b4eb6b3d
JH
16924timeincl='$timeincl'
16925timetype='$timetype'
5f80c64f
JH
16926touch='$touch'
16927tr='$tr'
16928trnl='$trnl'
16929troff='$troff'
b4eb6b3d
JH
16930u16size='$u16size'
16931u16type='$u16type'
16932u32size='$u32size'
16933u32type='$u32type'
16934u64size='$u64size'
16935u64type='$u64type'
16936u8size='$u8size'
16937u8type='$u8type'
16938uidformat='$uidformat'
16939uidsign='$uidsign'
16940uidsize='$uidsize'
16941uidtype='$uidtype'
5f80c64f
JH
16942uname='$uname'
16943uniq='$uniq'
b4eb6b3d
JH
16944uquadtype='$uquadtype'
16945use5005threads='$use5005threads'
16946use64bitall='$use64bitall'
16947use64bitint='$use64bitint'
5f80c64f 16948usedl='$usedl'
b4eb6b3d
JH
16949useithreads='$useithreads'
16950uselargefiles='$uselargefiles'
16951uselongdouble='$uselongdouble'
16952usemorebits='$usemorebits'
16953usemultiplicity='$usemultiplicity'
16954usemymalloc='$usemymalloc'
5f80c64f 16955usenm='$usenm'
b4eb6b3d
JH
16956useopcode='$useopcode'
16957useperlio='$useperlio'
16958useposix='$useposix'
16959usesfio='$usesfio'
16960useshrplib='$useshrplib'
29209bc5 16961usesocks='$usesocks'
b4eb6b3d
JH
16962usethreads='$usethreads'
16963usevendorprefix='$usevendorprefix'
16964usevfork='$usevfork'
5f80c64f
JH
16965usrinc='$usrinc'
16966uuname='$uuname'
b4eb6b3d
JH
16967uvXUformat='$uvXUformat'
16968uvoformat='$uvoformat'
16969uvsize='$uvsize'
16970uvtype='$uvtype'
16971uvuformat='$uvuformat'
16972uvxformat='$uvxformat'
16973vendorarch='$vendorarch'
16974vendorarchexp='$vendorarchexp'
16975vendorbin='$vendorbin'
16976vendorbinexp='$vendorbinexp'
16977vendorlib='$vendorlib'
16978vendorlib_stem='$vendorlib_stem'
16979vendorlibexp='$vendorlibexp'
16980vendorprefix='$vendorprefix'
16981vendorprefixexp='$vendorprefixexp'
16982version='$version'
d56c5707 16983versiononly='$versiononly'
5f80c64f 16984vi='$vi'
b4eb6b3d 16985voidflags='$voidflags'
5f80c64f 16986xlibpth='$xlibpth'
b4eb6b3d 16987xs_apiversion='$xs_apiversion'
3659ebf1
JH
16988yacc='$yacc'
16989yaccflags='$yaccflags'
5f80c64f
JH
16990zcat='$zcat'
16991zip='$zip'
16992EOT
16993
16994: Add in command line options if available
16995$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16996
16997: add special variables
16998$test -f $src/patchlevel.h && \
d00b958f 16999awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 17000echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 17001echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
17002
17003: propagate old symbols
17004if $test -f UU/config.sh; then
381aa1ff 17005 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 17006 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 17007 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
17008 set X `cat UU/oldsyms`
17009 shift
17010 case $# in
17011 0) ;;
17012 *)
17013 cat <<EOM
17014Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
17015EOM
17016 echo "# Variables propagated from previous config.sh file." >>config.sh
17017 for sym in `cat UU/oldsyms`; do
17018 echo " Propagating $hint variable "'$'"$sym..."
17019 eval 'tmp="$'"${sym}"'"'
17020 echo "$tmp" | \
17021 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
17022 done
17023 ;;
17024 esac
17025fi
17026
17027: Finish up by extracting the .SH files
17028case "$alldone" in
17029exit)
17030 $rm -rf UU
24ccb310 17031 echo "Extraction done."
5f80c64f
JH
17032 exit 0
17033 ;;
17034cont)
17035 ;;
17036'')
17037 dflt=''
17038 nostick=true
17039 $cat <<EOM
17040
17041If you'd like to make any changes to the config.sh file before I begin
17042to configure things, do it as a shell escape now (e.g. !vi config.sh).
17043
17044EOM
17045 rp="Press return or use a shell escape to edit config.sh:"
17046 . UU/myread
17047 nostick=''
17048 case "$ans" in
17049 '') ;;
17050 *) : in case they cannot read
17051 sh 1>&4 -c "$ans";;
17052 esac
17053 ;;
17054esac
17055
17056: if this fails, just run all the .SH files by hand
17057. ./config.sh
17058
17059echo " "
17060exec 1>&4
17061. ./UU/extract
17062
17063if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
17064 dflt=y
17065 case "$silent" in
17066 true) ;;
17067 *)
17068 $cat <<EOM
17069
17070Now you need to generate make dependencies by running "$make depend".
17071You might prefer to run it in background: "$make depend > makedepend.out &"
17072It can take a while, so you might not want to run it right now.
17073
17074EOM
17075 ;;
17076 esac
17077 rp="Run $make depend now?"
17078 . UU/myread
17079 case "$ans" in
17080 y*)
3d5d58b1 17081 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
17082 ;;
17083 *)
17084 echo "You must run '$make depend' then '$make'."
17085 ;;
17086 esac
17087elif test -f [Mm]akefile; then
17088 echo " "
17089 echo "Now you must run a $make."
17090else
24ccb310 17091 echo "Configure done."
5f80c64f
JH
17092fi
17093
17094if $test -f Policy.sh; then
17095 $cat <<EOM
17096
17097If you compile $package on a different machine or from a different object
17098directory, copy the Policy.sh file from this object directory to the
17099new one before you run Configure -- this will help you with most of
17100the policy defaults.
17101
17102EOM
17103fi
17104if $test -f config.msg; then
17105 echo "Hmm. I also noted the following information while running:"
17106 echo " "
17107 $cat config.msg >&4
17108 $rm -f config.msg
17109fi
17110$rm -f kit*isdone ark*isdone
17111$rm -rf UU
17112
17113: End of Configure
17114