This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate perlio:
[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#
e67aeab1 23# Generated on Fri Jun 8 18:06:31 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=''
e67aeab1 453d_modfl_pow32_bug=''
b4eb6b3d
JH
454d_mprotect=''
455d_msg=''
456d_msgctl=''
457d_msgget=''
4e0554ec 458d_msghdr_s=''
b4eb6b3d
JH
459d_msgrcv=''
460d_msgsnd=''
461d_msync=''
462d_munmap=''
463d_nice=''
464d_off64_t=''
465d_open3=''
466d_fpathconf=''
467d_pathconf=''
468d_pause=''
469d_pipe=''
470d_poll=''
2304df62 471d_portable=''
b4eb6b3d
JH
472d_old_pthread_create_joinable=''
473old_pthread_create_joinable=''
474d_pthread_yield=''
475d_sched_yield=''
476sched_yield=''
477d_qgcvt=''
478d_readdir=''
479d_rewinddir=''
480d_seekdir=''
481d_telldir=''
482d_readlink=''
4e0554ec 483d_readv=''
640374d0 484d_realpath=''
4e0554ec 485d_recvmsg=''
b4eb6b3d
JH
486d_rename=''
487d_rmdir=''
488d_safebcpy=''
489d_safemcpy=''
490d_sanemcmp=''
ef9f17be 491d_sbrkproto=''
b4eb6b3d
JH
492d_select=''
493d_sem=''
494d_semctl=''
495d_semget=''
496d_semop=''
4e0554ec 497d_sendmsg=''
b4eb6b3d
JH
498d_setegid=''
499d_seteuid=''
500d_setgrent=''
501d_setgrps=''
502d_sethent=''
4e0554ec 503d_setitimer=''
b4eb6b3d
JH
504d_setlinebuf=''
505d_setlocale=''
506d_setnent=''
507d_setpent=''
508d_setpgid=''
509d_setpgrp2=''
510d_bsdsetpgrp=''
511d_setpgrp=''
512d_setprior=''
513d_setproctitle=''
514d_setpwent=''
515d_setregid=''
516d_setresgid=''
517d_setresuid=''
518d_setreuid=''
519d_setrgid=''
520d_setruid=''
521d_setsent=''
522d_setsid=''
523d_setvbuf=''
524d_sfio=''
525usesfio=''
526d_shm=''
527d_shmat=''
528d_shmatprototype=''
529shmattype=''
530d_shmctl=''
531d_shmdt=''
532d_shmget=''
533d_sigaction=''
983dbef6 534d_sigprocmask=''
b4eb6b3d 535d_sigsetjmp=''
49a78c82 536d_sockatmark=''
2ef53570 537d_sockatmarkproto=''
b4eb6b3d
JH
538d_msg_ctrunc=''
539d_msg_dontroute=''
540d_msg_oob=''
541d_msg_peek=''
542d_msg_proxy=''
543d_oldsock=''
544d_scm_rights=''
545d_socket=''
546d_sockpair=''
547sockethdr=''
548socketlib=''
549d_socklen_t=''
550d_socks5_init=''
551d_sqrtl=''
eef837ea 552d_sresgproto=''
640374d0 553d_sresuproto=''
b4eb6b3d
JH
554d_statblks=''
555d_statfs_f_flags=''
556d_statfs_s=''
557d_fstatvfs=''
558d_statvfs=''
559d_stdio_cnt_lval=''
560d_stdio_ptr_lval=''
a7ffa9b9
NC
561d_stdio_ptr_lval_nochange_cnt=''
562d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
563d_stdiobase=''
564d_stdstdio=''
565stdio_base=''
566stdio_bufsiz=''
567stdio_cnt=''
568stdio_filbuf=''
569stdio_ptr=''
570d_index=''
571d_strchr=''
572d_strcoll=''
573d_strctcpy=''
574d_strerrm=''
575d_strerror=''
576d_sysernlst=''
577d_syserrlst=''
b3c85772 578d_strftime=''
b4eb6b3d
JH
579d_strtod=''
580d_strtol=''
581d_strtold=''
582d_strtoll=''
28e5dec8 583d_strtoq=''
b4eb6b3d
JH
584d_strtoul=''
585d_strtoull=''
586d_strtouq=''
587d_strxfrm=''
588d_symlink=''
589d_syscall=''
2ef53570 590d_syscallproto=''
b4eb6b3d
JH
591d_sysconf=''
592d_system=''
593d_tcgetpgrp=''
594d_tcsetpgrp=''
595d_telldirproto=''
596d_time=''
597timetype=''
598clocktype=''
599d_times=''
600d_truncate=''
601d_tzname=''
4e0554ec
JH
602d_u32align=''
603d_ualarm=''
b4eb6b3d
JH
604d_umask=''
605d_semctl_semid_ds=''
606d_semctl_semun=''
607d_union_semun=''
4e0554ec 608d_usleep=''
2ef53570 609d_usleepproto=''
b4eb6b3d
JH
610d_ustat=''
611d_vfork=''
612usevfork=''
613d_voidsig=''
614signal_t=''
615d_volatile=''
616d_charvspr=''
617d_vprintf=''
618d_wait4=''
619d_waitpid=''
620d_wcstombs=''
621d_wctomb=''
4e0554ec 622d_writev=''
b4eb6b3d 623dlext=''
85e6fe83
LW
624cccdlflags=''
625ccdlflags=''
2304df62 626dlsrc=''
232e078e 627ld=''
85e6fe83 628lddlflags=''
2304df62 629usedl=''
b4eb6b3d
JH
630doublesize=''
631ebcdic=''
632fflushNULL=''
633fflushall=''
634fpossize=''
635fpostype=''
5b463ca7 636gccosandvers=''
8a27cf78 637gccversion=''
b4eb6b3d
JH
638gidformat=''
639gidsign=''
640gidsize=''
641gidtype=''
642groupstype=''
643h_fcntl=''
644h_sysfile=''
645i_arpainet=''
646db_hashtype=''
647db_prefixtype=''
640374d0
JH
648db_version_major=''
649db_version_minor=''
650db_version_patch=''
b4eb6b3d
JH
651i_db=''
652i_dbm=''
653i_rpcsvcdbm=''
654d_dirnamlen=''
655direntrytype=''
656i_dirent=''
a0d0e21e 657i_dld=''
b4eb6b3d
JH
658i_dlfcn=''
659i_fcntl=''
660i_float=''
661i_gdbm=''
662d_grpasswd=''
663i_grp=''
664i_iconv=''
665i_ieeefp=''
666i_inttypes=''
667i_libutil=''
668i_limits=''
669i_locale=''
670i_machcthr=''
671i_malloc=''
672i_math=''
673i_memory=''
674i_mntent=''
675i_ndbm=''
676i_netdb=''
677i_neterrno=''
678i_netinettcp=''
679i_niin=''
680i_sysin=''
681i_poll=''
682i_prot=''
683i_pthread=''
684d_pwage=''
685d_pwchange=''
686d_pwclass=''
687d_pwcomment=''
688d_pwexpire=''
689d_pwgecos=''
690d_pwpasswd=''
691d_pwquota=''
692i_pwd=''
693i_sfio=''
694i_shadow=''
695i_socks=''
696i_stddef=''
697i_stdlib=''
698i_string=''
699strings=''
700i_sunmath=''
701i_sysaccess=''
702i_sysdir=''
703i_sysfile=''
704d_voidtty=''
705i_bsdioctl=''
706i_sysfilio=''
707i_sysioctl=''
708i_syssockio=''
709i_syslog=''
710i_sysmman=''
711i_sysmode=''
712i_sysmount=''
713i_sysndir=''
714i_sysparam=''
715i_sysresrc=''
716i_syssecrt=''
717i_sysselct=''
718i_sysstat=''
719i_sysstatfs=''
720i_sysstatvfs=''
721i_systimes=''
722i_systypes=''
723i_sysuio=''
724i_sysun=''
725i_sysutsname=''
726i_sysvfs=''
727i_syswait=''
728i_sgtty=''
729i_termio=''
730i_termios=''
731i_systime=''
732i_systimek=''
733i_time=''
734timeincl=''
735i_unistd=''
736i_ustat=''
737i_utime=''
738i_values=''
739i_stdarg=''
740i_varargs=''
741i_varhdr=''
742i_vfork=''
743inc_version_list=''
744inc_version_list_init=''
745installprefix=''
746installprefixexp=''
747installstyle=''
748installusrbinperl=''
749intsize=''
750longsize=''
751shortsize=''
4b661809 752issymlink=''
2304df62 753libc=''
b4eb6b3d
JH
754ldlibpthname=''
755libperl=''
756shrpenv=''
757useshrplib=''
a0d0e21e 758glibpth=''
2304df62 759libpth=''
8e07c86e 760loclibpth=''
2304df62
AD
761plibpth=''
762xlibpth=''
1cfa4ec7 763ignore_versioned_solibs=''
2304df62 764libs=''
43999f95
JH
765libsdirs=''
766libsfiles=''
767libsfound=''
13b3f787 768libspath=''
85e6fe83 769lns=''
b4eb6b3d
JH
770d_PRIEUldbl=''
771d_PRIFUldbl=''
772d_PRIGUldbl=''
773d_PRIeldbl=''
774d_PRIfldbl=''
775d_PRIgldbl=''
776d_SCNfldbl=''
777sPRIEUldbl=''
778sPRIFUldbl=''
779sPRIGUldbl=''
780sPRIeldbl=''
781sPRIfldbl=''
782sPRIgldbl=''
783sSCNfldbl=''
784lseeksize=''
785lseektype=''
8ff267be 786make_set_make=''
b4eb6b3d
JH
787d_mymalloc=''
788freetype=''
789mallocobj=''
790mallocsrc=''
791malloctype=''
792usemymalloc=''
793installman1dir=''
794man1dir=''
795man1direxp=''
796man1ext=''
797installman3dir=''
798man3dir=''
799man3direxp=''
800man3ext=''
801modetype=''
802multiarch=''
803mydomain=''
804myhostname=''
805phostname=''
2304df62
AD
806c=''
807n=''
b4eb6b3d
JH
808d_eofnblk=''
809eagain=''
810o_nonblock=''
811rd_nodata=''
2cc61e15 812need_va_copy=''
b4eb6b3d
JH
813netdb_hlen_type=''
814netdb_host_type=''
815netdb_name_type=''
816netdb_net_type=''
817groupcat=''
818hostcat=''
819passcat=''
820orderlib=''
821ranlib=''
822d_perl_otherlibdirs=''
823otherlibdirs=''
2304df62
AD
824package=''
825spackage=''
b4eb6b3d
JH
826pager=''
827api_revision=''
828api_subversion=''
829api_version=''
830api_versionstring=''
831patchlevel=''
151e6568 832perl_patchlevel=''
b4eb6b3d
JH
833revision=''
834subversion=''
835version=''
836perl5=''
837perladmin=''
838perlpath=''
839d_nv_preserves_uv=''
840d_nv_preserves_uv_bits=''
841i16size=''
842i16type=''
843i32size=''
844i32type=''
845i64size=''
846i64type=''
847i8size=''
848i8type=''
849ivsize=''
850ivtype=''
851nvsize=''
852nvtype=''
853u16size=''
854u16type=''
855u32size=''
856u32type=''
857u64size=''
858u64type=''
859u8size=''
860u8type=''
861uvsize=''
862uvtype=''
863ivdformat=''
864nvEUformat=''
865nvFUformat=''
866nvGUformat=''
867nveformat=''
868nvfformat=''
869nvgformat=''
870uvXUformat=''
871uvoformat=''
872uvuformat=''
873uvxformat=''
874pidtype=''
875prefix=''
876prefixexp=''
877installprivlib=''
878privlib=''
879privlibexp=''
880prototype=''
881ptrsize=''
882d_PRIXU64=''
883d_PRId64=''
884d_PRIi64=''
885d_PRIo64=''
886d_PRIu64=''
887d_PRIx64=''
888sPRIXU64=''
889sPRId64=''
890sPRIi64=''
891sPRIo64=''
892sPRIu64=''
893sPRIx64=''
894d_quad=''
895quadkind=''
896quadtype=''
897uquadtype=''
898drand01=''
899randbits=''
900randfunc=''
901randseedtype=''
902seedfunc=''
903installscript=''
904scriptdir=''
905scriptdirexp=''
906selectminbits=''
907selecttype=''
8ff267be 908sh=''
b4eb6b3d
JH
909sig_count=''
910sig_name=''
911sig_name_init=''
912sig_num=''
913sig_num_init=''
76d3c696 914sig_size=''
b4eb6b3d
JH
915installsitearch=''
916sitearch=''
917sitearchexp=''
918installsitebin=''
919sitebin=''
920sitebinexp=''
921installsitelib=''
922sitelib=''
923sitelib_stem=''
924sitelibexp=''
925siteprefix=''
926siteprefixexp=''
927sizesize=''
928sizetype=''
a0d0e21e 929so=''
b4eb6b3d 930socksizetype=''
2304df62
AD
931sharpbang=''
932shsharp=''
933spitshell=''
dfe9444c 934src=''
b4eb6b3d
JH
935ssizetype=''
936startperl=''
2304df62 937startsh=''
b4eb6b3d
JH
938stdchar=''
939d_stdio_stream_array=''
940stdio_stream_array=''
941sysman=''
5ff3f7a4 942trnl=''
b4eb6b3d
JH
943uidformat=''
944uidsign=''
945uidsize=''
946uidtype=''
947archname64=''
948use64bitall=''
949use64bitint=''
950ccflags_uselargefiles=''
951ldflags_uselargefiles=''
952libswanted_uselargefiles=''
953uselargefiles=''
954uselongdouble=''
955usemorebits=''
956usemultiplicity=''
2304df62 957nm_opt=''
40a7a20a 958nm_so_opt=''
2304df62
AD
959runnm=''
960usenm=''
b4eb6b3d 961useperlio=''
29209bc5 962usesocks=''
b4eb6b3d
JH
963d_oldpthreads=''
964use5005threads=''
965useithreads=''
966usethreads=''
2304df62 967incpath=''
2304df62
AD
968mips_type=''
969usrinc=''
b4eb6b3d
JH
970d_vendorarch=''
971installvendorarch=''
972vendorarch=''
973vendorarchexp=''
974d_vendorbin=''
975installvendorbin=''
976vendorbin=''
977vendorbinexp=''
978d_vendorlib=''
979installvendorlib=''
980vendorlib=''
981vendorlib_stem=''
982vendorlibexp=''
983usevendorprefix=''
984vendorprefix=''
985vendorprefixexp=''
d56c5707 986versiononly=''
b4eb6b3d
JH
987defvoidused=''
988voidflags=''
989pm_apiversion=''
990xs_apiversion=''
3659ebf1
JH
991yacc=''
992yaccflags=''
2304df62
AD
993CONFIG=''
994
ecfc5424
AD
995define='define'
996undef='undef'
997smallmach='pdp11 i8086 z8000 i80286 iAPX286'
998rmlist=''
999
1000: We must find out about Eunice early
1001eunicefix=':'
1002if test -f /etc/unixtovms; then
1003 eunicefix=/etc/unixtovms
1004fi
1005if test -f /etc/unixtovms.exe; then
1006 eunicefix=/etc/unixtovms.exe
1007fi
1008
b4eb6b3d 1009i_whoami=''
6b356c8e
JH
1010ccname=''
1011ccversion=''
9c839522 1012perllibs=''
b4eb6b3d
JH
1013: set useposix=false in your hint file to disable the POSIX extension.
1014useposix=true
1015: set useopcode=false in your hint file to disable the Opcode extension.
1016useopcode=true
dfe9444c 1017: Trailing extension. Override this in a hint file, if needed.
4e2a5f63 1018_exe=''
dfe9444c
AD
1019: Extra object files, if any, needed on this platform.
1020archobjs=''
b4eb6b3d 1021archname=''
ff935051
JH
1022: Possible local include directories to search.
1023: Set locincpth to "" in a hint file to defeat local include searches.
1024locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1025locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1026:
1027: no include file wanted by default
1028inclwanted=''
1029
b4eb6b3d 1030groupstype=''
732c9516
JH
1031: change the next line if compiling for Xenix/286 on Xenix/386
1032xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1033: Possible local library directories to search.
1034loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1035loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1036
1037: general looking path for locating libraries
5869b1f1 1038glibpth="/lib /usr/lib $xlibpth"
732c9516 1039glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1040test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1041test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1042
1043: Private path used by Configure to find libraries. Its value
1044: is prepended to libpth. This variable takes care of special
1045: machines, like the mips. Usually, it should be empty.
1046plibpth=''
1047
1cfa4ec7
GS
1048: default library list
1049libswanted=''
921b2963 1050: some systems want to use only the non-versioned libso:s
1cfa4ec7 1051ignore_versioned_solibs=''
b4eb6b3d
JH
1052archname64=''
1053ccflags_uselargefiles=''
1054ldflags_uselargefiles=''
1055libswanted_uselargefiles=''
1056: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1057: set usesocks on the Configure command line to enable socks.
b4eb6b3d
JH
1058: set usethreads on the Configure command line to enable threads.
1059: full support for void wanted by default
1060defvoidused=15
1061
ecfc5424 1062: List of libraries we want.
693762b4 1063: If anyone needs -lnet, put it in a hint file.
997d70a2 1064libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
69e84d1d 1065libswanted="$libswanted dld ld sun m c cposix posix"
f1066039 1066libswanted="$libswanted ndir dir crypt sec"
0c9177ab 1067libswanted="$libswanted ucb bsd BSD PW x iconv util"
1aef975c 1068: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1069: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1070glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1071glibpth="/usr/shlib $glibpth"
1072: Do not use vfork unless overridden by a hint file.
1073usevfork=false
1074
8ff267be 1075: Find the basic shell for Bourne shell scripts
1076case "$sh" in
1077'')
8ff267be 1078 case "$SYSTYPE" in
1079 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1080 *) xxx='/bin/sh';;
1081 esac
1082 if test -f "$xxx"; then
1083 sh="$xxx"
1084 else
1085 : Build up a list and do a single loop so we can 'break' out.
1086 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1087 for xxx in sh bash ksh pdksh ash; do
1088 for p in $pth; do
1089 try="$try ${p}/${xxx}"
1090 done
1091 done
1092 for xxx in $try; do
1093 if test -f "$xxx"; then
1094 sh="$xxx";
8ff267be 1095 break
1096 elif test -f "$xxx.exe"; then
1097 sh="$xxx";
8ff267be 1098 break
1099 fi
1100 done
1101 fi
1102 ;;
1103esac
1104
1105case "$sh" in
1106'') cat <<EOM >&2
1107$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1108
8ff267be 1109Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1110Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1111we'll try to straighten this all out.
8ff267be 1112EOM
1113 exit 1
1114 ;;
1115esac
1116
760ac839 1117: see if sh knows # comments
73614538 1118if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1119 shsharp=true
1120 spitshell=cat
760ac839
LW
1121 xcat=/bin/cat
1122 test -f $xcat || xcat=/usr/bin/cat
1123 echo "#!$xcat" >try
1124 $eunicefix try
1125 chmod +x try
1126 ./try > today
1127 if test -s today; then
760ac839
LW
1128 sharpbang='#!'
1129 else
1130 echo "#! $xcat" > try
1131 $eunicefix try
1132 chmod +x try
1133 ./try > today
1134 if test -s today; then
760ac839
LW
1135 sharpbang='#! '
1136 else
760ac839
LW
1137 sharpbang=': use '
1138 fi
1139 fi
1140else
dfe9444c 1141 echo " "
8ff267be 1142 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1143 shsharp=false
1144 cd ..
1145 echo "exec grep -v '^[ ]*#'" >spitshell
1146 chmod +x spitshell
1147 $eunicefix spitshell
1148 spitshell=`pwd`/spitshell
1149 cd UU
1150 echo "I presume that if # doesn't work, #! won't work either!"
1151 sharpbang=': use '
1152fi
1153rm -f try today
1154
1155: figure out how to guarantee sh startup
8ff267be 1156case "$startsh" in
1157'') startsh=${sharpbang}${sh} ;;
1158*)
760ac839 1159esac
760ac839
LW
1160cat >try <<EOSS
1161$startsh
1162set abc
1163test "$?abc" != 1
1164EOSS
1165
1166chmod +x try
1167$eunicefix try
1168if ./try; then
8ff267be 1169 : echo "Yup, it does."
760ac839 1170else
dfe9444c
AD
1171 echo "Hmm... '$startsh' does not guarantee sh startup..."
1172 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839
LW
1173fi
1174rm -f try
1175
aebf16e7
AD
1176
1177: Save command line options in file UU/cmdline.opt for later use in
1178: generating config.sh.
1179cat > cmdline.opt <<EOSH
1180# Configure command line arguments.
1181config_arg0='$0'
1182config_args='$*'
1183config_argc=$#
1184EOSH
1185argn=1
1186for arg in "$@"; do
1187 cat >>cmdline.opt <<EOSH
1188config_arg$argn='$arg'
1189EOSH
1190 argn=`expr $argn + 1`
1191done
1192
2304df62
AD
1193: produce awk script to parse command line options
1194cat >options.awk <<'EOF'
1195BEGIN {
02e93a22 1196 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1197
1198 len = length(optstr);
1199 for (i = 1; i <= len; i++) {
1200 c = substr(optstr, i, 1);
1201 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1202 if (a == ":") {
1203 arg[c] = 1;
1204 i++;
1205 }
1206 opt[c] = 1;
1207 }
1208}
1209{
1210 expect = 0;
1211 str = $0;
1212 if (substr(str, 1, 1) != "-") {
1213 printf("'%s'\n", str);
1214 next;
1215 }
1216 len = length($0);
1217 for (i = 2; i <= len; i++) {
1218 c = substr(str, i, 1);
1219 if (!opt[c]) {
1220 printf("-%s\n", substr(str, i));
1221 next;
1222 }
1223 printf("-%s\n", c);
1224 if (arg[c]) {
1225 if (i < len)
1226 printf("'%s'\n", substr(str, i + 1));
1227 else
1228 expect = 1;
1229 next;
1230 }
1231 }
1232}
1233END {
1234 if (expect)
1235 print "?";
1236}
1237EOF
1238
1239: process the command line options
4633a7c4
LW
1240set X `for arg in "$@"; do echo "X$arg"; done |
1241 sed -e s/X// | awk -f options.awk`
2304df62
AD
1242eval "set $*"
1243shift
1244rm -f options.awk
1245
1246: set up default values
1247fastread=''
1248reuseval=false
1249config_sh=''
1250alldone=''
1251error=''
1252silent=''
1253extractsh=''
ecfc5424 1254override=''
16d20bd9 1255knowitall=''
02e93a22 1256rm -f optdef.sh posthint.sh
28757baa 1257cat >optdef.sh <<EOS
1258$startsh
1259EOS
2304df62 1260
dfe9444c 1261
2304df62
AD
1262: option parsing
1263while test $# -gt 0; do
1264 case "$1" in
1265 -d) shift; fastread=yes;;
1266 -e) shift; alldone=cont;;
1267 -f)
1268 shift
1269 cd ..
1270 if test -r "$1"; then
1271 config_sh="$1"
1272 else
a0d0e21e 1273 echo "$me: cannot read config file $1." >&2
2304df62
AD
1274 error=true
1275 fi
1276 cd UU
1277 shift;;
1278 -h) shift; error=true;;
1279 -r) shift; reuseval=true;;
dfe9444c 1280 -s) shift; silent=true; realsilent=true;;
2304df62 1281 -E) shift; alldone=exit;;
16d20bd9 1282 -K) shift; knowitall=true;;
ecfc5424 1283 -O) shift; override=true;;
dfe9444c 1284 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1285 -D)
1286 shift
1287 case "$1" in
1288 *=)
1289 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1290 echo "$me: ignoring -D $1" >&2
1291 ;;
ecfc5424 1292 *=*) echo "$1" | \
1aef975c
AD
1293 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1294 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1295 esac
1296 shift
1297 ;;
1298 -U)
1299 shift
1300 case "$1" in
1aef975c 1301 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1302 *=*)
1303 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1304 echo "$me: ignoring -U $1" >&2
1305 ;;
1aef975c 1306 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1307 esac
1308 shift
1309 ;;
02e93a22
JH
1310 -A)
1311 shift
1312 xxx=''
1313 yyy="$1"
02e93a22 1314 zzz=''
5f83a3e9 1315 uuu=undef
02e93a22 1316 case "$yyy" in
5f83a3e9
JH
1317 *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1318 case "$zzz" in
1319 *:*) zzz='' ;;
1320 *) xxx=append
1321 zzz=" "`echo $yyy|sed 's!^[^=]*=!!'`
1322 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1323 esac
1324 ;;
1325 esac
1326 case "$xxx" in
1327 '') case "$yyy" in
1328 *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1329 yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1330 zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1331 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1332 *) xxx=`echo $yyy|sed 's!:.*!!'`
1333 yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1334 esac
1335 ;;
1336 esac
02e93a22
JH
1337 case "$xxx" in
1338 append)
5f83a3e9 1339 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1340 clear)
5f83a3e9 1341 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1342 define)
1343 case "$zzz" in
1344 '') zzz=define ;;
1345 esac
5f83a3e9 1346 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1347 eval)
5f83a3e9 1348 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1349 prepend)
5f83a3e9 1350 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1351 undef)
1352 case "$zzz" in
1353 '') zzz="$uuu" ;;
1354 esac
5f83a3e9
JH
1355 echo "$yyy=$zzz" >> posthint.sh ;;
1356 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1357 esac
bde6b06b 1358 shift
02e93a22 1359 ;;
dfe9444c 1360 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1361 exit 0;;
2304df62 1362 --) break;;
a0d0e21e 1363 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1364 *) break;;
1365 esac
1366done
1367
1368case "$error" in
1369true)
1370 cat >&2 <<EOM
2afac517 1371Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1372 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1373 -d : use defaults for all answers.
1374 -e : go on without questioning past the production of config.sh.
1375 -f : specify an alternate default configuration file.
1376 -h : print this help message and exit (with an error status).
1377 -r : reuse C symbols value if possible (skips costly nm extraction).
1378 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1379 -D : define symbol to have some value:
1380 -D symbol symbol gets the value 'define'
1381 -D symbol=value symbol gets the value 'value'
2304df62 1382 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1383 -K : do not use unless you know what you are doing.
ecfc5424 1384 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1385 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1386 -U : undefine symbol:
1387 -U symbol symbol gets the value 'undef'
1388 -U symbol= symbol gets completely empty
02e93a22 1389 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1390 -A symbol=value append " "value to symbol
02e93a22
JH
1391 -A append:symbol=value append value to symbol
1392 -A define:symbol=value define symbol to have value
02e93a22
JH
1393 -A clear:symbol define symbol to be ''
1394 -A define:symbol define symbol to be 'define'
1395 -A eval:symbol=value define symbol to be eval of value
1396 -A prepend:symbol=value prepend value to symbol
1397 -A undef:symbol define symbol to be 'undef'
1398 -A undef:symbol= define symbol to be ''
2304df62
AD
1399 -V : print version number and exit (with a zero status).
1400EOM
1401 exit 1
1402 ;;
1403esac
1404
dfe9444c
AD
1405: Sanity checks
1406case "$fastread$alldone" in
1407yescont|yesexit) ;;
1408*)
aaeb8e51
GS
1409 case "$extractsh" in
1410 true) ;;
1411 *)
1412 if test ! -t 0; then
1413 echo "Say 'sh Configure', not 'sh <Configure'"
1414 exit 1
1415 fi
1416 ;;
1417 esac
dfe9444c
AD
1418 ;;
1419esac
1420
2304df62
AD
1421exec 4>&1
1422case "$silent" in
1423true) exec 1>/dev/null;;
1424esac
1425
ecfc5424 1426: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1427touch optdef.sh
1428. ./optdef.sh
02e93a22
JH
1429: create the posthint manipulation script and leave the file out there...
1430touch posthint.sh
a0d0e21e 1431
2304df62 1432: set package name
85e6fe83 1433package=perl5
b4eb6b3d
JH
1434first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1435last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1436case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1437ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1438*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1439esac
2304df62 1440
2304df62
AD
1441: Some greps do not return status, grrr.
1442echo "grimblepritz" >grimble
1443if grep blurfldyick grimble >/dev/null 2>&1 ; then
1444 contains=contains
1445elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1446 contains=grep
1447else
1448 contains=contains
1449fi
1450rm -f grimble
1451: the following should work in any shell
1452case "$contains" in
1453contains*)
1454 echo " "
1455 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1456 cat >contains <<'EOSS'
1457grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1458EOSS
1459chmod +x contains
1460esac
1461
dfe9444c
AD
1462: Find the path to the source tree
1463case "$src" in
1464'') case "$0" in
b233458b
JH
1465 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1466 case "$src" in
1467 /*) ;;
8504afb7 1468 .) ;;
b233458b
JH
1469 *) src=`cd ../$src && pwd` ;;
1470 esac
1471 ;;
dfe9444c
AD
1472 *) src='.';;
1473 esac;;
1474esac
1475case "$src" in
1476'') src=/
1477 rsrc=/
1478 ;;
1479/*) rsrc="$src";;
1480*) rsrc="../$src";;
1481esac
1482if test -f $rsrc/Configure && \
1483 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1484then
1485 : found it, so we are ok.
1486else
1487 rsrc=''
1488 for src in . .. ../.. ../../.. ../../../..; do
1489 if test -f ../$src/Configure && \
1490 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1491 then
1492 rsrc=../$src
1493 break
1494 fi
1495 done
1496fi
1497case "$rsrc" in
1498'')
1499 cat <<EOM >&4
1500
1501Sorry, I can't seem to locate the source dir for $package. Please start
1502Configure with an explicit path -- i.e. /some/path/Configure.
1503
1504EOM
1505 exit 1
1506 ;;
1507../.) rsrc='..';;
1508*)
1509 echo " "
1510 echo "Sources for $package found in \"$src\"." >&4
1511 ;;
1512esac
1513
1514: script used to extract .SH files with variable substitutions
1515cat >extract <<'EOS'
a02608de 1516PERL_CONFIG_SH=true
dfe9444c 1517echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1518if test -f MANIFEST; then
1519 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1520else
1521 echo "(Looking for .SH files under the source directory.)"
1522 set x `(cd $src; find . -name "*.SH" -print)`
1523fi
1524shift
1525case $# in
15260) set x `(cd $src; echo *.SH)`; shift;;
1527esac
1528if test ! -f $src/$1; then
1529 shift
1530fi
1531mkdir_p='
1532name=$1;
1533create="";
1534while test $name; do
1535 if test ! -d "$name"; then
1536 create="$name $create";
1537 name=`echo $name | sed -e "s|^[^/]*$||"`;
1538 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1539 else
1540 name="";
1541 fi;
1542done;
1543for file in $create; do
1544 mkdir $file;
1545done
1546'
1547for file in $*; do
1548 case "$src" in
1549 ".")
1550 case "$file" in
1551 */*)
1552 dir=`expr X$file : 'X\(.*\)/'`
1553 file=`expr X$file : 'X.*/\(.*\)'`
1554 (cd $dir && . ./$file)
1555 ;;
1556 *)
1557 . ./$file
1558 ;;
1559 esac
1560 ;;
1561 *)
1562 case "$file" in
1563 */*)
1564 dir=`expr X$file : 'X\(.*\)/'`
1565 file=`expr X$file : 'X.*/\(.*\)'`
1566 (set x $dir; shift; eval $mkdir_p)
1567 sh <$src/$dir/$file
1568 ;;
1569 *)
1570 sh <$src/$file
1571 ;;
1572 esac
1573 ;;
1574 esac
1575done
1576if test -f $src/config_h.SH; then
1577 if test ! -f config.h; then
1578 : oops, they left it out of MANIFEST, probably, so do it anyway.
1579 . $src/config_h.SH
1580 fi
1581fi
1582EOS
1583
1584: extract files and exit if asked to do so
1585case "$extractsh" in
1586true)
1587 case "$realsilent" in
1588 true) ;;
1589 *) exec 1>&4;;
1590 esac
1591 case "$config_sh" in
1592 '') config_sh='config.sh';;
1593 esac
1594 echo " "
1595 echo "Fetching answers from $config_sh..."
1596 cd ..
1597 . $config_sh
1598 test "$override" && . ./optdef.sh
1599 echo " "
1600 . UU/extract
1601 rm -rf UU
24ccb310 1602 echo "Extraction done."
dfe9444c
AD
1603 exit 0
1604 ;;
1605esac
1606
1607: Eunice requires " " instead of "", can you believe it
1608echo " "
1609: Here we go...
1610echo "Beginning of configuration questions for $package."
1611
1612trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1613
2304df62
AD
1614: first determine how to suppress newline on echo command
1615echo " "
1616echo "Checking echo to see how to suppress newlines..."
1617(echo "hi there\c" ; echo " ") >.echotmp
1618if $contains c .echotmp >/dev/null 2>&1 ; then
1619 echo "...using -n."
1620 n='-n'
1621 c=''
1622else
1623 cat <<'EOM'
1624...using \c
1625EOM
1626 n=''
1627 c='\c'
1628fi
1629echo $n "The star should be here-->$c"
1630echo '*'
1631rm -f .echotmp
1632
1633: Now test for existence of everything in MANIFEST
1634echo " "
dfe9444c 1635if test -f $rsrc/MANIFEST; then
2304df62 1636 echo "First let's make sure your kit is complete. Checking..." >&4
dfe9444c 1637 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
2304df62 1638 rm -f missing
dfe9444c 1639 tmppwd=`pwd`
2304df62 1640 for filelist in x??; do
dfe9444c 1641 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
2304df62
AD
1642 done
1643 if test -s missing; then
1644 cat missing >&4
1645 cat >&4 <<'EOM'
1646
1647THIS PACKAGE SEEMS TO BE INCOMPLETE.
1648
1649You have the option of continuing the configuration process, despite the
1650distinct possibility that your kit is damaged, by typing 'y'es. If you
1651do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1652and contact the author (perlbug@perl.org).
2304df62
AD
1653
1654EOM
1655 echo $n "Continue? [n] $c" >&4
1656 read ans
1657 case "$ans" in
1658 y*)
1659 echo "Continuing..." >&4
1660 rm -f missing
1661 ;;
1662 *)
1663 echo "ABORTING..." >&4
1664 kill $$
1665 ;;
1666 esac
1667 else
dfe9444c 1668 echo "Looks good..."
2304df62
AD
1669 fi
1670else
1671 echo "There is no MANIFEST file. I hope your kit is complete !"
1672fi
1673rm -f missing x??
1674
5ff3f7a4
GS
1675echo " "
1676: Find the appropriate value for a newline for tr
1677if test -n "$DJGPP"; then
1678 trnl='\012'
1679fi
1680if test X"$trnl" = X; then
1681 case "`echo foo|tr '\n' x 2>/dev/null`" in
1682 foox) trnl='\n' ;;
1683 esac
1684fi
1685if test X"$trnl" = X; then
1686 case "`echo foo|tr '\012' x 2>/dev/null`" in
1687 foox) trnl='\012' ;;
1688 esac
1689fi
1690if test X"$trnl" = X; then
1691 cat <<EOM >&2
1692
1693$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1694
1695EOM
1696 exit 1
1697fi
1698
2304df62
AD
1699: compute the number of columns on the terminal for proper question formatting
1700case "$COLUMNS" in
1701'') COLUMNS='80';;
1702esac
1703
1704: set up the echo used in my read
1705myecho="case \"\$xxxm\" in
1706'') echo $n \"\$rp $c\" >&4;;
1707*) case \"\$rp\" in
1708 '') echo $n \"[\$xxxm] $c\";;
1709 *)
1710 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1711 echo \"\$rp\" >&4
1712 echo $n \"[\$xxxm] $c\" >&4
1713 else
1714 echo $n \"\$rp [\$xxxm] $c\" >&4
1715 fi
1716 ;;
1717 esac;;
1718esac"
1719
1720: now set up to do reads with possible shell escape and default assignment
1721cat <<EOSC >myread
28757baa 1722$startsh
2304df62
AD
1723xxxm=\$dflt
1724$myecho
1725ans='!'
1726case "\$fastread" in
1727yes) case "\$dflt" in
1728 '') ;;
1729 *) ans='';
1730 case "\$silent-\$rp" in
1731 true-) ;;
1732 *) echo " " >&4;;
1733 esac;;
1734 esac;;
1735*) case "\$silent" in
1736 true) case "\$rp" in
1737 '') ans='';;
1738 esac;;
1739 esac;;
1740esac
1741while expr "X\$ans" : "X!" >/dev/null; do
1742 read answ
1743 set x \$xxxm
1744 shift
dfe9444c 1745 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1746 case "\$answ" in
dfe9444c
AD
1747 "!")
1748 sh 1>&4
1749 echo " "
1750 $myecho
1751 ;;
1752 !*)
1753 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1754 shift
1755 sh 1>&4 -c "\$*"
1756 echo " "
1757 $myecho
1758 ;;
2304df62
AD
1759 "\$ans")
1760 case "\$ans" in
ecfc5424
AD
1761 \\&*)
1762 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1763 shift
1764 case "\$1" in
1765 -d)
1766 fastread=yes
40a7a20a 1767 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1768 ;;
1769 -*)
40a7a20a 1770 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1771 ;;
1772 esac
1773 $myecho
1774 ans=!
1775 ;;
2304df62
AD
1776 esac;;
1777 *)
1778 case "\$aok" in
1779 y)
1780 echo "*** Substitution done -- please confirm."
1781 xxxm="\$ans"
c9795ab7 1782 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1783 xxxm="\$ans"
1784 ans=!
1785 ;;
1786 *)
1787 echo "*** Error -- try again."
1788 ans=!
1789 ;;
1790 esac
1791 $myecho
1792 ;;
1793 esac
1794 case "\$ans\$xxxm\$nostick" in
1795 '')
1796 ans=!
1797 $myecho
1798 ;;
1799 esac
1800done
1801case "\$ans" in
1802'') ans="\$xxxm";;
1803esac
1804EOSC
1805
1806: create .config dir to save info across Configure sessions
1807test -d ../.config || mkdir ../.config
1808cat >../.config/README <<EOF
1809This directory created by Configure to save information that should
dfe9444c 1810persist across sessions for $package.
2304df62
AD
1811
1812You may safely delete it if you wish.
1813EOF
1814
9507cadf 1815xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 1816case "$usedevel" in
0107c034 1817$define|true|[yY]*) ;;
9507cadf 1818*) case "$xversion" in
0107c034
JH
1819 *[13579])
1820 cat >&4 <<EOH
1821*** WHOA THERE!!! ***
1822
1823 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
1824 The version of this $package distribution is $xversion, that is, odd,
1825 (as opposed to even) and that signifies a development release.
3d5d58b1 1826 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
1827
1828 Do ***NOT*** install this into production use.
1829 Data corruption and crashes are possible.
1830
1831 It is most seriously suggested that you do not continue any further
1832 unless you want to help in developing and debugging Perl.
1833
6adc6a45
JH
1834 If you *still* want to build perl, you can answer 'y' now,
1835 or pass -Dusedevel to Configure.
1836
0107c034
JH
1837EOH
1838 rp='Do you really want to continue?'
1839 dflt='n'
1840 . ./myread
1841 case "$ans" in
8feeef0e
JH
1842 [yY]) echo >&4 "Okay, continuing."
1843 usedevel="$define" ;;
0107c034
JH
1844 *) echo >&4 "Okay, bye."
1845 exit 1
1846 ;;
1847 esac
1848 ;;
1849 esac
1850 ;;
1851esac
8feeef0e
JH
1852case "$usedevel" in
1853$define|true|[yY]*)
1854 case "$versiononly" in
1855 '') versiononly="$define" ;;
1856 esac
1857 case "$installusrbinperl" in
1858 '') installusrbinperl="$undef" ;;
1859 esac
1860 ;;
1861esac
0107c034 1862
2304df62
AD
1863: general instructions
1864needman=true
1865firsttime=true
760ac839 1866user=`(logname) 2>/dev/null`
dfe9444c
AD
1867case "$user" in
1868'') user=`whoami 2>&1`;;
760ac839 1869esac
2304df62
AD
1870if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1871 firsttime=false
1872 echo " "
1873 rp='Would you like to see the instructions?'
1874 dflt=n
1875 . ./myread
1876 case "$ans" in
1877 [yY]*) ;;
1878 *) needman=false;;
1879 esac
1880fi
1881if $needman; then
1882 cat <<EOH
4e2a5f63 1883
2304df62 1884This installation shell script will examine your system and ask you questions
a0d0e21e 1885to determine how the perl5 package should be installed. If you get
2304df62
AD
1886stuck on a question, you may use a ! shell escape to start a subshell or
1887execute a command. Many of the questions will have default answers in square
1888brackets; typing carriage return will give you the default.
1889
1890On some of the questions which ask for file or directory names you are allowed
1891to use the ~name construct to specify the login directory belonging to "name",
1892even if you don't have a shell which knows about that. Questions where this is
1893allowed will be marked "(~name ok)".
1894
1895EOH
1896 rp=''
1897 dflt='Type carriage return to continue'
1898 . ./myread
1899 cat <<'EOH'
1900
1901The prompter used in this script allows you to use shell variables and
1902backticks in your answers. You may use $1, $2, etc... to refer to the words
1903in the default answer, as if the default line was a set of arguments given to a
1904script shell. This means you may also use $* to repeat the whole default line,
1905so you do not have to re-type everything to add something to the default.
1906
1907Everytime there is a substitution, you will have to confirm. If there is an
1908error (e.g. an unmatched backtick), the default answer will remain unchanged
1909and you will be prompted again.
1910
1911If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1912the questions and use the computed defaults (or the previous answers if there
1913was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1914You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1915on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1916
1917EOH
1918 . ./myread
1919 cat <<EOH
1920
1921Much effort has been expended to ensure that this shell script will run on any
1922Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1923Configure and run it again. If you can't run Configure for some reason,
1924you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 1925have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
1926
1927This installation script affects things in two ways:
1928
19291) it may do direct variable substitutions on some of the files included
1930 in this kit.
19312) it builds a config.h file for inclusion in C programs. You may edit
1932 any of these files as the need arises after running this script.
1933
1934If you make a mistake on a question, there is no easy way to back up to it
1935currently. The easiest thing to do is to edit config.sh and rerun all the SH
1936files. Configure will offer to let you do this before it runs the SH files.
1937
1938EOH
1939 dflt='Type carriage return to continue'
1940 . ./myread
1941 case "$firsttime" in
1942 true) echo $user >>../.config/instruct;;
1943 esac
1944fi
1945
2304df62
AD
1946: find out where common programs are
1947echo " "
1948echo "Locating common programs..." >&4
1949cat <<EOSC >loc
1950$startsh
1951case \$# in
19520) exit 1;;
1953esac
1954thing=\$1
1955shift
1956dflt=\$1
1957shift
1958for dir in \$*; do
1959 case "\$thing" in
1960 .)
1961 if test -d \$dir/\$thing; then
1962 echo \$dir
1963 exit 0
1964 fi
1965 ;;
1966 *)
a0d0e21e 1967 for thisthing in \$dir/\$thing; do
ecfc5424 1968 : just loop through to pick last item
a0d0e21e 1969 done
25f94b33 1970 if test -f \$thisthing; then
a0d0e21e 1971 echo \$thisthing
2304df62
AD
1972 exit 0
1973 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
1974 if test -n "$DJGPP"; then
1975 echo \$dir/\$thing.exe
1976 else
1977 : on Eunice apparently
1978 echo \$dir/\$thing
1979 fi
2304df62
AD
1980 exit 0
1981 fi
1982 ;;
1983 esac
1984done
1985echo \$dflt
1986exit 1
1987EOSC
1988chmod +x loc
1989$eunicefix loc
1990loclist="
1991awk
1992cat
b4eb6b3d
JH
1993comm
1994cp
2304df62
AD
1995echo
1996expr
1997grep
a0d0e21e 1998ls
dfe9444c 1999make
b4eb6b3d 2000mkdir
2304df62
AD
2001rm
2002sed
b4eb6b3d 2003sort
85e6fe83 2004touch
2304df62 2005tr
b4eb6b3d 2006uniq
2304df62
AD
2007"
2008trylist="
2009Mcc
dfe9444c 2010ar
3659ebf1 2011bison
b4eb6b3d 2012byacc
2304df62 2013cpp
b4eb6b3d 2014csh
2304df62
AD
2015date
2016egrep
8ff267be 2017gzip
b4eb6b3d 2018less
8ff267be 2019ln
b4eb6b3d 2020more
693762b4 2021nm
b4eb6b3d
JH
2022nroff
2023pg
2304df62
AD
2024test
2025uname
8ff267be 2026zip
2304df62 2027"
8e07c86e 2028pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2029pth="$pth /lib /usr/lib"
2030for file in $loclist; do
dfe9444c
AD
2031 eval xxx=\$$file
2032 case "$xxx" in
2033 /*|?:[\\/]*)
2034 if test -f "$xxx"; then
2035 : ok
2036 else
2037 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2038 xxx=`./loc $file $file $pth`
2039 fi
2040 ;;
2041 '') xxx=`./loc $file $file $pth`;;
2042 *) xxx=`./loc $xxx $xxx $pth`;;
2043 esac
2304df62
AD
2044 eval $file=$xxx
2045 eval _$file=$xxx
2046 case "$xxx" in
2047 /*)
2048 echo $file is in $xxx.
2049 ;;
8e07c86e
AD
2050 ?:[\\/]*)
2051 echo $file is in $xxx.
2052 ;;
2304df62 2053 *)
25f94b33
AD
2054 echo "I don't know where '$file' is, and my life depends on it." >&4
2055 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2056 exit 1
2304df62
AD
2057 ;;
2058 esac
2059done
2060echo " "
2061echo "Don't worry if any of the following aren't found..."
2062say=offhand
2063for file in $trylist; do
dfe9444c
AD
2064 eval xxx=\$$file
2065 case "$xxx" in
2066 /*|?:[\\/]*)
2067 if test -f "$xxx"; then
2068 : ok
2069 else
2070 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2071 xxx=`./loc $file $file $pth`
2072 fi
2073 ;;
2074 '') xxx=`./loc $file $file $pth`;;
2075 *) xxx=`./loc $xxx $xxx $pth`;;
2076 esac
2304df62
AD
2077 eval $file=$xxx
2078 eval _$file=$xxx
2079 case "$xxx" in
2080 /*)
2081 echo $file is in $xxx.
2082 ;;
8e07c86e
AD
2083 ?:[\\/]*)
2084 echo $file is in $xxx.
2085 ;;
2304df62
AD
2086 *)
2087 echo "I don't see $file out there, $say."
2088 say=either
2089 ;;
2090 esac
2091done
2092case "$egrep" in
2093egrep)
2094 echo "Substituting grep for egrep."
2095 egrep=$grep
2096 ;;
2097esac
8ff267be 2098case "$ln" in
2099ln)
2100 echo "Substituting cp for ln."
2101 ln=$cp
2102 ;;
2103esac
2304df62
AD
2104case "$test" in
2105test)
2106 echo "Hopefully test is built into your sh."
2107 ;;
2108*)
73614538 2109 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2110 echo "Using the test built into your sh."
2304df62
AD
2111 test=test
2112 _test=test
2113 fi
2114 ;;
2115esac
2116case "$echo" in
2117echo)
2118 echo "Hopefully echo is built into your sh."
2119 ;;
2120'') ;;
2121*)
2122 echo " "
2123echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2124 $echo $n "hi there$c" >foo1
2125 echo $n "hi there$c" >foo2
2126 if cmp foo1 foo2 >/dev/null 2>&1; then
2127 echo "They are compatible. In fact, they may be identical."
2128 else
2129 case "$n" in
2130 '-n') n='' c='\c';;
2131 *) n='-n' c='';;
2132 esac
2133 cat <<FOO
2134They are not compatible! You are probably running ksh on a non-USG system.
2135I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2136have echo built in and we may have to run some Bourne shell scripts. That
2137means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2138
2139FOO
2140 $echo $n "The star should be here-->$c"
2141 $echo "*"
2142 fi
2143 $rm -f foo1 foo2
2144 ;;
2145esac
2146
2573c5f9
JH
2147cat <<EOS >checkcc
2148$startsh
2149EOS
2150cat <<'EOSC' >>checkcc
2151case "$cc" in
2152'') ;;
2153*) $rm -f try try.*
2154 $cat >try.c <<EOM
2155int main(int argc, char *argv[]) {
2156 return 0;
2157}
2158EOM
e4778687 2159 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2160 :
2161 else
2162 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2163 despair=yes
2164 trygcc=yes
2165 case "$cc" in
2166 *gcc*) trygcc=no ;;
2167 esac
2168 case "`$cc -v -c try.c 2>&1`" in
2169 *gcc*) trygcc=no ;;
2170 esac
2171 if $test X"$trygcc" = Xyes; then
2172 if gcc -o try -c try.c; then
2173 echo " "
2174 echo "You seem to have a working gcc, though." >&4
2175 rp="Would you like to use it?"
2176 dflt=y
2177 if $test -f myread; then
2178 . ./myread
2179 else
2180 if $test -f UU/myread; then
2181 . ./UU/myread
2182 else
2183 echo "Cannot find myread, sorry. Aborting." >&2
2184 exit 1
2185 fi
2186 fi
2187 case "$ans" in
e723fc21 2188 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2573c5f9
JH
2189 esac
2190 fi
2191 fi
2192 if $test X"$despair" = Xyes; then
5dd4fbdf
MB
2193 $cat >&4 <<EOM
2194You need to find a working C compiler.
2195Either (purchase and) install the C compiler supplied by your OS vendor,
2196or for a free C compiler try http://gcc.gnu.org/
2197I cannot continue any further, aborting.
2198EOM
2573c5f9
JH
2199 exit 1
2200 fi
2201 fi
2202 $rm -f try try.*
2203 ;;
2204esac
2205EOSC
2206
a0d0e21e
LW
2207: determine whether symbolic links are supported
2208echo " "
2209$touch blurfl
2210if $ln -s blurfl sym > /dev/null 2>&1 ; then
2211 echo "Symbolic links are supported." >&4
2212 lns="$ln -s"
2213else
2214 echo "Symbolic links are NOT supported." >&4
2215 lns="$ln"
2216fi
2217$rm -f blurfl sym
2218
dafca956
JH
2219: determine whether symbolic links are supported
2220echo " "
2221case "$lns" in
2222*"ln -s")
2223 echo "Checking how to test for symbolic links..." >&4
2224 $lns blurfl sym
4b661809 2225 if $test "X$issymlink" = X; then
73614538 2226 sh -c "PATH= test -h sym" >/dev/null 2>&1
5d644a95
MB
2227 if test $? = 0; then
2228 issymlink="test -h"
2229 fi
2230 fi
2231 if $test "X$issymlink" = X; then
73614538 2232 if $test -h >/dev/null 2>&1; then
5d644a95
MB
2233 issymlink="$test -h"
2234 echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2235 fi
dafca956 2236 fi
4b661809 2237 if $test "X$issymlink" = X; then
dafca956 2238 if $test -L sym 2>/dev/null; then
5d644a95 2239 issymlink="$test -L"
dafca956
JH
2240 fi
2241 fi
4b661809 2242 if $test "X$issymlink" != X; then
5d644a95 2243 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2244 else
2245 echo "I do not know how you can test for symbolic links." >&4
2246 fi
2247 $rm -f blurfl sym
2248 ;;
2249*) echo "No symbolic links, so not testing for their testing..." >&4
2250 ;;
2251esac
2252echo " "
2253
2254
2255case "$mksymlinks" in
2256$define|true|[yY]*)
2257 case "$src" in
2258 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2259 exit 1
2260 ;;
4b661809 2261 *) case "$lns:$issymlink" in
7a800fca 2262 *"ln -s:"*"test -"?)
dafca956
JH
2263 echo "Creating the symbolic links..." >&4
2264 echo "(First creating the subdirectories...)" >&4
2265 cd ..
2266 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2267 read directory
2268 test -z "$directory" && break
2269 mkdir -p $directory
2270 done
2271 # Sanity check 1.
2272 if test ! -d t/base; then
2273 echo "Failed to create the subdirectories. Aborting." >&4
2274 exit 1
2275 fi
2276 echo "(Then creating the symlinks...)" >&4
2277 awk '{print $1}' $src/MANIFEST | while true; do
2278 read filename
2279 test -z "$filename" && break
2280 if test -f $filename; then
5d644a95 2281 if $issymlink $filename; then
dafca956
JH
2282 rm -f $filename
2283 fi
2284 fi
2285 if test -f $filename; then
2286 echo "$filename already exists, not symlinking."
2287 else
2288 ln -s $src/$filename $filename
2289 fi
2290 done
2291 # Sanity check 2.
2292 if test ! -f t/base/commonsense.t; then
2293 echo "Failed to create the symlinks. Aborting." >&4
2294 exit 1
2295 fi
2296 cd UU
2297 ;;
2298 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2299 ;;
2300 esac
2301 ;;
2302 esac
2303 ;;
2304esac
2305
ecfc5424
AD
2306: see whether [:lower:] and [:upper:] are supported character classes
2307echo " "
ecfc5424
AD
2308case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2309ABYZ)
2310 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2311 up='[:upper:]'
2312 low='[:lower:]'
2313 ;;
28e8609d
JH
2314*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2315 # (0xc9 and 0xd1), therefore that is a nice testing point.
2316 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2317 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2318 ij) up='[A-Z]'
2319 low='[a-z]'
2320 ;;
2321 esac
2322 fi
2323 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2324 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2325 ij) up='A-Z'
2326 low='a-z'
2327 ;;
2328 esac
2329 fi
2330 if test "X$up" = X -o "X$low" = X; then
2331 case "`echo IJ | od -x 2>/dev/null`" in
2332 *C9D1*|*c9d1*)
2333 echo "Hey, this might be EBCDIC." >&4
2334 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2335 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2336 ij) up='[A-IJ-RS-Z]'
2337 low='[a-ij-rs-z]'
2338 ;;
2339 esac
2340 fi
2341 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2342 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2343 ij) up='A-IJ-RS-Z'
2344 low='a-ij-rs-z'
2345 ;;
2346 esac
2347 fi
2348 ;;
2349 esac
2350 fi
2351esac
3eaeeeae 2352case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2353ij)
2354 echo "Using $up and $low to convert case." >&4
2355 ;;
ecfc5424 2356*)
28e8609d
JH
2357 echo "I don't know how to translate letters from upper to lower case." >&4
2358 echo "Your tr is not acting any way I know of." >&4
2359 exit 1
2360 ;;
ecfc5424
AD
2361esac
2362: set up the translation script tr, must be called with ./tr of course
2363cat >tr <<EOSC
2364$startsh
2365case "\$1\$2" in
2366'[A-Z][a-z]') exec $tr '$up' '$low';;
2367'[a-z][A-Z]') exec $tr '$low' '$up';;
2368esac
2369exec $tr "\$@"
2370EOSC
2371chmod +x tr
2372$eunicefix tr
2373
2304df62
AD
2374: Try to determine whether config.sh was made on this system
2375case "$config_sh" in
2376'')
43999f95
JH
2377myuname=`$uname -a 2>/dev/null`
2378$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2379# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2380# because the A-Z/a-z are not consecutive.
a0d0e21e 2381myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2382 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2383newmyuname="$myuname"
2304df62 2384dflt=n
16d20bd9
AD
2385case "$knowitall" in
2386'')
2387 if test -f ../config.sh; then
2388 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2389 eval "`grep myuname= ../config.sh`"
2390 fi
2391 if test "X$myuname" = "X$newmyuname"; then
2392 dflt=y
2393 fi
2304df62 2394 fi
16d20bd9
AD
2395 ;;
2396*) dflt=y;;
2397esac
2304df62
AD
2398
2399: Get old answers from old config file if Configure was run on the
2400: same system, otherwise use the hints.
2401hint=default
2402cd ..
2403if test -f config.sh; then
16d20bd9
AD
2404 echo " "
2405 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2406 . UU/myread
2407 case "$ans" in
f83701cd
AD
2408 n*|N*) echo "OK, I'll ignore it."
2409 mv config.sh config.sh.old
2410 myuname="$newmyuname"
2411 ;;
2304df62 2412 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2413 tmp_n="$n"
2414 tmp_c="$c"
85cad39c 2415 tmp_sh="$sh"
2304df62
AD
2416 . ./config.sh
2417 cp config.sh UU
ecfc5424
AD
2418 n="$tmp_n"
2419 c="$tmp_c"
85cad39c 2420 : Older versions did not always set $sh. Catch re-use of such
2421 : an old config.sh.
2422 case "$sh" in
2423 '') sh="$tmp_sh" ;;
2424 esac
2304df62
AD
2425 hint=previous
2426 ;;
2427 esac
2428fi
2573c5f9 2429. ./UU/checkcc
2304df62
AD
2430if test ! -f config.sh; then
2431 $cat <<EOM
2432
4e2a5f63
AD
2433First time through, eh? I have some defaults handy for some systems
2434that need some extra help getting the Configure answers right:
2304df62
AD
2435
2436EOM
dfe9444c 2437 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2438 dflt=''
2439 : Half the following guesses are probably wrong... If you have better
7f2de2d2 2440 : tests or hints, please send them to perlbug@perl.org
2304df62 2441 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2442 $test -f /irix && osname=irix
85e6fe83
LW
2443 $test -f /xenix && osname=sco_xenix
2444 $test -f /dynix && osname=dynix
2445 $test -f /dnix && osname=dnix
5f05dabc 2446 $test -f /lynx.os && osname=lynxos
2447 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2448 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2449 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2450 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2451 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2452 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2453 $test -d /usr/apollo/bin && osname=apollo
2454 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2455 $test -d /usr/include/minix && osname=minix
e060872b 2456 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2457 osname=machten
4633a7c4 2458 if $test -x /sbin/version; then
dfe9444c 2459 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2460 $sed -e 's/[A-Za-z]$//'`
2461 elif $test -x /usr/etc/version; then
dfe9444c 2462 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2463 $sed -e 's/[A-Za-z]$//'`
2464 else
2465 osvers="$2.$3"
2466 fi
2467 fi
aaacdc8b
GS
2468
2469 $test -f /sys/posix.dll &&
2470 $test -f /usr/bin/what &&
2471 set X `/usr/bin/what /sys/posix.dll` &&
2472 $test "$3" = UWIN &&
2473 osname=uwin &&
2474 osvers="$5"
2475
2304df62
AD
2476 if $test -f $uname; then
2477 set X $myuname
2478 shift
2479
2304df62 2480 case "$5" in
85e6fe83 2481 fps*) osname=fps ;;
2304df62
AD
2482 mips*)
2483 case "$4" in
85e6fe83
LW
2484 umips) osname=umips ;;
2485 *) osname=mips ;;
2304df62 2486 esac;;
85e6fe83
LW
2487 [23]100) osname=mips ;;
2488 next*) osname=next ;;
ecfc5424 2489 i386*)
c6912327
JH
2490 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2491 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2492 osname='sco'
2493 osvers=$tmp
2494 elif $test -f /etc/kconfig; then
ecfc5424 2495 osname=isc
bd628c73 2496 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2497 osvers=4
2498 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2499 osvers=3
2304df62 2500 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2501 osvers=2
ecfc5424
AD
2502 fi
2503 fi
2000072c 2504 tmp=''
ecfc5424 2505 ;;
c4f23d77
AD
2506 pc*)
2507 if test -n "$DJGPP"; then
2508 osname=dos
2509 osvers=djgpp
2510 fi
2511 ;;
2304df62
AD
2512 esac
2513
2514 case "$1" in
a0d0e21e
LW
2515 aix) osname=aix
2516 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2517 case "$tmp" in
1aef975c 2518 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2519 '<3240'|'<>3240') osvers=3.2.0 ;;
2520 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2521 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2522 *) osvers=$tmp;;
a0d0e21e
LW
2523 esac
2524 ;;
aaacdc8b
GS
2525 bsd386) osname=bsd386
2526 osvers=`$uname -r`
2527 ;;
2528 cygwin*) osname=cygwin
2529 osvers="$3"
2530 ;;
23f87696
SZ
2531 *dc.osx) osname=dcosx
2532 osvers="$3"
2533 ;;
a0d0e21e
LW
2534 dnix) osname=dnix
2535 osvers="$3"
2536 ;;
2537 domainos) osname=apollo
2538 osvers="$3"
2539 ;;
2540 dgux) osname=dgux
2541 osvers="$3"
2542 ;;
760ac839 2543 dynixptx*) osname=dynixptx
e58e581d 2544 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2545 ;;
a0d0e21e
LW
2546 freebsd) osname=freebsd
2547 osvers="$3" ;;
2548 genix) osname=genix ;;
2549 hp*) osname=hpux
bfb7748a 2550 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2551 ;;
a78b0d02 2552 irix*) osname=irix
a0d0e21e
LW
2553 case "$3" in
2554 4*) osvers=4 ;;
2555 5*) osvers=5 ;;
ecfc5424 2556 *) osvers="$3" ;;
a0d0e21e
LW
2557 esac
2558 ;;
2559 linux) osname=linux
2560 case "$3" in
a0d0e21e
LW
2561 *) osvers="$3" ;;
2562 esac
2563 ;;
28e8609d
JH
2564 MiNT) osname=mint
2565 ;;
2566 netbsd*) osname=netbsd
ecfc5424
AD
2567 osvers="$3"
2568 ;;
4e81affe
MM
2569 news-os) osvers="$3"
2570 case "$3" in
2571 4*) osname=newsos4 ;;
2572 *) osname=newsos ;;
2573 esac
2574 ;;
aaacdc8b 2575 next*) osname=next ;;
28bb1e2c 2576 nonstop-ux) osname=nonstopux ;;
aaacdc8b
GS
2577 POSIX-BC | posix-bc ) osname=posix-bc
2578 osvers="$3"
a0d0e21e 2579 ;;
ae3afa4e
TH
2580 powerux | power_ux | powermax_os | powermaxos | \
2581 powerunix | power_unix) osname=powerux
2582 osvers="$3"
2583 ;;
aaacdc8b
GS
2584 qnx) osname=qnx
2585 osvers="$4"
2586 ;;
a0d0e21e
LW
2587 solaris) osname=solaris
2588 case "$3" in
2589 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2590 *) osvers="$3" ;;
a0d0e21e
LW
2591 esac
2592 ;;
85e6fe83
LW
2593 sunos) osname=sunos
2594 case "$3" in
85e6fe83
LW
2595 5*) osname=solaris
2596 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2597 *) osvers="$3" ;;
2304df62
AD
2598 esac
2599 ;;
a0d0e21e 2600 titanos) osname=titanos
85e6fe83 2601 case "$3" in
a0d0e21e
LW
2602 1*) osvers=1 ;;
2603 2*) osvers=2 ;;
2604 3*) osvers=3 ;;
2605 4*) osvers=4 ;;
ecfc5424 2606 *) osvers="$3" ;;
2304df62
AD
2607 esac
2608 ;;
85e6fe83 2609 ultrix) osname=ultrix
ecfc5424 2610 osvers="$3"
2304df62 2611 ;;
28757baa 2612 osf1|mls+) case "$5" in
fed7345c
AD
2613 alpha)
2614 osname=dec_osf
2aa76180
JH
2615 osvers=`sizer -v | awk '{print $3}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2616 case "$osvers" in
2617 [1-9].[0-9]*) ;;
2618 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2619 esac
ecfc5424
AD
2620 ;;
2621 hp*) osname=hp_osf1 ;;
2622 mips) osname=mips_osf1 ;;
85e6fe83
LW
2623 esac
2624 ;;
0337d152
BG
2625 unixware) osname=svr5
2626 osvers="$4"
2627 ;;
2628 uts) osname=uts
a0d0e21e
LW
2629 osvers="$3"
2630 ;;
85e6fe83 2631 $2) case "$osname" in
2304df62 2632 *isc*) ;;
a0d0e21e 2633 *freebsd*) ;;
5f05dabc 2634 svr*)
a0d0e21e
LW
2635 : svr4.x or possibly later
2636 case "svr$3" in
2637 ${osname}*)
2638 osname=svr$3
2639 osvers=$4
2640 ;;
2641 esac
2642 case "$osname" in
2643 svr4.0)
2644 : Check for ESIX
2645 if test -f /stand/boot ; then
2646 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2647 if test -n "$INITPROG" -a -f "$INITPROG"; then
2648 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2649 if test -n "$isesix"; then
a0d0e21e
LW
2650 osname=esix4
2651 fi
2652 fi
2653 fi
2654 ;;
2655 esac
2656 ;;
2304df62 2657 *) if test -f /etc/systemid; then
a0d0e21e
LW
2658 osname=sco
2659 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2660 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2661 osvers=$1.$2.$3
c4f23d77 2662 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2663 osvers=$1.$2
c4f23d77 2664 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2665 osvers=$1
2304df62 2666 fi
a0d0e21e
LW
2667 else
2668 case "$osname" in
2669 '') : Still unknown. Probably a generic Sys V.
2670 osname="sysv"
2671 osvers="$3"
2672 ;;
2673 esac
2304df62
AD
2674 fi
2675 ;;
2676 esac
2677 ;;
a0d0e21e
LW
2678 *) case "$osname" in
2679 '') : Still unknown. Probably a generic BSD.
2680 osname="$1"
2681 osvers="$3"
2682 ;;
2683 esac
2684 ;;
2304df62
AD
2685 esac
2686 else
dfe9444c
AD
2687 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2688 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2689 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2690 osname=news_os
2304df62 2691 fi
dfe9444c 2692 $rm -f UU/kernel.what
8e07c86e
AD
2693 elif test -d c:/.; then
2694 set X $myuname
2695 osname=os2
2696 osvers="$5"
2304df62
AD
2697 fi
2698 fi
85e6fe83 2699
a0d0e21e
LW
2700 : Now look for a hint file osname_osvers, unless one has been
2701 : specified already.
2702 case "$hintfile" in
2703 ''|' ')
1e127011 2704 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 2705 : Also try without trailing minor version numbers.
1e127011
DD
2706 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2707 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2708 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2709 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
2710 case "$file" in
2711 '') dflt=none ;;
2712 *) case "$osvers" in
2713 '') dflt=$file
2714 ;;
dfe9444c 2715 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 2716 dflt=$file
dfe9444c 2717 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 2718 dflt=$xfile
dfe9444c 2719 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 2720 dflt=$xxfile
dfe9444c 2721 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 2722 dflt=$xxxfile
dfe9444c 2723 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 2724 dflt=$xxxxfile
dfe9444c 2725 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
2726 dflt="${osname}"
2727 else
2728 dflt=none
2729 fi
2730 ;;
2731 esac
85e6fe83
LW
2732 ;;
2733 esac
4e2a5f63
AD
2734 if $test -f Policy.sh ; then
2735 case "$dflt" in
2736 *Policy*) ;;
2737 none) dflt="Policy" ;;
2738 *) dflt="Policy $dflt" ;;
2739 esac
2740 fi
85e6fe83 2741 ;;
a0d0e21e 2742 *)
ecfc5424 2743 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 2744 ;;
2304df62 2745 esac
1aef975c 2746
4e2a5f63
AD
2747 if $test -f Policy.sh ; then
2748 $cat <<EOM
2749
2750There's also a Policy hint file available, which should make the
2751site-specific (policy) questions easier to answer.
2752EOM
2753
2754 fi
2755
2304df62
AD
2756 $cat <<EOM
2757
2758You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 2759A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 2760is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
2761
2762EOM
4e2a5f63 2763
2304df62 2764 rp="Which of these apply, if any?"
dfe9444c 2765 . UU/myread
85e6fe83
LW
2766 tans=$ans
2767 for file in $tans; do
4e2a5f63
AD
2768 if $test X$file = XPolicy -a -f Policy.sh; then
2769 . Policy.sh
2770 $cat Policy.sh >> UU/config.sh
2771 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
2772 . $src/hints/$file.sh
2773 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83 2774 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
2775 : nothing
2776 else
85e6fe83
LW
2777 : Give one chance to correct a possible typo.
2778 echo "$file.sh does not exist"
2779 dflt=$file
2780 rp="hint to use instead?"
dfe9444c 2781 . UU/myread
85e6fe83 2782 for file in $ans; do
dfe9444c
AD
2783 if $test -f "$src/hints/$file.sh"; then
2784 . $src/hints/$file.sh
2785 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
2786 elif $test X$ans = X -o X$ans = Xnone ; then
2787 : nothing
2788 else
2789 echo "$file.sh does not exist -- ignored."
2790 fi
2791 done
2304df62
AD
2792 fi
2793 done
85e6fe83 2794
2304df62 2795 hint=recommended
85e6fe83 2796 : Remember our hint file for later.
dfe9444c 2797 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 2798 hintfile="$file"
85e6fe83 2799 else
a0d0e21e 2800 hintfile=''
85e6fe83 2801 fi
2304df62
AD
2802fi
2803cd UU
2804;;
2805*)
2806 echo " "
2807 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
2808 tmp_n="$n"
2809 tmp_c="$c"
2304df62
AD
2810 cd ..
2811 cp $config_sh config.sh 2>/dev/null
a78b0d02 2812 chmod +w config.sh
2304df62
AD
2813 . ./config.sh
2814 cd UU
2815 cp ../config.sh .
ecfc5424
AD
2816 n="$tmp_n"
2817 c="$tmp_c"
2304df62
AD
2818 hint=previous
2819 ;;
2820esac
1aef975c 2821test "$override" && . ./optdef.sh
2304df62
AD
2822
2823: Restore computed paths
2824for file in $loclist $trylist; do
2825 eval $file="\$_$file"
2826done
2827
85e6fe83 2828cat << EOM
a0d0e21e 2829
85e6fe83 2830Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
2831The default value is probably right if the name rings a bell. Otherwise,
2832since spelling matters for me, either accept the default or answer "none"
2833to leave it blank.
a0d0e21e 2834
85e6fe83 2835EOM
85e6fe83 2836case "$osname" in
a0d0e21e 2837 ''|' ')
85e6fe83 2838 case "$hintfile" in
a0d0e21e 2839 ''|' '|none) dflt=none ;;
ecfc5424 2840 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
2841 esac
2842 ;;
2843 *) dflt="$osname" ;;
2844esac
2845rp="Operating system name?"
2846. ./myread
2847case "$ans" in
ecfc5424
AD
2848none) osname='' ;;
2849*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 2850esac
8ff267be 2851echo " "
2852case "$osvers" in
2853 ''|' ')
2854 case "$hintfile" in
2855 ''|' '|none) dflt=none ;;
2856 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2857 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2858 case "$dflt" in
2859 ''|' ') dflt=none ;;
2860 esac
2861 ;;
2862 esac
2863 ;;
2864 *) dflt="$osvers" ;;
2865esac
2866rp="Operating system version?"
2867. ./myread
2868case "$ans" in
2869none) osvers='' ;;
2870*) osvers="$ans" ;;
2871esac
2872
02e93a22
JH
2873
2874. ./posthint.sh
2875
2304df62 2876: who configured the system
59b83a6f 2877cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 2878cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
2879case "$cf_by" in
2880"")
8ff267be 2881 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
2882 case "$cf_by" in
2883 "") cf_by=unknown ;;
8ff267be 2884 esac ;;
2885esac
2304df62 2886
b4eb6b3d
JH
2887: set up the script used to warn in case of inconsistency
2888cat <<EOS >whoa
2889$startsh
2890EOS
2891cat <<'EOSC' >>whoa
2892dflt=y
2893echo " "
2894echo "*** WHOA THERE!!! ***" >&4
2895echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2896rp=" Keep the $hint value?"
2897. ./myread
2898case "$ans" in
2899y) td=$was; tu=$was;;
2900esac
2901EOSC
2902
2903: function used to set $1 to $val
2904setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2905case "$val$was" in
2906$define$undef) . ./whoa; eval "$var=\$td";;
2907$undef$define) . ./whoa; eval "$var=\$tu";;
2908*) eval "$var=$val";;
2909esac'
2910
2911case "$usethreads" in
2912$define|true|[yY]*) dflt='y';;
2913*) dflt='n';;
2914esac
2915cat <<EOM
2916
2917Perl can be built to take advantage of threads on some systems.
2918To do so, Configure can be run with -Dusethreads.
2919
2920Note that threading is a highly experimental feature, and
2921some known race conditions still remain. If you choose to try
2922it, be very sure to not actually deploy it for production
2923purposes. README.threads has more details, and is required
2924reading if you enable threads.
2925
2926If this doesn't make any sense to you, just accept the default '$dflt'.
2927EOM
2928rp='Build a threading Perl?'
2929. ./myread
2930case "$ans" in
2931y|Y) val="$define" ;;
2932*) val="$undef" ;;
2933esac
2934set usethreads
2935eval $setvar
2936
2937case "$usethreads" in
2938$define)
2939 $cat <<EOM
2940
2941As of 5.5.640, Perl has two different internal threading implementations,
2942the 5.005 version (5005threads) and an interpreter-based version
2943(ithreads) that has one interpreter per thread. Both are very
2944experimental. This arrangement exists to help developers work out
2945which one is better.
2946
2947If you're a casual user, you probably don't want interpreter-threads
2948at this time. There doesn't yet exist a way to create threads from
2949within Perl in this model, i.e., "use Thread;" will NOT work.
2950EOM
2951 : Default to ithreads unless overridden on command line or with
2952 : old config.sh
2953 dflt='y'
2954 case "$use5005threads" in
2955 $define|true|[yY]*) dflt='n';;
2956 esac
2957 case "$useithreads" in
2958 $undef|false|[nN]*) dflt='n';;
2959 esac
2960 rp='Use interpreter-based ithreads?'
2961 . ./myread
2962 case "$ans" in
2963 y|Y) val="$define" ;;
2964 *) val="$undef" ;;
2965 esac
2966 set useithreads
2967 eval $setvar
2968 : Now set use5005threads to the opposite value.
2969 case "$useithreads" in
2970 $define) val="$undef" ;;
2971 *) val="$define" ;;
2972 esac
2973 set use5005threads
2974 eval $setvar
2975 ;;
2976*)
2977 useithreads="$undef"
2978 use5005threads="$undef"
2979 ;;
2980esac
2981
c915ce7f
JH
2982case "$useithreads$use5005threads" in
2983"$define$define")
2984 $cat >&4 <<EOM
2985
2986You cannot have both the ithreads and the 5.005 threads enabled
2987at the same time. Disabling the 5.005 threads since they are
2988much less stable than the ithreads.
2989
2990EOM
2991 use5005threads="$undef"
2992 ;;
2993esac
2994
b4eb6b3d
JH
2995case "$d_oldpthreads" in
2996'') : Configure tests would be welcome here. For now, assume undef.
2997 val="$undef" ;;
2998*) val="$d_oldpthreads" ;;
2999esac
3000set d_oldpthreads
3001eval $setvar
3002
3003
3004case "$usethreads" in
3005"$define"|true|[yY]*)
3006: Look for a hint-file generated 'call-back-unit'. If the
3007: user has specified that a threading perl is to be built,
3008: we may need to set or change some other defaults.
3009 if $test -f usethreads.cbu; then
3010 echo "Your platform has some specific hints for threaded builds, using them..."
3011 . ./usethreads.cbu
3012 else
3013 $cat <<EOM
3014(Your platform doesn't have any specific hints for threaded builds.
3015 Assuming POSIX threads, then.)
3016EOM
3017 fi
3018 ;;
3019esac
3020
3021cat <<EOM
3022
3023Perl can be built so that multiple Perl interpreters can coexist
3024within the same Perl executable.
3025EOM
3026
3027case "$useithreads" in
3028$define)
3029 cat <<EOM
3030This multiple interpreter support is required for interpreter-based threads.
3031EOM
3032 val="$define"
3033 ;;
3034*) case "$usemultiplicity" in
3035 $define|true|[yY]*) dflt='y';;
3036 *) dflt='n';;
3037 esac
3038 echo " "
3039 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3040 rp='Build Perl for multiplicity?'
3041 . ./myread
3042 case "$ans" in
3043 y|Y) val="$define" ;;
3044 *) val="$undef" ;;
3045 esac
3046 ;;
3047esac
3048set usemultiplicity
3049eval $setvar
3050
e5e20432
JH
3051: make some quick guesses about what we are up against
3052echo " "
3053$echo $n "Hmm... $c"
3054echo exit 1 >bsd
3055echo exit 1 >usg
3056echo exit 1 >v7
3057echo exit 1 >osf1
3058echo exit 1 >eunice
3059echo exit 1 >xenix
3060echo exit 1 >venix
3061echo exit 1 >os2
3062d_bsd="$undef"
3063$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3064if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3065then
3066 echo "Looks kind of like an OSF/1 system, but we'll see..."
3067 echo exit 0 >osf1
381aa1ff 3068elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3069 xxx=`./loc addbib blurfl $pth`
3070 if $test -f $xxx; then
3071 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3072 echo exit 0 >bsd
3073 echo exit 0 >usg
3074 else
3075 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3076 echo "Looks kind of like an extended USG system, but we'll see..."
3077 else
3078 echo "Looks kind of like a USG system, but we'll see..."
3079 fi
3080 echo exit 0 >usg
3081 fi
3082elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3083 echo "Looks kind of like a BSD system, but we'll see..."
3084 d_bsd="$define"
3085 echo exit 0 >bsd
3086else
3087 echo "Looks kind of like a Version 7 system, but we'll see..."
3088 echo exit 0 >v7
3089fi
3090case "$eunicefix" in
3091*unixtovms*)
3092 $cat <<'EOI'
3093There is, however, a strange, musty smell in the air that reminds me of
3094something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3095EOI
3096 echo exit 0 >eunice
3097 d_eunice="$define"
3098: it so happens the Eunice I know will not run shell scripts in Unix format
3099 ;;
3100*)
3101 echo " "
3102 echo "Congratulations. You aren't running Eunice."
3103 d_eunice="$undef"
3104 ;;
3105esac
3106: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3107: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3108: semicolon as a patch separator
e5e20432
JH
3109case "$p_" in
3110:) ;;
3111*)
3112 $cat <<'EOI'
3113I have the feeling something is not exactly right, however...don't tell me...
3114lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3115(Or you may be running DOS with DJGPP.)
e5e20432
JH
3116EOI
3117 echo exit 0 >os2
3118 ;;
3119esac
3120if test -f /xenix; then
3121 echo "Actually, this looks more like a XENIX system..."
3122 echo exit 0 >xenix
3123 d_xenix="$define"
3124else
3125 echo " "
3126 echo "It's not Xenix..."
3127 d_xenix="$undef"
3128fi
3129chmod +x xenix
3130$eunicefix xenix
3131if test -f /venix; then
3132 echo "Actually, this looks more like a VENIX system..."
3133 echo exit 0 >venix
3134else
3135 echo " "
3136 if ./xenix; then
3137 : null
3138 else
3139 echo "Nor is it Venix..."
3140 fi
3141fi
3142chmod +x bsd usg v7 osf1 eunice xenix venix os2
3143$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3144$rm -f foo
3145
5869b1f1
JH
3146case "$cc" in
3147'') dflt=cc;;
3148*) dflt="$cc";;
3149esac
3150rp="Use which C compiler?"
3151. ./myread
3152cc="$ans"
e5e20432
JH
3153: Look for a hint-file generated 'call-back-unit'. Now that the
3154: user has specified the compiler, we may need to set or change some
3155: other defaults.
3156if $test -f cc.cbu; then
3157 . ./cc.cbu
3158fi
2573c5f9 3159. ./checkcc
8a27cf78 3160
e5e20432
JH
3161echo " "
3162echo "Checking for GNU cc in disguise and/or its version number..." >&4
3163$cat >gccvers.c <<EOM
3164#include <stdio.h>
3165int main() {
3166#ifdef __GNUC__
3167#ifdef __VERSION__
3168 printf("%s\n", __VERSION__);
3169#else
3170 printf("%s\n", "1");
3171#endif
3172#endif
3173 exit(0);
3174}
3175EOM
2d967e39 3176if $cc -o gccvers $ccflags $ldflags gccvers.c; then
e5e20432
JH
3177 gccversion=`./gccvers`
3178 case "$gccversion" in
3179 '') echo "You are not using GNU cc." ;;
fc68435e 3180 *) echo "You are using GNU cc $gccversion."
e723fc21 3181 ccname=gcc
fc68435e 3182 ;;
e5e20432
JH
3183 esac
3184else
3185 echo " "
3186 echo "*** WHOA THERE!!! ***" >&4
3187 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3188 case "$knowitall" in
3189 '')
3190 echo " You'd better start hunting for one and let me know about it." >&4
3191 exit 1
3192 ;;
3193 esac
3194fi
3195$rm -f gccvers*
3196case "$gccversion" in
31971*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3198esac
5b463ca7
KS
3199case "$gccversion" in
3200'') gccosandvers='' ;;
10b4ebb5
JH
3201*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3202 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3203 gccshortvers=''
5b463ca7 3204 case "$gccosandvers" in
02903077
JH
3205 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3206 $osname$osvers) ;; # looking good
5b463ca7
KS
3207 $osname*) cat <<EOM >&4
3208
3209*** WHOA THERE!!! ***
3210
3211 Your gcc has not been compiled for the exact release of
3212 your operating system ($gccosandvers versus $osname$osvers).
3213
3214 In general it is a good idea to keep gcc synchronized with
3215 the operating system because otherwise serious problems
3216 may ensue when trying to compile software, like Perl.
3217
3218 I'm trying to be optimistic here, though, and will continue.
3219 If later during the configuration and build icky compilation
02903077
JH
3220 problems appear (headerfile conflicts being the most common
3221 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3222 your operating system release.
3223
3224EOM
3225 ;;
81575342 3226 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3227 esac
3228 ;;
3229esac
e723fc21
JH
3230case "$ccname" in
3231'') ccname="$cc" ;;
3232esac
e5e20432 3233
640374d0
JH
3234case "$gccversion" in
3235'') ;;
3236*) case "$ccflags" in
3237 *-Wall*) ;;
a126002e 3238 *) ccflags="$ccflags -Wall" ;;
640374d0
JH
3239 esac
3240 ;;
3241esac
3242
8a27cf78
JH
3243: see how we invoke the C preprocessor
3244echo " "
3245echo "Now, how can we feed standard input to your C preprocessor..." >&4
3246cat <<'EOT' >testcpp.c
3247#define ABC abc
3248#define XYZ xyz
3249ABC.XYZ
3250EOT
3251cd ..
3252if test ! -f cppstdin; then
3253 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3254 # AIX cc -E doesn't show the absolute headerfile
3255 # locations but we'll cheat by using the -M flag.
3256 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
3257 else
3258 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3259 fi
3260else
3261 echo "Keeping your $hint cppstdin wrapper."
3262fi
3263chmod 755 cppstdin
3264wrapper=`pwd`/cppstdin
3265ok='false'
3266cd UU
3267
3268if $test "X$cppstdin" != "X" && \
3269 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3270 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3271then
3272 echo "You used to use $cppstdin $cppminus so we'll use that again."
3273 case "$cpprun" in
3274 '') echo "But let's see if we can live without a wrapper..." ;;
3275 *)
3276 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3277 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3278 then
3279 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3280 ok='true'
3281 else
3282 echo "(However, $cpprun $cpplast does not work, let's see...)"
3283 fi
3284 ;;
3285 esac
3286else
3287 case "$cppstdin" in
3288 '') ;;
3289 *)
3290 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3291 ;;
3292 esac
3293fi
3294
3295if $ok; then
3296 : nothing
3297elif echo 'Maybe "'"$cc"' -E" will work...'; \
3298 $cc -E <testcpp.c >testcpp.out 2>&1; \
3299 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3300 echo "Yup, it does."
3301 x_cpp="$cc -E"
3302 x_minus='';
3303elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3304 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3305 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3306 echo "Yup, it does."
3307 x_cpp="$cc -E"
3308 x_minus='-';
3309elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3310 $cc -P <testcpp.c >testcpp.out 2>&1; \
3311 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3312 echo "Yipee, that works!"
3313 x_cpp="$cc -P"
3314 x_minus='';
3315elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3316 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3317 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3318 echo "At long last!"
3319 x_cpp="$cc -P"
3320 x_minus='-';
3321elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3322 $cpp <testcpp.c >testcpp.out 2>&1; \
3323 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3324 echo "It works!"
3325 x_cpp="$cpp"
3326 x_minus='';
3327elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3328 $cpp - <testcpp.c >testcpp.out 2>&1; \
3329 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3330 echo "Hooray, it works! I was beginning to wonder."
3331 x_cpp="$cpp"
3332 x_minus='-';
3333elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3334 $wrapper <testcpp.c >testcpp.out 2>&1; \
3335 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3336 x_cpp="$wrapper"
3337 x_minus=''
3338 echo "Eureka!"
3339else
3340 dflt=''
3341 rp="No dice. I can't find a C preprocessor. Name one:"
3342 . ./myread
3343 x_cpp="$ans"
3344 x_minus=''
3345 $x_cpp <testcpp.c >testcpp.out 2>&1
3346 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3347 echo "OK, that will do." >&4
3348 else
3349echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3350 exit 1
3351 fi
3352fi
3353
3354case "$ok" in
3355false)
3356 cppstdin="$x_cpp"
3357 cppminus="$x_minus"
3358 cpprun="$x_cpp"
3359 cpplast="$x_minus"
3360 set X $x_cpp
3361 shift
3362 case "$1" in
3363 "$cpp")
3364 echo "Perhaps can we force $cc -E using a wrapper..."
3365 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3366 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3367 then
3368 echo "Yup, we can."
3369 cppstdin="$wrapper"
3370 cppminus='';
3371 else
3372 echo "Nope, we'll have to live without it..."
3373 fi
3374 ;;
3375 esac
3376 case "$cpprun" in
3377 "$wrapper")
3378 cpprun=''
3379 cpplast=''
3380 ;;
3381 esac
3382 ;;
3383esac
3384
3385case "$cppstdin" in
3386"$wrapper"|'cppstdin') ;;
3387*) $rm -f $wrapper;;
3388esac
3389$rm -f testcpp.c testcpp.out
3390
bd9b35c9
JH
3391: decide how portable to be. Allow command line overrides.
3392case "$d_portable" in
3393"$undef") ;;
3394*) d_portable="$define" ;;
104d25b7 3395esac
85ab1d1d 3396
bd9b35c9
JH
3397: set up shell script to do ~ expansion
3398cat >filexp <<EOSS
3399$startsh
3400: expand filename
3401case "\$1" in
3402 ~/*|~)
3403 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3404 ;;
3405 ~*)
3406 if $test -f /bin/csh; then
3407 /bin/csh -f -c "glob \$1"
3408 failed=\$?
3409 echo ""
3410 exit \$failed
e5e20432 3411 else
bd9b35c9
JH
3412 name=\`$expr x\$1 : '..\([^/]*\)'\`
3413 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3414 if $test ! -d "\$dir"; then
3415 me=\`basename \$0\`
3416 echo "\$me: can't locate home directory for: \$name" >&2
3417 exit 1
3418 fi
3419 case "\$1" in
3420 */*)
3421 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3422 ;;
3423 *)
3424 echo \$dir
e5e20432
JH
3425 ;;
3426 esac
3427 fi
b691c02f 3428 ;;
4633a7c4 3429*)
bd9b35c9 3430 echo \$1
2304df62
AD
3431 ;;
3432esac
4633a7c4
LW
3433EOSS
3434chmod +x filexp
3435$eunicefix filexp
2304df62
AD
3436
3437: now set up to get a file name
28757baa 3438cat <<EOS >getfile
3439$startsh
3440EOS
3441cat <<'EOSC' >>getfile
2304df62
AD
3442tilde=''
3443fullpath=''
3444already=''
3445skip=''
3446none_ok=''
3447exp_file=''
a0d0e21e 3448nopath_ok=''
2304df62
AD
3449orig_rp="$rp"
3450orig_dflt="$dflt"
b233458b
JH
3451case "$gfpth" in
3452'') gfpth='.' ;;
3453esac
2304df62
AD
3454
3455case "$fn" in
ecfc5424 3456*\(*)
381aa1ff 3457 expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
3458 fn=`echo $fn | sed 's/(.*)//'`
3459 ;;
3460esac
3461
3462case "$fn" in
a0d0e21e
LW
3463*:*)
3464 loc_file=`expr $fn : '.*:\(.*\)'`
3465 fn=`expr $fn : '\(.*\):.*'`
3466 ;;
3467esac
3468
3469case "$fn" in
2304df62
AD
3470*~*) tilde=true;;
3471esac
3472case "$fn" in
3473*/*) fullpath=true;;
3474esac
3475case "$fn" in
3476*+*) skip=true;;
3477esac
3478case "$fn" in
3479*n*) none_ok=true;;
3480esac
3481case "$fn" in
3482*e*) exp_file=true;;
3483esac
a0d0e21e
LW
3484case "$fn" in
3485*p*) nopath_ok=true;;
3486esac
2304df62
AD
3487
3488case "$fn" in
3489*f*) type='File';;
3490*d*) type='Directory';;
a0d0e21e 3491*l*) type='Locate';;
2304df62
AD
3492esac
3493
3494what="$type"
3495case "$what" in
3496Locate) what='File';;
3497esac
3498
3499case "$exp_file" in
3500'')
3501 case "$d_portable" in
3502 "$define") ;;
3503 *) exp_file=true;;
3504 esac
3505 ;;
3506esac
3507
3508cd ..
3509while test "$type"; do
3510 redo=''
3511 rp="$orig_rp"
3512 dflt="$orig_dflt"
3513 case "$tilde" in
3514 true) rp="$rp (~name ok)";;
3515 esac
3516 . UU/myread
ecfc5424
AD
3517 if test -f UU/getfile.ok && \
3518 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3519 then
3520 value="$ans"
3521 ansexp="$ans"
3522 break
3523 fi
2304df62
AD
3524 case "$ans" in
3525 none)
3526 value=''
3527 ansexp=''
3528 case "$none_ok" in
3529 true) type='';;
3530 esac
3531 ;;
3532 *)
3533 case "$tilde" in
3534 '') value="$ans"
3535 ansexp="$ans";;
3536 *)
3537 value=`UU/filexp $ans`
3538 case $? in
3539 0)
3540 if test "$ans" != "$value"; then
ecfc5424 3541 echo "(That expands to $value on this system.)"
2304df62
AD
3542 fi
3543 ;;
3544 *) value="$ans";;
3545 esac
3546 ansexp="$value"
3547 case "$exp_file" in
3548 '') value="$ans";;
3549 esac
3550 ;;
3551 esac
3552 case "$fullpath" in
3553 true)
3554 case "$ansexp" in
3555 /*) value="$ansexp" ;;
23da6c43 3556 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
3557 *)
3558 redo=true
3559 case "$already" in
3560 true)
3561 echo "I shall only accept a full path name, as in /bin/ls." >&4
3562 echo "Use a ! shell escape if you wish to check pathnames." >&4
3563 ;;
3564 *)
3565 echo "Please give a full path name, starting with slash." >&4
3566 case "$tilde" in
3567 true)
3568 echo "Note that using ~name is ok provided it expands well." >&4
3569 already=true
3570 ;;
3571 esac
3572 esac
3573 ;;
3574 esac
3575 ;;
3576 esac
3577 case "$redo" in
3578 '')
3579 case "$type" in
3580 File)
b233458b
JH
3581 for fp in $gfpth; do
3582 if test "X$fp" = X.; then
3583 pf="$ansexp"
3584 else
3585 pf="$fp/$ansexp"
3586 fi
3587 if test -f "$pf"; then
3588 type=''
3589 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3590 then
3591 echo "($value is not a plain file, but that's ok.)"
3592 type=''
3593 fi
3594 if test X"$type" = X; then
3595 value="$pf"
3596 break
3597 fi
3598 done
2304df62
AD
3599 ;;
3600 Directory)
b233458b
JH
3601 for fp in $gfpth; do
3602 if test "X$fp" = X.; then
f78bfc9c
JH
3603 dir="$ans"
3604 direxp="$ansexp"
b233458b 3605 else
dd858076 3606 dir="$fp/$ansexp"
f78bfc9c 3607 direxp="$fp/$ansexp"
b233458b 3608 fi
f78bfc9c 3609 if test -d "$direxp"; then
b233458b 3610 type=''
f78bfc9c 3611 value="$dir"
b233458b
JH
3612 break
3613 fi
3614 done
2304df62
AD
3615 ;;
3616 Locate)
40000a8c 3617 if test -d "$ansexp"; then
a0d0e21e
LW
3618 echo "(Looking for $loc_file in directory $value.)"
3619 value="$value/$loc_file"
40000a8c 3620 ansexp="$ansexp/$loc_file"
2304df62 3621 fi
40000a8c 3622 if test -f "$ansexp"; then
2304df62
AD
3623 type=''
3624 fi
a0d0e21e
LW
3625 case "$nopath_ok" in
3626 true) case "$value" in
3627 */*) ;;
3628 *) echo "Assuming $value will be in people's path."
3629 type=''
3630 ;;
3631 esac
3632 ;;
3633 esac
2304df62
AD
3634 ;;
3635 esac
3636
3637 case "$skip" in
3638 true) type='';
3639 esac
3640
3641 case "$type" in
3642 '') ;;
3643 *)
3644 if test "$fastread" = yes; then
3645 dflt=y
3646 else
3647 dflt=n
3648 fi
3649 rp="$what $value doesn't exist. Use that name anyway?"
3650 . UU/myread
3651 dflt=''
3652 case "$ans" in
3653 y*) type='';;
3654 *) echo " ";;
3655 esac
3656 ;;
3657 esac
3658 ;;
3659 esac
3660 ;;
3661 esac
3662done
3663cd UU
3664ans="$value"
3665rp="$orig_rp"
3666dflt="$orig_dflt"
ecfc5424 3667rm -f getfile.ok
b233458b 3668test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3669EOSC
3670
bd9b35c9
JH
3671: What should the include directory be ?
3672echo " "
3673$echo $n "Hmm... $c"
3674dflt='/usr/include'
3675incpath=''
3676mips_type=''
3677if $test -f /bin/mips && /bin/mips; then
3678 echo "Looks like a MIPS system..."
3679 $cat >usr.c <<'EOCP'
3680#ifdef SYSTYPE_BSD43
3681/bsd43
3682#endif
3683EOCP
8a27cf78 3684 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
3685 dflt='/bsd43/usr/include'
3686 incpath='/bsd43'
3687 mips_type='BSD 4.3'
3688 else
3689 mips_type='System V'
3690 fi
3691 $rm -f usr.c usr.out
3692 echo "and you're compiling with the $mips_type compiler and libraries."
3693 xxx_prompt=y
3694 echo "exit 0" >mips
3695else
3696 echo "Doesn't look like a MIPS system."
3697 xxx_prompt=n
3698 echo "exit 1" >mips
3699fi
3700chmod +x mips
3701$eunicefix mips
3702case "$usrinc" in
3703'') ;;
3704*) dflt="$usrinc";;
3705esac
3706case "$xxx_prompt" in
3707y) fn=d/
3708 echo " "
3709 rp='Where are the include files you want to use?'
3710 . ./getfile
3711 usrinc="$ans"
8e07c86e 3712 ;;
bd9b35c9 3713*) usrinc="$dflt"
8e07c86e
AD
3714 ;;
3715esac
2304df62 3716
bd9b35c9
JH
3717: Set private lib path
3718case "$plibpth" in
3719'') if ./mips; then
3720 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3721 fi;;
3722esac
3723case "$libpth" in
3724' ') dlist='';;
3725'') dlist="$loclibpth $plibpth $glibpth";;
3726*) dlist="$libpth";;
3727esac
3728
3729: Now check and see which directories actually exist, avoiding duplicates
3730libpth=''
3731for xxx in $dlist
3732do
3733 if $test -d $xxx; then
3734 case " $libpth " in
3735 *" $xxx "*) ;;
3736 *) libpth="$libpth $xxx";;
3737 esac
3738 fi
3739done
3740$cat <<'EOM'
3741
3742Some systems have incompatible or broken versions of libraries. Among
3743the directories listed in the question below, please remove any you
3744know not to be holding relevant libraries, and add any that are needed.
3745Say "none" for none.
8e07c86e
AD
3746
3747EOM
bd9b35c9
JH
3748case "$libpth" in
3749'') dflt='none';;
8e07c86e 3750*)
bd9b35c9
JH
3751 set X $libpth
3752 shift
3753 dflt=${1+"$@"}
8e07c86e 3754 ;;
a0d0e21e 3755esac
bd9b35c9
JH
3756rp="Directories to use for library searches?"
3757. ./myread
3758case "$ans" in
3759none) libpth=' ';;
3760*) libpth="$ans";;
3761esac
a0d0e21e 3762
bd9b35c9
JH
3763: compute shared library extension
3764case "$so" in
3765'')
3766 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3767 dflt='sl'
dd4e71fd 3768 else
bd9b35c9 3769 dflt='so'
dd4e71fd
JH
3770 fi
3771 ;;
bd9b35c9 3772*) dflt="$so";;
dd4e71fd 3773esac
dd4e71fd
JH
3774$cat <<EOM
3775
bd9b35c9 3776On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 3777you want to suppress searching of shared libraries for the remainder
bd9b35c9 3778of this configuration.
dd4e71fd
JH
3779
3780EOM
bd9b35c9
JH
3781rp='What is the file extension used for shared libraries?'
3782. ./myread
3783so="$ans"
dd4e71fd 3784
bd9b35c9
JH
3785: Define several unixisms.
3786: Hints files or command line option can be used to override them.
3787: The convoluted testing is in case hints files set either the old
3788: or the new name.
3789case "$_exe" in
3790'') case "$exe_ext" in
3791 '') ;;
3792 *) _exe="$exe_ext" ;;
dd4e71fd 3793 esac
bd9b35c9 3794 ;;
bfb7748a 3795esac
bd9b35c9
JH
3796case "$_a" in
3797'') case "$lib_ext" in
3798 '') _a='.a';;
3799 *) _a="$lib_ext" ;;
dd4e71fd
JH
3800 esac
3801 ;;
dd4e71fd 3802esac
bd9b35c9
JH
3803case "$_o" in
3804'') case "$obj_ext" in
3805 '') _o='.o';;
3806 *) _o="$obj_ext";;
3807 esac
3808 ;;
3809esac
3810case "$p_" in
3811'') case "$path_sep" in
3812 '') p_=':';;
3813 *) p_="$path_sep";;
3814 esac
3815 ;;
3816esac
3817exe_ext=$_exe
3818lib_ext=$_a
3819obj_ext=$_o
3820path_sep=$p_
dd4e71fd 3821
b4eb6b3d
JH
3822: Which makefile gets called first. This is used by make depend.
3823case "$firstmakefile" in
3824'') firstmakefile='makefile';;
4633a7c4 3825esac
4633a7c4 3826
0f0995ae
JH
3827case "$usesocks" in
3828$define|true|[yY]*) dflt='y';;
3829*) dflt='n';;
3830esac
bd9b35c9 3831cat <<EOM
4633a7c4 3832
bd9b35c9 3833Perl can be built to use the SOCKS proxy protocol library. To do so,
cf829ab0
JH
3834Configure must be run with -Dusesocks. If you use SOCKS you also need
3835to use the PerlIO abstraction layer, this will be implicitly selected.
4633a7c4 3836
0f0995ae 3837If this doesn't make any sense to you, just accept the default '$dflt'.
bd9b35c9 3838EOM
bd9b35c9
JH
3839rp='Build Perl for SOCKS?'
3840. ./myread
3841case "$ans" in
3842y|Y) val="$define" ;;
3843*) val="$undef" ;;
3844esac
3845set usesocks
3846eval $setvar
3847
cf829ab0
JH
3848case "$usesocks" in
3849$define|true|[yY]*) useperlio="$define";;
3850esac
3851
bd9b35c9
JH
3852: Looking for optional libraries
3853echo " "
3854echo "Checking for optional libraries..." >&4
3855case "$libs" in
3856' '|'') dflt='';;
3857*) dflt="$libs";;
3858esac
3859case "$libswanted" in
3860'') libswanted='c_s';;
3861esac
3862case "$usesocks" in
923fc586 3863"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 3864esac
68435ea7
JH
3865libsfound=''
3866libsfiles=''
3867libsdirs=''
13b3f787
JH
3868libspath=''
3869for thisdir in $libpth $xlibpth; do
3870 test -d $thisdir && libspath="$libspath $thisdir"
3871done
bd9b35c9 3872for thislib in $libswanted; do
13b3f787 3873 for thisdir in $libspath; do
f7dd4e7f
JH
3874 xxx=''
3875 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3876 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3877 $test -f "$xxx" && eval $libscheck
3878 $test -f "$xxx" && libstyle=shared
3879 fi
3880 if test ! -f "$xxx"; then
3881 xxx=$thisdir/lib$thislib.$so
3882 $test -f "$xxx" && eval $libscheck
3883 $test -f "$xxx" && libstyle=shared
3884 fi
3885 if test ! -f "$xxx"; then
3886 xxx=$thisdir/lib$thislib$_a
3887 $test -f "$xxx" && eval $libscheck
3888 $test -f "$xxx" && libstyle=static
3889 fi
3890 if test ! -f "$xxx"; then
3891 xxx=$thisdir/$thislib$_a
3892 $test -f "$xxx" && eval $libscheck
3893 $test -f "$xxx" && libstyle=static
3894 fi
3895 if test ! -f "$xxx"; then
3896 xxx=$thisdir/lib${thislib}_s$_a
3897 $test -f "$xxx" && eval $libscheck
3898 $test -f "$xxx" && libstyle=static
09ea5ba9 3899 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
3900 fi
3901 if test ! -f "$xxx"; then
3902 xxx=$thisdir/Slib$thislib$_a
3903 $test -f "$xxx" && eval $libscheck
3904 $test -f "$xxx" && libstyle=static
3905 fi
3906 if $test -f "$xxx"; then
43999f95 3907 case "$libstyle" in
f7dd4e7f
JH
3908 shared) echo "Found -l$thislib (shared)." ;;
3909 static) echo "Found -l$thislib." ;;
3910 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 3911 esac
bd9b35c9
JH
3912 case " $dflt " in
3913 *"-l$thislib "*);;
f7dd4e7f 3914 *) dflt="$dflt -l$thislib"
43999f95
JH
3915 libsfound="$libsfound $xxx"
3916 yyy=`basename $xxx`
3917 libsfiles="$libsfiles $yyy"
1e127011 3918 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
3919 case " $libsdirs " in
3920 *" $yyy "*) ;;
3921 *) libsdirs="$libsdirs $yyy" ;;
3922 esac
3923 ;;
bd9b35c9 3924 esac
f7dd4e7f
JH
3925 break
3926 fi
3927 done
3928 if $test ! -f "$xxx"; then
3929 echo "No -l$thislib."
bd9b35c9
JH
3930 fi
3931done
3932set X $dflt
3933shift
3934dflt="$*"
3935case "$libs" in
3936'') dflt="$dflt";;
3937*) dflt="$libs";;
3938esac
3939case "$dflt" in
3940' '|'') dflt='none';;
3941esac
4633a7c4 3942
bd9b35c9 3943$cat <<EOM
4633a7c4 3944
bd9b35c9
JH
3945In order to compile $package on your machine, a number of libraries
3946are usually needed. Include any other special libraries here as well.
3947Say "none" for none. The default list is almost always right.
8e07c86e 3948EOM
8e07c86e 3949
bd9b35c9
JH
3950echo " "
3951rp="What libraries to use?"
3952. ./myread
3953case "$ans" in
3954none) libs=' ';;
3955*) libs="$ans";;
3956esac
d71b2b6b 3957
bd9b35c9
JH
3958: determine optimization, if desired, or use for debug flag also
3959case "$optimize" in
3960' '|$undef) dflt='none';;
3961'') dflt='-O';;
3962*) dflt="$optimize";;
3963esac
3964$cat <<EOH
d71b2b6b 3965
bd9b35c9
JH
3966By default, $package compiles with the -O flag to use the optimizer.
3967Alternately, you might want to use the symbolic debugger, which uses
3968the -g flag (on traditional Unix systems). Either flag can be
3969specified here. To use neither flag, specify the word "none".
d71b2b6b 3970
bd9b35c9
JH
3971EOH
3972rp="What optimizer/debugger flag should be used?"
3973. ./myread
3974optimize="$ans"
3975case "$optimize" in
3976'none') optimize=" ";;
3977esac
3978
3979dflt=''
3980: We will not override a previous value, but we might want to
3981: augment a hint file
3982case "$hint" in
3983default|recommended)
3984 case "$gccversion" in
3985 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 3986 esac
bd9b35c9
JH
3987 case "$optimize" in
3988 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 3989 esac
bd9b35c9
JH
3990 case "$gccversion" in
3991 2*) if test -d /etc/conf/kconfig.d &&
3992 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3993 then
3994 dflt="$dflt -posix"
3995 fi
f0d04425 3996 ;;
bd9b35c9
JH
3997 esac
3998 case "$gccversion" in
3999 1*) ;;
4000 2.[0-8]*) ;;
4001 ?*) echo " "
4002 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4003 echo 'int main(void) { return 0; }' > gcctest.c
4004 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4005 echo "Yes, it does." 2>&1
4006 case "$ccflags" in
4007 *strict-aliasing*)
4008 echo "Leaving current flags $ccflags alone." 2>&1
4009 ;;
4010 *) dflt="$dflt -fno-strict-aliasing" ;;
4011 esac
4012 else
4013 echo "Nope, it doesn't, but that's ok." 2>&1
4014 fi
f0d04425 4015 ;;
e5e20432
JH
4016 esac
4017 ;;
4018esac
4019
bd9b35c9
JH
4020case "$mips_type" in
4021*BSD*|'') inclwanted="$locincpth $usrinc";;
4022*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4023esac
4024for thisincl in $inclwanted; do
4025 if $test -d $thisincl; then
4026 if $test x$thisincl != x$usrinc; then
4027 case "$dflt" in
422af00a
LC
4028 *" -I$thisincl "*);;
4029 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
4030 esac
4031 fi
4032 fi
4033done
40a7a20a 4034
bd9b35c9
JH
4035inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4036 xxx=true;
4037elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4038 xxx=true;
4039else
4040 xxx=false;
4041fi;
4042if $xxx; then
4043 case "$dflt" in
4044 *$2*);;
4045 *) dflt="$dflt -D$2";;
4046 esac;
4047fi'
40a7a20a 4048
bd9b35c9 4049set signal.h LANGUAGE_C; eval $inctest
40a7a20a 4050
bd9b35c9
JH
4051case "$usesocks" in
4052$define)
4053 ccflags="$ccflags -DSOCKS"
4054 ;;
4055esac
40a7a20a 4056
bd9b35c9
JH
4057case "$hint" in
4058default|recommended) dflt="$ccflags $dflt" ;;
4059*) dflt="$ccflags";;
4060esac
40a7a20a 4061
bd9b35c9
JH
4062case "$dflt" in
4063''|' ') dflt=none;;
4064esac
422af00a 4065
bd9b35c9 4066$cat <<EOH
40a7a20a 4067
bd9b35c9
JH
4068Your C compiler may want other flags. For this question you should include
4069-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4070but you should NOT include libraries or ld flags like -lwhatever. If you
4071want $package to honor its debug switch, you should include -DDEBUGGING here.
4072Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 4073
bd9b35c9 4074To use no flags, specify the word "none".
40a7a20a 4075
bd9b35c9
JH
4076EOH
4077set X $dflt
4078shift
4079dflt=${1+"$@"}
4080rp="Any additional cc flags?"
4081. ./myread
4082case "$ans" in
4083none) ccflags='';;
4084*) ccflags="$ans";;
4085esac
8e07c86e 4086
bd9b35c9 4087: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
4088case "$cppflags" in
4089'') cppflags="$ccflags" ;;
4090*) cppflags="$cppflags $ccflags" ;;
4091esac
bd9b35c9
JH
4092case "$gccversion" in
40931*) cppflags="$cppflags -D__GNUC__"
4633a7c4 4094esac
bd9b35c9
JH
4095case "$mips_type" in
4096'');;
4097*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4098esac
4099case "$cppflags" in
4100'');;
4101*)
4102 echo " "
4103 echo "Let me guess what the preprocessor flags are..." >&4
4104 set X $cppflags
4105 shift
4106 cppflags=''
4107 $cat >cpp.c <<'EOM'
4108#define BLURFL foo
8e07c86e 4109
bd9b35c9
JH
4110BLURFL xx LFRULB
4111EOM
4112 previous=''
4113 for flag in $*
4114 do
4115 case "$flag" in
4116 -*) ftry="$flag";;
4117 *) ftry="$previous $flag";;
4118 esac
4119 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4120 >cpp1.out 2>/dev/null && \
4121 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4122 >cpp2.out 2>/dev/null && \
4123 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4124 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4125 then
4126 cppflags="$cppflags $ftry"
4127 previous=''
4128 else
4129 previous="$flag"
4130 fi
4131 done
4132 set X $cppflags
4133 shift
4134 cppflags=${1+"$@"}
4135 case "$cppflags" in
4136 *-*) echo "They appear to be: $cppflags";;
4137 esac
4138 $rm -f cpp.c cpp?.out
2afac517 4139 ;;
4140esac
8e07c86e 4141
bd9b35c9
JH
4142: flags used in final linking phase
4143case "$ldflags" in
4144'') if ./venix; then
4145 dflt='-i -z'
10a23457 4146 else
bd9b35c9 4147 dflt=''
10a23457 4148 fi
bd9b35c9
JH
4149 case "$ccflags" in
4150 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 4151 esac
bd9b35c9
JH
4152 ;;
4153*) dflt="$ldflags";;
4154esac
4155
4156: Try to guess additional flags to pick up local libraries.
4157for thislibdir in $libpth; do
4158 case " $loclibpth " in
4159 *" $thislibdir "*)
4160 case "$dflt " in
4161 *"-L$thislibdir "*) ;;
4162 *) dflt="$dflt -L$thislibdir" ;;
4163 esac
c4f23d77
AD
4164 ;;
4165 esac
bd9b35c9 4166done
c4f23d77 4167
bd9b35c9
JH
4168case "$dflt" in
4169'') dflt='none' ;;
4170esac
c4f23d77 4171
bd9b35c9
JH
4172$cat <<EOH
4173
4174Your C linker may need flags. For this question you should
4175include -L/whatever and any other flags used by the C linker, but you
4176should NOT include libraries like -lwhatever.
4177
4178Make sure you include the appropriate -L/path flags if your C linker
4179does not normally search all of the directories you specified above,
4180namely
4181 $libpth
4182To use no flags, specify the word "none".
4183
4184EOH
4185
4186rp="Any additional ld flags (NOT including libraries)?"
4187. ./myread
4188case "$ans" in
4189none) ldflags='';;
4190*) ldflags="$ans";;
4191esac
4192rmlist="$rmlist pdp11"
4193
4194: coherency check
4195echo " "
4196echo "Checking your choice of C compiler and flags for coherency..." >&4
4197$cat > try.c <<'EOF'
4198#include <stdio.h>
4199int main() { printf("Ok\n"); exit(0); }
4200EOF
7a282f6d 4201set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
4202shift
4203$cat >try.msg <<'EOM'
4204I've tried to compile and run the following simple program:
4205
4206EOM
4207$cat try.c >> try.msg
4208
4209$cat >> try.msg <<EOM
4210
4211I used the command:
4212
4213 $*
4214 ./try
4215
4216and I got the following output:
4217
4218EOM
4219dflt=y
73614538
JH
4220if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4221 if $sh -c './try' >>try.msg 2>&1; then
bd9b35c9
JH
4222 xxx=`./try`
4223 case "$xxx" in
4224 "Ok") dflt=n ;;
4225 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4226 case " $libs " in
4227 *" -lsfio "*)
4228 cat >> try.msg <<'EOQS'
4229If $libs contains -lsfio, and sfio is mis-configured, then it
4230sometimes (apparently) runs and exits with a 0 status, but with no
4231output! It may have to do with sfio's use of _exit vs. exit.
4232
4233EOQS
4234 rp="You have a big problem. Shall I abort Configure"
4235 dflt=y
4236 ;;
4237 esac
4238 ;;
4239 esac
4240 else
4241 echo "The program compiled OK, but exited with status $?." >>try.msg
4242 rp="You have a problem. Shall I abort Configure"
4243 dflt=y
4244 fi
4245else
4246 echo "I can't compile the test program." >>try.msg
4247 rp="You have a BIG problem. Shall I abort Configure"
4248 dflt=y
4249fi
4250case "$dflt" in
4251y)
4252 $cat try.msg >&4
4253 case "$knowitall" in
4254 '')
4255 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 4256 ;;
bd9b35c9 4257 *) dflt=n;;
c4f23d77 4258 esac
bd9b35c9
JH
4259 echo " "
4260 . ./myread
4261 case "$ans" in
4262 n*|N*) ;;
4263 *) echo "Ok. Stopping Configure." >&4
4264 exit 1
c4f23d77
AD
4265 ;;
4266 esac
4267 ;;
bd9b35c9 4268n) echo "OK, that should do.";;
c4f23d77 4269esac
bd9b35c9 4270$rm -f try try.* core
c4f23d77 4271
b4eb6b3d
JH
4272: define an is-a-typedef? function
4273typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4274case "$inclist" in
4275"") inclist="sys/types.h";;
4276esac;
4277eval "varval=\$$var";
4278case "$varval" in
4279"")
4280 $rm -f temp.c;
4281 for inc in $inclist; do
4282 echo "#include <$inc>" >>temp.c;
4283 done;
4284 echo "#ifdef $type" >> temp.c;
4285 echo "printf(\"We have $type\");" >> temp.c;
4286 echo "#endif" >> temp.c;
4287 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4288 if $contains $type temp.E >/dev/null 2>&1; then
4289 eval "$var=\$type";
4290 else
4291 eval "$var=\$def";
4292 fi;
4293 $rm -f temp.?;;
4294*) eval "$var=\$varval";;
4295esac'
4296
4297: define an is-a-typedef? function that prompts if the type is not available.
4298typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4299case "$inclist" in
4300"") inclist="sys/types.h";;
4301esac;
4302eval "varval=\$$var";
4303case "$varval" in
4304"")
4305 $rm -f temp.c;
4306 for inc in $inclist; do
4307 echo "#include <$inc>" >>temp.c;
4308 done;
4309 echo "#ifdef $type" >> temp.c;
4310 echo "printf(\"We have $type\");" >> temp.c;
4311 echo "#endif" >> temp.c;
4312 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4313 echo " " ;
4314 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4315 if $contains $type temp.E >/dev/null 2>&1; then
4316 echo "$type found." >&4;
4317 eval "$var=\$type";
4318 else
4319 echo "$type NOT found." >&4;
4320 dflt="$def";
4321 . ./myread ;
4322 eval "$var=\$ans";
4323 fi;
4324 $rm -f temp.?;;
4325*) eval "$var=\$varval";;
4326esac'
4327
bd9b35c9
JH
4328: define a shorthand compile call
4329compile='
4330mc_file=$1;
4331shift;
08413ebc 4332$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
4333: define a shorthand compile call for compilations that should be ok.
4334compile_ok='
4335mc_file=$1;
4336shift;
7a282f6d 4337$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 4338
b4eb6b3d 4339: check for lengths of integral types
bd9b35c9 4340echo " "
b4eb6b3d
JH
4341case "$intsize" in
4342'')
4343 echo "Checking to see how big your integers are..." >&4
4344 $cat >intsize.c <<'EOCP'
bd9b35c9
JH
4345#include <stdio.h>
4346int main()
4347{
b4eb6b3d
JH
4348 printf("intsize=%d;\n", (int)sizeof(int));
4349 printf("longsize=%d;\n", (int)sizeof(long));
4350 printf("shortsize=%d;\n", (int)sizeof(short));
4351 exit(0);
bd9b35c9 4352}
b4eb6b3d
JH
4353EOCP
4354 set intsize
4355 if eval $compile_ok && ./intsize > /dev/null; then
4356 eval `./intsize`
4357 echo "Your integers are $intsize bytes long."
4358 echo "Your long integers are $longsize bytes long."
4359 echo "Your short integers are $shortsize bytes long."
4360 else
4361 $cat >&4 <<EOM
4362!
4363Help! I can't compile and run the intsize test program: please enlighten me!
4364(This is probably a misconfiguration in your system or libraries, and
4365you really ought to fix it. Still, I'll try anyway.)
4366!
bd9b35c9 4367EOM
b4eb6b3d
JH
4368 dflt=4
4369 rp="What is the size of an integer (in bytes)?"
4370 . ./myread
4371 intsize="$ans"
4372 dflt=$intsize
4373 rp="What is the size of a long integer (in bytes)?"
4374 . ./myread
4375 longsize="$ans"
4376 dflt=2
4377 rp="What is the size of a short integer (in bytes)?"
4378 . ./myread
4379 shortsize="$ans"
4380 fi
4381 ;;
4382esac
4383$rm -f intsize intsize.*
c1a7f87b 4384
b4eb6b3d
JH
4385: see what type lseek is declared as in the kernel
4386rp="What is the type used for lseek's offset on this system?"
4387set off_t lseektype long stdio.h sys/types.h
4388eval $typedef_ask
4389
4390echo " "
4391echo "Checking to see how big your file offsets are..." >&4
4392$cat >try.c <<EOCP
4393#include <sys/types.h>
4394#include <stdio.h>
4395int main()
4396{
4397 printf("%d\n", (int)sizeof($lseektype));
4398 return(0);
4399}
4400EOCP
4401set try
4402if eval $compile_ok; then
4403 lseeksize=`./try`
4404 echo "Your file offsets are $lseeksize bytes long."
4405else
4406 dflt=$longsize
4407 echo " "
4408 echo "(I can't seem to compile the test program. Guessing...)"
4409 rp="What is the size of your file offsets (in bytes)?"
4410 . ./myread
4411 lseeksize="$ans"
4412fi
4413$rm -f try.c try
4414
4415: see what type file positions are declared as in the library
4416rp="What is the type for file position used by fsetpos()?"
4417set fpos_t fpostype long stdio.h sys/types.h
4418eval $typedef_ask
4419
4420echo " "
4421case "$fpostype" in
4422*_t) zzz="$fpostype" ;;
4423*) zzz="fpos_t" ;;
4424esac
4425echo "Checking the size of $zzz..." >&4
4426cat > try.c <<EOCP
4427#include <sys/types.h>
4428#include <stdio.h>
4429int main() {
4430 printf("%d\n", (int)sizeof($fpostype));
4431 exit(0);
4432}
4433EOCP
4434set try
4435if eval $compile_ok; then
4436 yyy=`./try`
4437 case "$yyy" in
4438 '') fpossize=4
4439 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4440 ;;
4441 *) fpossize=$yyy
4442 echo "Your $zzz is $fpossize bytes long."
4443 ;;
4444 esac
4445else
4446 dflt="$longsize"
4447 echo " " >&4
4448 echo "(I can't compile the test program. Guessing...)" >&4
4449 rp="What is the size of your file positions (in bytes)?"
4450 . ./myread
4451 fpossize="$ans"
4452fi
4453
4454
4455
4456# Backward compatibility (uselfs is deprecated).
4457case "$uselfs" in
4458"$define"|true|[yY]*)
4459 cat <<EOM >&4
4460
4461*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4462EOM
4463 uselargefiles="$define"
4464 ;;
4465esac
4466
4467case "$lseeksize:$fpossize" in
44688:8) cat <<EOM
4469
4470You can have files larger than 2 gigabytes.
4471EOM
4472 val="$define" ;;
4473*) case "$uselargefiles" in
4474 "$undef"|false|[nN]*) dflt='n' ;;
4475 *) dflt='y' ;;
4476 esac
4477 cat <<EOM
4478
4479Perl can be built to understand large files (files larger than 2 gigabytes)
4480on some systems. To do so, Configure can be run with -Duselargefiles.
4481
4482If this doesn't make any sense to you, just accept the default '$dflt'.
4483EOM
4484 rp='Try to understand large files, if available?'
4485 . ./myread
4486 case "$ans" in
4487 y|Y) val="$define" ;;
4488 *) val="$undef" ;;
4489 esac
4490 ;;
4491esac
4492set uselargefiles
4493eval $setvar
4494case "$uselargefiles" in
4495"$define")
4496: Look for a hint-file generated 'call-back-unit'. If the
4497: user has specified that a large files perl is to be built,
4498: we may need to set or change some other defaults.
4499 if $test -f uselargefiles.cbu; then
4500 echo "Your platform has some specific hints for large file builds, using them..."
4501 . ./uselargefiles.cbu
4502 echo " "
4503 echo "Rechecking to see how big your file offsets are..." >&4
4504 $cat >try.c <<EOCP
4505#include <sys/types.h>
4506#include <stdio.h>
4507int main()
4508{
4509 printf("%d\n", (int)sizeof($lseektype));
4510 return(0);
4511}
4512EOCP
4513 set try
4514 if eval $compile_ok; then
4515 lseeksize=`./try`
4516 $echo "Your file offsets are now $lseeksize bytes long."
4517 else
4518 dflt="$lseeksize"
4519 echo " "
4520 echo "(I can't seem to compile the test program. Guessing...)"
4521 rp="What is the size of your file offsets (in bytes)?"
4522 . ./myread
4523 lseeksize="$ans"
4524 fi
4525 case "$fpostype" in
4526 *_t) zzz="$fpostype" ;;
4527 *) zzz="fpos_t" ;;
4528 esac
4529 $echo $n "Rechecking the size of $zzz...$c" >&4
4530 $cat > try.c <<EOCP
4531#include <sys/types.h>
4532#include <stdio.h>
4533int main() {
4534 printf("%d\n", (int)sizeof($fpostype));
4535 exit(0);
4536}
4537EOCP
4538 set try
4539 if eval $compile_ok; then
4540 yyy=`./try`
4541 dflt="$lseeksize"
4542 case "$yyy" in
4543 '') echo " "
4544 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4545 ;;
4546 *) fpossize=$yyy
4547 echo " $fpossize bytes." >&4
4548 ;;
4549 esac
4550 else
4551 dflt="$fpossize"
4552 echo " "
4553 echo "(I can't compile the test program. Guessing...)" >&4
4554 rp="What is the size of your file positions (in bytes)?"
4555 . ./myread
4556 fpossize="$ans"
4557 fi
4558 $rm -f try.c try
4559 fi
4560 ;;
4561esac
4562
4563
4564case "$usemorebits" in
4565"$define"|true|[yY]*)
4566 use64bitint="$define"
4567 uselongdouble="$define"
4568 usemorebits="$define"
4569 ;;
4570*) usemorebits="$undef"
4571 ;;
4572esac
4573
8dfa8df9
JH
4574: check for void type
4575echo " "
4576echo "Checking to see how well your C compiler groks the void type..." >&4
4577case "$voidflags" in
4578'')
4579 $cat >try.c <<'EOCP'
4580#if TRY & 1
4581void sub() {
4582#else
4583sub() {
4584#endif
4585 extern void moo(); /* function returning void */
4586 void (*goo)(); /* ptr to func returning void */
4587#if TRY & 8
4588 void *hue; /* generic ptr */
4589#endif
4590#if TRY & 2
4591 void (*foo[10])();
4592#endif
4593
4594#if TRY & 4
4595 if(goo == moo) {
4596 exit(0);
4597 }
4598#endif
4599 exit(0);
4600}
4601int main() { sub(); }
4602EOCP
4603 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4604 voidflags=$defvoidused
4605 echo "Good. It appears to support void to the level $package wants.">&4
4606 if $contains warning .out >/dev/null 2>&1; then
4607 echo "However, you might get some warnings that look like this:"
4608 $cat .out
4609 fi
4610 else
4611echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4612 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4613 echo "It supports 1..."
4614 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4615 echo "It also supports 2..."
4616 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4617 voidflags=7
4618 echo "And it supports 4 but not 8 definitely."
4619 else
4620 echo "It doesn't support 4..."
4621 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4622 voidflags=11
4623 echo "But it supports 8."
4624 else
4625 voidflags=3
4626 echo "Neither does it support 8."
4627 fi
4628 fi
4629 else
4630 echo "It does not support 2..."
4631 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4632 voidflags=13
4633 echo "But it supports 4 and 8."
4634 else
4635 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4636 voidflags=5
4637 echo "And it supports 4 but has not heard about 8."
4638 else
4639 echo "However it supports 8 but not 4."
4640 fi
4641 fi
4642 fi
4643 else
4644 echo "There is no support at all for void."
4645 voidflags=0
4646 fi
4647 fi
4648esac
4649case "$voidflags" in
4650"$defvoidused") ;;
4651*) $cat >&4 <<'EOM'
4652 Support flag bits are:
4653 1: basic void declarations.
4654 2: arrays of pointers to functions returning void.
4655 4: operations between pointers to and addresses of void functions.
4656 8: generic void pointers.
4657EOM
4658 dflt="$voidflags";
4659 rp="Your void support flags add up to what?"
4660 . ./myread
4661 voidflags="$ans"
4662 ;;
4663esac
4664$rm -f try.* .out
4665
4666: check for length of pointer
4667echo " "
4668case "$ptrsize" in
4669'')
4670 echo "Checking to see how big your pointers are..." >&4
4671 if test "$voidflags" -gt 7; then
4672 echo '#define VOID_PTR char *' > try.c
4673 else
4674 echo '#define VOID_PTR void *' > try.c
4675 fi
4676 $cat >>try.c <<'EOCP'
4677#include <stdio.h>
4678int main()
4679{
4680 printf("%d\n", (int)sizeof(VOID_PTR));
4681 exit(0);
4682}
4683EOCP
4684 set try
4685 if eval $compile_ok; then
4686 ptrsize=`./try`
4687 echo "Your pointers are $ptrsize bytes long."
4688 else
4689 dflt='4'
4690 echo "(I can't seem to compile the test program. Guessing...)" >&4
4691 rp="What is the size of a pointer (in bytes)?"
4692 . ./myread
4693 ptrsize="$ans"
4694 fi
4695 ;;
4696esac
4697$rm -f try.c try
4698
4699: check for long long
4700echo " "
4701echo "Checking to see if you have long long..." >&4
4702echo 'int main() { long long x = 7; return 0; }' > try.c
4703set try
4704if eval $compile; then
4705 val="$define"
4706 echo "You have long long."
4707else
4708 val="$undef"
4709 echo "You do not have long long."
4710fi
4711$rm try.*
4712set d_longlong
4713eval $setvar
4714
4715: check for length of long long
4716case "${d_longlong}${longlongsize}" in
4717$define)
4718 echo " "
4719 echo "Checking to see how big your long longs are..." >&4
4720 $cat >try.c <<'EOCP'
4721#include <stdio.h>
4722int main()
4723{
4724 printf("%d\n", (int)sizeof(long long));
4725 return(0);
4726}
4727EOCP
4728 set try
4729 if eval $compile_ok; then
4730 longlongsize=`./try$exe_ext`
4731 echo "Your long longs are $longlongsize bytes long."
4732 else
4733 dflt='8'
4734 echo " "
4735 echo "(I can't seem to compile the test program. Guessing...)"
4736 rp="What is the size of a long long (in bytes)?"
4737 . ./myread
4738 longlongsize="$ans"
4739 fi
4740 if $test "X$longsize" = "X$longlongsize"; then
4741 echo "(That isn't any different from an ordinary long.)"
4742 fi
4743 ;;
4744esac
4745$rm -f try.* try
4746
4747: determine filename position in cpp output
4748echo " "
4749echo "Computing filename position in cpp output for #include directives..." >&4
4750echo '#include <stdio.h>' > foo.c
4751$cat >fieldn <<EOF
4752$startsh
4753$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4754$grep '^[ ]*#.*stdio\.h' | \
4755while read cline; do
4756 pos=1
4757 set \$cline
4758 while $test \$# -gt 0; do
4759 if $test -r \`echo \$1 | $tr -d '"'\`; then
4760 echo "\$pos"
4761 exit 0
4762 fi
4763 shift
4764 pos=\`expr \$pos + 1\`
4765 done
4766done
4767EOF
4768chmod +x fieldn
4769fieldn=`./fieldn`
4770$rm -f foo.c fieldn
4771case $fieldn in
4772'') pos='???';;
47731) pos=first;;
47742) pos=second;;
47753) pos=third;;
4776*) pos="${fieldn}th";;
4777esac
4778echo "Your cpp writes the filename in the $pos field of the line."
4779
4780: locate header file
4781$cat >findhdr <<EOF
4782$startsh
4783wanted=\$1
4784name=''
4785for usrincdir in $usrinc
4786do
4787 if test -f \$usrincdir/\$wanted; then
4788 echo "\$usrincdir/\$wanted"
4789 exit 0
4790 fi
4791done
4792awkprg='{ print \$$fieldn }'
4793echo "#include <\$wanted>" > foo\$\$.c
4794$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4795$grep "^[ ]*#.*\$wanted" | \
4796while read cline; do
4797 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4798 case "\$name" in
4799 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4800 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4801 *) exit 2;;
4802 esac;
4803done;
4804#
4805# status = 0: grep returned 0 lines, case statement not executed
4806# status = 1: headerfile found
4807# status = 2: while loop executed, no headerfile found
4808#
4809status=\$?
4810$rm -f foo\$\$.c;
4811if test \$status -eq 1; then
4812 exit 0;
4813fi
4814exit 1
4815EOF
4816chmod +x findhdr
4817
4818: define an alternate in-header-list? function
4819inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4820cont=true; xxf="echo \"<\$1> found.\" >&4";
4821case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4822*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4823esac;
4824case $# in 4) instead=instead;; *) instead="at last";; esac;
4825while $test "$cont"; do
4826 xxx=`./findhdr $1`
4827 var=$2; eval "was=\$$2";
4828 if $test "$xxx" && $test -r "$xxx";
4829 then eval $xxf;
4830 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4831 cont="";
4832 else eval $xxnf;
4833 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4834 set $yyy; shift; shift; yyy=$@;
4835 case $# in 0) cont="";;
4836 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4837 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4838 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4839 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4840 esac;
4841done;
4842while $test "$yyy";
4843do set $yyy; var=$2; eval "was=\$$2";
4844 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4845 set $yyy; shift; shift; yyy=$@;
4846done'
4847
4848: see if inttypes.h is available
4849: we want a real compile instead of Inhdr because some systems
4850: have an inttypes.h which includes non-existent headers
4851echo " "
4852$cat >try.c <<EOCP
4853#include <inttypes.h>
4854int main() {
4855 static int32_t foo32 = 0x12345678;
4856}
4857EOCP
4858set try
4859if eval $compile; then
4860 echo "<inttypes.h> found." >&4
4861 val="$define"
4862else
4863 echo "<inttypes.h> NOT found." >&4
4864 val="$undef"
4865fi
4866$rm -f try.c try
4867set i_inttypes
4868eval $setvar
4869
4870: check for int64_t
4871echo " "
4872echo "Checking to see if you have int64_t..." >&4
4873$cat >try.c <<EOCP
4874#include <sys/types.h>
4875#$i_inttypes I_INTTYPES
4876#ifdef I_INTTYPES
4877#include <inttypes.h>
4878#endif
4879int main() { int64_t x = 7; }
4880EOCP
4881set try
4882if eval $compile; then
4883 val="$define"
4884 echo "You have int64_t."
4885else
4886 val="$undef"
4887 echo "You do not have int64_t."
4888fi
4889$rm -f try try.*
4890set d_int64_t
4891eval $setvar
4892
4893
4894echo " "
4895echo "Checking which 64-bit integer type we could use..." >&4
4896
4897case "$intsize" in
48988) val=int
4899 set quadtype
4900 eval $setvar
4901 val='"unsigned int"'
4902 set uquadtype
4903 eval $setvar
4904 quadkind=1
4905 ;;
4906*) case "$longsize" in
4907 8) val=long
4908 set quadtype
4909 eval $setvar
4910 val='"unsigned long"'
4911 set uquadtype
4912 eval $setvar
4913 quadkind=2
4914 ;;
4915 *) case "$d_longlong:$longlongsize" in
4916 define:8)
4917 val='"long long"'
4918 set quadtype
4919 eval $setvar
4920 val='"unsigned long long"'
4921 set uquadtype
4922 eval $setvar
4923 quadkind=3
4924 ;;
4925 *) case "$d_int64_t" in
4926 define)
4927 val=int64_t
4928 set quadtype
4929 eval $setvar
4930 val=uint64_t
4931 set uquadtype
4932 eval $setvar
4933 quadkind=4
4934 ;;
4935 esac
4936 ;;
4937 esac
4938 ;;
4939 esac
4940 ;;
4941esac
4942
4943case "$quadtype" in
4944'') echo "Alas, no 64-bit integer types in sight." >&4
4945 d_quad="$undef"
4946 ;;
4947*) echo "We could use '$quadtype' for 64-bit integers." >&4
4948 d_quad="$define"
4949 ;;
4950esac
4951
b4eb6b3d
JH
4952
4953case "$uselonglong" in
4954"$define"|true|[yY]*)
4955 cat <<EOM >&4
4956
4957*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4958EOM
4959 use64bitint="$define"
4960 ;;
4961esac
4962case "$use64bits" in
4963"$define"|true|[yY]*)
4964 cat <<EOM >&4
4965
4966*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4967EOM
4968 use64bitint="$define"
4969 ;;
4970esac
4971case "$use64bitints" in
4972"$define"|true|[yY]*)
4973 cat <<EOM >&4
4974
4975*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4976EOM
4977 use64bitint="$define"
4978 ;;
4979esac
4980case "$use64bitsint" in
4981"$define"|true|[yY]*)
4982 cat <<EOM >&4
4983
4984*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4985EOM
4986 use64bitint="$define"
4987 ;;
4988esac
4989case "$uselonglongs" in
4990"$define"|true|[yY]*)
4991 cat <<EOM >&4
4992
4993*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4994EOM
4995 use64bitint="$define"
4996 ;;
4997esac
4998case "$use64bitsall" in
4999"$define"|true|[yY]*)
5000 cat <<EOM >&4
5001
5002*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5003EOM
5004 use64bitall="$define"
5005 ;;
5006esac
5007
5008case "$ccflags" in
5009*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5010esac
5011case "$use64bitall" in
5012"$define"|true|[yY]*) use64bitint="$define" ;;
5013esac
5014
5015case "$longsize" in
50168) cat <<EOM
5017
5018You have natively 64-bit long integers.
5019EOM
5020 val="$define"
5021 ;;
5022*) case "$use64bitint" in
5023 "$define"|true|[yY]*) dflt='y';;
5024 *) dflt='n';;
5025 esac
8dfa8df9
JH
5026 case "$d_quad" in
5027 "$define") ;;
5028 *) dflt='n' ;;
5029 esac
b4eb6b3d
JH
5030 cat <<EOM
5031
5032Perl can be built to take advantage of 64-bit integer types
5033on some systems. To do so, Configure can be run with -Duse64bitint.
5034Choosing this option will most probably introduce binary incompatibilities.
5035
5036If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5037(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5038EOM
5039 rp='Try to use 64-bit integers, if available?'
5040 . ./myread
5041 case "$ans" in
5042 [yY]*) val="$define" ;;
5043 *) val="$undef" ;;
5044 esac
5045 ;;
5046esac
5047set use64bitint
5048eval $setvar
5049
5050case "$use64bitall" in
5051"$define"|true|[yY]*) dflt='y' ;;
5052*) case "$longsize" in
5053 8) dflt='y' ;;
5054 *) dflt='n' ;;
5055 esac
5056 ;;
5057esac
5058cat <<EOM
5059
5060You may also choose to try maximal 64-bitness. It means using as much
506164-bitness as possible on the platform. This in turn means even more
5062binary incompatibilities. On the other hand, your platform may not
5063have any more 64-bitness available than what you already have chosen.
5064
5065If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5066(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5067EOM
5068rp='Try to use maximal 64-bit support, if available?'
5069. ./myread
5070case "$ans" in
5071[yY]*) val="$define" ;;
5072*) val="$undef" ;;
5073esac
5074set use64bitall
5075eval $setvar
5076case "$use64bitall" in
5077"$define")
5078 case "$use64bitint" in
5079 "$undef")
5080 cat <<EOM
5081
5082Since you have chosen a maximally 64-bit build, I'm also turning on
5083the use of 64-bit integers.
5084EOM
5085 use64bitint="$define" ;;
5086 esac
5087 ;;
5088esac
5089
8dfa8df9
JH
5090case "$use64bitall" in
5091"$define"|true|[yY]*)
5092 case "$ptrsize" in
5093 4) cat <<EOM >&4
5094
5095*** You have chosen a maximally 64-bit build, but your pointers
5096*** are only 4 bytes wide, disabling maximal 64-bitness.
5097
5098EOM
5099 use64bitall="$undef"
5100 case "$use64bitint" in
5101 "$define"|true|[yY]*) ;;
5102 *) cat <<EOM >&4
5103
5104*** Downgrading from maximal 64-bitness to using 64-bit integers.
5105
5106EOM
5107 use64bitint="$define"
5108 ;;
5109 esac
5110 ;;
5111 esac
5112 ;;
5113esac
5114
b4eb6b3d
JH
5115case "$use64bitint" in
5116"$define"|true|[yY]*)
5117: Look for a hint-file generated 'call-back-unit'. If the
5118: user has specified that a 64-bit perl is to be built,
5119: we may need to set or change some other defaults.
5120 if $test -f use64bitint.cbu; then
5121 echo "Your platform has some specific hints for 64-bit integers, using them..."
5122 . ./use64bitint.cbu
5123 fi
5124 case "$longsize" in
5125 4) case "$archname64" in
5126 '') archname64=64int ;;
5127 esac
5128 ;;
5129 esac
5130 ;;
5131esac
5132
5133case "$use64bitall" in
5134"$define"|true|[yY]*)
5135: Look for a hint-file generated 'call-back-unit'. If the
5136: user has specified that a maximally 64-bit perl is to be built,
5137: we may need to set or change some other defaults.
5138 if $test -f use64bitall.cbu; then
5139 echo "Your platform has some specific hints for 64-bit builds, using them..."
5140 . ./use64bitall.cbu
5141 fi
5142 case "$longsize" in
5143 4) case "$archname64" in
5144 ''|64int) archname64=64all ;;
5145 esac
5146 ;;
5147 esac
5148 ;;
5149esac
5150
5151echo " "
5152echo "Checking for GNU C Library..." >&4
5153cat >gnulibc.c <<EOM
5154#include <stdio.h>
5155int main()
5156{
5157#ifdef __GLIBC__
5158 exit(0);
5159#else
5160 exit(1);
5161#endif
5162}
5163EOM
5164set gnulibc
5165if eval $compile_ok && ./gnulibc; then
5166 val="$define"
5167 echo "You are using the GNU C Library"
5168else
5169 val="$undef"
5170 echo "You are not using the GNU C Library"
5171fi
5172$rm -f gnulibc*
5173set d_gnulibc
5174eval $setvar
5175
5176: see if nm is to be used to determine whether a symbol is defined or not
5177case "$usenm" in
5178'')
5179 dflt=''
c1a7f87b
JH
5180 case "$d_gnulibc" in
5181 "$define")
5182 echo " "
5183 echo "nm probably won't work on the GNU C Library." >&4
5184 dflt=n
bd9b35c9 5185 ;;
c1a7f87b
JH
5186 esac
5187 case "$dflt" in
5188 '')
5189 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5190 echo " "
5191 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
5192 echo "'nm' won't be sufficient on this sytem." >&4
5193 dflt=n
5194 fi
5195 ;;
5196 esac
5197 case "$dflt" in
5198 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5199 if $test $dflt -gt 20; then
5200 dflt=y
5201 else
5202 dflt=n
5203 fi
bd9b35c9
JH
5204 ;;
5205 esac
bd9b35c9
JH
5206 ;;
5207*)
c1a7f87b
JH
5208 case "$usenm" in
5209 true|$define) dflt=y;;
5210 *) dflt=n;;
5211 esac
bd9b35c9
JH
5212 ;;
5213esac
5214$cat <<EOM
5215
c1a7f87b
JH
5216I can use $nm to extract the symbols from your C libraries. This
5217is a time consuming task which may generate huge output on the disk (up
5218to 3 megabytes) but that should make the symbols extraction faster. The
5219alternative is to skip the 'nm' extraction part and to compile a small
5220test program instead to determine whether each symbol is present. If
5221you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5222this may be the best solution.
5223
5224You probably shouldn't let me use 'nm' if you are using the GNU C Library.
bd9b35c9
JH
5225
5226EOM
c1a7f87b
JH
5227rp="Shall I use $nm to extract C symbols from the libraries?"
5228. ./myread
5229case "$ans" in
5230[Nn]*) usenm=false;;
5231*) usenm=true;;
bd9b35c9 5232esac
bd9b35c9 5233
c1a7f87b
JH
5234runnm=$usenm
5235case "$reuseval" in
5236true) runnm=false;;
8e07c86e 5237esac
29209bc5 5238
c1a7f87b
JH
5239: nm options which may be necessary
5240case "$nm_opt" in
5241'') if $test -f /mach_boot; then
5242 nm_opt='' # Mach
5243 elif $test -d /usr/ccs/lib; then
5244 nm_opt='-p' # Solaris (and SunOS?)
5245 elif $test -f /dgux; then
5246 nm_opt='-p' # DG-UX
5247 elif $test -f /lib64/rld; then
5248 nm_opt='-p' # 64-bit Irix
5249 else
5250 nm_opt=''
5251 fi;;
5252esac
bd9b35c9 5253
c1a7f87b
JH
5254: nm options which may be necessary for shared libraries but illegal
5255: for archive libraries. Thank you, Linux.
5256case "$nm_so_opt" in
5257'') case "$myuname" in
5258 *linux*)
5259 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5260 nm_so_opt='--dynamic'
5261 fi
5262 ;;
bd9b35c9 5263 esac
c1a7f87b
JH
5264 ;;
5265esac
8e07c86e 5266
c1a7f87b
JH
5267case "$runnm" in
5268true)
5269: get list of predefined functions in a handy place
5270echo " "
5271case "$libc" in
5272'') libc=unknown
5273 case "$libs" in
5274 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
bd9b35c9 5275 esac
ff935051
JH
5276 ;;
5277esac
c1a7f87b
JH
5278libnames='';
5279case "$libs" in
5280'') ;;
5281*) for thislib in $libs; do
5282 case "$thislib" in
5283 -lc|-lc_s)
5284 : Handle C library specially below.
5285 ;;
5286 -l*)
5287 thislib=`echo $thislib | $sed -e 's/^-l//'`
5288 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5289 :
5290 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5291 :
5292 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5293 :
5294 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5295 :
5296 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5297 :
5298 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5299 :
5300 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5301 :
5302 else
5303 try=''
5304 fi
5305 libnames="$libnames $try"
5306 ;;
5307 *) libnames="$libnames $thislib" ;;
34d1710f 5308 esac
c1a7f87b 5309 done
4633a7c4
LW
5310 ;;
5311esac
c1a7f87b
JH
5312xxx=normal
5313case "$libc" in
5314unknown)
5315 set /lib/libc.$so
5316 for xxx in $libpth; do
5317 $test -r $1 || set $xxx/libc.$so
5318 : The messy sed command sorts on library version numbers.
5319 $test -r $1 || \
5320 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5321 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5322 h
5323 s/[0-9][0-9]*/0000&/g
5324 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5325 G
5326 s/\n/ /' | \
381aa1ff 5327 $sort | $sed -e 's/^.* //'`
c1a7f87b
JH
5328 eval set \$$#
5329 done
5330 $test -r $1 || set /usr/ccs/lib/libc.$so
5331 $test -r $1 || set /lib/libsys_s$_a
5332 ;;
5333*)
5334 set blurfl
5335 ;;
a4f3eea9 5336esac
c1a7f87b
JH
5337if $test -r "$1"; then
5338 echo "Your (shared) C library seems to be in $1."
5339 libc="$1"
5340elif $test -r /lib/libc && $test -r /lib/clib; then
5341 echo "Your C library seems to be in both /lib/clib and /lib/libc."
5342 xxx=apollo
5343 libc='/lib/clib /lib/libc'
5344 if $test -r /lib/syslib; then
5345 echo "(Your math library is in /lib/syslib.)"
5346 libc="$libc /lib/syslib"
5347 fi
5348elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5349 echo "Your C library seems to be in $libc, as you said before."
5350elif $test -r $incpath/usr/lib/libc$_a; then
5351 libc=$incpath/usr/lib/libc$_a;
5352 echo "Your C library seems to be in $libc. That's fine."
5353elif $test -r /lib/libc$_a; then
5354 libc=/lib/libc$_a;
5355 echo "Your C library seems to be in $libc. You're normal."
5356else
5357 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5358 :
5359 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5360 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5361 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5362 :
5363 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5364 :
5365 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5366 :
5367 else
5368 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5369 fi
5370 if $test -r "$tans"; then
5371 echo "Your C library seems to be in $tans, of all places."
5372 libc=$tans
5373 else
5374 libc='blurfl'
5375 fi
5376fi
5377if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5378 dflt="$libc"
5379 cat <<EOM
a4f3eea9 5380
c1a7f87b
JH
5381If the guess above is wrong (which it might be if you're using a strange
5382compiler, or your machine supports multiple models), you can override it here.
bd9b35c9
JH
5383
5384EOM
a4f3eea9 5385else
c1a7f87b 5386 dflt=''
381aa1ff 5387 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
c1a7f87b
JH
5388 cat >&4 <<EOM
5389I can't seem to find your C library. I've looked in the following places:
a4f3eea9 5390
c1a7f87b
JH
5391EOM
5392 $sed 's/^/ /' libpath
5393 cat <<EOM
29209bc5 5394
c1a7f87b 5395None of these seems to contain your C library. I need to get its name...
a4f3eea9 5396
bd9b35c9 5397EOM
bd9b35c9 5398fi
c1a7f87b
JH
5399fn=f
5400rp='Where is your C library?'
5401. ./getfile
5402libc="$ans"
a4f3eea9 5403
c1a7f87b 5404echo " "
381aa1ff 5405echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
c1a7f87b
JH
5406set X `cat libnames`
5407shift
5408xxx=files
5409case $# in 1) xxx=file; esac
5410echo "Extracting names from the following $xxx for later perusal:" >&4
5411echo " "
5412$sed 's/^/ /' libnames >&4
5413echo " "
5414$echo $n "This may take a while...$c" >&4
a4f3eea9 5415
c1a7f87b
JH
5416for file in $*; do
5417 case $file in
5418 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5419 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 5420 esac
c1a7f87b 5421done >libc.tmp
a4f3eea9 5422
c1a7f87b
JH
5423$echo $n ".$c"
5424$grep fprintf libc.tmp > libc.ptf
5425xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5426xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5427xxx='[ADTSIW]'
5428if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
5429 eval $xscan;\
5430 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5431 eval $xrun
5432elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5433 eval $xscan;\
5434 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5435 eval $xrun
5436elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5437 eval $xscan;\
5438 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5439 eval $xrun
5440elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5441 eval $xscan;\
5442 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5443 eval $xrun
5444elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5445 eval $xscan;\
5446 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5447 eval $xrun
5448elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5449 eval $xscan;\
5450 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5451 eval $xrun
5452elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5453 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
5454 eval $xscan;\
5455 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5456 eval $xrun
5457elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5458 eval $xscan;\
5459 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5460 eval $xrun
5461elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5462 eval $xscan;\
5463 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5464 eval $xrun
5465elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5466 eval $xscan;\
5467 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5468 eval $xrun
5469elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5470 eval $xscan;\
5471 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5472 eval $xrun
5473elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5474 eval $xscan;\
5475 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5476 eval $xrun
5477elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5478 eval $xscan;\
5479 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5480 eval $xrun
5481elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
5482 eval $xscan;\
5483 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5484 eval $xrun
5485else
5486 $nm -p $* 2>/dev/null >libc.tmp
5487 $grep fprintf libc.tmp > libc.ptf
5488 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5489 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5490 then
5491 nm_opt='-p'
5492 eval $xrun
bd9b35c9 5493 else
c1a7f87b
JH
5494 echo " "
5495 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5496 com=''
5497 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5498 for thisname in $libnames $libc; do
5499 $ar t $thisname >>libc.tmp
5500 done
5501 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5502 echo "Ok." >&4
5503 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5504 # Repeat libc to extract forwarders to DLL entries too
5505 for thisname in $libnames $libc; do
5506 $ar tv $thisname >>libc.tmp
5507 # Revision 50 of EMX has bug in $ar.
5508 # it will not extract forwarders to DLL entries
5509 # Use emximp which will extract exactly them.
5510 emximp -o tmp.imp $thisname \
5511 2>/dev/null && \
5512 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5513 < tmp.imp >>libc.tmp
5514 $rm tmp.imp
5515 done
5516 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5517 echo "Ok." >&4
5518 else
5519 echo "$ar didn't seem to work right." >&4
5520 echo "Maybe this is a Cray...trying bld instead..." >&4
5521 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5522 then
5523 for thisname in $libnames; do
5524 bld t $libnames | \
5525 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5526 $ar t $thisname >>libc.tmp
5527 done
5528 echo "Ok." >&4
bd9b35c9 5529 else
c1a7f87b
JH
5530 echo "That didn't work either. Giving up." >&4
5531 exit 1
bd9b35c9 5532 fi
c1a7f87b 5533 fi
a4f3eea9 5534 fi
a4f3eea9 5535fi
c1a7f87b
JH
5536nm_extract="$com"
5537if $test -f /lib/syscalls.exp; then
5538 echo " "
5539 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5540 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5541fi
5542;;
5543esac
5544$rm -f libnames libpath
bd9b35c9 5545
c1a7f87b
JH
5546: is a C symbol defined?
5547csym='tlook=$1;
5548case "$3" in
5549-v) tf=libc.tmp; tc=""; tdc="";;
5550-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5551*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5552esac;
5553tx=yes;
5554case "$reuseval-$4" in
5555true-) ;;
5556true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5557esac;
5558case "$tx" in
5559yes)
5560 case "$runnm" in
5561 true)
5562 if $contains $tlook $tf >/dev/null 2>&1;
5563 then tval=true;
5564 else tval=false;
5565 fi;;
5566 *)
5567 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
7a282f6d 5568 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
c1a7f87b
JH
5569 then tval=true;
5570 else tval=false;
5571 fi;
5572 $rm -f t t.c;;
5573 esac;;
5574*)
5575 case "$tval" in
5576 $define) tval=true;;
5577 *) tval=false;;
5578 esac;;
5579esac;
5580eval "$2=$tval"'
bd9b35c9 5581
c1a7f87b
JH
5582: define an is-in-libc? function
5583inlibc='echo " "; td=$define; tu=$undef;
5584sym=$1; var=$2; eval "was=\$$2";
5585tx=yes;
5586case "$reuseval$was" in
5587true) ;;
5588true*) tx=no;;
5589esac;
5590case "$tx" in
5591yes)
5592 set $sym tres -f;
5593 eval $csym;
5594 case "$tres" in
5595 true)
5596 echo "$sym() found." >&4;
5597 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5598 *)
5599 echo "$sym() NOT found." >&4;
5600 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5601 esac;;
bd9b35c9 5602*)
c1a7f87b
JH
5603 case "$was" in
5604 $define) echo "$sym() found." >&4;;
5605 *) echo "$sym() NOT found." >&4;;
5606 esac;;
5607esac'
5608
b4eb6b3d
JH
5609: see if sqrtl exists
5610set sqrtl d_sqrtl
c1a7f87b
JH
5611eval $inlibc
5612
b4eb6b3d
JH
5613case "$ccflags" in
5614*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
c1a7f87b 5615esac
b4eb6b3d
JH
5616
5617case "$uselongdouble" in
5618$define|true|[yY]*) dflt='y';;
5619*) dflt='n';;
5620esac
5621cat <<EOM
5622
5623Perl can be built to take advantage of long doubles which
5624(if available) may give more accuracy and range for floating point numbers.
5625
5626If this doesn't make any sense to you, just accept the default '$dflt'.
5627EOM
5628rp='Try to use long doubles if available?'
c1a7f87b
JH
5629. ./myread
5630case "$ans" in
b4eb6b3d
JH
5631y|Y) val="$define" ;;
5632*) val="$undef" ;;
5633esac
5634set uselongdouble
5635eval $setvar
bfb7748a 5636
b4eb6b3d
JH
5637case "$uselongdouble" in
5638true|[yY]*) uselongdouble="$define" ;;
5639esac
bfb7748a 5640
b4eb6b3d
JH
5641case "$uselongdouble" in
5642$define)
5643: Look for a hint-file generated 'call-back-unit'. If the
5644: user has specified that long doubles should be used,
5645: we may need to set or change some other defaults.
5646 if $test -f uselongdouble.cbu; then
5647 echo "Your platform has some specific hints for long doubles, using them..."
5648 . ./uselongdouble.cbu
5649 else
5650 $cat <<EOM
5651(Your platform doesn't have any specific hints for long doubles.)
c1a7f87b 5652EOM
b4eb6b3d
JH
5653 fi
5654 ;;
5655esac
5656
5657case "$uselongdouble:$d_sqrtl" in
5658$define:$undef)
5659 $cat <<EOM >&4
5660
5661*** You requested the use of long doubles but you do not seem to have
5662*** the mathematic functions for long doubles. I'm disabling the use
5663*** of long doubles.
5664
5665EOM
5666 uselongdouble=$undef
5667 ;;
5668esac
5669
5670: check for length of double
5671echo " "
5672case "$doublesize" in
5673'')
5674 echo "Checking to see how big your double precision numbers are..." >&4
5675 $cat >try.c <<'EOCP'
5676#include <stdio.h>
5677int main()
5678{
5679 printf("%d\n", (int)sizeof(double));
5680 exit(0);
5681}
5682EOCP
5683 set try
5684 if eval $compile_ok; then
5685 doublesize=`./try`
5686 echo "Your double is $doublesize bytes long."
5687 else
5688 dflt='8'
5689 echo "(I can't seem to compile the test program. Guessing...)"
5690 rp="What is the size of a double precision number (in bytes)?"
5691 . ./myread
5692 doublesize="$ans"
5693 fi
5694 ;;
5695esac
5696$rm -f try.c try
5697
5698: check for long doubles
5699echo " "
5700echo "Checking to see if you have long double..." >&4
5701echo 'int main() { long double x = 7.0; }' > try.c
5702set try
5703if eval $compile; then
5704 val="$define"
5705 echo "You have long double."
5706else
5707 val="$undef"
5708 echo "You do not have long double."
5709fi
5710$rm try.*
5711set d_longdbl
5712eval $setvar
5713
5714: check for length of long double
5715case "${d_longdbl}${longdblsize}" in
5716$define)
5717 echo " "
5718 echo "Checking to see how big your long doubles are..." >&4
5719 $cat >try.c <<'EOCP'
5720#include <stdio.h>
5721int main()
5722{
5723 printf("%d\n", sizeof(long double));
5724}
5725EOCP
5726 set try
5727 set try
5728 if eval $compile; then
5729 longdblsize=`./try$exe_ext`
5730 echo "Your long doubles are $longdblsize bytes long."
5731 else
5732 dflt='8'
5733 echo " "
5734 echo "(I can't seem to compile the test program. Guessing...)" >&4
5735 rp="What is the size of a long double (in bytes)?"
5736 . ./myread
5737 longdblsize="$ans"
5738 fi
5739 if $test "X$doublesize" = "X$longdblsize"; then
5740 echo "(That isn't any different from an ordinary double.)"
5741 fi
5742 ;;
5743esac
5744$rm -f try.* try
5745
51de783f 5746case "$useperlio" in
5a3a8a02 5747$define|true|[yY]*|'') dflt='y';;
51de783f
JH
5748*) dflt='n';;
5749esac
5750cat <<EOM
5751
5752Previous version of $package used the standard IO mechanisms as
5a3a8a02 5753defined in <stdio.h>. Versions 5.003_02 and later of $package allow
51de783f 5754alternate IO mechanisms via the PerlIO abstraction layer, but the
5a3a8a02
JH
5755stdio mechanism is still available if needed. The abstraction layer
5756can use AT&T's sfio (if you already have sfio installed) or regular stdio.
51de783f
JH
5757Using PerlIO with sfio may cause problems with some extension modules.
5758
5759If this doesn't make any sense to you, just accept the default '$dflt'.
5760EOM
5a3a8a02 5761rp='Use the PerlIO abstraction layer?'
51de783f
JH
5762. ./myread
5763case "$ans" in
5764y|Y)
5765 val="$define"
5a3a8a02 5766 ;;
51de783f
JH
5767*)
5768 echo "Ok, doing things the stdio way."
5769 val="$undef"
5770 ;;
5771esac
5772set useperlio
5773eval $setvar
5774
5775case "$usesocks" in
5776$define|true|[yY]*)
5777 case "$useperlio" in
5778 $define|true|[yY]*) ;;
5779 *) cat >&4 <<EOM
5780
5781You are using the SOCKS proxy protocol library which means that you
5782should also use the PerlIO layer. You may be headed for trouble.
5783
5784EOM
5785 ;;
5786 esac
5787 ;;
5788esac
5789
5790
b4eb6b3d
JH
5791: determine the architecture name
5792echo " "
5793if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5794 tarch=`arch`"-$osname"
5795elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5796 if uname -m > tmparch 2>&1 ; then
5797 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5798 -e 's/$/'"-$osname/" tmparch`
5799 else
5800 tarch="$osname"
5801 fi
5802 $rm -f tmparch
5803else
5804 tarch="$osname"
5805fi
5806case "$myarchname" in
5807''|"$tarch") ;;
5808*)
5809 echo "(Your architecture name used to be $myarchname.)"
5810 archname=''
5811 ;;
5812esac
5813myarchname="$tarch"
5814case "$archname" in
5815'') dflt="$tarch";;
5816*) dflt="$archname";;
5817esac
5818rp='What is your architecture name'
5819. ./myread
5820archname="$ans"
5821case "$usethreads" in
5822$define)
5823 echo "Threads selected." >&4
5824 case "$archname" in
5825 *-thread*) echo "...and architecture name already has -thread." >&4
5826 ;;
5827 *) archname="$archname-thread"
5828 echo "...setting architecture name to $archname." >&4
5829 ;;
5830 esac
5831 ;;
5832esac
5833case "$usemultiplicity" in
5834$define)
5835 echo "Multiplicity selected." >&4
5836 case "$archname" in
5837 *-multi*) echo "...and architecture name already has -multi." >&4
5838 ;;
5839 *) archname="$archname-multi"
5840 echo "...setting architecture name to $archname." >&4
5841 ;;
5842 esac
5843 ;;
5844esac
5845case "$use64bitint$use64bitall" in
5846*"$define"*)
5847 case "$archname64" in
5848 '')
5849 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5850 ;;
5851 *)
5852 case "$use64bitint" in
5853 "$define") echo "64 bit integers selected." >&4 ;;
5854 esac
5855 case "$use64bitall" in
5856 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5857 esac
5858 case "$archname" in
5859 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5860 ;;
5861 *) archname="$archname-$archname64"
5862 echo "...setting architecture name to $archname." >&4
5863 ;;
5864 esac
5865 ;;
5866 esac
5867esac
5868case "$uselongdouble" in
5869$define)
5870 echo "Long doubles selected." >&4
5871 case "$longdblsize" in
5872 $doublesize)
5873 "...but long doubles are equal to doubles, not changing architecture name." >&4
5874 ;;
5875 *)
5876 case "$archname" in
5877 *-ld*) echo "...and architecture name already has -ld." >&4
5878 ;;
5879 *) archname="$archname-ld"
5880 echo "...setting architecture name to $archname." >&4
5881 ;;
5882 esac
5883 ;;
5884 esac
5885 ;;
5886esac
51de783f
JH
5887case "$useperlio" in
5888$define)
5889 echo "Perlio selected." >&4
d46c9a2d
JH
5890 ;;
5891*)
5892 echo "Perlio not selected, using stdio." >&4
51de783f 5893 case "$archname" in
d46c9a2d 5894 *-stdio*) echo "...and architecture name already has -stdio." >&4
51de783f 5895 ;;
d46c9a2d 5896 *) archname="$archname-stdio"
51de783f
JH
5897 echo "...setting architecture name to $archname." >&4
5898 ;;
5899 esac
5900 ;;
5901esac
b4eb6b3d
JH
5902
5903: determine root of directory hierarchy where package will be installed.
5904case "$prefix" in
5905'')
5906 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5907 ;;
5908*)
5909 dflt="$prefix"
5910 ;;
5911esac
5912$cat <<EOM
5913
5914By default, $package will be installed in $dflt/bin, manual pages
5915under $dflt/man, etc..., i.e. with $dflt as prefix for all
5916installation directories. Typically this is something like /usr/local.
5917If you wish to have binaries under /usr/bin but other parts of the
5918installation under /usr/local, that's ok: you will be prompted
5919separately for each of the installation directories, the prefix being
5920only used to set the defaults.
5921
5922EOM
5923fn=d~
5924rp='Installation prefix to use?'
5925. ./getfile
5926oldprefix=''
5927case "$prefix" in
5928'') ;;
5929*)
5930 case "$ans" in
5931 "$prefix") ;;
5932 *) oldprefix="$prefix";;
5933 esac
5934 ;;
5935esac
5936prefix="$ans"
5937prefixexp="$ansexp"
5938
a6d26a0d
JH
5939case "$afsroot" in
5940'') afsroot=/afs ;;
5941*) afsroot=$afsroot ;;
5942esac
5943
b4eb6b3d
JH
5944: is AFS running?
5945echo " "
5946case "$afs" in
5947$define|true) afs=true ;;
5948$undef|false) afs=false ;;
a6d26a0d 5949*) if test -d $afsroot; then
b4eb6b3d
JH
5950 afs=true
5951 else
5952 afs=false
5953 fi
5954 ;;
5955esac
5956if $afs; then
5957 echo "AFS may be running... I'll be extra cautious then..." >&4
5958else
5959 echo "AFS does not seem to be running..." >&4
5960fi
5961
5962: determine installation prefix for where package is to be installed.
5963if $afs; then
5964$cat <<EOM
5965
5966Since you are running AFS, I need to distinguish the directory in which
5967files will reside from the directory in which they are installed (and from
5968which they are presumably copied to the former directory by occult means).
5969
5970EOM
5971 case "$installprefix" in
5972 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5973 *) dflt="$installprefix";;
5974 esac
5975else
5976$cat <<EOM
5977
5978In some special cases, particularly when building $package for distribution,
5979it is convenient to distinguish between the directory in which files should
5980be installed from the directory ($prefix) in which they
5981will eventually reside. For most users, these two directories are the same.
5982
5983EOM
5984 case "$installprefix" in
5985 '') dflt=$prefix ;;
5986 *) dflt=$installprefix;;
5987 esac
5988fi
5989fn=d~
5990rp='What installation prefix should I use for installing files?'
5991. ./getfile
5992installprefix="$ans"
5993installprefixexp="$ansexp"
5994
5995: set the prefixit variable, to compute a suitable default value
5996prefixit='case "$3" in
5997""|none)
5998 case "$oldprefix" in
5999 "") eval "$1=\"\$$2\"";;
6000 *)
6001 case "$3" in
6002 "") eval "$1=";;
6003 none)
6004 eval "tp=\"\$$2\"";
6005 case "$tp" in
6006 ""|" ") eval "$1=\"\$$2\"";;
6007 *) eval "$1=";;
6008 esac;;
6009 esac;;
6010 esac;;
6011*)
6012 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6013 case "$tp" in
6014 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6015 /*-$oldprefix/*|\~*-$oldprefix/*)
6016 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6017 *) eval "$1=\"\$$2\"";;
6018 esac;;
6019esac'
6020
6021
6022: get the patchlevel
6023echo " "
6024echo "Getting the current patchlevel..." >&4
6025if $test -r $rsrc/patchlevel.h;then
6026 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6027 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6028 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6029 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6030 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6031 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
151e6568 6032 perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
b4eb6b3d
JH
6033else
6034 revision=0
6035 patchlevel=0
6036 subversion=0
6037 api_revision=0
6038 api_version=0
6039 api_subversion=0
151e6568
MB
6040 perl_patchlevel=0
6041 $echo "(You do not have patchlevel.h. Eek.)"
b4eb6b3d 6042fi
151e6568
MB
6043if $test -r $rsrc/.patch ; then
6044 if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6045 perl_patchlevel=`cat $rsrc/.patch`
6046 fi
6047fi
6048case "$perl_patchlevel" in
60490) ;;
6050'') $echo "(You have $package version $patchlevel subversion $subversion.)" ;;
6051*) $echo "(You have $package version $patchlevel subversion $subversion patchlevel $perl_patchlevel.)" ;;
6052esac
b4eb6b3d
JH
6053case "$osname" in
6054dos|vms)
6055 : XXX Should be a Configure test for double-dots in filenames.
6056 version=`echo $revision $patchlevel $subversion | \
6057 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6058 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6059 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6060 ;;
6061*)
6062 version=`echo $revision $patchlevel $subversion | \
6063 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6064 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6065 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6066 ;;
6067esac
6068: Special case the 5.005_xx maintenance series, which used 5.005
6069: without any subversion label as a subdirectory in $sitelib
6070if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6071 api_versionstring='5.005'
6072fi
6073
6074: determine installation style
6075: For now, try to deduce it from prefix unless it is already set.
6076: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6077case "$installstyle" in
6078'') case "$prefix" in
6079 *perl*) dflt='lib';;
6080 *) dflt='lib/perl5' ;;
6081 esac
6082 ;;
6083*) dflt="$installstyle" ;;
6084esac
6085: Probably not worth prompting for this since we prompt for all
6086: the directories individually, and the prompt would be too long and
6087: confusing anyway.
6088installstyle=$dflt
6089
6090: determine where private library files go
6091: Usual default is /usr/local/lib/perl5/$version.
6092: Also allow things like /opt/perl/lib/$version, since
6093: /opt/perl/lib/perl5... would be redundant.
6094: The default "style" setting is made in installstyle.U
6095case "$installstyle" in
6096*lib/perl5*) set dflt privlib lib/$package/$version ;;
6097*) set dflt privlib lib/$version ;;
6098esac
6099eval $prefixit
6100$cat <<EOM
6101
6102There are some auxiliary files for $package that need to be put into a
6103private library directory that is accessible by everyone.
6104
6105EOM
6106fn=d~+
6107rp='Pathname where the private library files will reside?'
6108. ./getfile
6109privlib="$ans"
6110privlibexp="$ansexp"
6111: Change installation prefix, if necessary.
6112if $test X"$prefix" != X"$installprefix"; then
6113 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6114else
6115 installprivlib="$privlibexp"
6116fi
6117
6118: set the prefixup variable, to restore leading tilda escape
6119prefixup='case "$prefixexp" in
6120"$prefix") ;;
6121*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6122esac'
6123
6124: determine where public architecture dependent libraries go
6125set archlib archlib
6126eval $prefixit
6127: privlib default is /usr/local/lib/$package/$version
6128: archlib default is /usr/local/lib/$package/$version/$archname
6129: privlib may have an optional trailing /share.
6130tdflt=`echo $privlib | $sed 's,/share$,,'`
6131tdflt=$tdflt/$archname
6132case "$archlib" in
6133'') dflt=$tdflt
6134 ;;
6135*) dflt="$archlib"
6136 ;;
6137esac
6138$cat <<EOM
6139
6140$spackage contains architecture-dependent library files. If you are
6141sharing libraries in a heterogeneous environment, you might store
6142these files in a separate location. Otherwise, you can just include
6143them with the rest of the public library files.
6144
6145EOM
6146fn=d+~
6147rp='Where do you want to put the public architecture-dependent libraries?'
6148. ./getfile
6149archlib="$ans"
6150archlibexp="$ansexp"
6151if $test X"$archlib" = X"$privlib"; then
6152 d_archlib="$undef"
6153else
6154 d_archlib="$define"
6155fi
6156: Change installation prefix, if necessary.
6157if $test X"$prefix" != X"$installprefix"; then
6158 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6159else
6160 installarchlib="$archlibexp"
6161fi
6162
6163
6164: Binary compatibility with 5.005 is not possible for builds
6165: with advanced features
6166case "$usethreads$usemultiplicity" in
6167*define*)
6168 bincompat5005="$undef"
6169 d_bincompat5005="$undef"
6170 ;;
6171*) $cat <<EOM
6172
6173This version of Perl can be compiled for binary compatibility with 5.005.
6174If you decide to do so, you will be able to continue using most of the
6175extensions that were compiled for Perl 5.005.
6176
6177EOM
6178 case "$bincompat5005$d_bincompat5005" in
6179 *"$undef"*) dflt=n ;;
6180 *) dflt=y ;;
6181 esac
6182 rp='Binary compatibility with Perl 5.005?'
6183 . ./myread
6184 case "$ans" in
6185 y*) val="$define" ;;
6186 *) val="$undef" ;;
6187 esac
6188 set d_bincompat5005
6189 eval $setvar
6190 case "$d_bincompat5005" in
6191 "$define")
6192 bincompat5005="$define"
6193 ;;
6194 *) bincompat5005="$undef"
6195 d_bincompat5005="$undef"
6196 ;;
6197 esac
6198 ;;
6199esac
6200
6201
6202: see if setuid scripts can be secure
6203$cat <<EOM
6204
6205Some kernels have a bug that prevents setuid #! scripts from being
6206secure. Some sites have disabled setuid #! scripts because of this.
6207
6208First let's decide if your kernel supports secure setuid #! scripts.
6209(If setuid #! scripts would be secure but have been disabled anyway,
6210don't say that they are secure if asked.)
6211
6212EOM
6213
6214val="$undef"
6215if $test -d /dev/fd; then
6216 echo "#!$ls" >reflect
6217 chmod +x,u+s reflect
6218 ./reflect >flect 2>&1
6219 if $contains "/dev/fd" flect >/dev/null; then
6220 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6221 val="$define"
6222 else
6223 $cat <<EOM
6224If you are not sure if they are secure, I can check but I'll need a
6225username and password different from the one you are using right now.
6226If you don't have such a username or don't want me to test, simply
6227enter 'none'.
6228
6229EOM
6230 rp='Other username to test security of setuid scripts with?'
6231 dflt='none'
6232 . ./myread
6233 case "$ans" in
6234 n|none)
6235 case "$d_suidsafe" in
6236 '') echo "I'll assume setuid scripts are *not* secure." >&4
6237 dflt=n;;
6238 "$undef")
6239 echo "Well, the $hint value is *not* secure." >&4
6240 dflt=n;;
6241 *) echo "Well, the $hint value *is* secure." >&4
6242 dflt=y;;
6243 esac
c1a7f87b 6244 ;;
b4eb6b3d
JH
6245 *)
6246 $rm -f reflect flect
6247 echo "#!$ls" >reflect
6248 chmod +x,u+s reflect
6249 echo >flect
6250 chmod a+w flect
6251 echo '"su" will (probably) prompt you for '"$ans's password."
6252 su $ans -c './reflect >flect'
6253 if $contains "/dev/fd" flect >/dev/null; then
6254 echo "Okay, it looks like setuid scripts are secure." >&4
6255 dflt=y
6256 else
6257 echo "I don't think setuid scripts are secure." >&4
6258 dflt=n
6259 fi
6260 ;;
6261 esac
6262 rp='Does your kernel have *secure* setuid scripts?'
6263 . ./myread
6264 case "$ans" in
6265 [yY]*) val="$define";;
6266 *) val="$undef";;
6267 esac
6268 fi
6269else
6270 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6271 echo "(That's for file descriptors, not floppy disks.)"
6272 val="$undef"
6273fi
6274set d_suidsafe
6275eval $setvar
6276
6277$rm -f reflect flect
6278
6279: now see if they want to do setuid emulation
6280echo " "
6281val="$undef"
6282case "$d_suidsafe" in
6283"$define")
6284 val="$undef"
6285 echo "No need to emulate SUID scripts since they are secure here." >& 4
6286 ;;
6287*)
6288 $cat <<EOM
6289Some systems have disabled setuid scripts, especially systems where
6290setuid scripts cannot be secure. On systems where setuid scripts have
6291been disabled, the setuid/setgid bits on scripts are currently
6292useless. It is possible for $package to detect those bits and emulate
6293setuid/setgid in a secure fashion. This emulation will only work if
6294setuid scripts have been disabled in your kernel.
6295
6296EOM
6297 case "$d_dosuid" in
6298 "$define") dflt=y ;;
6299 *) dflt=n ;;
6300 esac
6301 rp="Do you want to do setuid/setgid emulation?"
6302 . ./myread
6303 case "$ans" in
6304 [yY]*) val="$define";;
6305 *) val="$undef";;
6306 esac
6307 ;;
6308esac
6309set d_dosuid
6310eval $setvar
6311
b4eb6b3d
JH
6312: see if this is a malloc.h system
6313set malloc.h i_malloc
6314eval $inhdr
6315
6316: see if stdlib is available
6317set stdlib.h i_stdlib
6318eval $inhdr
6319
6320: determine which malloc to compile in
6321echo " "
6322case "$usemymalloc" in
c4163172
JH
6323[yY]*|true|$define) dflt='y' ;;
6324[nN]*|false|$undef) dflt='n' ;;
6325*) case "$ptrsize" in
6326 4) dflt='y' ;;
6327 *) dflt='n' ;;
6328 esac
6329 ;;
8dfa8df9 6330esac
b4eb6b3d
JH
6331rp="Do you wish to attempt to use the malloc that comes with $package?"
6332. ./myread
6333usemymalloc="$ans"
6334case "$ans" in
6335y*|true)
6336 usemymalloc='y'
6337 mallocsrc='malloc.c'
6338 mallocobj="malloc$_o"
6339 d_mymalloc="$define"
6340 case "$libs" in
6341 *-lmalloc*)
6342 : Remove malloc from list of libraries to use
6343 echo "Removing unneeded -lmalloc from library list" >&4
6344 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6345 shift
6346 libs="$*"
6347 echo "libs = $libs" >&4
6348 ;;
6349 esac
6350 ;;
6351*)
6352 usemymalloc='n'
6353 mallocsrc=''
6354 mallocobj=''
6355 d_mymalloc="$undef"
6356 ;;
6357esac
6358
6359: compute the return types of malloc and free
6360echo " "
6361$cat >malloc.c <<END
6362#$i_malloc I_MALLOC
6363#$i_stdlib I_STDLIB
6364#include <stdio.h>
6365#include <sys/types.h>
6366#ifdef I_MALLOC
6367#include <malloc.h>
6368#endif
6369#ifdef I_STDLIB
6370#include <stdlib.h>
6371#endif
6372#ifdef TRY_MALLOC
6373void *malloc();
6374#endif
6375#ifdef TRY_FREE
6376void free();
6377#endif
6378END
6379case "$malloctype" in
6380'')
6381 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6382 malloctype='void *'
6383 else
6384 malloctype='char *'
6385 fi
6386 ;;
6387esac
6388echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6389
6390case "$freetype" in
6391'')
6392 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6393 freetype='void'
6394 else
6395 freetype='int'
6396 fi
6397 ;;
6398esac
6399echo "Your system uses $freetype free(), it would seem." >&4
6400$rm -f malloc.[co]
6401$cat <<EOM
6402
6403After $package is installed, you may wish to install various
6404add-on modules and utilities. Typically, these add-ons will
6405be installed under $prefix with the rest
6406of this package. However, you may wish to install such add-ons
6407elsewhere under a different prefix.
6408
6409If you do not wish to put everything under a single prefix, that's
6410ok. You will be prompted for the individual locations; this siteprefix
6411is only used to suggest the defaults.
6412
6413The default should be fine for most people.
6414
6415EOM
6416fn=d~+
6417rp='Installation prefix to use for add-on modules and utilities?'
6418: XXX Here might be another good place for an installstyle setting.
6419case "$siteprefix" in
6420'') dflt=$prefix ;;
6421*) dflt=$siteprefix ;;
6422esac
6423. ./getfile
6424: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6425oldsiteprefix=''
6426case "$siteprefix" in
6427'') ;;
6428*) case "$ans" in
6429 "$prefix") ;;
6430 *) oldsiteprefix="$prefix";;
6431 esac
6432 ;;
6433esac
6434siteprefix="$ans"
6435siteprefixexp="$ansexp"
6436
6437: determine where site specific libraries go.
6438: Usual default is /usr/local/lib/perl5/site_perl/$version
6439: The default "style" setting is made in installstyle.U
6440: XXX No longer works with Prefixit stuff.
6441prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6442case "$sitelib" in
6443'') case "$installstyle" in
6444 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6445 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6446 esac
6447 ;;
6448*) dflt="$sitelib"
6449 ;;
6450esac
6451$cat <<EOM
6452
6453The installation process will create a directory for
6454site-specific extensions and modules. Most users find it convenient
6455to place all site-specific files in this directory rather than in the
6456main distribution directory.
6457
6458EOM
6459fn=d~+
6460rp='Pathname for the site-specific library files?'
6461. ./getfile
6462sitelib="$ans"
6463sitelibexp="$ansexp"
6464sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6465: Change installation prefix, if necessary.
6466if $test X"$prefix" != X"$installprefix"; then
6467 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6468else
6469 installsitelib="$sitelibexp"
6470fi
6471
6472: determine where site specific architecture-dependent libraries go.
6473: sitelib default is /usr/local/lib/perl5/site_perl/$version
6474: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6475: sitelib may have an optional trailing /share.
6476case "$sitearch" in
6477'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6478 dflt="$dflt/$archname"
6479 ;;
6480*) dflt="$sitearch"
6481 ;;
6482esac
6483set sitearch sitearch none
6484eval $prefixit
6485$cat <<EOM
6486
6487The installation process will also create a directory for
6488architecture-dependent site-specific extensions and modules.
6489
6490EOM
6491fn=d~+
6492rp='Pathname for the site-specific architecture-dependent library files?'
6493. ./getfile
6494sitearch="$ans"
6495sitearchexp="$ansexp"
6496: Change installation prefix, if necessary.
6497if $test X"$prefix" != X"$installprefix"; then
6498 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6499else
6500 installsitearch="$sitearchexp"
6501fi
6502
6503$cat <<EOM
6504
6505The installation process will also create a directory for
6506vendor-supplied add-ons. Vendors who supply perl with their system
6507may find it convenient to place all vendor-supplied files in this
6508directory rather than in the main distribution directory. This will
6509ease upgrades between binary-compatible maintenance versions of perl.
6510
6511Of course you may also use these directories in whatever way you see
6512fit. For example, you might use them to access modules shared over a
6513company-wide network.
6514
6515The default answer should be fine for most people.
6516This causes further questions about vendor add-ons to be skipped
6517and no vendor-specific directories will be configured for perl.
6518
6519EOM
6520rp='Do you want to configure vendor-specific add-on directories?'
6521case "$usevendorprefix" in
6522define|true|[yY]*) dflt=y ;;
6523*) : User may have set vendorprefix directly on Configure command line.
6524 case "$vendorprefix" in
6525 ''|' ') dflt=n ;;
6526 *) dflt=y ;;
6527 esac
6528 ;;
6529esac
6530. ./myread
6531case "$ans" in
6532[yY]*) fn=d~+
6533 rp='Installation prefix to use for vendor-supplied add-ons?'
6534 case "$vendorprefix" in
6535 '') dflt='' ;;
6536 *) dflt=$vendorprefix ;;
6537 esac
6538 . ./getfile
6539 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6540 oldvendorprefix=''
6541 case "$vendorprefix" in
6542 '') ;;
6543 *) case "$ans" in
6544 "$prefix") ;;
6545 *) oldvendorprefix="$prefix";;
6546 esac
6547 ;;
6548 esac
6549 usevendorprefix="$define"
6550 vendorprefix="$ans"
6551 vendorprefixexp="$ansexp"
6552 ;;
6553*) usevendorprefix="$undef"
6554 vendorprefix=''
6555 vendorprefixexp=''
6556 ;;
6557esac
6558
6559case "$vendorprefix" in
6560'') d_vendorlib="$undef"
6561 vendorlib=''
6562 vendorlibexp=''
6563 ;;
6564*) d_vendorlib="$define"
6565 : determine where vendor-supplied modules go.
6566 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6567 case "$vendorlib" in
6568 '')
6569 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6570 case "$installstyle" in
6571 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6572 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6573 esac
6574 ;;
6575 *) dflt="$vendorlib"
6576 ;;
6577 esac
6578 fn=d~+
6579 rp='Pathname for the vendor-supplied library files?'
6580 . ./getfile
6581 vendorlib="$ans"
6582 vendorlibexp="$ansexp"
6583 ;;
6584esac
6585vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6586: Change installation prefix, if necessary.
6587if $test X"$prefix" != X"$installprefix"; then
6588 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6589else
6590 installvendorlib="$vendorlibexp"
6591fi
6592
6593case "$vendorprefix" in
6594'') d_vendorarch="$undef"
6595 vendorarch=''
6596 vendorarchexp=''
6597 ;;
6598*) d_vendorarch="$define"
6599 : determine where vendor-supplied architecture-dependent libraries go.
6600 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6601 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6602 : vendorlib may have an optional trailing /share.
6603 case "$vendorarch" in
6604 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6605 dflt="$dflt/$archname"
6606 ;;
6607 *) dflt="$vendorarch" ;;
6608 esac
6609 fn=d~+
6610 rp='Pathname for vendor-supplied architecture-dependent files?'
6611 . ./getfile
6612 vendorarch="$ans"
6613 vendorarchexp="$ansexp"
6614 ;;
6615esac
6616: Change installation prefix, if necessary.
6617if $test X"$prefix" != X"$installprefix"; then
6618 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6619else
6620 installvendorarch="$vendorarchexp"
6621fi
6622
6623: Final catch-all directories to search
6624$cat <<EOM
6625
6626Lastly, you can have perl look in other directories for extensions and
6627modules in addition to those already specified.
6628These directories will be searched after
6629 $sitearch
6630 $sitelib
6631EOM
6632test X"$vendorlib" != "X" && echo ' ' $vendorlib
6633test X"$vendorarch" != "X" && echo ' ' $vendorarch
6634echo ' '
6635case "$otherlibdirs" in
6636''|' ') dflt='none' ;;
6637*) dflt="$otherlibdirs" ;;
6638esac
6639$cat <<EOM
6640Enter a colon-separated set of extra paths to include in perl's @INC
6641search path, or enter 'none' for no extra paths.
6642
6643EOM
6644
6645rp='Colon-separated list of additional directories for perl to search?'
6646. ./myread
6647case "$ans" in
6648' '|''|none) otherlibdirs=' ' ;;
6649*) otherlibdirs="$ans" ;;
6650esac
6651case "$otherlibdirs" in
6652' ') val=$undef ;;
6653*) val=$define ;;
6654esac
6655set d_perl_otherlibdirs
6656eval $setvar
6657
6658: Cruising for prototypes
6659echo " "
6660echo "Checking out function prototypes..." >&4
6661$cat >prototype.c <<'EOCP'
6662int main(int argc, char *argv[]) {
6663 exit(0);}
6664EOCP
6665if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6666 echo "Your C compiler appears to support function prototypes."
6667 val="$define"
6668else
6669 echo "Your C compiler doesn't seem to understand function prototypes."
6670 val="$undef"
6671fi
6672set prototype
6673eval $setvar
6674$rm -f prototype*
6675
6676case "$prototype" in
6677"$define") ;;
6678*) ansi2knr='ansi2knr'
6679 echo " "
6680 cat <<EOM >&4
6681
6682$me: FATAL ERROR:
6683This version of $package can only be compiled by a compiler that
6684understands function prototypes. Unfortunately, your C compiler
6685 $cc $ccflags
6686doesn't seem to understand them. Sorry about that.
6687
6688If GNU cc is available for your system, perhaps you could try that instead.
6689
6690Eventually, we hope to support building Perl with pre-ANSI compilers.
6691If you would like to help in that effort, please contact <perlbug@perl.org>.
6692
6693Aborting Configure now.
6694EOM
6695 exit 2
6696 ;;
6697esac
6698
6699: determine where public executables go
6700echo " "
6701set dflt bin bin
6702eval $prefixit
6703fn=d~
6704rp='Pathname where the public executables will reside?'
6705. ./getfile
6706if $test "X$ansexp" != "X$binexp"; then
6707 installbin=''
6708fi
6709bin="$ans"
6710binexp="$ansexp"
6711: Change installation prefix, if necessary.
6712: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6713if $test X"$prefix" != X"$installprefix"; then
6714 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6715else
6716 installbin="$binexp"
6717fi
6718
6719: Find perl5.005 or later.
6720echo "Looking for a previously installed perl5.005 or later... "
6721case "$perl5" in
a938a3bb 6722'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
b4eb6b3d 6723 : Check if this perl is recent and can load a simple module
a938a3bb 6724 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
b4eb6b3d
JH
6725 perl5=$tdir/perl
6726 break;
a938a3bb
IZ
6727 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6728 perl5=$tdir/perl5
b4eb6b3d
JH
6729 break;
6730 fi
6731 done
6732 ;;
6733*) perl5="$perl5"
6734 ;;
6735esac
6736case "$perl5" in
6737'') echo "None found. That's ok.";;
6738*) echo "Using $perl5." ;;
6739esac
6740
6741: Determine list of previous versions to include in @INC
6742$cat > getverlist <<EOPL
6743#!$perl5 -w
6744use File::Basename;
6745\$api_versionstring = "$api_versionstring";
6746\$version = "$version";
6747\$stem = "$sitelib_stem";
6748\$archname = "$archname";
6749EOPL
6750 $cat >> getverlist <<'EOPL'
6751# Can't have leading @ because metaconfig interprets it as a command!
6752;@inc_version_list=();
6753# XXX Redo to do opendir/readdir?
6754if (-d $stem) {
6755 chdir($stem);
6756 ;@candidates = glob("5.*");
6757}
6758else {
6759 ;@candidates = ();
6760}
6761
6762# XXX ToDo: These comparisons must be reworked when two-digit
6763# subversions come along, so that 5.7.10 compares as greater than
6764# 5.7.3! By that time, hope that 5.6.x is sufficiently
6765# widespread that we can use the built-in version vectors rather
6766# than reinventing them here. For 5.6.0, however, we must
6767# assume this script will likely be run by 5.005_0x. --AD 1/2000.
6768foreach $d (@candidates) {
6769 if ($d lt $version) {
6770 if ($d ge $api_versionstring) {
6771 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6772 }
6773 elsif ($d ge "5.005") {
6774 unshift(@inc_version_list, grep { -d } $d);
6775 }
6776 }
6777 else {
6778 # Skip newer version. I.e. don't look in
6779 # 5.7.0 if we're installing 5.6.1.
6780 }
6781}
6782
6783if (@inc_version_list) {
6784 print join(' ', @inc_version_list);
6785}
6786else {
6787 # Blank space to preserve value for next Configure run.
6788 print " ";
6789}
6790EOPL
6791chmod +x getverlist
6792case "$inc_version_list" in
a938a3bb 6793'') if test -x "$perl5$exe_ext"; then
b4eb6b3d
JH
6794 dflt=`$perl5 getverlist`
6795 else
6796 dflt='none'
6797 fi
6798 ;;
6799$undef) dflt='none' ;;
6d1a7737 6800*) eval dflt=\"$inc_version_list\" ;;
b4eb6b3d
JH
6801esac
6802case "$dflt" in
6803''|' ') dflt=none ;;
6804esac
6805case "$dflt" in
68065.005) case "$bincompat5005" in
6807 $define|true|[yY]*) ;;
6808 *) dflt=none ;;
6809 esac
6810 ;;
6811esac
6812$cat <<'EOM'
6813
6814In order to ease the process of upgrading, this version of perl
6815can be configured to use modules built and installed with earlier
6816versions of perl that were installed under $prefix. Specify here
6817the list of earlier versions that this version of perl should check.
6818If Configure detected no earlier versions of perl installed under
6819$prefix, then the list will be empty. Answer 'none' to tell perl
6820to not search earlier versions.
6821
6822The default should almost always be sensible, so if you're not sure,
6823just accept the default.
6824EOM
6825
6826rp='List of earlier versions to include in @INC?'
6827. ./myread
6828case "$ans" in
6829[Nn]one|''|' ') inc_version_list=' ' ;;
6830*) inc_version_list="$ans" ;;
6831esac
6832case "$inc_version_list" in
6833''|' ')
6834 inc_version_list_init='0';;
6835*) inc_version_list_init=`echo $inc_version_list |
6836 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6837 ;;
6838esac
6839$rm -f getverlist
6840
6841: determine whether to install perl also as /usr/bin/perl
6842
6843echo " "
6844if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6845 $cat <<EOM
6846Many scripts expect perl to be installed as /usr/bin/perl.
6847I can install the perl you are about to compile also as /usr/bin/perl
6848(in addition to $installbin/perl).
6849EOM
6850 case "$installusrbinperl" in
6851 "$undef"|[nN]*) dflt='n';;
6852 *) dflt='y';;
6853 esac
6854 rp="Do you want to install perl as /usr/bin/perl?"
6855 . ./myread
6856 case "$ans" in
6857 [yY]*) val="$define";;
6858 *) val="$undef" ;;
6859 esac
6860else
6861 val="$undef"
6862fi
6863set installusrbinperl
6864eval $setvar
6865
6866: see if dld is available
6867set dld.h i_dld
6868eval $inhdr
6869
6870: see if dlopen exists
6871xxx_runnm="$runnm"
6872runnm=false
6873set dlopen d_dlopen
6874eval $inlibc
6875runnm="$xxx_runnm"
6876
6877: determine which dynamic loading, if any, to compile in
6878echo " "
6879dldir="ext/DynaLoader"
6880case "$usedl" in
6881$define|y|true)
6882 dflt='y'
6883 usedl="$define"
6884 ;;
6885$undef|n|false)
6886 dflt='n'
6887 usedl="$undef"
6888 ;;
6889*)
6890 dflt='n'
6891 case "$d_dlopen" in
6892 $define) dflt='y' ;;
6893 esac
6894 case "$i_dld" in
6895 $define) dflt='y' ;;
6896 esac
6897 : Does a dl_xxx.xs file exist for this operating system
6898 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6899 ;;
6900esac
6901rp="Do you wish to use dynamic loading?"
6902. ./myread
6903usedl="$ans"
6904case "$ans" in
6905y*) usedl="$define"
6906 case "$dlsrc" in
6907 '')
6908 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6909 dflt="$dldir/dl_${osname}.xs"
6910 elif $test "$d_dlopen" = "$define" ; then
6911 dflt="$dldir/dl_dlopen.xs"
6912 elif $test "$i_dld" = "$define" ; then
6913 dflt="$dldir/dl_dld.xs"
6914 else
6915 dflt=''
6916 fi
6917 ;;
6918 *) dflt="$dldir/$dlsrc"
6919 ;;
6920 esac
6921 echo "The following dynamic loading files are available:"
6922 : Can not go over to $dldir because getfile has path hard-coded in.
6923 tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6924 rp="Source file to use for dynamic loading"
6925 fn="fne"
6926 gfpth="$src"
6927 . ./getfile
6928 usedl="$define"
6929 : emulate basename
6930 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6931
6932 $cat << EOM
6933
6934Some systems may require passing special flags to $cc -c to
6935compile modules that will be used to create a shared library.
6936To use no flags, say "none".
6937
6938EOM
6939 case "$cccdlflags" in
6940 '') case "$gccversion" in
6941 '') case "$osname" in
6942 hpux) dflt='+z' ;;
6943 next) dflt='none' ;;
6944 irix*) dflt='-KPIC' ;;
48bcfe03 6945 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
6946 sunos) dflt='-pic' ;;
6947 *) dflt='none' ;;
6948 esac
6949 ;;
6950 *) case "$osname" in
48bcfe03 6951 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
6952 *) dflt='-fpic' ;;
6953 esac ;;
6954 esac ;;
6955 ' ') dflt='none' ;;
6956 *) dflt="$cccdlflags" ;;
6957 esac
6958 rp="Any special flags to pass to $cc -c to compile shared library modules?"
6959 . ./myread
6960 case "$ans" in
6961 none) cccdlflags=' ' ;;
6962 *) cccdlflags="$ans" ;;
6963 esac
6964
6965 cat << EOM
6966
6967Some systems use ld to create libraries that can be dynamically loaded,
6968while other systems (such as those using ELF) use $cc.
6969
6970EOM
6971 case "$ld" in
6972 '') $cat >try.c <<'EOM'
6973/* Test for whether ELF binaries are produced */
6974#include <fcntl.h>
6975#include <stdlib.h>
6976int main() {
6977 char b[4];
6978 int i = open("a.out",O_RDONLY);
6979 if(i == -1)
6980 exit(1); /* fail */
6981 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6982 exit(0); /* succeed (yes, it's ELF) */
6983 else
6984 exit(1); /* fail */
6985}
6986EOM
e4778687 6987 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && ./a.out; then
b4eb6b3d
JH
6988 cat <<EOM
6989You appear to have ELF support. I'll use $cc to build dynamic libraries.
6990EOM
6991 dflt="$cc"
6992 else
6993 echo "I'll use ld to build dynamic libraries."
6994 dflt='ld'
6995 fi
6996 rm -f try.c a.out
6997 ;;
6998 *) dflt="$ld"
6999 ;;
7000 esac
7001
7002 rp="What command should be used to create dynamic libraries?"
7003 . ./myread
7004 ld="$ans"
7005
7006 cat << EOM
7007
7008Some systems may require passing special flags to $ld to create a
7009library that can be dynamically loaded. If your ld flags include
7010-L/other/path options to locate libraries outside your loader's normal
7011search path, you may need to specify those -L options here as well. To
7012use no flags, say "none".
7013
7014EOM
7015 case "$lddlflags" in
7016 '') case "$osname" in
7017 beos) dflt='-nostart' ;;
7018 hpux) dflt='-b';
7019 case "$gccversion" in
7020 '') dflt="$dflt +vnocompatwarnings" ;;
7021 esac
7022 ;;
7023 linux|irix*) dflt='-shared' ;;
7024 next) dflt='none' ;;
7025 solaris) dflt='-G' ;;
7026 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7027 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7028 *) dflt='none' ;;
7029 esac
7030 ;;
7031 *) dflt="$lddlflags" ;;
7032 esac
7033
7034 : Try to guess additional flags to pick up local libraries.
7035 : Be careful not to append to a plain 'none'
7036 case "$dflt" in
7037 none) dflt='' ;;
7038 esac
7039 for thisflag in $ldflags; do
7040 case "$thisflag" in
7041 -L*|-R*)
7042 case " $dflt " in
7043 *" $thisflag "*) ;;
7044 *) dflt="$dflt $thisflag" ;;
7045 esac
7046 ;;
7047 esac
7048 done
7049
7050 case "$dflt" in
7051 ''|' ') dflt='none' ;;
7052 esac
7053
7054 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7055 . ./myread
7056 case "$ans" in
7057 none) lddlflags=' ' ;;
7058 *) lddlflags="$ans" ;;
7059 esac
7060
7061 cat <<EOM
7062
7063Some systems may require passing special flags to $cc to indicate that
7064the resulting executable will use dynamic linking. To use no flags,
7065say "none".
7066
7067EOM
7068 case "$ccdlflags" in
7069 '') case "$osname" in
7070 hpux) dflt='-Wl,-E' ;;
7071 linux) dflt='-rdynamic' ;;
7072 next) dflt='none' ;;
7073 sunos) dflt='none' ;;
7074 *) dflt='none' ;;
7075 esac ;;
7076 ' ') dflt='none' ;;
7077 *) dflt="$ccdlflags" ;;
7078 esac
7079 rp="Any special flags to pass to $cc to use dynamic linking?"
7080 . ./myread
7081 case "$ans" in
7082 none) ccdlflags=' ' ;;
7083 *) ccdlflags="$ans" ;;
7084 esac
7085 ;;
7086*) usedl="$undef"
7087 ld='ld'
7088 dlsrc='dl_none.xs'
7089 lddlflags=''
7090 ccdlflags=''
7091 ;;
7092esac
7093
7094also=''
7095case "$usedl" in
7096$undef)
7097 # No dynamic loading being used, so don't bother even to prompt.
7098 useshrplib='false'
7099 ;;
7100*) case "$useshrplib" in
7101 '') case "$osname" in
48bcfe03 7102 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7103 dflt=y
7104 also='Building a shared libperl is required for dynamic loading to work on your system.'
7105 ;;
7106 next*)
7107 case "$osvers" in
7108 4*) dflt=y
7109 also='Building a shared libperl is needed for MAB support.'
7110 ;;
7111 *) dflt=n
7112 ;;
7113 esac
7114 ;;
7115 *) dflt=n
7116 ;;
7117 esac
7118 ;;
7119 $define|true|[Yy]*)
7120 dflt=y
7121 ;;
7122 *) dflt=n
7123 ;;
7124 esac
7125 $cat << EOM
7126
7127The perl executable is normally obtained by linking perlmain.c with
7128libperl${_a}, any static extensions (usually just DynaLoader), and
7129any other libraries needed on this system (such as -lm, etc.). Since
7130your system supports dynamic loading, it is probably possible to build
7131a shared libperl.$so. If you will have more than one executable linked
7132to libperl.$so, this will significantly reduce the size of each
7133executable, but it may have a noticeable affect on performance. The
7134default is probably sensible for your system.
7135$also
7136
7137EOM
7138 rp="Build a shared libperl.$so (y/n)"
7139 . ./myread
7140 case "$ans" in
7141 true|$define|[Yy]*)
7142 useshrplib='true' ;;
7143 *) useshrplib='false' ;;
7144 esac
7145 ;;
7146esac
7147
7148case "$useshrplib" in
7149true)
7150 case "$libperl" in
7151 '')
7152 # Figure out a good name for libperl.so. Since it gets stored in
7153 # a version-specific architecture-dependent library, the version
7154 # number isn't really that important, except for making cc/ld happy.
7155 #
7156 # A name such as libperl.so.3.1
7157 majmin="libperl.$so.$patchlevel.$subversion"
7158 # A name such as libperl.so.301
7159 majonly=`echo $patchlevel $subversion |
7160 $awk '{printf "%d%02d", $1, $2}'`
7161 majonly=libperl.$so.$majonly
7162 # I'd prefer to keep the os-specific stuff here to a minimum, and
7163 # rely on figuring it out from the naming of libc.
7164 case "${osname}${osvers}" in
7165 next4*)
7166 dflt=libperl.5.$so
7167 # XXX How handle the --version stuff for MAB?
7168 ;;
7169 linux*) # ld won't link with a bare -lperl otherwise.
7170 dflt=libperl.$so
7171 ;;
7172 cygwin*) # include version
7173 dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7174 ;;
7175 *) # Try to guess based on whether libc has major.minor.
7176 case "$libc" in
7177 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7178 *libc.$so.[0-9]*) dflt=$majonly ;;
7179 *) dflt=libperl.$so ;;
7180 esac
7181 ;;
7182 esac
7183 ;;
7184 *) dflt=$libperl
7185 ;;
7186 esac
7187 cat << EOM
7188
7189I need to select a good name for the shared libperl. If your system uses
7190library names with major and minor numbers, then you might want something
7191like $majmin. Alternatively, if your system uses a single version
7192number for shared libraries, then you might want to use $majonly.
7193Or, your system might be quite happy with a simple libperl.$so.
7194
7195Since the shared libperl will get installed into a version-specific
7196architecture-dependent directory, the version number of the shared perl
7197library probably isn't important, so the default should be o.k.
7198
7199EOM
7200 rp='What name do you want to give to the shared libperl?'
7201 . ./myread
7202 libperl=$ans
7203 echo "Ok, I'll use $libperl"
7204 ;;
7205*)
7206 libperl="libperl${_a}"
7207 ;;
7208esac
7209
7210# Detect old use of shrpdir via undocumented Configure -Dshrpdir
7211case "$shrpdir" in
7212'') ;;
7213*) $cat >&4 <<EOM
7214WARNING: Use of the shrpdir variable for the installation location of
7215the shared $libperl is not supported. It was never documented and
7216will not work in this version. Let me (perlbug@perl.org)
7217know of any problems this may cause.
7218
7219EOM
7220 case "$shrpdir" in
7221 "$archlibexp/CORE")
7222 $cat >&4 <<EOM
7223But your current setting of $shrpdir is
7224the default anyway, so it's harmless.
7225EOM
7226 ;;
7227 *)
7228 $cat >&4 <<EOM
7229Further, your current attempted setting of $shrpdir
7230conflicts with the value of $archlibexp/CORE
7231that installperl will use.
7232EOM
7233 ;;
7234 esac
7235 ;;
7236esac
7237
7238# How will the perl executable find the installed shared $libperl?
7239# Add $xxx to ccdlflags.
7240# If we can't figure out a command-line option, use $shrpenv to
7241# set env LD_RUN_PATH. The main perl makefile uses this.
7242shrpdir=$archlibexp/CORE
7243xxx=''
7244tmp_shrpenv=''
7245if "$useshrplib"; then
7246 case "$osname" in
7247 aix)
7248 # We'll set it in Makefile.SH...
7249 ;;
7250 solaris|netbsd)
7251 xxx="-R $shrpdir"
7252 ;;
7253 freebsd)
7254 xxx="-Wl,-R$shrpdir"
7255 ;;
7256 linux|irix*|dec_osf)
7257 xxx="-Wl,-rpath,$shrpdir"
7258 ;;
7259 next)
7260 # next doesn't like the default...
7261 ;;
7262 beos)
7263 # beos doesn't like the default, either.
7264 ;;
7265 hpux*)
7266 # hpux doesn't like the default, either.
7267 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7268 ;;
7269 *)
7270 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7271 ;;
7272 esac
7273 case "$xxx" in
7274 '') ;;
7275 *)
7276 # Only add $xxx if it isn't already in ccdlflags.
7277 case " $ccdlflags " in
7278 *" $xxx "*) ;;
7279 *) ccdlflags="$ccdlflags $xxx"
7280 cat <<EOM >&4
7281
7282Adding $xxx to the flags
7283passed to $ld so that the perl executable will find the
7284installed shared $libperl.
7285
7286EOM
7287 ;;
7288 esac
7289 ;;
7290 esac
7291fi
7292# Fix ccdlflags in AIX for building external extensions.
7293# (For building Perl itself bare -bE:perl.exp is needed,
7294# Makefile.SH takes care of this.)
7295case "$osname" in
7296aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7297esac
7298# Respect a hint or command-line value.
7299case "$shrpenv" in
7300'') shrpenv="$tmp_shrpenv" ;;
7301esac
7302case "$ldlibpthname" in
7303'') ldlibpthname=LD_LIBRARY_PATH ;;
7304none) ldlibpthname='' ;;
7305esac
7306
7307: determine where manual pages are on this system
7308echo " "
7309case "$sysman" in
7310'')
7311 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
7312 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
7313 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7314 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7315 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7316 sysman=`./loc . /usr/man/man1 $syspath`
7317 ;;
7318esac
7319if $test -d "$sysman"; then
7320 echo "System manual is in $sysman." >&4
7321else
7322 echo "Could not find manual pages in source form." >&4
7323fi
7324
7325: determine where manual pages go
7326set man1dir man1dir none
7327eval $prefixit
7328$cat <<EOM
7329
7330$spackage has manual pages available in source form.
7331EOM
7332case "$nroff" in
7333nroff)
7334 echo "However, you don't have nroff, so they're probably useless to you."
7335 case "$man1dir" in
7336 '') man1dir="none";;
7337 esac;;
7338esac
7339echo "If you don't want the manual sources installed, answer 'none'."
7340case "$man1dir" in
7341' ') dflt=none
7342 ;;
7343'')
7344 lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
7345 lookpath="$lookpath $prefixexp/man/p_man/man1"
7346 lookpath="$lookpath $prefixexp/man/u_man/man1"
7347 lookpath="$lookpath $prefixexp/man/man.1"
7348 case "$sysman" in
7349 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7350 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7351 esac
7352 set dflt
7353 eval $prefixup
7354 ;;
7355*) dflt="$man1dir"
7356 ;;
7357esac
7358echo " "
7359fn=dn+~
7360rp="Where do the main $spackage manual pages (source) go?"
7361. ./getfile
7362if $test "X$man1direxp" != "X$ansexp"; then
7363 installman1dir=''
7364fi
7365man1dir="$ans"
7366man1direxp="$ansexp"
7367case "$man1dir" in
7368'') man1dir=' '
7369 installman1dir='';;
7370esac
7371
7372: Change installation prefix, if necessary.
7373if $test X"$prefix" != X"$installprefix"; then
7374 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7375else
7376 installman1dir="$man1direxp"
7377fi
7378
7379: What suffix to use on installed man pages
7380
7381case "$man1dir" in
7382' ')
7383 man1ext='0'
7384 ;;
7385*)
7386 rp="What suffix should be used for the main $spackage man pages?"
7387 case "$man1ext" in
7388 '') case "$man1dir" in
7389 *1) dflt=1 ;;
7390 *1p) dflt=1p ;;
7391 *1pm) dflt=1pm ;;
7392 *l) dflt=l;;
7393 *n) dflt=n;;
7394 *o) dflt=o;;
7395 *p) dflt=p;;
7396 *C) dflt=C;;
7397 *L) dflt=L;;
7398 *L1) dflt=L1;;
7399 *) dflt=1;;
7400 esac
7401 ;;
7402 *) dflt="$man1ext";;
7403 esac
7404 . ./myread
7405 man1ext="$ans"
7406 ;;
7407esac
7408
7409: see if we can have long filenames
7410echo " "
7411first=123456789abcdef
7412$rm -f $first
7413if (echo hi >$first) 2>/dev/null; then
7414 if $test -f 123456789abcde; then
7415 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
7416 val="$undef"
7417 else
7418 echo 'You can have filenames longer than 14 characters.'>&4
7419 val="$define"
7420 fi
7421else
7422 $cat <<'EOM'
7423You can't have filenames longer than 14 chars.
7424You can't even think about them!
7425EOM
7426 val="$undef"
7427fi
7428set d_flexfnam
7429eval $setvar
7430$rm -rf 123456789abcde*
7431
7432: determine where library module manual pages go
7433set man3dir man3dir none
7434eval $prefixit
7435$cat <<EOM
7436
7437$spackage has manual pages for many of the library modules.
7438EOM
7439
7440case "$nroff" in
7441nroff)
7442 $cat <<'EOM'
7443However, you don't have nroff, so they're probably useless to you.
7444EOM
7445 case "$man3dir" in
7446 '') man3dir="none";;
7447 esac;;
7448esac
7449
7450case "$d_flexfnam" in
7451undef)
7452 $cat <<'EOM'
7453However, your system can't handle the long file names like File::Basename.3.
7454EOM
7455 case "$man3dir" in
7456 '') man3dir="none";;
7457 esac;;
7458esac
7459
7460echo "If you don't want the manual sources installed, answer 'none'."
7461prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7462case "$man3dir" in
7463'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7464 if $test -d "$privlib/man/man3"; then
7465 cat <<EOM >&4
7466
7467WARNING: Previous versions of perl installed man3 pages into
7468$privlib/man/man3. This version will suggest a
7469new default of $dflt.
7470EOM
7471 tdflt=$dflt
7472 dflt='n'
7473 rp='Do you wish to preserve the old behavior?(y/n)'
7474 . ./myread
7475 case "$ans" in
7476 y*) dflt="$privlib/man/man3" ;;
7477 *) dflt=$tdflt ;;
7478 esac
7479 fi
7480 ;;
7481*) dflt="$man3dir" ;;
7482esac
7483case "$dflt" in
7484' ') dflt=none ;;
7485esac
7486echo " "
7487fn=dn+~
7488rp="Where do the $package library man pages (source) go?"
7489. ./getfile
7490man3dir="$ans"
7491man3direxp="$ansexp"
7492case "$man3dir" in
7493'') man3dir=' '
7494 installman3dir='';;
7495esac
7496
7497: Change installation prefix, if necessary.
7498if $test X"$prefix" != X"$installprefix"; then
7499 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7500else
7501 installman3dir="$man3direxp"
7502fi
7503
7504: What suffix to use on installed man pages
7505case "$man3dir" in
7506' ')
7507 man3ext='0'
7508 ;;
7509*)
7510 rp="What suffix should be used for the $package library man pages?"
7511 case "$man3ext" in
7512 '') case "$man3dir" in
7513 *3) dflt=3 ;;
7514 *3p) dflt=3p ;;
7515 *3pm) dflt=3pm ;;
7516 *l) dflt=l;;
7517 *n) dflt=n;;
7518 *o) dflt=o;;
7519 *p) dflt=p;;
7520 *C) dflt=C;;
7521 *L) dflt=L;;
7522 *L3) dflt=L3;;
7523 *) dflt=3;;
7524 esac
7525 ;;
7526 *) dflt="$man3ext";;
7527 esac
7528 . ./myread
7529 man3ext="$ans"
7530 ;;
7531esac
7532
7533: see if we have to deal with yellow pages, now NIS.
7534if $test -d /usr/etc/yp || $test -d /etc/yp; then
7535 if $test -f /usr/etc/nibindd; then
7536 echo " "
7537 echo "I'm fairly confident you're on a NeXT."
7538 echo " "
7539 rp='Do you get the hosts file via NetInfo?'
7540 dflt=y
7541 case "$hostcat" in
7542 nidump*) ;;
7543 '') ;;
7544 *) dflt=n;;
7545 esac
7546 . ./myread
7547 case "$ans" in
7548 y*) hostcat='nidump hosts .';;
7549 *) case "$hostcat" in
7550 nidump*) hostcat='';;
7551 esac
7552 ;;
7553 esac
7554 fi
7555 case "$hostcat" in
7556 nidump*) ;;
7557 *)
7558 case "$hostcat" in
7559 *ypcat*) dflt=y;;
7560 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7561 dflt=y
7562 else
7563 dflt=n
7564 fi;;
7565 *) dflt=n;;
7566 esac
7567 echo " "
7568 rp='Are you getting the hosts file via yellow pages?'
7569 . ./myread
7570 case "$ans" in
7571 y*) hostcat='ypcat hosts';;
7572 *) hostcat='cat /etc/hosts';;
7573 esac
7574 ;;
7575 esac
7576fi
7577case "$hostcat" in
7578'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7579esac
7580case "$groupcat" in
7581'') test -f /etc/group && groupcat='cat /etc/group';;
7582esac
7583case "$passcat" in
7584'') test -f /etc/passwd && passcat='cat /etc/passwd';;
7585esac
7586
7587: now get the host name
7588echo " "
7589echo "Figuring out host name..." >&4
7590case "$myhostname" in
7591'') cont=true
7592 echo 'Maybe "hostname" will work...'
73614538 7593 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
7594 myhostname=$tans
7595 phostname=hostname
7596 cont=''
7597 fi
7598 ;;
7599*) cont='';;
7600esac
7601if $test "$cont"; then
7602 if ./xenix; then
7603 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
7604 if tans=`cat /etc/systemid 2>&1` ; then
7605 myhostname=$tans
7606 phostname='cat /etc/systemid'
7607 echo "Whadyaknow. Xenix always was a bit strange..."
7608 cont=''
7609 fi
7610 elif $test -r /etc/systemid; then
7611 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7612 fi
7613fi
7614if $test "$cont"; then
7615 echo 'No, maybe "uuname -l" will work...'
73614538 7616 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
7617 myhostname=$tans
7618 phostname='uuname -l'
7619 else
7620 echo 'Strange. Maybe "uname -n" will work...'
73614538 7621 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
7622 myhostname=$tans
7623 phostname='uname -n'
7624 else
7625 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 7626 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
7627 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7628 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7629 else
7630 case "$myhostname" in
7631 '') echo "Does this machine have an identity crisis or something?"
7632 phostname='';;
7633 *)
7634 echo "Well, you said $myhostname before..."
7635 phostname='echo $myhostname';;
7636 esac
7637 fi
7638 fi
7639 fi
7640fi
7641: you do not want to know about this
7642set $myhostname
7643myhostname=$1
7644
7645: verify guess
7646if $test "$myhostname" ; then
7647 dflt=y
7648 rp='Your host name appears to be "'$myhostname'".'" Right?"
7649 . ./myread
7650 case "$ans" in
7651 y*) ;;
7652 *) myhostname='';;
7653 esac
7654fi
7655
7656: bad guess or no guess
7657while $test "X$myhostname" = X ; do
7658 dflt=''
7659 rp="Please type the (one word) name of your host:"
7660 . ./myread
7661 myhostname="$ans"
7662done
7663
7664: translate upper to lower if necessary
7665case "$myhostname" in
7666*[A-Z]*)
7667 echo "(Normalizing case in your host name)"
7668 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7669 ;;
7670esac
7671
7672case "$myhostname" in
7673*.*)
7674 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7675 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7676 echo "(Trimming domain name from host name--host name is now $myhostname)"
7677 ;;
7678*) case "$mydomain" in
7679 '')
7680 {
7681 test "X$hostcat" = "Xypcat hosts" &&
7682 ypmatch "$myhostname" hosts 2>/dev/null |\
7683 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
7684 $test -s hosts
7685 } || {
7686 test "X$hostcat" != "X" &&
7687 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
7688 /[ ]$myhostname[ . ]/p" > hosts
7689 }
7690 tmp_re="[ . ]"
f08cbdd1
PP
7691 if $test -f hosts; then
7692 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 7693 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
7694 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7695 hosts | $sort | $uniq | \
7696 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7697 case `$echo X$dflt` in
7698 X*\ *) echo "(Several hosts in the database matched hostname)"
7699 dflt=.
7700 ;;
7701 X.) echo "(You do not have fully-qualified names in the hosts database)"
7702 ;;
7703 esac
7704 else
7705 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 7706 dflt=.
f08cbdd1 7707 fi
b4eb6b3d
JH
7708 case "$dflt" in
7709 .)
7710 tans=`./loc resolv.conf X /etc /usr/etc`
7711 if $test -f "$tans"; then
7712 echo "(Attempting domain name extraction from $tans)"
7713 dflt=.`$sed -n -e 's/ / /g' \
7714 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
7715 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7716 case "$dflt" in
7717 .) dflt=.`$sed -n -e 's/ / /g' \
7718 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
7719 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7720 ;;
7721 esac
7722 fi
7723 ;;
7724 esac
7725 case "$dflt" in
7726 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 7727 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
7728 case "$dflt" in
7729 '') dflt='.';;
7730 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7731 esac
7732 ;;
7733 esac
59c9e5d6
PP
7734 case "$dflt$osname" in
7735 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 7736 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
7737 ;;
7738 esac
b4eb6b3d
JH
7739 case "$dflt" in
7740 .) echo "(Lost all hope -- silly guess then)"
7741 dflt='.uucp'
7742 ;;
7743 esac
7744 $rm -f hosts
7745 ;;
7746 *) dflt="$mydomain";;
7747 esac;;
7748esac
7749echo " "
7750rp="What is your domain name?"
7751. ./myread
7752tans="$ans"
7753case "$ans" in
7754'') ;;
7755.*) ;;
7756*) tans=".$tans";;
7757esac
7758mydomain="$tans"
7759
7760: translate upper to lower if necessary
7761case "$mydomain" in
7762*[A-Z]*)
7763 echo "(Normalizing case in your domain name)"
7764 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7765 ;;
7766esac
7767
7768: a little sanity check here
7769case "$phostname" in
7770'') ;;
7771*)
7772 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7773 $myhostname$mydomain|$myhostname) ;;
7774 *)
7775 case "$phostname" in
7776 sed*)
7777 echo "(That doesn't agree with your whoami.h file, by the way.)"
7778 ;;
7779 *)
7780 echo "(That doesn't agree with your $phostname command, by the way.)"
7781 ;;
7782 esac
7783 ;;
7784 esac
7785 ;;
7786esac
7787
7788$cat <<EOM
7789
7790I need to get your e-mail address in Internet format if possible, i.e.
7791something like user@host.domain. Please answer accurately since I have
7792no easy means to double check it. The default value provided below
7793is most probably close to reality but may not be valid from outside
7794your organization...
7795
7796EOM
7797cont=x
7798while test "$cont"; do
7799 case "$cf_email" in
7800 '') dflt="$cf_by@$myhostname$mydomain";;
7801 *) dflt="$cf_email";;
7802 esac
7803 rp='What is your e-mail address?'
7804 . ./myread
7805 cf_email="$ans"
7806 case "$cf_email" in
7807 *@*.*) cont='' ;;
7808 *)
7809 rp='Address does not look like an Internet one. Use it anyway?'
7810 case "$fastread" in
7811 yes) dflt=y ;;
7812 *) dflt=n ;;
7813 esac
7814 . ./myread
7815 case "$ans" in
7816 y*) cont='' ;;
7817 *) echo " " ;;
7818 esac
7819 ;;
7820 esac
7821done
7822
7823$cat <<EOM
7824
7825If you or somebody else will be maintaining perl at your site, please
7826fill in the correct e-mail address here so that they may be contacted
7827if necessary. Currently, the "perlbug" program included with perl
7828will send mail to this address in addition to perlbug@perl.org. You may
7829enter "none" for no administrator.
7830
7831EOM
7832case "$perladmin" in
7833'') dflt="$cf_email";;
7834*) dflt="$perladmin";;
7835esac
7836rp='Perl administrator e-mail address'
7837. ./myread
7838perladmin="$ans"
7839
674912d7
RB
7840: determine whether to only install version-specific parts.
7841echo " "
7842$cat <<EOM
7843Do you want to install only the version-specific parts of the perl
7844distribution? Usually you do *not* want to do this.
7845EOM
7846case "$versiononly" in
7847"$define"|[Yy]*|true) dflt='y' ;;
7848*) dflt='n';
7849esac
7850rp="Do you want to install only the version-specific parts of perl?"
7851. ./myread
7852case "$ans" in
7853[yY]*) val="$define";;
7854*) val="$undef" ;;
7855esac
7856set versiononly
7857eval $setvar
7858
b4eb6b3d
JH
7859: figure out how to guarantee perl startup
7860case "$startperl" in
7861'')
7862 case "$sharpbang" in
7863 *!)
7864 $cat <<EOH
7865
7866I can use the #! construct to start perl on your system. This will
7867make startup of perl scripts faster, but may cause problems if you
7868want to share those scripts and perl is not in a standard place
7869($binexp/perl) on all your platforms. The alternative is to force
7870a shell by starting the script with a single ':' character.
7871
7872EOH
674912d7
RB
7873 case "$versiononly" in
7874 "$define") dflt="$binexp/perl$version";;
7875 *) dflt="$binexp/perl";;
7876 esac
b4eb6b3d
JH
7877 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7878 . ./myread
7879 case "$ans" in
7880 none) startperl=": # use perl";;
7881 *) startperl="#!$ans"
7882 if $test 30 -lt `echo "$ans" | wc -c`; then
7883 $cat >&4 <<EOM
7884
7885WARNING: Some systems limit the #! command to 32 characters.
7886If you experience difficulty running Perl scripts with #!, try
7887installing Perl in a directory with a shorter pathname.
7888
7889EOM
7890 fi ;;
7891 esac
7892 ;;
7893 *) startperl=": # use perl"
7894 ;;
7895 esac
7896 ;;
7897esac
7898echo "I'll use $startperl to start perl scripts."
7899
7900: figure best path for perl in scripts
7901case "$perlpath" in
7902'')
7903 perlpath="$binexp/perl"
7904 case "$startperl" in
7905 *!*) ;;
7906 *)
7907 $cat <<EOH
7908
7909I will use the "eval 'exec'" idiom to start Perl on your system.
7910I can use the full path of your Perl binary for this purpose, but
7911doing so may cause problems if you want to share those scripts and
7912Perl is not always in a standard place ($binexp/perl).
7913
7914EOH
7915 dflt="$binexp/perl"
7916 rp="What path shall I use in \"eval 'exec'\"?"
7917 . ./myread
7918 perlpath="$ans"
7919 ;;
7920 esac
7921 ;;
7922esac
7923case "$startperl" in
7924*!*) ;;
7925*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7926esac
7927
7928: determine where public executable scripts go
7929set scriptdir scriptdir
7930eval $prefixit
7931case "$scriptdir" in
7932'')
7933 dflt="$bin"
7934 : guess some guesses
7935 $test -d /usr/share/scripts && dflt=/usr/share/scripts
7936 $test -d /usr/share/bin && dflt=/usr/share/bin
7937 $test -d /usr/local/script && dflt=/usr/local/script
7938 $test -d /usr/local/scripts && dflt=/usr/local/scripts
7939 $test -d $prefixexp/script && dflt=$prefixexp/script
7940 set dflt
7941 eval $prefixup
7942 ;;
7943*) dflt="$scriptdir"
7944 ;;
7945esac
7946$cat <<EOM
7947
7948Some installations have a separate directory just for executable scripts so
7949that they can mount it across multiple architectures but keep the scripts in
7950one spot. You might, for example, have a subdirectory of /usr/share for this.
7951Or you might just lump your scripts in with all your other executables.
7952
7953EOM
7954fn=d~
7955rp='Where do you keep publicly executable scripts?'
7956. ./getfile
7957if $test "X$ansexp" != "X$scriptdirexp"; then
7958 installscript=''
7959fi
7960scriptdir="$ans"
7961scriptdirexp="$ansexp"
7962: Change installation prefix, if necessary.
7963if $test X"$prefix" != X"$installprefix"; then
7964 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7965else
7966 installscript="$scriptdirexp"
7967fi
7968
7969: determine where add-on public executables go
7970case "$sitebin" in
7971'') dflt=$siteprefix/bin ;;
7972*) dflt=$sitebin ;;
7973esac
7974fn=d~
7975rp='Pathname where the add-on public executables should be installed?'
7976. ./getfile
7977sitebin="$ans"
7978sitebinexp="$ansexp"
7979: Change installation prefix, if necessary.
7980if $test X"$prefix" != X"$installprefix"; then
7981 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7982else
7983 installsitebin="$sitebinexp"
7984fi
7985
b4eb6b3d
JH
7986case "$vendorprefix" in
7987'') d_vendorbin="$undef"
7988 vendorbin=''
7989 vendorbinexp=''
7990 ;;
7991*) d_vendorbin="$define"
7992 : determine where vendor-supplied executables go.
7993 case "$vendorbin" in
7994 '') dflt=$vendorprefix/bin ;;
7995 *) dflt="$vendorbin" ;;
7996 esac
7997 fn=d~+
7998 rp='Pathname for the vendor-supplied executables directory?'
7999 . ./getfile
8000 vendorbin="$ans"
8001 vendorbinexp="$ansexp"
8002 ;;
8003esac
8004: Change installation prefix, if necessary.
8005if $test X"$prefix" != X"$installprefix"; then
8006 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8007else
8008 installvendorbin="$vendorbinexp"
8009fi
8010
8011: see if qgcvt exists
8012set qgcvt d_qgcvt
8013eval $inlibc
8014
8015echo " "
8016
8017if $test X"$d_longdbl" = X"$define"; then
8018
8019echo "Checking how to print long doubles..." >&4
8020
8021if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
8022 $cat >try.c <<'EOCP'
8023#include <sys/types.h>
8024#include <stdio.h>
8025int main() {
8026 double d = 123.456;
8027 printf("%.3f\n", d);
8028}
8029EOCP
8030 set try
8031 if eval $compile; then
8032 yyy=`./try$exe_ext`
8033 case "$yyy" in
8034 123.456)
8035 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
8036 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
8037 echo "We will use %f."
8038 ;;
8039 esac
8040 fi
8041fi
8042
8043if $test X"$sPRIfldbl" = X; then
8044 $cat >try.c <<'EOCP'
8045#include <sys/types.h>
8046#include <stdio.h>
8047int main() {
8048 long double d = 123.456;
2ef53570 8049 printf("%.3Lf\n", d);
b4eb6b3d
JH
8050}
8051EOCP
8052 set try
8053 if eval $compile; then
8054 yyy=`./try$exe_ext`
8055 case "$yyy" in
8056 123.456)
2ef53570
JH
8057 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8058 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8059 echo "We will use %Lf."
b4eb6b3d
JH
8060 ;;
8061 esac
8062 fi
8063fi
8064
8065if $test X"$sPRIfldbl" = X; then
8066 $cat >try.c <<'EOCP'
8067#include <sys/types.h>
8068#include <stdio.h>
8069int main() {
8070 long double d = 123.456;
2ef53570 8071 printf("%.3llf\n", d);
b4eb6b3d
JH
8072}
8073EOCP
8074 set try
8075 if eval $compile; then
8076 yyy=`./try$exe_ext`
8077 case "$yyy" in
8078 123.456)
2ef53570
JH
8079 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8080 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8081 echo "We will use %llf."
b4eb6b3d
JH
8082 ;;
8083 esac
8084 fi
8085fi
8086
8087if $test X"$sPRIfldbl" = X; then
8088 $cat >try.c <<'EOCP'
8089#include <sys/types.h>
8090#include <stdio.h>
8091int main() {
8092 long double d = 123.456;
8093 printf("%.3lf\n", d);
8094}
8095EOCP
8096 set try
8097 if eval $compile; then
8098 yyy=`./try$exe_ext`
8099 case "$yyy" in
8100 123.456)
8101 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8102 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8103 echo "We will use %lf."
8104 ;;
8105 esac
8106 fi
8107fi
8108
8109if $test X"$sPRIfldbl" = X; then
8110 echo "Cannot figure out how to print long doubles." >&4
8111else
8112 sSCNfldbl=$sPRIfldbl # expect consistency
8113fi
8114
8115$rm -f try try.*
8116
8117fi # d_longdbl
8118
8119case "$sPRIfldbl" in
8120'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
8121 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
8122 d_SCNfldbl="$undef";
8123 ;;
8124*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
8125 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
8126 d_SCNfldbl="$define";
8127 ;;
8128esac
8129
8130: Check how to convert floats to strings.
8131echo " "
8132echo "Checking for an efficient way to convert floats to strings."
8133echo " " > try.c
8134case "$uselongdouble" in
8135"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8136esac
8137case "$d_longdbl" in
8138"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8139esac
8140case "$d_PRIgldbl" in
8141"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
8142esac
8143$cat >>try.c <<EOP
8144#ifdef TRY_gconvert
8145#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8146char *myname = "gconvert";
8147#endif
8148#ifdef TRY_gcvt
8149#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8150char *myname = "gcvt";
8151#endif
8152#ifdef TRY_qgcvt
8153#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8154char *myname = "qgcvt";
8155#define DOUBLETYPE long double
8156#endif
8157#ifdef TRY_sprintf
8158#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8159#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8160#else
8161#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8162#endif
8163char *myname = "sprintf";
8164#endif
8165
8166#ifndef DOUBLETYPE
8167#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8168#define DOUBLETYPE long double
8169#else
8170#define DOUBLETYPE double
8171#endif
8172#endif
8173
8174#include <stdio.h>
8175
8176#define I_STDLIB $i_stdlib
8177#ifdef I_STDLIB
8178#include <stdlib.h>
8179#endif
8180
8181int
8182checkit(expect, got)
8183char *expect;
8184char *got;
8185{
8186 if (strcmp(expect, got)) {
8187 printf("%s oddity: Expected %s, got %s\n",
8188 myname, expect, got);
8189 exit(1);
8190 }
8191}
8192
8193int main()
8194{
8195 char buf[64];
8196 buf[63] = '\0';
8197
8198 /* This must be 1st test on (which?) platform */
8199 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8200 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8201 checkit("0.1", buf);
8202
8203 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
8204 checkit("1", buf);
8205
8206 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
8207 checkit("1.1", buf);
8208
8209 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
8210 checkit("1.01", buf);
8211
8212 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
8213 checkit("1.001", buf);
8214
8215 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
8216 checkit("1.0001", buf);
8217
8218 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
8219 checkit("1.00001", buf);
8220
8221 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
8222 checkit("1.000001", buf);
8223
8224 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
8225 checkit("0", buf);
8226
8227 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
8228 checkit("-1", buf);
8229
8230 /* Some Linux gcvt's give 1.e+5 here. */
8231 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
8232 checkit("100000", buf);
8233
8234 /* Some Linux gcvt's give -1.e+5 here. */
8235 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
8236 checkit("-100000", buf);
8237
8238 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
8239 checkit("123.456", buf);
8240
8241 exit(0);
8242}
8243EOP
8244case "$d_Gconvert" in
8245gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8246gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8247sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8248*) xxx_list='gconvert gcvt sprintf' ;;
8249esac
8250
8251case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8252"$define$define$define")
8253 # for long doubles prefer first qgcvt, then sprintf
8254 xxx_list="`echo $xxx_list|sed s/sprintf//`"
8255 xxx_list="sprintf $xxx_list"
8256 case "$d_qgcvt" in
8257 "$define") xxx_list="qgcvt $xxx_list" ;;
8258 esac
8259 ;;
8260esac
8261
8262for xxx_convert in $xxx_list; do
8263 echo "Trying $xxx_convert..."
8264 $rm -f try try$_o
8265 set try -DTRY_$xxx_convert
8266 if eval $compile; then
8267 echo "$xxx_convert() found." >&4
8268 if ./try; then
8269 echo "I'll use $xxx_convert to convert floats into a string." >&4
8270 break;
8271 else
8272 echo "...But $xxx_convert didn't work as I expected."
8273 fi
8274 else
8275 echo "$xxx_convert NOT found." >&4
8276 fi
8277done
8278
8279case "$xxx_convert" in
8280gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8281gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8282qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8283*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8284 "$define$define$define")
8285 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8286 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8287 esac
8288 ;;
8289esac
8290
74cac757
JH
8291: see if _fwalk exists
8292set fwalk d__fwalk
8293eval $inlibc
8294
b4eb6b3d
JH
8295: Initialize h_fcntl
8296h_fcntl=false
8297
8298: Initialize h_sysfile
8299h_sysfile=false
8300
8301: access call always available on UNIX
8302set access d_access
8303eval $inlibc
8304
8305: locate the flags for 'access()'
8306case "$d_access" in
8307"$define")
8308 echo " "
8309 $cat >access.c <<'EOCP'
8310#include <sys/types.h>
8311#ifdef I_FCNTL
8312#include <fcntl.h>
8313#endif
8314#ifdef I_SYS_FILE
8315#include <sys/file.h>
8316#endif
8317#ifdef I_UNISTD
8318#include <unistd.h>
8319#endif
8320int main() {
8321 exit(R_OK);
8322}
8323EOCP
8324 : check sys/file.h first, no particular reason here
8325 if $test `./findhdr sys/file.h` && \
7a282f6d 8326 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
8327 h_sysfile=true;
8328 echo "<sys/file.h> defines the *_OK access constants." >&4
8329 elif $test `./findhdr fcntl.h` && \
7a282f6d 8330 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
8331 h_fcntl=true;
8332 echo "<fcntl.h> defines the *_OK access constants." >&4
8333 elif $test `./findhdr unistd.h` && \
7a282f6d 8334 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
8335 echo "<unistd.h> defines the *_OK access constants." >&4
8336 else
8337 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8338 fi
8339 ;;
8340esac
8341$rm -f access*
8342
8343: see if accessx exists
8344set accessx d_accessx
8345eval $inlibc
8346
8347: see if alarm exists
8348set alarm d_alarm
8349eval $inlibc
8350
8351: see if atolf exists
8352set atolf d_atolf
8353eval $inlibc
8354
8355: see if atoll exists
8356set atoll d_atoll
8357eval $inlibc
8358
8359: Look for GNU-cc style attribute checking
8360echo " "
8361echo "Checking whether your compiler can handle __attribute__ ..." >&4
8362$cat >attrib.c <<'EOCP'
8363#include <stdio.h>
8364void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8365EOCP
8366if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8367 if $contains 'warning' attrib.out >/dev/null 2>&1; then
8368 echo "Your C compiler doesn't fully support __attribute__."
8369 val="$undef"
8370 else
8371 echo "Your C compiler supports __attribute__."
8372 val="$define"
8373 fi
8374else
8375 echo "Your C compiler doesn't seem to understand __attribute__ at all."
8376 val="$undef"
8377fi
8378set d_attribut
8379eval $setvar
8380$rm -f attrib*
8381
8382: see if bcmp exists
8383set bcmp d_bcmp
8384eval $inlibc
8385
8386: see if bcopy exists
8387set bcopy d_bcopy
8388eval $inlibc
8389
8390: see if this is a unistd.h system
8391set unistd.h i_unistd
8392eval $inhdr
8393
8394: see if getpgrp exists
8395set getpgrp d_getpgrp
8396eval $inlibc
8397
8398case "$d_getpgrp" in
8399"$define")
8400 echo " "
8401 echo "Checking to see which flavor of getpgrp is in use..."
8402 $cat >set.c <<EOP
8403#$i_unistd I_UNISTD
8404#include <sys/types.h>
8405#ifdef I_UNISTD
8406# include <unistd.h>
8407#endif
8408int main()
8409{
8410 if (getuid() == 0) {
8411 printf("(I see you are running Configure as super-user...)\n");
8412 setuid(1);
8413 }
8414#ifdef TRY_BSD_PGRP
8415 if (getpgrp(1) == 0)
8416 exit(0);
8417#else
8418 if (getpgrp() > 0)
8419 exit(0);
8420#endif
8421 exit(1);
8422}
8423EOP
7a282f6d 8424 if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
8425 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8426 val="$define"
7a282f6d 8427 elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
8428 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8429 val="$undef"
8430 else
8431 echo "I can't seem to compile and run the test program."
8432 if ./usg; then
8433 xxx="a USG one, i.e. you use getpgrp()."
8434 else
8435 # SVR4 systems can appear rather BSD-ish.
8436 case "$i_unistd" in
8437 $undef)
8438 xxx="a BSD one, i.e. you use getpgrp(pid)."
8439 val="$define"
8440 ;;
8441 $define)
8442 xxx="probably a USG one, i.e. you use getpgrp()."
8443 val="$undef"
8444 ;;
8445 esac
8446 fi
8447 echo "Assuming your getpgrp is $xxx" >&4
8448 fi
8449 ;;
8450*) val="$undef";;
8451esac
8452set d_bsdgetpgrp
8453eval $setvar
8454$rm -f set set.c
8455
8456: see if setpgrp exists
8457set setpgrp d_setpgrp
8458eval $inlibc
8459
8460case "$d_setpgrp" in
8461"$define")
8462 echo " "
8463 echo "Checking to see which flavor of setpgrp is in use..."
8464 $cat >set.c <<EOP
8465#$i_unistd I_UNISTD
8466#include <sys/types.h>
8467#ifdef I_UNISTD
8468# include <unistd.h>
8469#endif
8470int main()
8471{
8472 if (getuid() == 0) {
8473 printf("(I see you are running Configure as super-user...)\n");
8474 setuid(1);
8475 }
8476#ifdef TRY_BSD_PGRP
8477 if (-1 == setpgrp(1, 1))
8478 exit(0);
8479#else
8480 if (setpgrp() != -1)
8481 exit(0);
8482#endif
8483 exit(1);
8484}
8485EOP
7a282f6d 8486 if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
8487 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8488 val="$define"
7a282f6d 8489 elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
8490 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8491 val="$undef"
8492 else
8493 echo "(I can't seem to compile and run the test program.)"
8494 if ./usg; then
8495 xxx="a USG one, i.e. you use setpgrp()."
8496 else
8497 # SVR4 systems can appear rather BSD-ish.
8498 case "$i_unistd" in
8499 $undef)
8500 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8501 val="$define"
8502 ;;
8503 $define)
8504 xxx="probably a USG one, i.e. you use setpgrp()."
8505 val="$undef"
8506 ;;
8507 esac
8508 fi
8509 echo "Assuming your setpgrp is $xxx" >&4
8510 fi
8511 ;;
8512*) val="$undef";;
8513esac
8514set d_bsdsetpgrp
8515eval $setvar
8516$rm -f set set.c
8517: see if bzero exists
8518set bzero d_bzero
8519eval $inlibc
8520
8521: see if signal is declared as pointer to function returning int or void
8522echo " "
8523xxx=`./findhdr signal.h`
8524$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8525if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
8526 echo "You have int (*signal())() instead of void." >&4
8527 val="$undef"
8528elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
8529 echo "You have void (*signal())()." >&4
8530 val="$define"
8531elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8532 echo "You have int (*signal())() instead of void." >&4
8533 val="$undef"
8534elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8535 echo "You have void (*signal())()." >&4
8536 val="$define"
8537else
8538 case "$d_voidsig" in
8539 '')
8540 echo "I can't determine whether signal handler returns void or int..." >&4
8541 dflt=void
8542 rp="What type does your signal handler return?"
8543 . ./myread
8544 case "$ans" in
8545 v*) val="$define";;
8546 *) val="$undef";;
8547 esac;;
8548 "$define")
8549 echo "As you already told me, signal handler returns void." >&4
8550 val="$define"
8551 ;;
8552 *) echo "As you already told me, signal handler returns int." >&4
8553 val="$undef"
8554 ;;
8555 esac
8556fi
8557set d_voidsig
8558eval $setvar
8559case "$d_voidsig" in
8560"$define") signal_t="void";;
8561*) signal_t="int";;
8562esac
8563$rm -f $$.tmp
8564
8565: check for ability to cast large floats to 32-bit ints.
8566echo " "
8567echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8568if $test "$intsize" -ge 4; then
8569 xxx=int
8570else
8571 xxx=long
8572fi
8573$cat >try.c <<EOCP
8574#include <stdio.h>
8575#include <sys/types.h>
8576#include <signal.h>
8577$signal_t blech(s) int s; { exit(3); }
8578int main()
8579{
8580 $xxx i32;
8581 double f, g;
8582 int result = 0;
8583 char str[16];
8584 signal(SIGFPE, blech);
8585
8586 /* Don't let compiler optimize the test away. Store the number
8587 in a writable string for gcc to pass to sscanf under HP/UX.
8588 */
8589 sprintf(str, "2147483647");
8590 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8591 g = 10 * f;
8592 i32 = ($xxx) g;
8593
8594 /* x86 processors will probably give 0x8000 0000, which is a
8595 sign change. We don't want that. We want to mimic SPARC
8596 behavior here, which is to preserve the sign and give
8597 back 0x7fff ffff.
8598 */
8599 if (i32 != ($xxx) f)
8600 result |= 1;
8601 exit(result);
8602}
8603EOCP
8604set try
8605if eval $compile_ok; then
8606 ./try
8607 yyy=$?
8608else
8609 echo "(I can't seem to compile the test program--assuming it can't)"
8610 yyy=1
8611fi
8612case "$yyy" in
86130) val="$define"
8614 echo "Yup, it can."
8615 ;;
8616*) val="$undef"
8617 echo "Nope, it can't."
8618 ;;
8619esac
8620set d_casti32
8621eval $setvar
8622$rm -f try try.*
8623
8624: check for ability to cast negative floats to unsigned
8625echo " "
8626echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8627$cat >try.c <<EOCP
8628#include <stdio.h>
8629#include <sys/types.h>
8630#include <signal.h>
8631$signal_t blech(s) int s; { exit(7); }
8632$signal_t blech_in_list(s) int s; { exit(4); }
8633unsigned long dummy_long(p) unsigned long p; { return p; }
8634unsigned int dummy_int(p) unsigned int p; { return p; }
8635unsigned short dummy_short(p) unsigned short p; { return p; }
8636int main()
8637{
8638 double f;
8639 unsigned long along;
8640 unsigned int aint;
8641 unsigned short ashort;
8642 int result = 0;
8643 char str[16];
8644
8645 /* Frustrate gcc-2.7.2's optimizer which failed this test with
8646 a direct f = -123. assignment. gcc-2.8.0 reportedly
8647 optimized the whole file away
8648 */
8649 /* Store the number in a writable string for gcc to pass to
8650 sscanf under HP/UX.
8651 */
8652 sprintf(str, "-123");
8653 sscanf(str, "%lf", &f); /* f = -123.; */
8654
8655 signal(SIGFPE, blech);
8656 along = (unsigned long)f;
8657 aint = (unsigned int)f;
8658 ashort = (unsigned short)f;
8659 if (along != (unsigned long)-123)
8660 result |= 1;
8661 if (aint != (unsigned int)-123)
8662 result |= 1;
8663 if (ashort != (unsigned short)-123)
8664 result |= 1;
8665 sprintf(str, "1073741824.");
8666 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8667 f = f + f;
8668 along = 0;
8669 along = (unsigned long)f;
8670 if (along != 0x80000000)
8671 result |= 2;
8672 f -= 1.;
8673 along = 0;
8674 along = (unsigned long)f;
8675 if (along != 0x7fffffff)
8676 result |= 1;
8677 f += 2.;
8678 along = 0;
8679 along = (unsigned long)f;
8680 if (along != 0x80000001)
8681 result |= 2;
8682 if (result)
8683 exit(result);
8684 signal(SIGFPE, blech_in_list);
8685 sprintf(str, "123.");
8686 sscanf(str, "%lf", &f); /* f = 123.; */
8687 along = dummy_long((unsigned long)f);
8688 aint = dummy_int((unsigned int)f);
8689 ashort = dummy_short((unsigned short)f);
8690 if (along != (unsigned long)123)
8691 result |= 4;
8692 if (aint != (unsigned int)123)
8693 result |= 4;
8694 if (ashort != (unsigned short)123)
8695 result |= 4;
8696 exit(result);
8697
8698}
8699EOCP
8700set try
8701if eval $compile_ok; then
8702 ./try
8703 castflags=$?
8704else
8705 echo "(I can't seem to compile the test program--assuming it can't)"
8706 castflags=7
8707fi
8708case "$castflags" in
87090) val="$define"
8710 echo "Yup, it can."
8711 ;;
8712*) val="$undef"
8713 echo "Nope, it can't."
8714 ;;
8715esac
8716set d_castneg
8717eval $setvar
8718$rm -f try.*
8719
8720: see if vprintf exists
8721echo " "
8722if set vprintf val -f d_vprintf; eval $csym; $val; then
8723 echo 'vprintf() found.' >&4
8724 val="$define"
8725 $cat >vprintf.c <<'EOF'
8726#include <varargs.h>
8727
8728int main() { xxx("foo"); }
8729
8730xxx(va_alist)
8731va_dcl
8732{
8733 va_list args;
8734 char buf[10];
8735
8736 va_start(args);
8737 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8738}
8739EOF
8740 set vprintf
8741 if eval $compile && ./vprintf; then
8742 echo "Your vsprintf() returns (int)." >&4
8743 val2="$undef"
8744 else
8745 echo "Your vsprintf() returns (char*)." >&4
8746 val2="$define"
8747 fi
8748else
8749 echo 'vprintf() NOT found.' >&4
8750 val="$undef"
8751 val2="$undef"
8752fi
8753set d_vprintf
8754eval $setvar
8755val=$val2
8756set d_charvspr
8757eval $setvar
8758
8759: see if chown exists
8760set chown d_chown
8761eval $inlibc
8762
8763: see if chroot exists
8764set chroot d_chroot
8765eval $inlibc
8766
8767: see if chsize exists
8768set chsize d_chsize
8769eval $inlibc
8770
4e0554ec
JH
8771hasstruct='varname=$1; struct=$2; shift; shift;
8772while $test $# -ge 2; do
8773 case "$1" in
8774 $define) echo "#include <$2>";;
8775 esac ;
8776 shift 2;
8777done > try.c;
8778echo "int main () { struct $struct foo; }" >> try.c;
8779set try;
8780if eval $compile; then
8781 val="$define";
8782else
8783 val="$undef";
8784fi;
8785set $varname;
8786eval $setvar;
8787$rm -f try.c try.o'
8788
8789: see if sys/types.h has to be included
8790set sys/types.h i_systypes
8791eval $inhdr
8792
8793hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8794while $test $# -ge 2; do
8795 case "$1" in
8796 $define) echo "#include <$2>";;
8797 esac ;
8798 shift 2;
8799done > try.c;
8800echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8801set try;
8802if eval $compile; then
8803 val="$define";
8804else
8805 val="$undef";
8806fi;
8807set $varname;
8808eval $setvar;
8809$rm -f try.c try.o'
8810
8811socketlib=''
8812sockethdr=''
8813: see whether socket exists
8814echo " "
8815$echo $n "Hmm... $c" >&4
8816if set socket val -f d_socket; eval $csym; $val; then
8817 echo "Looks like you have Berkeley networking support." >&4
8818 d_socket="$define"
8819 if set setsockopt val -f; eval $csym; $val; then
8820 d_oldsock="$undef"
8821 else
8822 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8823 d_oldsock="$define"
8824 fi
8825else
8826 if $contains socklib libc.list >/dev/null 2>&1; then
8827 echo "Looks like you have Berkeley networking support." >&4
8828 d_socket="$define"
8829 : we will have to assume that it supports the 4.2 BSD interface
8830 d_oldsock="$undef"
8831 else
8832 echo "You don't have Berkeley networking in libc$_a..." >&4
8833 if test "X$d_socket" = "X$define"; then
8834 echo "...but you seem to believe that you have sockets." >&4
8835 else
8836 for net in net socket
8837 do
8838 if test -f /usr/lib/lib$net$_a; then
8839 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
8840 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8841 if $contains socket libc.list >/dev/null 2>&1; then
8842 d_socket="$define"
8843 socketlib="-l$net"
8844 case "$net" in
8845 net)
8846 echo "...but the Wollongong group seems to have hacked it in." >&4
8847 sockethdr="-I/usr/netinclude"
8848 ;;
8849 esac
8850 echo "Found Berkeley sockets interface in lib$net." >& 4
8851 if $contains setsockopt libc.list >/dev/null 2>&1; then
8852 d_oldsock="$undef"
8853 else
8854 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8855 d_oldsock="$define"
8856 fi
8857 break
8858 fi
8859 fi
8860 done
8861 if test "X$d_socket" != "X$define"; then
8862 echo "or anywhere else I see." >&4
8863 d_socket="$undef"
8864 d_oldsock="$undef"
8865 fi
8866 fi
8867 fi
8868fi
8869
8870: see if socketpair exists
8871set socketpair d_sockpair
8872eval $inlibc
8873
8874
8875echo " "
8876echo "Checking the availability of certain socket constants..." >& 4
8877for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8878 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8879 $cat >try.c <<EOF
8880#include <sys/types.h>
8881#include <sys/socket.h>
8882int main() {
8883 int i = $ENUM;
8884}
8885EOF
8886 val="$undef"
8887 set try; if eval $compile; then
8888 val="$define"
8889 fi
8890 set d_${enum}; eval $setvar
8891 $rm -f try.c try
8892done
8893
8894: see if this is a sys/uio.h system
8895set sys/uio.h i_sysuio
8896eval $inhdr
8897
8898
8899echo " "
8900echo "Checking to see if your system supports struct cmsghdr..." >&4
8901set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
8902eval $hasstruct
8903case "$d_cmsghdr_s" in
8904"$define") echo "Yes, it does." ;;
8905*) echo "No, it doesn't." ;;
8906esac
8907
8908
b4eb6b3d
JH
8909: check for const keyword
8910echo " "
8911echo 'Checking to see if your C compiler knows about "const"...' >&4
8912$cat >const.c <<'EOCP'
8913typedef struct spug { int drokk; } spug;
8914int main()
8915{
8916 const char *foo;
8917 const spug y;
8918}
8919EOCP
8920if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8921 val="$define"
8922 echo "Yup, it does."
8923else
8924 val="$undef"
8925 echo "Nope, it doesn't."
8926fi
8927set d_const
8928eval $setvar
8929
8930: see if crypt exists
8931echo " "
8932if set crypt val -f d_crypt; eval $csym; $val; then
8933 echo 'crypt() found.' >&4
8934 val="$define"
8935 cryptlib=''
8936else
8937 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8938 if $test -z "$cryptlib"; then
8939 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8940 else
8941 cryptlib=-lcrypt
8942 fi
8943 if $test -z "$cryptlib"; then
8944 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8945 else
8946 cryptlib=-lcrypt
8947 fi
8948 if $test -z "$cryptlib"; then
8949 cryptlib=`./loc libcrypt$_a "" $libpth`
8950 else
8951 cryptlib=-lcrypt
8952 fi
8953 if $test -z "$cryptlib"; then
8954 echo 'crypt() NOT found.' >&4
8955 val="$undef"
8956 else
8957 val="$define"
8958 fi
8959fi
8960set d_crypt
8961eval $setvar
8962
8963: get csh whereabouts
8964case "$csh" in
8965'csh') val="$undef" ;;
8966*) val="$define" ;;
8967esac
8968set d_csh
8969eval $setvar
8970: Respect a hint or command line value for full_csh.
8971case "$full_csh" in
8972'') full_csh=$csh ;;
8973esac
8974
8975: see if cuserid exists
8976set cuserid d_cuserid
8977eval $inlibc
8978
8979: see if this is a limits.h system
8980set limits.h i_limits
8981eval $inhdr
8982
8983: see if this is a float.h system
8984set float.h i_float
8985eval $inhdr
8986
8987: See if number of significant digits in a double precision number is known
8988echo " "
8989$cat >dbl_dig.c <<EOM
8990#$i_limits I_LIMITS
8991#$i_float I_FLOAT
8992#ifdef I_LIMITS
8993#include <limits.h>
8994#endif
8995#ifdef I_FLOAT
8996#include <float.h>
8997#endif
8998#ifdef DBL_DIG
8999printf("Contains DBL_DIG");
9000#endif
9001EOM
9002$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
9003if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
9004 echo "DBL_DIG found." >&4
9005 val="$define"
9006else
9007 echo "DBL_DIG NOT found." >&4
9008 val="$undef"
9009fi
9010$rm -f dbl_dig.?
9011set d_dbl_dig
9012eval $setvar
9013
2ef53570
JH
9014hasproto='varname=$1; func=$2; shift; shift;
9015while $test $# -ge 2; do
9016 case "$1" in
9017 $define) echo "#include <$2>";;
9018 esac ;
9019 shift 2;
9020done > try.c;
9021$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9022if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9023 echo "$func() prototype found.";
9024 val="$define";
9025else
9026 echo "$func() prototype NOT found.";
9027 val="$undef";
9028fi;
9029set $varname;
9030eval $setvar;
9031$rm -f try.c tryout.c'
9032
9033: see if dbm.h is available
9034: see if dbmclose exists
9035set dbmclose d_dbmclose
9036eval $inlibc
9037
9038case "$d_dbmclose" in
9039$define)
9040 set dbm.h i_dbm
9041 eval $inhdr
9042 case "$i_dbm" in
9043 $define)
9044 val="$undef"
9045 set i_rpcsvcdbm
9046 eval $setvar
9047 ;;
9048 *) set rpcsvc/dbm.h i_rpcsvcdbm
9049 eval $inhdr
9050 ;;
9051 esac
9052 ;;
9053*) echo "We won't be including <dbm.h>"
9054 val="$undef"
9055 set i_dbm
9056 eval $setvar
9057 val="$undef"
9058 set i_rpcsvcdbm
9059 eval $setvar
9060 ;;
9061esac
9062
9063: see if prototype for dbminit is available
9064echo " "
9065set d_dbminitproto dbminit $i_dbm dbm.h
9066eval $hasproto
9067
b4eb6b3d
JH
9068: see if difftime exists
9069set difftime d_difftime
9070eval $inlibc
9071
9072: see if this is a dirent system
9073echo " "
9074if xinc=`./findhdr dirent.h`; $test "$xinc"; then
9075 val="$define"
9076 echo "<dirent.h> found." >&4
9077else
9078 val="$undef"
9079 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
9080 echo "<sys/dir.h> found." >&4
9081 echo " "
9082 else
9083 xinc=`./findhdr sys/ndir.h`
9084 fi
9085 echo "<dirent.h> NOT found." >&4
9086fi
9087set i_dirent
9088eval $setvar
9089
9090: Look for type of directory structure.
9091echo " "
9092$cppstdin $cppflags $cppminus < "$xinc" > try.c
9093
9094case "$direntrytype" in
9095''|' ')
9096 case "$i_dirent" in
9097 $define) guess1='struct dirent' ;;
9098 *) guess1='struct direct' ;;
9099 esac
9100 ;;
9101*) guess1="$direntrytype"
9102 ;;
9103esac
9104
9105case "$guess1" in
9106'struct dirent') guess2='struct direct' ;;
9107*) guess2='struct dirent' ;;
9108esac
9109
9110if $contains "$guess1" try.c >/dev/null 2>&1; then
9111 direntrytype="$guess1"
9112 echo "Your directory entries are $direntrytype." >&4
9113elif $contains "$guess2" try.c >/dev/null 2>&1; then
9114 direntrytype="$guess2"
9115 echo "Your directory entries seem to be $direntrytype." >&4
9116else
9117 echo "I don't recognize your system's directory entries." >&4
9118 rp="What type is used for directory entries on this system?"
9119 dflt="$guess1"
9120 . ./myread
9121 direntrytype="$ans"
9122fi
9123$rm -f try.c
9124
9125
9126: see if the directory entry stores field length
9127echo " "
9128$cppstdin $cppflags $cppminus < "$xinc" > try.c
9129if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9130 echo "Good, your directory entry keeps length information in d_namlen." >&4
9131 val="$define"
9132else
9133 echo "Your directory entry does not know about the d_namlen field." >&4
9134 val="$undef"
9135fi
9136set d_dirnamlen
9137eval $setvar
9138$rm -f try.c
9139
9140: see if dlerror exists
9141xxx_runnm="$runnm"
9142runnm=false
9143set dlerror d_dlerror
9144eval $inlibc
9145runnm="$xxx_runnm"
9146
9147: see if dlfcn is available
9148set dlfcn.h i_dlfcn
9149eval $inhdr
9150
9151case "$usedl" in
9152$define|y|true)
9153 $cat << EOM
9154
9155On a few systems, the dynamically loaded modules that perl generates and uses
9156will need a different extension than shared libs. The default will probably
9157be appropriate.
9158
9159EOM
9160 case "$dlext" in
9161 '') dflt="$so" ;;
9162 *) dflt="$dlext" ;;
9163 esac
9164 rp='What is the extension of dynamically loaded modules'
9165 . ./myread
9166 dlext="$ans"
9167 ;;
9168*)
9169 dlext="none"
9170 ;;
9171esac
9172
9173: Check if dlsym need a leading underscore
9174echo " "
9175val="$undef"
9176
9177case "$dlsrc" in
9178dl_dlopen.xs)
9179 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9180 $cat >dyna.c <<'EOM'
9181fred () { }
9182EOM
9183
9184$cat >fred.c<<EOM
9185
9186#include <stdio.h>
9187#$i_dlfcn I_DLFCN
9188#ifdef I_DLFCN
9189#include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
9190#else
9191#include <sys/types.h>
9192#include <nlist.h>
9193#include <link.h>
9194#endif
9195
9196extern int fred() ;
9197
9198int main()
9199{
9200 void * handle ;
9201 void * symbol ;
9202#ifndef RTLD_LAZY
9203 int mode = 1 ;
9204#else
9205 int mode = RTLD_LAZY ;
9206#endif
9207 handle = dlopen("./dyna.$dlext", mode) ;
9208 if (handle == NULL) {
9209 printf ("1\n") ;
9210 fflush (stdout) ;
9211 exit(0);
9212 }
9213 symbol = dlsym(handle, "fred") ;
9214 if (symbol == NULL) {
9215 /* try putting a leading underscore */
9216 symbol = dlsym(handle, "_fred") ;
9217 if (symbol == NULL) {
9218 printf ("2\n") ;
9219 fflush (stdout) ;
9220 exit(0);
9221 }
9222 printf ("3\n") ;
9223 }
9224 else
9225 printf ("4\n") ;
9226 fflush (stdout) ;
9227 exit(0);
9228}
9229EOM
9230 : Call the object file tmp-dyna.o in case dlext=o.
9231 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
9232 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 9233 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
7a282f6d 9234 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
b4eb6b3d
JH
9235 xxx=`./fred`
9236 case $xxx in
9237 1) echo "Test program failed using dlopen." >&4
9238 echo "Perhaps you should not use dynamic loading." >&4;;
9239 2) echo "Test program failed using dlsym." >&4
9240 echo "Perhaps you should not use dynamic loading." >&4;;
9241 3) echo "dlsym needs a leading underscore" >&4
9242 val="$define" ;;
9243 4) echo "dlsym doesn't need a leading underscore." >&4;;
9244 esac
9245 else
9246 echo "I can't compile and run the test program." >&4
9247 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9248 fi
9249 ;;
9250esac
9251
9252$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
9253
9254set d_dlsymun
9255eval $setvar
9256
b4eb6b3d
JH
9257: see if prototype for drand48 is available
9258echo " "
9259set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9260eval $hasproto
9261
9262: see if dup2 exists
9263set dup2 d_dup2
9264eval $inlibc
9265
9266: see if eaccess exists
9267set eaccess d_eaccess
9268eval $inlibc
9269
9270: see if endgrent exists
9271set endgrent d_endgrent
9272eval $inlibc
9273
9274: see if endhostent exists
9275set endhostent d_endhent
9276eval $inlibc
9277
9278: see if endnetent exists
9279set endnetent d_endnent
9280eval $inlibc
9281
9282: see if endprotoent exists
9283set endprotoent d_endpent
9284eval $inlibc
9285
9286: see if endpwent exists
9287set endpwent d_endpwent
9288eval $inlibc
9289
9290: see if endservent exists
9291set endservent d_endsent
9292eval $inlibc
9293
9294: Locate the flags for 'open()'
9295echo " "
9296$cat >open3.c <<'EOCP'
9297#include <sys/types.h>
9298#ifdef I_FCNTL
9299#include <fcntl.h>
9300#endif
9301#ifdef I_SYS_FILE
9302#include <sys/file.h>
9303#endif
9304int main() {
9305 if(O_RDONLY);
9306#ifdef O_TRUNC
9307 exit(0);
9308#else
9309 exit(1);
9310#endif
9311}
9312EOCP
9313: check sys/file.h first to get FREAD on Sun
9314if $test `./findhdr sys/file.h` && \
9315 set open3 -DI_SYS_FILE && eval $compile; then
9316 h_sysfile=true;
9317 echo "<sys/file.h> defines the O_* constants..." >&4
9318 if ./open3; then
9319 echo "and you have the 3 argument form of open()." >&4
9320 val="$define"
9321 else
9322 echo "but not the 3 argument form of open(). Oh, well." >&4
9323 val="$undef"
9324 fi
9325elif $test `./findhdr fcntl.h` && \
9326 set open3 -DI_FCNTL && eval $compile; then
9327 h_fcntl=true;
9328 echo "<fcntl.h> defines the O_* constants..." >&4
9329 if ./open3; then
9330 echo "and you have the 3 argument form of open()." >&4
9331 val="$define"
9332 else
9333 echo "but not the 3 argument form of open(). Oh, well." >&4
9334 val="$undef"
9335 fi
9336else
9337 val="$undef"
9338 echo "I can't find the O_* constant definitions! You got problems." >&4
9339fi
9340set d_open3
9341eval $setvar
9342$rm -f open3*
9343
9344: see which of string.h or strings.h is needed
9345echo " "
9346strings=`./findhdr string.h`
9347if $test "$strings" && $test -r "$strings"; then
9348 echo "Using <string.h> instead of <strings.h>." >&4
9349 val="$define"
9350else
9351 val="$undef"
9352 strings=`./findhdr strings.h`
9353 if $test "$strings" && $test -r "$strings"; then
9354 echo "Using <strings.h> instead of <string.h>." >&4
9355 else
9356 echo "No string header found -- You'll surely have problems." >&4
9357 fi
9358fi
9359set i_string
9360eval $setvar
9361case "$i_string" in
9362"$undef") strings=`./findhdr strings.h`;;
9363*) strings=`./findhdr string.h`;;
9364esac
9365
9366: check for non-blocking I/O stuff
9367case "$h_sysfile" in
a0acbdc3
JH
9368true) echo "#include <sys/file.h>" > head.c;;
9369*)
9370 case "$h_fcntl" in
9371 true) echo "#include <fcntl.h>" > head.c;;
9372 *) echo "#include <sys/fcntl.h>" > head.c;;
9373 esac
9374 ;;
b4eb6b3d
JH
9375esac
9376echo " "
9377echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9378case "$o_nonblock" in
9379'')
9380 $cat head.c > try.c
9381 $cat >>try.c <<'EOCP'
9382#include <stdio.h>
9383int main() {
9384#ifdef O_NONBLOCK
9385 printf("O_NONBLOCK\n");
9386 exit(0);
9387#endif
9388#ifdef O_NDELAY
9389 printf("O_NDELAY\n");
9390 exit(0);
9391#endif
9392#ifdef FNDELAY
9393 printf("FNDELAY\n");
9394 exit(0);
9395#endif
9396 exit(0);
9397}
9398EOCP
9399 set try
9400 if eval $compile_ok; then
9401 o_nonblock=`./try`
9402 case "$o_nonblock" in
9403 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9404 *) echo "Seems like we can use $o_nonblock.";;
9405 esac
9406 else
9407 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9408 fi
9409 ;;
9410*) echo "Using $hint value $o_nonblock.";;
9411esac
9412$rm -f try try.* .out core
9413
9414echo " "
9415echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9416case "$eagain" in
9417'')
9418 $cat head.c > try.c
9419 $cat >>try.c <<EOCP
9420#include <errno.h>
9421#include <sys/types.h>
9422#include <signal.h>
9423#include <stdio.h>
9424#define MY_O_NONBLOCK $o_nonblock
9425#ifndef errno /* XXX need better Configure test */
9426extern int errno;
9427#endif
9428#$i_unistd I_UNISTD
9429#ifdef I_UNISTD
9430#include <unistd.h>
9431#endif
9432#$i_string I_STRING
9433#ifdef I_STRING
9434#include <string.h>
9435#else
9436#include <strings.h>
9437#endif
9438$signal_t blech(x) int x; { exit(3); }
9439EOCP
9440 $cat >> try.c <<'EOCP'
9441int main()
9442{
9443 int pd[2];
9444 int pu[2];
9445 char buf[1];
9446 char string[100];
9447
9448 pipe(pd); /* Down: child -> parent */
9449 pipe(pu); /* Up: parent -> child */
9450 if (0 != fork()) {
9451 int ret;
9452 close(pd[1]); /* Parent reads from pd[0] */
9453 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 9454#ifdef F_SETFL
b4eb6b3d
JH
9455 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
9456 exit(1);
a0acbdc3
JH
9457#else
9458 exit(4);
9459#endif
b4eb6b3d
JH
9460 signal(SIGALRM, blech);
9461 alarm(5);
9462 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
9463 exit(2);
9464 sprintf(string, "%d\n", ret);
9465 write(2, string, strlen(string));
9466 alarm(0);
9467#ifdef EAGAIN
9468 if (errno == EAGAIN) {
9469 printf("EAGAIN\n");
9470 goto ok;
9471 }
9472#endif
9473#ifdef EWOULDBLOCK
9474 if (errno == EWOULDBLOCK)
9475 printf("EWOULDBLOCK\n");
9476#endif
9477 ok:
9478 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
9479 sleep(2); /* Give it time to close our pipe */
9480 alarm(5);
9481 ret = read(pd[0], buf, 1); /* Should read EOF */
9482 alarm(0);
9483 sprintf(string, "%d\n", ret);
9484 write(3, string, strlen(string));
9485 exit(0);
9486 }
9487
9488 close(pd[0]); /* We write to pd[1] */
9489 close(pu[1]); /* We read from pu[0] */
9490 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
9491 close(pd[1]); /* Pipe pd is now fully closed! */
9492 exit(0); /* Bye bye, thank you for playing! */
9493}
9494EOCP
9495 set try
9496 if eval $compile_ok; then
9497 echo "$startsh" >mtry
9498 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
9499 chmod +x mtry
9500 ./mtry >/dev/null 2>&1
9501 case $? in
9502 0) eagain=`$cat try.out`;;
9503 1) echo "Could not perform non-blocking setting!";;
9504 2) echo "I did a successful read() for something that was not there!";;
9505 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 9506 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
9507 *) echo "Something terribly wrong happened during testing.";;
9508 esac
9509 rd_nodata=`$cat try.ret`
9510 echo "A read() system call with no data present returns $rd_nodata."
9511 case "$rd_nodata" in
9512 0|-1) ;;
9513 *)
9514 echo "(That's peculiar, fixing that to be -1.)"
9515 rd_nodata=-1
9516 ;;
9517 esac
9518 case "$eagain" in
9519 '')
9520 echo "Forcing errno EAGAIN on read() with no data available."
9521 eagain=EAGAIN
9522 ;;
9523 *)
9524 echo "Your read() sets errno to $eagain when no data is available."
9525 ;;
9526 esac
9527 status=`$cat try.err`
9528 case "$status" in
9529 0) echo "And it correctly returns 0 to signal EOF.";;
9530 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
9531 *) echo "However, your read() returns '$status' on EOF??";;
9532 esac
9533 val="$define"
9534 if test "$status" = "$rd_nodata"; then
9535 echo "WARNING: you can't distinguish between EOF and no data!"
9536 val="$undef"
9537 fi
9538 else
9539 echo "I can't compile the test program--assuming errno EAGAIN will do."
9540 eagain=EAGAIN
9541 fi
9542 set d_eofnblk
9543 eval $setvar
9544 ;;
9545*)
9546 echo "Using $hint value $eagain."
9547 echo "Your read() returns $rd_nodata when no data is present."
9548 case "$d_eofnblk" in
9549 "$define") echo "And you can see EOF because read() returns 0.";;
9550 "$undef") echo "But you can't see EOF status from read() returned value.";;
9551 *)
9552 echo "(Assuming you can't see EOF status from read anyway.)"
9553 d_eofnblk=$undef
9554 ;;
9555 esac
9556 ;;
9557esac
9558$rm -f try try.* .out core head.c mtry
9559
9560: see if fchmod exists
9561set fchmod d_fchmod
9562eval $inlibc
9563
9564: see if fchown exists
9565set fchown d_fchown
9566eval $inlibc
9567
9568: see if this is an fcntl system
9569set fcntl d_fcntl
9570eval $inlibc
9571
9d9004a9
AD
9572echo " "
9573: See if fcntl-based locking works.
9574$cat >try.c <<'EOCP'
9575#include <stdlib.h>
9576#include <unistd.h>
9577#include <fcntl.h>
9578int main() {
9579#if defined(F_SETLK) && defined(F_SETLKW)
9580 struct flock flock;
9581 int retval, fd;
9582 fd = open("try.c", O_RDONLY);
9583 flock.l_type = F_RDLCK;
9584 flock.l_whence = SEEK_SET;
9585 flock.l_start = flock.l_len = 0;
9586 retval = fcntl(fd, F_SETLK, &flock);
9587 close(fd);
9588 (retval < 0 ? exit(2) : exit(0));
9589#else
9590 exit(2);
9591#endif
9592}
9593EOCP
9594echo "Checking if fcntl-based file locking works... "
9595case "$d_fcntl" in
9596"$define")
9597 set try
9598 if eval $compile_ok; then
9599 if ./try; then
9600 echo "Yes, it seems to work."
9601 val="$define"
9602 else
9603 echo "Nope, it didn't work."
9604 val="$undef"
9605 fi
9606 else
9607 echo "I'm unable to compile the test program, so I'll assume not."
9608 val="$undef"
9609 fi
9610 ;;
9611*) val="$undef";
9612 echo "Nope, since you don't even have fcntl()."
9613 ;;
9614esac
9615set d_fcntl_can_lock
9616eval $setvar
9617$rm -f try*
9618
9619
b4eb6b3d
JH
9620: see if sys/select.h has to be included
9621set sys/select.h i_sysselct
9622eval $inhdr
9623
9624: see if we should include time.h, sys/time.h, or both
9625echo " "
9626if test "X$timeincl" = X; then
9627 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9628 $echo $n "I'm now running the test program...$c"
9629 $cat >try.c <<'EOCP'
9630#include <sys/types.h>
9631#ifdef I_TIME
9632#include <time.h>
9633#endif
9634#ifdef I_SYSTIME
9635#ifdef SYSTIMEKERNEL
9636#define KERNEL
9637#endif
9638#include <sys/time.h>
9639#endif
9640#ifdef I_SYSSELECT
9641#include <sys/select.h>
9642#endif
9643int main()
9644{
9645 struct tm foo;
9646#ifdef S_TIMEVAL
9647 struct timeval bar;
9648#endif
9649#ifdef S_TIMEZONE
9650 struct timezone tzp;
9651#endif
9652 if (foo.tm_sec == foo.tm_sec)
9653 exit(0);
9654#ifdef S_TIMEVAL
9655 if (bar.tv_sec == bar.tv_sec)
9656 exit(0);
9657#endif
9658 exit(1);
9659}
9660EOCP
9661 flags=''
9662 for s_timezone in '-DS_TIMEZONE' ''; do
9663 sysselect=''
9664 for s_timeval in '-DS_TIMEVAL' ''; do
9665 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9666 for i_time in '' '-DI_TIME'; do
9667 for i_systime in '-DI_SYSTIME' ''; do
9668 case "$flags" in
9669 '') $echo $n ".$c"
9670 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9671 if eval $compile; then
9672 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9673 shift
9674 flags="$*"
9675 echo " "
9676 $echo $n "Succeeded with $flags$c"
9677 fi
9678 ;;
9679 esac
9680 done
9681 done
9682 done
9683 done
9684 done
9685 timeincl=''
9686 echo " "
9687 case "$flags" in
9688 *SYSTIMEKERNEL*) i_systimek="$define"
9689 timeincl=`./findhdr sys/time.h`
9690 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9691 *) i_systimek="$undef";;
9692 esac
9693 case "$flags" in
9694 *I_TIME*) i_time="$define"
9695 timeincl=`./findhdr time.h`" $timeincl"
9696 echo "We'll include <time.h>." >&4;;
9697 *) i_time="$undef";;
9698 esac
9699 case "$flags" in
9700 *I_SYSTIME*) i_systime="$define"
9701 timeincl=`./findhdr sys/time.h`" $timeincl"
9702 echo "We'll include <sys/time.h>." >&4;;
9703 *) i_systime="$undef";;
9704 esac
9705 $rm -f try.c try
9706fi
9707
9708: check for fd_set items
9709$cat <<EOM
9710
9711Checking to see how well your C compiler handles fd_set and friends ...
9712EOM
9713$cat >fd_set.c <<EOCP
9714#$i_systime I_SYS_TIME
9715#$i_sysselct I_SYS_SELECT
9716#$d_socket HAS_SOCKET
9717#include <sys/types.h>
9718#ifdef HAS_SOCKET
9719#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9720#endif
9721#ifdef I_SYS_TIME
9722#include <sys/time.h>
9723#endif
9724#ifdef I_SYS_SELECT
9725#include <sys/select.h>
9726#endif
9727int main() {
9728 fd_set fds;
9729
9730#ifdef TRYBITS
9731 if(fds.fds_bits);
9732#endif
9733
9734#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9735 exit(0);
9736#else
9737 exit(1);
9738#endif
9739}
9740EOCP
9741set fd_set -DTRYBITS
9742if eval $compile; then
9743 d_fds_bits="$define"
9744 d_fd_set="$define"
9745 echo "Well, your system knows about the normal fd_set typedef..." >&4
9746 if ./fd_set; then
9747 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9748 d_fd_macros="$define"
9749 else
9750 $cat >&4 <<'EOM'
9751but not the normal fd_set macros! Gaaack! I'll have to cover for you.
9752EOM
9753 d_fd_macros="$undef"
9754 fi
9755else
9756 $cat <<'EOM'
9757Hmm, your compiler has some difficulty with fd_set. Checking further...
9758EOM
9759 set fd_set
9760 if eval $compile; then
9761 d_fds_bits="$undef"
9762 d_fd_set="$define"
9763 echo "Well, your system has some sort of fd_set available..." >&4
9764 if ./fd_set; then
9765 echo "and you have the normal fd_set macros." >&4
9766 d_fd_macros="$define"
9767 else
9768 $cat <<'EOM'
9769but not the normal fd_set macros! Gross! More work for me...
9770EOM
9771 d_fd_macros="$undef"
9772 fi
9773 else
9774 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
9775 d_fd_set="$undef"
9776 d_fds_bits="$undef"
9777 d_fd_macros="$undef"
9778 fi
9779fi
9780$rm -f fd_set*
9781
9782: see if fgetpos exists
9783set fgetpos d_fgetpos
9784eval $inlibc
9785
9786: see if flock exists
9787set flock d_flock
9788eval $inlibc
9789
2ef53570
JH
9790: see if this is a sys/file.h system
9791val=''
9792set sys/file.h val
9793eval $inhdr
9794
9795: do we need to include sys/file.h ?
9796case "$val" in
9797"$define")
9798 echo " "
9799 if $h_sysfile; then
9800 val="$define"
9801 echo "We'll be including <sys/file.h>." >&4
9802 else
9803 val="$undef"
9804 echo "We won't be including <sys/file.h>." >&4
9805 fi
9806 ;;
9807*)
9808 h_sysfile=false
9809 ;;
9810esac
9811set i_sysfile
9812eval $setvar
9813
9814: see if prototype for flock is available
9815echo " "
9816set d_flockproto flock $i_sysfile sys/file.h
9817eval $hasproto
9818
b4eb6b3d
JH
9819: see if fork exists
9820set fork d_fork
9821eval $inlibc
9822
9823: see if pathconf exists
9824set pathconf d_pathconf
9825eval $inlibc
9826
9827: see if fpathconf exists
9828set fpathconf d_fpathconf
9829eval $inlibc
9830
9831
9832: check for fpos64_t
9833echo " "
9834echo "Checking to see if you have fpos64_t..." >&4
9835$cat >try.c <<EOCP
9836#include <stdio.h>
9837int main() { fpos64_t x = 7; }
9838EOCP
9839set try
9840if eval $compile; then
9841 val="$define"
9842 echo "You have fpos64_t."
9843else
9844 val="$undef"
9845 echo "You do not have fpos64_t."
9846 case "$fpossize" in
9847 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9848 esac
9849fi
9850$rm -f try.* try
9851set d_fpos64_t
9852eval $setvar
9853
9854: see if frexpl exists
9855set frexpl d_frexpl
9856eval $inlibc
9857
b4eb6b3d
JH
9858: see if this is a sys/param system
9859set sys/param.h i_sysparam
9860eval $inhdr
9861
9862: see if this is a sys/mount.h system
9863set sys/mount.h i_sysmount
9864eval $inhdr
9865
b4eb6b3d
JH
9866
9867echo " "
9868echo "Checking to see if your system supports struct fs_data..." >&4
9869set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9870eval $hasstruct
9871case "$d_fs_data_s" in
9872"$define") echo "Yes, it does." ;;
9873*) echo "No, it doesn't." ;;
9874esac
9875
9876: see if fseeko exists
9877set fseeko d_fseeko
9878eval $inlibc
9879case "$longsize" in
98808) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9881esac
9882
9883: see if fsetpos exists
9884set fsetpos d_fsetpos
9885eval $inlibc
9886
9887
9888: see if fstatfs exists
9889set fstatfs d_fstatfs
9890eval $inlibc
9891
9892
9893: see if statvfs exists
9894set statvfs d_statvfs
9895eval $inlibc
9896
9897: see if fstatvfs exists
9898set fstatvfs d_fstatvfs
9899eval $inlibc
9900
9901
411ab01c
JH
9902: see if fsync exists
9903set fsync d_fsync
9904eval $inlibc
9905
b4eb6b3d
JH
9906: see if ftello exists
9907set ftello d_ftello
9908eval $inlibc
9909case "$longsize" in
99108) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9911esac
9912
9913: see if getcwd exists
9914set getcwd d_getcwd
9915eval $inlibc
9916
9917: see if getespwnam exists
9918set getespwnam d_getespwnam
9919eval $inlibc
9920
9921
9922: see if getfsstat exists
9923set getfsstat d_getfsstat
9924eval $inlibc
9925
9926: see if getgrent exists
9927set getgrent d_getgrent
9928eval $inlibc
9929
9930: see if gethostbyaddr exists
9931set gethostbyaddr d_gethbyaddr
9932eval $inlibc
9933
9934: see if gethostbyname exists
9935set gethostbyname d_gethbyname
9936eval $inlibc
9937
9938: see if gethostent exists
9939set gethostent d_gethent
9940eval $inlibc
9941
9942: see how we will look up host name
9943echo " "
9944call=''
9945if set gethostname val -f d_gethname; eval $csym; $val; then
9946 echo 'gethostname() found.' >&4
9947 d_gethname="$define"
9948 call=gethostname
9949fi
9950if set uname val -f d_uname; eval $csym; $val; then
9951 if ./xenix; then
9952 $cat <<'EOM'
9953uname() was found, but you're running xenix, and older versions of xenix
9954have a broken uname(). If you don't really know whether your xenix is old
9955enough to have a broken system call, use the default answer.
9956
9957EOM
9958 dflt=y
9959 case "$d_uname" in
9960 "$define") dflt=n;;
9961 esac
9962 rp='Is your uname() broken?'
9963 . ./myread
9964 case "$ans" in
9965 n*) d_uname="$define"; call=uname;;
9966 esac
9967 else
9968 echo 'uname() found.' >&4
9969 d_uname="$define"
9970 case "$call" in
9971 '') call=uname ;;
9972 esac
9973 fi
9974fi
9975case "$d_gethname" in
9976'') d_gethname="$undef";;
9977esac
9978case "$d_uname" in
9979'') d_uname="$undef";;
9980esac
9981case "$d_uname$d_gethname" in
9982*define*)
9983 dflt=n
9984 cat <<EOM
9985
9986Every now and then someone has a $call() that lies about the hostname
9987but can't be fixed for political or economic reasons. If you wish, I can
9988pretend $call() isn't there and maybe compute hostname at run-time
9989thanks to the '$phostname' command.
9990
9991EOM
9992 rp="Shall I ignore $call() from now on?"
9993 . ./myread
9994 case "$ans" in
9995 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9996 esac;;
9997esac
9998case "$phostname" in
9999'') aphostname='';;
10000*) case "$aphostname" in
10001 /*) ;;
10002 *) set X $phostname
10003 shift
10004 file=$1
10005 shift
10006 file=`./loc $file $file $pth`
10007 aphostname=`echo $file $*`
10008 ;;
10009 esac
10010 ;;
10011esac
10012case "$d_uname$d_gethname" in
10013*define*) ;;
10014*)
10015 case "$phostname" in
10016 '')
10017 echo "There will be no way for $package to get your hostname." >&4;;
10018 *)
10019 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
10020 ;;
10021 esac;;
10022esac
10023case "$d_phostname" in
10024'') d_phostname="$undef";;
10025esac
10026
10027: see if this is a netdb.h system
10028set netdb.h i_netdb
10029eval $inhdr
10030
10031: see if prototypes for various gethostxxx netdb.h functions are available
10032echo " "
10033set d_gethostprotos gethostent $i_netdb netdb.h
10034eval $hasproto
10035
4e0554ec
JH
10036: see if getitimer exists
10037set getitimer d_getitimer
10038eval $inlibc
10039
b4eb6b3d
JH
10040: see if getlogin exists
10041set getlogin d_getlogin
10042eval $inlibc
10043
10044: see if getmnt exists
10045set getmnt d_getmnt
10046eval $inlibc
10047
10048: see if getmntent exists
10049set getmntent d_getmntent
10050eval $inlibc
10051
10052: see if getnetbyaddr exists
10053set getnetbyaddr d_getnbyaddr
10054eval $inlibc
10055
10056: see if getnetbyname exists
10057set getnetbyname d_getnbyname
10058eval $inlibc
10059
10060: see if getnetent exists
10061set getnetent d_getnent
10062eval $inlibc
10063
10064: see if prototypes for various getnetxxx netdb.h functions are available
10065echo " "
10066set d_getnetprotos getnetent $i_netdb netdb.h
10067eval $hasproto
10068
0c0643d0
JH
10069: see if getpagesize exists
10070set getpagesize d_getpagsz
10071eval $inlibc
10072
b4eb6b3d
JH
10073
10074: see if getprotobyname exists
10075set getprotobyname d_getpbyname
10076eval $inlibc
10077
10078: see if getprotobynumber exists
10079set getprotobynumber d_getpbynumber
10080eval $inlibc
10081
10082: see if getprotoent exists
10083set getprotoent d_getpent
10084eval $inlibc
10085
10086: see if getpgid exists
10087set getpgid d_getpgid
10088eval $inlibc
10089
10090: see if getpgrp2 exists
10091set getpgrp2 d_getpgrp2
10092eval $inlibc
10093
10094: see if getppid exists
10095set getppid d_getppid
10096eval $inlibc
10097
10098: see if getpriority exists
10099set getpriority d_getprior
10100eval $inlibc
10101
10102: see if prototypes for various getprotoxxx netdb.h functions are available
10103echo " "
10104set d_getprotoprotos getprotoent $i_netdb netdb.h
10105eval $hasproto
10106
10107: see if getprpwnam exists
10108set getprpwnam d_getprpwnam
10109eval $inlibc
10110
10111: see if getpwent exists
10112set getpwent d_getpwent
10113eval $inlibc
10114
10115
10116: see if getservbyname exists
10117set getservbyname d_getsbyname
10118eval $inlibc
10119
10120: see if getservbyport exists
10121set getservbyport d_getsbyport
10122eval $inlibc
10123
10124: see if getservent exists
10125set getservent d_getsent
10126eval $inlibc
10127
10128: see if prototypes for various getservxxx netdb.h functions are available
10129echo " "
10130set d_getservprotos getservent $i_netdb netdb.h
10131eval $hasproto
10132
10133: see if getspnam exists
10134set getspnam d_getspnam
10135eval $inlibc
10136
10137: see if gettimeofday or ftime exists
10138set gettimeofday d_gettimeod
10139eval $inlibc
10140case "$d_gettimeod" in
10141"$undef")
10142 set ftime d_ftime
10143 eval $inlibc
10144 ;;
10145*)
10146 val="$undef"; set d_ftime; eval $setvar
10147 ;;
10148esac
10149case "$d_gettimeod$d_ftime" in
10150"$undef$undef")
10151 echo " "
10152 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10153 ;;
10154esac
10155
10156: see if this is an grp system
10157set grp.h i_grp
10158eval $inhdr
10159
10160case "$i_grp" in
10161$define)
10162 xxx=`./findhdr grp.h`
10163 $cppstdin $cppflags $cppminus < $xxx >$$.h
10164
10165 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10166 val="$define"
10167 else
10168 val="$undef"
10169 fi
10170 set d_grpasswd
10171 eval $setvar
10172
10173 $rm -f $$.h
10174 ;;
10175*)
10176 val="$undef";
10177 set d_grpasswd; eval $setvar
10178 ;;
10179esac
10180
10181: see if hasmntopt exists
10182set hasmntopt d_hasmntopt
10183eval $inlibc
10184
10185: see if this is a netinet/in.h or sys/in.h system
10186set netinet/in.h i_niin sys/in.h i_sysin
10187eval $inhdr
10188
10189: see if arpa/inet.h has to be included
10190set arpa/inet.h i_arpainet
10191eval $inhdr
10192
10193: see if htonl --and friends-- exists
10194val=''
10195set htonl val
10196eval $inlibc
10197
10198: Maybe they are macros.
10199case "$val" in
10200$undef)
10201 $cat >htonl.c <<EOM
10202#include <stdio.h>
10203#include <sys/types.h>
10204#$i_niin I_NETINET_IN
10205#$i_sysin I_SYS_IN
10206#$i_arpainet I_ARPA_INET
10207#ifdef I_NETINET_IN
10208#include <netinet/in.h>
10209#endif
10210#ifdef I_SYS_IN
10211#include <sys/in.h>
10212#endif
10213#ifdef I_ARPA_INET
10214#include <arpa/inet.h>
10215#endif
10216#ifdef htonl
10217printf("Defined as a macro.");
10218#endif
10219EOM
10220 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10221 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10222 val="$define"
10223 echo "But it seems to be defined as a macro." >&4
10224 fi
10225 $rm -f htonl.?
10226 ;;
10227esac
10228set d_htonl
10229eval $setvar
10230
10231: see if iconv exists
10232set iconv d_iconv
10233eval $inlibc
10234
10235: index or strchr
10236echo " "
10237if set index val -f; eval $csym; $val; then
10238 if set strchr val -f d_strchr; eval $csym; $val; then
10239 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10240 val="$define"
10241 vali="$undef"
10242 echo "strchr() found." >&4
10243 else
10244 val="$undef"
10245 vali="$define"
10246 echo "index() found." >&4
10247 fi
10248 else
10249 val="$undef"
10250 vali="$define"
8dfa8df9
JH
10251 echo "index() found." >&4
10252 fi
b4eb6b3d 10253else
8dfa8df9
JH
10254 if set strchr val -f d_strchr; eval $csym; $val; then
10255 val="$define"
10256 vali="$undef"
10257 echo "strchr() found." >&4
10258 else
10259 echo "No index() or strchr() found!" >&4
10260 val="$undef"
10261 vali="$undef"
10262 fi
b4eb6b3d 10263fi
8dfa8df9
JH
10264set d_strchr; eval $setvar
10265val="$vali"
10266set d_index; eval $setvar
10267
10268: check whether inet_aton exists
10269set inet_aton d_inetaton
10270eval $inlibc
b4eb6b3d
JH
10271
10272: Look for isascii
10273echo " "
10274$cat >isascii.c <<'EOCP'
10275#include <stdio.h>
10276#include <ctype.h>
10277int main() {
10278 int c = 'A';
10279 if (isascii(c))
10280 exit(0);
10281 else
10282 exit(1);
10283}
10284EOCP
10285set isascii
10286if eval $compile; then
10287 echo "isascii() found." >&4
10288 val="$define"
10289else
10290 echo "isascii() NOT found." >&4
10291 val="$undef"
10292fi
10293set d_isascii
10294eval $setvar
10295$rm -f isascii*
10296
10297: see if isnan exists
10298set isnan d_isnan
10299eval $inlibc
10300
10301: see if isnanl exists
10302set isnanl d_isnanl
10303eval $inlibc
10304
10305: see if killpg exists
10306set killpg d_killpg
10307eval $inlibc
10308
10309: see if lchown exists
10310echo " "
10311$cat > try.c <<'EOCP'
10312/* System header to define __stub macros and hopefully few prototypes,
10313 which can conflict with char lchown(); below. */
10314#include <assert.h>
10315/* Override any gcc2 internal prototype to avoid an error. */
10316/* We use char because int might match the return type of a gcc2
10317 builtin and then its argument prototype would still apply. */
10318char lchown();
10319int main() {
10320 /* The GNU C library defines this for functions which it implements
10321 to always fail with ENOSYS. Some functions are actually named
10322 something starting with __ and the normal name is an alias. */
10323#if defined (__stub_lchown) || defined (__stub___lchown)
10324choke me
10325#else
10326lchown();
10327#endif
10328; return 0; }
10329EOCP
10330set try
10331if eval $compile; then
10332 $echo "lchown() found." >&4
10333 val="$define"
10334else
10335 $echo "lchown() NOT found." >&4
10336 val="$undef"
10337fi
10338set d_lchown
10339eval $setvar
10340
10341: See if number of significant digits in a double precision number is known
10342echo " "
10343$cat >ldbl_dig.c <<EOM
10344#$i_limits I_LIMITS
10345#$i_float I_FLOAT
10346#ifdef I_LIMITS
10347#include <limits.h>
10348#endif
10349#ifdef I_FLOAT
10350#include <float.h>
10351#endif
10352#ifdef LDBL_DIG
10353printf("Contains LDBL_DIG");
10354#endif
10355EOM
10356$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10357if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10358 echo "LDBL_DIG found." >&4
10359 val="$define"
10360else
10361 echo "LDBL_DIG NOT found." >&4
10362 val="$undef"
10363fi
10364$rm -f ldbl_dig.?
10365set d_ldbl_dig
10366eval $setvar
10367
10368: see if link exists
10369set link d_link
10370eval $inlibc
10371
10372: see if localeconv exists
10373set localeconv d_locconv
10374eval $inlibc
10375
10376: see if lockf exists
10377set lockf d_lockf
10378eval $inlibc
10379
b4eb6b3d
JH
10380: see if prototype for lseek is available
10381echo " "
10382set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10383eval $hasproto
10384
10385: see if lstat exists
10386set lstat d_lstat
10387eval $inlibc
10388
10389: see if madvise exists
10390set madvise d_madvise
10391eval $inlibc
10392
10393: see if mblen exists
10394set mblen d_mblen
10395eval $inlibc
10396
10397: see if mbstowcs exists
10398set mbstowcs d_mbstowcs
10399eval $inlibc
10400
10401: see if mbtowc exists
10402set mbtowc d_mbtowc
10403eval $inlibc
10404
10405: see if memchr exists
10406set memchr d_memchr
10407eval $inlibc
10408
10409: see if memcmp exists
10410set memcmp d_memcmp
10411eval $inlibc
10412
10413: see if memcpy exists
10414set memcpy d_memcpy
10415eval $inlibc
10416
10417: see if memmove exists
10418set memmove d_memmove
10419eval $inlibc
10420
10421: see if memset exists
10422set memset d_memset
10423eval $inlibc
10424
10425: see if mkdir exists
10426set mkdir d_mkdir
10427eval $inlibc
10428
10429: see if mkdtemp exists
10430set mkdtemp d_mkdtemp
10431eval $inlibc
10432
10433: see if mkfifo exists
10434set mkfifo d_mkfifo
10435eval $inlibc
10436
10437: see if mkstemp exists
10438set mkstemp d_mkstemp
10439eval $inlibc
10440
10441: see if mkstemps exists
10442set mkstemps d_mkstemps
10443eval $inlibc
10444
10445: see if mktime exists
10446set mktime d_mktime
10447eval $inlibc
10448
10449: see if this is a sys/mman.h system
10450set sys/mman.h i_sysmman
10451eval $inhdr
10452
10453: see if mmap exists
10454set mmap d_mmap
10455eval $inlibc
10456: see what shmat returns
10457: default to something harmless
10458mmaptype='void *'
10459case "$i_sysmman$d_mmap" in
10460"$define$define")
10461 $cat >mmap.c <<'END'
10462#include <sys/mman.h>
10463void *mmap();
10464END
10465 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10466 mmaptype='void *'
10467 else
10468 mmaptype='caddr_t'
10469 fi
10470 echo "and it returns ($mmaptype)." >&4
10471 ;;
10472esac
10473
10474
10475
10476: see if modfl exists
10477set modfl d_modfl
10478eval $inlibc
10479
e67aeab1
JH
10480d_modfl_pow32_bug="$undef"
10481
2b2cdb4d
HS
10482case "$d_longdbl$d_modfl" in
10483$define$define)
10484 $cat <<EOM
10485Checking to see whether your modfl() is okay for large values...
10486EOM
10487$cat >try.c <<EOCP
10488#include <math.h>
10489#include <stdio.h>
10490int main() {
10491 long double nv = 4294967303.15;
10492 long double v, w;
10493 v = modfl(nv, &w);
10494#ifdef __GLIBC__
10495 printf("glibc");
10496#endif
10497 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
10498 return 0;
10499}
10500EOCP
27f9615e
JH
10501 case "$osname:$gccversion" in
10502 aix:) saveccflags="$ccflags"
10503 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10504 esac
2b2cdb4d
HS
10505 set try
10506 if eval $compile; then
10507 foo=`./try`
10508 case "$foo" in
10509 *" 4294967303.150000 1.150000 4294967302.000000")
10510 echo >&4 "Your modfl() is broken for large values."
e67aeab1 10511 d_modfl_pow32_bug="$define"
2b2cdb4d
HS
10512 case "$foo" in
10513 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
10514 ;;
10515 esac
10516 ;;
10517 *" 4294967303.150000 0.150000 4294967303.000000")
10518 echo >&4 "Your modfl() seems okay for large values."
10519 ;;
10520 *) echo >&4 "I don't understand your modfl() at all."
10521 d_modfl="$undef"
10522 ;;
10523 esac
10524 $rm -f try.* try core core.try.*
10525 else
10526 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
10527 d_modfl="$undef"
10528 fi
27f9615e
JH
10529 case "$osname:$gccversion" in
10530 aix:) $ccflags="saveccflags" ;; # restore
10531 esac
2b2cdb4d
HS
10532 ;;
10533esac
10534
b4eb6b3d
JH
10535: see if mprotect exists
10536set mprotect d_mprotect
10537eval $inlibc
10538
10539: see if msgctl exists
10540set msgctl d_msgctl
10541eval $inlibc
10542
10543: see if msgget exists
10544set msgget d_msgget
10545eval $inlibc
10546
10547: see if msgsnd exists
10548set msgsnd d_msgsnd
10549eval $inlibc
10550
10551: see if msgrcv exists
10552set msgrcv d_msgrcv
10553eval $inlibc
10554
10555: see how much of the 'msg*(2)' library is present.
10556h_msg=true
10557echo " "
10558case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10559*"$undef"*) h_msg=false;;
10560esac
10561case "$osname" in
10562freebsd)
10563 case "`ipcs 2>&1`" in
10564 "SVID messages"*"not configured"*)
10565 echo "Your $osname does not have the msg*(2) configured." >&4
10566 h_msg=false
10567 val="$undef"
10568 set msgctl d_msgctl
10569 eval $setvar
10570 set msgget d_msgget
10571 eval $setvar
10572 set msgsnd d_msgsnd
10573 eval $setvar
10574 set msgrcv d_msgrcv
10575 eval $setvar
10576 ;;
10577 esac
10578 ;;
10579esac
10580: we could also check for sys/ipc.h ...
10581if $h_msg && $test `./findhdr sys/msg.h`; then
10582 echo "You have the full msg*(2) library." >&4
10583 val="$define"
10584else
10585 echo "You don't have the full msg*(2) library." >&4
10586 val="$undef"
10587fi
10588set d_msg
10589eval $setvar
10590
4e0554ec
JH
10591
10592echo " "
10593echo "Checking to see if your system supports struct msghdr..." >&4
10594set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10595eval $hasstruct
10596case "$d_msghdr_s" in
10597"$define") echo "Yes, it does." ;;
10598*) echo "No, it doesn't." ;;
10599esac
10600
10601
b4eb6b3d
JH
10602: see if msync exists
10603set msync d_msync
10604eval $inlibc
10605
10606: see if munmap exists
10607set munmap d_munmap
10608eval $inlibc
10609
10610: see if nice exists
10611set nice d_nice
10612eval $inlibc
10613
b4eb6b3d
JH
10614: check for length of character
10615echo " "
10616case "$charsize" in
10617'')
10618 echo "Checking to see how big your characters are (hey, you never know)..." >&4
10619 $cat >try.c <<'EOCP'
10620#include <stdio.h>
10621int main()
10622{
10623 printf("%d\n", (int)sizeof(char));
10624 exit(0);
10625}
10626EOCP
10627 set try
10628 if eval $compile_ok; then
10629 dflt=`./try`
10630 else
10631 dflt='1'
10632 echo "(I can't seem to compile the test program. Guessing...)"
10633 fi
10634 ;;
10635*)
10636 dflt="$charsize"
10637 ;;
10638esac
10639rp="What is the size of a character (in bytes)?"
10640. ./myread
10641charsize="$ans"
10642$rm -f try.c try
10643
1d1be0dc
NC
10644: check for volatile keyword
10645echo " "
10646echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10647$cat >try.c <<'EOCP'
10648int main()
10649{
10650 typedef struct _goo_struct goo_struct;
10651 goo_struct * volatile goo = ((goo_struct *)0);
10652 struct _goo_struct {
10653 long long_int;
10654 int reg_int;
10655 char char_var;
10656 };
10657 typedef unsigned short foo_t;
10658 char *volatile foo;
10659 volatile int bar;
10660 volatile foo_t blech;
10661 foo = foo;
10662}
10663EOCP
10664if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10665 val="$define"
10666 echo "Yup, it does."
10667else
10668 val="$undef"
10669 echo "Nope, it doesn't."
10670fi
10671set d_volatile
10672eval $setvar
10673$rm -f try.*
10674
b4eb6b3d
JH
10675
10676echo " "
10677$echo "Choosing the C types to be used for Perl's internal types..." >&4
10678
10679case "$use64bitint:$d_quad:$quadtype" in
10680define:define:?*)
10681 ivtype="$quadtype"
10682 uvtype="$uquadtype"
10683 ivsize=8
10684 uvsize=8
10685 ;;
10686*) ivtype="long"
10687 uvtype="unsigned long"
10688 ivsize=$longsize
10689 uvsize=$longsize
10690 ;;
10691esac
10692
10693case "$uselongdouble:$d_longdbl" in
10694define:define)
10695 nvtype="long double"
10696 nvsize=$longdblsize
10697 ;;
10698*) nvtype=double
10699 nvsize=$doublesize
10700 ;;
10701esac
10702
10703$echo "(IV will be "$ivtype", $ivsize bytes)"
10704$echo "(UV will be "$uvtype", $uvsize bytes)"
10705$echo "(NV will be "$nvtype", $nvsize bytes)"
10706
10707$cat >try.c <<EOCP
10708#$i_inttypes I_INTTYPES
10709#ifdef I_INTTYPES
10710#include <inttypes.h>
10711#endif
10712#include <stdio.h>
10713int main() {
10714#ifdef INT8
10715 int8_t i = INT8_MAX;
10716 uint8_t u = UINT8_MAX;
10717 printf("int8_t\n");
10718#endif
10719#ifdef INT16
10720 int16_t i = INT16_MAX;
10721 uint16_t i = UINT16_MAX;
10722 printf("int16_t\n");
10723#endif
10724#ifdef INT32
10725 int32_t i = INT32_MAX;
10726 uint32_t u = UINT32_MAX;
10727 printf("int32_t\n");
10728#endif
10729}
10730EOCP
10731
10732case "$i8type" in
10733'') case "$charsize" in
10734 1) i8type=char
10735 u8type="unsigned char"
10736 i8size=$charsize
10737 u8size=$charsize
10738 ;;
10739 esac
10740 ;;
10741esac
10742case "$i8type" in
10743'') set try -DINT8
10744 if eval $compile; then
10745 case "`./try$exe_ext`" in
10746 int8_t) i8type=int8_t
10747 u8type=uint8_t
10748 i8size=1
10749 u8size=1
10750 ;;
10751 esac
10752 fi
10753 ;;
10754esac
10755case "$i8type" in
10756'') if $test $charsize -ge 1; then
10757 i8type=char
10758 u8type="unsigned char"
10759 i8size=$charsize
10760 u8size=$charsize
10761 fi
10762 ;;
10763esac
10764
10765case "$i16type" in
10766'') case "$shortsize" in
10767 2) i16type=short
10768 u16type="unsigned short"
10769 i16size=$shortsize
10770 u16size=$shortsize
10771 ;;
10772 esac
10773 ;;
10774esac
10775case "$i16type" in
10776'') set try -DINT16
10777 if eval $compile; then
10778 case "`./try$exe_ext`" in
10779 int16_t)
10780 i16type=int16_t
10781 u16type=uint16_t
10782 i16size=2
10783 u16size=2
10784 ;;
10785 esac
10786 fi
10787 ;;
10788esac
10789case "$i16type" in
10790'') if $test $shortsize -ge 2; then
10791 i16type=short
10792 u16type="unsigned short"
10793 i16size=$shortsize
10794 u16size=$shortsize
10795 fi
10796 ;;
10797esac
10798
10799case "$i32type" in
10800'') case "$longsize" in
10801 4) i32type=long
10802 u32type="unsigned long"
10803 i32size=$longsize
10804 u32size=$longsize
10805 ;;
10806 *) case "$intsize" in
10807 4) i32type=int
10808 u32type="unsigned int"
10809 i32size=$intsize
10810 u32size=$intsize
10811 ;;
10812 esac
10813 ;;
10814 esac
10815 ;;
10816esac
10817case "$i32type" in
10818'') set try -DINT32
10819 if eval $compile; then
10820 case "`./try$exe_ext`" in
10821 int32_t)
10822 i32type=int32_t
10823 u32type=uint32_t
10824 i32size=4
10825 u32size=4
10826 ;;
10827 esac
10828 fi
10829 ;;
10830esac
10831case "$i32type" in
10832'') if $test $intsize -ge 4; then
10833 i32type=int
10834 u32type="unsigned int"
10835 i32size=$intsize
10836 u32size=$intsize
10837 fi
10838 ;;
10839esac
10840
10841case "$i64type" in
10842'') case "$d_quad:$quadtype" in
10843 define:?*)
10844 i64type="$quadtype"
10845 u64type="$uquadtype"
10846 i64size=8
10847 u64size=8
10848 ;;
10849 esac
10850 ;;
10851esac
10852
1d1be0dc
NC
10853$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10854: volatile so that the compiler has to store it out to memory.
10855if test X"$d_volatile" = X"$define"; then
10856 volatile=volatile
10857fi
b4eb6b3d
JH
10858$cat <<EOP >try.c
10859#include <stdio.h>
1d1be0dc
NC
10860#include <sys/types.h>
10861#include <signal.h>
10862#ifdef SIGFPE
10863$volatile int bletched = 0;
10864$signal_t blech(s) int s; { bletched = 1; }
10865#endif
b4eb6b3d
JH
10866int main() {
10867 $uvtype u = 0;
1d1be0dc 10868 $nvtype d;
b4eb6b3d
JH
10869 int n = 8 * $uvsize;
10870 int i;
1d1be0dc
NC
10871#ifdef SIGFPE
10872 signal(SIGFPE, blech);
10873#endif
10874
b4eb6b3d
JH
10875 for (i = 0; i < n; i++) {
10876 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
10877 d = ($nvtype)u;
10878 if (($uvtype)d != u)
b4eb6b3d 10879 break;
1d1be0dc
NC
10880 if (d <= 0)
10881 break;
10882 d = ($nvtype)(u - 1);
10883 if (($uvtype)d != (u - 1))
10884 break;
10885#ifdef SIGFPE
10886 if (bletched) {
10887 break;
10888#endif
10889 }
b4eb6b3d 10890 }
efd1522b 10891 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
10892 exit(0);
10893}
10894EOP
1d1be0dc
NC
10895set try
10896
10897d_nv_preserves_uv="$undef"
10898if eval $compile; then
10899 d_nv_preserves_uv_bits="`./try$exe_ext`"
10900fi
10901case "$d_nv_preserves_uv_bits" in
10902\-[1-9]*)
10903 d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10904 $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs." 2>&1
10905 d_nv_preserves_uv="$define"
b4eb6b3d 10906 ;;
1d1be0dc
NC
10907[1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs." 2>&1
10908 d_nv_preserves_uv="$undef" ;;
10909*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
10910 d_nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
10911esac
10912
1d1be0dc
NC
10913$rm -f try.* try
10914
b4eb6b3d
JH
10915
10916: check for off64_t
10917echo " "
10918echo "Checking to see if you have off64_t..." >&4
10919$cat >try.c <<EOCP
10920#include <sys/types.h>
10921#include <unistd.h>
10922int main() { off64_t x = 7; }
10923EOCP
10924set try
10925if eval $compile; then
10926 val="$define"
10927 echo "You have off64_t."
10928else
10929 val="$undef"
10930 echo "You do not have off64_t."
10931 case "$lseeksize" in
10932 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10933 esac
10934fi
10935$rm -f try.* try
10936set d_off64_t
10937eval $setvar
10938
10939: see if POSIX threads are available
10940set pthread.h i_pthread
10941eval $inhdr
10942
10943
10944
10945
10946: how to create joinable pthreads
10947if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10948 echo " "
10949 echo "Checking what constant to use for creating joinable pthreads..." >&4
10950 $cat >try.c <<'EOCP'
10951#include <pthread.h>
10952int main() {
10953 int detachstate = JOINABLE;
10954}
10955EOCP
10956 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10957 if eval $compile; then
10958 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10959 val="$undef" # Yes, undef.
10960 set d_old_pthread_create_joinable
10961 eval $setvar
10962 val=""
10963 set old_pthread_create_joinable
10964 eval $setvar
10965 else
10966 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10967 if eval $compile; then
10968 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10969 val="$define"
10970 set d_old_pthread_create_joinable
10971 eval $setvar
10972 val=PTHREAD_CREATE_UNDETACHED
10973 set old_pthread_create_joinable
10974 eval $setvar
10975 else
10976 set try -DJOINABLE=__UNDETACHED
10977 if eval $compile; then
10978 echo "You seem to use __UNDETACHED." >&4
10979 val="$define"
10980 set d_old_pthread_create_joinable
10981 eval $setvar
10982 val=__UNDETACHED
10983 set old_pthread_create_joinable
10984 eval $setvar
10985 else
10986 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
10987 val="$define"
10988 set d_old_pthread_create_joinable
10989 eval $setvar
10990 val=0
10991 set old_pthread_create_joinable
10992 eval $setvar
10993 fi
10994 fi
10995 fi
10996 $rm -f try try.*
10997else
10998 d_old_pthread_create_joinable="$undef"
10999 old_pthread_create_joinable=""
11000fi
11001
11002: see if pause exists
11003set pause d_pause
11004eval $inlibc
11005
11006: see if pipe exists
11007set pipe d_pipe
11008eval $inlibc
11009
11010: see if poll exists
11011set poll d_poll
11012eval $inlibc
11013
11014
11015: see whether the various POSIXish _yields exist
11016$cat >try.c <<EOP
11017#include <pthread.h>
11018#include <stdio.h>
11019int main() {
11020#ifdef SCHED_YIELD
11021 sched_yield();
11022#else
11023#ifdef PTHREAD_YIELD
11024 pthread_yield();
11025#else
11026#ifdef PTHREAD_YIELD_NULL
11027 pthread_yield(NULL);
11028#endif
11029#endif
11030#endif
11031}
11032EOP
11033: see if sched_yield exists
11034set try -DSCHED_YIELD
11035if eval $compile; then
11036 val="$define"
11037 sched_yield='sched_yield()'
11038else
11039 val="$undef"
11040fi
11041case "$usethreads" in
11042$define)
11043 case "$val" in
11044 $define) echo 'sched_yield() found.' >&4 ;;
11045 *) echo 'sched_yield() NOT found.' >&4 ;;
11046 esac
11047esac
11048set d_sched_yield
11049eval $setvar
11050
11051: see if pthread_yield exists
11052set try -DPTHREAD_YIELD
11053if eval $compile; then
11054 val="$define"
11055 case "$sched_yield" in
11056 '') sched_yield='pthread_yield()' ;;
11057 esac
11058else
11059 set try -DPTHREAD_YIELD_NULL
11060 if eval $compile; then
11061 val="$define"
11062 case "$sched_yield" in
11063 '') sched_yield='pthread_yield(NULL)' ;;
11064 esac
11065 else
11066 val="$undef"
11067 fi
11068fi
11069case "$usethreads" in
11070$define)
11071 case "$val" in
11072 $define) echo 'pthread_yield() found.' >&4 ;;
11073 *) echo 'pthread_yield() NOT found.' >&4 ;;
11074 esac
11075 ;;
11076esac
11077set d_pthread_yield
11078eval $setvar
11079
11080case "$sched_yield" in
11081'') sched_yield=undef ;;
11082esac
11083
11084$rm -f try try.*
11085
11086: see if this is a pwd.h system
11087set pwd.h i_pwd
11088eval $inhdr
11089
11090case "$i_pwd" in
11091$define)
11092 xxx=`./findhdr pwd.h`
11093 $cppstdin $cppflags $cppminus < $xxx >$$.h
11094
11095 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11096 val="$define"
11097 else
11098 val="$undef"
11099 fi
11100 set d_pwquota
11101 eval $setvar
11102
11103 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11104 val="$define"
11105 else
11106 val="$undef"
11107 fi
11108 set d_pwage
11109 eval $setvar
11110
11111 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11112 val="$define"
11113 else
11114 val="$undef"
11115 fi
11116 set d_pwchange
11117 eval $setvar
11118
11119 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11120 val="$define"
11121 else
11122 val="$undef"
11123 fi
11124 set d_pwclass
11125 eval $setvar
11126
11127 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11128 val="$define"
11129 else
11130 val="$undef"
11131 fi
11132 set d_pwexpire
11133 eval $setvar
11134
11135 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11136 val="$define"
11137 else
11138 val="$undef"
11139 fi
11140 set d_pwcomment
11141 eval $setvar
11142
11143 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11144 val="$define"
11145 else
11146 val="$undef"
11147 fi
11148 set d_pwgecos
11149 eval $setvar
11150
11151 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11152 val="$define"
11153 else
11154 val="$undef"
11155 fi
11156 set d_pwpasswd
11157 eval $setvar
11158
11159 $rm -f $$.h
11160 ;;
11161*)
11162 val="$undef";
11163 set d_pwquota; eval $setvar
11164 set d_pwage; eval $setvar
11165 set d_pwchange; eval $setvar
11166 set d_pwclass; eval $setvar
11167 set d_pwexpire; eval $setvar
11168 set d_pwcomment; eval $setvar
11169 set d_pwgecos; eval $setvar
11170 set d_pwpasswd; eval $setvar
11171 ;;
11172esac
11173
11174: see if readdir and friends exist
11175set readdir d_readdir
11176eval $inlibc
11177set seekdir d_seekdir
11178eval $inlibc
11179set telldir d_telldir
11180eval $inlibc
11181set rewinddir d_rewinddir
11182eval $inlibc
11183
11184: see if readlink exists
11185set readlink d_readlink
11186eval $inlibc
11187
4e0554ec
JH
11188: see if readv exists
11189set readv d_readv
11190eval $inlibc
11191
640374d0
JH
11192: see if realpath exists
11193set realpath d_realpath
11194eval $inlibc
11195
4e0554ec
JH
11196: see if recvmsg exists
11197set recvmsg d_recvmsg
11198eval $inlibc
11199
b4eb6b3d
JH
11200: see if rename exists
11201set rename d_rename
11202eval $inlibc
11203
11204: see if rmdir exists
11205set rmdir d_rmdir
11206eval $inlibc
11207
11208: see if memory.h is available.
11209val=''
11210set memory.h val
11211eval $inhdr
11212
11213: See if it conflicts with string.h
11214case "$val" in
11215$define)
11216 case "$strings" in
11217 '') ;;
11218 *)
11219 $cppstdin $cppflags $cppminus < $strings > mem.h
11220 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11221 echo " "
11222 echo "We won't be including <memory.h>."
11223 val="$undef"
11224 fi
11225 $rm -f mem.h
11226 ;;
11227 esac
11228esac
11229set i_memory
11230eval $setvar
11231
11232: can bcopy handle overlapping blocks?
11233val="$undef"
11234case "$d_bcopy" in
11235"$define")
11236 echo " "
11237 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
11238 $cat >try.c <<EOCP
11239#$i_memory I_MEMORY
11240#$i_stdlib I_STDLIB
11241#$i_string I_STRING
11242#$i_unistd I_UNISTD
11243EOCP
11244 $cat >>try.c <<'EOCP'
11245#include <stdio.h>
11246#ifdef I_MEMORY
11247# include <memory.h>
11248#endif
11249#ifdef I_STDLIB
11250# include <stdlib.h>
11251#endif
11252#ifdef I_STRING
11253# include <string.h>
11254#else
11255# include <strings.h>
11256#endif
11257#ifdef I_UNISTD
11258# include <unistd.h> /* Needed for NetBSD */
11259#endif
11260int main()
11261{
11262char buf[128], abc[128];
11263char *b;
11264int len;
11265int off;
11266int align;
11267
11268bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11269
11270for (align = 7; align >= 0; align--) {
11271 for (len = 36; len; len--) {
11272 b = buf+align;
11273 bcopy(abc, b, len);
11274 for (off = 1; off <= len; off++) {
11275 bcopy(b, b+off, len);
11276 bcopy(b+off, b, len);
11277 if (bcmp(b, abc, len))
11278 exit(1);
11279 }
11280 }
11281}
11282exit(0);
11283}
11284EOCP
11285 set try
11286 if eval $compile_ok; then
11287 if ./try 2>/dev/null; then
11288 echo "Yes, it can."
11289 val="$define"
11290 else
11291 echo "It can't, sorry."
11292 case "$d_memmove" in
11293 "$define") echo "But that's Ok since you have memmove()." ;;
11294 esac
11295 fi
11296 else
11297 echo "(I can't compile the test program, so we'll assume not...)"
11298 case "$d_memmove" in
11299 "$define") echo "But that's Ok since you have memmove()." ;;
11300 esac
11301 fi
11302 ;;
11303esac
11304$rm -f try.* try core
11305set d_safebcpy
11306eval $setvar
11307
11308: can memcpy handle overlapping blocks?
11309val="$undef"
11310case "$d_memcpy" in
11311"$define")
11312 echo " "
11313 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
11314 $cat >try.c <<EOCP
11315#$i_memory I_MEMORY
11316#$i_stdlib I_STDLIB
11317#$i_string I_STRING
11318#$i_unistd I_UNISTD
11319EOCP
11320 $cat >>try.c <<'EOCP'
11321#include <stdio.h>
11322#ifdef I_MEMORY
11323# include <memory.h>
11324#endif
11325#ifdef I_STDLIB
11326# include <stdlib.h>
11327#endif
11328#ifdef I_STRING
11329# include <string.h>
11330#else
11331# include <strings.h>
11332#endif
11333#ifdef I_UNISTD
11334# include <unistd.h> /* Needed for NetBSD */
11335#endif
11336int main()
11337{
11338char buf[128], abc[128];
11339char *b;
11340int len;
11341int off;
11342int align;
11343
11344/* Copy "abcde..." string to char abc[] so that gcc doesn't
11345 try to store the string in read-only memory. */
11346memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11347
11348for (align = 7; align >= 0; align--) {
11349 for (len = 36; len; len--) {
11350 b = buf+align;
11351 memcpy(b, abc, len);
11352 for (off = 1; off <= len; off++) {
11353 memcpy(b+off, b, len);
11354 memcpy(b, b+off, len);
11355 if (memcmp(b, abc, len))
11356 exit(1);
11357 }
11358 }
11359}
11360exit(0);
11361}
11362EOCP
11363 set try
11364 if eval $compile_ok; then
11365 if ./try 2>/dev/null; then
11366 echo "Yes, it can."
11367 val="$define"
11368 else
11369 echo "It can't, sorry."
11370 case "$d_memmove" in
11371 "$define") echo "But that's Ok since you have memmove()." ;;
11372 esac
11373 fi
11374 else
11375 echo "(I can't compile the test program, so we'll assume not...)"
11376 case "$d_memmove" in
11377 "$define") echo "But that's Ok since you have memmove()." ;;
11378 esac
11379 fi
11380 ;;
11381esac
11382$rm -f try.* try core
11383set d_safemcpy
11384eval $setvar
11385
11386: can memcmp be trusted to compare relative magnitude?
11387val="$undef"
11388case "$d_memcmp" in
11389"$define")
11390 echo " "
11391 echo "Checking if your memcmp() can compare relative magnitude..." >&4
11392 $cat >try.c <<EOCP
11393#$i_memory I_MEMORY
11394#$i_stdlib I_STDLIB
11395#$i_string I_STRING
11396#$i_unistd I_UNISTD
11397EOCP
11398 $cat >>try.c <<'EOCP'
11399#include <stdio.h>
11400#ifdef I_MEMORY
11401# include <memory.h>
11402#endif
11403#ifdef I_STDLIB
11404# include <stdlib.h>
11405#endif
11406#ifdef I_STRING
11407# include <string.h>
11408#else
11409# include <strings.h>
11410#endif
11411#ifdef I_UNISTD
11412# include <unistd.h> /* Needed for NetBSD */
11413#endif
11414int main()
11415{
11416char a = -1;
11417char b = 0;
11418if ((a < b) && memcmp(&a, &b, 1) < 0)
11419 exit(1);
11420exit(0);
11421}
11422EOCP
11423 set try
11424 if eval $compile_ok; then
11425 if ./try 2>/dev/null; then
11426 echo "Yes, it can."
11427 val="$define"
11428 else
11429 echo "No, it can't (it uses signed chars)."
11430 fi
11431 else
11432 echo "(I can't compile the test program, so we'll assume not...)"
11433 fi
11434 ;;
11435esac
11436$rm -f try.* try core
11437set d_sanemcmp
11438eval $setvar
11439
ef9f17be
JH
11440: see if prototype for sbrk is available
11441echo " "
11442set d_sbrkproto sbrk $i_unistd unistd.h
11443eval $hasproto
11444
b4eb6b3d
JH
11445: see if select exists
11446set select d_select
11447eval $inlibc
11448
11449: see if semctl exists
11450set semctl d_semctl
11451eval $inlibc
11452
11453: see if semget exists
11454set semget d_semget
11455eval $inlibc
11456
11457: see if semop exists
11458set semop d_semop
11459eval $inlibc
11460
11461: see how much of the 'sem*(2)' library is present.
11462h_sem=true
11463echo " "
11464case "$d_semctl$d_semget$d_semop" in
11465*"$undef"*) h_sem=false;;
11466esac
11467case "$osname" in
11468freebsd)
11469 case "`ipcs 2>&1`" in
11470 "SVID messages"*"not configured"*)
11471 echo "Your $osname does not have the sem*(2) configured." >&4
11472 h_sem=false
11473 val="$undef"
11474 set semctl d_semctl
11475 eval $setvar
11476 set semget d_semget
11477 eval $setvar
11478 set semop d_semop
11479 eval $setvar
11480 ;;
11481 esac
11482 ;;
11483esac
11484: we could also check for sys/ipc.h ...
11485if $h_sem && $test `./findhdr sys/sem.h`; then
11486 echo "You have the full sem*(2) library." >&4
11487 val="$define"
11488else
11489 echo "You don't have the full sem*(2) library." >&4
11490 val="$undef"
11491fi
11492set d_sem
11493eval $setvar
11494
11495: see whether sys/sem.h defines union semun
11496echo " "
11497$cat > try.c <<'END'
11498#include <sys/types.h>
11499#include <sys/ipc.h>
11500#include <sys/sem.h>
11501int main () { union semun semun; semun.buf = 0; }
11502END
11503set try
11504if eval $compile; then
11505 echo "You have union semun in <sys/sem.h>." >&4
11506 val="$define"
11507else
11508 echo "You do not have union semun in <sys/sem.h>." >&4
11509 val="$undef"
11510fi
11511$rm -f try try.c try.h
11512set d_union_semun
11513eval $setvar
11514
11515: see how to do semctl IPC_STAT
11516case "$d_sem" in
11517$define)
11518 : see whether semctl IPC_STAT can use union semun
11519 echo " "
11520 $cat > try.h <<END
11521#ifndef S_IRUSR
11522# ifdef S_IREAD
11523# define S_IRUSR S_IREAD
11524# define S_IWUSR S_IWRITE
11525# define S_IXUSR S_IEXEC
11526# else
11527# define S_IRUSR 0400
11528# define S_IWUSR 0200
11529# define S_IXUSR 0100
11530# endif
11531# define S_IRGRP (S_IRUSR>>3)
11532# define S_IWGRP (S_IWUSR>>3)
11533# define S_IXGRP (S_IXUSR>>3)
11534# define S_IROTH (S_IRUSR>>6)
11535# define S_IWOTH (S_IWUSR>>6)
11536# define S_IXOTH (S_IXUSR>>6)
11537#endif
11538#ifndef S_IRWXU
11539# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11540# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11541# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11542#endif
11543END
11544
11545 $cat > try.c <<END
11546#include <sys/types.h>
11547#include <sys/ipc.h>
11548#include <sys/sem.h>
11549#include <sys/stat.h>
11550#include <stdio.h>
11551#include <errno.h>
11552#include "try.h"
11553#ifndef errno
11554extern int errno;
11555#endif
11556#$d_union_semun HAS_UNION_SEMUN
11557int main() {
11558 union semun
11559#ifndef HAS_UNION_SEMUN
11560 {
11561 int val;
11562 struct semid_ds *buf;
11563 unsigned short *array;
11564 }
11565#endif
11566 arg;
11567 int sem, st;
11568
11569#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11570 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11571 if (sem > -1) {
11572 struct semid_ds argbuf;
11573 arg.buf = &argbuf;
11574# ifdef IPC_STAT
11575 st = semctl(sem, 0, IPC_STAT, arg);
11576 if (st == 0)
11577 printf("semun\n");
11578 else
11579# endif /* IPC_STAT */
11580 printf("semctl IPC_STAT failed: errno = %d\n", errno);
11581# ifdef IPC_RMID
11582 if (semctl(sem, 0, IPC_RMID, arg) != 0)
11583# endif /* IPC_RMID */
11584 printf("semctl IPC_RMID failed: errno = %d\n", errno);
11585 } else
11586#endif /* IPC_PRIVATE && ... */
11587 printf("semget failed: errno = %d\n", errno);
11588 return 0;
11589}
11590END
11591 val="$undef"
11592 set try
11593 if eval $compile; then
11594 xxx=`./try`
11595 case "$xxx" in
11596 semun) val="$define" ;;
11597 esac
11598 fi
11599 $rm -f try try.c
11600 set d_semctl_semun
11601 eval $setvar
11602 case "$d_semctl_semun" in
11603 $define)
11604 echo "You can use union semun for semctl IPC_STAT." >&4
11605 also='also'
11606 ;;
11607 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
11608 also=''
11609 ;;
11610 esac
11611
11612 : see whether semctl IPC_STAT can use struct semid_ds pointer
11613 $cat > try.c <<'END'
11614#include <sys/types.h>
11615#include <sys/ipc.h>
11616#include <sys/sem.h>
11617#include <sys/stat.h>
11618#include "try.h"
11619#include <stdio.h>
11620#include <errno.h>
11621#ifndef errno
11622extern int errno;
11623#endif
11624int main() {
11625 struct semid_ds arg;
11626 int sem, st;
11627
11628#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11629 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11630 if (sem > -1) {
11631# ifdef IPC_STAT
11632 st = semctl(sem, 0, IPC_STAT, &arg);
11633 if (st == 0)
11634 printf("semid_ds\n");
11635 else
11636# endif /* IPC_STAT */
11637 printf("semctl IPC_STAT failed: errno = %d\n", errno);
11638# ifdef IPC_RMID
11639 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11640# endif /* IPC_RMID */
11641 printf("semctl IPC_RMID failed: errno = %d\n", errno);
11642 } else
11643#endif /* IPC_PRIVATE && ... */
11644 printf("semget failed: errno = %d\n", errno);
11645
11646 return 0;
11647}
11648END
11649 val="$undef"
11650 set try
11651 if eval $compile; then
11652 xxx=`./try`
11653 case "$xxx" in
11654 semid_ds) val="$define" ;;
11655 esac
11656 fi
11657 $rm -f try try.c
11658 set d_semctl_semid_ds
11659 eval $setvar
11660 case "$d_semctl_semid_ds" in
11661 $define)
11662 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11663 ;;
11664 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11665 ;;
11666 esac
11667 $rm -f try.h
11668 ;;
11669*) val="$undef"
11670
11671 # We do not have the full sem*(2) library, so assume we can not
11672 # use either.
11673
11674 set d_semctl_semun
11675 eval $setvar
11676
11677 set d_semctl_semid_ds
11678 eval $setvar
11679 ;;
11680esac
11681
4e0554ec
JH
11682: see if sendmsg exists
11683set sendmsg d_sendmsg
11684eval $inlibc
11685
b4eb6b3d
JH
11686: see if setegid exists
11687set setegid d_setegid
11688eval $inlibc
11689
11690: see if seteuid exists
11691set seteuid d_seteuid
11692eval $inlibc
11693
11694: see if setgrent exists
11695set setgrent d_setgrent
11696eval $inlibc
11697
11698: see if sethostent exists
11699set sethostent d_sethent
11700eval $inlibc
11701
4e0554ec
JH
11702: see if setitimer exists
11703set setitimer d_setitimer
11704eval $inlibc
11705
b4eb6b3d
JH
11706: see if setlinebuf exists
11707set setlinebuf d_setlinebuf
11708eval $inlibc
11709
11710: see if setlocale exists
11711set setlocale d_setlocale
11712eval $inlibc
11713
11714: see if setnetent exists
11715set setnetent d_setnent
11716eval $inlibc
11717
11718: see if setprotoent exists
11719set setprotoent d_setpent
11720eval $inlibc
11721
11722: see if setpgid exists
11723set setpgid d_setpgid
11724eval $inlibc
11725
11726: see if setpgrp2 exists
11727set setpgrp2 d_setpgrp2
11728eval $inlibc
11729
11730: see if setpriority exists
11731set setpriority d_setprior
11732eval $inlibc
11733
11734: see if setproctitle exists
11735set setproctitle d_setproctitle
11736eval $inlibc
11737
11738: see if setpwent exists
11739set setpwent d_setpwent
11740eval $inlibc
11741
11742: see if setregid exists
11743set setregid d_setregid
11744eval $inlibc
11745set setresgid d_setresgid
11746eval $inlibc
11747
11748: see if setreuid exists
11749set setreuid d_setreuid
11750eval $inlibc
11751set setresuid d_setresuid
11752eval $inlibc
11753
11754: see if setrgid exists
11755set setrgid d_setrgid
11756eval $inlibc
11757
11758: see if setruid exists
11759set setruid d_setruid
11760eval $inlibc
11761
11762: see if setservent exists
11763set setservent d_setsent
11764eval $inlibc
11765
11766: see if setsid exists
11767set setsid d_setsid
11768eval $inlibc
11769
11770: see if setvbuf exists
11771set setvbuf d_setvbuf
11772eval $inlibc
11773
11774: see if sfio.h is available
11775set sfio.h i_sfio
11776eval $inhdr
11777
11778
11779: see if sfio library is available
11780case "$i_sfio" in
11781$define)
11782 val=''
11783 set sfreserve val
11784 eval $inlibc
11785 ;;
11786*)
11787 val="$undef"
11788 ;;
11789esac
11790: Ok, but do we want to use it.
11791case "$val" in
11792$define)
11793 case "$usesfio" in
11794 true|$define|[yY]*) dflt='y';;
11795 *) dflt='n';;
11796 esac
11797 echo "$package can use the sfio library, but it is experimental."
11798 case "$useperlio" in
11799 "$undef")
11800 echo "For sfio also the PerlIO abstraction layer is needed."
11801 echo "Earlier you said you wouldn't want that."
11802 ;;
11803 esac
11804 rp="You seem to have sfio available, do you want to try using it?"
11805 . ./myread
11806 case "$ans" in
11807 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
11808 useperlio="$define"
11809 val="$define"
11810 ;;
11811 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
11812 val="$undef"
b4eb6b3d
JH
11813 ;;
11814 esac
11815 ;;
11816*) case "$usesfio" in
11817 true|$define|[yY]*)
11818 echo "Sorry, cannot find sfio on this machine." >&4
11819 echo "Ignoring your setting of usesfio=$usesfio." >&4
11820 val="$undef"
11821 ;;
11822 esac
11823 ;;
11824esac
11825set d_sfio
11826eval $setvar
11827case "$d_sfio" in
11828$define) usesfio='true';;
11829*) usesfio='false';;
11830esac
3659ebf1
JH
11831case "$d_sfio" in
11832$define) ;;
11833*) : Remove sfio from list of libraries to use
11834 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11835 shift
11836 libs="$*"
11837 echo "libs = $libs" >&4
11838;;
11839esac
11840
b4eb6b3d
JH
11841
11842: see if shmctl exists
11843set shmctl d_shmctl
11844eval $inlibc
11845
11846: see if shmget exists
11847set shmget d_shmget
11848eval $inlibc
11849
11850: see if shmat exists
11851set shmat d_shmat
11852eval $inlibc
11853: see what shmat returns
11854case "$d_shmat" in
11855"$define")
11856 $cat >shmat.c <<'END'
11857#include <sys/shm.h>
11858void *shmat();
11859END
11860 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11861 shmattype='void *'
11862 else
11863 shmattype='char *'
11864 fi
11865 echo "and it returns ($shmattype)." >&4
11866 : see if a prototype for shmat is available
11867 xxx=`./findhdr sys/shm.h`
11868 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11869 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11870 val="$define"
11871 else
11872 val="$undef"
11873 fi
11874 $rm -f shmat.[co]
11875 ;;
11876*)
11877 val="$undef"
11878 ;;
11879esac
11880set d_shmatprototype
11881eval $setvar
11882
11883: see if shmdt exists
11884set shmdt d_shmdt
11885eval $inlibc
11886
11887: see how much of the 'shm*(2)' library is present.
11888h_shm=true
11889echo " "
11890case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11891*"$undef"*) h_shm=false;;
11892esac
11893case "$osname" in
11894freebsd)
11895 case "`ipcs 2>&1`" in
11896 "SVID shared memory"*"not configured"*)
11897 echo "Your $osname does not have the shm*(2) configured." >&4
11898 h_shm=false
11899 val="$undef"
11900 set shmctl d_shmctl
11901 evat $setvar
11902 set shmget d_shmget
11903 evat $setvar
11904 set shmat d_shmat
11905 evat $setvar
11906 set shmdt d_shmdt
11907 evat $setvar
11908 ;;
11909 esac
11910 ;;
11911esac
11912: we could also check for sys/ipc.h ...
11913if $h_shm && $test `./findhdr sys/shm.h`; then
11914 echo "You have the full shm*(2) library." >&4
11915 val="$define"
11916else
11917 echo "You don't have the full shm*(2) library." >&4
11918 val="$undef"
11919fi
11920set d_shm
11921eval $setvar
11922
11923echo " "
11924: see if we have sigaction
11925if set sigaction val -f d_sigaction; eval $csym; $val; then
11926 echo 'sigaction() found.' >&4
11927 $cat > try.c <<'EOP'
11928#include <stdio.h>
11929#include <sys/types.h>
11930#include <signal.h>
11931int main()
11932{
11933 struct sigaction act, oact;
11934 act.sa_flags = 0;
11935 oact.sa_handler = 0;
11936 /* so that act and oact are used */
11937 exit(act.sa_flags == 0 && oact.sa_handler == 0);
11938}
11939EOP
11940 set try
11941 if eval $compile_ok; then
11942 val="$define"
11943 else
11944 echo "But you don't seem to have a useable struct sigaction." >&4
11945 val="$undef"
11946 fi
11947else
11948 echo 'sigaction NOT found.' >&4
11949 val="$undef"
11950fi
11951set d_sigaction; eval $setvar
11952$rm -f try try$_o try.c
11953
983dbef6
JH
11954: see if sigprocmask exists
11955set sigprocmask d_sigprocmask
11956eval $inlibc
11957
b4eb6b3d
JH
11958: see if sigsetjmp exists
11959echo " "
11960case "$d_sigsetjmp" in
11961'')
11962 $cat >try.c <<'EOP'
11963#include <setjmp.h>
11964sigjmp_buf env;
11965int set = 1;
11966int main()
11967{
11968 if (sigsetjmp(env,1))
11969 exit(set);
11970 set = 0;
11971 siglongjmp(env, 1);
11972 exit(1);
11973}
11974EOP
11975 set try
11976 if eval $compile; then
11977 if ./try >/dev/null 2>&1; then
11978 echo "POSIX sigsetjmp found." >&4
11979 val="$define"
11980 else
11981 $cat >&4 <<EOM
11982Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11983I'll ignore them.
11984EOM
11985 val="$undef"
11986 fi
11987 else
11988 echo "sigsetjmp not found." >&4
11989 val="$undef"
11990 fi
11991 ;;
11992*) val="$d_sigsetjmp"
11993 case "$d_sigsetjmp" in
11994 $define) echo "POSIX sigsetjmp found." >&4;;
11995 $undef) echo "sigsetjmp not found." >&4;;
11996 esac
11997 ;;
11998esac
11999set d_sigsetjmp
12000eval $setvar
12001$rm -f try.c try
12002
49a78c82
JH
12003: see if sockatmark exists
12004set sockatmark d_sockatmark
12005eval $inlibc
12006
2ef53570
JH
12007: see if prototype for sockatmark is available
12008echo " "
12009set d_sockatmarkproto sockatmark $d_socket sys/socket.h
12010eval $hasproto
12011
b4eb6b3d
JH
12012: see if socks5_init exists
12013set socks5_init d_socks5_init
12014eval $inlibc
12015
eef837ea
JH
12016: see if prototype for setresgid is available
12017echo " "
12018set d_sresgproto setresgid $i_unistd unistd.h
12019eval $hasproto
12020
640374d0
JH
12021: see if prototype for setresuid is available
12022echo " "
12023set d_sresuproto setresuid $i_unistd unistd.h
12024eval $hasproto
12025
b4eb6b3d
JH
12026: see if sys/stat.h is available
12027set sys/stat.h i_sysstat
12028eval $inhdr
12029
12030
12031: see if stat knows about block sizes
12032echo " "
12033echo "Checking to see if your struct stat has st_blocks field..." >&4
12034set d_statblks stat st_blocks $i_sysstat sys/stat.h
12035eval $hasfield
12036
12037
12038: see if this is a sys/vfs.h system
12039set sys/vfs.h i_sysvfs
12040eval $inhdr
12041
12042
12043: see if this is a sys/statfs.h system
12044set sys/statfs.h i_sysstatfs
12045eval $inhdr
12046
12047
12048echo " "
12049echo "Checking to see if your system supports struct statfs..." >&4
12050set 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
12051eval $hasstruct
12052case "$d_statfs_s" in
12053"$define") echo "Yes, it does." ;;
12054*) echo "No, it doesn't." ;;
12055esac
12056
12057
12058
12059: see if struct statfs knows about f_flags
12060case "$d_statfs_s" in
12061define)
12062 echo " "
12063 echo "Checking to see if your struct statfs has f_flags field..." >&4
12064 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
12065 eval $hasfield
12066 ;;
12067*) val="$undef"
12068 set d_statfs_f_flags
12069 eval $setvar
12070 ;;
12071esac
12072case "$d_statfs_f_flags" in
12073"$define") echo "Yes, it does." ;;
12074*) echo "No, it doesn't." ;;
12075esac
12076
12077: see if _ptr and _cnt from stdio act std
12078echo " "
80f36755
NC
12079
12080if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12081 echo "(Looks like you have stdio.h from BSD.)"
12082 case "$stdio_ptr" in
12083 '') stdio_ptr='((fp)->_p)'
12084 ptr_lval=$define
12085 ;;
12086 *) ptr_lval=$d_stdio_ptr_lval;;
12087 esac
12088 case "$stdio_cnt" in
12089 '') stdio_cnt='((fp)->_r)'
12090 cnt_lval=$define
12091 ;;
12092 *) cnt_lval=$d_stdio_cnt_lval;;
12093 esac
12094 case "$stdio_base" in
12095 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12096 esac
12097 case "$stdio_bufsiz" in
12098 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12099 esac
12100elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
b4eb6b3d
JH
12101 echo "(Looks like you have stdio.h from Linux.)"
12102 case "$stdio_ptr" in
12103 '') stdio_ptr='((fp)->_IO_read_ptr)'
12104 ptr_lval=$define
12105 ;;
12106 *) ptr_lval=$d_stdio_ptr_lval;;
12107 esac
12108 case "$stdio_cnt" in
12109 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12110 cnt_lval=$undef
12111 ;;
12112 *) cnt_lval=$d_stdio_cnt_lval;;
12113 esac
12114 case "$stdio_base" in
12115 '') stdio_base='((fp)->_IO_read_base)';;
12116 esac
12117 case "$stdio_bufsiz" in
12118 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12119 esac
12120else
12121 case "$stdio_ptr" in
12122 '') stdio_ptr='((fp)->_ptr)'
12123 ptr_lval=$define
12124 ;;
12125 *) ptr_lval=$d_stdio_ptr_lval;;
12126 esac
12127 case "$stdio_cnt" in
12128 '') stdio_cnt='((fp)->_cnt)'
12129 cnt_lval=$define
12130 ;;
12131 *) cnt_lval=$d_stdio_cnt_lval;;
12132 esac
12133 case "$stdio_base" in
12134 '') stdio_base='((fp)->_base)';;
12135 esac
12136 case "$stdio_bufsiz" in
12137 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12138 esac
12139fi
80f36755 12140
b4eb6b3d
JH
12141: test whether _ptr and _cnt really work
12142echo "Checking how std your stdio is..." >&4
12143$cat >try.c <<EOP
12144#include <stdio.h>
12145#define FILE_ptr(fp) $stdio_ptr
12146#define FILE_cnt(fp) $stdio_cnt
12147int main() {
12148 FILE *fp = fopen("try.c", "r");
12149 char c = getc(fp);
12150 if (
12151 18 <= FILE_cnt(fp) &&
12152 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12153 )
12154 exit(0);
12155 exit(1);
12156}
12157EOP
12158val="$undef"
12159set try
12160if eval $compile; then
12161 if ./try; then
12162 echo "Your stdio acts pretty std."
12163 val="$define"
12164 else
12165 echo "Your stdio isn't very std."
12166 fi
12167else
12168 echo "Your stdio doesn't appear very std."
12169fi
12170$rm -f try.c try
12171set d_stdstdio
12172eval $setvar
12173
12174: Can _ptr be used as an lvalue?
12175case "$d_stdstdio$ptr_lval" in
12176$define$define) val=$define ;;
12177*) val=$undef ;;
12178esac
12179set d_stdio_ptr_lval
12180eval $setvar
12181
12182: Can _cnt be used as an lvalue?
12183case "$d_stdstdio$cnt_lval" in
12184$define$define) val=$define ;;
12185*) val=$undef ;;
12186esac
12187set d_stdio_cnt_lval
12188eval $setvar
12189
a7ffa9b9
NC
12190
12191: test whether setting _ptr sets _cnt as a side effect
12192d_stdio_ptr_lval_sets_cnt="$undef"
12193d_stdio_ptr_lval_nochange_cnt="$undef"
12194case "$d_stdio_ptr_lval$d_stdstdio" in
12195$define$define)
12196 echo "Checking to see what happens if we set the stdio ptr..." >&4
12197$cat >try.c <<EOP
12198#include <stdio.h>
12199/* Can we scream? */
12200/* Eat dust sed :-) */
c1d9e6fa 12201/* In the buffer space, no one can hear you scream. */
0bbfc344
JH
12202#define FILE_ptr(fp) $stdio_ptr
12203#define FILE_cnt(fp) $stdio_cnt
c1d9e6fa 12204#include <sys/types.h>
a7ffa9b9
NC
12205int main() {
12206 FILE *fp = fopen("try.c", "r");
c1d9e6fa 12207 int c;
a7ffa9b9
NC
12208 char *ptr;
12209 size_t cnt;
c1d9e6fa
JH
12210 if (!fp) {
12211 puts("Fail even to read");
12212 exit(1);
12213 }
12214 c = getc(fp); /* Read away the first # */
12215 if (c == EOF) {
12216 puts("Fail even to read");
12217 exit(1);
12218 }
a7ffa9b9
NC
12219 if (!(
12220 18 <= FILE_cnt(fp) &&
12221 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12222 )) {
12223 puts("Fail even to read");
12224 exit (1);
12225 }
c1d9e6fa
JH
12226 ptr = (char*) FILE_ptr(fp);
12227 cnt = (size_t)FILE_cnt(fp);
a7ffa9b9 12228
c1d9e6fa 12229 FILE_ptr(fp) += 42;
a7ffa9b9 12230
c1d9e6fa 12231 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
a7ffa9b9
NC
12232 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12233 exit (1);
12234 }
12235 if (FILE_cnt(fp) <= 20) {
12236 printf ("Fail (<20 chars to test)");
12237 exit (1);
12238 }
12239 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12240 puts("Fail compare");
12241 exit (1);
12242 }
12243 if (cnt == FILE_cnt(fp)) {
12244 puts("Pass_unchanged");
12245 exit (0);
12246 }
12247 if (FILE_cnt(fp) == (cnt - 42)) {
12248 puts("Pass_changed");
12249 exit (0);
12250 }
12251 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12252 return 1;
12253
12254}
12255EOP
12256 set try
12257 if eval $compile; then
12258 case `./try$exe_ext` in
12259 Pass_changed)
2e32dcfe 12260 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
a7ffa9b9
NC
12261 d_stdio_ptr_lval_sets_cnt="$define" ;;
12262 Pass_unchanged)
12263 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12264 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12265 Fail*)
12266 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12267 *)
12268 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12269 esac
12270 else
12271 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12272 fi
12273 $rm -f try.c try
12274 ;;
12275esac
12276
b4eb6b3d
JH
12277: see if _base is also standard
12278val="$undef"
12279case "$d_stdstdio" in
12280$define)
12281 $cat >try.c <<EOP
12282#include <stdio.h>
12283#define FILE_base(fp) $stdio_base
12284#define FILE_bufsiz(fp) $stdio_bufsiz
12285int main() {
12286 FILE *fp = fopen("try.c", "r");
12287 char c = getc(fp);
12288 if (
12289 19 <= FILE_bufsiz(fp) &&
12290 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12291 )
12292 exit(0);
12293 exit(1);
12294}
12295EOP
12296 set try
12297 if eval $compile; then
12298 if ./try; then
12299 echo "And its _base field acts std."
12300 val="$define"
12301 else
12302 echo "But its _base field isn't std."
12303 fi
12304 else
12305 echo "However, it seems to be lacking the _base field."
12306 fi
12307 $rm -f try.c try
12308 ;;
12309esac
12310set d_stdiobase
12311eval $setvar
12312
12313$cat >&4 <<EOM
12314Checking how to access stdio streams by file descriptor number...
12315EOM
12316case "$stdio_stream_array" in
12317'') $cat >try.c <<EOCP
12318#include <stdio.h>
12319int main() {
12320 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12321 printf("yes\n");
12322}
12323EOCP
12324 for s in _iob __iob __sF
12325 do
12326 set try -DSTDIO_STREAM_ARRAY=$s
12327 if eval $compile; then
12328 case "`./try$exe_ext`" in
12329 yes) stdio_stream_array=$s; break ;;
12330 esac
12331 fi
12332 done
12333 $rm -f try.* try$exe_ext
12334esac
12335case "$stdio_stream_array" in
12336'') $cat >&4 <<EOM
12337I can't figure out how to access stdio streams by file descriptor number.
12338EOM
12339 d_stdio_stream_array="$undef"
12340 ;;
12341*) $cat >&4 <<EOM
12342You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12343EOM
12344 d_stdio_stream_array="$define"
12345 ;;
12346esac
12347
12348: see if strcoll exists
12349set strcoll d_strcoll
12350eval $inlibc
12351
12352: check for structure copying
12353echo " "
12354echo "Checking to see if your C compiler can copy structs..." >&4
12355$cat >try.c <<'EOCP'
12356int main()
12357{
12358 struct blurfl {
12359 int dyick;
12360 } foo, bar;
12361
12362 foo = bar;
12363}
12364EOCP
12365if $cc -c try.c >/dev/null 2>&1 ; then
12366 val="$define"
12367 echo "Yup, it can."
12368else
12369 val="$undef"
12370 echo "Nope, it can't."
12371fi
12372set d_strctcpy
12373eval $setvar
12374$rm -f try.*
12375
12376: see if strerror and/or sys_errlist[] exist
12377echo " "
12378if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12379 if set strerror val -f d_strerror; eval $csym; $val; then
12380 echo 'strerror() found.' >&4
12381 d_strerror="$define"
12382 d_strerrm='strerror(e)'
12383 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12384 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
12385 d_syserrlst="$define"
12386 else
12387 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12388 d_syserrlst="$undef"
12389 fi
12390 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12391 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12392 echo 'strerror() found in string header.' >&4
12393 d_strerror="$define"
12394 d_strerrm='strerror(e)'
12395 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12396 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12397 d_syserrlst="$define"
12398 else
12399 echo "(You don't appear to have any sys_errlist[], how can this be?)"
12400 d_syserrlst="$undef"
12401 fi
12402 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12403 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12404 d_strerror="$undef"
12405 d_syserrlst="$define"
12406 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12407 else
12408 echo 'strerror() and sys_errlist[] NOT found.' >&4
12409 d_strerror="$undef"
12410 d_syserrlst="$undef"
12411 d_strerrm='"unknown"'
12412 fi
12413fi
12414
b3c85772
JH
12415: see if strftime exists
12416set strftime d_strftime
12417eval $inlibc
12418
b4eb6b3d
JH
12419: see if strtod exists
12420set strtod d_strtod
12421eval $inlibc
12422
12423: see if strtol exists
12424set strtol d_strtol
12425eval $inlibc
12426
12427: see if strtold exists
12428set strtold d_strtold
12429eval $inlibc
12430
12431: see if strtoll exists
12432set strtoll d_strtoll
12433eval $inlibc
12434
12435case "$d_longlong-$d_strtoll" in
12436"$define-$define")
12437 $cat <<EOM
12438Checking whether your strtoll() works okay...
12439EOM
12440 $cat >try.c <<'EOCP'
12441#include <errno.h>
12442#ifdef __hpux
12443#define strtoll __strtoll
12444#endif
e75931a7
YST
12445#ifdef __EMX__
12446#define strtoll _strtoll
12447#endif
b4eb6b3d
JH
12448#include <stdio.h>
12449extern long long int strtoll(char *s, char **, int);
12450static int bad = 0;
12451int check(char *s, long long ell, int een) {
12452 long long gll;
12453 errno = 0;
12454 gll = strtoll(s, 0, 10);
12455 if (!((gll == ell) && (errno == een)))
12456 bad++;
12457}
12458int main() {
12459 check(" 1", 1LL, 0);
12460 check(" 0", 0LL, 0);
12461 check("-1", -1LL, 0);
12462 check("-9223372036854775808", -9223372036854775808LL, 0);
12463 check("-9223372036854775808", -9223372036854775808LL, 0);
12464 check(" 9223372036854775807", 9223372036854775807LL, 0);
12465 check("-9223372036854775808", -9223372036854775808LL, 0);
12466 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
12467 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12468 if (!bad)
12469 printf("ok\n");
12470}
12471EOCP
12472 set try
12473 if eval $compile; then
e75931a7
YST
12474 yyy=`./try`
12475 case "$yyy" in
b4eb6b3d
JH
12476 ok) echo "Your strtoll() seems to be working okay." ;;
12477 *) cat <<EOM >&4
12478Your strtoll() doesn't seem to be working okay.
12479EOM
12480 d_strtoll="$undef"
12481 ;;
69eadf66 12482 esac
e75931a7
YST
12483 else
12484 echo "(I can't seem to compile the test program--assuming it doesn't)"
12485 d_strtoll="$undef"
b4eb6b3d
JH
12486 fi
12487 ;;
12488esac
12489
28e5dec8
JH
12490: see if strtoq exists
12491set strtoq d_strtoq
12492eval $inlibc
12493
b4eb6b3d
JH
12494: see if strtoul exists
12495set strtoul d_strtoul
12496eval $inlibc
12497
d0e6d399
NC
12498case "$d_strtoul" in
12499"$define")
12500 $cat <<EOM
12501Checking whether your strtoul() works okay...
12502EOM
12503 $cat >try.c <<'EOCP'
12504#include <errno.h>
12505#include <stdio.h>
12506extern unsigned long int strtoul(char *s, char **, int);
12507static int bad = 0;
12508void check(char *s, unsigned long eul, int een) {
12509 unsigned long gul;
12510 errno = 0;
12511 gul = strtoul(s, 0, 10);
12512 if (!((gul == eul) && (errno == een)))
12513 bad++;
12514}
12515int main() {
12516 check(" 1", 1L, 0);
12517 check(" 0", 0L, 0);
12518EOCP
12519 case "$longsize" in
12520 8)
12521 $cat >>try.c <<'EOCP'
09c0d2c4
JH
12522 check("18446744073709551615", 18446744073709551615UL, 0);
12523 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 12524#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 12525 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
12526 check("-18446744073709551614", 2, 0);
12527 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
12528 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12529 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 12530#endif
d0e6d399
NC
12531EOCP
12532 ;;
12533 4)
12534 $cat >>try.c <<'EOCP'
12535 check("4294967295", 4294967295UL, 0);
12536 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 12537#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
12538 check("-1", 4294967295UL, 0);
12539 check("-4294967294", 2, 0);
12540 check("-4294967295", 1, 0);
12541 check("-4294967296", 4294967295UL, ERANGE);
12542 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 12543#endif
d0e6d399
NC
12544EOCP
12545 ;;
12546 *)
12547: Should we write these tests to be more portable by sprintf-ing
12548: ~0 and then manipulating that char string as input for strtol?
12549 ;;
12550 esac
12551 $cat >>try.c <<'EOCP'
12552 if (!bad)
12553 printf("ok\n");
12554 return 0;
12555}
12556EOCP
12557 set try
12558 if eval $compile; then
12559 case "`./try`" in
12560 ok) echo "Your strtoul() seems to be working okay." ;;
12561 *) cat <<EOM >&4
12562Your strtoul() doesn't seem to be working okay.
12563EOM
12564 d_strtoul="$undef"
12565 ;;
12566 esac
12567 fi
12568 ;;
12569esac
12570
b4eb6b3d
JH
12571: see if strtoull exists
12572set strtoull d_strtoull
12573eval $inlibc
12574
12575case "$d_longlong-$d_strtoull" in
12576"$define-$define")
12577 $cat <<EOM
12578Checking whether your strtoull() works okay...
12579EOM
12580 $cat >try.c <<'EOCP'
12581#include <errno.h>
12582#ifdef __hpux
12583#define strtoull __strtoull
12584#endif
12585#include <stdio.h>
12586extern unsigned long long int strtoull(char *s, char **, int);
12587static int bad = 0;
12588int check(char *s, long long eull, int een) {
12589 long long gull;
12590 errno = 0;
12591 gull = strtoull(s, 0, 10);
12592 if (!((gull == eull) && (errno == een)))
12593 bad++;
12594}
12595int main() {
d0e6d399
NC
12596 check(" 1", 1LL, 0);
12597 check(" 0", 0LL, 0);
12598 check("18446744073709551615", 18446744073709551615ULL, 0);
12599 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 12600#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
12601 check("-1", 18446744073709551615ULL, 0);
12602 check("-18446744073709551614", 2LL, 0);
12603 check("-18446744073709551615", 1LL, 0);
12604 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12605 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 12606#endif
b4eb6b3d
JH
12607 if (!bad)
12608 printf("ok\n");
12609}
12610EOCP
12611 set try
12612 if eval $compile; then
12613 case "`./try`" in
12614 ok) echo "Your strtoull() seems to be working okay." ;;
12615 *) cat <<EOM >&4
12616Your strtoull() doesn't seem to be working okay.
12617EOM
12618 d_strtoull="$undef"
12619 ;;
12620 esac
12621 fi
12622 ;;
12623esac
12624
12625: see if strtouq exists
12626set strtouq d_strtouq
12627eval $inlibc
12628
d0e6d399
NC
12629case "$d_strtouq" in
12630"$define")
12631 $cat <<EOM
12632Checking whether your strtouq() works okay...
12633EOM
12634 $cat >try.c <<'EOCP'
12635#include <errno.h>
12636#include <stdio.h>
12637extern unsigned long long int strtouq(char *s, char **, int);
12638static int bad = 0;
12639void check(char *s, unsigned long long eull, int een) {
12640 unsigned long long gull;
12641 errno = 0;
12642 gull = strtouq(s, 0, 10);
12643 if (!((gull == eull) && (errno == een)))
12644 bad++;
12645}
12646int main() {
12647 check(" 1", 1LL, 0);
12648 check(" 0", 0LL, 0);
12649 check("18446744073709551615", 18446744073709551615ULL, 0);
12650 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 12651#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
12652 check("-1", 18446744073709551615ULL, 0);
12653 check("-18446744073709551614", 2LL, 0);
12654 check("-18446744073709551615", 1LL, 0);
12655 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12656 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 12657#endif
d0e6d399
NC
12658 if (!bad)
12659 printf("ok\n");
12660 return 0;
12661}
12662EOCP
12663 set try
12664 if eval $compile; then
12665 case "`./try`" in
12666 ok) echo "Your strtouq() seems to be working okay." ;;
12667 *) cat <<EOM >&4
12668Your strtouq() doesn't seem to be working okay.
12669EOM
12670 d_strtouq="$undef"
12671 ;;
12672 esac
12673 fi
12674 ;;
12675esac
12676
b4eb6b3d
JH
12677: see if strxfrm exists
12678set strxfrm d_strxfrm
12679eval $inlibc
12680
12681: see if symlink exists
12682set symlink d_symlink
12683eval $inlibc
12684
12685: see if syscall exists
12686set syscall d_syscall
12687eval $inlibc
12688
2ef53570
JH
12689: see if prototype for syscall is available
12690echo " "
12691set d_syscallproto syscall $i_unistd unistd.h
12692eval $hasproto
12693
b4eb6b3d
JH
12694: see if sysconf exists
12695set sysconf d_sysconf
12696eval $inlibc
12697
12698: see if system exists
12699set system d_system
12700eval $inlibc
12701
12702: see if tcgetpgrp exists
12703set tcgetpgrp d_tcgetpgrp
12704eval $inlibc
12705
12706: see if tcsetpgrp exists
12707set tcsetpgrp d_tcsetpgrp
12708eval $inlibc
12709
12710: see if prototype for telldir is available
12711echo " "
12712set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12713eval $hasproto
12714
12715: see if this is a sys/times.h system
12716set sys/times.h i_systimes
12717eval $inhdr
12718
12719: see if times exists
12720echo " "
12721if set times val -f d_times; eval $csym; $val; then
12722 echo 'times() found.' >&4
12723 d_times="$define"
12724 inc=''
12725 case "$i_systimes" in
12726 "$define") inc='sys/times.h';;
12727 esac
12728 rp="What is the type returned by times() on this system?"
12729 set clock_t clocktype long stdio.h sys/types.h $inc
12730 eval $typedef_ask
12731else
12732 echo 'times() NOT found, hope that will do.' >&4
12733 d_times="$undef"
12734 clocktype='int'
12735fi
12736
12737: see if truncate exists
12738set truncate d_truncate
12739eval $inlibc
12740
12741: see if tzname[] exists
12742echo " "
12743if set tzname val -a d_tzname; eval $csym; $val; then
12744 val="$define"
12745 echo 'tzname[] found.' >&4
12746else
12747 val="$undef"
12748 echo 'tzname[] NOT found.' >&4
12749fi
12750set d_tzname
12751eval $setvar
12752
4e0554ec
JH
12753case "$crosscompile" in
12754''|[nN]*) crosscompile="$undef" ;;
12755esac
12756
12757case "$osname" in
12758next|rhapsody|darwin) multiarch="$define" ;;
12759esac
12760case "$multiarch" in
12761''|[nN]*) multiarch="$undef" ;;
12762esac
12763
12764: check for ordering of bytes in a long
12765echo " "
12766case "$crosscompile$multiarch" in
12767*$define*)
12768 $cat <<EOM
12769You seem to be either cross-compiling or doing a multiarchitecture build,
12770skipping the byteorder check.
12771
12772EOM
12773 byteorder='0xffff'
12774 ;;
12775*)
12776 case "$byteorder" in
12777 '')
12778 $cat <<'EOM'
12779In the following, larger digits indicate more significance. A big-endian
12780machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12781little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12782machines may have weird orders like 3412. A Cray will report 87654321,
12783an Alpha will report 12345678. If the test program works the default is
12784probably right.
12785I'm now running the test program...
12786EOM
12787 $cat >try.c <<'EOCP'
12788#include <stdio.h>
12789int main()
12790{
12791 int i;
12792 union {
12793 unsigned long l;
12794 char c[sizeof(long)];
12795 } u;
12796
12797 if (sizeof(long) > 4)
12798 u.l = (0x08070605L << 32) | 0x04030201L;
12799 else
12800 u.l = 0x04030201L;
12801 for (i = 0; i < sizeof(long); i++)
12802 printf("%c", u.c[i]+'0');
12803 printf("\n");
12804 exit(0);
12805}
12806EOCP
12807 xxx_prompt=y
12808 set try
12809 if eval $compile && ./try > /dev/null; then
12810 dflt=`./try`
12811 case "$dflt" in
12812 [1-4][1-4][1-4][1-4]|12345678|87654321)
12813 echo "(The test program ran ok.)"
12814 echo "byteorder=$dflt"
12815 xxx_prompt=n
12816 ;;
12817 ????|????????) echo "(The test program ran ok.)" ;;
12818 *) echo "(The test program didn't run right for some reason.)" ;;
12819 esac
12820 else
12821 dflt='4321'
12822 cat <<'EOM'
12823(I can't seem to compile the test program. Guessing big-endian...)
12824EOM
12825 fi
12826 case "$xxx_prompt" in
12827 y)
12828 rp="What is the order of bytes in a long?"
12829 . ./myread
12830 byteorder="$ans"
12831 ;;
12832 *) byteorder=$dflt
12833 ;;
12834 esac
12835 ;;
12836 esac
12837 $rm -f try.c try
12838 ;;
12839esac
12840
12841
12842$cat <<EOM
12843
12844Checking to see whether you can access character data unalignedly...
12845EOM
12846$cat >try.c <<EOCP
12847#include <stdio.h>
12848#define U32 $u32type
12849#define BYTEORDER $byteorder
12850int main() {
12851#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
12852 U8 buf[] = "\0\0\0\1\0\0\0\0";
12853 U32 *up;
12854 int i;
12855
12856 if (sizeof(U32) != 4) {
12857 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
12858 exit(1);
12859 }
12860
12861 fflush(stdout);
12862
12863 for (i = 0; i < 4; i++) {
12864 up = (U32*)(buf + i);
12865 if (! ((*up == 1 << (8*i)) || /* big-endian */
12866 (*up == 1 << (8*(3-i))) /* little-endian */
12867 )
12868 )
12869 {
12870 printf("read failed (%x)\n", *up);
12871 exit(2);
12872 }
12873 }
12874
12875 /* write test */
12876 for (i = 0; i < 4; i++) {
12877 up = (U32*)(buf + i);
12878 *up = 0xBeef;
12879 if (*up != 0xBeef) {
12880 printf("write failed (%x)\n", *up);
12881 exit(3);
12882 }
12883 }
12884
12885 exit(0);
12886#else
12887 printf("1\n");
12888 exit(1);
12889#endif
12890 return 0;
12891}
12892EOCP
12893set try
12894if eval $compile_ok; then
12895 echo "(This test may dump core.)" >&4
12896 ./try >&2 >/dev/null
12897 case "$?" in
12898 0) cat >&4 <<EOM
12899You can access character data pretty unalignedly.
12900EOM
12901 d_u32align="$undef"
12902 ;;
12903 *) cat >&4 <<EOM
12904It seems that you must access character data in an aligned manner.
12905EOM
12906 d_u32align="$define"
12907 ;;
12908 esac
12909 $rm -f core core.try.* try.core
12910else
12911 rp='Can you access character data at unaligned addresses?'
12912 dflt='n'
12913 . ./myread
12914 case "$ans" in
12915 [yY]*) d_u32align="$undef" ;;
12916 *) d_u32align="$define" ;;
12917 esac
12918fi
12919
12920: see if ualarm exists
12921set ualarm d_ualarm
12922eval $inlibc
12923
b4eb6b3d
JH
12924: see if umask exists
12925set umask d_umask
12926eval $inlibc
12927
4e0554ec
JH
12928: see if usleep exists
12929set usleep d_usleep
12930eval $inlibc
12931
2ef53570
JH
12932: see if prototype for usleep is available
12933echo " "
12934set d_usleepproto usleep $i_unistd unistd.h
12935eval $hasproto
12936
b4eb6b3d
JH
12937: see if ustat exists
12938set ustat d_ustat
12939eval $inlibc
12940
12941: backward compatibility for d_hvfork
12942if test X$d_hvfork != X; then
12943 d_vfork="$d_hvfork"
12944 d_hvfork=''
12945fi
12946: see if there is a vfork
12947val=''
12948set vfork val
12949eval $inlibc
12950
12951: Ok, but do we want to use it. vfork is reportedly unreliable in
12952: perl on Solaris 2.x, and probably elsewhere.
12953case "$val" in
12954$define)
12955 echo " "
12956 case "$usevfork" in
12957 false) dflt='n';;
12958 *) dflt='y';;
12959 esac
12960 cat <<'EOM'
12961
12962Perl can only use a vfork() that doesn't suffer from strict
12963restrictions on calling functions or modifying global data in
12964the child. For example, glibc-2.1 contains such a vfork()
12965that is unsuitable. If your system provides a proper fork()
12966call, chances are that you do NOT want perl to use vfork().
12967
12968EOM
12969 rp="Do you still want to use vfork()?"
12970 . ./myread
12971 case "$ans" in
12972 y|Y) ;;
12973 *)
12974 echo "Ok, we won't use vfork()."
12975 val="$undef"
12976 ;;
12977 esac
12978 ;;
12979esac
12980set d_vfork
12981eval $setvar
12982case "$d_vfork" in
12983$define) usevfork='true';;
12984*) usevfork='false';;
12985esac
12986
12987: see if this is an sysdir system
12988set sys/dir.h i_sysdir
12989eval $inhdr
12990
12991: see if this is an sysndir system
12992set sys/ndir.h i_sysndir
12993eval $inhdr
12994
12995: see if closedir exists
12996set closedir d_closedir
12997eval $inlibc
12998
12999case "$d_closedir" in
13000"$define")
13001 echo " "
13002 echo "Checking whether closedir() returns a status..." >&4
13003 cat > closedir.c <<EOM
13004#$i_dirent I_DIRENT /**/
13005#$i_sysdir I_SYS_DIR /**/
13006#$i_sysndir I_SYS_NDIR /**/
13007#$i_systypes I_SYS_TYPES /**/
13008
13009#if defined(I_SYS_TYPES)
13010#include <sys/types.h>
13011#endif
13012#if defined(I_DIRENT)
13013#include <dirent.h>
13014#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
13015#include <sys/dir.h>
13016#endif
13017#else
13018#ifdef I_SYS_NDIR
13019#include <sys/ndir.h>
13020#else
13021#ifdef I_SYS_DIR
13022#ifdef hp9000s500
13023#include <ndir.h> /* may be wrong in the future */
13024#else
13025#include <sys/dir.h>
13026#endif
13027#endif
13028#endif
13029#endif
13030int main() { return closedir(opendir(".")); }
13031EOM
13032 set closedir
13033 if eval $compile_ok; then
13034 if ./closedir > /dev/null 2>&1 ; then
13035 echo "Yes, it does."
13036 val="$undef"
13037 else
13038 echo "No, it doesn't."
13039 val="$define"
13040 fi
13041 else
13042 echo "(I can't seem to compile the test program--assuming it doesn't)"
13043 val="$define"
13044 fi
13045 ;;
13046*)
13047 val="$undef";
13048 ;;
13049esac
13050set d_void_closedir
13051eval $setvar
13052$rm -f closedir*
b4eb6b3d
JH
13053: see if there is a wait4
13054set wait4 d_wait4
13055eval $inlibc
13056
13057: see if waitpid exists
13058set waitpid d_waitpid
13059eval $inlibc
13060
13061: see if wcstombs exists
13062set wcstombs d_wcstombs
13063eval $inlibc
13064
13065: see if wctomb exists
13066set wctomb d_wctomb
13067eval $inlibc
13068
4e0554ec
JH
13069: see if writev exists
13070set writev d_writev
13071eval $inlibc
13072
b4eb6b3d
JH
13073: preserve RCS keywords in files with variable substitution, grrr
13074Date='$Date'
13075Id='$Id'
13076Log='$Log'
13077RCSfile='$RCSfile'
13078Revision='$Revision'
13079
b4eb6b3d
JH
13080: check for alignment requirements
13081echo " "
13082case "$crosscompile$multiarch" in
13083*$define*)
13084 $cat <<EOM
13085You seem to be either cross-compiling or doing a multiarchitecture build,
13086skipping the memory alignment check.
13087
13088EOM
13089 case "$alignbytes" in
13090 '') alignbytes=8 ;;
13091 esac
13092 ;;
13093*)
13094 case "$alignbytes" in
13095 '') echo "Checking alignment constraints..." >&4
13096 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
13097 $cat >try.c <<'EOCP'
13098typedef long double NV;
13099EOCP
13100 else
13101 $cat >try.c <<'EOCP'
13102typedef double NV;
13103EOCP
13104 fi
13105 $cat >>try.c <<'EOCP'
13106#include <stdio.h>
13107struct foobar {
13108 char foo;
13109 NV bar;
13110} try_algn;
13111int main()
13112{
13113 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
13114 return(0);
13115}
13116EOCP
13117 set try
13118 if eval $compile_ok; then
13119 dflt=`./try`
13120 else
13121 dflt='8'
13122 echo "(I can't seem to compile the test program...)"
13123 fi
13124 ;;
13125 *) dflt="$alignbytes"
13126 ;;
13127 esac
13128 rp="Doubles must be aligned on a how-many-byte boundary?"
13129 . ./myread
13130 alignbytes="$ans"
13131 $rm -f try.c try
13132 ;;
13133esac
13134
13135
13136: set the base revision
13137baserev=5.0
13138
b4eb6b3d
JH
13139: how do we catenate cpp tokens here?
13140echo " "
13141echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
13142$cat >cpp_stuff.c <<'EOCP'
13143#define RCAT(a,b)a/**/b
13144#define ACAT(a,b)a ## b
13145RCAT(Rei,ser)
13146ACAT(Cir,cus)
13147EOCP
13148$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
13149if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
13150 echo "Oh! Smells like ANSI's been here." >&4
13151 echo "We can catify or stringify, separately or together!"
13152 cpp_stuff=42
13153elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
13154 echo "Ah, yes! The good old days!" >&4
13155 echo "However, in the good old days we don't know how to stringify and"
13156 echo "catify at the same time."
13157 cpp_stuff=1
13158else
13159 $cat >&4 <<EOM
13160Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
13161to have to edit the values of CAT[2-5] in config.h...
13162EOM
13163 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
13164fi
13165$rm -f cpp_stuff.*
13166
13167: see if this is a db.h system
13168set db.h i_db
13169eval $inhdr
13170
13171case "$i_db" in
13172$define)
13173 : Check db version.
13174 echo " "
13175 echo "Checking Berkeley DB version ..." >&4
13176 $cat >try.c <<EOCP
13177#$d_const HASCONST
13178#ifndef HASCONST
13179#define const
13180#endif
13181#include <sys/types.h>
13182#include <stdio.h>
13183#include <db.h>
640374d0 13184int main(int argc, char *argv[])
b4eb6b3d
JH
13185{
13186#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
13187 int Major, Minor, Patch ;
13188 unsigned long Version ;
13189 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
13190 if (argc == 2) {
13191 printf("%d %d %d %d %d %d\n",
13192 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
13193 Major, Minor, Patch);
13194 exit(0);
13195 }
13196 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
13197
13198 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13199 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13200 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13201 Major, Minor, Patch) ;
13202
13203 /* check that db.h & libdb are compatible */
13204 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 13205 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
13206 exit(3);
13207 }
13208
640374d0 13209 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
13210
13211 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13212 + DB_VERSION_PATCH ;
13213
13214 /* needs to be >= 2.3.4 */
13215 if (Version < 2003004) {
13216 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 13217 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
13218 exit(2);
13219 }
13220
13221 exit(0);
13222#else
13223#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
13224 if (argc == 2) {
13225 printf("1 0 0\n");
13226 exit(0);
13227 }
13228 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
13229 exit(0); /* DB version < 2: the coast is clear. */
13230#else
13231 exit(1); /* <db.h> not Berkeley DB? */
13232#endif
13233#endif
13234}
13235EOCP
13236 set try
13237 if eval $compile_ok && ./try; then
13238 echo 'Looks OK.' >&4
640374d0
JH
13239 set `./try 1`
13240 db_version_major=$1
13241 db_version_minor=$2
13242 db_version_patch=$3
b4eb6b3d
JH
13243 else
13244 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
13245 i_db=$undef
13246 case " $libs " in
13247 *"-ldb "*)
13248 : Remove db from list of libraries to use
13249 echo "Removing unusable -ldb from library list" >&4
13250 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13251 shift
13252 libs="$*"
13253 echo "libs = $libs" >&4
13254 ;;
13255 esac
13256 fi
13257 $rm -f try.*
13258 ;;
13259esac
13260
13261case "$i_db" in
13262define)
13263 : Check the return type needed for hash
13264 echo " "
13265 echo "Checking return type needed for hash for Berkeley DB ..." >&4
13266 $cat >try.c <<EOCP
13267#$d_const HASCONST
13268#ifndef HASCONST
13269#define const
13270#endif
13271#include <sys/types.h>
13272#include <db.h>
13273
13274#ifndef DB_VERSION_MAJOR
13275u_int32_t hash_cb (ptr, size)
13276const void *ptr;
13277size_t size;
13278{
13279}
13280HASHINFO info;
13281int main()
13282{
13283 info.hash = hash_cb;
13284}
13285#endif
13286EOCP
13287 if $cc $ccflags -c try.c >try.out 2>&1 ; then
13288 if $contains warning try.out >>/dev/null 2>&1 ; then
13289 db_hashtype='int'
13290 else
13291 db_hashtype='u_int32_t'
13292 fi
13293 else
13294 : XXX Maybe we should just give up here.
13295 db_hashtype=u_int32_t
13296 $cat try.out >&4
13297 echo "Help: I can't seem to compile the db test program." >&4
13298 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13299 fi
13300 $rm -f try.*
13301 echo "Your version of Berkeley DB uses $db_hashtype for hash."
13302 ;;
13303*) db_hashtype=u_int32_t
13304 ;;
13305esac
13306case "$i_db" in
13307define)
13308 : Check the return type needed for prefix
13309 echo " "
13310 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13311 cat >try.c <<EOCP
13312#$d_const HASCONST
13313#ifndef HASCONST
13314#define const
13315#endif
13316#include <sys/types.h>
13317#include <db.h>
13318
13319#ifndef DB_VERSION_MAJOR
13320size_t prefix_cb (key1, key2)
13321const DBT *key1;
13322const DBT *key2;
13323{
13324}
13325BTREEINFO info;
13326int main()
13327{
13328 info.prefix = prefix_cb;
13329}
13330#endif
13331EOCP
13332 if $cc $ccflags -c try.c >try.out 2>&1 ; then
13333 if $contains warning try.out >>/dev/null 2>&1 ; then
13334 db_prefixtype='int'
13335 else
13336 db_prefixtype='size_t'
13337 fi
13338 else
13339 db_prefixtype='size_t'
13340 : XXX Maybe we should just give up here.
13341 $cat try.out >&4
13342 echo "Help: I can't seem to compile the db test program." >&4
13343 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13344 fi
13345 $rm -f try.*
13346 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13347 ;;
13348*) db_prefixtype='size_t'
13349 ;;
13350esac
13351
b4eb6b3d
JH
13352
13353: How can we generate normalized random numbers ?
13354echo " "
13355echo "Looking for a random number function..." >&4
13356case "$randfunc" in
13357'')
13358 if set drand48 val -f; eval $csym; $val; then
13359 dflt="drand48"
13360 echo "Good, found drand48()." >&4
13361 elif set random val -f; eval $csym; $val; then
13362 dflt="random"
13363 echo "OK, found random()." >&4
13364 else
13365 dflt="rand"
13366 echo "Yick, looks like I have to use rand()." >&4
13367 fi
13368 echo " "
13369 ;;
13370*)
13371 dflt="$randfunc"
13372 ;;
13373esac
13374cont=true
13375
13376case "$ccflags" in
13377*-Dmy_rand=*|*-Dmy_srand=*)
13378 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13379 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13380 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13381 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13382 ;;
13383esac
13384
13385while $test "$cont"; do
13386 rp="Use which function to generate random numbers?"
13387 . ./myread
13388 if $test "$ans" = "$dflt"; then
13389 : null
13390 else
13391 randbits=''
13392 fi
13393 randfunc="$ans"
13394 if set $ans val -f; eval $csym; $val; then
13395 cont=''
13396 else
13397 dflt=y
13398 rp="I cannot find function $ans. Use that name anyway?"
13399 . ./myread
13400 dflt=rand
13401 case "$ans" in
13402 [yY]*) cont='';;
13403 esac
13404 fi
13405 case "$cont" in
13406 '')
13407 case "$randfunc" in
13408 drand48)
13409 drand01="drand48()"
13410 seedfunc="srand48"
13411 randbits=48
13412 randseedtype=long
13413 ;;
13414 rand|random)
13415 case "$randbits" in
13416 '')
13417echo "Checking to see how many bits your $randfunc() function produces..." >&4
13418 $cat >try.c <<EOCP
13419#$i_unistd I_UNISTD
13420#$i_stdlib I_STDLIB
13421#include <stdio.h>
13422#ifdef I_UNISTD
13423# include <unistd.h>
13424#endif
13425#ifdef I_STDLIB
13426# include <stdlib.h>
13427#endif
13428int main()
13429{
13430 register int i;
13431 register unsigned long tmp;
13432 register unsigned long max = 0L;
13433
13434 for (i = 1000; i; i--) {
13435 tmp = (unsigned long) $randfunc();
13436 if (tmp > max) max = tmp;
13437 }
13438 for (i = 0; max; i++)
13439 max /= 2;
13440 printf("%d\n",i);
13441}
13442EOCP
13443 set try
13444 if eval $compile_ok; then
13445 dflt=`try`
13446 else
13447 dflt='?'
13448 echo "(I can't seem to compile the test program...)"
13449 fi
13450 ;;
13451 *)
13452 dflt="$randbits"
13453 ;;
13454 esac
13455 rp="How many bits does your $randfunc() function produce?"
13456 . ./myread
13457 randbits="$ans"
13458 $rm -f try.c try
13459 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13460 seedfunc="s$randfunc"
13461 randseedtype=unsigned
13462 ;;
13463 *)
13464 dflt="31"
13465 rp="How many bits does your $randfunc() function produce?"
13466 . ./myread
13467 randbits="$ans"
13468 seedfunc="s$randfunc"
13469 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13470 if set $seedfunc val -f; eval $csym; $val; then
13471 echo "(Using $seedfunc() to seed random generator)"
13472 else
13473 echo "(Warning: no $seedfunc() to seed random generator)"
13474 seedfunc=rand
13475 fi
13476 randseedtype=unsigned
13477 ;;
13478 esac
13479 ;;
13480 esac
13481done
13482
13483echo " "
13484echo "Determining whether or not we are on an EBCDIC system..." >&4
13485$cat >tebcdic.c <<'EOM'
13486int main()
13487{
13488 if ('M'==0xd4) return 0;
13489 return 1;
13490}
13491EOM
13492
13493val=$undef
13494set tebcdic
13495if eval $compile_ok; then
13496 if ./tebcdic; then
13497 echo "You seem to speak EBCDIC." >&4
13498 val="$define"
13499 else
13500 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13501 fi
13502else
13503 echo "I'm unable to compile the test program." >&4
13504 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13505fi
13506$rm -f tebcdic.c tebcdic
13507set ebcdic
13508eval $setvar
13509
13510echo " "
13511$cat >&4 <<EOM
13512Checking how to flush all pending stdio output...
13513EOM
13514# I only know how to find the first 32 possibly open files on SunOS.
13515# See also hints/sunos_4_1.sh and util.c --AD
13516case "$osname" in
13517sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13518esac
13519$cat >>try.c <<EOCP
13520#include <stdio.h>
13521#$i_unistd I_UNISTD
13522#ifdef I_UNISTD
13523# include <unistd.h>
13524#endif
13525#$d_sysconf HAS_SYSCONF
13526#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13527#ifdef HAS_STDIO_STREAM_ARRAY
13528# define STDIO_STREAM_ARRAY $stdio_stream_array
13529#endif
13530int main() {
13531 FILE* p = fopen("try.out", "w");
13532#ifdef TRY_FPUTC
13533 fputc('x', p);
13534#else
13535# ifdef TRY_FPRINTF
13536 fprintf(p, "x");
13537# endif
13538#endif
13539#ifdef TRY_FFLUSH_NULL
13540 fflush(NULL);
13541#endif
13542#ifdef TRY_FFLUSH_ALL
13543 {
13544 long open_max = -1;
13545# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13546 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13547# else
13548# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13549 open_max = sysconf(_SC_OPEN_MAX);
13550# else
13551# ifdef FOPEN_MAX
13552 open_max = FOPEN_MAX;
13553# else
13554# ifdef OPEN_MAX
13555 open_max = OPEN_MAX;
13556# else
13557# ifdef _NFILE
13558 open_max = _NFILE;
13559# endif
13560# endif
13561# endif
13562# endif
13563# endif
13564# ifdef HAS_STDIO_STREAM_ARRAY
13565 if (open_max > 0) {
13566 long i;
13567 for (i = 0; i < open_max; i++)
13568 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13569 STDIO_STREAM_ARRAY[i]._file < open_max &&
13570 STDIO_STREAM_ARRAY[i]._flag)
13571 fflush(&STDIO_STREAM_ARRAY[i]);
13572 }
13573 }
13574# endif
13575#endif
13576 _exit(42);
13577}
13578EOCP
13579: first we have to find out how _not_ to flush
13580if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13581 output=''
13582 set try -DTRY_FPUTC
13583 if eval $compile; then
13584 $rm -f try.out
13585 ./try$exe_ext 2>/dev/null
13586 if $test ! -s try.out -a "X$?" = X42; then
13587 output=-DTRY_FPUTC
13588 fi
13589 fi
13590 case "$output" in
13591 '')
13592 set try -DTRY_FPRINTF
13593 $rm -f try.out
13594 if eval $compile; then
13595 $rm -f try.out
13596 ./try$exe_ext 2>/dev/null
13597 if $test ! -s try.out -a "X$?" = X42; then
13598 output=-DTRY_FPRINTF
13599 fi
13600 fi
13601 ;;
13602 esac
13603fi
13604: check for fflush NULL behaviour
13605case "$fflushNULL" in
13606'') set try -DTRY_FFLUSH_NULL $output
13607 if eval $compile; then
13608 $rm -f try.out
13609 ./try$exe_ext 2>/dev/null
13610 code="$?"
13611 if $test -s try.out -a "X$code" = X42; then
13612 fflushNULL="`$cat try.out`"
13613 else
13614 if $test "X$code" != X42; then
13615 $cat >&4 <<EOM
13616(If this test failed, don't worry, we'll try another method shortly.)
13617EOM
13618 fi
13619 fi
13620 fi
13621 $rm -f core try.core core.try.*
13622 case "$fflushNULL" in
13623 x) $cat >&4 <<EOM
13624Your fflush(NULL) works okay for output streams.
13625Let's see if it clobbers input pipes...
13626EOM
13627# As of mid-March 2000 all versions of Solaris appear to have a stdio
13628# bug that improperly flushes the input end of pipes. So we avoid the
13629# autoflush on fork/system/exec support for now. :-(
13630$cat >tryp.c <<EOCP
13631#include <stdio.h>
13632int
13633main(int argc, char **argv)
13634{
13635 char buf[1024];
13636 int i;
13637 char *bp = buf;
13638 while (1) {
13639 while ((i = getc(stdin)) != -1
13640 && (*bp++ = i) != '\n'
13641 && bp < &buf[1024])
13642 /* DO NOTHING */ ;
13643 *bp = '\0';
13644 fprintf(stdout, "%s", buf);
13645 fflush(NULL);
13646 if (i == -1)
13647 return 0;
13648 bp = buf;
13649 }
13650}
13651EOCP
13652 fflushNULL="$define"
13653 set tryp
13654 if eval $compile; then
13655 $rm -f tryp.out
13656 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13657 if cmp tryp.c tryp.out >/dev/null 2>&1; then
13658 $cat >&4 <<EOM
13659fflush(NULL) seems to behave okay with input streams.
13660EOM
13661 fflushNULL="$define"
13662 else
13663 $cat >&4 <<EOM
13664Ouch, fflush(NULL) clobbers input pipes! We will not use it.
13665EOM
13666 fflushNULL="$undef"
13667 fi
13668 fi
13669 $rm -f core tryp.c tryp.core core.tryp.*
13670 ;;
13671 '') $cat >&4 <<EOM
13672Your fflush(NULL) isn't working (contrary to ANSI C).
13673EOM
13674 fflushNULL="$undef"
13675 ;;
13676 *) $cat >&4 <<EOM
13677Cannot figure out whether your fflush(NULL) works or not.
13678I'm assuming it doesn't (contrary to ANSI C).
13679EOM
13680 fflushNULL="$undef"
13681 ;;
13682 esac
13683 ;;
13684$define|true|[yY]*)
13685 fflushNULL="$define"
13686 ;;
13687*)
13688 fflushNULL="$undef"
13689 ;;
13690esac
13691: check explicit looping only if NULL did not work, and if the pipe
13692: bug does not show up on an explicit flush too
13693case "$fflushNULL" in
13694"$undef")
13695 $cat >tryp.c <<EOCP
13696#include <stdio.h>
13697int
13698main(int argc, char **argv)
13699{
13700 char buf[1024];
13701 int i;
13702 char *bp = buf;
13703 while (1) {
13704 while ((i = getc(stdin)) != -1
13705 && (*bp++ = i) != '\n'
13706 && bp < &buf[1024])
13707 /* DO NOTHING */ ;
13708 *bp = '\0';
13709 fprintf(stdout, "%s", buf);
13710 fflush(stdin);
13711 if (i == -1)
13712 return 0;
13713 bp = buf;
13714 }
13715}
13716EOCP
13717 set tryp
13718 if eval $compile; then
13719 $rm -f tryp.out
13720 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13721 if cmp tryp.c tryp.out >/dev/null 2>&1; then
13722 $cat >&4 <<EOM
13723Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13724EOM
13725 : now check for fflushall behaviour
13726 case "$fflushall" in
13727 '') set try -DTRY_FFLUSH_ALL $output
13728 if eval $compile; then
13729 $cat >&4 <<EOM
13730(Now testing the other method--but note that this also may fail.)
13731EOM
13732 $rm -f try.out
13733 ./try$exe_ext 2>/dev/null
13734 if $test -s try.out -a "X$?" = X42; then
13735 fflushall="`$cat try.out`"
13736 fi
13737 fi
13738 $rm -f core try.core core.try.*
13739 case "$fflushall" in
13740 x) $cat >&4 <<EOM
13741Whew. Flushing explicitly all the stdio streams works.
13742EOM
13743 fflushall="$define"
13744 ;;
13745 '') $cat >&4 <<EOM
13746Sigh. Flushing explicitly all the stdio streams doesn't work.
13747EOM
13748 fflushall="$undef"
13749 ;;
13750 *) $cat >&4 <<EOM
13751Cannot figure out whether flushing stdio streams explicitly works or not.
13752I'm assuming it doesn't.
13753EOM
13754 fflushall="$undef"
13755 ;;
13756 esac
13757 ;;
13758 "$define"|true|[yY]*)
13759 fflushall="$define"
13760 ;;
13761 *)
13762 fflushall="$undef"
13763 ;;
13764 esac
13765 else
13766 $cat >&4 <<EOM
13767All is futile. Even fflush(stdin) clobbers input pipes!
13768EOM
13769 fflushall="$undef"
13770 fi
13771 else
13772 fflushall="$undef"
13773 fi
13774 $rm -f core tryp.c tryp.core core.tryp.*
13775 ;;
13776*) fflushall="$undef"
13777 ;;
13778esac
13779
13780case "$fflushNULL$fflushall" in
13781undefundef)
13782 $cat <<EOM
13783OK, I give up. I cannot figure out how to flush pending stdio output.
13784We won't be flushing handles at all before fork/exec/popen.
13785EOM
13786 ;;
13787esac
13788$rm -f try.* try$exe_ext
13789
13790: Store the full pathname to the ar program for use in the C program
13791: Respect a hint or command line value for full_ar.
13792case "$full_ar" in
13793'') full_ar=$ar ;;
13794esac
13795
13796: Store the full pathname to the sed program for use in the C program
13797full_sed=$sed
13798
13799: see what type gids are declared as in the kernel
13800echo " "
13801echo "Looking for the type for group ids returned by getgid()."
13802set gid_t gidtype xxx stdio.h sys/types.h
13803eval $typedef
13804case "$gidtype" in
13805xxx)
13806 xxx=`./findhdr sys/user.h`
13807 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13808 case $1 in
13809 unsigned) dflt="$1 $2" ;;
13810 *) dflt="$1" ;;
13811 esac
13812 ;;
13813*) dflt="$gidtype";;
13814esac
13815case "$gidtype" in
13816gid_t) echo "gid_t found." ;;
13817*) rp="What is the type for group ids returned by getgid()?"
13818 . ./myread
13819 gidtype="$ans"
13820 ;;
13821esac
13822
13823echo " "
13824case "$gidtype" in
13825*_t) zzz="$gidtype" ;;
13826*) zzz="gid" ;;
13827esac
13828echo "Checking the size of $zzz..." >&4
13829cat > try.c <<EOCP
13830#include <sys/types.h>
13831#include <stdio.h>
13832int main() {
13833 printf("%d\n", (int)sizeof($gidtype));
13834 exit(0);
13835}
13836EOCP
13837set try
13838if eval $compile_ok; then
13839 yyy=`./try`
13840 case "$yyy" in
13841 '') gidsize=4
13842 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13843 ;;
13844 *) gidsize=$yyy
13845 echo "Your $zzz is $gidsize bytes long."
13846 ;;
13847 esac
13848else
13849 gidsize=4
13850 echo "(I can't compile the test program--guessing $gidsize.)" >&4
13851fi
13852
13853
13854echo " "
13855case "$gidtype" in
13856*_t) zzz="$gidtype" ;;
13857*) zzz="gid" ;;
13858esac
13859echo "Checking the sign of $zzz..." >&4
13860cat > try.c <<EOCP
13861#include <sys/types.h>
13862#include <stdio.h>
13863int main() {
13864 $gidtype foo = -1;
13865 if (foo < 0)
13866 printf("-1\n");
13867 else
13868 printf("1\n");
13869}
13870EOCP
13871set try
13872if eval $compile; then
13873 yyy=`./try`
13874 case "$yyy" in
13875 '') gidsign=1
13876 echo "(I can't execute the test program--guessing unsigned.)" >&4
13877 ;;
13878 *) gidsign=$yyy
13879 case "$gidsign" in
13880 1) echo "Your $zzz is unsigned." ;;
13881 -1) echo "Your $zzz is signed." ;;
13882 esac
13883 ;;
13884 esac
13885else
13886 gidsign=1
13887 echo "(I can't compile the test program--guessing unsigned.)" >&4
13888fi
13889
13890
13891echo " "
13892
13893if $test X"$quadtype" != X; then
13894
13895echo "Checking how to print 64-bit integers..." >&4
13896
13897if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13898 $cat >try.c <<'EOCP'
13899#include <sys/types.h>
13900#include <stdio.h>
13901int main() {
13902 int q = 12345678901;
13903 printf("%ld\n", q);
13904}
13905EOCP
13906 set try
13907 if eval $compile; then
13908 yyy=`./try$exe_ext`
13909 case "$yyy" in
13910 12345678901)
13911 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13912 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13913 echo "We will use %d."
13914 ;;
13915 esac
13916 fi
13917fi
13918
13919if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13920 $cat >try.c <<'EOCP'
13921#include <sys/types.h>
13922#include <stdio.h>
13923int main() {
13924 long q = 12345678901;
13925 printf("%ld\n", q);
13926}
13927EOCP
13928 set try
13929 if eval $compile; then
13930 yyy=`./try$exe_ext`
13931 case "$yyy" in
13932 12345678901)
13933 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13934 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13935 echo "We will use %ld."
13936 ;;
13937 esac
13938 fi
13939fi
13940
13941if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13942 $cat >try.c <<'EOCP'
13943#include <sys/types.h>
13944#include <inttypes.h>
13945#include <stdio.h>
13946int main() {
13947 int64_t q = 12345678901;
13948 printf("%" PRId64 "\n", q);
13949}
13950EOCP
13951 set try
13952 if eval $compile; then
13953 yyy=`./try$exe_ext`
13954 case "$yyy" in
13955 12345678901)
13956 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13957 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13958 echo "We will use the C9X style."
13959 ;;
13960 esac
13961 fi
13962fi
13963
2ef53570
JH
13964if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13965 $cat >try.c <<EOCP
b4eb6b3d
JH
13966#include <sys/types.h>
13967#include <stdio.h>
13968int main() {
2ef53570
JH
13969 $quadtype q = 12345678901;
13970 printf("%Ld\n", q);
b4eb6b3d
JH
13971}
13972EOCP
13973 set try
13974 if eval $compile; then
13975 yyy=`./try$exe_ext`
13976 case "$yyy" in
13977 12345678901)
2ef53570
JH
13978 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13979 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13980 echo "We will use %Ld."
b4eb6b3d
JH
13981 ;;
13982 esac
13983 fi
13984fi
13985
2ef53570
JH
13986if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13987 $cat >try.c <<'EOCP'
b4eb6b3d
JH
13988#include <sys/types.h>
13989#include <stdio.h>
13990int main() {
2ef53570
JH
13991 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13992 printf("%lld\n", q);
b4eb6b3d
JH
13993}
13994EOCP
13995 set try
13996 if eval $compile; then
13997 yyy=`./try$exe_ext`
13998 case "$yyy" in
13999 12345678901)
2ef53570
JH
14000 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
14001 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
14002 echo "We will use the %lld style."
b4eb6b3d
JH
14003 ;;
14004 esac
14005 fi
14006fi
14007
14008if $test X"$sPRId64" = X -a X"$quadtype" != X; then
14009 $cat >try.c <<EOCP
14010#include <sys/types.h>
14011#include <stdio.h>
14012int main() {
14013 $quadtype q = 12345678901;
14014 printf("%qd\n", q);
14015}
14016EOCP
14017 set try
14018 if eval $compile; then
14019 yyy=`./try$exe_ext`
14020 case "$yyy" in
14021 12345678901)
14022 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
14023 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
14024 echo "We will use %qd."
14025 ;;
14026 esac
14027 fi
14028fi
14029
14030if $test X"$sPRId64" = X; then
14031 echo "Cannot figure out how to print 64-bit integers." >&4
14032fi
14033
14034$rm -f try try.*
14035
14036fi
14037
14038case "$sPRId64" in
14039'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
14040 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
14041 ;;
14042*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
14043 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
14044 ;;
14045esac
14046
14047
14048echo " "
14049$echo "Checking the format strings to be used for Perl's internal types..." >&4
14050
14051if $test X"$ivsize" = X8; then
14052 ivdformat="$sPRId64"
14053 uvuformat="$sPRIu64"
14054 uvoformat="$sPRIo64"
14055 uvxformat="$sPRIx64"
14056 uvXUformat="$sPRIXU64"
14057else
14058 if $test X"$ivsize" = X"$longsize"; then
14059 ivdformat='"ld"'
14060 uvuformat='"lu"'
14061 uvoformat='"lo"'
14062 uvxformat='"lx"'
14063 uvXUformat='"lX"'
14064 else
14065 if $test X"$ivsize" = X"$intsize"; then
14066 ivdformat='"d"'
14067 uvuformat='"u"'
14068 uvoformat='"o"'
14069 uvxformat='"x"'
14070 uvXUformat='"X"'
14071 else
14072 : far out
14073 if $test X"$ivsize" = X"$shortsize"; then
14074 ivdformat='"hd"'
14075 uvuformat='"hu"'
14076 uvoformat='"ho"'
14077 uvxformat='"hx"'
14078 uvXUformat='"hX"'
14079 fi
14080 fi
14081 fi
14082fi
14083
14084if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
14085 nveformat="$sPRIeldbl"
14086 nvfformat="$sPRIfldbl"
14087 nvgformat="$sPRIgldbl"
14088 nvEUformat="$sPRIEUldbl"
14089 nvFUformat="$sPRIFUldbl"
14090 nvGUformat="$sPRIGUldbl"
14091else
14092 nveformat='"e"'
14093 nvfformat='"f"'
14094 nvgformat='"g"'
14095 nvEUformat='"E"'
14096 nvFUformat='"F"'
14097 nvGUformat='"G"'
14098fi
14099
14100case "$ivdformat" in
14101'') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
14102 exit 1
14103 ;;
14104esac
14105
14106
14107echo " "
14108$echo "Checking the format string to be used for gids..." >&4
14109
14110case "$gidsign" in
14111-1) if $test X"$gidsize" = X"$ivsize"; then
14112 gidformat="$ivdformat"
14113 else
14114 if $test X"$gidsize" = X"$longsize"; then
14115 gidformat='"ld"'
14116 else
14117 if $test X"$gidsize" = X"$intsize"; then
14118 gidformat='"d"'
14119 else
14120 if $test X"$gidsize" = X"$shortsize"; then
14121 gidformat='"hd"'
14122 fi
14123 fi
14124 fi
14125 fi
14126 ;;
14127*) if $test X"$gidsize" = X"$uvsize"; then
14128 gidformat="$uvuformat"
14129 else
14130 if $test X"$gidsize" = X"$longsize"; then
14131 gidformat='"lu"'
14132 else
14133 if $test X"$gidsize" = X"$intsize"; then
14134 gidformat='"u"'
14135 else
14136 if $test X"$gidsize" = X"$shortsize"; then
14137 gidformat='"hu"'
14138 fi
14139 fi
14140 fi
14141 fi
14142 ;;
14143esac
14144
14145: see if getgroups exists
14146set getgroups d_getgrps
14147eval $inlibc
14148
14149: see if setgroups exists
14150set setgroups d_setgrps
14151eval $inlibc
14152
14153
14154: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
14155echo " "
14156case "$d_getgrps$d_setgrps" in
14157*define*)
14158 case "$groupstype" in
14159 '') dflt="$gidtype" ;;
14160 *) dflt="$groupstype" ;;
14161 esac
14162 $cat <<EOM
14163What type of pointer is the second argument to getgroups() and setgroups()?
14164Usually this is the same as group ids, $gidtype, but not always.
14165
14166EOM
14167 rp='What type pointer is the second argument to getgroups() and setgroups()?'
14168 . ./myread
14169 groupstype="$ans"
14170 ;;
14171*) groupstype="$gidtype";;
14172esac
14173
14174echo " "
14175echo "Checking if your $make program sets \$(MAKE)..." >&4
14176case "$make_set_make" in
14177'')
14178 $sed 's/^X //' > testmake.mak << 'EOF'
14179Xall:
14180X @echo 'maketemp="$(MAKE)"'
14181EOF
14182 case "`$make -f testmake.mak 2>/dev/null`" in
14183 *maketemp=*) make_set_make='#' ;;
14184 *) make_set_make="MAKE=$make" ;;
14185 esac
14186 $rm -f testmake.mak
14187 ;;
14188esac
14189case "$make_set_make" in
14190'#') echo "Yup, it does.";;
14191*) echo "Nope, it doesn't.";;
14192esac
14193
14194: see what type is used for mode_t
14195rp="What is the type used for file modes for system calls (e.g. fchmod())?"
14196set mode_t modetype int stdio.h sys/types.h
14197eval $typedef_ask
14198
2cc61e15
DD
14199: see if stdarg is available
14200echo " "
14201if $test `./findhdr stdarg.h`; then
14202 echo "<stdarg.h> found." >&4
14203 valstd="$define"
14204else
14205 echo "<stdarg.h> NOT found." >&4
14206 valstd="$undef"
14207fi
14208
14209: see if varags is available
14210echo " "
14211if $test `./findhdr varargs.h`; then
14212 echo "<varargs.h> found." >&4
14213else
14214 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14215fi
14216
14217: set up the varargs testing programs
14218$cat > varargs.c <<EOP
14219#ifdef I_STDARG
14220#include <stdarg.h>
14221#endif
14222#ifdef I_VARARGS
14223#include <varargs.h>
14224#endif
14225
14226#ifdef I_STDARG
14227int f(char *p, ...)
14228#else
14229int f(va_alist)
14230va_dcl
14231#endif
14232{
14233 va_list ap;
14234#ifndef I_STDARG
14235 char *p;
14236#endif
14237#ifdef I_STDARG
14238 va_start(ap,p);
14239#else
14240 va_start(ap);
14241 p = va_arg(ap, char *);
14242#endif
14243 va_end(ap);
14244}
14245EOP
14246$cat > varargs <<EOP
14247$startsh
14248if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14249 echo "true"
14250else
14251 echo "false"
14252fi
14253$rm -f varargs$_o
14254EOP
14255chmod +x varargs
14256
14257: now check which varargs header should be included
14258echo " "
14259i_varhdr=''
14260case "$valstd" in
14261"$define")
14262 if `./varargs I_STDARG`; then
14263 val='stdarg.h'
14264 elif `./varargs I_VARARGS`; then
14265 val='varargs.h'
14266 fi
14267 ;;
14268*)
14269 if `./varargs I_VARARGS`; then
14270 val='varargs.h'
14271 fi
14272 ;;
14273esac
14274case "$val" in
14275'')
14276echo "I could not find the definition for va_dcl... You have problems..." >&4
14277 val="$undef"; set i_stdarg; eval $setvar
14278 val="$undef"; set i_varargs; eval $setvar
14279 ;;
14280*)
14281 set i_varhdr
14282 eval $setvar
14283 case "$i_varhdr" in
14284 stdarg.h)
14285 val="$define"; set i_stdarg; eval $setvar
14286 val="$undef"; set i_varargs; eval $setvar
14287 ;;
14288 varargs.h)
14289 val="$undef"; set i_stdarg; eval $setvar
14290 val="$define"; set i_varargs; eval $setvar
14291 ;;
14292 esac
14293 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14294esac
14295$rm -f varargs*
14296
14297: see if we need va_copy
14298echo " "
14299case "$i_stdarg" in
14300"$define")
14301 $cat >try.c <<EOCP
14302#include <stdarg.h>
14303#include <stdio.h>
85c8a686
DD
14304#$i_stdlib I_STDLIB
14305#ifdef I_STDLIB
14306#include <stdlib.h>
14307#endif
14308#include <signal.h>
2cc61e15
DD
14309
14310int
14311ivfprintf(FILE *f, const char *fmt, va_list *valp)
14312{
14313 return vfprintf(f, fmt, *valp);
14314}
14315
14316int
14317myvfprintf(FILE *f, const char *fmt, va_list val)
14318{
14319 return ivfprintf(f, fmt, &val);
14320}
14321
14322int
14323myprintf(char *fmt, ...)
14324{
14325 va_list val;
14326 va_start(val, fmt);
14327 return myvfprintf(stdout, fmt, val);
14328}
14329
14330int
14331main(int ac, char **av)
14332{
85c8a686
DD
14333 signal(SIGSEGV, exit);
14334
2cc61e15
DD
14335 myprintf("%s%cs all right, then\n", "that", '\'');
14336 exit(0);
14337}
14338EOCP
14339 set try
d50de4df 14340 if eval $compile && ./try 2>&1 >/dev/null; then
2cc61e15
DD
14341 case "`./try`" in
14342 "that's all right, then")
14343 okay=yes
14344 ;;
14345 esac
14346 fi
14347 case "$okay" in
14348 yes) echo "It seems that you don't need va_copy()." >&4
14349 need_va_copy="$undef"
14350 ;;
14351 *) echo "It seems that va_copy() or similar will be needed." >&4
14352 need_va_copy="$define"
14353 ;;
14354 esac
14355 $rm -f try.* core core.* *.core *.core.*
14356 ;;
14357*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14358 ;;
14359esac
14360
b4eb6b3d
JH
14361: define a fucntion to check prototypes
14362$cat > protochk <<EOSH
14363$startsh
14364cc="$cc"
14365optimize="$optimize"
14366ccflags="$ccflags"
14367prototype="$prototype"
14368define="$define"
14369rm=$rm
14370EOSH
14371
14372$cat >> protochk <<'EOSH'
14373
14374$rm -f try.c
14375foo="$1"
14376shift
14377while test $# -ge 2; do
14378 case "$1" in
14379 $define) echo "#include <$2>" >> try.c ;;
14380 literal) echo "$2" >> try.c ;;
14381 esac
14382 shift 2
14383done
14384test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
14385cat >> try.c <<'EOCP'
14386#ifdef CAN_PROTOTYPE
14387#define _(args) args
14388#else
14389#define _(args) ()
14390#endif
14391EOCP
14392echo "$foo" >> try.c
14393echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14394$cc $optimize $ccflags -c try.c > /dev/null 2>&1
14395status=$?
14396$rm -f try.[co]
14397exit $status
14398EOSH
14399chmod +x protochk
14400$eunicefix protochk
14401
14402: see what type is used for size_t
14403rp="What is the type used for the length parameter for string functions?"
14404set size_t sizetype 'unsigned int' stdio.h sys/types.h
14405eval $typedef_ask
14406
14407: check for type of arguments to gethostbyaddr.
14408if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14409 case "$d_gethbyaddr" in
14410 $define)
14411 $cat <<EOM
14412
14413Checking to see what type of arguments are accepted by gethostbyaddr().
14414EOM
14415 hdrs="$define sys/types.h
14416 $d_socket sys/socket.h
14417 $i_niin netinet/in.h
14418 $i_netdb netdb.h
14419 $i_unistd unistd.h"
14420 : The first arg can 'char *' or 'void *'
14421 : The second arg is some of integral type
14422 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14423 for yyy in size_t long int; do
14424 case "$netdb_host_type" in
14425 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14426 if ./protochk "$try" $hdrs; then
14427 echo "Your system accepts $xxx for the first arg."
14428 echo "...and $yyy for the second arg."
14429 netdb_host_type="$xxx"
14430 netdb_hlen_type="$yyy"
14431 fi
14432 ;;
14433 esac
14434 done
14435 done
14436 : In case none of those worked, prompt the user.
14437 case "$netdb_host_type" in
14438 '') rp='What is the type for the 1st argument to gethostbyaddr?'
14439 dflt='char *'
14440 . ./myread
14441 netdb_host_type=$ans
14442 rp='What is the type for the 2nd argument to gethostbyaddr?'
14443 dflt="$sizetype"
14444 . ./myread
14445 netdb_hlen_type=$ans
14446 ;;
14447 esac
14448 ;;
14449 *) : no gethostbyaddr, so pick harmless defaults
14450 netdb_host_type='char *'
14451 netdb_hlen_type="$sizetype"
14452 ;;
14453 esac
14454 # Remove the "const" if needed. -- but then we'll have a
14455 # prototype clash!
14456 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14457fi
14458
14459: check for type of argument to gethostbyname.
14460if test "X$netdb_name_type" = X ; then
14461 case "$d_gethbyname" in
14462 $define)
14463 $cat <<EOM
14464
14465Checking to see what type of argument is accepted by gethostbyname().
14466EOM
14467 hdrs="$define sys/types.h
14468 $d_socket sys/socket.h
14469 $i_niin netinet/in.h
14470 $i_netdb netdb.h
14471 $i_unistd unistd.h"
14472 for xxx in "const char *" "char *"; do
14473 case "$netdb_name_type" in
14474 '') try="extern struct hostent *gethostbyname($xxx);"
14475 if ./protochk "$try" $hdrs; then
14476 echo "Your system accepts $xxx."
14477 netdb_name_type="$xxx"
14478 fi
14479 ;;
14480 esac
14481 done
14482 : In case none of those worked, prompt the user.
14483 case "$netdb_name_type" in
14484 '') rp='What is the type for the 1st argument to gethostbyname?'
14485 dflt='char *'
14486 . ./myread
14487 netdb_name_type=$ans
14488 ;;
14489 esac
14490 ;;
14491 *) : no gethostbyname, so pick harmless default
14492 netdb_name_type='char *'
14493 ;;
14494 esac
14495fi
14496
14497: check for type of 1st argument to getnetbyaddr.
14498if test "X$netdb_net_type" = X ; then
14499 case "$d_getnbyaddr" in
14500 $define)
14501 $cat <<EOM
14502
14503Checking to see what type of 1st argument is accepted by getnetbyaddr().
14504EOM
14505 hdrs="$define sys/types.h
14506 $d_socket sys/socket.h
14507 $i_niin netinet/in.h
14508 $i_netdb netdb.h
14509 $i_unistd unistd.h"
14510 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14511 case "$netdb_net_type" in
14512 '') try="extern struct netent *getnetbyaddr($xxx, int);"
14513 if ./protochk "$try" $hdrs; then
14514 echo "Your system accepts $xxx."
14515 netdb_net_type="$xxx"
14516 fi
14517 ;;
14518 esac
14519 done
14520 : In case none of those worked, prompt the user.
14521 case "$netdb_net_type" in
14522 '') rp='What is the type for the 1st argument to getnetbyaddr?'
14523 dflt='long'
14524 . ./myread
14525 netdb_net_type=$ans
14526 ;;
14527 esac
14528 ;;
14529 *) : no getnetbyaddr, so pick harmless default
14530 netdb_net_type='long'
14531 ;;
14532 esac
14533fi
14534: locate the preferred pager for this system
14535case "$pager" in
14536'')
14537 dflt=''
14538 case "$pg" in
14539 /*) dflt=$pg;;
14540 [a-zA-Z]:/*) dflt=$pg;;
14541 esac
14542 case "$more" in
14543 /*) dflt=$more;;
14544 [a-zA-Z]:/*) dflt=$more;;
14545 esac
14546 case "$less" in
14547 /*) dflt=$less;;
14548 [a-zA-Z]:/*) dflt=$less;;
14549 esac
14550 case "$dflt" in
14551 '') dflt=/usr/ucb/more;;
14552 esac
14553 ;;
14554*) dflt="$pager";;
14555esac
14556echo " "
14557fn=f/
14558rp='What pager is used on your system?'
14559. ./getfile
14560pager="$ans"
14561
14562: see what type pids are declared as in the kernel
14563rp="What is the type of process ids on this system?"
14564set pid_t pidtype int stdio.h sys/types.h
14565eval $typedef_ask
14566
14567: Find earliest binary compatible site_perl subdirectory perl can use.
14568case "$bincompat5005" in
14569"$define") xs_apiversion='5.005' ;;
14570*) xs_apiversion=$version ;; # The current site_perl version.
14571esac
14572: Find earliest pure perl site_perl subdirectory perl can use.
14573: The versioned directories started at 5.005.
14574pm_apiversion='5.005'
14575
b4eb6b3d
JH
14576: see if ar generates random libraries by itself
14577echo " "
14578echo "Checking how to generate random libraries on your machine..." >&4
14579echo 'int bar1() { return bar2(); }' > bar1.c
14580echo 'int bar2() { return 2; }' > bar2.c
14581$cat > foo.c <<'EOP'
14582int main() { printf("%d\n", bar1()); exit(0); }
14583EOP
14584$cc $ccflags -c bar1.c >/dev/null 2>&1
14585$cc $ccflags -c bar2.c >/dev/null 2>&1
14586$cc $ccflags -c foo.c >/dev/null 2>&1
14587$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 14588if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
b4eb6b3d
JH
14589 ./foobar >/dev/null 2>&1; then
14590 echo "$ar appears to generate random libraries itself."
14591 orderlib=false
14592 ranlib=":"
14593elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 14594 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
b4eb6b3d
JH
14595 ./foobar >/dev/null 2>&1; then
14596 echo "a table of contents needs to be added with '$ar ts'."
14597 orderlib=false
14598 ranlib="$ar ts"
14599else
14600 case "$ranlib" in
14601 :) ranlib='';;
14602 '')
14603 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14604 $test -f $ranlib || ranlib=''
14605 ;;
14606 esac
14607 if $test -n "$ranlib"; then
14608 echo "your system has '$ranlib'; we'll use that."
14609 orderlib=false
14610 else
14611 echo "your system doesn't seem to support random libraries"
14612 echo "so we'll use lorder and tsort to order the libraries."
14613 orderlib=true
14614 ranlib=":"
14615 fi
14616fi
14617$rm -f foo* bar*
14618
14619: check for type of arguments to select.
14620case "$selecttype" in
14621'') case "$d_select" in
14622 $define)
14623 echo " "
14624 $cat <<EOM
14625Checking to see what type of arguments are accepted by select().
14626EOM
14627 hdrs="$define sys/types.h
14628 $i_systime sys/time.h
14629 $i_sysselct sys/select.h
14630 $d_socket sys/socket.h"
14631 : The first arg can be int, unsigned, or size_t
14632 : The last arg may or may not be 'const'
14633 val=''
14634 : void pointer has been seen but using that
14635 : breaks the selectminbits test
14636 for xxx in 'fd_set *' 'int *'; do
14637 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14638 for tmo in 'struct timeval *' 'const struct timeval *'; do
14639 case "$val" in
14640 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14641 if ./protochk "$try" $hdrs; then
14642 echo "Your system accepts $xxx."
14643 val="$xxx"
14644 fi
14645 ;;
14646 esac
14647 done
14648 done
14649 done
14650 case "$val" in
14651 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14652 case "$d_fd_set" in
14653 $define) dflt="fd_set *" ;;
14654 *) dflt="int *" ;;
14655 esac
14656 . ./myread
14657 val=$ans
14658 ;;
14659 esac
14660 selecttype="$val"
14661 ;;
14662 *) : no select, so pick a harmless default
14663 selecttype='int *'
14664 ;;
14665 esac
14666 ;;
14667esac
14668
14669: check for the select 'width'
14670case "$selectminbits" in
14671'') case "$d_select" in
14672 $define)
14673 $cat <<EOM
14674
14675Checking to see on how many bits at a time your select() operates...
14676EOM
14677 $cat >try.c <<EOCP
14678#include <sys/types.h>
14679#$i_time I_TIME
14680#$i_systime I_SYS_TIME
14681#$i_systimek I_SYS_TIME_KERNEL
14682#ifdef I_TIME
14683# include <time.h>
14684#endif
14685#ifdef I_SYS_TIME
14686# ifdef I_SYS_TIME_KERNEL
14687# define KERNEL
14688# endif
14689# include <sys/time.h>
14690# ifdef I_SYS_TIME_KERNEL
14691# undef KERNEL
14692# endif
14693#endif
14694#$i_sysselct I_SYS_SELECT
14695#ifdef I_SYS_SELECT
14696#include <sys/select.h>
14697#endif
14698#$d_socket HAS_SOCKET
14699#ifdef HAS_SOCKET
14700# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14701#endif
14702#include <stdio.h>
14703$selecttype b;
14704#define S sizeof(*(b))
14705#define MINBITS 64
14706#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14707#define NBITS (NBYTES * 8)
14708int main() {
14709 char s[NBYTES];
14710 struct timeval t;
14711 int i;
14712 FILE* fp;
14713 int fd;
14714
14715 fclose(stdin);
14716 fp = fopen("try.c", "r");
14717 if (fp == 0)
14718 exit(1);
14719 fd = fileno(fp);
14720 if (fd < 0)
14721 exit(2);
14722 b = ($selecttype)s;
14723 for (i = 0; i < NBITS; i++)
14724 FD_SET(i, b);
14725 t.tv_sec = 0;
14726 t.tv_usec = 0;
14727 select(fd + 1, b, 0, 0, &t);
14728 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14729 printf("%d\n", i + 1);
14730 return 0;
14731}
14732EOCP
14733 set try
14734 if eval $compile_ok; then
14735 selectminbits=`./try`
14736 case "$selectminbits" in
14737 '') cat >&4 <<EOM
14738Cannot figure out on how many bits at a time your select() operates.
14739I'll play safe and guess it is 32 bits.
14740EOM
14741 selectminbits=32
14742 bits="32 bits"
14743 ;;
14744 1) bits="1 bit" ;;
14745 *) bits="$selectminbits bits" ;;
14746 esac
14747 echo "Your select() operates on $bits at a time." >&4
14748 else
14749 rp='What is the minimum number of bits your select() operates on?'
14750 case "$byteorder" in
14751 1234|12345678) dflt=32 ;;
14752 *) dflt=1 ;;
14753 esac
14754 . ./myread
14755 val=$ans
14756 selectminbits="$val"
14757 fi
14758 $rm -f try.* try
14759 ;;
14760 *) : no select, so pick a harmless default
14761 selectminbits='32'
14762 ;;
14763 esac
14764 ;;
14765esac
14766
14767: Trace out the files included by signal.h, then look for SIGxxx names.
14768: Remove SIGARRAYSIZE used by HPUX.
14769: Remove SIGSTKSIZE used by Linux.
14770: Remove SIGSTKSZ used by Posix.
14771: Remove SIGTYP void lines used by OS2.
14772: Some cpps, like os390, dont give the file name anywhere
14773if [ "X$fieldn" = X ]; then
14774 : Just make some guesses. We check them later.
14775 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14776else
14777 xxx=`echo '#include <signal.h>' |
14778 $cppstdin $cppminus $cppflags 2>/dev/null |
14779 $grep '^[ ]*#.*include' |
a938a3bb 14780 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
14781fi
14782: Check this list of files to be sure we have parsed the cpp output ok.
14783: This will also avoid potentially non-existent files, such
14784: as ../foo/bar.h
14785xxxfiles=''
14786for xx in $xxx /dev/null ; do
14787 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14788done
14789: If we have found no files, at least try signal.h
14790case "$xxxfiles" in
14791'') xxxfiles=`./findhdr signal.h` ;;
14792esac
14793xxx=`awk '
14794$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14795 print substr($2, 4, 20)
14796}
14797$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14798 print substr($3, 4, 20)
14799}' $xxxfiles`
14800: Append some common names just in case the awk scan failed.
14801xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14802xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14803xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14804xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14805xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14806
14807: generate a few handy files for later
14808$cat > signal.c <<'EOCP'
14809#include <sys/types.h>
14810#include <signal.h>
14811#include <stdio.h>
14812int main() {
14813
14814/* Strange style to avoid deeply-nested #if/#else/#endif */
14815#ifndef NSIG
14816# ifdef _NSIG
14817# define NSIG (_NSIG)
14818# endif
14819#endif
14820
14821#ifndef NSIG
14822# ifdef SIGMAX
14823# define NSIG (SIGMAX+1)
14824# endif
14825#endif
14826
14827#ifndef NSIG
14828# ifdef SIG_MAX
14829# define NSIG (SIG_MAX+1)
14830# endif
14831#endif
14832
14833#ifndef NSIG
14834# ifdef MAXSIG
14835# define NSIG (MAXSIG+1)
14836# endif
14837#endif
14838
14839#ifndef NSIG
14840# ifdef MAX_SIG
14841# define NSIG (MAX_SIG+1)
14842# endif
14843#endif
14844
14845#ifndef NSIG
14846# ifdef SIGARRAYSIZE
14847# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14848# endif
14849#endif
14850
14851#ifndef NSIG
14852# ifdef _sys_nsig
14853# define NSIG (_sys_nsig) /* Solaris 2.5 */
14854# endif
14855#endif
14856
14857/* Default to some arbitrary number that's big enough to get most
14858 of the common signals.
14859*/
14860#ifndef NSIG
14861# define NSIG 50
14862#endif
14863
14864printf("NSIG %d\n", NSIG);
14865
14866#ifndef JUST_NSIG
14867
14868EOCP
14869
14870echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14871{
14872 printf "#ifdef SIG"; printf $1; printf "\n"
14873 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14874 printf $1; printf ");\n"
14875 printf "#endif\n"
14876}
14877END {
14878 printf "#endif /* JUST_NSIG */\n";
14879 printf "exit(0);\n}\n";
14880}
14881' >>signal.c
14882$cat >signal.awk <<'EOP'
14883BEGIN { ndups = 0 }
14884$1 ~ /^NSIG$/ { nsig = $2 }
14885($1 !~ /^NSIG$/) && (NF == 2) {
14886 if ($2 > maxsig) { maxsig = $2 }
14887 if (sig_name[$2]) {
14888 dup_name[ndups] = $1
14889 dup_num[ndups] = $2
14890 ndups++
14891 }
14892 else {
14893 sig_name[$2] = $1
14894 sig_num[$2] = $2
14895 }
14896}
14897END {
14898 if (nsig == 0) {
14899 nsig = maxsig + 1
14900 }
14901 printf("NSIG %d\n", nsig);
14902 for (n = 1; n < nsig; n++) {
14903 if (sig_name[n]) {
14904 printf("%s %d\n", sig_name[n], sig_num[n])
14905 }
14906 else {
14907 printf("NUM%d %d\n", n, n)
14908 }
14909 }
14910 for (n = 0; n < ndups; n++) {
14911 printf("%s %d\n", dup_name[n], dup_num[n])
14912 }
14913}
14914EOP
14915$cat >signal_cmd <<EOS
14916$startsh
14917if $test -s signal.lst; then
14918 echo "Using your existing signal.lst file"
14919 exit 0
14920fi
14921xxx="$xxx"
14922EOS
14923$cat >>signal_cmd <<'EOS'
14924
14925set signal
14926if eval $compile_ok; then
14927 ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14928else
14929 echo "(I can't seem be able to compile the whole test program)" >&4
14930 echo "(I'll try it in little pieces.)" >&4
14931 set signal -DJUST_NSIG
14932 if eval $compile_ok; then
14933 ./signal$_exe > signal.nsg
14934 $cat signal.nsg
14935 else
14936 echo "I can't seem to figure out how many signals you have." >&4
14937 echo "Guessing 50." >&4
14938 echo 'NSIG 50' > signal.nsg
14939 fi
14940 : Now look at all the signal names, one at a time.
14941 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14942 $cat > signal.c <<EOCP
14943#include <sys/types.h>
14944#include <signal.h>
14945#include <stdio.h>
14946int main() {
14947printf("$xx %d\n", SIG${xx});
14948return 0;
14949}
14950EOCP
14951 set signal
14952 if eval $compile; then
14953 echo "SIG${xx} found."
14954 ./signal$_exe >> signal.ls1
14955 else
14956 echo "SIG${xx} NOT found."
14957 fi
14958 done
14959 if $test -s signal.ls1; then
14960 $cat signal.nsg signal.ls1 |
14961 $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14962 fi
14963
14964fi
14965if $test -s signal.lst; then
14966 :
14967else
14968 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14969 echo 'kill -l' >signal
14970 set X `csh -f <signal`
14971 $rm -f signal
14972 shift
14973 case $# in
14974 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14975 esac
14976 echo $@ | $tr ' ' $trnl | \
14977 $awk '{ printf "%s %d\n", $1, ++s; }
14978 END { printf "NSIG %d\n", ++s }' >signal.lst
14979fi
14980$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14981EOS
14982chmod a+x signal_cmd
14983$eunicefix signal_cmd
14984
14985: generate list of signal names
14986echo " "
14987case "$sig_name_init" in
14988'') doinit=yes ;;
14989*) case "$sig_num_init" in
14990 ''|*,*) doinit=yes ;;
14991 esac ;;
14992esac
14993case "$doinit" in
14994yes)
14995 echo "Generating a list of signal names and numbers..." >&4
14996 . ./signal_cmd
14997 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14998 sig_name=`$awk 'BEGIN { printf "ZERO " }
14999 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
15000 sig_num=`$awk 'BEGIN { printf "0 " }
15001 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
15002 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
15003 !/^NSIG/ { printf "\"%s\", ", $1 }
15004 END { printf "0\n" }' signal.lst`
15005 sig_num_init=`$awk 'BEGIN { printf "0, " }
15006 !/^NSIG/ { printf "%d, ", $2}
15007 END { printf "0\n"}' signal.lst`
15008 ;;
15009esac
15010echo "The following $sig_count signals are available:"
15011echo " "
15012echo $sig_name | $awk \
15013'BEGIN { linelen = 0 }
15014{
15015 for (i = 1; i <= NF; i++) {
15016 name = "SIG" $i " "
15017 linelen = linelen + length(name)
15018 if (linelen > 70) {
15019 printf "\n"
15020 linelen = length(name)
15021 }
15022 printf "%s", name
15023 }
15024 printf "\n"
15025}'
76d3c696 15026sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
15027$rm -f signal signal.c signal.awk signal.lst signal_cmd
15028
15029echo " "
15030case "$sizetype" in
15031*_t) zzz="$sizetype" ;;
15032*) zzz="filesize" ;;
15033esac
15034echo "Checking the size of $zzz..." >&4
15035cat > try.c <<EOCP
15036#include <sys/types.h>
15037#include <stdio.h>
15038int main() {
15039 printf("%d\n", (int)sizeof($sizetype));
15040 exit(0);
15041}
15042EOCP
15043set try
15044if eval $compile_ok; then
15045 yyy=`./try`
15046 case "$yyy" in
15047 '') sizesize=4
15048 echo "(I can't execute the test program--guessing $sizesize.)" >&4
15049 ;;
15050 *) sizesize=$yyy
15051 echo "Your $zzz size is $sizesize bytes."
15052 ;;
15053 esac
15054else
15055 sizesize=4
15056 echo "(I can't compile the test program--guessing $sizesize.)" >&4
15057fi
15058
15059
15060: check for socklen_t
15061echo " "
15062echo "Checking to see if you have socklen_t..." >&4
15063$cat >try.c <<EOCP
15064#include <sys/types.h>
15065#$d_socket HAS_SOCKET
15066#ifdef HAS_SOCKET
15067#include <sys/socket.h>
15068#endif
15069int main() { socklen_t x = 16; }
15070EOCP
15071set try
15072if eval $compile; then
15073 val="$define"
15074 echo "You have socklen_t."
15075else
15076 val="$undef"
15077 echo "You do not have socklen_t."
15078 case "$sizetype" in
15079 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
15080 esac
15081fi
15082$rm -f try try.*
15083set d_socklen_t
15084eval $setvar
15085
a7710f8d
JH
15086: see if this is a socks.h system
15087set socks.h i_socks
15088eval $inhdr
15089
b4eb6b3d
JH
15090: check for type of the size argument to socket calls
15091case "$d_socket" in
15092"$define")
15093 $cat <<EOM
15094
15095Checking to see what type is the last argument of accept().
15096EOM
b4eb6b3d
JH
15097 yyy=''
15098 case "$d_socklen_t" in
15099 "$define") yyy="$yyy socklen_t"
15100 esac
15101 yyy="$yyy $sizetype int long unsigned"
15102 for xxx in $yyy; do
15103 case "$socksizetype" in
15104 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
15105 case "$usesocks" in
15106 "$define")
15107 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
15108 echo "Your system accepts '$xxx *' for the last argument of accept()."
15109 socksizetype="$xxx"
15110 fi
15111 ;;
15112 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
15113 echo "Your system accepts '$xxx *' for the last argument of accept()."
15114 socksizetype="$xxx"
15115 fi
15116 ;;
15117 esac
b4eb6b3d
JH
15118 ;;
15119 esac
15120 done
15121: In case none of those worked, prompt the user.
15122 case "$socksizetype" in
15123 '') rp='What is the type for socket address structure sizes?'
15124 dflt='int'
15125 . ./myread
15126 socksizetype=$ans
15127 ;;
15128 esac
15129 ;;
15130*) : no sockets, so pick relatively harmless default
15131 socksizetype='int'
15132 ;;
15133esac
15134
15135: see what type is used for signed size_t
15136set ssize_t ssizetype int stdio.h sys/types.h
15137eval $typedef
15138dflt="$ssizetype"
15139$cat > ssize.c <<EOM
15140#include <stdio.h>
15141#include <sys/types.h>
15142#define Size_t $sizetype
15143#define SSize_t $dflt
15144int main()
15145{
15146 if (sizeof(Size_t) == sizeof(SSize_t))
15147 printf("$dflt\n");
15148 else if (sizeof(Size_t) == sizeof(int))
15149 printf("int\n");
15150 else
15151 printf("long\n");
15152 exit(0);
15153}
15154EOM
15155echo " "
15156set ssize
15157if eval $compile_ok && ./ssize > /dev/null; then
15158 ssizetype=`./ssize`
15159 echo "I'll be using $ssizetype for functions returning a byte count." >&4
15160else
15161 $cat >&4 <<EOM
15162Help! I can't compile and run the ssize_t test program: please enlighten me!
15163(This is probably a misconfiguration in your system or libraries, and
15164you really ought to fix it. Still, I'll try anyway.)
15165
15166I need a type that is the same size as $sizetype, but is guaranteed to
15167be signed. Common values are ssize_t, int and long.
15168
15169EOM
15170 rp="What signed type is the same size as $sizetype?"
15171 . ./myread
15172 ssizetype="$ans"
15173fi
15174$rm -f ssize ssize.*
15175
15176: see what type of char stdio uses.
15177echo " "
aa517f50
JH
15178echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
15179if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
15180 echo "Your stdio uses unsigned chars." >&4
15181 stdchar="unsigned char"
15182else
aa517f50
JH
15183 echo "Your stdio uses signed chars." >&4
15184 stdchar="char"
b4eb6b3d 15185fi
aa517f50
JH
15186$rm -f stdioh
15187
15188
b4eb6b3d
JH
15189
15190: see if time exists
15191echo " "
15192if test "X$d_time" = X -o X"$timetype" = X; then
15193 if set time val -f d_time; eval $csym; $val; then
15194 echo 'time() found.' >&4
15195 val="$define"
15196 rp="What is the type returned by time() on this system?"
15197 set time_t timetype long stdio.h sys/types.h
15198 eval $typedef_ask
15199 else
15200 echo 'time() not found, hope that will do.' >&4
15201 val="$undef"
15202 timetype='int';
15203 fi
15204 set d_time
15205 eval $setvar
15206fi
15207
15208: see what type uids are declared as in the kernel
15209echo " "
15210echo "Looking for the type for user ids returned by getuid()."
15211set uid_t uidtype xxx stdio.h sys/types.h
15212eval $typedef
15213case "$uidtype" in
15214xxx)
15215 xxx=`./findhdr sys/user.h`
15216 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15217 case $1 in
15218 unsigned) dflt="$1 $2" ;;
15219 *) dflt="$1" ;;
15220 esac
15221 ;;
15222*) dflt="$uidtype";;
15223esac
15224case "$uidtype" in
15225uid_t) echo "uid_t found." ;;
15226*) rp="What is the type for user ids returned by getuid()?"
15227 . ./myread
15228 uidtype="$ans"
15229 ;;
15230esac
15231
15232echo " "
15233case "$uidtype" in
15234*_t) zzz="$uidtype" ;;
15235*) zzz="uid" ;;
15236esac
15237echo "Checking the size of $zzz..." >&4
15238cat > try.c <<EOCP
15239#include <sys/types.h>
15240#include <stdio.h>
15241int main() {
15242 printf("%d\n", (int)sizeof($uidtype));
15243 exit(0);
15244}
15245EOCP
15246set try
15247if eval $compile_ok; then
15248 yyy=`./try`
15249 case "$yyy" in
15250 '') uidsize=4
15251 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15252 ;;
15253 *) uidsize=$yyy
15254 echo "Your $zzz is $uidsize bytes long."
15255 ;;
15256 esac
15257else
15258 uidsize=4
15259 echo "(I can't compile the test program--guessing $uidsize.)" >&4
15260fi
15261
15262echo " "
15263case "$uidtype" in
15264*_t) zzz="$uidtype" ;;
15265*) zzz="uid" ;;
15266esac
15267echo "Checking the sign of $zzz..." >&4
15268cat > try.c <<EOCP
15269#include <sys/types.h>
15270#include <stdio.h>
15271int main() {
15272 $uidtype foo = -1;
15273 if (foo < 0)
15274 printf("-1\n");
15275 else
15276 printf("1\n");
15277}
15278EOCP
15279set try
15280if eval $compile; then
15281 yyy=`./try`
15282 case "$yyy" in
15283 '') uidsign=1
15284 echo "(I can't execute the test program--guessing unsigned.)" >&4
15285 ;;
15286 *) uidsign=$yyy
15287 case "$uidsign" in
15288 1) echo "Your $zzz is unsigned." ;;
15289 -1) echo "Your $zzz is signed." ;;
15290 esac
15291 ;;
15292 esac
15293else
15294 uidsign=1
15295 echo "(I can't compile the test program--guessing unsigned.)" >&4
15296fi
15297
15298
15299
15300echo " "
15301$echo "Checking the format string to be used for uids..." >&4
15302
15303case "$uidsign" in
15304-1) if $test X"$uidsize" = X"$ivsize"; then
15305 uidformat="$ivdformat"
15306 else
15307 if $test X"$uidsize" = X"$longsize"; then
15308 uidformat='"ld"'
15309 else
15310 if $test X"$uidsize" = X"$intsize"; then
15311 uidformat='"d"'
15312 else
15313 if $test X"$uidsize" = X"$shortsize"; then
15314 uidformat='"hd"'
15315 fi
15316 fi
15317 fi
15318 fi
15319 ;;
15320*) if $test X"$uidsize" = X"$uvsize"; then
15321 uidformat="$uvuformat"
15322 else
15323 if $test X"$uidsize" = X"$longsize"; then
15324 uidformat='"lu"'
15325 else
15326 if $test X"$uidsize" = X"$intsize"; then
15327 uidformat='"u"'
15328 else
15329 if $test X"$uidsize" = X"$shortsize"; then
15330 uidformat='"hu"'
15331 fi
15332 fi
15333 fi
15334 fi
15335 ;;
15336esac
15337
3659ebf1
JH
15338: determine compiler compiler
15339case "$yacc" in
15340'')
15341 dflt=yacc;;
15342*)
15343 dflt="$yacc";;
15344esac
15345echo " "
15346comp='yacc'
15347if $test -f "$byacc"; then
15348 dflt="$byacc"
15349 comp="byacc or $comp"
15350fi
15351if $test -f "$bison"; then
15352 comp="$comp or bison -y"
15353fi
15354rp="Which compiler compiler ($comp) shall I use?"
15355. ./myread
15356yacc="$ans"
15357case "$yacc" in
15358*bis*)
15359 case "$yacc" in
15360 *-y*) ;;
15361 *)
15362 yacc="$yacc -y"
15363 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15364 ;;
15365 esac
15366 ;;
15367esac
15368
b4eb6b3d
JH
15369: see if fcntl.h is there
15370val=''
15371set fcntl.h val
15372eval $inhdr
15373
15374: see if we can include fcntl.h
15375case "$val" in
15376"$define")
15377 echo " "
15378 if $h_fcntl; then
15379 val="$define"
15380 echo "We'll be including <fcntl.h>." >&4
15381 else
15382 val="$undef"
15383 if $h_sysfile; then
15384 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15385 else
15386 echo "We won't be including <fcntl.h>." >&4
15387 fi
15388 fi
15389 ;;
15390*)
15391 h_fcntl=false
15392 val="$undef"
15393 ;;
15394esac
15395set i_fcntl
15396eval $setvar
15397
15398: see if this is a iconv.h system
15399set iconv.h i_iconv
15400eval $inhdr
15401
15402: see if this is a ieeefp.h system
15403set ieeefp.h i_ieeefp
15404eval $inhdr
15405
15406: see if this is a libutil.h system
15407set libutil.h i_libutil
15408eval $inhdr
15409
15410: see if locale.h is available
15411set locale.h i_locale
15412eval $inhdr
15413
15414: see if mach cthreads are available
15415if test "X$usethreads" = "X$define"; then
15416 set mach/cthreads.h i_machcthr
15417 eval $inhdr
15418else
15419 i_machcthr="$undef"
15420fi
15421
15422
15423
15424: see if this is a math.h system
15425set math.h i_math
15426eval $inhdr
15427
15428: see if this is a mntent.h system
15429set mntent.h i_mntent
15430eval $inhdr
15431
15432: see if ndbm.h is available
15433set ndbm.h t_ndbm
15434eval $inhdr
15435case "$t_ndbm" in
15436$define)
15437 : see if dbm_open exists
15438 set dbm_open d_dbm_open
15439 eval $inlibc
15440 case "$d_dbm_open" in
15441 $undef)
15442 t_ndbm="$undef"
15443 echo "We won't be including <ndbm.h>"
15444 ;;
15445 esac
15446 ;;
15447esac
15448val="$t_ndbm"
15449set i_ndbm
15450eval $setvar
15451
15452: see if net/errno.h is available
15453val=''
15454set net/errno.h val
15455eval $inhdr
15456
15457: Unfortunately, it causes problems on some systems. Arrgh.
15458case "$val" in
15459$define)
15460 cat > try.c <<'EOM'
15461#include <stdio.h>
15462#include <errno.h>
15463#include <net/errno.h>
15464int func()
15465{
15466 return ENOTSOCK;
15467}
15468EOM
15469 if $cc $ccflags -c try.c >/dev/null 2>&1; then
15470 echo "We'll be including <net/errno.h>." >&4
15471 else
15472 echo "We won't be including <net/errno.h>." >&4
15473 val="$undef"
15474 fi
15475 $rm -f try.* try
15476 ;;
15477esac
15478set i_neterrno
15479eval $setvar
15480
15481: see if netinet/tcp.h is available
15482set netinet/tcp.h i_netinettcp
15483eval $inhdr
15484
15485: see if this is a poll.h system
15486set poll.h i_poll
15487eval $inhdr
15488
15489: see if this is a prot.h system
15490set prot.h i_prot
15491eval $inhdr
15492
15493echo " "
15494$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
15495$cat <<'EOSH' > Cppsym.know
15496a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15497AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
d46c9a2d
JH
15498alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15499ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15500BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
15501BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15502bull c cadmus clipper CMU COFF COMPILER_VERSION
15503concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15504CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15505Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15506FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15507GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15508H3050R H3050RX hbullx20 hcx host_mips
15509hp200 hp300 hp700 HP700 hp800 hp9000
15510hp9000s200 hp9000s300 hp9000s400 hp9000s500
15511hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15512i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 15513IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
15514INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15515LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15516LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15517Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15518LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15519M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15520M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15521M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15522MATH_HAS_NO_SIDE_EFFECTS
15523mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15524mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15525mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15526MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15527mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15528NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 15529news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
15530ns32016 ns32332 ns32k nsc32000
15531OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15532pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15533pc532 pdp11 PGC PIC plexus PORTAR posix
15534POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15535POSIX_C_SOURCE POSIX_SOURCE POWER
15536PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 15537riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
15538SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15539sony sony_news sonyrisc sparc sparclite spectrum
15540stardent stdc STDC_EXT stratos sun sun3 sun386
15541Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15542SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15543SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15544sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 15545TM3200 TM5400 TM5600
b4eb6b3d
JH
15546tower tower32 tower32_200 tower32_600 tower32_700
15547tower32_800 tower32_850 tss
15548u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15549ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15550unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15551Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15552XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15553XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15554z8000
15555EOSH
15556# Maybe put other stuff here too.
15557cat <<EOSH >>Cppsym.know
15558$osname
15559EOSH
15560./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15561./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15562$cat Cppsym.know > Cppsym.c
381aa1ff 15563$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
15564$rm -f Cppsym.a Cppsym.b Cppsym.c
15565cat <<EOSH > Cppsym
15566$startsh
15567if $test \$# -gt 0; then
15568 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15569 if $test -s Cppsym.got; then
15570 $rm -f Cppsym.got
15571 exit 0
15572 fi
15573 $rm -f Cppsym.got
15574 exit 1
15575else
15576 $tr " " "$trnl" | ./Cppsym.try
15577 exit 0
15578fi
15579EOSH
15580chmod +x Cppsym
15581$eunicefix Cppsym
15582cat <<EOSH > Cppsym.try
15583$startsh
15584cat <<'EOCP' > try.c
15585#include <stdio.h>
15586int main() {
15587EOCP
15588$awk \\
15589EOSH
15590cat <<'EOSH' >> Cppsym.try
15591'length($1) > 0 {
2ef53570
JH
15592 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
15593 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
15594 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
15595 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 15596}' >> try.c
2ef53570 15597echo 'return 0;}' >> try.c
b4eb6b3d
JH
15598EOSH
15599cat <<EOSH >> Cppsym.try
15600ccflags="$ccflags"
15601case "$osname-$gccversion" in
15602irix-) ccflags="\$ccflags -woff 1178" ;;
15603os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15604esac
7a282f6d 15605$cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
b4eb6b3d
JH
15606EOSH
15607chmod +x Cppsym.try
15608$eunicefix Cppsym.try
15609./Cppsym < Cppsym.know > Cppsym.true
15610: now check the C compiler for additional symbols
15611postprocess_cc_v=''
15612case "$osname" in
15613aix) postprocess_cc_v="|$tr , ' '" ;;
15614esac
15615$cat >ccsym <<EOS
15616$startsh
15617$cat >tmp.c <<EOF
15618extern int foo;
15619EOF
15620for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15621do
15622 case "\$i" in
15623 -D*) echo "\$i" | $sed 's/^-D//';;
15624 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15625 esac
15626done
15627$rm -f try.c
15628EOS
15629postprocess_cc_v=''
15630chmod +x ccsym
15631$eunicefix ccsym
15632./ccsym > ccsym1.raw
15633if $test -s ccsym1.raw; then
15634 $sort ccsym1.raw | $uniq >ccsym.raw
15635else
15636 mv ccsym1.raw ccsym.raw
15637fi
15638
15639$awk '/\=/ { print $0; next }
15640 { print $0"=1" }' ccsym.raw >ccsym.list
15641$awk '/\=/ { print $0; next }
15642 { print $0"=1" }' Cppsym.true >ccsym.true
15643$comm -13 ccsym.true ccsym.list >ccsym.own
15644$comm -12 ccsym.true ccsym.list >ccsym.com
15645$comm -23 ccsym.true ccsym.list >ccsym.cpp
15646also=''
15647if $test -z ccsym.raw; then
15648 echo "Your C compiler doesn't seem to define any symbols!" >&4
15649 echo " "
15650 echo "However, your C preprocessor defines the following symbols:"
15651 $cat Cppsym.true
15652 ccsymbols=''
15653 cppsymbols=`$cat Cppsym.true`
15654 cppsymbols=`echo $cppsymbols`
15655 cppccsymbols="$cppsymbols"
15656else
15657 if $test -s ccsym.com; then
15658 echo "Your C compiler and pre-processor define these symbols:"
15659 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15660 also='also '
15661 symbols='ones'
15662 cppccsymbols=`$cat ccsym.com`
15663 cppccsymbols=`echo $cppccsymbols`
15664 $test "$silent" || sleep 1
15665 fi
15666 if $test -s ccsym.cpp; then
15667 $test "$also" && echo " "
15668 echo "Your C pre-processor ${also}defines the following symbols:"
15669 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15670 also='further '
15671 cppsymbols=`$cat ccsym.cpp`
15672 cppsymbols=`echo $cppsymbols`
15673 $test "$silent" || sleep 1
15674 fi
15675 if $test -s ccsym.own; then
15676 $test "$also" && echo " "
15677 echo "Your C compiler ${also}defines the following cpp symbols:"
15678 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15679 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15680 ccsymbols=`$cat ccsym.own`
15681 ccsymbols=`echo $ccsymbols`
15682 $test "$silent" || sleep 1
15683 fi
15684fi
15685$rm -f ccsym* Cppsym.*
15686
15687: see if this is a termio system
15688val="$undef"
15689val2="$undef"
15690val3="$undef"
15691if $test `./findhdr termios.h`; then
15692 set tcsetattr i_termios
15693 eval $inlibc
15694 val3="$i_termios"
15695fi
15696echo " "
15697case "$val3" in
15698"$define") echo "You have POSIX termios.h... good!" >&4;;
15699*) if ./Cppsym pyr; then
15700 case "`/bin/universe`" in
15701 ucb) if $test `./findhdr sgtty.h`; then
15702 val2="$define"
15703 echo "<sgtty.h> found." >&4
15704 else
15705 echo "System is pyramid with BSD universe."
15706 echo "<sgtty.h> not found--you could have problems." >&4
15707 fi;;
15708 *) if $test `./findhdr termio.h`; then
15709 val="$define"
15710 echo "<termio.h> found." >&4
15711 else
15712 echo "System is pyramid with USG universe."
15713 echo "<termio.h> not found--you could have problems." >&4
15714 fi;;
15715 esac
15716 elif ./usg; then
15717 if $test `./findhdr termio.h`; then
15718 echo "<termio.h> found." >&4
15719 val="$define"
15720 elif $test `./findhdr sgtty.h`; then
15721 echo "<sgtty.h> found." >&4
15722 val2="$define"
15723 else
15724echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15725 fi
15726 else
15727 if $test `./findhdr sgtty.h`; then
15728 echo "<sgtty.h> found." >&4
15729 val2="$define"
15730 elif $test `./findhdr termio.h`; then
15731 echo "<termio.h> found." >&4
15732 val="$define"
15733 else
15734echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15735 fi
15736 fi;;
15737esac
15738set i_termio; eval $setvar
15739val=$val2; set i_sgtty; eval $setvar
15740val=$val3; set i_termios; eval $setvar
15741
15742: see if this is a shadow.h system
15743set shadow.h i_shadow
15744eval $inhdr
15745
b4eb6b3d
JH
15746: see if stddef is available
15747set stddef.h i_stddef
15748eval $inhdr
923fc586 15749
b4eb6b3d
JH
15750: see if this is a sunmath.h system
15751set sunmath.h i_sunmath
15752eval $inhdr
5f80c64f 15753
b4eb6b3d
JH
15754: see if sys/access.h is available
15755set sys/access.h i_sysaccess
15756eval $inhdr
15757
15758: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15759set sys/filio.h i_sysfilio
15760eval $inhdr
15761echo " "
15762if $test `./findhdr sys/ioctl.h`; then
15763 val="$define"
15764 echo '<sys/ioctl.h> found.' >&4
15765else
15766 val="$undef"
15767 if $test $i_sysfilio = "$define"; then
15768 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 15769 else
b4eb6b3d
JH
15770 $test $i_sgtty = "$define" && xxx="sgtty.h"
15771 $test $i_termio = "$define" && xxx="termio.h"
15772 $test $i_termios = "$define" && xxx="termios.h"
15773echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15774 fi
15775fi
15776set i_sysioctl
15777eval $setvar
15778
49a78c82
JH
15779: see if socket ioctl defs are in sys/sockio.h
15780echo " "
15781xxx=`./findhdr sys/sockio.h`
15782if $test "$xxx"; then
15783 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
15784 val="$define"
15785 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
15786 else
15787 val="$undef"
15788 echo "No socket ioctls found in <sys/sockio.h>." >&4
15789 fi
15790else
15791 val="$undef"
15792 $cat <<EOM
15793<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
15794EOM
15795fi
15796set i_syssockio
15797eval $setvar
15798
b4eb6b3d
JH
15799
15800: see if this is a syslog.h system
15801set syslog.h i_syslog
15802eval $inhdr
15803
15804
15805: see if this is a sys/mode.h system
15806set sys/mode.h i_sysmode
15807eval $inhdr
15808
15809: see if sys/resource.h has to be included
15810set sys/resource.h i_sysresrc
15811eval $inhdr
15812
15813: see if sys/security.h is available
15814set sys/security.h i_syssecrt
15815eval $inhdr
15816
15817: see if this is a sys/statvfs.h system
15818set sys/statvfs.h i_sysstatvfs
15819eval $inhdr
15820
b4eb6b3d
JH
15821: see if this is a sys/un.h system
15822set sys/un.h i_sysun
15823eval $inhdr
15824
15825
15826: see if this is a sys/utsname.h system
15827set sys/utsname.h i_sysutsname
15828eval $inhdr
15829
15830: see if this is a syswait system
15831set sys/wait.h i_syswait
15832eval $inhdr
15833
15834: see if this is a ustat.h system
15835set ustat.h i_ustat
15836eval $inhdr
15837
15838: see if this is an utime system
15839set utime.h i_utime
15840eval $inhdr
15841
15842: see if this is a values.h system
15843set values.h i_values
15844eval $inhdr
15845
15846: see if this is a vfork system
15847case "$d_vfork" in
15848"$define")
15849 set vfork.h i_vfork
15850 eval $inhdr
15851 ;;
15852*)
15853 i_vfork="$undef"
15854 ;;
15855esac
15856
15857: see if gdbm.h is available
15858set gdbm.h t_gdbm
15859eval $inhdr
15860case "$t_gdbm" in
15861$define)
15862 : see if gdbm_open exists
15863 set gdbm_open d_gdbm_open
15864 eval $inlibc
15865 case "$d_gdbm_open" in
15866 $undef)
15867 t_gdbm="$undef"
15868 echo "We won't be including <gdbm.h>"
5f80c64f 15869 ;;
b4eb6b3d
JH
15870 esac
15871 ;;
15872esac
15873val="$t_gdbm"
15874set i_gdbm
15875eval $setvar
15876
15877echo " "
15878echo "Looking for extensions..." >&4
15879: If we are using the old config.sh, known_extensions may contain
15880: old or inaccurate or duplicate values.
15881known_extensions=''
15882nonxs_extensions=''
15883: We do not use find because it might not be available.
15884: We do not just use MANIFEST because the user may have dropped
15885: some additional extensions into the source tree and expect them
15886: to be built.
15887
15888: Function to recursively find available extensions, ignoring DynaLoader
15889: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15890find_extensions='
15891 for xxx in *; do
15892 case "$xxx" in
15893 DynaLoader|dynaload) ;;
15894 *)
15895 if $test -f $xxx/$xxx.xs; then
15896 known_extensions="$known_extensions $1$xxx";
15897 elif $test -f $xxx/Makefile.PL; then
15898 nonxs_extensions="$nonxs_extensions $1$xxx";
15899 else
15900 if $test -d $xxx -a $# -lt 10; then
15901 set $1$xxx/ $*;
15902 cd $xxx;
15903 eval $find_extensions;
15904 cd ..;
15905 shift;
15906 fi;
15907 fi
15908 ;;
15909 esac;
15910 done'
15911tdir=`pwd`
15912cd $rsrc/ext
15913set X
15914shift
15915eval $find_extensions
15916set X $nonxs_extensions
15917shift
15918nonxs_extensions="$*"
15919set X $known_extensions
15920shift
15921known_extensions="$*"
15922cd $tdir
15923
15924: Now see which are supported on this system.
15925avail_ext=''
15926for xxx in $known_extensions ; do
15927 case "$xxx" in
15928 DB_File|db_file)
15929 case "$i_db" in
15930 $define) avail_ext="$avail_ext $xxx" ;;
15931 esac
15932 ;;
15933 GDBM_File|gdbm_fil)
15934 case "$i_gdbm" in
15935 $define) avail_ext="$avail_ext $xxx" ;;
15936 esac
15937 ;;
15938 NDBM_File|ndbm_fil)
15939 case "$i_ndbm" in
15940 $define)
15941 case "$osname-$use64bitint" in
15942 hpux-define)
15943 case "$libs" in
15944 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15945 esac
15946 ;;
15947 *) avail_ext="$avail_ext $xxx" ;;
15948 esac
15949 ;;
15950 esac
15951 ;;
15952 ODBM_File|odbm_fil)
15953 case "${i_dbm}${i_rpcsvcdbm}" in
15954 *"${define}"*)
15955 case "$osname-$use64bitint" in
15956 hpux-define)
15957 case "$libs" in
15958 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15959 esac
15960 ;;
15961 *) avail_ext="$avail_ext $xxx" ;;
15962 esac
15963 ;;
15964 esac
15965 ;;
15966 POSIX|posix)
15967 case "$useposix" in
15968 true|define|y) avail_ext="$avail_ext $xxx" ;;
15969 esac
15970 ;;
15971 Opcode|opcode)
15972 case "$useopcode" in
15973 true|define|y) avail_ext="$avail_ext $xxx" ;;
15974 esac
15975 ;;
15976 Socket|socket)
15977 case "$d_socket" in
15978 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15979 esac
15980 ;;
15981 Sys/Syslog|sys/syslog)
15982 : XXX syslog requires socket
15983 case "$d_socket" in
15984 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15985 esac
15986 ;;
15987 Thread|thread)
15988 case "$usethreads" in
15989 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15990 esac
15991 ;;
15992 IPC/SysV|ipc/sysv)
15993 : XXX Do we need a useipcsysv variable here
15994 case "${d_msg}${d_sem}${d_shm}" in
15995 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15996 esac
15997 ;;
15998 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
15999 ;;
16000 esac
b4eb6b3d 16001done
5f80c64f 16002
b4eb6b3d
JH
16003set X $avail_ext
16004shift
16005avail_ext="$*"
5f80c64f 16006
b4eb6b3d
JH
16007: Now see which nonxs extensions are supported on this system.
16008: For now assume all are.
16009nonxs_ext=''
16010for xxx in $nonxs_extensions ; do
16011 case "$xxx" in
16012 *) nonxs_ext="$nonxs_ext $xxx"
16013 ;;
16014 esac
16015done
5f80c64f 16016
b4eb6b3d
JH
16017set X $nonxs_ext
16018shift
16019nonxs_ext="$*"
16020
16021case $usedl in
16022$define)
16023 $cat <<EOM
16024A number of extensions are supplied with $package. You may choose to
16025compile these extensions for dynamic loading (the default), compile
16026them into the $package executable (static loading), or not include
16027them at all. Answer "none" to include no extensions.
16028Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
16029
16030EOM
b4eb6b3d
JH
16031 case "$dynamic_ext" in
16032 '') dflt="$avail_ext" ;;
16033 *) dflt="$dynamic_ext"
16034 # Perhaps we are reusing an old out-of-date config.sh.
16035 case "$hint" in
16036 previous)
16037 if test X"$dynamic_ext" != X"$avail_ext"; then
16038 $cat <<EOM
16039NOTICE: Your previous config.sh list may be incorrect.
16040The extensions now available to you are
16041 ${avail_ext}
16042but the default list from your previous config.sh is
16043 ${dynamic_ext}
9c839522 16044
b4eb6b3d
JH
16045EOM
16046 fi
9c839522
PM
16047 ;;
16048 esac
b4eb6b3d
JH
16049 ;;
16050 esac
5f80c64f 16051 case "$dflt" in
b4eb6b3d
JH
16052 '') dflt=none;;
16053 esac
16054 rp="What extensions do you wish to load dynamically?"
16055 . ./myread
16056 case "$ans" in
16057 none) dynamic_ext=' ' ;;
16058 *) dynamic_ext="$ans" ;;
5f80c64f 16059 esac
5f80c64f 16060
b4eb6b3d
JH
16061 case "$static_ext" in
16062 '')
16063 : Exclude those already listed in dynamic linking
16064 dflt=''
16065 for xxx in $avail_ext; do
16066 case " $dynamic_ext " in
16067 *" $xxx "*) ;;
16068 *) dflt="$dflt $xxx" ;;
16069 esac
16070 done
16071 set X $dflt
16072 shift
16073 dflt="$*"
16074 ;;
16075 *) dflt="$static_ext"
16076 ;;
16077 esac
9c839522 16078
b4eb6b3d
JH
16079 case "$dflt" in
16080 '') dflt=none;;
16081 esac
16082 rp="What extensions do you wish to load statically?"
16083 . ./myread
16084 case "$ans" in
16085 none) static_ext=' ' ;;
16086 *) static_ext="$ans" ;;
16087 esac
16088 ;;
16089*)
16090 $cat <<EOM
16091A number of extensions are supplied with $package. Answer "none"
16092to include no extensions.
16093Note that DynaLoader is always built and need not be mentioned here.
9c839522 16094
b4eb6b3d
JH
16095EOM
16096 case "$static_ext" in
16097 '') dflt="$avail_ext" ;;
16098 *) dflt="$static_ext"
16099 # Perhaps we are reusing an old out-of-date config.sh.
16100 case "$hint" in
16101 previous)
16102 if test X"$static_ext" != X"$avail_ext"; then
16103 $cat <<EOM
16104NOTICE: Your previous config.sh list may be incorrect.
16105The extensions now available to you are
16106 ${avail_ext}
16107but the default list from your previous config.sh is
16108 ${static_ext}
5f80c64f
JH
16109
16110EOM
b4eb6b3d
JH
16111 fi
16112 ;;
16113 esac
16114 ;;
16115 esac
16116 : Exclude those that are not xs extensions
16117 case "$dflt" in
16118 '') dflt=none;;
16119 esac
16120 rp="What extensions do you wish to include?"
16121 . ./myread
16122 case "$ans" in
16123 none) static_ext=' ' ;;
16124 *) static_ext="$ans" ;;
16125 esac
16126 ;;
5f80c64f
JH
16127esac
16128
b4eb6b3d
JH
16129set X $dynamic_ext $static_ext $nonxs_ext
16130shift
16131extensions="$*"
16132
9c839522
PM
16133: Remove libraries needed only for extensions
16134: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
16135: The exception is SunOS 4.x, which needs them.
16136case "${osname}X${osvers}" in
16137sunos*X4*)
16138 perllibs="$libs"
16139 ;;
16140*) case "$usedl" in
16141 $define|true|[yY]*)
16142 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
16143 shift
16144 perllibs="$*"
16145 ;;
16146 *) perllibs="$libs"
16147 ;;
16148 esac
16149 ;;
9c839522 16150esac
5f80c64f
JH
16151
16152: Remove build directory name from cppstdin so it can be used from
16153: either the present location or the final installed location.
16154echo " "
16155: Get out of the UU directory to get correct path name.
16156cd ..
16157case "$cppstdin" in
16158`pwd`/cppstdin)
16159 echo "Stripping down cppstdin path name"
16160 cppstdin=cppstdin
16161 ;;
16162esac
16163cd UU
16164
16165: end of configuration questions
16166echo " "
16167echo "End of configuration questions."
16168echo " "
16169
16170: back to where it started
16171if test -d ../UU; then
16172 cd ..
16173fi
16174
16175: configuration may be patched via a 'config.over' file
16176if $test -f config.over; then
16177 echo " "
16178 dflt=y
16179 rp='I see a config.over file. Do you wish to load it?'
16180 . UU/myread
16181 case "$ans" in
16182 n*) echo "OK, I'll ignore it.";;
16183 *) . ./config.over
16184 echo "Configuration override changes have been loaded."
16185 ;;
16186 esac
16187fi
16188
16189: in case they want portability, strip down executable paths
16190case "$d_portable" in
16191"$define")
16192 echo " "
16193 echo "Stripping down executable paths..." >&4
16194 for file in $loclist $trylist; do
534ac15a
JH
16195 eval temp=\$$file
16196 eval $file=`basename $temp`
5f80c64f
JH
16197 done
16198 ;;
16199esac
16200
16201: create config.sh file
16202echo " "
16203echo "Creating config.sh..." >&4
16204$spitshell <<EOT >config.sh
16205$startsh
16206#
16207# This file was produced by running the Configure script. It holds all the
16208# definitions figured out by Configure. Should you modify one of these values,
16209# do not forget to propagate your changes by running "Configure -der". You may
16210# instead choose to run each of the .SH files by yourself, or "Configure -S".
16211#
16212
16213# Package name : $package
16214# Source directory : $src
16215# Configuration time: $cf_time
16216# Configured by : $cf_by
16217# Target system : $myuname
16218
16219Author='$Author'
16220Date='$Date'
16221Header='$Header'
16222Id='$Id'
16223Locker='$Locker'
16224Log='$Log'
16225Mcc='$Mcc'
16226RCSfile='$RCSfile'
16227Revision='$Revision'
16228Source='$Source'
16229State='$State'
16230_a='$_a'
16231_exe='$_exe'
16232_o='$_o'
b4eb6b3d 16233afs='$afs'
a6d26a0d 16234afsroot='$afsroot'
b4eb6b3d
JH
16235alignbytes='$alignbytes'
16236ansi2knr='$ansi2knr'
16237aphostname='$aphostname'
16238api_revision='$api_revision'
16239api_subversion='$api_subversion'
16240api_version='$api_version'
16241api_versionstring='$api_versionstring'
5f80c64f 16242ar='$ar'
b4eb6b3d
JH
16243archlib='$archlib'
16244archlibexp='$archlibexp'
16245archname64='$archname64'
16246archname='$archname'
5f80c64f
JH
16247archobjs='$archobjs'
16248awk='$awk'
b4eb6b3d 16249baserev='$baserev'
5f80c64f 16250bash='$bash'
b4eb6b3d
JH
16251bin='$bin'
16252bincompat5005='$bincompat5005'
16253binexp='$binexp'
5f80c64f
JH
16254bison='$bison'
16255byacc='$byacc'
b4eb6b3d 16256byteorder='$byteorder'
5f80c64f 16257c='$c'
b4eb6b3d 16258castflags='$castflags'
5f80c64f
JH
16259cat='$cat'
16260cc='$cc'
16261cccdlflags='$cccdlflags'
16262ccdlflags='$ccdlflags'
16263ccflags='$ccflags'
b4eb6b3d 16264ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 16265ccname='$ccname'
b4eb6b3d 16266ccsymbols='$ccsymbols'
6b356c8e 16267ccversion='$ccversion'
5f80c64f 16268cf_by='$cf_by'
b4eb6b3d 16269cf_email='$cf_email'
5f80c64f 16270cf_time='$cf_time'
b4eb6b3d 16271charsize='$charsize'
5f80c64f
JH
16272chgrp='$chgrp'
16273chmod='$chmod'
16274chown='$chown'
b4eb6b3d 16275clocktype='$clocktype'
5f80c64f
JH
16276comm='$comm'
16277compress='$compress'
16278contains='$contains'
16279cp='$cp'
16280cpio='$cpio'
16281cpp='$cpp'
b4eb6b3d
JH
16282cpp_stuff='$cpp_stuff'
16283cppccsymbols='$cppccsymbols'
5f80c64f
JH
16284cppflags='$cppflags'
16285cpplast='$cpplast'
16286cppminus='$cppminus'
16287cpprun='$cpprun'
16288cppstdin='$cppstdin'
b4eb6b3d
JH
16289cppsymbols='$cppsymbols'
16290crosscompile='$crosscompile'
16291cryptlib='$cryptlib'
5f80c64f 16292csh='$csh'
b4eb6b3d
JH
16293d_Gconvert='$d_Gconvert'
16294d_PRIEUldbl='$d_PRIEUldbl'
16295d_PRIFUldbl='$d_PRIFUldbl'
16296d_PRIGUldbl='$d_PRIGUldbl'
16297d_PRIXU64='$d_PRIXU64'
16298d_PRId64='$d_PRId64'
16299d_PRIeldbl='$d_PRIeldbl'
16300d_PRIfldbl='$d_PRIfldbl'
16301d_PRIgldbl='$d_PRIgldbl'
16302d_PRIi64='$d_PRIi64'
16303d_PRIo64='$d_PRIo64'
16304d_PRIu64='$d_PRIu64'
16305d_PRIx64='$d_PRIx64'
16306d_SCNfldbl='$d_SCNfldbl'
74cac757 16307d__fwalk='$d__fwalk'
b4eb6b3d
JH
16308d_access='$d_access'
16309d_accessx='$d_accessx'
16310d_alarm='$d_alarm'
16311d_archlib='$d_archlib'
16312d_atolf='$d_atolf'
16313d_atoll='$d_atoll'
16314d_attribut='$d_attribut'
16315d_bcmp='$d_bcmp'
16316d_bcopy='$d_bcopy'
16317d_bincompat5005='$d_bincompat5005'
5f80c64f 16318d_bsd='$d_bsd'
b4eb6b3d
JH
16319d_bsdgetpgrp='$d_bsdgetpgrp'
16320d_bsdsetpgrp='$d_bsdsetpgrp'
16321d_bzero='$d_bzero'
16322d_casti32='$d_casti32'
16323d_castneg='$d_castneg'
16324d_charvspr='$d_charvspr'
16325d_chown='$d_chown'
16326d_chroot='$d_chroot'
16327d_chsize='$d_chsize'
16328d_closedir='$d_closedir'
4e0554ec 16329d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d
JH
16330d_const='$d_const'
16331d_crypt='$d_crypt'
16332d_csh='$d_csh'
16333d_cuserid='$d_cuserid'
16334d_dbl_dig='$d_dbl_dig'
2ef53570 16335d_dbminitproto='$d_dbminitproto'
b4eb6b3d
JH
16336d_difftime='$d_difftime'
16337d_dirnamlen='$d_dirnamlen'
16338d_dlerror='$d_dlerror'
5f80c64f 16339d_dlopen='$d_dlopen'
b4eb6b3d
JH
16340d_dlsymun='$d_dlsymun'
16341d_dosuid='$d_dosuid'
16342d_drand48proto='$d_drand48proto'
16343d_dup2='$d_dup2'
16344d_eaccess='$d_eaccess'
16345d_endgrent='$d_endgrent'
16346d_endhent='$d_endhent'
16347d_endnent='$d_endnent'
16348d_endpent='$d_endpent'
16349d_endpwent='$d_endpwent'
16350d_endsent='$d_endsent'
16351d_eofnblk='$d_eofnblk'
5f80c64f 16352d_eunice='$d_eunice'
b4eb6b3d
JH
16353d_fchmod='$d_fchmod'
16354d_fchown='$d_fchown'
16355d_fcntl='$d_fcntl'
9d9004a9 16356d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
16357d_fd_macros='$d_fd_macros'
16358d_fd_set='$d_fd_set'
16359d_fds_bits='$d_fds_bits'
16360d_fgetpos='$d_fgetpos'
16361d_flexfnam='$d_flexfnam'
16362d_flock='$d_flock'
2ef53570 16363d_flockproto='$d_flockproto'
b4eb6b3d
JH
16364d_fork='$d_fork'
16365d_fpathconf='$d_fpathconf'
16366d_fpos64_t='$d_fpos64_t'
16367d_frexpl='$d_frexpl'
16368d_fs_data_s='$d_fs_data_s'
16369d_fseeko='$d_fseeko'
16370d_fsetpos='$d_fsetpos'
16371d_fstatfs='$d_fstatfs'
16372d_fstatvfs='$d_fstatvfs'
411ab01c 16373d_fsync='$d_fsync'
b4eb6b3d
JH
16374d_ftello='$d_ftello'
16375d_ftime='$d_ftime'
16376d_getcwd='$d_getcwd'
16377d_getespwnam='$d_getespwnam'
16378d_getfsstat='$d_getfsstat'
16379d_getgrent='$d_getgrent'
16380d_getgrps='$d_getgrps'
16381d_gethbyaddr='$d_gethbyaddr'
16382d_gethbyname='$d_gethbyname'
16383d_gethent='$d_gethent'
16384d_gethname='$d_gethname'
16385d_gethostprotos='$d_gethostprotos'
4e0554ec 16386d_getitimer='$d_getitimer'
b4eb6b3d
JH
16387d_getlogin='$d_getlogin'
16388d_getmnt='$d_getmnt'
16389d_getmntent='$d_getmntent'
16390d_getnbyaddr='$d_getnbyaddr'
16391d_getnbyname='$d_getnbyname'
16392d_getnent='$d_getnent'
16393d_getnetprotos='$d_getnetprotos'
0c0643d0 16394d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
16395d_getpbyname='$d_getpbyname'
16396d_getpbynumber='$d_getpbynumber'
16397d_getpent='$d_getpent'
16398d_getpgid='$d_getpgid'
16399d_getpgrp2='$d_getpgrp2'
16400d_getpgrp='$d_getpgrp'
16401d_getppid='$d_getppid'
16402d_getprior='$d_getprior'
16403d_getprotoprotos='$d_getprotoprotos'
16404d_getprpwnam='$d_getprpwnam'
16405d_getpwent='$d_getpwent'
16406d_getsbyname='$d_getsbyname'
16407d_getsbyport='$d_getsbyport'
16408d_getsent='$d_getsent'
16409d_getservprotos='$d_getservprotos'
16410d_getspnam='$d_getspnam'
16411d_gettimeod='$d_gettimeod'
5f80c64f 16412d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
16413d_grpasswd='$d_grpasswd'
16414d_hasmntopt='$d_hasmntopt'
16415d_htonl='$d_htonl'
16416d_iconv='$d_iconv'
16417d_index='$d_index'
16418d_inetaton='$d_inetaton'
16419d_int64_t='$d_int64_t'
16420d_isascii='$d_isascii'
16421d_isnan='$d_isnan'
16422d_isnanl='$d_isnanl'
16423d_killpg='$d_killpg'
16424d_lchown='$d_lchown'
16425d_ldbl_dig='$d_ldbl_dig'
16426d_link='$d_link'
16427d_locconv='$d_locconv'
16428d_lockf='$d_lockf'
16429d_longdbl='$d_longdbl'
16430d_longlong='$d_longlong'
16431d_lseekproto='$d_lseekproto'
16432d_lstat='$d_lstat'
16433d_madvise='$d_madvise'
16434d_mblen='$d_mblen'
16435d_mbstowcs='$d_mbstowcs'
16436d_mbtowc='$d_mbtowc'
16437d_memchr='$d_memchr'
16438d_memcmp='$d_memcmp'
16439d_memcpy='$d_memcpy'
16440d_memmove='$d_memmove'
16441d_memset='$d_memset'
16442d_mkdir='$d_mkdir'
16443d_mkdtemp='$d_mkdtemp'
16444d_mkfifo='$d_mkfifo'
16445d_mkstemp='$d_mkstemp'
16446d_mkstemps='$d_mkstemps'
16447d_mktime='$d_mktime'
16448d_mmap='$d_mmap'
16449d_modfl='$d_modfl'
e67aeab1 16450d_modfl_pow32_bug='$d_modfl_pow32_bug'
b4eb6b3d
JH
16451d_mprotect='$d_mprotect'
16452d_msg='$d_msg'
16453d_msg_ctrunc='$d_msg_ctrunc'
16454d_msg_dontroute='$d_msg_dontroute'
16455d_msg_oob='$d_msg_oob'
16456d_msg_peek='$d_msg_peek'
16457d_msg_proxy='$d_msg_proxy'
16458d_msgctl='$d_msgctl'
16459d_msgget='$d_msgget'
4e0554ec 16460d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
16461d_msgrcv='$d_msgrcv'
16462d_msgsnd='$d_msgsnd'
16463d_msync='$d_msync'
16464d_munmap='$d_munmap'
16465d_mymalloc='$d_mymalloc'
16466d_nice='$d_nice'
16467d_nv_preserves_uv='$d_nv_preserves_uv'
16468d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16469d_off64_t='$d_off64_t'
16470d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16471d_oldpthreads='$d_oldpthreads'
16472d_oldsock='$d_oldsock'
16473d_open3='$d_open3'
16474d_pathconf='$d_pathconf'
16475d_pause='$d_pause'
16476d_perl_otherlibdirs='$d_perl_otherlibdirs'
16477d_phostname='$d_phostname'
16478d_pipe='$d_pipe'
16479d_poll='$d_poll'
5f80c64f 16480d_portable='$d_portable'
b4eb6b3d
JH
16481d_pthread_yield='$d_pthread_yield'
16482d_pwage='$d_pwage'
16483d_pwchange='$d_pwchange'
16484d_pwclass='$d_pwclass'
16485d_pwcomment='$d_pwcomment'
16486d_pwexpire='$d_pwexpire'
16487d_pwgecos='$d_pwgecos'
16488d_pwpasswd='$d_pwpasswd'
16489d_pwquota='$d_pwquota'
16490d_qgcvt='$d_qgcvt'
16491d_quad='$d_quad'
16492d_readdir='$d_readdir'
16493d_readlink='$d_readlink'
4e0554ec 16494d_readv='$d_readv'
640374d0 16495d_realpath='$d_realpath'
4e0554ec 16496d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
16497d_rename='$d_rename'
16498d_rewinddir='$d_rewinddir'
16499d_rmdir='$d_rmdir'
16500d_safebcpy='$d_safebcpy'
16501d_safemcpy='$d_safemcpy'
16502d_sanemcmp='$d_sanemcmp'
ef9f17be 16503d_sbrkproto='$d_sbrkproto'
b4eb6b3d
JH
16504d_sched_yield='$d_sched_yield'
16505d_scm_rights='$d_scm_rights'
16506d_seekdir='$d_seekdir'
16507d_select='$d_select'
16508d_sem='$d_sem'
16509d_semctl='$d_semctl'
16510d_semctl_semid_ds='$d_semctl_semid_ds'
16511d_semctl_semun='$d_semctl_semun'
16512d_semget='$d_semget'
16513d_semop='$d_semop'
4e0554ec 16514d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
16515d_setegid='$d_setegid'
16516d_seteuid='$d_seteuid'
16517d_setgrent='$d_setgrent'
16518d_setgrps='$d_setgrps'
16519d_sethent='$d_sethent'
4e0554ec 16520d_setitimer='$d_setitimer'
b4eb6b3d
JH
16521d_setlinebuf='$d_setlinebuf'
16522d_setlocale='$d_setlocale'
16523d_setnent='$d_setnent'
16524d_setpent='$d_setpent'
16525d_setpgid='$d_setpgid'
16526d_setpgrp2='$d_setpgrp2'
16527d_setpgrp='$d_setpgrp'
16528d_setprior='$d_setprior'
16529d_setproctitle='$d_setproctitle'
16530d_setpwent='$d_setpwent'
16531d_setregid='$d_setregid'
16532d_setresgid='$d_setresgid'
16533d_setresuid='$d_setresuid'
16534d_setreuid='$d_setreuid'
16535d_setrgid='$d_setrgid'
16536d_setruid='$d_setruid'
16537d_setsent='$d_setsent'
16538d_setsid='$d_setsid'
16539d_setvbuf='$d_setvbuf'
16540d_sfio='$d_sfio'
16541d_shm='$d_shm'
16542d_shmat='$d_shmat'
16543d_shmatprototype='$d_shmatprototype'
16544d_shmctl='$d_shmctl'
16545d_shmdt='$d_shmdt'
16546d_shmget='$d_shmget'
16547d_sigaction='$d_sigaction'
983dbef6 16548d_sigprocmask='$d_sigprocmask'
b4eb6b3d 16549d_sigsetjmp='$d_sigsetjmp'
49a78c82 16550d_sockatmark='$d_sockatmark'
2ef53570 16551d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
16552d_socket='$d_socket'
16553d_socklen_t='$d_socklen_t'
16554d_sockpair='$d_sockpair'
16555d_socks5_init='$d_socks5_init'
16556d_sqrtl='$d_sqrtl'
eef837ea 16557d_sresgproto='$d_sresgproto'
640374d0 16558d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
16559d_statblks='$d_statblks'
16560d_statfs_f_flags='$d_statfs_f_flags'
16561d_statfs_s='$d_statfs_s'
16562d_statvfs='$d_statvfs'
16563d_stdio_cnt_lval='$d_stdio_cnt_lval'
16564d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
16565d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16566d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
16567d_stdio_stream_array='$d_stdio_stream_array'
16568d_stdiobase='$d_stdiobase'
16569d_stdstdio='$d_stdstdio'
16570d_strchr='$d_strchr'
16571d_strcoll='$d_strcoll'
16572d_strctcpy='$d_strctcpy'
16573d_strerrm='$d_strerrm'
16574d_strerror='$d_strerror'
b3c85772 16575d_strftime='$d_strftime'
b4eb6b3d
JH
16576d_strtod='$d_strtod'
16577d_strtol='$d_strtol'
16578d_strtold='$d_strtold'
16579d_strtoll='$d_strtoll'
28e5dec8 16580d_strtoq='$d_strtoq'
b4eb6b3d
JH
16581d_strtoul='$d_strtoul'
16582d_strtoull='$d_strtoull'
16583d_strtouq='$d_strtouq'
16584d_strxfrm='$d_strxfrm'
16585d_suidsafe='$d_suidsafe'
16586d_symlink='$d_symlink'
16587d_syscall='$d_syscall'
2ef53570 16588d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
16589d_sysconf='$d_sysconf'
16590d_sysernlst='$d_sysernlst'
16591d_syserrlst='$d_syserrlst'
16592d_system='$d_system'
16593d_tcgetpgrp='$d_tcgetpgrp'
16594d_tcsetpgrp='$d_tcsetpgrp'
16595d_telldir='$d_telldir'
16596d_telldirproto='$d_telldirproto'
16597d_time='$d_time'
16598d_times='$d_times'
16599d_truncate='$d_truncate'
16600d_tzname='$d_tzname'
4e0554ec
JH
16601d_u32align='$d_u32align'
16602d_ualarm='$d_ualarm'
b4eb6b3d
JH
16603d_umask='$d_umask'
16604d_uname='$d_uname'
16605d_union_semun='$d_union_semun'
4e0554ec 16606d_usleep='$d_usleep'
2ef53570 16607d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
16608d_ustat='$d_ustat'
16609d_vendorarch='$d_vendorarch'
16610d_vendorbin='$d_vendorbin'
16611d_vendorlib='$d_vendorlib'
16612d_vfork='$d_vfork'
16613d_void_closedir='$d_void_closedir'
16614d_voidsig='$d_voidsig'
16615d_voidtty='$d_voidtty'
16616d_volatile='$d_volatile'
16617d_vprintf='$d_vprintf'
16618d_wait4='$d_wait4'
16619d_waitpid='$d_waitpid'
16620d_wcstombs='$d_wcstombs'
16621d_wctomb='$d_wctomb'
4e0554ec 16622d_writev='$d_writev'
5f80c64f
JH
16623d_xenix='$d_xenix'
16624date='$date'
b4eb6b3d
JH
16625db_hashtype='$db_hashtype'
16626db_prefixtype='$db_prefixtype'
640374d0
JH
16627db_version_major='$db_version_major'
16628db_version_minor='$db_version_minor'
16629db_version_patch='$db_version_patch'
b4eb6b3d
JH
16630defvoidused='$defvoidused'
16631direntrytype='$direntrytype'
16632dlext='$dlext'
5f80c64f 16633dlsrc='$dlsrc'
b4eb6b3d
JH
16634doublesize='$doublesize'
16635drand01='$drand01'
16636dynamic_ext='$dynamic_ext'
16637eagain='$eagain'
16638ebcdic='$ebcdic'
5f80c64f
JH
16639echo='$echo'
16640egrep='$egrep'
16641emacs='$emacs'
16642eunicefix='$eunicefix'
16643exe_ext='$exe_ext'
16644expr='$expr'
b4eb6b3d
JH
16645extensions='$extensions'
16646fflushNULL='$fflushNULL'
16647fflushall='$fflushall'
5f80c64f
JH
16648find='$find'
16649firstmakefile='$firstmakefile'
16650flex='$flex'
b4eb6b3d
JH
16651fpossize='$fpossize'
16652fpostype='$fpostype'
16653freetype='$freetype'
16654full_ar='$full_ar'
16655full_csh='$full_csh'
16656full_sed='$full_sed'
5b463ca7 16657gccosandvers='$gccosandvers'
5f80c64f 16658gccversion='$gccversion'
b4eb6b3d
JH
16659gidformat='$gidformat'
16660gidsign='$gidsign'
16661gidsize='$gidsize'
16662gidtype='$gidtype'
5f80c64f
JH
16663glibpth='$glibpth'
16664grep='$grep'
b4eb6b3d
JH
16665groupcat='$groupcat'
16666groupstype='$groupstype'
5f80c64f 16667gzip='$gzip'
b4eb6b3d
JH
16668h_fcntl='$h_fcntl'
16669h_sysfile='$h_sysfile'
5f80c64f 16670hint='$hint'
b4eb6b3d
JH
16671hostcat='$hostcat'
16672i16size='$i16size'
16673i16type='$i16type'
16674i32size='$i32size'
16675i32type='$i32type'
16676i64size='$i64size'
16677i64type='$i64type'
16678i8size='$i8size'
16679i8type='$i8type'
16680i_arpainet='$i_arpainet'
16681i_bsdioctl='$i_bsdioctl'
16682i_db='$i_db'
16683i_dbm='$i_dbm'
16684i_dirent='$i_dirent'
5f80c64f 16685i_dld='$i_dld'
b4eb6b3d
JH
16686i_dlfcn='$i_dlfcn'
16687i_fcntl='$i_fcntl'
16688i_float='$i_float'
16689i_gdbm='$i_gdbm'
16690i_grp='$i_grp'
16691i_iconv='$i_iconv'
16692i_ieeefp='$i_ieeefp'
16693i_inttypes='$i_inttypes'
16694i_libutil='$i_libutil'
16695i_limits='$i_limits'
16696i_locale='$i_locale'
16697i_machcthr='$i_machcthr'
16698i_malloc='$i_malloc'
16699i_math='$i_math'
16700i_memory='$i_memory'
16701i_mntent='$i_mntent'
16702i_ndbm='$i_ndbm'
16703i_netdb='$i_netdb'
16704i_neterrno='$i_neterrno'
16705i_netinettcp='$i_netinettcp'
16706i_niin='$i_niin'
16707i_poll='$i_poll'
16708i_prot='$i_prot'
16709i_pthread='$i_pthread'
16710i_pwd='$i_pwd'
16711i_rpcsvcdbm='$i_rpcsvcdbm'
16712i_sfio='$i_sfio'
16713i_sgtty='$i_sgtty'
16714i_shadow='$i_shadow'
16715i_socks='$i_socks'
16716i_stdarg='$i_stdarg'
16717i_stddef='$i_stddef'
16718i_stdlib='$i_stdlib'
16719i_string='$i_string'
16720i_sunmath='$i_sunmath'
16721i_sysaccess='$i_sysaccess'
16722i_sysdir='$i_sysdir'
16723i_sysfile='$i_sysfile'
16724i_sysfilio='$i_sysfilio'
16725i_sysin='$i_sysin'
16726i_sysioctl='$i_sysioctl'
16727i_syslog='$i_syslog'
16728i_sysmman='$i_sysmman'
16729i_sysmode='$i_sysmode'
16730i_sysmount='$i_sysmount'
16731i_sysndir='$i_sysndir'
16732i_sysparam='$i_sysparam'
16733i_sysresrc='$i_sysresrc'
16734i_syssecrt='$i_syssecrt'
16735i_sysselct='$i_sysselct'
16736i_syssockio='$i_syssockio'
16737i_sysstat='$i_sysstat'
16738i_sysstatfs='$i_sysstatfs'
16739i_sysstatvfs='$i_sysstatvfs'
16740i_systime='$i_systime'
16741i_systimek='$i_systimek'
16742i_systimes='$i_systimes'
16743i_systypes='$i_systypes'
16744i_sysuio='$i_sysuio'
16745i_sysun='$i_sysun'
16746i_sysutsname='$i_sysutsname'
16747i_sysvfs='$i_sysvfs'
16748i_syswait='$i_syswait'
16749i_termio='$i_termio'
16750i_termios='$i_termios'
16751i_time='$i_time'
16752i_unistd='$i_unistd'
16753i_ustat='$i_ustat'
16754i_utime='$i_utime'
16755i_values='$i_values'
16756i_varargs='$i_varargs'
16757i_varhdr='$i_varhdr'
16758i_vfork='$i_vfork'
5f80c64f 16759ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
16760inc_version_list='$inc_version_list'
16761inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
16762incpath='$incpath'
16763inews='$inews'
b4eb6b3d
JH
16764installarchlib='$installarchlib'
16765installbin='$installbin'
16766installman1dir='$installman1dir'
16767installman3dir='$installman3dir'
16768installprefix='$installprefix'
16769installprefixexp='$installprefixexp'
16770installprivlib='$installprivlib'
16771installscript='$installscript'
16772installsitearch='$installsitearch'
16773installsitebin='$installsitebin'
16774installsitelib='$installsitelib'
16775installstyle='$installstyle'
16776installusrbinperl='$installusrbinperl'
16777installvendorarch='$installvendorarch'
16778installvendorbin='$installvendorbin'
16779installvendorlib='$installvendorlib'
16780intsize='$intsize'
4b661809 16781issymlink='$issymlink'
b4eb6b3d
JH
16782ivdformat='$ivdformat'
16783ivsize='$ivsize'
16784ivtype='$ivtype'
16785known_extensions='$known_extensions'
5f80c64f 16786ksh='$ksh'
5f80c64f
JH
16787ld='$ld'
16788lddlflags='$lddlflags'
16789ldflags='$ldflags'
b4eb6b3d
JH
16790ldflags_uselargefiles='$ldflags_uselargefiles'
16791ldlibpthname='$ldlibpthname'
5f80c64f
JH
16792less='$less'
16793lib_ext='$lib_ext'
16794libc='$libc'
b4eb6b3d 16795libperl='$libperl'
5f80c64f
JH
16796libpth='$libpth'
16797libs='$libs'
43999f95
JH
16798libsdirs='$libsdirs'
16799libsfiles='$libsfiles'
16800libsfound='$libsfound'
13b3f787 16801libspath='$libspath'
5f80c64f 16802libswanted='$libswanted'
b4eb6b3d 16803libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
16804line='$line'
16805lint='$lint'
16806lkflags='$lkflags'
16807ln='$ln'
16808lns='$lns'
16809locincpth='$locincpth'
16810loclibpth='$loclibpth'
b4eb6b3d
JH
16811longdblsize='$longdblsize'
16812longlongsize='$longlongsize'
16813longsize='$longsize'
5f80c64f
JH
16814lp='$lp'
16815lpr='$lpr'
16816ls='$ls'
b4eb6b3d
JH
16817lseeksize='$lseeksize'
16818lseektype='$lseektype'
5f80c64f
JH
16819mail='$mail'
16820mailx='$mailx'
16821make='$make'
16822make_set_make='$make_set_make'
b4eb6b3d
JH
16823mallocobj='$mallocobj'
16824mallocsrc='$mallocsrc'
16825malloctype='$malloctype'
16826man1dir='$man1dir'
16827man1direxp='$man1direxp'
16828man1ext='$man1ext'
16829man3dir='$man3dir'
16830man3direxp='$man3direxp'
16831man3ext='$man3ext'
5f80c64f
JH
16832mips_type='$mips_type'
16833mkdir='$mkdir'
b4eb6b3d
JH
16834mmaptype='$mmaptype'
16835modetype='$modetype'
5f80c64f 16836more='$more'
b4eb6b3d 16837multiarch='$multiarch'
5f80c64f 16838mv='$mv'
b4eb6b3d
JH
16839myarchname='$myarchname'
16840mydomain='$mydomain'
16841myhostname='$myhostname'
5f80c64f
JH
16842myuname='$myuname'
16843n='$n'
2cc61e15 16844need_va_copy='$need_va_copy'
b4eb6b3d
JH
16845netdb_hlen_type='$netdb_hlen_type'
16846netdb_host_type='$netdb_host_type'
16847netdb_name_type='$netdb_name_type'
16848netdb_net_type='$netdb_net_type'
5f80c64f
JH
16849nm='$nm'
16850nm_opt='$nm_opt'
16851nm_so_opt='$nm_so_opt'
b4eb6b3d 16852nonxs_ext='$nonxs_ext'
5f80c64f 16853nroff='$nroff'
b4eb6b3d
JH
16854nvEUformat='$nvEUformat'
16855nvFUformat='$nvFUformat'
16856nvGUformat='$nvGUformat'
16857nveformat='$nveformat'
16858nvfformat='$nvfformat'
16859nvgformat='$nvgformat'
16860nvsize='$nvsize'
16861nvtype='$nvtype'
16862o_nonblock='$o_nonblock'
5f80c64f 16863obj_ext='$obj_ext'
b4eb6b3d 16864old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 16865optimize='$optimize'
b4eb6b3d 16866orderlib='$orderlib'
5f80c64f
JH
16867osname='$osname'
16868osvers='$osvers'
b4eb6b3d 16869otherlibdirs='$otherlibdirs'
5f80c64f 16870package='$package'
b4eb6b3d
JH
16871pager='$pager'
16872passcat='$passcat'
16873patchlevel='$patchlevel'
5f80c64f 16874path_sep='$path_sep'
b4eb6b3d 16875perl5='$perl5'
5f80c64f 16876perl='$perl'
151e6568 16877perl_patchlevel='$perl_patchlevel'
b4eb6b3d 16878perladmin='$perladmin'
9c839522 16879perllibs='$perllibs'
b4eb6b3d 16880perlpath='$perlpath'
5f80c64f 16881pg='$pg'
b4eb6b3d
JH
16882phostname='$phostname'
16883pidtype='$pidtype'
5f80c64f 16884plibpth='$plibpth'
b4eb6b3d 16885pm_apiversion='$pm_apiversion'
5f80c64f
JH
16886pmake='$pmake'
16887pr='$pr'
b4eb6b3d
JH
16888prefix='$prefix'
16889prefixexp='$prefixexp'
16890privlib='$privlib'
16891privlibexp='$privlibexp'
16892prototype='$prototype'
16893ptrsize='$ptrsize'
16894quadkind='$quadkind'
16895quadtype='$quadtype'
16896randbits='$randbits'
16897randfunc='$randfunc'
16898randseedtype='$randseedtype'
16899ranlib='$ranlib'
16900rd_nodata='$rd_nodata'
16901revision='$revision'
5f80c64f
JH
16902rm='$rm'
16903rmail='$rmail'
16904runnm='$runnm'
b4eb6b3d
JH
16905sPRIEUldbl='$sPRIEUldbl'
16906sPRIFUldbl='$sPRIFUldbl'
16907sPRIGUldbl='$sPRIGUldbl'
16908sPRIXU64='$sPRIXU64'
16909sPRId64='$sPRId64'
16910sPRIeldbl='$sPRIeldbl'
16911sPRIfldbl='$sPRIfldbl'
16912sPRIgldbl='$sPRIgldbl'
16913sPRIi64='$sPRIi64'
16914sPRIo64='$sPRIo64'
16915sPRIu64='$sPRIu64'
16916sPRIx64='$sPRIx64'
16917sSCNfldbl='$sSCNfldbl'
16918sched_yield='$sched_yield'
16919scriptdir='$scriptdir'
16920scriptdirexp='$scriptdirexp'
5f80c64f 16921sed='$sed'
b4eb6b3d
JH
16922seedfunc='$seedfunc'
16923selectminbits='$selectminbits'
16924selecttype='$selecttype'
5f80c64f
JH
16925sendmail='$sendmail'
16926sh='$sh'
16927shar='$shar'
16928sharpbang='$sharpbang'
b4eb6b3d
JH
16929shmattype='$shmattype'
16930shortsize='$shortsize'
16931shrpenv='$shrpenv'
5f80c64f 16932shsharp='$shsharp'
b4eb6b3d
JH
16933sig_count='$sig_count'
16934sig_name='$sig_name'
16935sig_name_init='$sig_name_init'
16936sig_num='$sig_num'
16937sig_num_init='$sig_num_init'
76d3c696 16938sig_size='$sig_size'
b4eb6b3d
JH
16939signal_t='$signal_t'
16940sitearch='$sitearch'
16941sitearchexp='$sitearchexp'
16942sitebin='$sitebin'
16943sitebinexp='$sitebinexp'
16944sitelib='$sitelib'
16945sitelib_stem='$sitelib_stem'
16946sitelibexp='$sitelibexp'
16947siteprefix='$siteprefix'
16948siteprefixexp='$siteprefixexp'
16949sizesize='$sizesize'
16950sizetype='$sizetype'
5f80c64f
JH
16951sleep='$sleep'
16952smail='$smail'
5f80c64f 16953so='$so'
b4eb6b3d
JH
16954sockethdr='$sockethdr'
16955socketlib='$socketlib'
16956socksizetype='$socksizetype'
5f80c64f
JH
16957sort='$sort'
16958spackage='$spackage'
16959spitshell='$spitshell'
5f80c64f 16960src='$src'
b4eb6b3d
JH
16961ssizetype='$ssizetype'
16962startperl='$startperl'
5f80c64f 16963startsh='$startsh'
b4eb6b3d
JH
16964static_ext='$static_ext'
16965stdchar='$stdchar'
16966stdio_base='$stdio_base'
16967stdio_bufsiz='$stdio_bufsiz'
16968stdio_cnt='$stdio_cnt'
16969stdio_filbuf='$stdio_filbuf'
16970stdio_ptr='$stdio_ptr'
16971stdio_stream_array='$stdio_stream_array'
16972strings='$strings'
5f80c64f 16973submit='$submit'
b4eb6b3d
JH
16974subversion='$subversion'
16975sysman='$sysman'
5f80c64f
JH
16976tail='$tail'
16977tar='$tar'
16978tbl='$tbl'
16979tee='$tee'
16980test='$test'
b4eb6b3d
JH
16981timeincl='$timeincl'
16982timetype='$timetype'
5f80c64f
JH
16983touch='$touch'
16984tr='$tr'
16985trnl='$trnl'
16986troff='$troff'
b4eb6b3d
JH
16987u16size='$u16size'
16988u16type='$u16type'
16989u32size='$u32size'
16990u32type='$u32type'
16991u64size='$u64size'
16992u64type='$u64type'
16993u8size='$u8size'
16994u8type='$u8type'
16995uidformat='$uidformat'
16996uidsign='$uidsign'
16997uidsize='$uidsize'
16998uidtype='$uidtype'
5f80c64f
JH
16999uname='$uname'
17000uniq='$uniq'
b4eb6b3d
JH
17001uquadtype='$uquadtype'
17002use5005threads='$use5005threads'
17003use64bitall='$use64bitall'
17004use64bitint='$use64bitint'
5f80c64f 17005usedl='$usedl'
b4eb6b3d
JH
17006useithreads='$useithreads'
17007uselargefiles='$uselargefiles'
17008uselongdouble='$uselongdouble'
17009usemorebits='$usemorebits'
17010usemultiplicity='$usemultiplicity'
17011usemymalloc='$usemymalloc'
5f80c64f 17012usenm='$usenm'
b4eb6b3d
JH
17013useopcode='$useopcode'
17014useperlio='$useperlio'
17015useposix='$useposix'
17016usesfio='$usesfio'
17017useshrplib='$useshrplib'
29209bc5 17018usesocks='$usesocks'
b4eb6b3d
JH
17019usethreads='$usethreads'
17020usevendorprefix='$usevendorprefix'
17021usevfork='$usevfork'
5f80c64f
JH
17022usrinc='$usrinc'
17023uuname='$uuname'
b4eb6b3d
JH
17024uvXUformat='$uvXUformat'
17025uvoformat='$uvoformat'
17026uvsize='$uvsize'
17027uvtype='$uvtype'
17028uvuformat='$uvuformat'
17029uvxformat='$uvxformat'
17030vendorarch='$vendorarch'
17031vendorarchexp='$vendorarchexp'
17032vendorbin='$vendorbin'
17033vendorbinexp='$vendorbinexp'
17034vendorlib='$vendorlib'
17035vendorlib_stem='$vendorlib_stem'
17036vendorlibexp='$vendorlibexp'
17037vendorprefix='$vendorprefix'
17038vendorprefixexp='$vendorprefixexp'
17039version='$version'
d56c5707 17040versiononly='$versiononly'
5f80c64f 17041vi='$vi'
b4eb6b3d 17042voidflags='$voidflags'
5f80c64f 17043xlibpth='$xlibpth'
b4eb6b3d 17044xs_apiversion='$xs_apiversion'
3659ebf1
JH
17045yacc='$yacc'
17046yaccflags='$yaccflags'
5f80c64f
JH
17047zcat='$zcat'
17048zip='$zip'
17049EOT
17050
17051: Add in command line options if available
17052$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
17053
17054: add special variables
17055$test -f $src/patchlevel.h && \
d00b958f 17056awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 17057echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 17058echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
17059
17060: propagate old symbols
17061if $test -f UU/config.sh; then
381aa1ff 17062 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 17063 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 17064 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
17065 set X `cat UU/oldsyms`
17066 shift
17067 case $# in
17068 0) ;;
17069 *)
17070 cat <<EOM
17071Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
17072EOM
17073 echo "# Variables propagated from previous config.sh file." >>config.sh
17074 for sym in `cat UU/oldsyms`; do
17075 echo " Propagating $hint variable "'$'"$sym..."
17076 eval 'tmp="$'"${sym}"'"'
17077 echo "$tmp" | \
17078 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
17079 done
17080 ;;
17081 esac
17082fi
17083
17084: Finish up by extracting the .SH files
17085case "$alldone" in
17086exit)
17087 $rm -rf UU
24ccb310 17088 echo "Extraction done."
5f80c64f
JH
17089 exit 0
17090 ;;
17091cont)
17092 ;;
17093'')
17094 dflt=''
17095 nostick=true
17096 $cat <<EOM
17097
17098If you'd like to make any changes to the config.sh file before I begin
17099to configure things, do it as a shell escape now (e.g. !vi config.sh).
17100
17101EOM
17102 rp="Press return or use a shell escape to edit config.sh:"
17103 . UU/myread
17104 nostick=''
17105 case "$ans" in
17106 '') ;;
17107 *) : in case they cannot read
17108 sh 1>&4 -c "$ans";;
17109 esac
17110 ;;
17111esac
17112
17113: if this fails, just run all the .SH files by hand
17114. ./config.sh
17115
17116echo " "
17117exec 1>&4
17118. ./UU/extract
17119
17120if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
17121 dflt=y
17122 case "$silent" in
17123 true) ;;
17124 *)
17125 $cat <<EOM
17126
17127Now you need to generate make dependencies by running "$make depend".
17128You might prefer to run it in background: "$make depend > makedepend.out &"
17129It can take a while, so you might not want to run it right now.
17130
17131EOM
17132 ;;
17133 esac
17134 rp="Run $make depend now?"
17135 . UU/myread
17136 case "$ans" in
17137 y*)
3d5d58b1 17138 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
17139 ;;
17140 *)
17141 echo "You must run '$make depend' then '$make'."
17142 ;;
17143 esac
17144elif test -f [Mm]akefile; then
17145 echo " "
17146 echo "Now you must run a $make."
17147else
24ccb310 17148 echo "Configure done."
5f80c64f
JH
17149fi
17150
17151if $test -f Policy.sh; then
17152 $cat <<EOM
17153
17154If you compile $package on a different machine or from a different object
17155directory, copy the Policy.sh file from this object directory to the
17156new one before you run Configure -- this will help you with most of
17157the policy defaults.
17158
17159EOM
17160fi
17161if $test -f config.msg; then
17162 echo "Hmm. I also noted the following information while running:"
17163 echo " "
17164 $cat config.msg >&4
17165 $rm -f config.msg
17166fi
17167$rm -f kit*isdone ark*isdone
17168$rm -rf UU
17169
17170: End of Configure
17171