This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
in change#10451, check that CvOUTSIDE is a CV before looking in
[perl5.git] / Configure
CommitLineData
2304df62
AD
1#! /bin/sh
2#
3# If these # comments don't work, trim them. Don't worry about any other
4# shell scripts, Configure will trim # comments from them for you.
5#
6# (If you are trying to port this package to a machine without sh,
7# I would suggest you have a look at the prototypical config_h.SH file
8# and edit it to reflect your system. Some packages may include samples
9# of config.h for certain machines, so you might look for one of those.)
10#
11# Yes, you may rip this off to use in other distribution packages. This
12# script belongs to the public domain and cannot be copyrighted.
13#
14# (Note: this Configure script was generated automatically. Rather than
15# working with this copy of Configure, you may wish to get metaconfig.
16# The dist-3.0 package (which contains metaconfig) was posted in
dfe9444c
AD
17# comp.sources.misc and is available on CPAN under authors/id/RAM so
18# you may fetch it yourself from your nearest archive site.)
2304df62
AD
19#
20
dfe9444c 21# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
2304df62 22#
2b2cdb4d 23# Generated on Thu Jun 7 00:46: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
2b2cdb4d
HS
10479case "$d_longdbl$d_modfl" in
10480$define$define)
10481 $cat <<EOM
10482Checking to see whether your modfl() is okay for large values...
10483EOM
10484$cat >try.c <<EOCP
10485#include <math.h>
10486#include <stdio.h>
10487int main() {
10488 long double nv = 4294967303.15;
10489 long double v, w;
10490 v = modfl(nv, &w);
10491#ifdef __GLIBC__
10492 printf("glibc");
10493#endif
10494 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
10495 return 0;
10496}
10497EOCP
10498 set try
10499 if eval $compile; then
10500 foo=`./try`
10501 case "$foo" in
10502 *" 4294967303.150000 1.150000 4294967302.000000")
10503 echo >&4 "Your modfl() is broken for large values."
10504 d_modfl="$undef"
10505 case "$foo" in
10506 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
10507 ;;
10508 esac
10509 ;;
10510 *" 4294967303.150000 0.150000 4294967303.000000")
10511 echo >&4 "Your modfl() seems okay for large values."
10512 ;;
10513 *) echo >&4 "I don't understand your modfl() at all."
10514 d_modfl="$undef"
10515 ;;
10516 esac
10517 $rm -f try.* try core core.try.*
10518 else
10519 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
10520 d_modfl="$undef"
10521 fi
10522 ;;
10523esac
10524
b4eb6b3d
JH
10525: see if mprotect exists
10526set mprotect d_mprotect
10527eval $inlibc
10528
10529: see if msgctl exists
10530set msgctl d_msgctl
10531eval $inlibc
10532
10533: see if msgget exists
10534set msgget d_msgget
10535eval $inlibc
10536
10537: see if msgsnd exists
10538set msgsnd d_msgsnd
10539eval $inlibc
10540
10541: see if msgrcv exists
10542set msgrcv d_msgrcv
10543eval $inlibc
10544
10545: see how much of the 'msg*(2)' library is present.
10546h_msg=true
10547echo " "
10548case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10549*"$undef"*) h_msg=false;;
10550esac
10551case "$osname" in
10552freebsd)
10553 case "`ipcs 2>&1`" in
10554 "SVID messages"*"not configured"*)
10555 echo "Your $osname does not have the msg*(2) configured." >&4
10556 h_msg=false
10557 val="$undef"
10558 set msgctl d_msgctl
10559 eval $setvar
10560 set msgget d_msgget
10561 eval $setvar
10562 set msgsnd d_msgsnd
10563 eval $setvar
10564 set msgrcv d_msgrcv
10565 eval $setvar
10566 ;;
10567 esac
10568 ;;
10569esac
10570: we could also check for sys/ipc.h ...
10571if $h_msg && $test `./findhdr sys/msg.h`; then
10572 echo "You have the full msg*(2) library." >&4
10573 val="$define"
10574else
10575 echo "You don't have the full msg*(2) library." >&4
10576 val="$undef"
10577fi
10578set d_msg
10579eval $setvar
10580
4e0554ec
JH
10581
10582echo " "
10583echo "Checking to see if your system supports struct msghdr..." >&4
10584set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10585eval $hasstruct
10586case "$d_msghdr_s" in
10587"$define") echo "Yes, it does." ;;
10588*) echo "No, it doesn't." ;;
10589esac
10590
10591
b4eb6b3d
JH
10592: see if msync exists
10593set msync d_msync
10594eval $inlibc
10595
10596: see if munmap exists
10597set munmap d_munmap
10598eval $inlibc
10599
10600: see if nice exists
10601set nice d_nice
10602eval $inlibc
10603
b4eb6b3d
JH
10604: check for length of character
10605echo " "
10606case "$charsize" in
10607'')
10608 echo "Checking to see how big your characters are (hey, you never know)..." >&4
10609 $cat >try.c <<'EOCP'
10610#include <stdio.h>
10611int main()
10612{
10613 printf("%d\n", (int)sizeof(char));
10614 exit(0);
10615}
10616EOCP
10617 set try
10618 if eval $compile_ok; then
10619 dflt=`./try`
10620 else
10621 dflt='1'
10622 echo "(I can't seem to compile the test program. Guessing...)"
10623 fi
10624 ;;
10625*)
10626 dflt="$charsize"
10627 ;;
10628esac
10629rp="What is the size of a character (in bytes)?"
10630. ./myread
10631charsize="$ans"
10632$rm -f try.c try
10633
1d1be0dc
NC
10634: check for volatile keyword
10635echo " "
10636echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10637$cat >try.c <<'EOCP'
10638int main()
10639{
10640 typedef struct _goo_struct goo_struct;
10641 goo_struct * volatile goo = ((goo_struct *)0);
10642 struct _goo_struct {
10643 long long_int;
10644 int reg_int;
10645 char char_var;
10646 };
10647 typedef unsigned short foo_t;
10648 char *volatile foo;
10649 volatile int bar;
10650 volatile foo_t blech;
10651 foo = foo;
10652}
10653EOCP
10654if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10655 val="$define"
10656 echo "Yup, it does."
10657else
10658 val="$undef"
10659 echo "Nope, it doesn't."
10660fi
10661set d_volatile
10662eval $setvar
10663$rm -f try.*
10664
b4eb6b3d
JH
10665
10666echo " "
10667$echo "Choosing the C types to be used for Perl's internal types..." >&4
10668
10669case "$use64bitint:$d_quad:$quadtype" in
10670define:define:?*)
10671 ivtype="$quadtype"
10672 uvtype="$uquadtype"
10673 ivsize=8
10674 uvsize=8
10675 ;;
10676*) ivtype="long"
10677 uvtype="unsigned long"
10678 ivsize=$longsize
10679 uvsize=$longsize
10680 ;;
10681esac
10682
10683case "$uselongdouble:$d_longdbl" in
10684define:define)
10685 nvtype="long double"
10686 nvsize=$longdblsize
10687 ;;
10688*) nvtype=double
10689 nvsize=$doublesize
10690 ;;
10691esac
10692
10693$echo "(IV will be "$ivtype", $ivsize bytes)"
10694$echo "(UV will be "$uvtype", $uvsize bytes)"
10695$echo "(NV will be "$nvtype", $nvsize bytes)"
10696
10697$cat >try.c <<EOCP
10698#$i_inttypes I_INTTYPES
10699#ifdef I_INTTYPES
10700#include <inttypes.h>
10701#endif
10702#include <stdio.h>
10703int main() {
10704#ifdef INT8
10705 int8_t i = INT8_MAX;
10706 uint8_t u = UINT8_MAX;
10707 printf("int8_t\n");
10708#endif
10709#ifdef INT16
10710 int16_t i = INT16_MAX;
10711 uint16_t i = UINT16_MAX;
10712 printf("int16_t\n");
10713#endif
10714#ifdef INT32
10715 int32_t i = INT32_MAX;
10716 uint32_t u = UINT32_MAX;
10717 printf("int32_t\n");
10718#endif
10719}
10720EOCP
10721
10722case "$i8type" in
10723'') case "$charsize" in
10724 1) i8type=char
10725 u8type="unsigned char"
10726 i8size=$charsize
10727 u8size=$charsize
10728 ;;
10729 esac
10730 ;;
10731esac
10732case "$i8type" in
10733'') set try -DINT8
10734 if eval $compile; then
10735 case "`./try$exe_ext`" in
10736 int8_t) i8type=int8_t
10737 u8type=uint8_t
10738 i8size=1
10739 u8size=1
10740 ;;
10741 esac
10742 fi
10743 ;;
10744esac
10745case "$i8type" in
10746'') if $test $charsize -ge 1; then
10747 i8type=char
10748 u8type="unsigned char"
10749 i8size=$charsize
10750 u8size=$charsize
10751 fi
10752 ;;
10753esac
10754
10755case "$i16type" in
10756'') case "$shortsize" in
10757 2) i16type=short
10758 u16type="unsigned short"
10759 i16size=$shortsize
10760 u16size=$shortsize
10761 ;;
10762 esac
10763 ;;
10764esac
10765case "$i16type" in
10766'') set try -DINT16
10767 if eval $compile; then
10768 case "`./try$exe_ext`" in
10769 int16_t)
10770 i16type=int16_t
10771 u16type=uint16_t
10772 i16size=2
10773 u16size=2
10774 ;;
10775 esac
10776 fi
10777 ;;
10778esac
10779case "$i16type" in
10780'') if $test $shortsize -ge 2; then
10781 i16type=short
10782 u16type="unsigned short"
10783 i16size=$shortsize
10784 u16size=$shortsize
10785 fi
10786 ;;
10787esac
10788
10789case "$i32type" in
10790'') case "$longsize" in
10791 4) i32type=long
10792 u32type="unsigned long"
10793 i32size=$longsize
10794 u32size=$longsize
10795 ;;
10796 *) case "$intsize" in
10797 4) i32type=int
10798 u32type="unsigned int"
10799 i32size=$intsize
10800 u32size=$intsize
10801 ;;
10802 esac
10803 ;;
10804 esac
10805 ;;
10806esac
10807case "$i32type" in
10808'') set try -DINT32
10809 if eval $compile; then
10810 case "`./try$exe_ext`" in
10811 int32_t)
10812 i32type=int32_t
10813 u32type=uint32_t
10814 i32size=4
10815 u32size=4
10816 ;;
10817 esac
10818 fi
10819 ;;
10820esac
10821case "$i32type" in
10822'') if $test $intsize -ge 4; then
10823 i32type=int
10824 u32type="unsigned int"
10825 i32size=$intsize
10826 u32size=$intsize
10827 fi
10828 ;;
10829esac
10830
10831case "$i64type" in
10832'') case "$d_quad:$quadtype" in
10833 define:?*)
10834 i64type="$quadtype"
10835 u64type="$uquadtype"
10836 i64size=8
10837 u64size=8
10838 ;;
10839 esac
10840 ;;
10841esac
10842
1d1be0dc
NC
10843$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10844: volatile so that the compiler has to store it out to memory.
10845if test X"$d_volatile" = X"$define"; then
10846 volatile=volatile
10847fi
b4eb6b3d
JH
10848$cat <<EOP >try.c
10849#include <stdio.h>
1d1be0dc
NC
10850#include <sys/types.h>
10851#include <signal.h>
10852#ifdef SIGFPE
10853$volatile int bletched = 0;
10854$signal_t blech(s) int s; { bletched = 1; }
10855#endif
b4eb6b3d
JH
10856int main() {
10857 $uvtype u = 0;
1d1be0dc 10858 $nvtype d;
b4eb6b3d
JH
10859 int n = 8 * $uvsize;
10860 int i;
1d1be0dc
NC
10861#ifdef SIGFPE
10862 signal(SIGFPE, blech);
10863#endif
10864
b4eb6b3d
JH
10865 for (i = 0; i < n; i++) {
10866 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
10867 d = ($nvtype)u;
10868 if (($uvtype)d != u)
b4eb6b3d 10869 break;
1d1be0dc
NC
10870 if (d <= 0)
10871 break;
10872 d = ($nvtype)(u - 1);
10873 if (($uvtype)d != (u - 1))
10874 break;
10875#ifdef SIGFPE
10876 if (bletched) {
10877 break;
10878#endif
10879 }
b4eb6b3d 10880 }
efd1522b 10881 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
10882 exit(0);
10883}
10884EOP
1d1be0dc
NC
10885set try
10886
10887d_nv_preserves_uv="$undef"
10888if eval $compile; then
10889 d_nv_preserves_uv_bits="`./try$exe_ext`"
10890fi
10891case "$d_nv_preserves_uv_bits" in
10892\-[1-9]*)
10893 d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10894 $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs." 2>&1
10895 d_nv_preserves_uv="$define"
b4eb6b3d 10896 ;;
1d1be0dc
NC
10897[1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs." 2>&1
10898 d_nv_preserves_uv="$undef" ;;
10899*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
10900 d_nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
10901esac
10902
1d1be0dc
NC
10903$rm -f try.* try
10904
b4eb6b3d
JH
10905
10906: check for off64_t
10907echo " "
10908echo "Checking to see if you have off64_t..." >&4
10909$cat >try.c <<EOCP
10910#include <sys/types.h>
10911#include <unistd.h>
10912int main() { off64_t x = 7; }
10913EOCP
10914set try
10915if eval $compile; then
10916 val="$define"
10917 echo "You have off64_t."
10918else
10919 val="$undef"
10920 echo "You do not have off64_t."
10921 case "$lseeksize" in
10922 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10923 esac
10924fi
10925$rm -f try.* try
10926set d_off64_t
10927eval $setvar
10928
10929: see if POSIX threads are available
10930set pthread.h i_pthread
10931eval $inhdr
10932
10933
10934
10935
10936: how to create joinable pthreads
10937if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10938 echo " "
10939 echo "Checking what constant to use for creating joinable pthreads..." >&4
10940 $cat >try.c <<'EOCP'
10941#include <pthread.h>
10942int main() {
10943 int detachstate = JOINABLE;
10944}
10945EOCP
10946 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10947 if eval $compile; then
10948 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10949 val="$undef" # Yes, undef.
10950 set d_old_pthread_create_joinable
10951 eval $setvar
10952 val=""
10953 set old_pthread_create_joinable
10954 eval $setvar
10955 else
10956 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10957 if eval $compile; then
10958 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10959 val="$define"
10960 set d_old_pthread_create_joinable
10961 eval $setvar
10962 val=PTHREAD_CREATE_UNDETACHED
10963 set old_pthread_create_joinable
10964 eval $setvar
10965 else
10966 set try -DJOINABLE=__UNDETACHED
10967 if eval $compile; then
10968 echo "You seem to use __UNDETACHED." >&4
10969 val="$define"
10970 set d_old_pthread_create_joinable
10971 eval $setvar
10972 val=__UNDETACHED
10973 set old_pthread_create_joinable
10974 eval $setvar
10975 else
10976 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
10977 val="$define"
10978 set d_old_pthread_create_joinable
10979 eval $setvar
10980 val=0
10981 set old_pthread_create_joinable
10982 eval $setvar
10983 fi
10984 fi
10985 fi
10986 $rm -f try try.*
10987else
10988 d_old_pthread_create_joinable="$undef"
10989 old_pthread_create_joinable=""
10990fi
10991
10992: see if pause exists
10993set pause d_pause
10994eval $inlibc
10995
10996: see if pipe exists
10997set pipe d_pipe
10998eval $inlibc
10999
11000: see if poll exists
11001set poll d_poll
11002eval $inlibc
11003
11004
11005: see whether the various POSIXish _yields exist
11006$cat >try.c <<EOP
11007#include <pthread.h>
11008#include <stdio.h>
11009int main() {
11010#ifdef SCHED_YIELD
11011 sched_yield();
11012#else
11013#ifdef PTHREAD_YIELD
11014 pthread_yield();
11015#else
11016#ifdef PTHREAD_YIELD_NULL
11017 pthread_yield(NULL);
11018#endif
11019#endif
11020#endif
11021}
11022EOP
11023: see if sched_yield exists
11024set try -DSCHED_YIELD
11025if eval $compile; then
11026 val="$define"
11027 sched_yield='sched_yield()'
11028else
11029 val="$undef"
11030fi
11031case "$usethreads" in
11032$define)
11033 case "$val" in
11034 $define) echo 'sched_yield() found.' >&4 ;;
11035 *) echo 'sched_yield() NOT found.' >&4 ;;
11036 esac
11037esac
11038set d_sched_yield
11039eval $setvar
11040
11041: see if pthread_yield exists
11042set try -DPTHREAD_YIELD
11043if eval $compile; then
11044 val="$define"
11045 case "$sched_yield" in
11046 '') sched_yield='pthread_yield()' ;;
11047 esac
11048else
11049 set try -DPTHREAD_YIELD_NULL
11050 if eval $compile; then
11051 val="$define"
11052 case "$sched_yield" in
11053 '') sched_yield='pthread_yield(NULL)' ;;
11054 esac
11055 else
11056 val="$undef"
11057 fi
11058fi
11059case "$usethreads" in
11060$define)
11061 case "$val" in
11062 $define) echo 'pthread_yield() found.' >&4 ;;
11063 *) echo 'pthread_yield() NOT found.' >&4 ;;
11064 esac
11065 ;;
11066esac
11067set d_pthread_yield
11068eval $setvar
11069
11070case "$sched_yield" in
11071'') sched_yield=undef ;;
11072esac
11073
11074$rm -f try try.*
11075
11076: see if this is a pwd.h system
11077set pwd.h i_pwd
11078eval $inhdr
11079
11080case "$i_pwd" in
11081$define)
11082 xxx=`./findhdr pwd.h`
11083 $cppstdin $cppflags $cppminus < $xxx >$$.h
11084
11085 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11086 val="$define"
11087 else
11088 val="$undef"
11089 fi
11090 set d_pwquota
11091 eval $setvar
11092
11093 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11094 val="$define"
11095 else
11096 val="$undef"
11097 fi
11098 set d_pwage
11099 eval $setvar
11100
11101 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11102 val="$define"
11103 else
11104 val="$undef"
11105 fi
11106 set d_pwchange
11107 eval $setvar
11108
11109 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11110 val="$define"
11111 else
11112 val="$undef"
11113 fi
11114 set d_pwclass
11115 eval $setvar
11116
11117 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11118 val="$define"
11119 else
11120 val="$undef"
11121 fi
11122 set d_pwexpire
11123 eval $setvar
11124
11125 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11126 val="$define"
11127 else
11128 val="$undef"
11129 fi
11130 set d_pwcomment
11131 eval $setvar
11132
11133 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11134 val="$define"
11135 else
11136 val="$undef"
11137 fi
11138 set d_pwgecos
11139 eval $setvar
11140
11141 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11142 val="$define"
11143 else
11144 val="$undef"
11145 fi
11146 set d_pwpasswd
11147 eval $setvar
11148
11149 $rm -f $$.h
11150 ;;
11151*)
11152 val="$undef";
11153 set d_pwquota; eval $setvar
11154 set d_pwage; eval $setvar
11155 set d_pwchange; eval $setvar
11156 set d_pwclass; eval $setvar
11157 set d_pwexpire; eval $setvar
11158 set d_pwcomment; eval $setvar
11159 set d_pwgecos; eval $setvar
11160 set d_pwpasswd; eval $setvar
11161 ;;
11162esac
11163
11164: see if readdir and friends exist
11165set readdir d_readdir
11166eval $inlibc
11167set seekdir d_seekdir
11168eval $inlibc
11169set telldir d_telldir
11170eval $inlibc
11171set rewinddir d_rewinddir
11172eval $inlibc
11173
11174: see if readlink exists
11175set readlink d_readlink
11176eval $inlibc
11177
4e0554ec
JH
11178: see if readv exists
11179set readv d_readv
11180eval $inlibc
11181
640374d0
JH
11182: see if realpath exists
11183set realpath d_realpath
11184eval $inlibc
11185
4e0554ec
JH
11186: see if recvmsg exists
11187set recvmsg d_recvmsg
11188eval $inlibc
11189
b4eb6b3d
JH
11190: see if rename exists
11191set rename d_rename
11192eval $inlibc
11193
11194: see if rmdir exists
11195set rmdir d_rmdir
11196eval $inlibc
11197
11198: see if memory.h is available.
11199val=''
11200set memory.h val
11201eval $inhdr
11202
11203: See if it conflicts with string.h
11204case "$val" in
11205$define)
11206 case "$strings" in
11207 '') ;;
11208 *)
11209 $cppstdin $cppflags $cppminus < $strings > mem.h
11210 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11211 echo " "
11212 echo "We won't be including <memory.h>."
11213 val="$undef"
11214 fi
11215 $rm -f mem.h
11216 ;;
11217 esac
11218esac
11219set i_memory
11220eval $setvar
11221
11222: can bcopy handle overlapping blocks?
11223val="$undef"
11224case "$d_bcopy" in
11225"$define")
11226 echo " "
11227 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
11228 $cat >try.c <<EOCP
11229#$i_memory I_MEMORY
11230#$i_stdlib I_STDLIB
11231#$i_string I_STRING
11232#$i_unistd I_UNISTD
11233EOCP
11234 $cat >>try.c <<'EOCP'
11235#include <stdio.h>
11236#ifdef I_MEMORY
11237# include <memory.h>
11238#endif
11239#ifdef I_STDLIB
11240# include <stdlib.h>
11241#endif
11242#ifdef I_STRING
11243# include <string.h>
11244#else
11245# include <strings.h>
11246#endif
11247#ifdef I_UNISTD
11248# include <unistd.h> /* Needed for NetBSD */
11249#endif
11250int main()
11251{
11252char buf[128], abc[128];
11253char *b;
11254int len;
11255int off;
11256int align;
11257
11258bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11259
11260for (align = 7; align >= 0; align--) {
11261 for (len = 36; len; len--) {
11262 b = buf+align;
11263 bcopy(abc, b, len);
11264 for (off = 1; off <= len; off++) {
11265 bcopy(b, b+off, len);
11266 bcopy(b+off, b, len);
11267 if (bcmp(b, abc, len))
11268 exit(1);
11269 }
11270 }
11271}
11272exit(0);
11273}
11274EOCP
11275 set try
11276 if eval $compile_ok; then
11277 if ./try 2>/dev/null; then
11278 echo "Yes, it can."
11279 val="$define"
11280 else
11281 echo "It can't, sorry."
11282 case "$d_memmove" in
11283 "$define") echo "But that's Ok since you have memmove()." ;;
11284 esac
11285 fi
11286 else
11287 echo "(I can't compile the test program, so we'll assume not...)"
11288 case "$d_memmove" in
11289 "$define") echo "But that's Ok since you have memmove()." ;;
11290 esac
11291 fi
11292 ;;
11293esac
11294$rm -f try.* try core
11295set d_safebcpy
11296eval $setvar
11297
11298: can memcpy handle overlapping blocks?
11299val="$undef"
11300case "$d_memcpy" in
11301"$define")
11302 echo " "
11303 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
11304 $cat >try.c <<EOCP
11305#$i_memory I_MEMORY
11306#$i_stdlib I_STDLIB
11307#$i_string I_STRING
11308#$i_unistd I_UNISTD
11309EOCP
11310 $cat >>try.c <<'EOCP'
11311#include <stdio.h>
11312#ifdef I_MEMORY
11313# include <memory.h>
11314#endif
11315#ifdef I_STDLIB
11316# include <stdlib.h>
11317#endif
11318#ifdef I_STRING
11319# include <string.h>
11320#else
11321# include <strings.h>
11322#endif
11323#ifdef I_UNISTD
11324# include <unistd.h> /* Needed for NetBSD */
11325#endif
11326int main()
11327{
11328char buf[128], abc[128];
11329char *b;
11330int len;
11331int off;
11332int align;
11333
11334/* Copy "abcde..." string to char abc[] so that gcc doesn't
11335 try to store the string in read-only memory. */
11336memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11337
11338for (align = 7; align >= 0; align--) {
11339 for (len = 36; len; len--) {
11340 b = buf+align;
11341 memcpy(b, abc, len);
11342 for (off = 1; off <= len; off++) {
11343 memcpy(b+off, b, len);
11344 memcpy(b, b+off, len);
11345 if (memcmp(b, abc, len))
11346 exit(1);
11347 }
11348 }
11349}
11350exit(0);
11351}
11352EOCP
11353 set try
11354 if eval $compile_ok; then
11355 if ./try 2>/dev/null; then
11356 echo "Yes, it can."
11357 val="$define"
11358 else
11359 echo "It can't, sorry."
11360 case "$d_memmove" in
11361 "$define") echo "But that's Ok since you have memmove()." ;;
11362 esac
11363 fi
11364 else
11365 echo "(I can't compile the test program, so we'll assume not...)"
11366 case "$d_memmove" in
11367 "$define") echo "But that's Ok since you have memmove()." ;;
11368 esac
11369 fi
11370 ;;
11371esac
11372$rm -f try.* try core
11373set d_safemcpy
11374eval $setvar
11375
11376: can memcmp be trusted to compare relative magnitude?
11377val="$undef"
11378case "$d_memcmp" in
11379"$define")
11380 echo " "
11381 echo "Checking if your memcmp() can compare relative magnitude..." >&4
11382 $cat >try.c <<EOCP
11383#$i_memory I_MEMORY
11384#$i_stdlib I_STDLIB
11385#$i_string I_STRING
11386#$i_unistd I_UNISTD
11387EOCP
11388 $cat >>try.c <<'EOCP'
11389#include <stdio.h>
11390#ifdef I_MEMORY
11391# include <memory.h>
11392#endif
11393#ifdef I_STDLIB
11394# include <stdlib.h>
11395#endif
11396#ifdef I_STRING
11397# include <string.h>
11398#else
11399# include <strings.h>
11400#endif
11401#ifdef I_UNISTD
11402# include <unistd.h> /* Needed for NetBSD */
11403#endif
11404int main()
11405{
11406char a = -1;
11407char b = 0;
11408if ((a < b) && memcmp(&a, &b, 1) < 0)
11409 exit(1);
11410exit(0);
11411}
11412EOCP
11413 set try
11414 if eval $compile_ok; then
11415 if ./try 2>/dev/null; then
11416 echo "Yes, it can."
11417 val="$define"
11418 else
11419 echo "No, it can't (it uses signed chars)."
11420 fi
11421 else
11422 echo "(I can't compile the test program, so we'll assume not...)"
11423 fi
11424 ;;
11425esac
11426$rm -f try.* try core
11427set d_sanemcmp
11428eval $setvar
11429
ef9f17be
JH
11430: see if prototype for sbrk is available
11431echo " "
11432set d_sbrkproto sbrk $i_unistd unistd.h
11433eval $hasproto
11434
b4eb6b3d
JH
11435: see if select exists
11436set select d_select
11437eval $inlibc
11438
11439: see if semctl exists
11440set semctl d_semctl
11441eval $inlibc
11442
11443: see if semget exists
11444set semget d_semget
11445eval $inlibc
11446
11447: see if semop exists
11448set semop d_semop
11449eval $inlibc
11450
11451: see how much of the 'sem*(2)' library is present.
11452h_sem=true
11453echo " "
11454case "$d_semctl$d_semget$d_semop" in
11455*"$undef"*) h_sem=false;;
11456esac
11457case "$osname" in
11458freebsd)
11459 case "`ipcs 2>&1`" in
11460 "SVID messages"*"not configured"*)
11461 echo "Your $osname does not have the sem*(2) configured." >&4
11462 h_sem=false
11463 val="$undef"
11464 set semctl d_semctl
11465 eval $setvar
11466 set semget d_semget
11467 eval $setvar
11468 set semop d_semop
11469 eval $setvar
11470 ;;
11471 esac
11472 ;;
11473esac
11474: we could also check for sys/ipc.h ...
11475if $h_sem && $test `./findhdr sys/sem.h`; then
11476 echo "You have the full sem*(2) library." >&4
11477 val="$define"
11478else
11479 echo "You don't have the full sem*(2) library." >&4
11480 val="$undef"
11481fi
11482set d_sem
11483eval $setvar
11484
11485: see whether sys/sem.h defines union semun
11486echo " "
11487$cat > try.c <<'END'
11488#include <sys/types.h>
11489#include <sys/ipc.h>
11490#include <sys/sem.h>
11491int main () { union semun semun; semun.buf = 0; }
11492END
11493set try
11494if eval $compile; then
11495 echo "You have union semun in <sys/sem.h>." >&4
11496 val="$define"
11497else
11498 echo "You do not have union semun in <sys/sem.h>." >&4
11499 val="$undef"
11500fi
11501$rm -f try try.c try.h
11502set d_union_semun
11503eval $setvar
11504
11505: see how to do semctl IPC_STAT
11506case "$d_sem" in
11507$define)
11508 : see whether semctl IPC_STAT can use union semun
11509 echo " "
11510 $cat > try.h <<END
11511#ifndef S_IRUSR
11512# ifdef S_IREAD
11513# define S_IRUSR S_IREAD
11514# define S_IWUSR S_IWRITE
11515# define S_IXUSR S_IEXEC
11516# else
11517# define S_IRUSR 0400
11518# define S_IWUSR 0200
11519# define S_IXUSR 0100
11520# endif
11521# define S_IRGRP (S_IRUSR>>3)
11522# define S_IWGRP (S_IWUSR>>3)
11523# define S_IXGRP (S_IXUSR>>3)
11524# define S_IROTH (S_IRUSR>>6)
11525# define S_IWOTH (S_IWUSR>>6)
11526# define S_IXOTH (S_IXUSR>>6)
11527#endif
11528#ifndef S_IRWXU
11529# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11530# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11531# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11532#endif
11533END
11534
11535 $cat > try.c <<END
11536#include <sys/types.h>
11537#include <sys/ipc.h>
11538#include <sys/sem.h>
11539#include <sys/stat.h>
11540#include <stdio.h>
11541#include <errno.h>
11542#include "try.h"
11543#ifndef errno
11544extern int errno;
11545#endif
11546#$d_union_semun HAS_UNION_SEMUN
11547int main() {
11548 union semun
11549#ifndef HAS_UNION_SEMUN
11550 {
11551 int val;
11552 struct semid_ds *buf;
11553 unsigned short *array;
11554 }
11555#endif
11556 arg;
11557 int sem, st;
11558
11559#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11560 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11561 if (sem > -1) {
11562 struct semid_ds argbuf;
11563 arg.buf = &argbuf;
11564# ifdef IPC_STAT
11565 st = semctl(sem, 0, IPC_STAT, arg);
11566 if (st == 0)
11567 printf("semun\n");
11568 else
11569# endif /* IPC_STAT */
11570 printf("semctl IPC_STAT failed: errno = %d\n", errno);
11571# ifdef IPC_RMID
11572 if (semctl(sem, 0, IPC_RMID, arg) != 0)
11573# endif /* IPC_RMID */
11574 printf("semctl IPC_RMID failed: errno = %d\n", errno);
11575 } else
11576#endif /* IPC_PRIVATE && ... */
11577 printf("semget failed: errno = %d\n", errno);
11578 return 0;
11579}
11580END
11581 val="$undef"
11582 set try
11583 if eval $compile; then
11584 xxx=`./try`
11585 case "$xxx" in
11586 semun) val="$define" ;;
11587 esac
11588 fi
11589 $rm -f try try.c
11590 set d_semctl_semun
11591 eval $setvar
11592 case "$d_semctl_semun" in
11593 $define)
11594 echo "You can use union semun for semctl IPC_STAT." >&4
11595 also='also'
11596 ;;
11597 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
11598 also=''
11599 ;;
11600 esac
11601
11602 : see whether semctl IPC_STAT can use struct semid_ds pointer
11603 $cat > try.c <<'END'
11604#include <sys/types.h>
11605#include <sys/ipc.h>
11606#include <sys/sem.h>
11607#include <sys/stat.h>
11608#include "try.h"
11609#include <stdio.h>
11610#include <errno.h>
11611#ifndef errno
11612extern int errno;
11613#endif
11614int main() {
11615 struct semid_ds arg;
11616 int sem, st;
11617
11618#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11619 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11620 if (sem > -1) {
11621# ifdef IPC_STAT
11622 st = semctl(sem, 0, IPC_STAT, &arg);
11623 if (st == 0)
11624 printf("semid_ds\n");
11625 else
11626# endif /* IPC_STAT */
11627 printf("semctl IPC_STAT failed: errno = %d\n", errno);
11628# ifdef IPC_RMID
11629 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11630# endif /* IPC_RMID */
11631 printf("semctl IPC_RMID failed: errno = %d\n", errno);
11632 } else
11633#endif /* IPC_PRIVATE && ... */
11634 printf("semget failed: errno = %d\n", errno);
11635
11636 return 0;
11637}
11638END
11639 val="$undef"
11640 set try
11641 if eval $compile; then
11642 xxx=`./try`
11643 case "$xxx" in
11644 semid_ds) val="$define" ;;
11645 esac
11646 fi
11647 $rm -f try try.c
11648 set d_semctl_semid_ds
11649 eval $setvar
11650 case "$d_semctl_semid_ds" in
11651 $define)
11652 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11653 ;;
11654 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11655 ;;
11656 esac
11657 $rm -f try.h
11658 ;;
11659*) val="$undef"
11660
11661 # We do not have the full sem*(2) library, so assume we can not
11662 # use either.
11663
11664 set d_semctl_semun
11665 eval $setvar
11666
11667 set d_semctl_semid_ds
11668 eval $setvar
11669 ;;
11670esac
11671
4e0554ec
JH
11672: see if sendmsg exists
11673set sendmsg d_sendmsg
11674eval $inlibc
11675
b4eb6b3d
JH
11676: see if setegid exists
11677set setegid d_setegid
11678eval $inlibc
11679
11680: see if seteuid exists
11681set seteuid d_seteuid
11682eval $inlibc
11683
11684: see if setgrent exists
11685set setgrent d_setgrent
11686eval $inlibc
11687
11688: see if sethostent exists
11689set sethostent d_sethent
11690eval $inlibc
11691
4e0554ec
JH
11692: see if setitimer exists
11693set setitimer d_setitimer
11694eval $inlibc
11695
b4eb6b3d
JH
11696: see if setlinebuf exists
11697set setlinebuf d_setlinebuf
11698eval $inlibc
11699
11700: see if setlocale exists
11701set setlocale d_setlocale
11702eval $inlibc
11703
11704: see if setnetent exists
11705set setnetent d_setnent
11706eval $inlibc
11707
11708: see if setprotoent exists
11709set setprotoent d_setpent
11710eval $inlibc
11711
11712: see if setpgid exists
11713set setpgid d_setpgid
11714eval $inlibc
11715
11716: see if setpgrp2 exists
11717set setpgrp2 d_setpgrp2
11718eval $inlibc
11719
11720: see if setpriority exists
11721set setpriority d_setprior
11722eval $inlibc
11723
11724: see if setproctitle exists
11725set setproctitle d_setproctitle
11726eval $inlibc
11727
11728: see if setpwent exists
11729set setpwent d_setpwent
11730eval $inlibc
11731
11732: see if setregid exists
11733set setregid d_setregid
11734eval $inlibc
11735set setresgid d_setresgid
11736eval $inlibc
11737
11738: see if setreuid exists
11739set setreuid d_setreuid
11740eval $inlibc
11741set setresuid d_setresuid
11742eval $inlibc
11743
11744: see if setrgid exists
11745set setrgid d_setrgid
11746eval $inlibc
11747
11748: see if setruid exists
11749set setruid d_setruid
11750eval $inlibc
11751
11752: see if setservent exists
11753set setservent d_setsent
11754eval $inlibc
11755
11756: see if setsid exists
11757set setsid d_setsid
11758eval $inlibc
11759
11760: see if setvbuf exists
11761set setvbuf d_setvbuf
11762eval $inlibc
11763
11764: see if sfio.h is available
11765set sfio.h i_sfio
11766eval $inhdr
11767
11768
11769: see if sfio library is available
11770case "$i_sfio" in
11771$define)
11772 val=''
11773 set sfreserve val
11774 eval $inlibc
11775 ;;
11776*)
11777 val="$undef"
11778 ;;
11779esac
11780: Ok, but do we want to use it.
11781case "$val" in
11782$define)
11783 case "$usesfio" in
11784 true|$define|[yY]*) dflt='y';;
11785 *) dflt='n';;
11786 esac
11787 echo "$package can use the sfio library, but it is experimental."
11788 case "$useperlio" in
11789 "$undef")
11790 echo "For sfio also the PerlIO abstraction layer is needed."
11791 echo "Earlier you said you wouldn't want that."
11792 ;;
11793 esac
11794 rp="You seem to have sfio available, do you want to try using it?"
11795 . ./myread
11796 case "$ans" in
11797 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
11798 useperlio="$define"
11799 val="$define"
11800 ;;
11801 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
11802 val="$undef"
b4eb6b3d
JH
11803 ;;
11804 esac
11805 ;;
11806*) case "$usesfio" in
11807 true|$define|[yY]*)
11808 echo "Sorry, cannot find sfio on this machine." >&4
11809 echo "Ignoring your setting of usesfio=$usesfio." >&4
11810 val="$undef"
11811 ;;
11812 esac
11813 ;;
11814esac
11815set d_sfio
11816eval $setvar
11817case "$d_sfio" in
11818$define) usesfio='true';;
11819*) usesfio='false';;
11820esac
3659ebf1
JH
11821case "$d_sfio" in
11822$define) ;;
11823*) : Remove sfio from list of libraries to use
11824 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11825 shift
11826 libs="$*"
11827 echo "libs = $libs" >&4
11828;;
11829esac
11830
b4eb6b3d
JH
11831
11832: see if shmctl exists
11833set shmctl d_shmctl
11834eval $inlibc
11835
11836: see if shmget exists
11837set shmget d_shmget
11838eval $inlibc
11839
11840: see if shmat exists
11841set shmat d_shmat
11842eval $inlibc
11843: see what shmat returns
11844case "$d_shmat" in
11845"$define")
11846 $cat >shmat.c <<'END'
11847#include <sys/shm.h>
11848void *shmat();
11849END
11850 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11851 shmattype='void *'
11852 else
11853 shmattype='char *'
11854 fi
11855 echo "and it returns ($shmattype)." >&4
11856 : see if a prototype for shmat is available
11857 xxx=`./findhdr sys/shm.h`
11858 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11859 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11860 val="$define"
11861 else
11862 val="$undef"
11863 fi
11864 $rm -f shmat.[co]
11865 ;;
11866*)
11867 val="$undef"
11868 ;;
11869esac
11870set d_shmatprototype
11871eval $setvar
11872
11873: see if shmdt exists
11874set shmdt d_shmdt
11875eval $inlibc
11876
11877: see how much of the 'shm*(2)' library is present.
11878h_shm=true
11879echo " "
11880case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11881*"$undef"*) h_shm=false;;
11882esac
11883case "$osname" in
11884freebsd)
11885 case "`ipcs 2>&1`" in
11886 "SVID shared memory"*"not configured"*)
11887 echo "Your $osname does not have the shm*(2) configured." >&4
11888 h_shm=false
11889 val="$undef"
11890 set shmctl d_shmctl
11891 evat $setvar
11892 set shmget d_shmget
11893 evat $setvar
11894 set shmat d_shmat
11895 evat $setvar
11896 set shmdt d_shmdt
11897 evat $setvar
11898 ;;
11899 esac
11900 ;;
11901esac
11902: we could also check for sys/ipc.h ...
11903if $h_shm && $test `./findhdr sys/shm.h`; then
11904 echo "You have the full shm*(2) library." >&4
11905 val="$define"
11906else
11907 echo "You don't have the full shm*(2) library." >&4
11908 val="$undef"
11909fi
11910set d_shm
11911eval $setvar
11912
11913echo " "
11914: see if we have sigaction
11915if set sigaction val -f d_sigaction; eval $csym; $val; then
11916 echo 'sigaction() found.' >&4
11917 $cat > try.c <<'EOP'
11918#include <stdio.h>
11919#include <sys/types.h>
11920#include <signal.h>
11921int main()
11922{
11923 struct sigaction act, oact;
11924 act.sa_flags = 0;
11925 oact.sa_handler = 0;
11926 /* so that act and oact are used */
11927 exit(act.sa_flags == 0 && oact.sa_handler == 0);
11928}
11929EOP
11930 set try
11931 if eval $compile_ok; then
11932 val="$define"
11933 else
11934 echo "But you don't seem to have a useable struct sigaction." >&4
11935 val="$undef"
11936 fi
11937else
11938 echo 'sigaction NOT found.' >&4
11939 val="$undef"
11940fi
11941set d_sigaction; eval $setvar
11942$rm -f try try$_o try.c
11943
983dbef6
JH
11944: see if sigprocmask exists
11945set sigprocmask d_sigprocmask
11946eval $inlibc
11947
b4eb6b3d
JH
11948: see if sigsetjmp exists
11949echo " "
11950case "$d_sigsetjmp" in
11951'')
11952 $cat >try.c <<'EOP'
11953#include <setjmp.h>
11954sigjmp_buf env;
11955int set = 1;
11956int main()
11957{
11958 if (sigsetjmp(env,1))
11959 exit(set);
11960 set = 0;
11961 siglongjmp(env, 1);
11962 exit(1);
11963}
11964EOP
11965 set try
11966 if eval $compile; then
11967 if ./try >/dev/null 2>&1; then
11968 echo "POSIX sigsetjmp found." >&4
11969 val="$define"
11970 else
11971 $cat >&4 <<EOM
11972Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11973I'll ignore them.
11974EOM
11975 val="$undef"
11976 fi
11977 else
11978 echo "sigsetjmp not found." >&4
11979 val="$undef"
11980 fi
11981 ;;
11982*) val="$d_sigsetjmp"
11983 case "$d_sigsetjmp" in
11984 $define) echo "POSIX sigsetjmp found." >&4;;
11985 $undef) echo "sigsetjmp not found." >&4;;
11986 esac
11987 ;;
11988esac
11989set d_sigsetjmp
11990eval $setvar
11991$rm -f try.c try
11992
49a78c82
JH
11993: see if sockatmark exists
11994set sockatmark d_sockatmark
11995eval $inlibc
11996
2ef53570
JH
11997: see if prototype for sockatmark is available
11998echo " "
11999set d_sockatmarkproto sockatmark $d_socket sys/socket.h
12000eval $hasproto
12001
b4eb6b3d
JH
12002: see if socks5_init exists
12003set socks5_init d_socks5_init
12004eval $inlibc
12005
eef837ea
JH
12006: see if prototype for setresgid is available
12007echo " "
12008set d_sresgproto setresgid $i_unistd unistd.h
12009eval $hasproto
12010
640374d0
JH
12011: see if prototype for setresuid is available
12012echo " "
12013set d_sresuproto setresuid $i_unistd unistd.h
12014eval $hasproto
12015
b4eb6b3d
JH
12016: see if sys/stat.h is available
12017set sys/stat.h i_sysstat
12018eval $inhdr
12019
12020
12021: see if stat knows about block sizes
12022echo " "
12023echo "Checking to see if your struct stat has st_blocks field..." >&4
12024set d_statblks stat st_blocks $i_sysstat sys/stat.h
12025eval $hasfield
12026
12027
12028: see if this is a sys/vfs.h system
12029set sys/vfs.h i_sysvfs
12030eval $inhdr
12031
12032
12033: see if this is a sys/statfs.h system
12034set sys/statfs.h i_sysstatfs
12035eval $inhdr
12036
12037
12038echo " "
12039echo "Checking to see if your system supports struct statfs..." >&4
12040set 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
12041eval $hasstruct
12042case "$d_statfs_s" in
12043"$define") echo "Yes, it does." ;;
12044*) echo "No, it doesn't." ;;
12045esac
12046
12047
12048
12049: see if struct statfs knows about f_flags
12050case "$d_statfs_s" in
12051define)
12052 echo " "
12053 echo "Checking to see if your struct statfs has f_flags field..." >&4
12054 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
12055 eval $hasfield
12056 ;;
12057*) val="$undef"
12058 set d_statfs_f_flags
12059 eval $setvar
12060 ;;
12061esac
12062case "$d_statfs_f_flags" in
12063"$define") echo "Yes, it does." ;;
12064*) echo "No, it doesn't." ;;
12065esac
12066
12067: see if _ptr and _cnt from stdio act std
12068echo " "
80f36755
NC
12069
12070if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12071 echo "(Looks like you have stdio.h from BSD.)"
12072 case "$stdio_ptr" in
12073 '') stdio_ptr='((fp)->_p)'
12074 ptr_lval=$define
12075 ;;
12076 *) ptr_lval=$d_stdio_ptr_lval;;
12077 esac
12078 case "$stdio_cnt" in
12079 '') stdio_cnt='((fp)->_r)'
12080 cnt_lval=$define
12081 ;;
12082 *) cnt_lval=$d_stdio_cnt_lval;;
12083 esac
12084 case "$stdio_base" in
12085 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12086 esac
12087 case "$stdio_bufsiz" in
12088 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12089 esac
12090elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
b4eb6b3d
JH
12091 echo "(Looks like you have stdio.h from Linux.)"
12092 case "$stdio_ptr" in
12093 '') stdio_ptr='((fp)->_IO_read_ptr)'
12094 ptr_lval=$define
12095 ;;
12096 *) ptr_lval=$d_stdio_ptr_lval;;
12097 esac
12098 case "$stdio_cnt" in
12099 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12100 cnt_lval=$undef
12101 ;;
12102 *) cnt_lval=$d_stdio_cnt_lval;;
12103 esac
12104 case "$stdio_base" in
12105 '') stdio_base='((fp)->_IO_read_base)';;
12106 esac
12107 case "$stdio_bufsiz" in
12108 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12109 esac
12110else
12111 case "$stdio_ptr" in
12112 '') stdio_ptr='((fp)->_ptr)'
12113 ptr_lval=$define
12114 ;;
12115 *) ptr_lval=$d_stdio_ptr_lval;;
12116 esac
12117 case "$stdio_cnt" in
12118 '') stdio_cnt='((fp)->_cnt)'
12119 cnt_lval=$define
12120 ;;
12121 *) cnt_lval=$d_stdio_cnt_lval;;
12122 esac
12123 case "$stdio_base" in
12124 '') stdio_base='((fp)->_base)';;
12125 esac
12126 case "$stdio_bufsiz" in
12127 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12128 esac
12129fi
80f36755 12130
b4eb6b3d
JH
12131: test whether _ptr and _cnt really work
12132echo "Checking how std your stdio is..." >&4
12133$cat >try.c <<EOP
12134#include <stdio.h>
12135#define FILE_ptr(fp) $stdio_ptr
12136#define FILE_cnt(fp) $stdio_cnt
12137int main() {
12138 FILE *fp = fopen("try.c", "r");
12139 char c = getc(fp);
12140 if (
12141 18 <= FILE_cnt(fp) &&
12142 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12143 )
12144 exit(0);
12145 exit(1);
12146}
12147EOP
12148val="$undef"
12149set try
12150if eval $compile; then
12151 if ./try; then
12152 echo "Your stdio acts pretty std."
12153 val="$define"
12154 else
12155 echo "Your stdio isn't very std."
12156 fi
12157else
12158 echo "Your stdio doesn't appear very std."
12159fi
12160$rm -f try.c try
12161set d_stdstdio
12162eval $setvar
12163
12164: Can _ptr be used as an lvalue?
12165case "$d_stdstdio$ptr_lval" in
12166$define$define) val=$define ;;
12167*) val=$undef ;;
12168esac
12169set d_stdio_ptr_lval
12170eval $setvar
12171
12172: Can _cnt be used as an lvalue?
12173case "$d_stdstdio$cnt_lval" in
12174$define$define) val=$define ;;
12175*) val=$undef ;;
12176esac
12177set d_stdio_cnt_lval
12178eval $setvar
12179
a7ffa9b9
NC
12180
12181: test whether setting _ptr sets _cnt as a side effect
12182d_stdio_ptr_lval_sets_cnt="$undef"
12183d_stdio_ptr_lval_nochange_cnt="$undef"
12184case "$d_stdio_ptr_lval$d_stdstdio" in
12185$define$define)
12186 echo "Checking to see what happens if we set the stdio ptr..." >&4
12187$cat >try.c <<EOP
12188#include <stdio.h>
12189/* Can we scream? */
12190/* Eat dust sed :-) */
c1d9e6fa 12191/* In the buffer space, no one can hear you scream. */
0bbfc344
JH
12192#define FILE_ptr(fp) $stdio_ptr
12193#define FILE_cnt(fp) $stdio_cnt
c1d9e6fa 12194#include <sys/types.h>
a7ffa9b9
NC
12195int main() {
12196 FILE *fp = fopen("try.c", "r");
c1d9e6fa 12197 int c;
a7ffa9b9
NC
12198 char *ptr;
12199 size_t cnt;
c1d9e6fa
JH
12200 if (!fp) {
12201 puts("Fail even to read");
12202 exit(1);
12203 }
12204 c = getc(fp); /* Read away the first # */
12205 if (c == EOF) {
12206 puts("Fail even to read");
12207 exit(1);
12208 }
a7ffa9b9
NC
12209 if (!(
12210 18 <= FILE_cnt(fp) &&
12211 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12212 )) {
12213 puts("Fail even to read");
12214 exit (1);
12215 }
c1d9e6fa
JH
12216 ptr = (char*) FILE_ptr(fp);
12217 cnt = (size_t)FILE_cnt(fp);
a7ffa9b9 12218
c1d9e6fa 12219 FILE_ptr(fp) += 42;
a7ffa9b9 12220
c1d9e6fa 12221 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
a7ffa9b9
NC
12222 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12223 exit (1);
12224 }
12225 if (FILE_cnt(fp) <= 20) {
12226 printf ("Fail (<20 chars to test)");
12227 exit (1);
12228 }
12229 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12230 puts("Fail compare");
12231 exit (1);
12232 }
12233 if (cnt == FILE_cnt(fp)) {
12234 puts("Pass_unchanged");
12235 exit (0);
12236 }
12237 if (FILE_cnt(fp) == (cnt - 42)) {
12238 puts("Pass_changed");
12239 exit (0);
12240 }
12241 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12242 return 1;
12243
12244}
12245EOP
12246 set try
12247 if eval $compile; then
12248 case `./try$exe_ext` in
12249 Pass_changed)
2e32dcfe 12250 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
a7ffa9b9
NC
12251 d_stdio_ptr_lval_sets_cnt="$define" ;;
12252 Pass_unchanged)
12253 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12254 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12255 Fail*)
12256 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12257 *)
12258 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12259 esac
12260 else
12261 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12262 fi
12263 $rm -f try.c try
12264 ;;
12265esac
12266
b4eb6b3d
JH
12267: see if _base is also standard
12268val="$undef"
12269case "$d_stdstdio" in
12270$define)
12271 $cat >try.c <<EOP
12272#include <stdio.h>
12273#define FILE_base(fp) $stdio_base
12274#define FILE_bufsiz(fp) $stdio_bufsiz
12275int main() {
12276 FILE *fp = fopen("try.c", "r");
12277 char c = getc(fp);
12278 if (
12279 19 <= FILE_bufsiz(fp) &&
12280 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12281 )
12282 exit(0);
12283 exit(1);
12284}
12285EOP
12286 set try
12287 if eval $compile; then
12288 if ./try; then
12289 echo "And its _base field acts std."
12290 val="$define"
12291 else
12292 echo "But its _base field isn't std."
12293 fi
12294 else
12295 echo "However, it seems to be lacking the _base field."
12296 fi
12297 $rm -f try.c try
12298 ;;
12299esac
12300set d_stdiobase
12301eval $setvar
12302
12303$cat >&4 <<EOM
12304Checking how to access stdio streams by file descriptor number...
12305EOM
12306case "$stdio_stream_array" in
12307'') $cat >try.c <<EOCP
12308#include <stdio.h>
12309int main() {
12310 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12311 printf("yes\n");
12312}
12313EOCP
12314 for s in _iob __iob __sF
12315 do
12316 set try -DSTDIO_STREAM_ARRAY=$s
12317 if eval $compile; then
12318 case "`./try$exe_ext`" in
12319 yes) stdio_stream_array=$s; break ;;
12320 esac
12321 fi
12322 done
12323 $rm -f try.* try$exe_ext
12324esac
12325case "$stdio_stream_array" in
12326'') $cat >&4 <<EOM
12327I can't figure out how to access stdio streams by file descriptor number.
12328EOM
12329 d_stdio_stream_array="$undef"
12330 ;;
12331*) $cat >&4 <<EOM
12332You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12333EOM
12334 d_stdio_stream_array="$define"
12335 ;;
12336esac
12337
12338: see if strcoll exists
12339set strcoll d_strcoll
12340eval $inlibc
12341
12342: check for structure copying
12343echo " "
12344echo "Checking to see if your C compiler can copy structs..." >&4
12345$cat >try.c <<'EOCP'
12346int main()
12347{
12348 struct blurfl {
12349 int dyick;
12350 } foo, bar;
12351
12352 foo = bar;
12353}
12354EOCP
12355if $cc -c try.c >/dev/null 2>&1 ; then
12356 val="$define"
12357 echo "Yup, it can."
12358else
12359 val="$undef"
12360 echo "Nope, it can't."
12361fi
12362set d_strctcpy
12363eval $setvar
12364$rm -f try.*
12365
12366: see if strerror and/or sys_errlist[] exist
12367echo " "
12368if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12369 if set strerror val -f d_strerror; eval $csym; $val; then
12370 echo 'strerror() found.' >&4
12371 d_strerror="$define"
12372 d_strerrm='strerror(e)'
12373 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12374 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
12375 d_syserrlst="$define"
12376 else
12377 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12378 d_syserrlst="$undef"
12379 fi
12380 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12381 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12382 echo 'strerror() found in string header.' >&4
12383 d_strerror="$define"
12384 d_strerrm='strerror(e)'
12385 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12386 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12387 d_syserrlst="$define"
12388 else
12389 echo "(You don't appear to have any sys_errlist[], how can this be?)"
12390 d_syserrlst="$undef"
12391 fi
12392 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12393 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12394 d_strerror="$undef"
12395 d_syserrlst="$define"
12396 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12397 else
12398 echo 'strerror() and sys_errlist[] NOT found.' >&4
12399 d_strerror="$undef"
12400 d_syserrlst="$undef"
12401 d_strerrm='"unknown"'
12402 fi
12403fi
12404
b3c85772
JH
12405: see if strftime exists
12406set strftime d_strftime
12407eval $inlibc
12408
b4eb6b3d
JH
12409: see if strtod exists
12410set strtod d_strtod
12411eval $inlibc
12412
12413: see if strtol exists
12414set strtol d_strtol
12415eval $inlibc
12416
12417: see if strtold exists
12418set strtold d_strtold
12419eval $inlibc
12420
12421: see if strtoll exists
12422set strtoll d_strtoll
12423eval $inlibc
12424
12425case "$d_longlong-$d_strtoll" in
12426"$define-$define")
12427 $cat <<EOM
12428Checking whether your strtoll() works okay...
12429EOM
12430 $cat >try.c <<'EOCP'
12431#include <errno.h>
12432#ifdef __hpux
12433#define strtoll __strtoll
12434#endif
e75931a7
YST
12435#ifdef __EMX__
12436#define strtoll _strtoll
12437#endif
b4eb6b3d
JH
12438#include <stdio.h>
12439extern long long int strtoll(char *s, char **, int);
12440static int bad = 0;
12441int check(char *s, long long ell, int een) {
12442 long long gll;
12443 errno = 0;
12444 gll = strtoll(s, 0, 10);
12445 if (!((gll == ell) && (errno == een)))
12446 bad++;
12447}
12448int main() {
12449 check(" 1", 1LL, 0);
12450 check(" 0", 0LL, 0);
12451 check("-1", -1LL, 0);
12452 check("-9223372036854775808", -9223372036854775808LL, 0);
12453 check("-9223372036854775808", -9223372036854775808LL, 0);
12454 check(" 9223372036854775807", 9223372036854775807LL, 0);
12455 check("-9223372036854775808", -9223372036854775808LL, 0);
12456 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
12457 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12458 if (!bad)
12459 printf("ok\n");
12460}
12461EOCP
12462 set try
12463 if eval $compile; then
e75931a7
YST
12464 yyy=`./try`
12465 case "$yyy" in
b4eb6b3d
JH
12466 ok) echo "Your strtoll() seems to be working okay." ;;
12467 *) cat <<EOM >&4
12468Your strtoll() doesn't seem to be working okay.
12469EOM
12470 d_strtoll="$undef"
12471 ;;
69eadf66 12472 esac
e75931a7
YST
12473 else
12474 echo "(I can't seem to compile the test program--assuming it doesn't)"
12475 d_strtoll="$undef"
b4eb6b3d
JH
12476 fi
12477 ;;
12478esac
12479
28e5dec8
JH
12480: see if strtoq exists
12481set strtoq d_strtoq
12482eval $inlibc
12483
b4eb6b3d
JH
12484: see if strtoul exists
12485set strtoul d_strtoul
12486eval $inlibc
12487
d0e6d399
NC
12488case "$d_strtoul" in
12489"$define")
12490 $cat <<EOM
12491Checking whether your strtoul() works okay...
12492EOM
12493 $cat >try.c <<'EOCP'
12494#include <errno.h>
12495#include <stdio.h>
12496extern unsigned long int strtoul(char *s, char **, int);
12497static int bad = 0;
12498void check(char *s, unsigned long eul, int een) {
12499 unsigned long gul;
12500 errno = 0;
12501 gul = strtoul(s, 0, 10);
12502 if (!((gul == eul) && (errno == een)))
12503 bad++;
12504}
12505int main() {
12506 check(" 1", 1L, 0);
12507 check(" 0", 0L, 0);
12508EOCP
12509 case "$longsize" in
12510 8)
12511 $cat >>try.c <<'EOCP'
09c0d2c4
JH
12512 check("18446744073709551615", 18446744073709551615UL, 0);
12513 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 12514#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 12515 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
12516 check("-18446744073709551614", 2, 0);
12517 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
12518 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12519 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 12520#endif
d0e6d399
NC
12521EOCP
12522 ;;
12523 4)
12524 $cat >>try.c <<'EOCP'
12525 check("4294967295", 4294967295UL, 0);
12526 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 12527#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
12528 check("-1", 4294967295UL, 0);
12529 check("-4294967294", 2, 0);
12530 check("-4294967295", 1, 0);
12531 check("-4294967296", 4294967295UL, ERANGE);
12532 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 12533#endif
d0e6d399
NC
12534EOCP
12535 ;;
12536 *)
12537: Should we write these tests to be more portable by sprintf-ing
12538: ~0 and then manipulating that char string as input for strtol?
12539 ;;
12540 esac
12541 $cat >>try.c <<'EOCP'
12542 if (!bad)
12543 printf("ok\n");
12544 return 0;
12545}
12546EOCP
12547 set try
12548 if eval $compile; then
12549 case "`./try`" in
12550 ok) echo "Your strtoul() seems to be working okay." ;;
12551 *) cat <<EOM >&4
12552Your strtoul() doesn't seem to be working okay.
12553EOM
12554 d_strtoul="$undef"
12555 ;;
12556 esac
12557 fi
12558 ;;
12559esac
12560
b4eb6b3d
JH
12561: see if strtoull exists
12562set strtoull d_strtoull
12563eval $inlibc
12564
12565case "$d_longlong-$d_strtoull" in
12566"$define-$define")
12567 $cat <<EOM
12568Checking whether your strtoull() works okay...
12569EOM
12570 $cat >try.c <<'EOCP'
12571#include <errno.h>
12572#ifdef __hpux
12573#define strtoull __strtoull
12574#endif
12575#include <stdio.h>
12576extern unsigned long long int strtoull(char *s, char **, int);
12577static int bad = 0;
12578int check(char *s, long long eull, int een) {
12579 long long gull;
12580 errno = 0;
12581 gull = strtoull(s, 0, 10);
12582 if (!((gull == eull) && (errno == een)))
12583 bad++;
12584}
12585int main() {
d0e6d399
NC
12586 check(" 1", 1LL, 0);
12587 check(" 0", 0LL, 0);
12588 check("18446744073709551615", 18446744073709551615ULL, 0);
12589 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 12590#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
12591 check("-1", 18446744073709551615ULL, 0);
12592 check("-18446744073709551614", 2LL, 0);
12593 check("-18446744073709551615", 1LL, 0);
12594 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12595 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 12596#endif
b4eb6b3d
JH
12597 if (!bad)
12598 printf("ok\n");
12599}
12600EOCP
12601 set try
12602 if eval $compile; then
12603 case "`./try`" in
12604 ok) echo "Your strtoull() seems to be working okay." ;;
12605 *) cat <<EOM >&4
12606Your strtoull() doesn't seem to be working okay.
12607EOM
12608 d_strtoull="$undef"
12609 ;;
12610 esac
12611 fi
12612 ;;
12613esac
12614
12615: see if strtouq exists
12616set strtouq d_strtouq
12617eval $inlibc
12618
d0e6d399
NC
12619case "$d_strtouq" in
12620"$define")
12621 $cat <<EOM
12622Checking whether your strtouq() works okay...
12623EOM
12624 $cat >try.c <<'EOCP'
12625#include <errno.h>
12626#include <stdio.h>
12627extern unsigned long long int strtouq(char *s, char **, int);
12628static int bad = 0;
12629void check(char *s, unsigned long long eull, int een) {
12630 unsigned long long gull;
12631 errno = 0;
12632 gull = strtouq(s, 0, 10);
12633 if (!((gull == eull) && (errno == een)))
12634 bad++;
12635}
12636int main() {
12637 check(" 1", 1LL, 0);
12638 check(" 0", 0LL, 0);
12639 check("18446744073709551615", 18446744073709551615ULL, 0);
12640 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 12641#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
12642 check("-1", 18446744073709551615ULL, 0);
12643 check("-18446744073709551614", 2LL, 0);
12644 check("-18446744073709551615", 1LL, 0);
12645 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12646 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 12647#endif
d0e6d399
NC
12648 if (!bad)
12649 printf("ok\n");
12650 return 0;
12651}
12652EOCP
12653 set try
12654 if eval $compile; then
12655 case "`./try`" in
12656 ok) echo "Your strtouq() seems to be working okay." ;;
12657 *) cat <<EOM >&4
12658Your strtouq() doesn't seem to be working okay.
12659EOM
12660 d_strtouq="$undef"
12661 ;;
12662 esac
12663 fi
12664 ;;
12665esac
12666
b4eb6b3d
JH
12667: see if strxfrm exists
12668set strxfrm d_strxfrm
12669eval $inlibc
12670
12671: see if symlink exists
12672set symlink d_symlink
12673eval $inlibc
12674
12675: see if syscall exists
12676set syscall d_syscall
12677eval $inlibc
12678
2ef53570
JH
12679: see if prototype for syscall is available
12680echo " "
12681set d_syscallproto syscall $i_unistd unistd.h
12682eval $hasproto
12683
b4eb6b3d
JH
12684: see if sysconf exists
12685set sysconf d_sysconf
12686eval $inlibc
12687
12688: see if system exists
12689set system d_system
12690eval $inlibc
12691
12692: see if tcgetpgrp exists
12693set tcgetpgrp d_tcgetpgrp
12694eval $inlibc
12695
12696: see if tcsetpgrp exists
12697set tcsetpgrp d_tcsetpgrp
12698eval $inlibc
12699
12700: see if prototype for telldir is available
12701echo " "
12702set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12703eval $hasproto
12704
12705: see if this is a sys/times.h system
12706set sys/times.h i_systimes
12707eval $inhdr
12708
12709: see if times exists
12710echo " "
12711if set times val -f d_times; eval $csym; $val; then
12712 echo 'times() found.' >&4
12713 d_times="$define"
12714 inc=''
12715 case "$i_systimes" in
12716 "$define") inc='sys/times.h';;
12717 esac
12718 rp="What is the type returned by times() on this system?"
12719 set clock_t clocktype long stdio.h sys/types.h $inc
12720 eval $typedef_ask
12721else
12722 echo 'times() NOT found, hope that will do.' >&4
12723 d_times="$undef"
12724 clocktype='int'
12725fi
12726
12727: see if truncate exists
12728set truncate d_truncate
12729eval $inlibc
12730
12731: see if tzname[] exists
12732echo " "
12733if set tzname val -a d_tzname; eval $csym; $val; then
12734 val="$define"
12735 echo 'tzname[] found.' >&4
12736else
12737 val="$undef"
12738 echo 'tzname[] NOT found.' >&4
12739fi
12740set d_tzname
12741eval $setvar
12742
4e0554ec
JH
12743case "$crosscompile" in
12744''|[nN]*) crosscompile="$undef" ;;
12745esac
12746
12747case "$osname" in
12748next|rhapsody|darwin) multiarch="$define" ;;
12749esac
12750case "$multiarch" in
12751''|[nN]*) multiarch="$undef" ;;
12752esac
12753
12754: check for ordering of bytes in a long
12755echo " "
12756case "$crosscompile$multiarch" in
12757*$define*)
12758 $cat <<EOM
12759You seem to be either cross-compiling or doing a multiarchitecture build,
12760skipping the byteorder check.
12761
12762EOM
12763 byteorder='0xffff'
12764 ;;
12765*)
12766 case "$byteorder" in
12767 '')
12768 $cat <<'EOM'
12769In the following, larger digits indicate more significance. A big-endian
12770machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12771little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12772machines may have weird orders like 3412. A Cray will report 87654321,
12773an Alpha will report 12345678. If the test program works the default is
12774probably right.
12775I'm now running the test program...
12776EOM
12777 $cat >try.c <<'EOCP'
12778#include <stdio.h>
12779int main()
12780{
12781 int i;
12782 union {
12783 unsigned long l;
12784 char c[sizeof(long)];
12785 } u;
12786
12787 if (sizeof(long) > 4)
12788 u.l = (0x08070605L << 32) | 0x04030201L;
12789 else
12790 u.l = 0x04030201L;
12791 for (i = 0; i < sizeof(long); i++)
12792 printf("%c", u.c[i]+'0');
12793 printf("\n");
12794 exit(0);
12795}
12796EOCP
12797 xxx_prompt=y
12798 set try
12799 if eval $compile && ./try > /dev/null; then
12800 dflt=`./try`
12801 case "$dflt" in
12802 [1-4][1-4][1-4][1-4]|12345678|87654321)
12803 echo "(The test program ran ok.)"
12804 echo "byteorder=$dflt"
12805 xxx_prompt=n
12806 ;;
12807 ????|????????) echo "(The test program ran ok.)" ;;
12808 *) echo "(The test program didn't run right for some reason.)" ;;
12809 esac
12810 else
12811 dflt='4321'
12812 cat <<'EOM'
12813(I can't seem to compile the test program. Guessing big-endian...)
12814EOM
12815 fi
12816 case "$xxx_prompt" in
12817 y)
12818 rp="What is the order of bytes in a long?"
12819 . ./myread
12820 byteorder="$ans"
12821 ;;
12822 *) byteorder=$dflt
12823 ;;
12824 esac
12825 ;;
12826 esac
12827 $rm -f try.c try
12828 ;;
12829esac
12830
12831
12832$cat <<EOM
12833
12834Checking to see whether you can access character data unalignedly...
12835EOM
12836$cat >try.c <<EOCP
12837#include <stdio.h>
12838#define U32 $u32type
12839#define BYTEORDER $byteorder
12840int main() {
12841#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
12842 U8 buf[] = "\0\0\0\1\0\0\0\0";
12843 U32 *up;
12844 int i;
12845
12846 if (sizeof(U32) != 4) {
12847 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
12848 exit(1);
12849 }
12850
12851 fflush(stdout);
12852
12853 for (i = 0; i < 4; i++) {
12854 up = (U32*)(buf + i);
12855 if (! ((*up == 1 << (8*i)) || /* big-endian */
12856 (*up == 1 << (8*(3-i))) /* little-endian */
12857 )
12858 )
12859 {
12860 printf("read failed (%x)\n", *up);
12861 exit(2);
12862 }
12863 }
12864
12865 /* write test */
12866 for (i = 0; i < 4; i++) {
12867 up = (U32*)(buf + i);
12868 *up = 0xBeef;
12869 if (*up != 0xBeef) {
12870 printf("write failed (%x)\n", *up);
12871 exit(3);
12872 }
12873 }
12874
12875 exit(0);
12876#else
12877 printf("1\n");
12878 exit(1);
12879#endif
12880 return 0;
12881}
12882EOCP
12883set try
12884if eval $compile_ok; then
12885 echo "(This test may dump core.)" >&4
12886 ./try >&2 >/dev/null
12887 case "$?" in
12888 0) cat >&4 <<EOM
12889You can access character data pretty unalignedly.
12890EOM
12891 d_u32align="$undef"
12892 ;;
12893 *) cat >&4 <<EOM
12894It seems that you must access character data in an aligned manner.
12895EOM
12896 d_u32align="$define"
12897 ;;
12898 esac
12899 $rm -f core core.try.* try.core
12900else
12901 rp='Can you access character data at unaligned addresses?'
12902 dflt='n'
12903 . ./myread
12904 case "$ans" in
12905 [yY]*) d_u32align="$undef" ;;
12906 *) d_u32align="$define" ;;
12907 esac
12908fi
12909
12910: see if ualarm exists
12911set ualarm d_ualarm
12912eval $inlibc
12913
b4eb6b3d
JH
12914: see if umask exists
12915set umask d_umask
12916eval $inlibc
12917
4e0554ec
JH
12918: see if usleep exists
12919set usleep d_usleep
12920eval $inlibc
12921
2ef53570
JH
12922: see if prototype for usleep is available
12923echo " "
12924set d_usleepproto usleep $i_unistd unistd.h
12925eval $hasproto
12926
b4eb6b3d
JH
12927: see if ustat exists
12928set ustat d_ustat
12929eval $inlibc
12930
12931: backward compatibility for d_hvfork
12932if test X$d_hvfork != X; then
12933 d_vfork="$d_hvfork"
12934 d_hvfork=''
12935fi
12936: see if there is a vfork
12937val=''
12938set vfork val
12939eval $inlibc
12940
12941: Ok, but do we want to use it. vfork is reportedly unreliable in
12942: perl on Solaris 2.x, and probably elsewhere.
12943case "$val" in
12944$define)
12945 echo " "
12946 case "$usevfork" in
12947 false) dflt='n';;
12948 *) dflt='y';;
12949 esac
12950 cat <<'EOM'
12951
12952Perl can only use a vfork() that doesn't suffer from strict
12953restrictions on calling functions or modifying global data in
12954the child. For example, glibc-2.1 contains such a vfork()
12955that is unsuitable. If your system provides a proper fork()
12956call, chances are that you do NOT want perl to use vfork().
12957
12958EOM
12959 rp="Do you still want to use vfork()?"
12960 . ./myread
12961 case "$ans" in
12962 y|Y) ;;
12963 *)
12964 echo "Ok, we won't use vfork()."
12965 val="$undef"
12966 ;;
12967 esac
12968 ;;
12969esac
12970set d_vfork
12971eval $setvar
12972case "$d_vfork" in
12973$define) usevfork='true';;
12974*) usevfork='false';;
12975esac
12976
12977: see if this is an sysdir system
12978set sys/dir.h i_sysdir
12979eval $inhdr
12980
12981: see if this is an sysndir system
12982set sys/ndir.h i_sysndir
12983eval $inhdr
12984
12985: see if closedir exists
12986set closedir d_closedir
12987eval $inlibc
12988
12989case "$d_closedir" in
12990"$define")
12991 echo " "
12992 echo "Checking whether closedir() returns a status..." >&4
12993 cat > closedir.c <<EOM
12994#$i_dirent I_DIRENT /**/
12995#$i_sysdir I_SYS_DIR /**/
12996#$i_sysndir I_SYS_NDIR /**/
12997#$i_systypes I_SYS_TYPES /**/
12998
12999#if defined(I_SYS_TYPES)
13000#include <sys/types.h>
13001#endif
13002#if defined(I_DIRENT)
13003#include <dirent.h>
13004#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
13005#include <sys/dir.h>
13006#endif
13007#else
13008#ifdef I_SYS_NDIR
13009#include <sys/ndir.h>
13010#else
13011#ifdef I_SYS_DIR
13012#ifdef hp9000s500
13013#include <ndir.h> /* may be wrong in the future */
13014#else
13015#include <sys/dir.h>
13016#endif
13017#endif
13018#endif
13019#endif
13020int main() { return closedir(opendir(".")); }
13021EOM
13022 set closedir
13023 if eval $compile_ok; then
13024 if ./closedir > /dev/null 2>&1 ; then
13025 echo "Yes, it does."
13026 val="$undef"
13027 else
13028 echo "No, it doesn't."
13029 val="$define"
13030 fi
13031 else
13032 echo "(I can't seem to compile the test program--assuming it doesn't)"
13033 val="$define"
13034 fi
13035 ;;
13036*)
13037 val="$undef";
13038 ;;
13039esac
13040set d_void_closedir
13041eval $setvar
13042$rm -f closedir*
b4eb6b3d
JH
13043: see if there is a wait4
13044set wait4 d_wait4
13045eval $inlibc
13046
13047: see if waitpid exists
13048set waitpid d_waitpid
13049eval $inlibc
13050
13051: see if wcstombs exists
13052set wcstombs d_wcstombs
13053eval $inlibc
13054
13055: see if wctomb exists
13056set wctomb d_wctomb
13057eval $inlibc
13058
4e0554ec
JH
13059: see if writev exists
13060set writev d_writev
13061eval $inlibc
13062
b4eb6b3d
JH
13063: preserve RCS keywords in files with variable substitution, grrr
13064Date='$Date'
13065Id='$Id'
13066Log='$Log'
13067RCSfile='$RCSfile'
13068Revision='$Revision'
13069
b4eb6b3d
JH
13070: check for alignment requirements
13071echo " "
13072case "$crosscompile$multiarch" in
13073*$define*)
13074 $cat <<EOM
13075You seem to be either cross-compiling or doing a multiarchitecture build,
13076skipping the memory alignment check.
13077
13078EOM
13079 case "$alignbytes" in
13080 '') alignbytes=8 ;;
13081 esac
13082 ;;
13083*)
13084 case "$alignbytes" in
13085 '') echo "Checking alignment constraints..." >&4
13086 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
13087 $cat >try.c <<'EOCP'
13088typedef long double NV;
13089EOCP
13090 else
13091 $cat >try.c <<'EOCP'
13092typedef double NV;
13093EOCP
13094 fi
13095 $cat >>try.c <<'EOCP'
13096#include <stdio.h>
13097struct foobar {
13098 char foo;
13099 NV bar;
13100} try_algn;
13101int main()
13102{
13103 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
13104 return(0);
13105}
13106EOCP
13107 set try
13108 if eval $compile_ok; then
13109 dflt=`./try`
13110 else
13111 dflt='8'
13112 echo "(I can't seem to compile the test program...)"
13113 fi
13114 ;;
13115 *) dflt="$alignbytes"
13116 ;;
13117 esac
13118 rp="Doubles must be aligned on a how-many-byte boundary?"
13119 . ./myread
13120 alignbytes="$ans"
13121 $rm -f try.c try
13122 ;;
13123esac
13124
13125
13126: set the base revision
13127baserev=5.0
13128
b4eb6b3d
JH
13129: how do we catenate cpp tokens here?
13130echo " "
13131echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
13132$cat >cpp_stuff.c <<'EOCP'
13133#define RCAT(a,b)a/**/b
13134#define ACAT(a,b)a ## b
13135RCAT(Rei,ser)
13136ACAT(Cir,cus)
13137EOCP
13138$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
13139if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
13140 echo "Oh! Smells like ANSI's been here." >&4
13141 echo "We can catify or stringify, separately or together!"
13142 cpp_stuff=42
13143elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
13144 echo "Ah, yes! The good old days!" >&4
13145 echo "However, in the good old days we don't know how to stringify and"
13146 echo "catify at the same time."
13147 cpp_stuff=1
13148else
13149 $cat >&4 <<EOM
13150Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
13151to have to edit the values of CAT[2-5] in config.h...
13152EOM
13153 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
13154fi
13155$rm -f cpp_stuff.*
13156
13157: see if this is a db.h system
13158set db.h i_db
13159eval $inhdr
13160
13161case "$i_db" in
13162$define)
13163 : Check db version.
13164 echo " "
13165 echo "Checking Berkeley DB version ..." >&4
13166 $cat >try.c <<EOCP
13167#$d_const HASCONST
13168#ifndef HASCONST
13169#define const
13170#endif
13171#include <sys/types.h>
13172#include <stdio.h>
13173#include <db.h>
640374d0 13174int main(int argc, char *argv[])
b4eb6b3d
JH
13175{
13176#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
13177 int Major, Minor, Patch ;
13178 unsigned long Version ;
13179 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
13180 if (argc == 2) {
13181 printf("%d %d %d %d %d %d\n",
13182 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
13183 Major, Minor, Patch);
13184 exit(0);
13185 }
13186 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
13187
13188 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13189 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13190 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13191 Major, Minor, Patch) ;
13192
13193 /* check that db.h & libdb are compatible */
13194 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 13195 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
13196 exit(3);
13197 }
13198
640374d0 13199 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
13200
13201 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13202 + DB_VERSION_PATCH ;
13203
13204 /* needs to be >= 2.3.4 */
13205 if (Version < 2003004) {
13206 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 13207 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
13208 exit(2);
13209 }
13210
13211 exit(0);
13212#else
13213#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
13214 if (argc == 2) {
13215 printf("1 0 0\n");
13216 exit(0);
13217 }
13218 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
13219 exit(0); /* DB version < 2: the coast is clear. */
13220#else
13221 exit(1); /* <db.h> not Berkeley DB? */
13222#endif
13223#endif
13224}
13225EOCP
13226 set try
13227 if eval $compile_ok && ./try; then
13228 echo 'Looks OK.' >&4
640374d0
JH
13229 set `./try 1`
13230 db_version_major=$1
13231 db_version_minor=$2
13232 db_version_patch=$3
b4eb6b3d
JH
13233 else
13234 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
13235 i_db=$undef
13236 case " $libs " in
13237 *"-ldb "*)
13238 : Remove db from list of libraries to use
13239 echo "Removing unusable -ldb from library list" >&4
13240 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13241 shift
13242 libs="$*"
13243 echo "libs = $libs" >&4
13244 ;;
13245 esac
13246 fi
13247 $rm -f try.*
13248 ;;
13249esac
13250
13251case "$i_db" in
13252define)
13253 : Check the return type needed for hash
13254 echo " "
13255 echo "Checking return type needed for hash for Berkeley DB ..." >&4
13256 $cat >try.c <<EOCP
13257#$d_const HASCONST
13258#ifndef HASCONST
13259#define const
13260#endif
13261#include <sys/types.h>
13262#include <db.h>
13263
13264#ifndef DB_VERSION_MAJOR
13265u_int32_t hash_cb (ptr, size)
13266const void *ptr;
13267size_t size;
13268{
13269}
13270HASHINFO info;
13271int main()
13272{
13273 info.hash = hash_cb;
13274}
13275#endif
13276EOCP
13277 if $cc $ccflags -c try.c >try.out 2>&1 ; then
13278 if $contains warning try.out >>/dev/null 2>&1 ; then
13279 db_hashtype='int'
13280 else
13281 db_hashtype='u_int32_t'
13282 fi
13283 else
13284 : XXX Maybe we should just give up here.
13285 db_hashtype=u_int32_t
13286 $cat try.out >&4
13287 echo "Help: I can't seem to compile the db test program." >&4
13288 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13289 fi
13290 $rm -f try.*
13291 echo "Your version of Berkeley DB uses $db_hashtype for hash."
13292 ;;
13293*) db_hashtype=u_int32_t
13294 ;;
13295esac
13296case "$i_db" in
13297define)
13298 : Check the return type needed for prefix
13299 echo " "
13300 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13301 cat >try.c <<EOCP
13302#$d_const HASCONST
13303#ifndef HASCONST
13304#define const
13305#endif
13306#include <sys/types.h>
13307#include <db.h>
13308
13309#ifndef DB_VERSION_MAJOR
13310size_t prefix_cb (key1, key2)
13311const DBT *key1;
13312const DBT *key2;
13313{
13314}
13315BTREEINFO info;
13316int main()
13317{
13318 info.prefix = prefix_cb;
13319}
13320#endif
13321EOCP
13322 if $cc $ccflags -c try.c >try.out 2>&1 ; then
13323 if $contains warning try.out >>/dev/null 2>&1 ; then
13324 db_prefixtype='int'
13325 else
13326 db_prefixtype='size_t'
13327 fi
13328 else
13329 db_prefixtype='size_t'
13330 : XXX Maybe we should just give up here.
13331 $cat try.out >&4
13332 echo "Help: I can't seem to compile the db test program." >&4
13333 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13334 fi
13335 $rm -f try.*
13336 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13337 ;;
13338*) db_prefixtype='size_t'
13339 ;;
13340esac
13341
b4eb6b3d
JH
13342
13343: How can we generate normalized random numbers ?
13344echo " "
13345echo "Looking for a random number function..." >&4
13346case "$randfunc" in
13347'')
13348 if set drand48 val -f; eval $csym; $val; then
13349 dflt="drand48"
13350 echo "Good, found drand48()." >&4
13351 elif set random val -f; eval $csym; $val; then
13352 dflt="random"
13353 echo "OK, found random()." >&4
13354 else
13355 dflt="rand"
13356 echo "Yick, looks like I have to use rand()." >&4
13357 fi
13358 echo " "
13359 ;;
13360*)
13361 dflt="$randfunc"
13362 ;;
13363esac
13364cont=true
13365
13366case "$ccflags" in
13367*-Dmy_rand=*|*-Dmy_srand=*)
13368 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13369 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13370 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13371 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13372 ;;
13373esac
13374
13375while $test "$cont"; do
13376 rp="Use which function to generate random numbers?"
13377 . ./myread
13378 if $test "$ans" = "$dflt"; then
13379 : null
13380 else
13381 randbits=''
13382 fi
13383 randfunc="$ans"
13384 if set $ans val -f; eval $csym; $val; then
13385 cont=''
13386 else
13387 dflt=y
13388 rp="I cannot find function $ans. Use that name anyway?"
13389 . ./myread
13390 dflt=rand
13391 case "$ans" in
13392 [yY]*) cont='';;
13393 esac
13394 fi
13395 case "$cont" in
13396 '')
13397 case "$randfunc" in
13398 drand48)
13399 drand01="drand48()"
13400 seedfunc="srand48"
13401 randbits=48
13402 randseedtype=long
13403 ;;
13404 rand|random)
13405 case "$randbits" in
13406 '')
13407echo "Checking to see how many bits your $randfunc() function produces..." >&4
13408 $cat >try.c <<EOCP
13409#$i_unistd I_UNISTD
13410#$i_stdlib I_STDLIB
13411#include <stdio.h>
13412#ifdef I_UNISTD
13413# include <unistd.h>
13414#endif
13415#ifdef I_STDLIB
13416# include <stdlib.h>
13417#endif
13418int main()
13419{
13420 register int i;
13421 register unsigned long tmp;
13422 register unsigned long max = 0L;
13423
13424 for (i = 1000; i; i--) {
13425 tmp = (unsigned long) $randfunc();
13426 if (tmp > max) max = tmp;
13427 }
13428 for (i = 0; max; i++)
13429 max /= 2;
13430 printf("%d\n",i);
13431}
13432EOCP
13433 set try
13434 if eval $compile_ok; then
13435 dflt=`try`
13436 else
13437 dflt='?'
13438 echo "(I can't seem to compile the test program...)"
13439 fi
13440 ;;
13441 *)
13442 dflt="$randbits"
13443 ;;
13444 esac
13445 rp="How many bits does your $randfunc() function produce?"
13446 . ./myread
13447 randbits="$ans"
13448 $rm -f try.c try
13449 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13450 seedfunc="s$randfunc"
13451 randseedtype=unsigned
13452 ;;
13453 *)
13454 dflt="31"
13455 rp="How many bits does your $randfunc() function produce?"
13456 . ./myread
13457 randbits="$ans"
13458 seedfunc="s$randfunc"
13459 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13460 if set $seedfunc val -f; eval $csym; $val; then
13461 echo "(Using $seedfunc() to seed random generator)"
13462 else
13463 echo "(Warning: no $seedfunc() to seed random generator)"
13464 seedfunc=rand
13465 fi
13466 randseedtype=unsigned
13467 ;;
13468 esac
13469 ;;
13470 esac
13471done
13472
13473echo " "
13474echo "Determining whether or not we are on an EBCDIC system..." >&4
13475$cat >tebcdic.c <<'EOM'
13476int main()
13477{
13478 if ('M'==0xd4) return 0;
13479 return 1;
13480}
13481EOM
13482
13483val=$undef
13484set tebcdic
13485if eval $compile_ok; then
13486 if ./tebcdic; then
13487 echo "You seem to speak EBCDIC." >&4
13488 val="$define"
13489 else
13490 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13491 fi
13492else
13493 echo "I'm unable to compile the test program." >&4
13494 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13495fi
13496$rm -f tebcdic.c tebcdic
13497set ebcdic
13498eval $setvar
13499
13500echo " "
13501$cat >&4 <<EOM
13502Checking how to flush all pending stdio output...
13503EOM
13504# I only know how to find the first 32 possibly open files on SunOS.
13505# See also hints/sunos_4_1.sh and util.c --AD
13506case "$osname" in
13507sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13508esac
13509$cat >>try.c <<EOCP
13510#include <stdio.h>
13511#$i_unistd I_UNISTD
13512#ifdef I_UNISTD
13513# include <unistd.h>
13514#endif
13515#$d_sysconf HAS_SYSCONF
13516#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13517#ifdef HAS_STDIO_STREAM_ARRAY
13518# define STDIO_STREAM_ARRAY $stdio_stream_array
13519#endif
13520int main() {
13521 FILE* p = fopen("try.out", "w");
13522#ifdef TRY_FPUTC
13523 fputc('x', p);
13524#else
13525# ifdef TRY_FPRINTF
13526 fprintf(p, "x");
13527# endif
13528#endif
13529#ifdef TRY_FFLUSH_NULL
13530 fflush(NULL);
13531#endif
13532#ifdef TRY_FFLUSH_ALL
13533 {
13534 long open_max = -1;
13535# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13536 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13537# else
13538# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13539 open_max = sysconf(_SC_OPEN_MAX);
13540# else
13541# ifdef FOPEN_MAX
13542 open_max = FOPEN_MAX;
13543# else
13544# ifdef OPEN_MAX
13545 open_max = OPEN_MAX;
13546# else
13547# ifdef _NFILE
13548 open_max = _NFILE;
13549# endif
13550# endif
13551# endif
13552# endif
13553# endif
13554# ifdef HAS_STDIO_STREAM_ARRAY
13555 if (open_max > 0) {
13556 long i;
13557 for (i = 0; i < open_max; i++)
13558 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13559 STDIO_STREAM_ARRAY[i]._file < open_max &&
13560 STDIO_STREAM_ARRAY[i]._flag)
13561 fflush(&STDIO_STREAM_ARRAY[i]);
13562 }
13563 }
13564# endif
13565#endif
13566 _exit(42);
13567}
13568EOCP
13569: first we have to find out how _not_ to flush
13570if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13571 output=''
13572 set try -DTRY_FPUTC
13573 if eval $compile; then
13574 $rm -f try.out
13575 ./try$exe_ext 2>/dev/null
13576 if $test ! -s try.out -a "X$?" = X42; then
13577 output=-DTRY_FPUTC
13578 fi
13579 fi
13580 case "$output" in
13581 '')
13582 set try -DTRY_FPRINTF
13583 $rm -f try.out
13584 if eval $compile; then
13585 $rm -f try.out
13586 ./try$exe_ext 2>/dev/null
13587 if $test ! -s try.out -a "X$?" = X42; then
13588 output=-DTRY_FPRINTF
13589 fi
13590 fi
13591 ;;
13592 esac
13593fi
13594: check for fflush NULL behaviour
13595case "$fflushNULL" in
13596'') set try -DTRY_FFLUSH_NULL $output
13597 if eval $compile; then
13598 $rm -f try.out
13599 ./try$exe_ext 2>/dev/null
13600 code="$?"
13601 if $test -s try.out -a "X$code" = X42; then
13602 fflushNULL="`$cat try.out`"
13603 else
13604 if $test "X$code" != X42; then
13605 $cat >&4 <<EOM
13606(If this test failed, don't worry, we'll try another method shortly.)
13607EOM
13608 fi
13609 fi
13610 fi
13611 $rm -f core try.core core.try.*
13612 case "$fflushNULL" in
13613 x) $cat >&4 <<EOM
13614Your fflush(NULL) works okay for output streams.
13615Let's see if it clobbers input pipes...
13616EOM
13617# As of mid-March 2000 all versions of Solaris appear to have a stdio
13618# bug that improperly flushes the input end of pipes. So we avoid the
13619# autoflush on fork/system/exec support for now. :-(
13620$cat >tryp.c <<EOCP
13621#include <stdio.h>
13622int
13623main(int argc, char **argv)
13624{
13625 char buf[1024];
13626 int i;
13627 char *bp = buf;
13628 while (1) {
13629 while ((i = getc(stdin)) != -1
13630 && (*bp++ = i) != '\n'
13631 && bp < &buf[1024])
13632 /* DO NOTHING */ ;
13633 *bp = '\0';
13634 fprintf(stdout, "%s", buf);
13635 fflush(NULL);
13636 if (i == -1)
13637 return 0;
13638 bp = buf;
13639 }
13640}
13641EOCP
13642 fflushNULL="$define"
13643 set tryp
13644 if eval $compile; then
13645 $rm -f tryp.out
13646 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13647 if cmp tryp.c tryp.out >/dev/null 2>&1; then
13648 $cat >&4 <<EOM
13649fflush(NULL) seems to behave okay with input streams.
13650EOM
13651 fflushNULL="$define"
13652 else
13653 $cat >&4 <<EOM
13654Ouch, fflush(NULL) clobbers input pipes! We will not use it.
13655EOM
13656 fflushNULL="$undef"
13657 fi
13658 fi
13659 $rm -f core tryp.c tryp.core core.tryp.*
13660 ;;
13661 '') $cat >&4 <<EOM
13662Your fflush(NULL) isn't working (contrary to ANSI C).
13663EOM
13664 fflushNULL="$undef"
13665 ;;
13666 *) $cat >&4 <<EOM
13667Cannot figure out whether your fflush(NULL) works or not.
13668I'm assuming it doesn't (contrary to ANSI C).
13669EOM
13670 fflushNULL="$undef"
13671 ;;
13672 esac
13673 ;;
13674$define|true|[yY]*)
13675 fflushNULL="$define"
13676 ;;
13677*)
13678 fflushNULL="$undef"
13679 ;;
13680esac
13681: check explicit looping only if NULL did not work, and if the pipe
13682: bug does not show up on an explicit flush too
13683case "$fflushNULL" in
13684"$undef")
13685 $cat >tryp.c <<EOCP
13686#include <stdio.h>
13687int
13688main(int argc, char **argv)
13689{
13690 char buf[1024];
13691 int i;
13692 char *bp = buf;
13693 while (1) {
13694 while ((i = getc(stdin)) != -1
13695 && (*bp++ = i) != '\n'
13696 && bp < &buf[1024])
13697 /* DO NOTHING */ ;
13698 *bp = '\0';
13699 fprintf(stdout, "%s", buf);
13700 fflush(stdin);
13701 if (i == -1)
13702 return 0;
13703 bp = buf;
13704 }
13705}
13706EOCP
13707 set tryp
13708 if eval $compile; then
13709 $rm -f tryp.out
13710 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13711 if cmp tryp.c tryp.out >/dev/null 2>&1; then
13712 $cat >&4 <<EOM
13713Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13714EOM
13715 : now check for fflushall behaviour
13716 case "$fflushall" in
13717 '') set try -DTRY_FFLUSH_ALL $output
13718 if eval $compile; then
13719 $cat >&4 <<EOM
13720(Now testing the other method--but note that this also may fail.)
13721EOM
13722 $rm -f try.out
13723 ./try$exe_ext 2>/dev/null
13724 if $test -s try.out -a "X$?" = X42; then
13725 fflushall="`$cat try.out`"
13726 fi
13727 fi
13728 $rm -f core try.core core.try.*
13729 case "$fflushall" in
13730 x) $cat >&4 <<EOM
13731Whew. Flushing explicitly all the stdio streams works.
13732EOM
13733 fflushall="$define"
13734 ;;
13735 '') $cat >&4 <<EOM
13736Sigh. Flushing explicitly all the stdio streams doesn't work.
13737EOM
13738 fflushall="$undef"
13739 ;;
13740 *) $cat >&4 <<EOM
13741Cannot figure out whether flushing stdio streams explicitly works or not.
13742I'm assuming it doesn't.
13743EOM
13744 fflushall="$undef"
13745 ;;
13746 esac
13747 ;;
13748 "$define"|true|[yY]*)
13749 fflushall="$define"
13750 ;;
13751 *)
13752 fflushall="$undef"
13753 ;;
13754 esac
13755 else
13756 $cat >&4 <<EOM
13757All is futile. Even fflush(stdin) clobbers input pipes!
13758EOM
13759 fflushall="$undef"
13760 fi
13761 else
13762 fflushall="$undef"
13763 fi
13764 $rm -f core tryp.c tryp.core core.tryp.*
13765 ;;
13766*) fflushall="$undef"
13767 ;;
13768esac
13769
13770case "$fflushNULL$fflushall" in
13771undefundef)
13772 $cat <<EOM
13773OK, I give up. I cannot figure out how to flush pending stdio output.
13774We won't be flushing handles at all before fork/exec/popen.
13775EOM
13776 ;;
13777esac
13778$rm -f try.* try$exe_ext
13779
13780: Store the full pathname to the ar program for use in the C program
13781: Respect a hint or command line value for full_ar.
13782case "$full_ar" in
13783'') full_ar=$ar ;;
13784esac
13785
13786: Store the full pathname to the sed program for use in the C program
13787full_sed=$sed
13788
13789: see what type gids are declared as in the kernel
13790echo " "
13791echo "Looking for the type for group ids returned by getgid()."
13792set gid_t gidtype xxx stdio.h sys/types.h
13793eval $typedef
13794case "$gidtype" in
13795xxx)
13796 xxx=`./findhdr sys/user.h`
13797 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13798 case $1 in
13799 unsigned) dflt="$1 $2" ;;
13800 *) dflt="$1" ;;
13801 esac
13802 ;;
13803*) dflt="$gidtype";;
13804esac
13805case "$gidtype" in
13806gid_t) echo "gid_t found." ;;
13807*) rp="What is the type for group ids returned by getgid()?"
13808 . ./myread
13809 gidtype="$ans"
13810 ;;
13811esac
13812
13813echo " "
13814case "$gidtype" in
13815*_t) zzz="$gidtype" ;;
13816*) zzz="gid" ;;
13817esac
13818echo "Checking the size of $zzz..." >&4
13819cat > try.c <<EOCP
13820#include <sys/types.h>
13821#include <stdio.h>
13822int main() {
13823 printf("%d\n", (int)sizeof($gidtype));
13824 exit(0);
13825}
13826EOCP
13827set try
13828if eval $compile_ok; then
13829 yyy=`./try`
13830 case "$yyy" in
13831 '') gidsize=4
13832 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13833 ;;
13834 *) gidsize=$yyy
13835 echo "Your $zzz is $gidsize bytes long."
13836 ;;
13837 esac
13838else
13839 gidsize=4
13840 echo "(I can't compile the test program--guessing $gidsize.)" >&4
13841fi
13842
13843
13844echo " "
13845case "$gidtype" in
13846*_t) zzz="$gidtype" ;;
13847*) zzz="gid" ;;
13848esac
13849echo "Checking the sign of $zzz..." >&4
13850cat > try.c <<EOCP
13851#include <sys/types.h>
13852#include <stdio.h>
13853int main() {
13854 $gidtype foo = -1;
13855 if (foo < 0)
13856 printf("-1\n");
13857 else
13858 printf("1\n");
13859}
13860EOCP
13861set try
13862if eval $compile; then
13863 yyy=`./try`
13864 case "$yyy" in
13865 '') gidsign=1
13866 echo "(I can't execute the test program--guessing unsigned.)" >&4
13867 ;;
13868 *) gidsign=$yyy
13869 case "$gidsign" in
13870 1) echo "Your $zzz is unsigned." ;;
13871 -1) echo "Your $zzz is signed." ;;
13872 esac
13873 ;;
13874 esac
13875else
13876 gidsign=1
13877 echo "(I can't compile the test program--guessing unsigned.)" >&4
13878fi
13879
13880
13881echo " "
13882
13883if $test X"$quadtype" != X; then
13884
13885echo "Checking how to print 64-bit integers..." >&4
13886
13887if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13888 $cat >try.c <<'EOCP'
13889#include <sys/types.h>
13890#include <stdio.h>
13891int main() {
13892 int q = 12345678901;
13893 printf("%ld\n", q);
13894}
13895EOCP
13896 set try
13897 if eval $compile; then
13898 yyy=`./try$exe_ext`
13899 case "$yyy" in
13900 12345678901)
13901 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13902 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13903 echo "We will use %d."
13904 ;;
13905 esac
13906 fi
13907fi
13908
13909if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13910 $cat >try.c <<'EOCP'
13911#include <sys/types.h>
13912#include <stdio.h>
13913int main() {
13914 long q = 12345678901;
13915 printf("%ld\n", q);
13916}
13917EOCP
13918 set try
13919 if eval $compile; then
13920 yyy=`./try$exe_ext`
13921 case "$yyy" in
13922 12345678901)
13923 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13924 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13925 echo "We will use %ld."
13926 ;;
13927 esac
13928 fi
13929fi
13930
13931if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13932 $cat >try.c <<'EOCP'
13933#include <sys/types.h>
13934#include <inttypes.h>
13935#include <stdio.h>
13936int main() {
13937 int64_t q = 12345678901;
13938 printf("%" PRId64 "\n", q);
13939}
13940EOCP
13941 set try
13942 if eval $compile; then
13943 yyy=`./try$exe_ext`
13944 case "$yyy" in
13945 12345678901)
13946 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13947 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13948 echo "We will use the C9X style."
13949 ;;
13950 esac
13951 fi
13952fi
13953
2ef53570
JH
13954if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13955 $cat >try.c <<EOCP
b4eb6b3d
JH
13956#include <sys/types.h>
13957#include <stdio.h>
13958int main() {
2ef53570
JH
13959 $quadtype q = 12345678901;
13960 printf("%Ld\n", q);
b4eb6b3d
JH
13961}
13962EOCP
13963 set try
13964 if eval $compile; then
13965 yyy=`./try$exe_ext`
13966 case "$yyy" in
13967 12345678901)
2ef53570
JH
13968 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13969 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13970 echo "We will use %Ld."
b4eb6b3d
JH
13971 ;;
13972 esac
13973 fi
13974fi
13975
2ef53570
JH
13976if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13977 $cat >try.c <<'EOCP'
b4eb6b3d
JH
13978#include <sys/types.h>
13979#include <stdio.h>
13980int main() {
2ef53570
JH
13981 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13982 printf("%lld\n", q);
b4eb6b3d
JH
13983}
13984EOCP
13985 set try
13986 if eval $compile; then
13987 yyy=`./try$exe_ext`
13988 case "$yyy" in
13989 12345678901)
2ef53570
JH
13990 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13991 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13992 echo "We will use the %lld style."
b4eb6b3d
JH
13993 ;;
13994 esac
13995 fi
13996fi
13997
13998if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13999 $cat >try.c <<EOCP
14000#include <sys/types.h>
14001#include <stdio.h>
14002int main() {
14003 $quadtype q = 12345678901;
14004 printf("%qd\n", q);
14005}
14006EOCP
14007 set try
14008 if eval $compile; then
14009 yyy=`./try$exe_ext`
14010 case "$yyy" in
14011 12345678901)
14012 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
14013 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
14014 echo "We will use %qd."
14015 ;;
14016 esac
14017 fi
14018fi
14019
14020if $test X"$sPRId64" = X; then
14021 echo "Cannot figure out how to print 64-bit integers." >&4
14022fi
14023
14024$rm -f try try.*
14025
14026fi
14027
14028case "$sPRId64" in
14029'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
14030 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
14031 ;;
14032*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
14033 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
14034 ;;
14035esac
14036
14037
14038echo " "
14039$echo "Checking the format strings to be used for Perl's internal types..." >&4
14040
14041if $test X"$ivsize" = X8; then
14042 ivdformat="$sPRId64"
14043 uvuformat="$sPRIu64"
14044 uvoformat="$sPRIo64"
14045 uvxformat="$sPRIx64"
14046 uvXUformat="$sPRIXU64"
14047else
14048 if $test X"$ivsize" = X"$longsize"; then
14049 ivdformat='"ld"'
14050 uvuformat='"lu"'
14051 uvoformat='"lo"'
14052 uvxformat='"lx"'
14053 uvXUformat='"lX"'
14054 else
14055 if $test X"$ivsize" = X"$intsize"; then
14056 ivdformat='"d"'
14057 uvuformat='"u"'
14058 uvoformat='"o"'
14059 uvxformat='"x"'
14060 uvXUformat='"X"'
14061 else
14062 : far out
14063 if $test X"$ivsize" = X"$shortsize"; then
14064 ivdformat='"hd"'
14065 uvuformat='"hu"'
14066 uvoformat='"ho"'
14067 uvxformat='"hx"'
14068 uvXUformat='"hX"'
14069 fi
14070 fi
14071 fi
14072fi
14073
14074if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
14075 nveformat="$sPRIeldbl"
14076 nvfformat="$sPRIfldbl"
14077 nvgformat="$sPRIgldbl"
14078 nvEUformat="$sPRIEUldbl"
14079 nvFUformat="$sPRIFUldbl"
14080 nvGUformat="$sPRIGUldbl"
14081else
14082 nveformat='"e"'
14083 nvfformat='"f"'
14084 nvgformat='"g"'
14085 nvEUformat='"E"'
14086 nvFUformat='"F"'
14087 nvGUformat='"G"'
14088fi
14089
14090case "$ivdformat" in
14091'') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
14092 exit 1
14093 ;;
14094esac
14095
14096
14097echo " "
14098$echo "Checking the format string to be used for gids..." >&4
14099
14100case "$gidsign" in
14101-1) if $test X"$gidsize" = X"$ivsize"; then
14102 gidformat="$ivdformat"
14103 else
14104 if $test X"$gidsize" = X"$longsize"; then
14105 gidformat='"ld"'
14106 else
14107 if $test X"$gidsize" = X"$intsize"; then
14108 gidformat='"d"'
14109 else
14110 if $test X"$gidsize" = X"$shortsize"; then
14111 gidformat='"hd"'
14112 fi
14113 fi
14114 fi
14115 fi
14116 ;;
14117*) if $test X"$gidsize" = X"$uvsize"; then
14118 gidformat="$uvuformat"
14119 else
14120 if $test X"$gidsize" = X"$longsize"; then
14121 gidformat='"lu"'
14122 else
14123 if $test X"$gidsize" = X"$intsize"; then
14124 gidformat='"u"'
14125 else
14126 if $test X"$gidsize" = X"$shortsize"; then
14127 gidformat='"hu"'
14128 fi
14129 fi
14130 fi
14131 fi
14132 ;;
14133esac
14134
14135: see if getgroups exists
14136set getgroups d_getgrps
14137eval $inlibc
14138
14139: see if setgroups exists
14140set setgroups d_setgrps
14141eval $inlibc
14142
14143
14144: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
14145echo " "
14146case "$d_getgrps$d_setgrps" in
14147*define*)
14148 case "$groupstype" in
14149 '') dflt="$gidtype" ;;
14150 *) dflt="$groupstype" ;;
14151 esac
14152 $cat <<EOM
14153What type of pointer is the second argument to getgroups() and setgroups()?
14154Usually this is the same as group ids, $gidtype, but not always.
14155
14156EOM
14157 rp='What type pointer is the second argument to getgroups() and setgroups()?'
14158 . ./myread
14159 groupstype="$ans"
14160 ;;
14161*) groupstype="$gidtype";;
14162esac
14163
14164echo " "
14165echo "Checking if your $make program sets \$(MAKE)..." >&4
14166case "$make_set_make" in
14167'')
14168 $sed 's/^X //' > testmake.mak << 'EOF'
14169Xall:
14170X @echo 'maketemp="$(MAKE)"'
14171EOF
14172 case "`$make -f testmake.mak 2>/dev/null`" in
14173 *maketemp=*) make_set_make='#' ;;
14174 *) make_set_make="MAKE=$make" ;;
14175 esac
14176 $rm -f testmake.mak
14177 ;;
14178esac
14179case "$make_set_make" in
14180'#') echo "Yup, it does.";;
14181*) echo "Nope, it doesn't.";;
14182esac
14183
14184: see what type is used for mode_t
14185rp="What is the type used for file modes for system calls (e.g. fchmod())?"
14186set mode_t modetype int stdio.h sys/types.h
14187eval $typedef_ask
14188
2cc61e15
DD
14189: see if stdarg is available
14190echo " "
14191if $test `./findhdr stdarg.h`; then
14192 echo "<stdarg.h> found." >&4
14193 valstd="$define"
14194else
14195 echo "<stdarg.h> NOT found." >&4
14196 valstd="$undef"
14197fi
14198
14199: see if varags is available
14200echo " "
14201if $test `./findhdr varargs.h`; then
14202 echo "<varargs.h> found." >&4
14203else
14204 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14205fi
14206
14207: set up the varargs testing programs
14208$cat > varargs.c <<EOP
14209#ifdef I_STDARG
14210#include <stdarg.h>
14211#endif
14212#ifdef I_VARARGS
14213#include <varargs.h>
14214#endif
14215
14216#ifdef I_STDARG
14217int f(char *p, ...)
14218#else
14219int f(va_alist)
14220va_dcl
14221#endif
14222{
14223 va_list ap;
14224#ifndef I_STDARG
14225 char *p;
14226#endif
14227#ifdef I_STDARG
14228 va_start(ap,p);
14229#else
14230 va_start(ap);
14231 p = va_arg(ap, char *);
14232#endif
14233 va_end(ap);
14234}
14235EOP
14236$cat > varargs <<EOP
14237$startsh
14238if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14239 echo "true"
14240else
14241 echo "false"
14242fi
14243$rm -f varargs$_o
14244EOP
14245chmod +x varargs
14246
14247: now check which varargs header should be included
14248echo " "
14249i_varhdr=''
14250case "$valstd" in
14251"$define")
14252 if `./varargs I_STDARG`; then
14253 val='stdarg.h'
14254 elif `./varargs I_VARARGS`; then
14255 val='varargs.h'
14256 fi
14257 ;;
14258*)
14259 if `./varargs I_VARARGS`; then
14260 val='varargs.h'
14261 fi
14262 ;;
14263esac
14264case "$val" in
14265'')
14266echo "I could not find the definition for va_dcl... You have problems..." >&4
14267 val="$undef"; set i_stdarg; eval $setvar
14268 val="$undef"; set i_varargs; eval $setvar
14269 ;;
14270*)
14271 set i_varhdr
14272 eval $setvar
14273 case "$i_varhdr" in
14274 stdarg.h)
14275 val="$define"; set i_stdarg; eval $setvar
14276 val="$undef"; set i_varargs; eval $setvar
14277 ;;
14278 varargs.h)
14279 val="$undef"; set i_stdarg; eval $setvar
14280 val="$define"; set i_varargs; eval $setvar
14281 ;;
14282 esac
14283 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14284esac
14285$rm -f varargs*
14286
14287: see if we need va_copy
14288echo " "
14289case "$i_stdarg" in
14290"$define")
14291 $cat >try.c <<EOCP
14292#include <stdarg.h>
14293#include <stdio.h>
85c8a686
DD
14294#$i_stdlib I_STDLIB
14295#ifdef I_STDLIB
14296#include <stdlib.h>
14297#endif
14298#include <signal.h>
2cc61e15
DD
14299
14300int
14301ivfprintf(FILE *f, const char *fmt, va_list *valp)
14302{
14303 return vfprintf(f, fmt, *valp);
14304}
14305
14306int
14307myvfprintf(FILE *f, const char *fmt, va_list val)
14308{
14309 return ivfprintf(f, fmt, &val);
14310}
14311
14312int
14313myprintf(char *fmt, ...)
14314{
14315 va_list val;
14316 va_start(val, fmt);
14317 return myvfprintf(stdout, fmt, val);
14318}
14319
14320int
14321main(int ac, char **av)
14322{
85c8a686
DD
14323 signal(SIGSEGV, exit);
14324
2cc61e15
DD
14325 myprintf("%s%cs all right, then\n", "that", '\'');
14326 exit(0);
14327}
14328EOCP
14329 set try
d50de4df 14330 if eval $compile && ./try 2>&1 >/dev/null; then
2cc61e15
DD
14331 case "`./try`" in
14332 "that's all right, then")
14333 okay=yes
14334 ;;
14335 esac
14336 fi
14337 case "$okay" in
14338 yes) echo "It seems that you don't need va_copy()." >&4
14339 need_va_copy="$undef"
14340 ;;
14341 *) echo "It seems that va_copy() or similar will be needed." >&4
14342 need_va_copy="$define"
14343 ;;
14344 esac
14345 $rm -f try.* core core.* *.core *.core.*
14346 ;;
14347*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14348 ;;
14349esac
14350
b4eb6b3d
JH
14351: define a fucntion to check prototypes
14352$cat > protochk <<EOSH
14353$startsh
14354cc="$cc"
14355optimize="$optimize"
14356ccflags="$ccflags"
14357prototype="$prototype"
14358define="$define"
14359rm=$rm
14360EOSH
14361
14362$cat >> protochk <<'EOSH'
14363
14364$rm -f try.c
14365foo="$1"
14366shift
14367while test $# -ge 2; do
14368 case "$1" in
14369 $define) echo "#include <$2>" >> try.c ;;
14370 literal) echo "$2" >> try.c ;;
14371 esac
14372 shift 2
14373done
14374test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
14375cat >> try.c <<'EOCP'
14376#ifdef CAN_PROTOTYPE
14377#define _(args) args
14378#else
14379#define _(args) ()
14380#endif
14381EOCP
14382echo "$foo" >> try.c
14383echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14384$cc $optimize $ccflags -c try.c > /dev/null 2>&1
14385status=$?
14386$rm -f try.[co]
14387exit $status
14388EOSH
14389chmod +x protochk
14390$eunicefix protochk
14391
14392: see what type is used for size_t
14393rp="What is the type used for the length parameter for string functions?"
14394set size_t sizetype 'unsigned int' stdio.h sys/types.h
14395eval $typedef_ask
14396
14397: check for type of arguments to gethostbyaddr.
14398if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14399 case "$d_gethbyaddr" in
14400 $define)
14401 $cat <<EOM
14402
14403Checking to see what type of arguments are accepted by gethostbyaddr().
14404EOM
14405 hdrs="$define sys/types.h
14406 $d_socket sys/socket.h
14407 $i_niin netinet/in.h
14408 $i_netdb netdb.h
14409 $i_unistd unistd.h"
14410 : The first arg can 'char *' or 'void *'
14411 : The second arg is some of integral type
14412 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14413 for yyy in size_t long int; do
14414 case "$netdb_host_type" in
14415 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14416 if ./protochk "$try" $hdrs; then
14417 echo "Your system accepts $xxx for the first arg."
14418 echo "...and $yyy for the second arg."
14419 netdb_host_type="$xxx"
14420 netdb_hlen_type="$yyy"
14421 fi
14422 ;;
14423 esac
14424 done
14425 done
14426 : In case none of those worked, prompt the user.
14427 case "$netdb_host_type" in
14428 '') rp='What is the type for the 1st argument to gethostbyaddr?'
14429 dflt='char *'
14430 . ./myread
14431 netdb_host_type=$ans
14432 rp='What is the type for the 2nd argument to gethostbyaddr?'
14433 dflt="$sizetype"
14434 . ./myread
14435 netdb_hlen_type=$ans
14436 ;;
14437 esac
14438 ;;
14439 *) : no gethostbyaddr, so pick harmless defaults
14440 netdb_host_type='char *'
14441 netdb_hlen_type="$sizetype"
14442 ;;
14443 esac
14444 # Remove the "const" if needed. -- but then we'll have a
14445 # prototype clash!
14446 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14447fi
14448
14449: check for type of argument to gethostbyname.
14450if test "X$netdb_name_type" = X ; then
14451 case "$d_gethbyname" in
14452 $define)
14453 $cat <<EOM
14454
14455Checking to see what type of argument is accepted by gethostbyname().
14456EOM
14457 hdrs="$define sys/types.h
14458 $d_socket sys/socket.h
14459 $i_niin netinet/in.h
14460 $i_netdb netdb.h
14461 $i_unistd unistd.h"
14462 for xxx in "const char *" "char *"; do
14463 case "$netdb_name_type" in
14464 '') try="extern struct hostent *gethostbyname($xxx);"
14465 if ./protochk "$try" $hdrs; then
14466 echo "Your system accepts $xxx."
14467 netdb_name_type="$xxx"
14468 fi
14469 ;;
14470 esac
14471 done
14472 : In case none of those worked, prompt the user.
14473 case "$netdb_name_type" in
14474 '') rp='What is the type for the 1st argument to gethostbyname?'
14475 dflt='char *'
14476 . ./myread
14477 netdb_name_type=$ans
14478 ;;
14479 esac
14480 ;;
14481 *) : no gethostbyname, so pick harmless default
14482 netdb_name_type='char *'
14483 ;;
14484 esac
14485fi
14486
14487: check for type of 1st argument to getnetbyaddr.
14488if test "X$netdb_net_type" = X ; then
14489 case "$d_getnbyaddr" in
14490 $define)
14491 $cat <<EOM
14492
14493Checking to see what type of 1st argument is accepted by getnetbyaddr().
14494EOM
14495 hdrs="$define sys/types.h
14496 $d_socket sys/socket.h
14497 $i_niin netinet/in.h
14498 $i_netdb netdb.h
14499 $i_unistd unistd.h"
14500 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14501 case "$netdb_net_type" in
14502 '') try="extern struct netent *getnetbyaddr($xxx, int);"
14503 if ./protochk "$try" $hdrs; then
14504 echo "Your system accepts $xxx."
14505 netdb_net_type="$xxx"
14506 fi
14507 ;;
14508 esac
14509 done
14510 : In case none of those worked, prompt the user.
14511 case "$netdb_net_type" in
14512 '') rp='What is the type for the 1st argument to getnetbyaddr?'
14513 dflt='long'
14514 . ./myread
14515 netdb_net_type=$ans
14516 ;;
14517 esac
14518 ;;
14519 *) : no getnetbyaddr, so pick harmless default
14520 netdb_net_type='long'
14521 ;;
14522 esac
14523fi
14524: locate the preferred pager for this system
14525case "$pager" in
14526'')
14527 dflt=''
14528 case "$pg" in
14529 /*) dflt=$pg;;
14530 [a-zA-Z]:/*) dflt=$pg;;
14531 esac
14532 case "$more" in
14533 /*) dflt=$more;;
14534 [a-zA-Z]:/*) dflt=$more;;
14535 esac
14536 case "$less" in
14537 /*) dflt=$less;;
14538 [a-zA-Z]:/*) dflt=$less;;
14539 esac
14540 case "$dflt" in
14541 '') dflt=/usr/ucb/more;;
14542 esac
14543 ;;
14544*) dflt="$pager";;
14545esac
14546echo " "
14547fn=f/
14548rp='What pager is used on your system?'
14549. ./getfile
14550pager="$ans"
14551
14552: see what type pids are declared as in the kernel
14553rp="What is the type of process ids on this system?"
14554set pid_t pidtype int stdio.h sys/types.h
14555eval $typedef_ask
14556
14557: Find earliest binary compatible site_perl subdirectory perl can use.
14558case "$bincompat5005" in
14559"$define") xs_apiversion='5.005' ;;
14560*) xs_apiversion=$version ;; # The current site_perl version.
14561esac
14562: Find earliest pure perl site_perl subdirectory perl can use.
14563: The versioned directories started at 5.005.
14564pm_apiversion='5.005'
14565
b4eb6b3d
JH
14566: see if ar generates random libraries by itself
14567echo " "
14568echo "Checking how to generate random libraries on your machine..." >&4
14569echo 'int bar1() { return bar2(); }' > bar1.c
14570echo 'int bar2() { return 2; }' > bar2.c
14571$cat > foo.c <<'EOP'
14572int main() { printf("%d\n", bar1()); exit(0); }
14573EOP
14574$cc $ccflags -c bar1.c >/dev/null 2>&1
14575$cc $ccflags -c bar2.c >/dev/null 2>&1
14576$cc $ccflags -c foo.c >/dev/null 2>&1
14577$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 14578if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
b4eb6b3d
JH
14579 ./foobar >/dev/null 2>&1; then
14580 echo "$ar appears to generate random libraries itself."
14581 orderlib=false
14582 ranlib=":"
14583elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 14584 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
b4eb6b3d
JH
14585 ./foobar >/dev/null 2>&1; then
14586 echo "a table of contents needs to be added with '$ar ts'."
14587 orderlib=false
14588 ranlib="$ar ts"
14589else
14590 case "$ranlib" in
14591 :) ranlib='';;
14592 '')
14593 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14594 $test -f $ranlib || ranlib=''
14595 ;;
14596 esac
14597 if $test -n "$ranlib"; then
14598 echo "your system has '$ranlib'; we'll use that."
14599 orderlib=false
14600 else
14601 echo "your system doesn't seem to support random libraries"
14602 echo "so we'll use lorder and tsort to order the libraries."
14603 orderlib=true
14604 ranlib=":"
14605 fi
14606fi
14607$rm -f foo* bar*
14608
14609: check for type of arguments to select.
14610case "$selecttype" in
14611'') case "$d_select" in
14612 $define)
14613 echo " "
14614 $cat <<EOM
14615Checking to see what type of arguments are accepted by select().
14616EOM
14617 hdrs="$define sys/types.h
14618 $i_systime sys/time.h
14619 $i_sysselct sys/select.h
14620 $d_socket sys/socket.h"
14621 : The first arg can be int, unsigned, or size_t
14622 : The last arg may or may not be 'const'
14623 val=''
14624 : void pointer has been seen but using that
14625 : breaks the selectminbits test
14626 for xxx in 'fd_set *' 'int *'; do
14627 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14628 for tmo in 'struct timeval *' 'const struct timeval *'; do
14629 case "$val" in
14630 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14631 if ./protochk "$try" $hdrs; then
14632 echo "Your system accepts $xxx."
14633 val="$xxx"
14634 fi
14635 ;;
14636 esac
14637 done
14638 done
14639 done
14640 case "$val" in
14641 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14642 case "$d_fd_set" in
14643 $define) dflt="fd_set *" ;;
14644 *) dflt="int *" ;;
14645 esac
14646 . ./myread
14647 val=$ans
14648 ;;
14649 esac
14650 selecttype="$val"
14651 ;;
14652 *) : no select, so pick a harmless default
14653 selecttype='int *'
14654 ;;
14655 esac
14656 ;;
14657esac
14658
14659: check for the select 'width'
14660case "$selectminbits" in
14661'') case "$d_select" in
14662 $define)
14663 $cat <<EOM
14664
14665Checking to see on how many bits at a time your select() operates...
14666EOM
14667 $cat >try.c <<EOCP
14668#include <sys/types.h>
14669#$i_time I_TIME
14670#$i_systime I_SYS_TIME
14671#$i_systimek I_SYS_TIME_KERNEL
14672#ifdef I_TIME
14673# include <time.h>
14674#endif
14675#ifdef I_SYS_TIME
14676# ifdef I_SYS_TIME_KERNEL
14677# define KERNEL
14678# endif
14679# include <sys/time.h>
14680# ifdef I_SYS_TIME_KERNEL
14681# undef KERNEL
14682# endif
14683#endif
14684#$i_sysselct I_SYS_SELECT
14685#ifdef I_SYS_SELECT
14686#include <sys/select.h>
14687#endif
14688#$d_socket HAS_SOCKET
14689#ifdef HAS_SOCKET
14690# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14691#endif
14692#include <stdio.h>
14693$selecttype b;
14694#define S sizeof(*(b))
14695#define MINBITS 64
14696#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14697#define NBITS (NBYTES * 8)
14698int main() {
14699 char s[NBYTES];
14700 struct timeval t;
14701 int i;
14702 FILE* fp;
14703 int fd;
14704
14705 fclose(stdin);
14706 fp = fopen("try.c", "r");
14707 if (fp == 0)
14708 exit(1);
14709 fd = fileno(fp);
14710 if (fd < 0)
14711 exit(2);
14712 b = ($selecttype)s;
14713 for (i = 0; i < NBITS; i++)
14714 FD_SET(i, b);
14715 t.tv_sec = 0;
14716 t.tv_usec = 0;
14717 select(fd + 1, b, 0, 0, &t);
14718 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14719 printf("%d\n", i + 1);
14720 return 0;
14721}
14722EOCP
14723 set try
14724 if eval $compile_ok; then
14725 selectminbits=`./try`
14726 case "$selectminbits" in
14727 '') cat >&4 <<EOM
14728Cannot figure out on how many bits at a time your select() operates.
14729I'll play safe and guess it is 32 bits.
14730EOM
14731 selectminbits=32
14732 bits="32 bits"
14733 ;;
14734 1) bits="1 bit" ;;
14735 *) bits="$selectminbits bits" ;;
14736 esac
14737 echo "Your select() operates on $bits at a time." >&4
14738 else
14739 rp='What is the minimum number of bits your select() operates on?'
14740 case "$byteorder" in
14741 1234|12345678) dflt=32 ;;
14742 *) dflt=1 ;;
14743 esac
14744 . ./myread
14745 val=$ans
14746 selectminbits="$val"
14747 fi
14748 $rm -f try.* try
14749 ;;
14750 *) : no select, so pick a harmless default
14751 selectminbits='32'
14752 ;;
14753 esac
14754 ;;
14755esac
14756
14757: Trace out the files included by signal.h, then look for SIGxxx names.
14758: Remove SIGARRAYSIZE used by HPUX.
14759: Remove SIGSTKSIZE used by Linux.
14760: Remove SIGSTKSZ used by Posix.
14761: Remove SIGTYP void lines used by OS2.
14762: Some cpps, like os390, dont give the file name anywhere
14763if [ "X$fieldn" = X ]; then
14764 : Just make some guesses. We check them later.
14765 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14766else
14767 xxx=`echo '#include <signal.h>' |
14768 $cppstdin $cppminus $cppflags 2>/dev/null |
14769 $grep '^[ ]*#.*include' |
a938a3bb 14770 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
14771fi
14772: Check this list of files to be sure we have parsed the cpp output ok.
14773: This will also avoid potentially non-existent files, such
14774: as ../foo/bar.h
14775xxxfiles=''
14776for xx in $xxx /dev/null ; do
14777 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14778done
14779: If we have found no files, at least try signal.h
14780case "$xxxfiles" in
14781'') xxxfiles=`./findhdr signal.h` ;;
14782esac
14783xxx=`awk '
14784$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14785 print substr($2, 4, 20)
14786}
14787$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14788 print substr($3, 4, 20)
14789}' $xxxfiles`
14790: Append some common names just in case the awk scan failed.
14791xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14792xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14793xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14794xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14795xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14796
14797: generate a few handy files for later
14798$cat > signal.c <<'EOCP'
14799#include <sys/types.h>
14800#include <signal.h>
14801#include <stdio.h>
14802int main() {
14803
14804/* Strange style to avoid deeply-nested #if/#else/#endif */
14805#ifndef NSIG
14806# ifdef _NSIG
14807# define NSIG (_NSIG)
14808# endif
14809#endif
14810
14811#ifndef NSIG
14812# ifdef SIGMAX
14813# define NSIG (SIGMAX+1)
14814# endif
14815#endif
14816
14817#ifndef NSIG
14818# ifdef SIG_MAX
14819# define NSIG (SIG_MAX+1)
14820# endif
14821#endif
14822
14823#ifndef NSIG
14824# ifdef MAXSIG
14825# define NSIG (MAXSIG+1)
14826# endif
14827#endif
14828
14829#ifndef NSIG
14830# ifdef MAX_SIG
14831# define NSIG (MAX_SIG+1)
14832# endif
14833#endif
14834
14835#ifndef NSIG
14836# ifdef SIGARRAYSIZE
14837# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14838# endif
14839#endif
14840
14841#ifndef NSIG
14842# ifdef _sys_nsig
14843# define NSIG (_sys_nsig) /* Solaris 2.5 */
14844# endif
14845#endif
14846
14847/* Default to some arbitrary number that's big enough to get most
14848 of the common signals.
14849*/
14850#ifndef NSIG
14851# define NSIG 50
14852#endif
14853
14854printf("NSIG %d\n", NSIG);
14855
14856#ifndef JUST_NSIG
14857
14858EOCP
14859
14860echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14861{
14862 printf "#ifdef SIG"; printf $1; printf "\n"
14863 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14864 printf $1; printf ");\n"
14865 printf "#endif\n"
14866}
14867END {
14868 printf "#endif /* JUST_NSIG */\n";
14869 printf "exit(0);\n}\n";
14870}
14871' >>signal.c
14872$cat >signal.awk <<'EOP'
14873BEGIN { ndups = 0 }
14874$1 ~ /^NSIG$/ { nsig = $2 }
14875($1 !~ /^NSIG$/) && (NF == 2) {
14876 if ($2 > maxsig) { maxsig = $2 }
14877 if (sig_name[$2]) {
14878 dup_name[ndups] = $1
14879 dup_num[ndups] = $2
14880 ndups++
14881 }
14882 else {
14883 sig_name[$2] = $1
14884 sig_num[$2] = $2
14885 }
14886}
14887END {
14888 if (nsig == 0) {
14889 nsig = maxsig + 1
14890 }
14891 printf("NSIG %d\n", nsig);
14892 for (n = 1; n < nsig; n++) {
14893 if (sig_name[n]) {
14894 printf("%s %d\n", sig_name[n], sig_num[n])
14895 }
14896 else {
14897 printf("NUM%d %d\n", n, n)
14898 }
14899 }
14900 for (n = 0; n < ndups; n++) {
14901 printf("%s %d\n", dup_name[n], dup_num[n])
14902 }
14903}
14904EOP
14905$cat >signal_cmd <<EOS
14906$startsh
14907if $test -s signal.lst; then
14908 echo "Using your existing signal.lst file"
14909 exit 0
14910fi
14911xxx="$xxx"
14912EOS
14913$cat >>signal_cmd <<'EOS'
14914
14915set signal
14916if eval $compile_ok; then
14917 ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14918else
14919 echo "(I can't seem be able to compile the whole test program)" >&4
14920 echo "(I'll try it in little pieces.)" >&4
14921 set signal -DJUST_NSIG
14922 if eval $compile_ok; then
14923 ./signal$_exe > signal.nsg
14924 $cat signal.nsg
14925 else
14926 echo "I can't seem to figure out how many signals you have." >&4
14927 echo "Guessing 50." >&4
14928 echo 'NSIG 50' > signal.nsg
14929 fi
14930 : Now look at all the signal names, one at a time.
14931 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14932 $cat > signal.c <<EOCP
14933#include <sys/types.h>
14934#include <signal.h>
14935#include <stdio.h>
14936int main() {
14937printf("$xx %d\n", SIG${xx});
14938return 0;
14939}
14940EOCP
14941 set signal
14942 if eval $compile; then
14943 echo "SIG${xx} found."
14944 ./signal$_exe >> signal.ls1
14945 else
14946 echo "SIG${xx} NOT found."
14947 fi
14948 done
14949 if $test -s signal.ls1; then
14950 $cat signal.nsg signal.ls1 |
14951 $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14952 fi
14953
14954fi
14955if $test -s signal.lst; then
14956 :
14957else
14958 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14959 echo 'kill -l' >signal
14960 set X `csh -f <signal`
14961 $rm -f signal
14962 shift
14963 case $# in
14964 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14965 esac
14966 echo $@ | $tr ' ' $trnl | \
14967 $awk '{ printf "%s %d\n", $1, ++s; }
14968 END { printf "NSIG %d\n", ++s }' >signal.lst
14969fi
14970$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14971EOS
14972chmod a+x signal_cmd
14973$eunicefix signal_cmd
14974
14975: generate list of signal names
14976echo " "
14977case "$sig_name_init" in
14978'') doinit=yes ;;
14979*) case "$sig_num_init" in
14980 ''|*,*) doinit=yes ;;
14981 esac ;;
14982esac
14983case "$doinit" in
14984yes)
14985 echo "Generating a list of signal names and numbers..." >&4
14986 . ./signal_cmd
14987 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14988 sig_name=`$awk 'BEGIN { printf "ZERO " }
14989 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14990 sig_num=`$awk 'BEGIN { printf "0 " }
14991 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14992 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
14993 !/^NSIG/ { printf "\"%s\", ", $1 }
14994 END { printf "0\n" }' signal.lst`
14995 sig_num_init=`$awk 'BEGIN { printf "0, " }
14996 !/^NSIG/ { printf "%d, ", $2}
14997 END { printf "0\n"}' signal.lst`
14998 ;;
14999esac
15000echo "The following $sig_count signals are available:"
15001echo " "
15002echo $sig_name | $awk \
15003'BEGIN { linelen = 0 }
15004{
15005 for (i = 1; i <= NF; i++) {
15006 name = "SIG" $i " "
15007 linelen = linelen + length(name)
15008 if (linelen > 70) {
15009 printf "\n"
15010 linelen = length(name)
15011 }
15012 printf "%s", name
15013 }
15014 printf "\n"
15015}'
76d3c696 15016sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
15017$rm -f signal signal.c signal.awk signal.lst signal_cmd
15018
15019echo " "
15020case "$sizetype" in
15021*_t) zzz="$sizetype" ;;
15022*) zzz="filesize" ;;
15023esac
15024echo "Checking the size of $zzz..." >&4
15025cat > try.c <<EOCP
15026#include <sys/types.h>
15027#include <stdio.h>
15028int main() {
15029 printf("%d\n", (int)sizeof($sizetype));
15030 exit(0);
15031}
15032EOCP
15033set try
15034if eval $compile_ok; then
15035 yyy=`./try`
15036 case "$yyy" in
15037 '') sizesize=4
15038 echo "(I can't execute the test program--guessing $sizesize.)" >&4
15039 ;;
15040 *) sizesize=$yyy
15041 echo "Your $zzz size is $sizesize bytes."
15042 ;;
15043 esac
15044else
15045 sizesize=4
15046 echo "(I can't compile the test program--guessing $sizesize.)" >&4
15047fi
15048
15049
15050: check for socklen_t
15051echo " "
15052echo "Checking to see if you have socklen_t..." >&4
15053$cat >try.c <<EOCP
15054#include <sys/types.h>
15055#$d_socket HAS_SOCKET
15056#ifdef HAS_SOCKET
15057#include <sys/socket.h>
15058#endif
15059int main() { socklen_t x = 16; }
15060EOCP
15061set try
15062if eval $compile; then
15063 val="$define"
15064 echo "You have socklen_t."
15065else
15066 val="$undef"
15067 echo "You do not have socklen_t."
15068 case "$sizetype" in
15069 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
15070 esac
15071fi
15072$rm -f try try.*
15073set d_socklen_t
15074eval $setvar
15075
a7710f8d
JH
15076: see if this is a socks.h system
15077set socks.h i_socks
15078eval $inhdr
15079
b4eb6b3d
JH
15080: check for type of the size argument to socket calls
15081case "$d_socket" in
15082"$define")
15083 $cat <<EOM
15084
15085Checking to see what type is the last argument of accept().
15086EOM
b4eb6b3d
JH
15087 yyy=''
15088 case "$d_socklen_t" in
15089 "$define") yyy="$yyy socklen_t"
15090 esac
15091 yyy="$yyy $sizetype int long unsigned"
15092 for xxx in $yyy; do
15093 case "$socksizetype" in
15094 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
15095 case "$usesocks" in
15096 "$define")
15097 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
15098 echo "Your system accepts '$xxx *' for the last argument of accept()."
15099 socksizetype="$xxx"
15100 fi
15101 ;;
15102 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
15103 echo "Your system accepts '$xxx *' for the last argument of accept()."
15104 socksizetype="$xxx"
15105 fi
15106 ;;
15107 esac
b4eb6b3d
JH
15108 ;;
15109 esac
15110 done
15111: In case none of those worked, prompt the user.
15112 case "$socksizetype" in
15113 '') rp='What is the type for socket address structure sizes?'
15114 dflt='int'
15115 . ./myread
15116 socksizetype=$ans
15117 ;;
15118 esac
15119 ;;
15120*) : no sockets, so pick relatively harmless default
15121 socksizetype='int'
15122 ;;
15123esac
15124
15125: see what type is used for signed size_t
15126set ssize_t ssizetype int stdio.h sys/types.h
15127eval $typedef
15128dflt="$ssizetype"
15129$cat > ssize.c <<EOM
15130#include <stdio.h>
15131#include <sys/types.h>
15132#define Size_t $sizetype
15133#define SSize_t $dflt
15134int main()
15135{
15136 if (sizeof(Size_t) == sizeof(SSize_t))
15137 printf("$dflt\n");
15138 else if (sizeof(Size_t) == sizeof(int))
15139 printf("int\n");
15140 else
15141 printf("long\n");
15142 exit(0);
15143}
15144EOM
15145echo " "
15146set ssize
15147if eval $compile_ok && ./ssize > /dev/null; then
15148 ssizetype=`./ssize`
15149 echo "I'll be using $ssizetype for functions returning a byte count." >&4
15150else
15151 $cat >&4 <<EOM
15152Help! I can't compile and run the ssize_t test program: please enlighten me!
15153(This is probably a misconfiguration in your system or libraries, and
15154you really ought to fix it. Still, I'll try anyway.)
15155
15156I need a type that is the same size as $sizetype, but is guaranteed to
15157be signed. Common values are ssize_t, int and long.
15158
15159EOM
15160 rp="What signed type is the same size as $sizetype?"
15161 . ./myread
15162 ssizetype="$ans"
15163fi
15164$rm -f ssize ssize.*
15165
15166: see what type of char stdio uses.
15167echo " "
aa517f50
JH
15168echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
15169if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
15170 echo "Your stdio uses unsigned chars." >&4
15171 stdchar="unsigned char"
15172else
aa517f50
JH
15173 echo "Your stdio uses signed chars." >&4
15174 stdchar="char"
b4eb6b3d 15175fi
aa517f50
JH
15176$rm -f stdioh
15177
15178
b4eb6b3d
JH
15179
15180: see if time exists
15181echo " "
15182if test "X$d_time" = X -o X"$timetype" = X; then
15183 if set time val -f d_time; eval $csym; $val; then
15184 echo 'time() found.' >&4
15185 val="$define"
15186 rp="What is the type returned by time() on this system?"
15187 set time_t timetype long stdio.h sys/types.h
15188 eval $typedef_ask
15189 else
15190 echo 'time() not found, hope that will do.' >&4
15191 val="$undef"
15192 timetype='int';
15193 fi
15194 set d_time
15195 eval $setvar
15196fi
15197
15198: see what type uids are declared as in the kernel
15199echo " "
15200echo "Looking for the type for user ids returned by getuid()."
15201set uid_t uidtype xxx stdio.h sys/types.h
15202eval $typedef
15203case "$uidtype" in
15204xxx)
15205 xxx=`./findhdr sys/user.h`
15206 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15207 case $1 in
15208 unsigned) dflt="$1 $2" ;;
15209 *) dflt="$1" ;;
15210 esac
15211 ;;
15212*) dflt="$uidtype";;
15213esac
15214case "$uidtype" in
15215uid_t) echo "uid_t found." ;;
15216*) rp="What is the type for user ids returned by getuid()?"
15217 . ./myread
15218 uidtype="$ans"
15219 ;;
15220esac
15221
15222echo " "
15223case "$uidtype" in
15224*_t) zzz="$uidtype" ;;
15225*) zzz="uid" ;;
15226esac
15227echo "Checking the size of $zzz..." >&4
15228cat > try.c <<EOCP
15229#include <sys/types.h>
15230#include <stdio.h>
15231int main() {
15232 printf("%d\n", (int)sizeof($uidtype));
15233 exit(0);
15234}
15235EOCP
15236set try
15237if eval $compile_ok; then
15238 yyy=`./try`
15239 case "$yyy" in
15240 '') uidsize=4
15241 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15242 ;;
15243 *) uidsize=$yyy
15244 echo "Your $zzz is $uidsize bytes long."
15245 ;;
15246 esac
15247else
15248 uidsize=4
15249 echo "(I can't compile the test program--guessing $uidsize.)" >&4
15250fi
15251
15252echo " "
15253case "$uidtype" in
15254*_t) zzz="$uidtype" ;;
15255*) zzz="uid" ;;
15256esac
15257echo "Checking the sign of $zzz..." >&4
15258cat > try.c <<EOCP
15259#include <sys/types.h>
15260#include <stdio.h>
15261int main() {
15262 $uidtype foo = -1;
15263 if (foo < 0)
15264 printf("-1\n");
15265 else
15266 printf("1\n");
15267}
15268EOCP
15269set try
15270if eval $compile; then
15271 yyy=`./try`
15272 case "$yyy" in
15273 '') uidsign=1
15274 echo "(I can't execute the test program--guessing unsigned.)" >&4
15275 ;;
15276 *) uidsign=$yyy
15277 case "$uidsign" in
15278 1) echo "Your $zzz is unsigned." ;;
15279 -1) echo "Your $zzz is signed." ;;
15280 esac
15281 ;;
15282 esac
15283else
15284 uidsign=1
15285 echo "(I can't compile the test program--guessing unsigned.)" >&4
15286fi
15287
15288
15289
15290echo " "
15291$echo "Checking the format string to be used for uids..." >&4
15292
15293case "$uidsign" in
15294-1) if $test X"$uidsize" = X"$ivsize"; then
15295 uidformat="$ivdformat"
15296 else
15297 if $test X"$uidsize" = X"$longsize"; then
15298 uidformat='"ld"'
15299 else
15300 if $test X"$uidsize" = X"$intsize"; then
15301 uidformat='"d"'
15302 else
15303 if $test X"$uidsize" = X"$shortsize"; then
15304 uidformat='"hd"'
15305 fi
15306 fi
15307 fi
15308 fi
15309 ;;
15310*) if $test X"$uidsize" = X"$uvsize"; then
15311 uidformat="$uvuformat"
15312 else
15313 if $test X"$uidsize" = X"$longsize"; then
15314 uidformat='"lu"'
15315 else
15316 if $test X"$uidsize" = X"$intsize"; then
15317 uidformat='"u"'
15318 else
15319 if $test X"$uidsize" = X"$shortsize"; then
15320 uidformat='"hu"'
15321 fi
15322 fi
15323 fi
15324 fi
15325 ;;
15326esac
15327
3659ebf1
JH
15328: determine compiler compiler
15329case "$yacc" in
15330'')
15331 dflt=yacc;;
15332*)
15333 dflt="$yacc";;
15334esac
15335echo " "
15336comp='yacc'
15337if $test -f "$byacc"; then
15338 dflt="$byacc"
15339 comp="byacc or $comp"
15340fi
15341if $test -f "$bison"; then
15342 comp="$comp or bison -y"
15343fi
15344rp="Which compiler compiler ($comp) shall I use?"
15345. ./myread
15346yacc="$ans"
15347case "$yacc" in
15348*bis*)
15349 case "$yacc" in
15350 *-y*) ;;
15351 *)
15352 yacc="$yacc -y"
15353 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15354 ;;
15355 esac
15356 ;;
15357esac
15358
b4eb6b3d
JH
15359: see if fcntl.h is there
15360val=''
15361set fcntl.h val
15362eval $inhdr
15363
15364: see if we can include fcntl.h
15365case "$val" in
15366"$define")
15367 echo " "
15368 if $h_fcntl; then
15369 val="$define"
15370 echo "We'll be including <fcntl.h>." >&4
15371 else
15372 val="$undef"
15373 if $h_sysfile; then
15374 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15375 else
15376 echo "We won't be including <fcntl.h>." >&4
15377 fi
15378 fi
15379 ;;
15380*)
15381 h_fcntl=false
15382 val="$undef"
15383 ;;
15384esac
15385set i_fcntl
15386eval $setvar
15387
15388: see if this is a iconv.h system
15389set iconv.h i_iconv
15390eval $inhdr
15391
15392: see if this is a ieeefp.h system
15393set ieeefp.h i_ieeefp
15394eval $inhdr
15395
15396: see if this is a libutil.h system
15397set libutil.h i_libutil
15398eval $inhdr
15399
15400: see if locale.h is available
15401set locale.h i_locale
15402eval $inhdr
15403
15404: see if mach cthreads are available
15405if test "X$usethreads" = "X$define"; then
15406 set mach/cthreads.h i_machcthr
15407 eval $inhdr
15408else
15409 i_machcthr="$undef"
15410fi
15411
15412
15413
15414: see if this is a math.h system
15415set math.h i_math
15416eval $inhdr
15417
15418: see if this is a mntent.h system
15419set mntent.h i_mntent
15420eval $inhdr
15421
15422: see if ndbm.h is available
15423set ndbm.h t_ndbm
15424eval $inhdr
15425case "$t_ndbm" in
15426$define)
15427 : see if dbm_open exists
15428 set dbm_open d_dbm_open
15429 eval $inlibc
15430 case "$d_dbm_open" in
15431 $undef)
15432 t_ndbm="$undef"
15433 echo "We won't be including <ndbm.h>"
15434 ;;
15435 esac
15436 ;;
15437esac
15438val="$t_ndbm"
15439set i_ndbm
15440eval $setvar
15441
15442: see if net/errno.h is available
15443val=''
15444set net/errno.h val
15445eval $inhdr
15446
15447: Unfortunately, it causes problems on some systems. Arrgh.
15448case "$val" in
15449$define)
15450 cat > try.c <<'EOM'
15451#include <stdio.h>
15452#include <errno.h>
15453#include <net/errno.h>
15454int func()
15455{
15456 return ENOTSOCK;
15457}
15458EOM
15459 if $cc $ccflags -c try.c >/dev/null 2>&1; then
15460 echo "We'll be including <net/errno.h>." >&4
15461 else
15462 echo "We won't be including <net/errno.h>." >&4
15463 val="$undef"
15464 fi
15465 $rm -f try.* try
15466 ;;
15467esac
15468set i_neterrno
15469eval $setvar
15470
15471: see if netinet/tcp.h is available
15472set netinet/tcp.h i_netinettcp
15473eval $inhdr
15474
15475: see if this is a poll.h system
15476set poll.h i_poll
15477eval $inhdr
15478
15479: see if this is a prot.h system
15480set prot.h i_prot
15481eval $inhdr
15482
15483echo " "
15484$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
15485$cat <<'EOSH' > Cppsym.know
15486a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15487AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
d46c9a2d
JH
15488alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15489ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15490BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
15491BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15492bull c cadmus clipper CMU COFF COMPILER_VERSION
15493concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15494CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15495Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15496FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15497GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15498H3050R H3050RX hbullx20 hcx host_mips
15499hp200 hp300 hp700 HP700 hp800 hp9000
15500hp9000s200 hp9000s300 hp9000s400 hp9000s500
15501hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15502i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 15503IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
15504INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15505LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15506LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15507Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15508LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15509M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15510M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15511M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15512MATH_HAS_NO_SIDE_EFFECTS
15513mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15514mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15515mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15516MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15517mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15518NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 15519news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
15520ns32016 ns32332 ns32k nsc32000
15521OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15522pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15523pc532 pdp11 PGC PIC plexus PORTAR posix
15524POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15525POSIX_C_SOURCE POSIX_SOURCE POWER
15526PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 15527riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
15528SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15529sony sony_news sonyrisc sparc sparclite spectrum
15530stardent stdc STDC_EXT stratos sun sun3 sun386
15531Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15532SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15533SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15534sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 15535TM3200 TM5400 TM5600
b4eb6b3d
JH
15536tower tower32 tower32_200 tower32_600 tower32_700
15537tower32_800 tower32_850 tss
15538u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15539ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15540unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15541Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15542XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15543XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15544z8000
15545EOSH
15546# Maybe put other stuff here too.
15547cat <<EOSH >>Cppsym.know
15548$osname
15549EOSH
15550./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15551./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15552$cat Cppsym.know > Cppsym.c
381aa1ff 15553$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
15554$rm -f Cppsym.a Cppsym.b Cppsym.c
15555cat <<EOSH > Cppsym
15556$startsh
15557if $test \$# -gt 0; then
15558 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15559 if $test -s Cppsym.got; then
15560 $rm -f Cppsym.got
15561 exit 0
15562 fi
15563 $rm -f Cppsym.got
15564 exit 1
15565else
15566 $tr " " "$trnl" | ./Cppsym.try
15567 exit 0
15568fi
15569EOSH
15570chmod +x Cppsym
15571$eunicefix Cppsym
15572cat <<EOSH > Cppsym.try
15573$startsh
15574cat <<'EOCP' > try.c
15575#include <stdio.h>
15576int main() {
15577EOCP
15578$awk \\
15579EOSH
15580cat <<'EOSH' >> Cppsym.try
15581'length($1) > 0 {
2ef53570
JH
15582 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
15583 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
15584 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
15585 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 15586}' >> try.c
2ef53570 15587echo 'return 0;}' >> try.c
b4eb6b3d
JH
15588EOSH
15589cat <<EOSH >> Cppsym.try
15590ccflags="$ccflags"
15591case "$osname-$gccversion" in
15592irix-) ccflags="\$ccflags -woff 1178" ;;
15593os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15594esac
7a282f6d 15595$cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
b4eb6b3d
JH
15596EOSH
15597chmod +x Cppsym.try
15598$eunicefix Cppsym.try
15599./Cppsym < Cppsym.know > Cppsym.true
15600: now check the C compiler for additional symbols
15601postprocess_cc_v=''
15602case "$osname" in
15603aix) postprocess_cc_v="|$tr , ' '" ;;
15604esac
15605$cat >ccsym <<EOS
15606$startsh
15607$cat >tmp.c <<EOF
15608extern int foo;
15609EOF
15610for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15611do
15612 case "\$i" in
15613 -D*) echo "\$i" | $sed 's/^-D//';;
15614 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15615 esac
15616done
15617$rm -f try.c
15618EOS
15619postprocess_cc_v=''
15620chmod +x ccsym
15621$eunicefix ccsym
15622./ccsym > ccsym1.raw
15623if $test -s ccsym1.raw; then
15624 $sort ccsym1.raw | $uniq >ccsym.raw
15625else
15626 mv ccsym1.raw ccsym.raw
15627fi
15628
15629$awk '/\=/ { print $0; next }
15630 { print $0"=1" }' ccsym.raw >ccsym.list
15631$awk '/\=/ { print $0; next }
15632 { print $0"=1" }' Cppsym.true >ccsym.true
15633$comm -13 ccsym.true ccsym.list >ccsym.own
15634$comm -12 ccsym.true ccsym.list >ccsym.com
15635$comm -23 ccsym.true ccsym.list >ccsym.cpp
15636also=''
15637if $test -z ccsym.raw; then
15638 echo "Your C compiler doesn't seem to define any symbols!" >&4
15639 echo " "
15640 echo "However, your C preprocessor defines the following symbols:"
15641 $cat Cppsym.true
15642 ccsymbols=''
15643 cppsymbols=`$cat Cppsym.true`
15644 cppsymbols=`echo $cppsymbols`
15645 cppccsymbols="$cppsymbols"
15646else
15647 if $test -s ccsym.com; then
15648 echo "Your C compiler and pre-processor define these symbols:"
15649 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15650 also='also '
15651 symbols='ones'
15652 cppccsymbols=`$cat ccsym.com`
15653 cppccsymbols=`echo $cppccsymbols`
15654 $test "$silent" || sleep 1
15655 fi
15656 if $test -s ccsym.cpp; then
15657 $test "$also" && echo " "
15658 echo "Your C pre-processor ${also}defines the following symbols:"
15659 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15660 also='further '
15661 cppsymbols=`$cat ccsym.cpp`
15662 cppsymbols=`echo $cppsymbols`
15663 $test "$silent" || sleep 1
15664 fi
15665 if $test -s ccsym.own; then
15666 $test "$also" && echo " "
15667 echo "Your C compiler ${also}defines the following cpp symbols:"
15668 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15669 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15670 ccsymbols=`$cat ccsym.own`
15671 ccsymbols=`echo $ccsymbols`
15672 $test "$silent" || sleep 1
15673 fi
15674fi
15675$rm -f ccsym* Cppsym.*
15676
15677: see if this is a termio system
15678val="$undef"
15679val2="$undef"
15680val3="$undef"
15681if $test `./findhdr termios.h`; then
15682 set tcsetattr i_termios
15683 eval $inlibc
15684 val3="$i_termios"
15685fi
15686echo " "
15687case "$val3" in
15688"$define") echo "You have POSIX termios.h... good!" >&4;;
15689*) if ./Cppsym pyr; then
15690 case "`/bin/universe`" in
15691 ucb) if $test `./findhdr sgtty.h`; then
15692 val2="$define"
15693 echo "<sgtty.h> found." >&4
15694 else
15695 echo "System is pyramid with BSD universe."
15696 echo "<sgtty.h> not found--you could have problems." >&4
15697 fi;;
15698 *) if $test `./findhdr termio.h`; then
15699 val="$define"
15700 echo "<termio.h> found." >&4
15701 else
15702 echo "System is pyramid with USG universe."
15703 echo "<termio.h> not found--you could have problems." >&4
15704 fi;;
15705 esac
15706 elif ./usg; then
15707 if $test `./findhdr termio.h`; then
15708 echo "<termio.h> found." >&4
15709 val="$define"
15710 elif $test `./findhdr sgtty.h`; then
15711 echo "<sgtty.h> found." >&4
15712 val2="$define"
15713 else
15714echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15715 fi
15716 else
15717 if $test `./findhdr sgtty.h`; then
15718 echo "<sgtty.h> found." >&4
15719 val2="$define"
15720 elif $test `./findhdr termio.h`; then
15721 echo "<termio.h> found." >&4
15722 val="$define"
15723 else
15724echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15725 fi
15726 fi;;
15727esac
15728set i_termio; eval $setvar
15729val=$val2; set i_sgtty; eval $setvar
15730val=$val3; set i_termios; eval $setvar
15731
15732: see if this is a shadow.h system
15733set shadow.h i_shadow
15734eval $inhdr
15735
b4eb6b3d
JH
15736: see if stddef is available
15737set stddef.h i_stddef
15738eval $inhdr
923fc586 15739
b4eb6b3d
JH
15740: see if this is a sunmath.h system
15741set sunmath.h i_sunmath
15742eval $inhdr
5f80c64f 15743
b4eb6b3d
JH
15744: see if sys/access.h is available
15745set sys/access.h i_sysaccess
15746eval $inhdr
15747
15748: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15749set sys/filio.h i_sysfilio
15750eval $inhdr
15751echo " "
15752if $test `./findhdr sys/ioctl.h`; then
15753 val="$define"
15754 echo '<sys/ioctl.h> found.' >&4
15755else
15756 val="$undef"
15757 if $test $i_sysfilio = "$define"; then
15758 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 15759 else
b4eb6b3d
JH
15760 $test $i_sgtty = "$define" && xxx="sgtty.h"
15761 $test $i_termio = "$define" && xxx="termio.h"
15762 $test $i_termios = "$define" && xxx="termios.h"
15763echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15764 fi
15765fi
15766set i_sysioctl
15767eval $setvar
15768
49a78c82
JH
15769: see if socket ioctl defs are in sys/sockio.h
15770echo " "
15771xxx=`./findhdr sys/sockio.h`
15772if $test "$xxx"; then
15773 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
15774 val="$define"
15775 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
15776 else
15777 val="$undef"
15778 echo "No socket ioctls found in <sys/sockio.h>." >&4
15779 fi
15780else
15781 val="$undef"
15782 $cat <<EOM
15783<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
15784EOM
15785fi
15786set i_syssockio
15787eval $setvar
15788
b4eb6b3d
JH
15789
15790: see if this is a syslog.h system
15791set syslog.h i_syslog
15792eval $inhdr
15793
15794
15795: see if this is a sys/mode.h system
15796set sys/mode.h i_sysmode
15797eval $inhdr
15798
15799: see if sys/resource.h has to be included
15800set sys/resource.h i_sysresrc
15801eval $inhdr
15802
15803: see if sys/security.h is available
15804set sys/security.h i_syssecrt
15805eval $inhdr
15806
15807: see if this is a sys/statvfs.h system
15808set sys/statvfs.h i_sysstatvfs
15809eval $inhdr
15810
b4eb6b3d
JH
15811: see if this is a sys/un.h system
15812set sys/un.h i_sysun
15813eval $inhdr
15814
15815
15816: see if this is a sys/utsname.h system
15817set sys/utsname.h i_sysutsname
15818eval $inhdr
15819
15820: see if this is a syswait system
15821set sys/wait.h i_syswait
15822eval $inhdr
15823
15824: see if this is a ustat.h system
15825set ustat.h i_ustat
15826eval $inhdr
15827
15828: see if this is an utime system
15829set utime.h i_utime
15830eval $inhdr
15831
15832: see if this is a values.h system
15833set values.h i_values
15834eval $inhdr
15835
15836: see if this is a vfork system
15837case "$d_vfork" in
15838"$define")
15839 set vfork.h i_vfork
15840 eval $inhdr
15841 ;;
15842*)
15843 i_vfork="$undef"
15844 ;;
15845esac
15846
15847: see if gdbm.h is available
15848set gdbm.h t_gdbm
15849eval $inhdr
15850case "$t_gdbm" in
15851$define)
15852 : see if gdbm_open exists
15853 set gdbm_open d_gdbm_open
15854 eval $inlibc
15855 case "$d_gdbm_open" in
15856 $undef)
15857 t_gdbm="$undef"
15858 echo "We won't be including <gdbm.h>"
5f80c64f 15859 ;;
b4eb6b3d
JH
15860 esac
15861 ;;
15862esac
15863val="$t_gdbm"
15864set i_gdbm
15865eval $setvar
15866
15867echo " "
15868echo "Looking for extensions..." >&4
15869: If we are using the old config.sh, known_extensions may contain
15870: old or inaccurate or duplicate values.
15871known_extensions=''
15872nonxs_extensions=''
15873: We do not use find because it might not be available.
15874: We do not just use MANIFEST because the user may have dropped
15875: some additional extensions into the source tree and expect them
15876: to be built.
15877
15878: Function to recursively find available extensions, ignoring DynaLoader
15879: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15880find_extensions='
15881 for xxx in *; do
15882 case "$xxx" in
15883 DynaLoader|dynaload) ;;
15884 *)
15885 if $test -f $xxx/$xxx.xs; then
15886 known_extensions="$known_extensions $1$xxx";
15887 elif $test -f $xxx/Makefile.PL; then
15888 nonxs_extensions="$nonxs_extensions $1$xxx";
15889 else
15890 if $test -d $xxx -a $# -lt 10; then
15891 set $1$xxx/ $*;
15892 cd $xxx;
15893 eval $find_extensions;
15894 cd ..;
15895 shift;
15896 fi;
15897 fi
15898 ;;
15899 esac;
15900 done'
15901tdir=`pwd`
15902cd $rsrc/ext
15903set X
15904shift
15905eval $find_extensions
15906set X $nonxs_extensions
15907shift
15908nonxs_extensions="$*"
15909set X $known_extensions
15910shift
15911known_extensions="$*"
15912cd $tdir
15913
15914: Now see which are supported on this system.
15915avail_ext=''
15916for xxx in $known_extensions ; do
15917 case "$xxx" in
15918 DB_File|db_file)
15919 case "$i_db" in
15920 $define) avail_ext="$avail_ext $xxx" ;;
15921 esac
15922 ;;
15923 GDBM_File|gdbm_fil)
15924 case "$i_gdbm" in
15925 $define) avail_ext="$avail_ext $xxx" ;;
15926 esac
15927 ;;
15928 NDBM_File|ndbm_fil)
15929 case "$i_ndbm" in
15930 $define)
15931 case "$osname-$use64bitint" in
15932 hpux-define)
15933 case "$libs" in
15934 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15935 esac
15936 ;;
15937 *) avail_ext="$avail_ext $xxx" ;;
15938 esac
15939 ;;
15940 esac
15941 ;;
15942 ODBM_File|odbm_fil)
15943 case "${i_dbm}${i_rpcsvcdbm}" in
15944 *"${define}"*)
15945 case "$osname-$use64bitint" in
15946 hpux-define)
15947 case "$libs" in
15948 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15949 esac
15950 ;;
15951 *) avail_ext="$avail_ext $xxx" ;;
15952 esac
15953 ;;
15954 esac
15955 ;;
15956 POSIX|posix)
15957 case "$useposix" in
15958 true|define|y) avail_ext="$avail_ext $xxx" ;;
15959 esac
15960 ;;
15961 Opcode|opcode)
15962 case "$useopcode" in
15963 true|define|y) avail_ext="$avail_ext $xxx" ;;
15964 esac
15965 ;;
15966 Socket|socket)
15967 case "$d_socket" in
15968 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15969 esac
15970 ;;
15971 Sys/Syslog|sys/syslog)
15972 : XXX syslog requires socket
15973 case "$d_socket" in
15974 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15975 esac
15976 ;;
15977 Thread|thread)
15978 case "$usethreads" in
15979 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15980 esac
15981 ;;
15982 IPC/SysV|ipc/sysv)
15983 : XXX Do we need a useipcsysv variable here
15984 case "${d_msg}${d_sem}${d_shm}" in
15985 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15986 esac
15987 ;;
15988 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
15989 ;;
15990 esac
b4eb6b3d 15991done
5f80c64f 15992
b4eb6b3d
JH
15993set X $avail_ext
15994shift
15995avail_ext="$*"
5f80c64f 15996
b4eb6b3d
JH
15997: Now see which nonxs extensions are supported on this system.
15998: For now assume all are.
15999nonxs_ext=''
16000for xxx in $nonxs_extensions ; do
16001 case "$xxx" in
16002 *) nonxs_ext="$nonxs_ext $xxx"
16003 ;;
16004 esac
16005done
5f80c64f 16006
b4eb6b3d
JH
16007set X $nonxs_ext
16008shift
16009nonxs_ext="$*"
16010
16011case $usedl in
16012$define)
16013 $cat <<EOM
16014A number of extensions are supplied with $package. You may choose to
16015compile these extensions for dynamic loading (the default), compile
16016them into the $package executable (static loading), or not include
16017them at all. Answer "none" to include no extensions.
16018Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
16019
16020EOM
b4eb6b3d
JH
16021 case "$dynamic_ext" in
16022 '') dflt="$avail_ext" ;;
16023 *) dflt="$dynamic_ext"
16024 # Perhaps we are reusing an old out-of-date config.sh.
16025 case "$hint" in
16026 previous)
16027 if test X"$dynamic_ext" != X"$avail_ext"; then
16028 $cat <<EOM
16029NOTICE: Your previous config.sh list may be incorrect.
16030The extensions now available to you are
16031 ${avail_ext}
16032but the default list from your previous config.sh is
16033 ${dynamic_ext}
9c839522 16034
b4eb6b3d
JH
16035EOM
16036 fi
9c839522
PM
16037 ;;
16038 esac
b4eb6b3d
JH
16039 ;;
16040 esac
5f80c64f 16041 case "$dflt" in
b4eb6b3d
JH
16042 '') dflt=none;;
16043 esac
16044 rp="What extensions do you wish to load dynamically?"
16045 . ./myread
16046 case "$ans" in
16047 none) dynamic_ext=' ' ;;
16048 *) dynamic_ext="$ans" ;;
5f80c64f 16049 esac
5f80c64f 16050
b4eb6b3d
JH
16051 case "$static_ext" in
16052 '')
16053 : Exclude those already listed in dynamic linking
16054 dflt=''
16055 for xxx in $avail_ext; do
16056 case " $dynamic_ext " in
16057 *" $xxx "*) ;;
16058 *) dflt="$dflt $xxx" ;;
16059 esac
16060 done
16061 set X $dflt
16062 shift
16063 dflt="$*"
16064 ;;
16065 *) dflt="$static_ext"
16066 ;;
16067 esac
9c839522 16068
b4eb6b3d
JH
16069 case "$dflt" in
16070 '') dflt=none;;
16071 esac
16072 rp="What extensions do you wish to load statically?"
16073 . ./myread
16074 case "$ans" in
16075 none) static_ext=' ' ;;
16076 *) static_ext="$ans" ;;
16077 esac
16078 ;;
16079*)
16080 $cat <<EOM
16081A number of extensions are supplied with $package. Answer "none"
16082to include no extensions.
16083Note that DynaLoader is always built and need not be mentioned here.
9c839522 16084
b4eb6b3d
JH
16085EOM
16086 case "$static_ext" in
16087 '') dflt="$avail_ext" ;;
16088 *) dflt="$static_ext"
16089 # Perhaps we are reusing an old out-of-date config.sh.
16090 case "$hint" in
16091 previous)
16092 if test X"$static_ext" != X"$avail_ext"; then
16093 $cat <<EOM
16094NOTICE: Your previous config.sh list may be incorrect.
16095The extensions now available to you are
16096 ${avail_ext}
16097but the default list from your previous config.sh is
16098 ${static_ext}
5f80c64f
JH
16099
16100EOM
b4eb6b3d
JH
16101 fi
16102 ;;
16103 esac
16104 ;;
16105 esac
16106 : Exclude those that are not xs extensions
16107 case "$dflt" in
16108 '') dflt=none;;
16109 esac
16110 rp="What extensions do you wish to include?"
16111 . ./myread
16112 case "$ans" in
16113 none) static_ext=' ' ;;
16114 *) static_ext="$ans" ;;
16115 esac
16116 ;;
5f80c64f
JH
16117esac
16118
b4eb6b3d
JH
16119set X $dynamic_ext $static_ext $nonxs_ext
16120shift
16121extensions="$*"
16122
9c839522
PM
16123: Remove libraries needed only for extensions
16124: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
16125: The exception is SunOS 4.x, which needs them.
16126case "${osname}X${osvers}" in
16127sunos*X4*)
16128 perllibs="$libs"
16129 ;;
16130*) case "$usedl" in
16131 $define|true|[yY]*)
16132 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
16133 shift
16134 perllibs="$*"
16135 ;;
16136 *) perllibs="$libs"
16137 ;;
16138 esac
16139 ;;
9c839522 16140esac
5f80c64f
JH
16141
16142: Remove build directory name from cppstdin so it can be used from
16143: either the present location or the final installed location.
16144echo " "
16145: Get out of the UU directory to get correct path name.
16146cd ..
16147case "$cppstdin" in
16148`pwd`/cppstdin)
16149 echo "Stripping down cppstdin path name"
16150 cppstdin=cppstdin
16151 ;;
16152esac
16153cd UU
16154
16155: end of configuration questions
16156echo " "
16157echo "End of configuration questions."
16158echo " "
16159
16160: back to where it started
16161if test -d ../UU; then
16162 cd ..
16163fi
16164
16165: configuration may be patched via a 'config.over' file
16166if $test -f config.over; then
16167 echo " "
16168 dflt=y
16169 rp='I see a config.over file. Do you wish to load it?'
16170 . UU/myread
16171 case "$ans" in
16172 n*) echo "OK, I'll ignore it.";;
16173 *) . ./config.over
16174 echo "Configuration override changes have been loaded."
16175 ;;
16176 esac
16177fi
16178
16179: in case they want portability, strip down executable paths
16180case "$d_portable" in
16181"$define")
16182 echo " "
16183 echo "Stripping down executable paths..." >&4
16184 for file in $loclist $trylist; do
534ac15a
JH
16185 eval temp=\$$file
16186 eval $file=`basename $temp`
5f80c64f
JH
16187 done
16188 ;;
16189esac
16190
16191: create config.sh file
16192echo " "
16193echo "Creating config.sh..." >&4
16194$spitshell <<EOT >config.sh
16195$startsh
16196#
16197# This file was produced by running the Configure script. It holds all the
16198# definitions figured out by Configure. Should you modify one of these values,
16199# do not forget to propagate your changes by running "Configure -der". You may
16200# instead choose to run each of the .SH files by yourself, or "Configure -S".
16201#
16202
16203# Package name : $package
16204# Source directory : $src
16205# Configuration time: $cf_time
16206# Configured by : $cf_by
16207# Target system : $myuname
16208
16209Author='$Author'
16210Date='$Date'
16211Header='$Header'
16212Id='$Id'
16213Locker='$Locker'
16214Log='$Log'
16215Mcc='$Mcc'
16216RCSfile='$RCSfile'
16217Revision='$Revision'
16218Source='$Source'
16219State='$State'
16220_a='$_a'
16221_exe='$_exe'
16222_o='$_o'
b4eb6b3d 16223afs='$afs'
a6d26a0d 16224afsroot='$afsroot'
b4eb6b3d
JH
16225alignbytes='$alignbytes'
16226ansi2knr='$ansi2knr'
16227aphostname='$aphostname'
16228api_revision='$api_revision'
16229api_subversion='$api_subversion'
16230api_version='$api_version'
16231api_versionstring='$api_versionstring'
5f80c64f 16232ar='$ar'
b4eb6b3d
JH
16233archlib='$archlib'
16234archlibexp='$archlibexp'
16235archname64='$archname64'
16236archname='$archname'
5f80c64f
JH
16237archobjs='$archobjs'
16238awk='$awk'
b4eb6b3d 16239baserev='$baserev'
5f80c64f 16240bash='$bash'
b4eb6b3d
JH
16241bin='$bin'
16242bincompat5005='$bincompat5005'
16243binexp='$binexp'
5f80c64f
JH
16244bison='$bison'
16245byacc='$byacc'
b4eb6b3d 16246byteorder='$byteorder'
5f80c64f 16247c='$c'
b4eb6b3d 16248castflags='$castflags'
5f80c64f
JH
16249cat='$cat'
16250cc='$cc'
16251cccdlflags='$cccdlflags'
16252ccdlflags='$ccdlflags'
16253ccflags='$ccflags'
b4eb6b3d 16254ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 16255ccname='$ccname'
b4eb6b3d 16256ccsymbols='$ccsymbols'
6b356c8e 16257ccversion='$ccversion'
5f80c64f 16258cf_by='$cf_by'
b4eb6b3d 16259cf_email='$cf_email'
5f80c64f 16260cf_time='$cf_time'
b4eb6b3d 16261charsize='$charsize'
5f80c64f
JH
16262chgrp='$chgrp'
16263chmod='$chmod'
16264chown='$chown'
b4eb6b3d 16265clocktype='$clocktype'
5f80c64f
JH
16266comm='$comm'
16267compress='$compress'
16268contains='$contains'
16269cp='$cp'
16270cpio='$cpio'
16271cpp='$cpp'
b4eb6b3d
JH
16272cpp_stuff='$cpp_stuff'
16273cppccsymbols='$cppccsymbols'
5f80c64f
JH
16274cppflags='$cppflags'
16275cpplast='$cpplast'
16276cppminus='$cppminus'
16277cpprun='$cpprun'
16278cppstdin='$cppstdin'
b4eb6b3d
JH
16279cppsymbols='$cppsymbols'
16280crosscompile='$crosscompile'
16281cryptlib='$cryptlib'
5f80c64f 16282csh='$csh'
b4eb6b3d
JH
16283d_Gconvert='$d_Gconvert'
16284d_PRIEUldbl='$d_PRIEUldbl'
16285d_PRIFUldbl='$d_PRIFUldbl'
16286d_PRIGUldbl='$d_PRIGUldbl'
16287d_PRIXU64='$d_PRIXU64'
16288d_PRId64='$d_PRId64'
16289d_PRIeldbl='$d_PRIeldbl'
16290d_PRIfldbl='$d_PRIfldbl'
16291d_PRIgldbl='$d_PRIgldbl'
16292d_PRIi64='$d_PRIi64'
16293d_PRIo64='$d_PRIo64'
16294d_PRIu64='$d_PRIu64'
16295d_PRIx64='$d_PRIx64'
16296d_SCNfldbl='$d_SCNfldbl'
74cac757 16297d__fwalk='$d__fwalk'
b4eb6b3d
JH
16298d_access='$d_access'
16299d_accessx='$d_accessx'
16300d_alarm='$d_alarm'
16301d_archlib='$d_archlib'
16302d_atolf='$d_atolf'
16303d_atoll='$d_atoll'
16304d_attribut='$d_attribut'
16305d_bcmp='$d_bcmp'
16306d_bcopy='$d_bcopy'
16307d_bincompat5005='$d_bincompat5005'
5f80c64f 16308d_bsd='$d_bsd'
b4eb6b3d
JH
16309d_bsdgetpgrp='$d_bsdgetpgrp'
16310d_bsdsetpgrp='$d_bsdsetpgrp'
16311d_bzero='$d_bzero'
16312d_casti32='$d_casti32'
16313d_castneg='$d_castneg'
16314d_charvspr='$d_charvspr'
16315d_chown='$d_chown'
16316d_chroot='$d_chroot'
16317d_chsize='$d_chsize'
16318d_closedir='$d_closedir'
4e0554ec 16319d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d
JH
16320d_const='$d_const'
16321d_crypt='$d_crypt'
16322d_csh='$d_csh'
16323d_cuserid='$d_cuserid'
16324d_dbl_dig='$d_dbl_dig'
2ef53570 16325d_dbminitproto='$d_dbminitproto'
b4eb6b3d
JH
16326d_difftime='$d_difftime'
16327d_dirnamlen='$d_dirnamlen'
16328d_dlerror='$d_dlerror'
5f80c64f 16329d_dlopen='$d_dlopen'
b4eb6b3d
JH
16330d_dlsymun='$d_dlsymun'
16331d_dosuid='$d_dosuid'
16332d_drand48proto='$d_drand48proto'
16333d_dup2='$d_dup2'
16334d_eaccess='$d_eaccess'
16335d_endgrent='$d_endgrent'
16336d_endhent='$d_endhent'
16337d_endnent='$d_endnent'
16338d_endpent='$d_endpent'
16339d_endpwent='$d_endpwent'
16340d_endsent='$d_endsent'
16341d_eofnblk='$d_eofnblk'
5f80c64f 16342d_eunice='$d_eunice'
b4eb6b3d
JH
16343d_fchmod='$d_fchmod'
16344d_fchown='$d_fchown'
16345d_fcntl='$d_fcntl'
9d9004a9 16346d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
16347d_fd_macros='$d_fd_macros'
16348d_fd_set='$d_fd_set'
16349d_fds_bits='$d_fds_bits'
16350d_fgetpos='$d_fgetpos'
16351d_flexfnam='$d_flexfnam'
16352d_flock='$d_flock'
2ef53570 16353d_flockproto='$d_flockproto'
b4eb6b3d
JH
16354d_fork='$d_fork'
16355d_fpathconf='$d_fpathconf'
16356d_fpos64_t='$d_fpos64_t'
16357d_frexpl='$d_frexpl'
16358d_fs_data_s='$d_fs_data_s'
16359d_fseeko='$d_fseeko'
16360d_fsetpos='$d_fsetpos'
16361d_fstatfs='$d_fstatfs'
16362d_fstatvfs='$d_fstatvfs'
411ab01c 16363d_fsync='$d_fsync'
b4eb6b3d
JH
16364d_ftello='$d_ftello'
16365d_ftime='$d_ftime'
16366d_getcwd='$d_getcwd'
16367d_getespwnam='$d_getespwnam'
16368d_getfsstat='$d_getfsstat'
16369d_getgrent='$d_getgrent'
16370d_getgrps='$d_getgrps'
16371d_gethbyaddr='$d_gethbyaddr'
16372d_gethbyname='$d_gethbyname'
16373d_gethent='$d_gethent'
16374d_gethname='$d_gethname'
16375d_gethostprotos='$d_gethostprotos'
4e0554ec 16376d_getitimer='$d_getitimer'
b4eb6b3d
JH
16377d_getlogin='$d_getlogin'
16378d_getmnt='$d_getmnt'
16379d_getmntent='$d_getmntent'
16380d_getnbyaddr='$d_getnbyaddr'
16381d_getnbyname='$d_getnbyname'
16382d_getnent='$d_getnent'
16383d_getnetprotos='$d_getnetprotos'
0c0643d0 16384d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
16385d_getpbyname='$d_getpbyname'
16386d_getpbynumber='$d_getpbynumber'
16387d_getpent='$d_getpent'
16388d_getpgid='$d_getpgid'
16389d_getpgrp2='$d_getpgrp2'
16390d_getpgrp='$d_getpgrp'
16391d_getppid='$d_getppid'
16392d_getprior='$d_getprior'
16393d_getprotoprotos='$d_getprotoprotos'
16394d_getprpwnam='$d_getprpwnam'
16395d_getpwent='$d_getpwent'
16396d_getsbyname='$d_getsbyname'
16397d_getsbyport='$d_getsbyport'
16398d_getsent='$d_getsent'
16399d_getservprotos='$d_getservprotos'
16400d_getspnam='$d_getspnam'
16401d_gettimeod='$d_gettimeod'
5f80c64f 16402d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
16403d_grpasswd='$d_grpasswd'
16404d_hasmntopt='$d_hasmntopt'
16405d_htonl='$d_htonl'
16406d_iconv='$d_iconv'
16407d_index='$d_index'
16408d_inetaton='$d_inetaton'
16409d_int64_t='$d_int64_t'
16410d_isascii='$d_isascii'
16411d_isnan='$d_isnan'
16412d_isnanl='$d_isnanl'
16413d_killpg='$d_killpg'
16414d_lchown='$d_lchown'
16415d_ldbl_dig='$d_ldbl_dig'
16416d_link='$d_link'
16417d_locconv='$d_locconv'
16418d_lockf='$d_lockf'
16419d_longdbl='$d_longdbl'
16420d_longlong='$d_longlong'
16421d_lseekproto='$d_lseekproto'
16422d_lstat='$d_lstat'
16423d_madvise='$d_madvise'
16424d_mblen='$d_mblen'
16425d_mbstowcs='$d_mbstowcs'
16426d_mbtowc='$d_mbtowc'
16427d_memchr='$d_memchr'
16428d_memcmp='$d_memcmp'
16429d_memcpy='$d_memcpy'
16430d_memmove='$d_memmove'
16431d_memset='$d_memset'
16432d_mkdir='$d_mkdir'
16433d_mkdtemp='$d_mkdtemp'
16434d_mkfifo='$d_mkfifo'
16435d_mkstemp='$d_mkstemp'
16436d_mkstemps='$d_mkstemps'
16437d_mktime='$d_mktime'
16438d_mmap='$d_mmap'
16439d_modfl='$d_modfl'
16440d_mprotect='$d_mprotect'
16441d_msg='$d_msg'
16442d_msg_ctrunc='$d_msg_ctrunc'
16443d_msg_dontroute='$d_msg_dontroute'
16444d_msg_oob='$d_msg_oob'
16445d_msg_peek='$d_msg_peek'
16446d_msg_proxy='$d_msg_proxy'
16447d_msgctl='$d_msgctl'
16448d_msgget='$d_msgget'
4e0554ec 16449d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
16450d_msgrcv='$d_msgrcv'
16451d_msgsnd='$d_msgsnd'
16452d_msync='$d_msync'
16453d_munmap='$d_munmap'
16454d_mymalloc='$d_mymalloc'
16455d_nice='$d_nice'
16456d_nv_preserves_uv='$d_nv_preserves_uv'
16457d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16458d_off64_t='$d_off64_t'
16459d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16460d_oldpthreads='$d_oldpthreads'
16461d_oldsock='$d_oldsock'
16462d_open3='$d_open3'
16463d_pathconf='$d_pathconf'
16464d_pause='$d_pause'
16465d_perl_otherlibdirs='$d_perl_otherlibdirs'
16466d_phostname='$d_phostname'
16467d_pipe='$d_pipe'
16468d_poll='$d_poll'
5f80c64f 16469d_portable='$d_portable'
b4eb6b3d
JH
16470d_pthread_yield='$d_pthread_yield'
16471d_pwage='$d_pwage'
16472d_pwchange='$d_pwchange'
16473d_pwclass='$d_pwclass'
16474d_pwcomment='$d_pwcomment'
16475d_pwexpire='$d_pwexpire'
16476d_pwgecos='$d_pwgecos'
16477d_pwpasswd='$d_pwpasswd'
16478d_pwquota='$d_pwquota'
16479d_qgcvt='$d_qgcvt'
16480d_quad='$d_quad'
16481d_readdir='$d_readdir'
16482d_readlink='$d_readlink'
4e0554ec 16483d_readv='$d_readv'
640374d0 16484d_realpath='$d_realpath'
4e0554ec 16485d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
16486d_rename='$d_rename'
16487d_rewinddir='$d_rewinddir'
16488d_rmdir='$d_rmdir'
16489d_safebcpy='$d_safebcpy'
16490d_safemcpy='$d_safemcpy'
16491d_sanemcmp='$d_sanemcmp'
ef9f17be 16492d_sbrkproto='$d_sbrkproto'
b4eb6b3d
JH
16493d_sched_yield='$d_sched_yield'
16494d_scm_rights='$d_scm_rights'
16495d_seekdir='$d_seekdir'
16496d_select='$d_select'
16497d_sem='$d_sem'
16498d_semctl='$d_semctl'
16499d_semctl_semid_ds='$d_semctl_semid_ds'
16500d_semctl_semun='$d_semctl_semun'
16501d_semget='$d_semget'
16502d_semop='$d_semop'
4e0554ec 16503d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
16504d_setegid='$d_setegid'
16505d_seteuid='$d_seteuid'
16506d_setgrent='$d_setgrent'
16507d_setgrps='$d_setgrps'
16508d_sethent='$d_sethent'
4e0554ec 16509d_setitimer='$d_setitimer'
b4eb6b3d
JH
16510d_setlinebuf='$d_setlinebuf'
16511d_setlocale='$d_setlocale'
16512d_setnent='$d_setnent'
16513d_setpent='$d_setpent'
16514d_setpgid='$d_setpgid'
16515d_setpgrp2='$d_setpgrp2'
16516d_setpgrp='$d_setpgrp'
16517d_setprior='$d_setprior'
16518d_setproctitle='$d_setproctitle'
16519d_setpwent='$d_setpwent'
16520d_setregid='$d_setregid'
16521d_setresgid='$d_setresgid'
16522d_setresuid='$d_setresuid'
16523d_setreuid='$d_setreuid'
16524d_setrgid='$d_setrgid'
16525d_setruid='$d_setruid'
16526d_setsent='$d_setsent'
16527d_setsid='$d_setsid'
16528d_setvbuf='$d_setvbuf'
16529d_sfio='$d_sfio'
16530d_shm='$d_shm'
16531d_shmat='$d_shmat'
16532d_shmatprototype='$d_shmatprototype'
16533d_shmctl='$d_shmctl'
16534d_shmdt='$d_shmdt'
16535d_shmget='$d_shmget'
16536d_sigaction='$d_sigaction'
983dbef6 16537d_sigprocmask='$d_sigprocmask'
b4eb6b3d 16538d_sigsetjmp='$d_sigsetjmp'
49a78c82 16539d_sockatmark='$d_sockatmark'
2ef53570 16540d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
16541d_socket='$d_socket'
16542d_socklen_t='$d_socklen_t'
16543d_sockpair='$d_sockpair'
16544d_socks5_init='$d_socks5_init'
16545d_sqrtl='$d_sqrtl'
eef837ea 16546d_sresgproto='$d_sresgproto'
640374d0 16547d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
16548d_statblks='$d_statblks'
16549d_statfs_f_flags='$d_statfs_f_flags'
16550d_statfs_s='$d_statfs_s'
16551d_statvfs='$d_statvfs'
16552d_stdio_cnt_lval='$d_stdio_cnt_lval'
16553d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
16554d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16555d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
16556d_stdio_stream_array='$d_stdio_stream_array'
16557d_stdiobase='$d_stdiobase'
16558d_stdstdio='$d_stdstdio'
16559d_strchr='$d_strchr'
16560d_strcoll='$d_strcoll'
16561d_strctcpy='$d_strctcpy'
16562d_strerrm='$d_strerrm'
16563d_strerror='$d_strerror'
b3c85772 16564d_strftime='$d_strftime'
b4eb6b3d
JH
16565d_strtod='$d_strtod'
16566d_strtol='$d_strtol'
16567d_strtold='$d_strtold'
16568d_strtoll='$d_strtoll'
28e5dec8 16569d_strtoq='$d_strtoq'
b4eb6b3d
JH
16570d_strtoul='$d_strtoul'
16571d_strtoull='$d_strtoull'
16572d_strtouq='$d_strtouq'
16573d_strxfrm='$d_strxfrm'
16574d_suidsafe='$d_suidsafe'
16575d_symlink='$d_symlink'
16576d_syscall='$d_syscall'
2ef53570 16577d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
16578d_sysconf='$d_sysconf'
16579d_sysernlst='$d_sysernlst'
16580d_syserrlst='$d_syserrlst'
16581d_system='$d_system'
16582d_tcgetpgrp='$d_tcgetpgrp'
16583d_tcsetpgrp='$d_tcsetpgrp'
16584d_telldir='$d_telldir'
16585d_telldirproto='$d_telldirproto'
16586d_time='$d_time'
16587d_times='$d_times'
16588d_truncate='$d_truncate'
16589d_tzname='$d_tzname'
4e0554ec
JH
16590d_u32align='$d_u32align'
16591d_ualarm='$d_ualarm'
b4eb6b3d
JH
16592d_umask='$d_umask'
16593d_uname='$d_uname'
16594d_union_semun='$d_union_semun'
4e0554ec 16595d_usleep='$d_usleep'
2ef53570 16596d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
16597d_ustat='$d_ustat'
16598d_vendorarch='$d_vendorarch'
16599d_vendorbin='$d_vendorbin'
16600d_vendorlib='$d_vendorlib'
16601d_vfork='$d_vfork'
16602d_void_closedir='$d_void_closedir'
16603d_voidsig='$d_voidsig'
16604d_voidtty='$d_voidtty'
16605d_volatile='$d_volatile'
16606d_vprintf='$d_vprintf'
16607d_wait4='$d_wait4'
16608d_waitpid='$d_waitpid'
16609d_wcstombs='$d_wcstombs'
16610d_wctomb='$d_wctomb'
4e0554ec 16611d_writev='$d_writev'
5f80c64f
JH
16612d_xenix='$d_xenix'
16613date='$date'
b4eb6b3d
JH
16614db_hashtype='$db_hashtype'
16615db_prefixtype='$db_prefixtype'
640374d0
JH
16616db_version_major='$db_version_major'
16617db_version_minor='$db_version_minor'
16618db_version_patch='$db_version_patch'
b4eb6b3d
JH
16619defvoidused='$defvoidused'
16620direntrytype='$direntrytype'
16621dlext='$dlext'
5f80c64f 16622dlsrc='$dlsrc'
b4eb6b3d
JH
16623doublesize='$doublesize'
16624drand01='$drand01'
16625dynamic_ext='$dynamic_ext'
16626eagain='$eagain'
16627ebcdic='$ebcdic'
5f80c64f
JH
16628echo='$echo'
16629egrep='$egrep'
16630emacs='$emacs'
16631eunicefix='$eunicefix'
16632exe_ext='$exe_ext'
16633expr='$expr'
b4eb6b3d
JH
16634extensions='$extensions'
16635fflushNULL='$fflushNULL'
16636fflushall='$fflushall'
5f80c64f
JH
16637find='$find'
16638firstmakefile='$firstmakefile'
16639flex='$flex'
b4eb6b3d
JH
16640fpossize='$fpossize'
16641fpostype='$fpostype'
16642freetype='$freetype'
16643full_ar='$full_ar'
16644full_csh='$full_csh'
16645full_sed='$full_sed'
5b463ca7 16646gccosandvers='$gccosandvers'
5f80c64f 16647gccversion='$gccversion'
b4eb6b3d
JH
16648gidformat='$gidformat'
16649gidsign='$gidsign'
16650gidsize='$gidsize'
16651gidtype='$gidtype'
5f80c64f
JH
16652glibpth='$glibpth'
16653grep='$grep'
b4eb6b3d
JH
16654groupcat='$groupcat'
16655groupstype='$groupstype'
5f80c64f 16656gzip='$gzip'
b4eb6b3d
JH
16657h_fcntl='$h_fcntl'
16658h_sysfile='$h_sysfile'
5f80c64f 16659hint='$hint'
b4eb6b3d
JH
16660hostcat='$hostcat'
16661i16size='$i16size'
16662i16type='$i16type'
16663i32size='$i32size'
16664i32type='$i32type'
16665i64size='$i64size'
16666i64type='$i64type'
16667i8size='$i8size'
16668i8type='$i8type'
16669i_arpainet='$i_arpainet'
16670i_bsdioctl='$i_bsdioctl'
16671i_db='$i_db'
16672i_dbm='$i_dbm'
16673i_dirent='$i_dirent'
5f80c64f 16674i_dld='$i_dld'
b4eb6b3d
JH
16675i_dlfcn='$i_dlfcn'
16676i_fcntl='$i_fcntl'
16677i_float='$i_float'
16678i_gdbm='$i_gdbm'
16679i_grp='$i_grp'
16680i_iconv='$i_iconv'
16681i_ieeefp='$i_ieeefp'
16682i_inttypes='$i_inttypes'
16683i_libutil='$i_libutil'
16684i_limits='$i_limits'
16685i_locale='$i_locale'
16686i_machcthr='$i_machcthr'
16687i_malloc='$i_malloc'
16688i_math='$i_math'
16689i_memory='$i_memory'
16690i_mntent='$i_mntent'
16691i_ndbm='$i_ndbm'
16692i_netdb='$i_netdb'
16693i_neterrno='$i_neterrno'
16694i_netinettcp='$i_netinettcp'
16695i_niin='$i_niin'
16696i_poll='$i_poll'
16697i_prot='$i_prot'
16698i_pthread='$i_pthread'
16699i_pwd='$i_pwd'
16700i_rpcsvcdbm='$i_rpcsvcdbm'
16701i_sfio='$i_sfio'
16702i_sgtty='$i_sgtty'
16703i_shadow='$i_shadow'
16704i_socks='$i_socks'
16705i_stdarg='$i_stdarg'
16706i_stddef='$i_stddef'
16707i_stdlib='$i_stdlib'
16708i_string='$i_string'
16709i_sunmath='$i_sunmath'
16710i_sysaccess='$i_sysaccess'
16711i_sysdir='$i_sysdir'
16712i_sysfile='$i_sysfile'
16713i_sysfilio='$i_sysfilio'
16714i_sysin='$i_sysin'
16715i_sysioctl='$i_sysioctl'
16716i_syslog='$i_syslog'
16717i_sysmman='$i_sysmman'
16718i_sysmode='$i_sysmode'
16719i_sysmount='$i_sysmount'
16720i_sysndir='$i_sysndir'
16721i_sysparam='$i_sysparam'
16722i_sysresrc='$i_sysresrc'
16723i_syssecrt='$i_syssecrt'
16724i_sysselct='$i_sysselct'
16725i_syssockio='$i_syssockio'
16726i_sysstat='$i_sysstat'
16727i_sysstatfs='$i_sysstatfs'
16728i_sysstatvfs='$i_sysstatvfs'
16729i_systime='$i_systime'
16730i_systimek='$i_systimek'
16731i_systimes='$i_systimes'
16732i_systypes='$i_systypes'
16733i_sysuio='$i_sysuio'
16734i_sysun='$i_sysun'
16735i_sysutsname='$i_sysutsname'
16736i_sysvfs='$i_sysvfs'
16737i_syswait='$i_syswait'
16738i_termio='$i_termio'
16739i_termios='$i_termios'
16740i_time='$i_time'
16741i_unistd='$i_unistd'
16742i_ustat='$i_ustat'
16743i_utime='$i_utime'
16744i_values='$i_values'
16745i_varargs='$i_varargs'
16746i_varhdr='$i_varhdr'
16747i_vfork='$i_vfork'
5f80c64f 16748ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
16749inc_version_list='$inc_version_list'
16750inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
16751incpath='$incpath'
16752inews='$inews'
b4eb6b3d
JH
16753installarchlib='$installarchlib'
16754installbin='$installbin'
16755installman1dir='$installman1dir'
16756installman3dir='$installman3dir'
16757installprefix='$installprefix'
16758installprefixexp='$installprefixexp'
16759installprivlib='$installprivlib'
16760installscript='$installscript'
16761installsitearch='$installsitearch'
16762installsitebin='$installsitebin'
16763installsitelib='$installsitelib'
16764installstyle='$installstyle'
16765installusrbinperl='$installusrbinperl'
16766installvendorarch='$installvendorarch'
16767installvendorbin='$installvendorbin'
16768installvendorlib='$installvendorlib'
16769intsize='$intsize'
4b661809 16770issymlink='$issymlink'
b4eb6b3d
JH
16771ivdformat='$ivdformat'
16772ivsize='$ivsize'
16773ivtype='$ivtype'
16774known_extensions='$known_extensions'
5f80c64f 16775ksh='$ksh'
5f80c64f
JH
16776ld='$ld'
16777lddlflags='$lddlflags'
16778ldflags='$ldflags'
b4eb6b3d
JH
16779ldflags_uselargefiles='$ldflags_uselargefiles'
16780ldlibpthname='$ldlibpthname'
5f80c64f
JH
16781less='$less'
16782lib_ext='$lib_ext'
16783libc='$libc'
b4eb6b3d 16784libperl='$libperl'
5f80c64f
JH
16785libpth='$libpth'
16786libs='$libs'
43999f95
JH
16787libsdirs='$libsdirs'
16788libsfiles='$libsfiles'
16789libsfound='$libsfound'
13b3f787 16790libspath='$libspath'
5f80c64f 16791libswanted='$libswanted'
b4eb6b3d 16792libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
16793line='$line'
16794lint='$lint'
16795lkflags='$lkflags'
16796ln='$ln'
16797lns='$lns'
16798locincpth='$locincpth'
16799loclibpth='$loclibpth'
b4eb6b3d
JH
16800longdblsize='$longdblsize'
16801longlongsize='$longlongsize'
16802longsize='$longsize'
5f80c64f
JH
16803lp='$lp'
16804lpr='$lpr'
16805ls='$ls'
b4eb6b3d
JH
16806lseeksize='$lseeksize'
16807lseektype='$lseektype'
5f80c64f
JH
16808mail='$mail'
16809mailx='$mailx'
16810make='$make'
16811make_set_make='$make_set_make'
b4eb6b3d
JH
16812mallocobj='$mallocobj'
16813mallocsrc='$mallocsrc'
16814malloctype='$malloctype'
16815man1dir='$man1dir'
16816man1direxp='$man1direxp'
16817man1ext='$man1ext'
16818man3dir='$man3dir'
16819man3direxp='$man3direxp'
16820man3ext='$man3ext'
5f80c64f
JH
16821mips_type='$mips_type'
16822mkdir='$mkdir'
b4eb6b3d
JH
16823mmaptype='$mmaptype'
16824modetype='$modetype'
5f80c64f 16825more='$more'
b4eb6b3d 16826multiarch='$multiarch'
5f80c64f 16827mv='$mv'
b4eb6b3d
JH
16828myarchname='$myarchname'
16829mydomain='$mydomain'
16830myhostname='$myhostname'
5f80c64f
JH
16831myuname='$myuname'
16832n='$n'
2cc61e15 16833need_va_copy='$need_va_copy'
b4eb6b3d
JH
16834netdb_hlen_type='$netdb_hlen_type'
16835netdb_host_type='$netdb_host_type'
16836netdb_name_type='$netdb_name_type'
16837netdb_net_type='$netdb_net_type'
5f80c64f
JH
16838nm='$nm'
16839nm_opt='$nm_opt'
16840nm_so_opt='$nm_so_opt'
b4eb6b3d 16841nonxs_ext='$nonxs_ext'
5f80c64f 16842nroff='$nroff'
b4eb6b3d
JH
16843nvEUformat='$nvEUformat'
16844nvFUformat='$nvFUformat'
16845nvGUformat='$nvGUformat'
16846nveformat='$nveformat'
16847nvfformat='$nvfformat'
16848nvgformat='$nvgformat'
16849nvsize='$nvsize'
16850nvtype='$nvtype'
16851o_nonblock='$o_nonblock'
5f80c64f 16852obj_ext='$obj_ext'
b4eb6b3d 16853old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 16854optimize='$optimize'
b4eb6b3d 16855orderlib='$orderlib'
5f80c64f
JH
16856osname='$osname'
16857osvers='$osvers'
b4eb6b3d 16858otherlibdirs='$otherlibdirs'
5f80c64f 16859package='$package'
b4eb6b3d
JH
16860pager='$pager'
16861passcat='$passcat'
16862patchlevel='$patchlevel'
5f80c64f 16863path_sep='$path_sep'
b4eb6b3d 16864perl5='$perl5'
5f80c64f 16865perl='$perl'
151e6568 16866perl_patchlevel='$perl_patchlevel'
b4eb6b3d 16867perladmin='$perladmin'
9c839522 16868perllibs='$perllibs'
b4eb6b3d 16869perlpath='$perlpath'
5f80c64f 16870pg='$pg'
b4eb6b3d
JH
16871phostname='$phostname'
16872pidtype='$pidtype'
5f80c64f 16873plibpth='$plibpth'
b4eb6b3d 16874pm_apiversion='$pm_apiversion'
5f80c64f
JH
16875pmake='$pmake'
16876pr='$pr'
b4eb6b3d
JH
16877prefix='$prefix'
16878prefixexp='$prefixexp'
16879privlib='$privlib'
16880privlibexp='$privlibexp'
16881prototype='$prototype'
16882ptrsize='$ptrsize'
16883quadkind='$quadkind'
16884quadtype='$quadtype'
16885randbits='$randbits'
16886randfunc='$randfunc'
16887randseedtype='$randseedtype'
16888ranlib='$ranlib'
16889rd_nodata='$rd_nodata'
16890revision='$revision'
5f80c64f
JH
16891rm='$rm'
16892rmail='$rmail'
16893runnm='$runnm'
b4eb6b3d
JH
16894sPRIEUldbl='$sPRIEUldbl'
16895sPRIFUldbl='$sPRIFUldbl'
16896sPRIGUldbl='$sPRIGUldbl'
16897sPRIXU64='$sPRIXU64'
16898sPRId64='$sPRId64'
16899sPRIeldbl='$sPRIeldbl'
16900sPRIfldbl='$sPRIfldbl'
16901sPRIgldbl='$sPRIgldbl'
16902sPRIi64='$sPRIi64'
16903sPRIo64='$sPRIo64'
16904sPRIu64='$sPRIu64'
16905sPRIx64='$sPRIx64'
16906sSCNfldbl='$sSCNfldbl'
16907sched_yield='$sched_yield'
16908scriptdir='$scriptdir'
16909scriptdirexp='$scriptdirexp'
5f80c64f 16910sed='$sed'
b4eb6b3d
JH
16911seedfunc='$seedfunc'
16912selectminbits='$selectminbits'
16913selecttype='$selecttype'
5f80c64f
JH
16914sendmail='$sendmail'
16915sh='$sh'
16916shar='$shar'
16917sharpbang='$sharpbang'
b4eb6b3d
JH
16918shmattype='$shmattype'
16919shortsize='$shortsize'
16920shrpenv='$shrpenv'
5f80c64f 16921shsharp='$shsharp'
b4eb6b3d
JH
16922sig_count='$sig_count'
16923sig_name='$sig_name'
16924sig_name_init='$sig_name_init'
16925sig_num='$sig_num'
16926sig_num_init='$sig_num_init'
76d3c696 16927sig_size='$sig_size'
b4eb6b3d
JH
16928signal_t='$signal_t'
16929sitearch='$sitearch'
16930sitearchexp='$sitearchexp'
16931sitebin='$sitebin'
16932sitebinexp='$sitebinexp'
16933sitelib='$sitelib'
16934sitelib_stem='$sitelib_stem'
16935sitelibexp='$sitelibexp'
16936siteprefix='$siteprefix'
16937siteprefixexp='$siteprefixexp'
16938sizesize='$sizesize'
16939sizetype='$sizetype'
5f80c64f
JH
16940sleep='$sleep'
16941smail='$smail'
5f80c64f 16942so='$so'
b4eb6b3d
JH
16943sockethdr='$sockethdr'
16944socketlib='$socketlib'
16945socksizetype='$socksizetype'
5f80c64f
JH
16946sort='$sort'
16947spackage='$spackage'
16948spitshell='$spitshell'
5f80c64f 16949src='$src'
b4eb6b3d
JH
16950ssizetype='$ssizetype'
16951startperl='$startperl'
5f80c64f 16952startsh='$startsh'
b4eb6b3d
JH
16953static_ext='$static_ext'
16954stdchar='$stdchar'
16955stdio_base='$stdio_base'
16956stdio_bufsiz='$stdio_bufsiz'
16957stdio_cnt='$stdio_cnt'
16958stdio_filbuf='$stdio_filbuf'
16959stdio_ptr='$stdio_ptr'
16960stdio_stream_array='$stdio_stream_array'
16961strings='$strings'
5f80c64f 16962submit='$submit'
b4eb6b3d
JH
16963subversion='$subversion'
16964sysman='$sysman'
5f80c64f
JH
16965tail='$tail'
16966tar='$tar'
16967tbl='$tbl'
16968tee='$tee'
16969test='$test'
b4eb6b3d
JH
16970timeincl='$timeincl'
16971timetype='$timetype'
5f80c64f
JH
16972touch='$touch'
16973tr='$tr'
16974trnl='$trnl'
16975troff='$troff'
b4eb6b3d
JH
16976u16size='$u16size'
16977u16type='$u16type'
16978u32size='$u32size'
16979u32type='$u32type'
16980u64size='$u64size'
16981u64type='$u64type'
16982u8size='$u8size'
16983u8type='$u8type'
16984uidformat='$uidformat'
16985uidsign='$uidsign'
16986uidsize='$uidsize'
16987uidtype='$uidtype'
5f80c64f
JH
16988uname='$uname'
16989uniq='$uniq'
b4eb6b3d
JH
16990uquadtype='$uquadtype'
16991use5005threads='$use5005threads'
16992use64bitall='$use64bitall'
16993use64bitint='$use64bitint'
5f80c64f 16994usedl='$usedl'
b4eb6b3d
JH
16995useithreads='$useithreads'
16996uselargefiles='$uselargefiles'
16997uselongdouble='$uselongdouble'
16998usemorebits='$usemorebits'
16999usemultiplicity='$usemultiplicity'
17000usemymalloc='$usemymalloc'
5f80c64f 17001usenm='$usenm'
b4eb6b3d
JH
17002useopcode='$useopcode'
17003useperlio='$useperlio'
17004useposix='$useposix'
17005usesfio='$usesfio'
17006useshrplib='$useshrplib'
29209bc5 17007usesocks='$usesocks'
b4eb6b3d
JH
17008usethreads='$usethreads'
17009usevendorprefix='$usevendorprefix'
17010usevfork='$usevfork'
5f80c64f
JH
17011usrinc='$usrinc'
17012uuname='$uuname'
b4eb6b3d
JH
17013uvXUformat='$uvXUformat'
17014uvoformat='$uvoformat'
17015uvsize='$uvsize'
17016uvtype='$uvtype'
17017uvuformat='$uvuformat'
17018uvxformat='$uvxformat'
17019vendorarch='$vendorarch'
17020vendorarchexp='$vendorarchexp'
17021vendorbin='$vendorbin'
17022vendorbinexp='$vendorbinexp'
17023vendorlib='$vendorlib'
17024vendorlib_stem='$vendorlib_stem'
17025vendorlibexp='$vendorlibexp'
17026vendorprefix='$vendorprefix'
17027vendorprefixexp='$vendorprefixexp'
17028version='$version'
d56c5707 17029versiononly='$versiononly'
5f80c64f 17030vi='$vi'
b4eb6b3d 17031voidflags='$voidflags'
5f80c64f 17032xlibpth='$xlibpth'
b4eb6b3d 17033xs_apiversion='$xs_apiversion'
3659ebf1
JH
17034yacc='$yacc'
17035yaccflags='$yaccflags'
5f80c64f
JH
17036zcat='$zcat'
17037zip='$zip'
17038EOT
17039
17040: Add in command line options if available
17041$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
17042
17043: add special variables
17044$test -f $src/patchlevel.h && \
d00b958f 17045awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 17046echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 17047echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
17048
17049: propagate old symbols
17050if $test -f UU/config.sh; then
381aa1ff 17051 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 17052 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 17053 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
17054 set X `cat UU/oldsyms`
17055 shift
17056 case $# in
17057 0) ;;
17058 *)
17059 cat <<EOM
17060Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
17061EOM
17062 echo "# Variables propagated from previous config.sh file." >>config.sh
17063 for sym in `cat UU/oldsyms`; do
17064 echo " Propagating $hint variable "'$'"$sym..."
17065 eval 'tmp="$'"${sym}"'"'
17066 echo "$tmp" | \
17067 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
17068 done
17069 ;;
17070 esac
17071fi
17072
17073: Finish up by extracting the .SH files
17074case "$alldone" in
17075exit)
17076 $rm -rf UU
24ccb310 17077 echo "Extraction done."
5f80c64f
JH
17078 exit 0
17079 ;;
17080cont)
17081 ;;
17082'')
17083 dflt=''
17084 nostick=true
17085 $cat <<EOM
17086
17087If you'd like to make any changes to the config.sh file before I begin
17088to configure things, do it as a shell escape now (e.g. !vi config.sh).
17089
17090EOM
17091 rp="Press return or use a shell escape to edit config.sh:"
17092 . UU/myread
17093 nostick=''
17094 case "$ans" in
17095 '') ;;
17096 *) : in case they cannot read
17097 sh 1>&4 -c "$ans";;
17098 esac
17099 ;;
17100esac
17101
17102: if this fails, just run all the .SH files by hand
17103. ./config.sh
17104
17105echo " "
17106exec 1>&4
17107. ./UU/extract
17108
17109if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
17110 dflt=y
17111 case "$silent" in
17112 true) ;;
17113 *)
17114 $cat <<EOM
17115
17116Now you need to generate make dependencies by running "$make depend".
17117You might prefer to run it in background: "$make depend > makedepend.out &"
17118It can take a while, so you might not want to run it right now.
17119
17120EOM
17121 ;;
17122 esac
17123 rp="Run $make depend now?"
17124 . UU/myread
17125 case "$ans" in
17126 y*)
3d5d58b1 17127 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
17128 ;;
17129 *)
17130 echo "You must run '$make depend' then '$make'."
17131 ;;
17132 esac
17133elif test -f [Mm]akefile; then
17134 echo " "
17135 echo "Now you must run a $make."
17136else
24ccb310 17137 echo "Configure done."
5f80c64f
JH
17138fi
17139
17140if $test -f Policy.sh; then
17141 $cat <<EOM
17142
17143If you compile $package on a different machine or from a different object
17144directory, copy the Policy.sh file from this object directory to the
17145new one before you run Configure -- this will help you with most of
17146the policy defaults.
17147
17148EOM
17149fi
17150if $test -f config.msg; then
17151 echo "Hmm. I also noted the following information while running:"
17152 echo " "
17153 $cat config.msg >&4
17154 $rm -f config.msg
17155fi
17156$rm -f kit*isdone ark*isdone
17157$rm -rf UU
17158
17159: End of Configure
17160