This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
(Retracted by #10073)
[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#
e4778687 23# Generated on Tue May 8 22:11:56 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
JH
275afs=''
276alignbytes=''
277ansi2knr=''
278archlib=''
279archlibexp=''
280d_archlib=''
281installarchlib=''
282archname=''
283myarchname=''
284d_atolf=''
285d_atoll=''
286baserev=''
287bin=''
288binexp=''
289installbin=''
290bincompat5005=''
291d_bincompat5005=''
292byteorder=''
2304df62 293cc=''
2304df62
AD
294ccflags=''
295cppflags=''
296ldflags=''
297lkflags=''
8e07c86e 298locincpth=''
2304df62 299optimize=''
b4eb6b3d 300cf_email=''
2304df62
AD
301cf_by=''
302cf_time=''
b4eb6b3d 303charsize=''
2304df62 304contains=''
b4eb6b3d 305cpp_stuff=''
2304df62
AD
306cpplast=''
307cppminus=''
308cpprun=''
309cppstdin=''
b4eb6b3d 310crosscompile=''
74cac757 311d__fwalk=''
b4eb6b3d
JH
312d_access=''
313d_accessx=''
314d_alarm=''
315d_attribut=''
316d_bcmp=''
317d_bcopy=''
318d_bzero=''
319d_casti32=''
320castflags=''
321d_castneg=''
322d_chown=''
323d_chroot=''
324d_chsize=''
325d_closedir=''
326d_void_closedir=''
4e0554ec 327d_cmsghdr_s=''
b4eb6b3d
JH
328d_const=''
329cryptlib=''
330d_crypt=''
331d_csh=''
332full_csh=''
333d_cuserid=''
334d_dbl_dig=''
335d_difftime=''
336d_dlerror=''
a0d0e21e 337d_dlopen=''
b4eb6b3d
JH
338d_dlsymun=''
339d_dosuid=''
340d_suidsafe=''
341d_drand48proto=''
342d_dup2=''
343d_eaccess=''
344d_endgrent=''
345d_endhent=''
346d_endnent=''
347d_endpent=''
348d_endpwent=''
349d_endsent=''
350d_fchmod=''
351d_fchown=''
352d_fcntl=''
9d9004a9 353d_fcntl_can_lock=''
b4eb6b3d
JH
354d_fd_macros=''
355d_fd_set=''
356d_fds_bits=''
357d_fgetpos=''
358d_flexfnam=''
359d_flock=''
360d_fork=''
361d_fpos64_t=''
362d_frexpl=''
363d_fs_data_s=''
364d_fseeko=''
365d_fsetpos=''
366d_fstatfs=''
411ab01c 367d_fsync=''
b4eb6b3d
JH
368d_ftello=''
369d_ftime=''
370d_gettimeod=''
371d_Gconvert=''
372d_getcwd=''
373d_getespwnam=''
374d_getfsstat=''
375d_getgrent=''
376d_getgrps=''
377d_gethbyaddr=''
378d_gethbyname=''
379d_gethent=''
380aphostname=''
381d_gethname=''
382d_phostname=''
383d_uname=''
384d_gethostprotos=''
4e0554ec 385d_getitimer=''
b4eb6b3d
JH
386d_getlogin=''
387d_getmnt=''
388d_getmntent=''
389d_getnbyaddr=''
390d_getnbyname=''
391d_getnent=''
392d_getnetprotos=''
0c0643d0 393d_getpagsz=''
b4eb6b3d
JH
394d_getpent=''
395d_getpgid=''
396d_getpgrp2=''
397d_bsdgetpgrp=''
398d_getpgrp=''
399d_getppid=''
400d_getprior=''
401d_getpbyname=''
402d_getpbynumber=''
403d_getprotoprotos=''
404d_getprpwnam=''
405d_getpwent=''
406d_getsent=''
407d_getservprotos=''
408d_getspnam=''
409d_getsbyname=''
410d_getsbyport=''
a4f3eea9 411d_gnulibc=''
b4eb6b3d
JH
412d_hasmntopt=''
413d_htonl=''
414d_iconv=''
415d_inetaton=''
416d_int64_t=''
417d_isascii=''
418d_isnan=''
419d_isnanl=''
420d_killpg=''
421d_lchown=''
422d_ldbl_dig=''
423d_link=''
424d_locconv=''
425d_lockf=''
426d_longdbl=''
427longdblsize=''
428d_longlong=''
429longlongsize=''
430d_lseekproto=''
431d_lstat=''
432d_madvise=''
433d_mblen=''
434d_mbstowcs=''
435d_mbtowc=''
436d_memchr=''
437d_memcmp=''
438d_memcpy=''
439d_memmove=''
440d_memset=''
441d_mkdir=''
442d_mkdtemp=''
443d_mkfifo=''
444d_mkstemp=''
445d_mkstemps=''
446d_mktime=''
447d_mmap=''
448mmaptype=''
449d_modfl=''
450d_mprotect=''
451d_msg=''
452d_msgctl=''
453d_msgget=''
4e0554ec 454d_msghdr_s=''
b4eb6b3d
JH
455d_msgrcv=''
456d_msgsnd=''
457d_msync=''
458d_munmap=''
459d_nice=''
460d_off64_t=''
461d_open3=''
462d_fpathconf=''
463d_pathconf=''
464d_pause=''
465d_pipe=''
466d_poll=''
2304df62 467d_portable=''
b4eb6b3d
JH
468d_old_pthread_create_joinable=''
469old_pthread_create_joinable=''
470d_pthread_yield=''
471d_sched_yield=''
472sched_yield=''
473d_qgcvt=''
474d_readdir=''
475d_rewinddir=''
476d_seekdir=''
477d_telldir=''
478d_readlink=''
4e0554ec
JH
479d_readv=''
480d_recvmsg=''
b4eb6b3d
JH
481d_rename=''
482d_rmdir=''
483d_safebcpy=''
484d_safemcpy=''
485d_sanemcmp=''
ef9f17be 486d_sbrkproto=''
b4eb6b3d
JH
487d_select=''
488d_sem=''
489d_semctl=''
490d_semget=''
491d_semop=''
4e0554ec 492d_sendmsg=''
b4eb6b3d
JH
493d_setegid=''
494d_seteuid=''
495d_setgrent=''
496d_setgrps=''
497d_sethent=''
4e0554ec 498d_setitimer=''
b4eb6b3d
JH
499d_setlinebuf=''
500d_setlocale=''
501d_setnent=''
502d_setpent=''
503d_setpgid=''
504d_setpgrp2=''
505d_bsdsetpgrp=''
506d_setpgrp=''
507d_setprior=''
508d_setproctitle=''
509d_setpwent=''
510d_setregid=''
511d_setresgid=''
512d_setresuid=''
513d_setreuid=''
514d_setrgid=''
515d_setruid=''
516d_setsent=''
517d_setsid=''
518d_setvbuf=''
519d_sfio=''
520usesfio=''
521d_shm=''
522d_shmat=''
523d_shmatprototype=''
524shmattype=''
525d_shmctl=''
526d_shmdt=''
527d_shmget=''
528d_sigaction=''
983dbef6 529d_sigprocmask=''
b4eb6b3d 530d_sigsetjmp=''
49a78c82 531d_sockatmark=''
b4eb6b3d
JH
532d_msg_ctrunc=''
533d_msg_dontroute=''
534d_msg_oob=''
535d_msg_peek=''
536d_msg_proxy=''
537d_oldsock=''
538d_scm_rights=''
539d_socket=''
540d_sockpair=''
541sockethdr=''
542socketlib=''
543d_socklen_t=''
544d_socks5_init=''
545d_sqrtl=''
546d_statblks=''
547d_statfs_f_flags=''
548d_statfs_s=''
549d_fstatvfs=''
550d_statvfs=''
551d_stdio_cnt_lval=''
552d_stdio_ptr_lval=''
a7ffa9b9
NC
553d_stdio_ptr_lval_nochange_cnt=''
554d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
555d_stdiobase=''
556d_stdstdio=''
557stdio_base=''
558stdio_bufsiz=''
559stdio_cnt=''
560stdio_filbuf=''
561stdio_ptr=''
562d_index=''
563d_strchr=''
564d_strcoll=''
565d_strctcpy=''
566d_strerrm=''
567d_strerror=''
568d_sysernlst=''
569d_syserrlst=''
b3c85772 570d_strftime=''
b4eb6b3d
JH
571d_strtod=''
572d_strtol=''
573d_strtold=''
574d_strtoll=''
28e5dec8 575d_strtoq=''
b4eb6b3d
JH
576d_strtoul=''
577d_strtoull=''
578d_strtouq=''
579d_strxfrm=''
580d_symlink=''
581d_syscall=''
582d_sysconf=''
583d_system=''
584d_tcgetpgrp=''
585d_tcsetpgrp=''
586d_telldirproto=''
587d_time=''
588timetype=''
589clocktype=''
590d_times=''
591d_truncate=''
592d_tzname=''
4e0554ec
JH
593d_u32align=''
594d_ualarm=''
b4eb6b3d
JH
595d_umask=''
596d_semctl_semid_ds=''
597d_semctl_semun=''
598d_union_semun=''
4e0554ec 599d_usleep=''
b4eb6b3d
JH
600d_ustat=''
601d_vfork=''
602usevfork=''
603d_voidsig=''
604signal_t=''
605d_volatile=''
606d_charvspr=''
607d_vprintf=''
608d_wait4=''
609d_waitpid=''
610d_wcstombs=''
611d_wctomb=''
4e0554ec 612d_writev=''
b4eb6b3d 613dlext=''
85e6fe83
LW
614cccdlflags=''
615ccdlflags=''
2304df62 616dlsrc=''
232e078e 617ld=''
85e6fe83 618lddlflags=''
2304df62 619usedl=''
b4eb6b3d
JH
620doublesize=''
621ebcdic=''
622fflushNULL=''
623fflushall=''
624fpossize=''
625fpostype=''
5b463ca7 626gccosandvers=''
8a27cf78 627gccversion=''
b4eb6b3d
JH
628gidformat=''
629gidsign=''
630gidsize=''
631gidtype=''
632groupstype=''
633h_fcntl=''
634h_sysfile=''
635i_arpainet=''
636db_hashtype=''
637db_prefixtype=''
638i_db=''
639i_dbm=''
640i_rpcsvcdbm=''
641d_dirnamlen=''
642direntrytype=''
643i_dirent=''
a0d0e21e 644i_dld=''
b4eb6b3d
JH
645i_dlfcn=''
646i_fcntl=''
647i_float=''
648i_gdbm=''
649d_grpasswd=''
650i_grp=''
651i_iconv=''
652i_ieeefp=''
653i_inttypes=''
654i_libutil=''
655i_limits=''
656i_locale=''
657i_machcthr=''
658i_malloc=''
659i_math=''
660i_memory=''
661i_mntent=''
662i_ndbm=''
663i_netdb=''
664i_neterrno=''
665i_netinettcp=''
666i_niin=''
667i_sysin=''
668i_poll=''
669i_prot=''
670i_pthread=''
671d_pwage=''
672d_pwchange=''
673d_pwclass=''
674d_pwcomment=''
675d_pwexpire=''
676d_pwgecos=''
677d_pwpasswd=''
678d_pwquota=''
679i_pwd=''
680i_sfio=''
681i_shadow=''
682i_socks=''
683i_stddef=''
684i_stdlib=''
685i_string=''
686strings=''
687i_sunmath=''
688i_sysaccess=''
689i_sysdir=''
690i_sysfile=''
691d_voidtty=''
692i_bsdioctl=''
693i_sysfilio=''
694i_sysioctl=''
695i_syssockio=''
696i_syslog=''
697i_sysmman=''
698i_sysmode=''
699i_sysmount=''
700i_sysndir=''
701i_sysparam=''
702i_sysresrc=''
703i_syssecrt=''
704i_sysselct=''
705i_sysstat=''
706i_sysstatfs=''
707i_sysstatvfs=''
708i_systimes=''
709i_systypes=''
710i_sysuio=''
711i_sysun=''
712i_sysutsname=''
713i_sysvfs=''
714i_syswait=''
715i_sgtty=''
716i_termio=''
717i_termios=''
718i_systime=''
719i_systimek=''
720i_time=''
721timeincl=''
722i_unistd=''
723i_ustat=''
724i_utime=''
725i_values=''
726i_stdarg=''
727i_varargs=''
728i_varhdr=''
729i_vfork=''
730inc_version_list=''
731inc_version_list_init=''
732installprefix=''
733installprefixexp=''
734installstyle=''
735installusrbinperl=''
736intsize=''
737longsize=''
738shortsize=''
4b661809 739issymlink=''
2304df62 740libc=''
b4eb6b3d
JH
741ldlibpthname=''
742libperl=''
743shrpenv=''
744useshrplib=''
a0d0e21e 745glibpth=''
2304df62 746libpth=''
8e07c86e 747loclibpth=''
2304df62
AD
748plibpth=''
749xlibpth=''
1cfa4ec7 750ignore_versioned_solibs=''
2304df62 751libs=''
43999f95
JH
752libsdirs=''
753libsfiles=''
754libsfound=''
13b3f787 755libspath=''
85e6fe83 756lns=''
b4eb6b3d
JH
757d_PRIEUldbl=''
758d_PRIFUldbl=''
759d_PRIGUldbl=''
760d_PRIeldbl=''
761d_PRIfldbl=''
762d_PRIgldbl=''
763d_SCNfldbl=''
764sPRIEUldbl=''
765sPRIFUldbl=''
766sPRIGUldbl=''
767sPRIeldbl=''
768sPRIfldbl=''
769sPRIgldbl=''
770sSCNfldbl=''
771lseeksize=''
772lseektype=''
8ff267be 773make_set_make=''
b4eb6b3d
JH
774d_mymalloc=''
775freetype=''
776mallocobj=''
777mallocsrc=''
778malloctype=''
779usemymalloc=''
780installman1dir=''
781man1dir=''
782man1direxp=''
783man1ext=''
784installman3dir=''
785man3dir=''
786man3direxp=''
787man3ext=''
788modetype=''
789multiarch=''
790mydomain=''
791myhostname=''
792phostname=''
2304df62
AD
793c=''
794n=''
b4eb6b3d
JH
795d_eofnblk=''
796eagain=''
797o_nonblock=''
798rd_nodata=''
2cc61e15 799need_va_copy=''
b4eb6b3d
JH
800netdb_hlen_type=''
801netdb_host_type=''
802netdb_name_type=''
803netdb_net_type=''
804groupcat=''
805hostcat=''
806passcat=''
807orderlib=''
808ranlib=''
809d_perl_otherlibdirs=''
810otherlibdirs=''
2304df62
AD
811package=''
812spackage=''
b4eb6b3d
JH
813pager=''
814api_revision=''
815api_subversion=''
816api_version=''
817api_versionstring=''
818patchlevel=''
819revision=''
820subversion=''
821version=''
822perl5=''
823perladmin=''
824perlpath=''
825d_nv_preserves_uv=''
826d_nv_preserves_uv_bits=''
827i16size=''
828i16type=''
829i32size=''
830i32type=''
831i64size=''
832i64type=''
833i8size=''
834i8type=''
835ivsize=''
836ivtype=''
837nvsize=''
838nvtype=''
839u16size=''
840u16type=''
841u32size=''
842u32type=''
843u64size=''
844u64type=''
845u8size=''
846u8type=''
847uvsize=''
848uvtype=''
849ivdformat=''
850nvEUformat=''
851nvFUformat=''
852nvGUformat=''
853nveformat=''
854nvfformat=''
855nvgformat=''
856uvXUformat=''
857uvoformat=''
858uvuformat=''
859uvxformat=''
860pidtype=''
861prefix=''
862prefixexp=''
863installprivlib=''
864privlib=''
865privlibexp=''
866prototype=''
867ptrsize=''
868d_PRIXU64=''
869d_PRId64=''
870d_PRIi64=''
871d_PRIo64=''
872d_PRIu64=''
873d_PRIx64=''
874sPRIXU64=''
875sPRId64=''
876sPRIi64=''
877sPRIo64=''
878sPRIu64=''
879sPRIx64=''
880d_quad=''
881quadkind=''
882quadtype=''
883uquadtype=''
884drand01=''
885randbits=''
886randfunc=''
887randseedtype=''
888seedfunc=''
889installscript=''
890scriptdir=''
891scriptdirexp=''
892selectminbits=''
893selecttype=''
8ff267be 894sh=''
b4eb6b3d
JH
895sig_count=''
896sig_name=''
897sig_name_init=''
898sig_num=''
899sig_num_init=''
76d3c696 900sig_size=''
b4eb6b3d
JH
901installsitearch=''
902sitearch=''
903sitearchexp=''
904installsitebin=''
905sitebin=''
906sitebinexp=''
907installsitelib=''
908sitelib=''
909sitelib_stem=''
910sitelibexp=''
911siteprefix=''
912siteprefixexp=''
913sizesize=''
914sizetype=''
a0d0e21e 915so=''
b4eb6b3d 916socksizetype=''
2304df62
AD
917sharpbang=''
918shsharp=''
919spitshell=''
dfe9444c 920src=''
b4eb6b3d
JH
921ssizetype=''
922startperl=''
2304df62 923startsh=''
b4eb6b3d
JH
924stdchar=''
925d_stdio_stream_array=''
926stdio_stream_array=''
927sysman=''
5ff3f7a4 928trnl=''
b4eb6b3d
JH
929uidformat=''
930uidsign=''
931uidsize=''
932uidtype=''
933archname64=''
934use64bitall=''
935use64bitint=''
936ccflags_uselargefiles=''
937ldflags_uselargefiles=''
938libswanted_uselargefiles=''
939uselargefiles=''
940uselongdouble=''
941usemorebits=''
942usemultiplicity=''
2304df62 943nm_opt=''
40a7a20a 944nm_so_opt=''
2304df62
AD
945runnm=''
946usenm=''
b4eb6b3d 947useperlio=''
29209bc5 948usesocks=''
b4eb6b3d
JH
949d_oldpthreads=''
950use5005threads=''
951useithreads=''
952usethreads=''
2304df62 953incpath=''
2304df62
AD
954mips_type=''
955usrinc=''
b4eb6b3d
JH
956d_vendorarch=''
957installvendorarch=''
958vendorarch=''
959vendorarchexp=''
960d_vendorbin=''
961installvendorbin=''
962vendorbin=''
963vendorbinexp=''
964d_vendorlib=''
965installvendorlib=''
966vendorlib=''
967vendorlib_stem=''
968vendorlibexp=''
969usevendorprefix=''
970vendorprefix=''
971vendorprefixexp=''
d56c5707 972versiononly=''
b4eb6b3d
JH
973defvoidused=''
974voidflags=''
975pm_apiversion=''
976xs_apiversion=''
3659ebf1
JH
977yacc=''
978yaccflags=''
2304df62
AD
979CONFIG=''
980
ecfc5424
AD
981define='define'
982undef='undef'
983smallmach='pdp11 i8086 z8000 i80286 iAPX286'
984rmlist=''
985
986: We must find out about Eunice early
987eunicefix=':'
988if test -f /etc/unixtovms; then
989 eunicefix=/etc/unixtovms
990fi
991if test -f /etc/unixtovms.exe; then
992 eunicefix=/etc/unixtovms.exe
993fi
994
b4eb6b3d 995i_whoami=''
6b356c8e
JH
996ccname=''
997ccversion=''
9c839522 998perllibs=''
b4eb6b3d
JH
999: set useposix=false in your hint file to disable the POSIX extension.
1000useposix=true
1001: set useopcode=false in your hint file to disable the Opcode extension.
1002useopcode=true
dfe9444c 1003: Trailing extension. Override this in a hint file, if needed.
4e2a5f63 1004_exe=''
dfe9444c
AD
1005: Extra object files, if any, needed on this platform.
1006archobjs=''
b4eb6b3d 1007archname=''
ff935051
JH
1008: Possible local include directories to search.
1009: Set locincpth to "" in a hint file to defeat local include searches.
1010locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1011locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1012:
1013: no include file wanted by default
1014inclwanted=''
1015
b4eb6b3d 1016groupstype=''
732c9516
JH
1017: change the next line if compiling for Xenix/286 on Xenix/386
1018xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1019: Possible local library directories to search.
1020loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1021loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1022
1023: general looking path for locating libraries
5869b1f1 1024glibpth="/lib /usr/lib $xlibpth"
732c9516 1025glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1026test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1027test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1028
1029: Private path used by Configure to find libraries. Its value
1030: is prepended to libpth. This variable takes care of special
1031: machines, like the mips. Usually, it should be empty.
1032plibpth=''
1033
1cfa4ec7
GS
1034: default library list
1035libswanted=''
921b2963 1036: some systems want to use only the non-versioned libso:s
1cfa4ec7 1037ignore_versioned_solibs=''
b4eb6b3d
JH
1038archname64=''
1039ccflags_uselargefiles=''
1040ldflags_uselargefiles=''
1041libswanted_uselargefiles=''
1042: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1043: set usesocks on the Configure command line to enable socks.
b4eb6b3d
JH
1044: set usethreads on the Configure command line to enable threads.
1045: full support for void wanted by default
1046defvoidused=15
1047
ecfc5424 1048: List of libraries we want.
693762b4 1049: If anyone needs -lnet, put it in a hint file.
997d70a2 1050libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
69e84d1d 1051libswanted="$libswanted dld ld sun m c cposix posix"
f1066039 1052libswanted="$libswanted ndir dir crypt sec"
0c9177ab 1053libswanted="$libswanted ucb bsd BSD PW x iconv util"
1aef975c 1054: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1055: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1056glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1057glibpth="/usr/shlib $glibpth"
1058: Do not use vfork unless overridden by a hint file.
1059usevfork=false
1060
8ff267be 1061: Find the basic shell for Bourne shell scripts
1062case "$sh" in
1063'')
8ff267be 1064 case "$SYSTYPE" in
1065 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1066 *) xxx='/bin/sh';;
1067 esac
1068 if test -f "$xxx"; then
1069 sh="$xxx"
1070 else
1071 : Build up a list and do a single loop so we can 'break' out.
1072 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1073 for xxx in sh bash ksh pdksh ash; do
1074 for p in $pth; do
1075 try="$try ${p}/${xxx}"
1076 done
1077 done
1078 for xxx in $try; do
1079 if test -f "$xxx"; then
1080 sh="$xxx";
8ff267be 1081 break
1082 elif test -f "$xxx.exe"; then
1083 sh="$xxx";
8ff267be 1084 break
1085 fi
1086 done
1087 fi
1088 ;;
1089esac
1090
1091case "$sh" in
1092'') cat <<EOM >&2
1093$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1094
8ff267be 1095Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1096Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1097we'll try to straighten this all out.
8ff267be 1098EOM
1099 exit 1
1100 ;;
1101esac
1102
760ac839 1103: see if sh knows # comments
73614538 1104if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1105 shsharp=true
1106 spitshell=cat
760ac839
LW
1107 xcat=/bin/cat
1108 test -f $xcat || xcat=/usr/bin/cat
1109 echo "#!$xcat" >try
1110 $eunicefix try
1111 chmod +x try
1112 ./try > today
1113 if test -s today; then
760ac839
LW
1114 sharpbang='#!'
1115 else
1116 echo "#! $xcat" > try
1117 $eunicefix try
1118 chmod +x try
1119 ./try > today
1120 if test -s today; then
760ac839
LW
1121 sharpbang='#! '
1122 else
760ac839
LW
1123 sharpbang=': use '
1124 fi
1125 fi
1126else
dfe9444c 1127 echo " "
8ff267be 1128 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1129 shsharp=false
1130 cd ..
1131 echo "exec grep -v '^[ ]*#'" >spitshell
1132 chmod +x spitshell
1133 $eunicefix spitshell
1134 spitshell=`pwd`/spitshell
1135 cd UU
1136 echo "I presume that if # doesn't work, #! won't work either!"
1137 sharpbang=': use '
1138fi
1139rm -f try today
1140
1141: figure out how to guarantee sh startup
8ff267be 1142case "$startsh" in
1143'') startsh=${sharpbang}${sh} ;;
1144*)
760ac839 1145esac
760ac839
LW
1146cat >try <<EOSS
1147$startsh
1148set abc
1149test "$?abc" != 1
1150EOSS
1151
1152chmod +x try
1153$eunicefix try
1154if ./try; then
8ff267be 1155 : echo "Yup, it does."
760ac839 1156else
dfe9444c
AD
1157 echo "Hmm... '$startsh' does not guarantee sh startup..."
1158 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839
LW
1159fi
1160rm -f try
1161
aebf16e7
AD
1162
1163: Save command line options in file UU/cmdline.opt for later use in
1164: generating config.sh.
1165cat > cmdline.opt <<EOSH
1166# Configure command line arguments.
1167config_arg0='$0'
1168config_args='$*'
1169config_argc=$#
1170EOSH
1171argn=1
1172for arg in "$@"; do
1173 cat >>cmdline.opt <<EOSH
1174config_arg$argn='$arg'
1175EOSH
1176 argn=`expr $argn + 1`
1177done
1178
2304df62
AD
1179: produce awk script to parse command line options
1180cat >options.awk <<'EOF'
1181BEGIN {
02e93a22 1182 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1183
1184 len = length(optstr);
1185 for (i = 1; i <= len; i++) {
1186 c = substr(optstr, i, 1);
1187 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1188 if (a == ":") {
1189 arg[c] = 1;
1190 i++;
1191 }
1192 opt[c] = 1;
1193 }
1194}
1195{
1196 expect = 0;
1197 str = $0;
1198 if (substr(str, 1, 1) != "-") {
1199 printf("'%s'\n", str);
1200 next;
1201 }
1202 len = length($0);
1203 for (i = 2; i <= len; i++) {
1204 c = substr(str, i, 1);
1205 if (!opt[c]) {
1206 printf("-%s\n", substr(str, i));
1207 next;
1208 }
1209 printf("-%s\n", c);
1210 if (arg[c]) {
1211 if (i < len)
1212 printf("'%s'\n", substr(str, i + 1));
1213 else
1214 expect = 1;
1215 next;
1216 }
1217 }
1218}
1219END {
1220 if (expect)
1221 print "?";
1222}
1223EOF
1224
1225: process the command line options
4633a7c4
LW
1226set X `for arg in "$@"; do echo "X$arg"; done |
1227 sed -e s/X// | awk -f options.awk`
2304df62
AD
1228eval "set $*"
1229shift
1230rm -f options.awk
1231
1232: set up default values
1233fastread=''
1234reuseval=false
1235config_sh=''
1236alldone=''
1237error=''
1238silent=''
1239extractsh=''
ecfc5424 1240override=''
16d20bd9 1241knowitall=''
02e93a22 1242rm -f optdef.sh posthint.sh
28757baa 1243cat >optdef.sh <<EOS
1244$startsh
1245EOS
2304df62 1246
dfe9444c 1247
2304df62
AD
1248: option parsing
1249while test $# -gt 0; do
1250 case "$1" in
1251 -d) shift; fastread=yes;;
1252 -e) shift; alldone=cont;;
1253 -f)
1254 shift
1255 cd ..
1256 if test -r "$1"; then
1257 config_sh="$1"
1258 else
a0d0e21e 1259 echo "$me: cannot read config file $1." >&2
2304df62
AD
1260 error=true
1261 fi
1262 cd UU
1263 shift;;
1264 -h) shift; error=true;;
1265 -r) shift; reuseval=true;;
dfe9444c 1266 -s) shift; silent=true; realsilent=true;;
2304df62 1267 -E) shift; alldone=exit;;
16d20bd9 1268 -K) shift; knowitall=true;;
ecfc5424 1269 -O) shift; override=true;;
dfe9444c 1270 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1271 -D)
1272 shift
1273 case "$1" in
1274 *=)
1275 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1276 echo "$me: ignoring -D $1" >&2
1277 ;;
ecfc5424 1278 *=*) echo "$1" | \
1aef975c
AD
1279 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1280 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1281 esac
1282 shift
1283 ;;
1284 -U)
1285 shift
1286 case "$1" in
1aef975c 1287 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1288 *=*)
1289 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1290 echo "$me: ignoring -U $1" >&2
1291 ;;
1aef975c 1292 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1293 esac
1294 shift
1295 ;;
02e93a22
JH
1296 -A)
1297 shift
1298 xxx=''
1299 yyy="$1"
02e93a22 1300 zzz=''
5f83a3e9 1301 uuu=undef
02e93a22 1302 case "$yyy" in
5f83a3e9
JH
1303 *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1304 case "$zzz" in
1305 *:*) zzz='' ;;
1306 *) xxx=append
1307 zzz=" "`echo $yyy|sed 's!^[^=]*=!!'`
1308 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1309 esac
1310 ;;
1311 esac
1312 case "$xxx" in
1313 '') case "$yyy" in
1314 *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1315 yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1316 zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1317 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1318 *) xxx=`echo $yyy|sed 's!:.*!!'`
1319 yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1320 esac
1321 ;;
1322 esac
02e93a22
JH
1323 case "$xxx" in
1324 append)
5f83a3e9 1325 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1326 clear)
5f83a3e9 1327 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1328 define)
1329 case "$zzz" in
1330 '') zzz=define ;;
1331 esac
5f83a3e9 1332 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1333 eval)
5f83a3e9 1334 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1335 prepend)
5f83a3e9 1336 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1337 undef)
1338 case "$zzz" in
1339 '') zzz="$uuu" ;;
1340 esac
5f83a3e9
JH
1341 echo "$yyy=$zzz" >> posthint.sh ;;
1342 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1343 esac
bde6b06b 1344 shift
02e93a22 1345 ;;
dfe9444c 1346 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1347 exit 0;;
2304df62 1348 --) break;;
a0d0e21e 1349 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1350 *) break;;
1351 esac
1352done
1353
1354case "$error" in
1355true)
1356 cat >&2 <<EOM
2afac517 1357Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1358 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1359 -d : use defaults for all answers.
1360 -e : go on without questioning past the production of config.sh.
1361 -f : specify an alternate default configuration file.
1362 -h : print this help message and exit (with an error status).
1363 -r : reuse C symbols value if possible (skips costly nm extraction).
1364 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1365 -D : define symbol to have some value:
1366 -D symbol symbol gets the value 'define'
1367 -D symbol=value symbol gets the value 'value'
2304df62 1368 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1369 -K : do not use unless you know what you are doing.
ecfc5424 1370 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1371 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1372 -U : undefine symbol:
1373 -U symbol symbol gets the value 'undef'
1374 -U symbol= symbol gets completely empty
02e93a22 1375 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1376 -A symbol=value append " "value to symbol
02e93a22
JH
1377 -A append:symbol=value append value to symbol
1378 -A define:symbol=value define symbol to have value
02e93a22
JH
1379 -A clear:symbol define symbol to be ''
1380 -A define:symbol define symbol to be 'define'
1381 -A eval:symbol=value define symbol to be eval of value
1382 -A prepend:symbol=value prepend value to symbol
1383 -A undef:symbol define symbol to be 'undef'
1384 -A undef:symbol= define symbol to be ''
2304df62
AD
1385 -V : print version number and exit (with a zero status).
1386EOM
1387 exit 1
1388 ;;
1389esac
1390
dfe9444c
AD
1391: Sanity checks
1392case "$fastread$alldone" in
1393yescont|yesexit) ;;
1394*)
aaeb8e51
GS
1395 case "$extractsh" in
1396 true) ;;
1397 *)
1398 if test ! -t 0; then
1399 echo "Say 'sh Configure', not 'sh <Configure'"
1400 exit 1
1401 fi
1402 ;;
1403 esac
dfe9444c
AD
1404 ;;
1405esac
1406
2304df62
AD
1407exec 4>&1
1408case "$silent" in
1409true) exec 1>/dev/null;;
1410esac
1411
ecfc5424 1412: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1413touch optdef.sh
1414. ./optdef.sh
02e93a22
JH
1415: create the posthint manipulation script and leave the file out there...
1416touch posthint.sh
a0d0e21e 1417
2304df62 1418: set package name
85e6fe83 1419package=perl5
b4eb6b3d
JH
1420first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1421last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1422case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1423ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1424*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1425esac
2304df62 1426
2304df62
AD
1427: Some greps do not return status, grrr.
1428echo "grimblepritz" >grimble
1429if grep blurfldyick grimble >/dev/null 2>&1 ; then
1430 contains=contains
1431elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1432 contains=grep
1433else
1434 contains=contains
1435fi
1436rm -f grimble
1437: the following should work in any shell
1438case "$contains" in
1439contains*)
1440 echo " "
1441 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1442 cat >contains <<'EOSS'
1443grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1444EOSS
1445chmod +x contains
1446esac
1447
dfe9444c
AD
1448: Find the path to the source tree
1449case "$src" in
1450'') case "$0" in
b233458b
JH
1451 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1452 case "$src" in
1453 /*) ;;
8504afb7 1454 .) ;;
b233458b
JH
1455 *) src=`cd ../$src && pwd` ;;
1456 esac
1457 ;;
dfe9444c
AD
1458 *) src='.';;
1459 esac;;
1460esac
1461case "$src" in
1462'') src=/
1463 rsrc=/
1464 ;;
1465/*) rsrc="$src";;
1466*) rsrc="../$src";;
1467esac
1468if test -f $rsrc/Configure && \
1469 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1470then
1471 : found it, so we are ok.
1472else
1473 rsrc=''
1474 for src in . .. ../.. ../../.. ../../../..; do
1475 if test -f ../$src/Configure && \
1476 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1477 then
1478 rsrc=../$src
1479 break
1480 fi
1481 done
1482fi
1483case "$rsrc" in
1484'')
1485 cat <<EOM >&4
1486
1487Sorry, I can't seem to locate the source dir for $package. Please start
1488Configure with an explicit path -- i.e. /some/path/Configure.
1489
1490EOM
1491 exit 1
1492 ;;
1493../.) rsrc='..';;
1494*)
1495 echo " "
1496 echo "Sources for $package found in \"$src\"." >&4
1497 ;;
1498esac
1499
1500: script used to extract .SH files with variable substitutions
1501cat >extract <<'EOS'
2000072c 1502CONFIGDOTSH=true
dfe9444c
AD
1503echo "Doing variable substitutions on .SH files..."
1504if test -f $src/MANIFEST; then
f7ab18e9 1505 set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
dfe9444c
AD
1506else
1507 echo "(Looking for .SH files under the source directory.)"
1508 set x `(cd $src; find . -name "*.SH" -print)`
1509fi
1510shift
1511case $# in
15120) set x `(cd $src; echo *.SH)`; shift;;
1513esac
1514if test ! -f $src/$1; then
1515 shift
1516fi
1517mkdir_p='
1518name=$1;
1519create="";
1520while test $name; do
1521 if test ! -d "$name"; then
1522 create="$name $create";
1523 name=`echo $name | sed -e "s|^[^/]*$||"`;
1524 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1525 else
1526 name="";
1527 fi;
1528done;
1529for file in $create; do
1530 mkdir $file;
1531done
1532'
1533for file in $*; do
1534 case "$src" in
1535 ".")
1536 case "$file" in
1537 */*)
1538 dir=`expr X$file : 'X\(.*\)/'`
1539 file=`expr X$file : 'X.*/\(.*\)'`
1540 (cd $dir && . ./$file)
1541 ;;
1542 *)
1543 . ./$file
1544 ;;
1545 esac
1546 ;;
1547 *)
1548 case "$file" in
1549 */*)
1550 dir=`expr X$file : 'X\(.*\)/'`
1551 file=`expr X$file : 'X.*/\(.*\)'`
1552 (set x $dir; shift; eval $mkdir_p)
1553 sh <$src/$dir/$file
1554 ;;
1555 *)
1556 sh <$src/$file
1557 ;;
1558 esac
1559 ;;
1560 esac
1561done
1562if test -f $src/config_h.SH; then
1563 if test ! -f config.h; then
1564 : oops, they left it out of MANIFEST, probably, so do it anyway.
1565 . $src/config_h.SH
1566 fi
1567fi
1568EOS
1569
1570: extract files and exit if asked to do so
1571case "$extractsh" in
1572true)
1573 case "$realsilent" in
1574 true) ;;
1575 *) exec 1>&4;;
1576 esac
1577 case "$config_sh" in
1578 '') config_sh='config.sh';;
1579 esac
1580 echo " "
1581 echo "Fetching answers from $config_sh..."
1582 cd ..
1583 . $config_sh
1584 test "$override" && . ./optdef.sh
1585 echo " "
1586 . UU/extract
1587 rm -rf UU
1588 echo "Done."
1589 exit 0
1590 ;;
1591esac
1592
1593: Eunice requires " " instead of "", can you believe it
1594echo " "
1595: Here we go...
1596echo "Beginning of configuration questions for $package."
1597
1598trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1599
2304df62
AD
1600: first determine how to suppress newline on echo command
1601echo " "
1602echo "Checking echo to see how to suppress newlines..."
1603(echo "hi there\c" ; echo " ") >.echotmp
1604if $contains c .echotmp >/dev/null 2>&1 ; then
1605 echo "...using -n."
1606 n='-n'
1607 c=''
1608else
1609 cat <<'EOM'
1610...using \c
1611EOM
1612 n=''
1613 c='\c'
1614fi
1615echo $n "The star should be here-->$c"
1616echo '*'
1617rm -f .echotmp
1618
1619: Now test for existence of everything in MANIFEST
1620echo " "
dfe9444c 1621if test -f $rsrc/MANIFEST; then
2304df62 1622 echo "First let's make sure your kit is complete. Checking..." >&4
dfe9444c 1623 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
2304df62 1624 rm -f missing
dfe9444c 1625 tmppwd=`pwd`
2304df62 1626 for filelist in x??; do
dfe9444c 1627 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
2304df62
AD
1628 done
1629 if test -s missing; then
1630 cat missing >&4
1631 cat >&4 <<'EOM'
1632
1633THIS PACKAGE SEEMS TO BE INCOMPLETE.
1634
1635You have the option of continuing the configuration process, despite the
1636distinct possibility that your kit is damaged, by typing 'y'es. If you
1637do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1638and contact the author (perlbug@perl.org).
2304df62
AD
1639
1640EOM
1641 echo $n "Continue? [n] $c" >&4
1642 read ans
1643 case "$ans" in
1644 y*)
1645 echo "Continuing..." >&4
1646 rm -f missing
1647 ;;
1648 *)
1649 echo "ABORTING..." >&4
1650 kill $$
1651 ;;
1652 esac
1653 else
dfe9444c 1654 echo "Looks good..."
2304df62
AD
1655 fi
1656else
1657 echo "There is no MANIFEST file. I hope your kit is complete !"
1658fi
1659rm -f missing x??
1660
5ff3f7a4
GS
1661echo " "
1662: Find the appropriate value for a newline for tr
1663if test -n "$DJGPP"; then
1664 trnl='\012'
1665fi
1666if test X"$trnl" = X; then
1667 case "`echo foo|tr '\n' x 2>/dev/null`" in
1668 foox) trnl='\n' ;;
1669 esac
1670fi
1671if test X"$trnl" = X; then
1672 case "`echo foo|tr '\012' x 2>/dev/null`" in
1673 foox) trnl='\012' ;;
1674 esac
1675fi
1676if test X"$trnl" = X; then
1677 cat <<EOM >&2
1678
1679$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1680
1681EOM
1682 exit 1
1683fi
1684
2304df62
AD
1685: compute the number of columns on the terminal for proper question formatting
1686case "$COLUMNS" in
1687'') COLUMNS='80';;
1688esac
1689
1690: set up the echo used in my read
1691myecho="case \"\$xxxm\" in
1692'') echo $n \"\$rp $c\" >&4;;
1693*) case \"\$rp\" in
1694 '') echo $n \"[\$xxxm] $c\";;
1695 *)
1696 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1697 echo \"\$rp\" >&4
1698 echo $n \"[\$xxxm] $c\" >&4
1699 else
1700 echo $n \"\$rp [\$xxxm] $c\" >&4
1701 fi
1702 ;;
1703 esac;;
1704esac"
1705
1706: now set up to do reads with possible shell escape and default assignment
1707cat <<EOSC >myread
28757baa 1708$startsh
2304df62
AD
1709xxxm=\$dflt
1710$myecho
1711ans='!'
1712case "\$fastread" in
1713yes) case "\$dflt" in
1714 '') ;;
1715 *) ans='';
1716 case "\$silent-\$rp" in
1717 true-) ;;
1718 *) echo " " >&4;;
1719 esac;;
1720 esac;;
1721*) case "\$silent" in
1722 true) case "\$rp" in
1723 '') ans='';;
1724 esac;;
1725 esac;;
1726esac
1727while expr "X\$ans" : "X!" >/dev/null; do
1728 read answ
1729 set x \$xxxm
1730 shift
dfe9444c 1731 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1732 case "\$answ" in
dfe9444c
AD
1733 "!")
1734 sh 1>&4
1735 echo " "
1736 $myecho
1737 ;;
1738 !*)
1739 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1740 shift
1741 sh 1>&4 -c "\$*"
1742 echo " "
1743 $myecho
1744 ;;
2304df62
AD
1745 "\$ans")
1746 case "\$ans" in
ecfc5424
AD
1747 \\&*)
1748 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1749 shift
1750 case "\$1" in
1751 -d)
1752 fastread=yes
40a7a20a 1753 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1754 ;;
1755 -*)
40a7a20a 1756 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1757 ;;
1758 esac
1759 $myecho
1760 ans=!
1761 ;;
2304df62
AD
1762 esac;;
1763 *)
1764 case "\$aok" in
1765 y)
1766 echo "*** Substitution done -- please confirm."
1767 xxxm="\$ans"
c9795ab7 1768 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1769 xxxm="\$ans"
1770 ans=!
1771 ;;
1772 *)
1773 echo "*** Error -- try again."
1774 ans=!
1775 ;;
1776 esac
1777 $myecho
1778 ;;
1779 esac
1780 case "\$ans\$xxxm\$nostick" in
1781 '')
1782 ans=!
1783 $myecho
1784 ;;
1785 esac
1786done
1787case "\$ans" in
1788'') ans="\$xxxm";;
1789esac
1790EOSC
1791
1792: create .config dir to save info across Configure sessions
1793test -d ../.config || mkdir ../.config
1794cat >../.config/README <<EOF
1795This directory created by Configure to save information that should
dfe9444c 1796persist across sessions for $package.
2304df62
AD
1797
1798You may safely delete it if you wish.
1799EOF
1800
9507cadf 1801xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 1802case "$usedevel" in
0107c034 1803$define|true|[yY]*) ;;
9507cadf 1804*) case "$xversion" in
0107c034
JH
1805 *[13579])
1806 cat >&4 <<EOH
1807*** WHOA THERE!!! ***
1808
1809 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
1810 The version of this $package distribution is $xversion, that is, odd,
1811 (as opposed to even) and that signifies a development release.
3d5d58b1 1812 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
1813
1814 Do ***NOT*** install this into production use.
1815 Data corruption and crashes are possible.
1816
1817 It is most seriously suggested that you do not continue any further
1818 unless you want to help in developing and debugging Perl.
1819
6adc6a45
JH
1820 If you *still* want to build perl, you can answer 'y' now,
1821 or pass -Dusedevel to Configure.
1822
0107c034
JH
1823EOH
1824 rp='Do you really want to continue?'
1825 dflt='n'
1826 . ./myread
1827 case "$ans" in
8feeef0e
JH
1828 [yY]) echo >&4 "Okay, continuing."
1829 usedevel="$define" ;;
0107c034
JH
1830 *) echo >&4 "Okay, bye."
1831 exit 1
1832 ;;
1833 esac
1834 ;;
1835 esac
1836 ;;
1837esac
8feeef0e
JH
1838case "$usedevel" in
1839$define|true|[yY]*)
1840 case "$versiononly" in
1841 '') versiononly="$define" ;;
1842 esac
1843 case "$installusrbinperl" in
1844 '') installusrbinperl="$undef" ;;
1845 esac
1846 ;;
1847esac
0107c034 1848
2304df62
AD
1849: general instructions
1850needman=true
1851firsttime=true
760ac839 1852user=`(logname) 2>/dev/null`
dfe9444c
AD
1853case "$user" in
1854'') user=`whoami 2>&1`;;
760ac839 1855esac
2304df62
AD
1856if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1857 firsttime=false
1858 echo " "
1859 rp='Would you like to see the instructions?'
1860 dflt=n
1861 . ./myread
1862 case "$ans" in
1863 [yY]*) ;;
1864 *) needman=false;;
1865 esac
1866fi
1867if $needman; then
1868 cat <<EOH
4e2a5f63 1869
2304df62 1870This installation shell script will examine your system and ask you questions
a0d0e21e 1871to determine how the perl5 package should be installed. If you get
2304df62
AD
1872stuck on a question, you may use a ! shell escape to start a subshell or
1873execute a command. Many of the questions will have default answers in square
1874brackets; typing carriage return will give you the default.
1875
1876On some of the questions which ask for file or directory names you are allowed
1877to use the ~name construct to specify the login directory belonging to "name",
1878even if you don't have a shell which knows about that. Questions where this is
1879allowed will be marked "(~name ok)".
1880
1881EOH
1882 rp=''
1883 dflt='Type carriage return to continue'
1884 . ./myread
1885 cat <<'EOH'
1886
1887The prompter used in this script allows you to use shell variables and
1888backticks in your answers. You may use $1, $2, etc... to refer to the words
1889in the default answer, as if the default line was a set of arguments given to a
1890script shell. This means you may also use $* to repeat the whole default line,
1891so you do not have to re-type everything to add something to the default.
1892
1893Everytime there is a substitution, you will have to confirm. If there is an
1894error (e.g. an unmatched backtick), the default answer will remain unchanged
1895and you will be prompted again.
1896
1897If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1898the questions and use the computed defaults (or the previous answers if there
1899was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1900You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1901on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1902
1903EOH
1904 . ./myread
1905 cat <<EOH
1906
1907Much effort has been expended to ensure that this shell script will run on any
1908Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1909Configure and run it again. If you can't run Configure for some reason,
1910you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 1911have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
1912
1913This installation script affects things in two ways:
1914
19151) it may do direct variable substitutions on some of the files included
1916 in this kit.
19172) it builds a config.h file for inclusion in C programs. You may edit
1918 any of these files as the need arises after running this script.
1919
1920If you make a mistake on a question, there is no easy way to back up to it
1921currently. The easiest thing to do is to edit config.sh and rerun all the SH
1922files. Configure will offer to let you do this before it runs the SH files.
1923
1924EOH
1925 dflt='Type carriage return to continue'
1926 . ./myread
1927 case "$firsttime" in
1928 true) echo $user >>../.config/instruct;;
1929 esac
1930fi
1931
2304df62
AD
1932: find out where common programs are
1933echo " "
1934echo "Locating common programs..." >&4
1935cat <<EOSC >loc
1936$startsh
1937case \$# in
19380) exit 1;;
1939esac
1940thing=\$1
1941shift
1942dflt=\$1
1943shift
1944for dir in \$*; do
1945 case "\$thing" in
1946 .)
1947 if test -d \$dir/\$thing; then
1948 echo \$dir
1949 exit 0
1950 fi
1951 ;;
1952 *)
a0d0e21e 1953 for thisthing in \$dir/\$thing; do
ecfc5424 1954 : just loop through to pick last item
a0d0e21e 1955 done
25f94b33 1956 if test -f \$thisthing; then
a0d0e21e 1957 echo \$thisthing
2304df62
AD
1958 exit 0
1959 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
1960 if test -n "$DJGPP"; then
1961 echo \$dir/\$thing.exe
1962 else
1963 : on Eunice apparently
1964 echo \$dir/\$thing
1965 fi
2304df62
AD
1966 exit 0
1967 fi
1968 ;;
1969 esac
1970done
1971echo \$dflt
1972exit 1
1973EOSC
1974chmod +x loc
1975$eunicefix loc
1976loclist="
1977awk
1978cat
b4eb6b3d
JH
1979comm
1980cp
2304df62
AD
1981echo
1982expr
1983grep
a0d0e21e 1984ls
dfe9444c 1985make
b4eb6b3d 1986mkdir
2304df62
AD
1987rm
1988sed
b4eb6b3d 1989sort
85e6fe83 1990touch
2304df62 1991tr
b4eb6b3d 1992uniq
2304df62
AD
1993"
1994trylist="
1995Mcc
dfe9444c 1996ar
3659ebf1 1997bison
b4eb6b3d 1998byacc
2304df62 1999cpp
b4eb6b3d 2000csh
2304df62
AD
2001date
2002egrep
8ff267be 2003gzip
b4eb6b3d 2004less
8ff267be 2005ln
b4eb6b3d 2006more
693762b4 2007nm
b4eb6b3d
JH
2008nroff
2009pg
2304df62
AD
2010test
2011uname
8ff267be 2012zip
2304df62 2013"
8e07c86e 2014pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2015pth="$pth /lib /usr/lib"
2016for file in $loclist; do
dfe9444c
AD
2017 eval xxx=\$$file
2018 case "$xxx" in
2019 /*|?:[\\/]*)
2020 if test -f "$xxx"; then
2021 : ok
2022 else
2023 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2024 xxx=`./loc $file $file $pth`
2025 fi
2026 ;;
2027 '') xxx=`./loc $file $file $pth`;;
2028 *) xxx=`./loc $xxx $xxx $pth`;;
2029 esac
2304df62
AD
2030 eval $file=$xxx
2031 eval _$file=$xxx
2032 case "$xxx" in
2033 /*)
2034 echo $file is in $xxx.
2035 ;;
8e07c86e
AD
2036 ?:[\\/]*)
2037 echo $file is in $xxx.
2038 ;;
2304df62 2039 *)
25f94b33
AD
2040 echo "I don't know where '$file' is, and my life depends on it." >&4
2041 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2042 exit 1
2304df62
AD
2043 ;;
2044 esac
2045done
2046echo " "
2047echo "Don't worry if any of the following aren't found..."
2048say=offhand
2049for file in $trylist; do
dfe9444c
AD
2050 eval xxx=\$$file
2051 case "$xxx" in
2052 /*|?:[\\/]*)
2053 if test -f "$xxx"; then
2054 : ok
2055 else
2056 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2057 xxx=`./loc $file $file $pth`
2058 fi
2059 ;;
2060 '') xxx=`./loc $file $file $pth`;;
2061 *) xxx=`./loc $xxx $xxx $pth`;;
2062 esac
2304df62
AD
2063 eval $file=$xxx
2064 eval _$file=$xxx
2065 case "$xxx" in
2066 /*)
2067 echo $file is in $xxx.
2068 ;;
8e07c86e
AD
2069 ?:[\\/]*)
2070 echo $file is in $xxx.
2071 ;;
2304df62
AD
2072 *)
2073 echo "I don't see $file out there, $say."
2074 say=either
2075 ;;
2076 esac
2077done
2078case "$egrep" in
2079egrep)
2080 echo "Substituting grep for egrep."
2081 egrep=$grep
2082 ;;
2083esac
8ff267be 2084case "$ln" in
2085ln)
2086 echo "Substituting cp for ln."
2087 ln=$cp
2088 ;;
2089esac
2304df62
AD
2090case "$test" in
2091test)
2092 echo "Hopefully test is built into your sh."
2093 ;;
2094*)
73614538 2095 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2096 echo "Using the test built into your sh."
2304df62
AD
2097 test=test
2098 _test=test
2099 fi
2100 ;;
2101esac
2102case "$echo" in
2103echo)
2104 echo "Hopefully echo is built into your sh."
2105 ;;
2106'') ;;
2107*)
2108 echo " "
2109echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2110 $echo $n "hi there$c" >foo1
2111 echo $n "hi there$c" >foo2
2112 if cmp foo1 foo2 >/dev/null 2>&1; then
2113 echo "They are compatible. In fact, they may be identical."
2114 else
2115 case "$n" in
2116 '-n') n='' c='\c';;
2117 *) n='-n' c='';;
2118 esac
2119 cat <<FOO
2120They are not compatible! You are probably running ksh on a non-USG system.
2121I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2122have echo built in and we may have to run some Bourne shell scripts. That
2123means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2124
2125FOO
2126 $echo $n "The star should be here-->$c"
2127 $echo "*"
2128 fi
2129 $rm -f foo1 foo2
2130 ;;
2131esac
2132
2573c5f9
JH
2133cat <<EOS >checkcc
2134$startsh
2135EOS
2136cat <<'EOSC' >>checkcc
2137case "$cc" in
2138'') ;;
2139*) $rm -f try try.*
2140 $cat >try.c <<EOM
2141int main(int argc, char *argv[]) {
2142 return 0;
2143}
2144EOM
e4778687 2145 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2146 :
2147 else
2148 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2149 despair=yes
2150 trygcc=yes
2151 case "$cc" in
2152 *gcc*) trygcc=no ;;
2153 esac
2154 case "`$cc -v -c try.c 2>&1`" in
2155 *gcc*) trygcc=no ;;
2156 esac
2157 if $test X"$trygcc" = Xyes; then
2158 if gcc -o try -c try.c; then
2159 echo " "
2160 echo "You seem to have a working gcc, though." >&4
2161 rp="Would you like to use it?"
2162 dflt=y
2163 if $test -f myread; then
2164 . ./myread
2165 else
2166 if $test -f UU/myread; then
2167 . ./UU/myread
2168 else
2169 echo "Cannot find myread, sorry. Aborting." >&2
2170 exit 1
2171 fi
2172 fi
2173 case "$ans" in
e723fc21 2174 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2573c5f9
JH
2175 esac
2176 fi
2177 fi
2178 if $test X"$despair" = Xyes; then
5dd4fbdf
MB
2179 $cat >&4 <<EOM
2180You need to find a working C compiler.
2181Either (purchase and) install the C compiler supplied by your OS vendor,
2182or for a free C compiler try http://gcc.gnu.org/
2183I cannot continue any further, aborting.
2184EOM
2573c5f9
JH
2185 exit 1
2186 fi
2187 fi
2188 $rm -f try try.*
2189 ;;
2190esac
2191EOSC
2192
a0d0e21e
LW
2193: determine whether symbolic links are supported
2194echo " "
2195$touch blurfl
2196if $ln -s blurfl sym > /dev/null 2>&1 ; then
2197 echo "Symbolic links are supported." >&4
2198 lns="$ln -s"
2199else
2200 echo "Symbolic links are NOT supported." >&4
2201 lns="$ln"
2202fi
2203$rm -f blurfl sym
2204
dafca956
JH
2205: determine whether symbolic links are supported
2206echo " "
2207case "$lns" in
2208*"ln -s")
2209 echo "Checking how to test for symbolic links..." >&4
2210 $lns blurfl sym
4b661809 2211 if $test "X$issymlink" = X; then
73614538 2212 sh -c "PATH= test -h sym" >/dev/null 2>&1
5d644a95
MB
2213 if test $? = 0; then
2214 issymlink="test -h"
2215 fi
2216 fi
2217 if $test "X$issymlink" = X; then
73614538 2218 if $test -h >/dev/null 2>&1; then
5d644a95
MB
2219 issymlink="$test -h"
2220 echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2221 fi
dafca956 2222 fi
4b661809 2223 if $test "X$issymlink" = X; then
dafca956 2224 if $test -L sym 2>/dev/null; then
5d644a95 2225 issymlink="$test -L"
dafca956
JH
2226 fi
2227 fi
4b661809 2228 if $test "X$issymlink" != X; then
5d644a95 2229 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2230 else
2231 echo "I do not know how you can test for symbolic links." >&4
2232 fi
2233 $rm -f blurfl sym
2234 ;;
2235*) echo "No symbolic links, so not testing for their testing..." >&4
2236 ;;
2237esac
2238echo " "
2239
2240
2241case "$mksymlinks" in
2242$define|true|[yY]*)
2243 case "$src" in
2244 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2245 exit 1
2246 ;;
4b661809 2247 *) case "$lns:$issymlink" in
7a800fca 2248 *"ln -s:"*"test -"?)
dafca956
JH
2249 echo "Creating the symbolic links..." >&4
2250 echo "(First creating the subdirectories...)" >&4
2251 cd ..
2252 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2253 read directory
2254 test -z "$directory" && break
2255 mkdir -p $directory
2256 done
2257 # Sanity check 1.
2258 if test ! -d t/base; then
2259 echo "Failed to create the subdirectories. Aborting." >&4
2260 exit 1
2261 fi
2262 echo "(Then creating the symlinks...)" >&4
2263 awk '{print $1}' $src/MANIFEST | while true; do
2264 read filename
2265 test -z "$filename" && break
2266 if test -f $filename; then
5d644a95 2267 if $issymlink $filename; then
dafca956
JH
2268 rm -f $filename
2269 fi
2270 fi
2271 if test -f $filename; then
2272 echo "$filename already exists, not symlinking."
2273 else
2274 ln -s $src/$filename $filename
2275 fi
2276 done
2277 # Sanity check 2.
2278 if test ! -f t/base/commonsense.t; then
2279 echo "Failed to create the symlinks. Aborting." >&4
2280 exit 1
2281 fi
2282 cd UU
2283 ;;
2284 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2285 ;;
2286 esac
2287 ;;
2288 esac
2289 ;;
2290esac
2291
ecfc5424
AD
2292: see whether [:lower:] and [:upper:] are supported character classes
2293echo " "
ecfc5424
AD
2294case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2295ABYZ)
2296 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2297 up='[:upper:]'
2298 low='[:lower:]'
2299 ;;
28e8609d
JH
2300*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2301 # (0xc9 and 0xd1), therefore that is a nice testing point.
2302 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2303 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2304 ij) up='[A-Z]'
2305 low='[a-z]'
2306 ;;
2307 esac
2308 fi
2309 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2310 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2311 ij) up='A-Z'
2312 low='a-z'
2313 ;;
2314 esac
2315 fi
2316 if test "X$up" = X -o "X$low" = X; then
2317 case "`echo IJ | od -x 2>/dev/null`" in
2318 *C9D1*|*c9d1*)
2319 echo "Hey, this might be EBCDIC." >&4
2320 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2321 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2322 ij) up='[A-IJ-RS-Z]'
2323 low='[a-ij-rs-z]'
2324 ;;
2325 esac
2326 fi
2327 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2328 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2329 ij) up='A-IJ-RS-Z'
2330 low='a-ij-rs-z'
2331 ;;
2332 esac
2333 fi
2334 ;;
2335 esac
2336 fi
2337esac
3eaeeeae 2338case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2339ij)
2340 echo "Using $up and $low to convert case." >&4
2341 ;;
ecfc5424 2342*)
28e8609d
JH
2343 echo "I don't know how to translate letters from upper to lower case." >&4
2344 echo "Your tr is not acting any way I know of." >&4
2345 exit 1
2346 ;;
ecfc5424
AD
2347esac
2348: set up the translation script tr, must be called with ./tr of course
2349cat >tr <<EOSC
2350$startsh
2351case "\$1\$2" in
2352'[A-Z][a-z]') exec $tr '$up' '$low';;
2353'[a-z][A-Z]') exec $tr '$low' '$up';;
2354esac
2355exec $tr "\$@"
2356EOSC
2357chmod +x tr
2358$eunicefix tr
2359
2304df62
AD
2360: Try to determine whether config.sh was made on this system
2361case "$config_sh" in
2362'')
43999f95
JH
2363myuname=`$uname -a 2>/dev/null`
2364$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2365# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2366# because the A-Z/a-z are not consecutive.
a0d0e21e 2367myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2368 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2369newmyuname="$myuname"
2304df62 2370dflt=n
16d20bd9
AD
2371case "$knowitall" in
2372'')
2373 if test -f ../config.sh; then
2374 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2375 eval "`grep myuname= ../config.sh`"
2376 fi
2377 if test "X$myuname" = "X$newmyuname"; then
2378 dflt=y
2379 fi
2304df62 2380 fi
16d20bd9
AD
2381 ;;
2382*) dflt=y;;
2383esac
2304df62
AD
2384
2385: Get old answers from old config file if Configure was run on the
2386: same system, otherwise use the hints.
2387hint=default
2388cd ..
2389if test -f config.sh; then
16d20bd9
AD
2390 echo " "
2391 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2392 . UU/myread
2393 case "$ans" in
f83701cd
AD
2394 n*|N*) echo "OK, I'll ignore it."
2395 mv config.sh config.sh.old
2396 myuname="$newmyuname"
2397 ;;
2304df62 2398 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2399 tmp_n="$n"
2400 tmp_c="$c"
85cad39c 2401 tmp_sh="$sh"
2304df62
AD
2402 . ./config.sh
2403 cp config.sh UU
ecfc5424
AD
2404 n="$tmp_n"
2405 c="$tmp_c"
85cad39c 2406 : Older versions did not always set $sh. Catch re-use of such
2407 : an old config.sh.
2408 case "$sh" in
2409 '') sh="$tmp_sh" ;;
2410 esac
2304df62
AD
2411 hint=previous
2412 ;;
2413 esac
2414fi
2573c5f9 2415. ./UU/checkcc
2304df62
AD
2416if test ! -f config.sh; then
2417 $cat <<EOM
2418
4e2a5f63
AD
2419First time through, eh? I have some defaults handy for some systems
2420that need some extra help getting the Configure answers right:
2304df62
AD
2421
2422EOM
dfe9444c 2423 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2424 dflt=''
2425 : Half the following guesses are probably wrong... If you have better
7f2de2d2 2426 : tests or hints, please send them to perlbug@perl.org
2304df62 2427 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2428 $test -f /irix && osname=irix
85e6fe83
LW
2429 $test -f /xenix && osname=sco_xenix
2430 $test -f /dynix && osname=dynix
2431 $test -f /dnix && osname=dnix
5f05dabc 2432 $test -f /lynx.os && osname=lynxos
2433 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2434 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2435 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2436 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2437 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2438 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2439 $test -d /usr/apollo/bin && osname=apollo
2440 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2441 $test -d /usr/include/minix && osname=minix
e060872b 2442 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2443 osname=machten
4633a7c4 2444 if $test -x /sbin/version; then
dfe9444c 2445 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2446 $sed -e 's/[A-Za-z]$//'`
2447 elif $test -x /usr/etc/version; then
dfe9444c 2448 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2449 $sed -e 's/[A-Za-z]$//'`
2450 else
2451 osvers="$2.$3"
2452 fi
2453 fi
aaacdc8b
GS
2454
2455 $test -f /sys/posix.dll &&
2456 $test -f /usr/bin/what &&
2457 set X `/usr/bin/what /sys/posix.dll` &&
2458 $test "$3" = UWIN &&
2459 osname=uwin &&
2460 osvers="$5"
2461
2304df62
AD
2462 if $test -f $uname; then
2463 set X $myuname
2464 shift
2465
2304df62 2466 case "$5" in
85e6fe83 2467 fps*) osname=fps ;;
2304df62
AD
2468 mips*)
2469 case "$4" in
85e6fe83
LW
2470 umips) osname=umips ;;
2471 *) osname=mips ;;
2304df62 2472 esac;;
85e6fe83
LW
2473 [23]100) osname=mips ;;
2474 next*) osname=next ;;
ecfc5424 2475 i386*)
c6912327
JH
2476 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2477 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2478 osname='sco'
2479 osvers=$tmp
2480 elif $test -f /etc/kconfig; then
ecfc5424 2481 osname=isc
bd628c73 2482 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2483 osvers=4
2484 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2485 osvers=3
2304df62 2486 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2487 osvers=2
ecfc5424
AD
2488 fi
2489 fi
2000072c 2490 tmp=''
ecfc5424 2491 ;;
c4f23d77
AD
2492 pc*)
2493 if test -n "$DJGPP"; then
2494 osname=dos
2495 osvers=djgpp
2496 fi
2497 ;;
2304df62
AD
2498 esac
2499
2500 case "$1" in
a0d0e21e
LW
2501 aix) osname=aix
2502 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2503 case "$tmp" in
1aef975c 2504 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2505 '<3240'|'<>3240') osvers=3.2.0 ;;
2506 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2507 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2508 *) osvers=$tmp;;
a0d0e21e
LW
2509 esac
2510 ;;
aaacdc8b
GS
2511 bsd386) osname=bsd386
2512 osvers=`$uname -r`
2513 ;;
2514 cygwin*) osname=cygwin
2515 osvers="$3"
2516 ;;
23f87696
SZ
2517 *dc.osx) osname=dcosx
2518 osvers="$3"
2519 ;;
a0d0e21e
LW
2520 dnix) osname=dnix
2521 osvers="$3"
2522 ;;
2523 domainos) osname=apollo
2524 osvers="$3"
2525 ;;
2526 dgux) osname=dgux
2527 osvers="$3"
2528 ;;
760ac839 2529 dynixptx*) osname=dynixptx
e58e581d 2530 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2531 ;;
a0d0e21e
LW
2532 freebsd) osname=freebsd
2533 osvers="$3" ;;
2534 genix) osname=genix ;;
2535 hp*) osname=hpux
bfb7748a 2536 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2537 ;;
a78b0d02 2538 irix*) osname=irix
a0d0e21e
LW
2539 case "$3" in
2540 4*) osvers=4 ;;
2541 5*) osvers=5 ;;
ecfc5424 2542 *) osvers="$3" ;;
a0d0e21e
LW
2543 esac
2544 ;;
2545 linux) osname=linux
2546 case "$3" in
a0d0e21e
LW
2547 *) osvers="$3" ;;
2548 esac
2549 ;;
28e8609d
JH
2550 MiNT) osname=mint
2551 ;;
2552 netbsd*) osname=netbsd
ecfc5424
AD
2553 osvers="$3"
2554 ;;
4e81affe
MM
2555 news-os) osvers="$3"
2556 case "$3" in
2557 4*) osname=newsos4 ;;
2558 *) osname=newsos ;;
2559 esac
2560 ;;
aaacdc8b 2561 next*) osname=next ;;
28bb1e2c 2562 nonstop-ux) osname=nonstopux ;;
aaacdc8b
GS
2563 POSIX-BC | posix-bc ) osname=posix-bc
2564 osvers="$3"
a0d0e21e 2565 ;;
ae3afa4e
TH
2566 powerux | power_ux | powermax_os | powermaxos | \
2567 powerunix | power_unix) osname=powerux
2568 osvers="$3"
2569 ;;
aaacdc8b
GS
2570 qnx) osname=qnx
2571 osvers="$4"
2572 ;;
a0d0e21e
LW
2573 solaris) osname=solaris
2574 case "$3" in
2575 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2576 *) osvers="$3" ;;
a0d0e21e
LW
2577 esac
2578 ;;
85e6fe83
LW
2579 sunos) osname=sunos
2580 case "$3" in
85e6fe83
LW
2581 5*) osname=solaris
2582 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2583 *) osvers="$3" ;;
2304df62
AD
2584 esac
2585 ;;
a0d0e21e 2586 titanos) osname=titanos
85e6fe83 2587 case "$3" in
a0d0e21e
LW
2588 1*) osvers=1 ;;
2589 2*) osvers=2 ;;
2590 3*) osvers=3 ;;
2591 4*) osvers=4 ;;
ecfc5424 2592 *) osvers="$3" ;;
2304df62
AD
2593 esac
2594 ;;
85e6fe83 2595 ultrix) osname=ultrix
ecfc5424 2596 osvers="$3"
2304df62 2597 ;;
28757baa 2598 osf1|mls+) case "$5" in
fed7345c
AD
2599 alpha)
2600 osname=dec_osf
2aa76180
JH
2601 osvers=`sizer -v | awk '{print $3}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2602 case "$osvers" in
2603 [1-9].[0-9]*) ;;
2604 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2605 esac
ecfc5424
AD
2606 ;;
2607 hp*) osname=hp_osf1 ;;
2608 mips) osname=mips_osf1 ;;
85e6fe83
LW
2609 esac
2610 ;;
0337d152
BG
2611 unixware) osname=svr5
2612 osvers="$4"
2613 ;;
2614 uts) osname=uts
a0d0e21e
LW
2615 osvers="$3"
2616 ;;
85e6fe83 2617 $2) case "$osname" in
2304df62 2618 *isc*) ;;
a0d0e21e 2619 *freebsd*) ;;
5f05dabc 2620 svr*)
a0d0e21e
LW
2621 : svr4.x or possibly later
2622 case "svr$3" in
2623 ${osname}*)
2624 osname=svr$3
2625 osvers=$4
2626 ;;
2627 esac
2628 case "$osname" in
2629 svr4.0)
2630 : Check for ESIX
2631 if test -f /stand/boot ; then
2632 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2633 if test -n "$INITPROG" -a -f "$INITPROG"; then
2634 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2635 if test -n "$isesix"; then
a0d0e21e
LW
2636 osname=esix4
2637 fi
2638 fi
2639 fi
2640 ;;
2641 esac
2642 ;;
2304df62 2643 *) if test -f /etc/systemid; then
a0d0e21e
LW
2644 osname=sco
2645 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2646 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2647 osvers=$1.$2.$3
c4f23d77 2648 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2649 osvers=$1.$2
c4f23d77 2650 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2651 osvers=$1
2304df62 2652 fi
a0d0e21e
LW
2653 else
2654 case "$osname" in
2655 '') : Still unknown. Probably a generic Sys V.
2656 osname="sysv"
2657 osvers="$3"
2658 ;;
2659 esac
2304df62
AD
2660 fi
2661 ;;
2662 esac
2663 ;;
a0d0e21e
LW
2664 *) case "$osname" in
2665 '') : Still unknown. Probably a generic BSD.
2666 osname="$1"
2667 osvers="$3"
2668 ;;
2669 esac
2670 ;;
2304df62
AD
2671 esac
2672 else
dfe9444c
AD
2673 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2674 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2675 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2676 osname=news_os
2304df62 2677 fi
dfe9444c 2678 $rm -f UU/kernel.what
8e07c86e
AD
2679 elif test -d c:/.; then
2680 set X $myuname
2681 osname=os2
2682 osvers="$5"
2304df62
AD
2683 fi
2684 fi
85e6fe83 2685
a0d0e21e
LW
2686 : Now look for a hint file osname_osvers, unless one has been
2687 : specified already.
2688 case "$hintfile" in
2689 ''|' ')
1e127011 2690 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 2691 : Also try without trailing minor version numbers.
1e127011
DD
2692 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2693 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2694 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2695 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
2696 case "$file" in
2697 '') dflt=none ;;
2698 *) case "$osvers" in
2699 '') dflt=$file
2700 ;;
dfe9444c 2701 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 2702 dflt=$file
dfe9444c 2703 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 2704 dflt=$xfile
dfe9444c 2705 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 2706 dflt=$xxfile
dfe9444c 2707 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 2708 dflt=$xxxfile
dfe9444c 2709 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 2710 dflt=$xxxxfile
dfe9444c 2711 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
2712 dflt="${osname}"
2713 else
2714 dflt=none
2715 fi
2716 ;;
2717 esac
85e6fe83
LW
2718 ;;
2719 esac
4e2a5f63
AD
2720 if $test -f Policy.sh ; then
2721 case "$dflt" in
2722 *Policy*) ;;
2723 none) dflt="Policy" ;;
2724 *) dflt="Policy $dflt" ;;
2725 esac
2726 fi
85e6fe83 2727 ;;
a0d0e21e 2728 *)
ecfc5424 2729 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 2730 ;;
2304df62 2731 esac
1aef975c 2732
4e2a5f63
AD
2733 if $test -f Policy.sh ; then
2734 $cat <<EOM
2735
2736There's also a Policy hint file available, which should make the
2737site-specific (policy) questions easier to answer.
2738EOM
2739
2740 fi
2741
2304df62
AD
2742 $cat <<EOM
2743
2744You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 2745A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 2746is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
2747
2748EOM
4e2a5f63 2749
2304df62 2750 rp="Which of these apply, if any?"
dfe9444c 2751 . UU/myread
85e6fe83
LW
2752 tans=$ans
2753 for file in $tans; do
4e2a5f63
AD
2754 if $test X$file = XPolicy -a -f Policy.sh; then
2755 . Policy.sh
2756 $cat Policy.sh >> UU/config.sh
2757 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
2758 . $src/hints/$file.sh
2759 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83 2760 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
2761 : nothing
2762 else
85e6fe83
LW
2763 : Give one chance to correct a possible typo.
2764 echo "$file.sh does not exist"
2765 dflt=$file
2766 rp="hint to use instead?"
dfe9444c 2767 . UU/myread
85e6fe83 2768 for file in $ans; do
dfe9444c
AD
2769 if $test -f "$src/hints/$file.sh"; then
2770 . $src/hints/$file.sh
2771 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
2772 elif $test X$ans = X -o X$ans = Xnone ; then
2773 : nothing
2774 else
2775 echo "$file.sh does not exist -- ignored."
2776 fi
2777 done
2304df62
AD
2778 fi
2779 done
85e6fe83 2780
2304df62 2781 hint=recommended
85e6fe83 2782 : Remember our hint file for later.
dfe9444c 2783 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 2784 hintfile="$file"
85e6fe83 2785 else
a0d0e21e 2786 hintfile=''
85e6fe83 2787 fi
2304df62
AD
2788fi
2789cd UU
2790;;
2791*)
2792 echo " "
2793 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
2794 tmp_n="$n"
2795 tmp_c="$c"
2304df62
AD
2796 cd ..
2797 cp $config_sh config.sh 2>/dev/null
a78b0d02 2798 chmod +w config.sh
2304df62
AD
2799 . ./config.sh
2800 cd UU
2801 cp ../config.sh .
ecfc5424
AD
2802 n="$tmp_n"
2803 c="$tmp_c"
2304df62
AD
2804 hint=previous
2805 ;;
2806esac
1aef975c 2807test "$override" && . ./optdef.sh
2304df62
AD
2808
2809: Restore computed paths
2810for file in $loclist $trylist; do
2811 eval $file="\$_$file"
2812done
2813
85e6fe83 2814cat << EOM
a0d0e21e 2815
85e6fe83 2816Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
2817The default value is probably right if the name rings a bell. Otherwise,
2818since spelling matters for me, either accept the default or answer "none"
2819to leave it blank.
a0d0e21e 2820
85e6fe83 2821EOM
85e6fe83 2822case "$osname" in
a0d0e21e 2823 ''|' ')
85e6fe83 2824 case "$hintfile" in
a0d0e21e 2825 ''|' '|none) dflt=none ;;
ecfc5424 2826 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
2827 esac
2828 ;;
2829 *) dflt="$osname" ;;
2830esac
2831rp="Operating system name?"
2832. ./myread
2833case "$ans" in
ecfc5424
AD
2834none) osname='' ;;
2835*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 2836esac
8ff267be 2837echo " "
2838case "$osvers" in
2839 ''|' ')
2840 case "$hintfile" in
2841 ''|' '|none) dflt=none ;;
2842 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2843 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2844 case "$dflt" in
2845 ''|' ') dflt=none ;;
2846 esac
2847 ;;
2848 esac
2849 ;;
2850 *) dflt="$osvers" ;;
2851esac
2852rp="Operating system version?"
2853. ./myread
2854case "$ans" in
2855none) osvers='' ;;
2856*) osvers="$ans" ;;
2857esac
2858
02e93a22
JH
2859
2860. ./posthint.sh
2861
2304df62 2862: who configured the system
59b83a6f 2863cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 2864cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
2865case "$cf_by" in
2866"")
8ff267be 2867 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
2868 case "$cf_by" in
2869 "") cf_by=unknown ;;
8ff267be 2870 esac ;;
2871esac
2304df62 2872
b4eb6b3d
JH
2873: set up the script used to warn in case of inconsistency
2874cat <<EOS >whoa
2875$startsh
2876EOS
2877cat <<'EOSC' >>whoa
2878dflt=y
2879echo " "
2880echo "*** WHOA THERE!!! ***" >&4
2881echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2882rp=" Keep the $hint value?"
2883. ./myread
2884case "$ans" in
2885y) td=$was; tu=$was;;
2886esac
2887EOSC
2888
2889: function used to set $1 to $val
2890setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2891case "$val$was" in
2892$define$undef) . ./whoa; eval "$var=\$td";;
2893$undef$define) . ./whoa; eval "$var=\$tu";;
2894*) eval "$var=$val";;
2895esac'
2896
2897case "$usethreads" in
2898$define|true|[yY]*) dflt='y';;
2899*) dflt='n';;
2900esac
2901cat <<EOM
2902
2903Perl can be built to take advantage of threads on some systems.
2904To do so, Configure can be run with -Dusethreads.
2905
2906Note that threading is a highly experimental feature, and
2907some known race conditions still remain. If you choose to try
2908it, be very sure to not actually deploy it for production
2909purposes. README.threads has more details, and is required
2910reading if you enable threads.
2911
2912If this doesn't make any sense to you, just accept the default '$dflt'.
2913EOM
2914rp='Build a threading Perl?'
2915. ./myread
2916case "$ans" in
2917y|Y) val="$define" ;;
2918*) val="$undef" ;;
2919esac
2920set usethreads
2921eval $setvar
2922
2923case "$usethreads" in
2924$define)
2925 $cat <<EOM
2926
2927As of 5.5.640, Perl has two different internal threading implementations,
2928the 5.005 version (5005threads) and an interpreter-based version
2929(ithreads) that has one interpreter per thread. Both are very
2930experimental. This arrangement exists to help developers work out
2931which one is better.
2932
2933If you're a casual user, you probably don't want interpreter-threads
2934at this time. There doesn't yet exist a way to create threads from
2935within Perl in this model, i.e., "use Thread;" will NOT work.
2936EOM
2937 : Default to ithreads unless overridden on command line or with
2938 : old config.sh
2939 dflt='y'
2940 case "$use5005threads" in
2941 $define|true|[yY]*) dflt='n';;
2942 esac
2943 case "$useithreads" in
2944 $undef|false|[nN]*) dflt='n';;
2945 esac
2946 rp='Use interpreter-based ithreads?'
2947 . ./myread
2948 case "$ans" in
2949 y|Y) val="$define" ;;
2950 *) val="$undef" ;;
2951 esac
2952 set useithreads
2953 eval $setvar
2954 : Now set use5005threads to the opposite value.
2955 case "$useithreads" in
2956 $define) val="$undef" ;;
2957 *) val="$define" ;;
2958 esac
2959 set use5005threads
2960 eval $setvar
2961 ;;
2962*)
2963 useithreads="$undef"
2964 use5005threads="$undef"
2965 ;;
2966esac
2967
c915ce7f
JH
2968case "$useithreads$use5005threads" in
2969"$define$define")
2970 $cat >&4 <<EOM
2971
2972You cannot have both the ithreads and the 5.005 threads enabled
2973at the same time. Disabling the 5.005 threads since they are
2974much less stable than the ithreads.
2975
2976EOM
2977 use5005threads="$undef"
2978 ;;
2979esac
2980
b4eb6b3d
JH
2981case "$d_oldpthreads" in
2982'') : Configure tests would be welcome here. For now, assume undef.
2983 val="$undef" ;;
2984*) val="$d_oldpthreads" ;;
2985esac
2986set d_oldpthreads
2987eval $setvar
2988
2989
2990case "$usethreads" in
2991"$define"|true|[yY]*)
2992: Look for a hint-file generated 'call-back-unit'. If the
2993: user has specified that a threading perl is to be built,
2994: we may need to set or change some other defaults.
2995 if $test -f usethreads.cbu; then
2996 echo "Your platform has some specific hints for threaded builds, using them..."
2997 . ./usethreads.cbu
2998 else
2999 $cat <<EOM
3000(Your platform doesn't have any specific hints for threaded builds.
3001 Assuming POSIX threads, then.)
3002EOM
3003 fi
3004 ;;
3005esac
3006
3007cat <<EOM
3008
3009Perl can be built so that multiple Perl interpreters can coexist
3010within the same Perl executable.
3011EOM
3012
3013case "$useithreads" in
3014$define)
3015 cat <<EOM
3016This multiple interpreter support is required for interpreter-based threads.
3017EOM
3018 val="$define"
3019 ;;
3020*) case "$usemultiplicity" in
3021 $define|true|[yY]*) dflt='y';;
3022 *) dflt='n';;
3023 esac
3024 echo " "
3025 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3026 rp='Build Perl for multiplicity?'
3027 . ./myread
3028 case "$ans" in
3029 y|Y) val="$define" ;;
3030 *) val="$undef" ;;
3031 esac
3032 ;;
3033esac
3034set usemultiplicity
3035eval $setvar
3036
e5e20432
JH
3037: make some quick guesses about what we are up against
3038echo " "
3039$echo $n "Hmm... $c"
3040echo exit 1 >bsd
3041echo exit 1 >usg
3042echo exit 1 >v7
3043echo exit 1 >osf1
3044echo exit 1 >eunice
3045echo exit 1 >xenix
3046echo exit 1 >venix
3047echo exit 1 >os2
3048d_bsd="$undef"
3049$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3050if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3051then
3052 echo "Looks kind of like an OSF/1 system, but we'll see..."
3053 echo exit 0 >osf1
381aa1ff 3054elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3055 xxx=`./loc addbib blurfl $pth`
3056 if $test -f $xxx; then
3057 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3058 echo exit 0 >bsd
3059 echo exit 0 >usg
3060 else
3061 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3062 echo "Looks kind of like an extended USG system, but we'll see..."
3063 else
3064 echo "Looks kind of like a USG system, but we'll see..."
3065 fi
3066 echo exit 0 >usg
3067 fi
3068elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3069 echo "Looks kind of like a BSD system, but we'll see..."
3070 d_bsd="$define"
3071 echo exit 0 >bsd
3072else
3073 echo "Looks kind of like a Version 7 system, but we'll see..."
3074 echo exit 0 >v7
3075fi
3076case "$eunicefix" in
3077*unixtovms*)
3078 $cat <<'EOI'
3079There is, however, a strange, musty smell in the air that reminds me of
3080something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3081EOI
3082 echo exit 0 >eunice
3083 d_eunice="$define"
3084: it so happens the Eunice I know will not run shell scripts in Unix format
3085 ;;
3086*)
3087 echo " "
3088 echo "Congratulations. You aren't running Eunice."
3089 d_eunice="$undef"
3090 ;;
3091esac
3092: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3093: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3094: semicolon as a patch separator
e5e20432
JH
3095case "$p_" in
3096:) ;;
3097*)
3098 $cat <<'EOI'
3099I have the feeling something is not exactly right, however...don't tell me...
3100lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3101(Or you may be running DOS with DJGPP.)
e5e20432
JH
3102EOI
3103 echo exit 0 >os2
3104 ;;
3105esac
3106if test -f /xenix; then
3107 echo "Actually, this looks more like a XENIX system..."
3108 echo exit 0 >xenix
3109 d_xenix="$define"
3110else
3111 echo " "
3112 echo "It's not Xenix..."
3113 d_xenix="$undef"
3114fi
3115chmod +x xenix
3116$eunicefix xenix
3117if test -f /venix; then
3118 echo "Actually, this looks more like a VENIX system..."
3119 echo exit 0 >venix
3120else
3121 echo " "
3122 if ./xenix; then
3123 : null
3124 else
3125 echo "Nor is it Venix..."
3126 fi
3127fi
3128chmod +x bsd usg v7 osf1 eunice xenix venix os2
3129$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3130$rm -f foo
3131
5869b1f1
JH
3132case "$cc" in
3133'') dflt=cc;;
3134*) dflt="$cc";;
3135esac
3136rp="Use which C compiler?"
3137. ./myread
3138cc="$ans"
e5e20432
JH
3139: Look for a hint-file generated 'call-back-unit'. Now that the
3140: user has specified the compiler, we may need to set or change some
3141: other defaults.
3142if $test -f cc.cbu; then
3143 . ./cc.cbu
3144fi
2573c5f9 3145. ./checkcc
8a27cf78 3146
e5e20432
JH
3147echo " "
3148echo "Checking for GNU cc in disguise and/or its version number..." >&4
3149$cat >gccvers.c <<EOM
3150#include <stdio.h>
3151int main() {
3152#ifdef __GNUC__
3153#ifdef __VERSION__
3154 printf("%s\n", __VERSION__);
3155#else
3156 printf("%s\n", "1");
3157#endif
3158#endif
3159 exit(0);
3160}
3161EOM
2d967e39 3162if $cc -o gccvers $ccflags $ldflags gccvers.c; then
e5e20432
JH
3163 gccversion=`./gccvers`
3164 case "$gccversion" in
3165 '') echo "You are not using GNU cc." ;;
fc68435e 3166 *) echo "You are using GNU cc $gccversion."
e723fc21 3167 ccname=gcc
fc68435e 3168 ;;
e5e20432
JH
3169 esac
3170else
3171 echo " "
3172 echo "*** WHOA THERE!!! ***" >&4
3173 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3174 case "$knowitall" in
3175 '')
3176 echo " You'd better start hunting for one and let me know about it." >&4
3177 exit 1
3178 ;;
3179 esac
3180fi
3181$rm -f gccvers*
3182case "$gccversion" in
31831*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3184esac
5b463ca7
KS
3185case "$gccversion" in
3186'') gccosandvers='' ;;
10b4ebb5
JH
3187*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3188 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3189 gccshortvers=''
5b463ca7 3190 case "$gccosandvers" in
02903077
JH
3191 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3192 $osname$osvers) ;; # looking good
5b463ca7
KS
3193 $osname*) cat <<EOM >&4
3194
3195*** WHOA THERE!!! ***
3196
3197 Your gcc has not been compiled for the exact release of
3198 your operating system ($gccosandvers versus $osname$osvers).
3199
3200 In general it is a good idea to keep gcc synchronized with
3201 the operating system because otherwise serious problems
3202 may ensue when trying to compile software, like Perl.
3203
3204 I'm trying to be optimistic here, though, and will continue.
3205 If later during the configuration and build icky compilation
02903077
JH
3206 problems appear (headerfile conflicts being the most common
3207 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3208 your operating system release.
3209
3210EOM
3211 ;;
81575342 3212 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3213 esac
3214 ;;
3215esac
e723fc21
JH
3216case "$ccname" in
3217'') ccname="$cc" ;;
3218esac
e5e20432 3219
8a27cf78
JH
3220: see how we invoke the C preprocessor
3221echo " "
3222echo "Now, how can we feed standard input to your C preprocessor..." >&4
3223cat <<'EOT' >testcpp.c
3224#define ABC abc
3225#define XYZ xyz
3226ABC.XYZ
3227EOT
3228cd ..
3229if test ! -f cppstdin; then
3230 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3231 # AIX cc -E doesn't show the absolute headerfile
3232 # locations but we'll cheat by using the -M flag.
3233 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
3234 else
3235 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3236 fi
3237else
3238 echo "Keeping your $hint cppstdin wrapper."
3239fi
3240chmod 755 cppstdin
3241wrapper=`pwd`/cppstdin
3242ok='false'
3243cd UU
3244
3245if $test "X$cppstdin" != "X" && \
3246 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3247 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3248then
3249 echo "You used to use $cppstdin $cppminus so we'll use that again."
3250 case "$cpprun" in
3251 '') echo "But let's see if we can live without a wrapper..." ;;
3252 *)
3253 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3254 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3255 then
3256 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3257 ok='true'
3258 else
3259 echo "(However, $cpprun $cpplast does not work, let's see...)"
3260 fi
3261 ;;
3262 esac
3263else
3264 case "$cppstdin" in
3265 '') ;;
3266 *)
3267 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3268 ;;
3269 esac
3270fi
3271
3272if $ok; then
3273 : nothing
3274elif echo 'Maybe "'"$cc"' -E" will work...'; \
3275 $cc -E <testcpp.c >testcpp.out 2>&1; \
3276 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3277 echo "Yup, it does."
3278 x_cpp="$cc -E"
3279 x_minus='';
3280elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3281 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3282 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3283 echo "Yup, it does."
3284 x_cpp="$cc -E"
3285 x_minus='-';
3286elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3287 $cc -P <testcpp.c >testcpp.out 2>&1; \
3288 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3289 echo "Yipee, that works!"
3290 x_cpp="$cc -P"
3291 x_minus='';
3292elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3293 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3294 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3295 echo "At long last!"
3296 x_cpp="$cc -P"
3297 x_minus='-';
3298elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3299 $cpp <testcpp.c >testcpp.out 2>&1; \
3300 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3301 echo "It works!"
3302 x_cpp="$cpp"
3303 x_minus='';
3304elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3305 $cpp - <testcpp.c >testcpp.out 2>&1; \
3306 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3307 echo "Hooray, it works! I was beginning to wonder."
3308 x_cpp="$cpp"
3309 x_minus='-';
3310elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3311 $wrapper <testcpp.c >testcpp.out 2>&1; \
3312 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3313 x_cpp="$wrapper"
3314 x_minus=''
3315 echo "Eureka!"
3316else
3317 dflt=''
3318 rp="No dice. I can't find a C preprocessor. Name one:"
3319 . ./myread
3320 x_cpp="$ans"
3321 x_minus=''
3322 $x_cpp <testcpp.c >testcpp.out 2>&1
3323 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3324 echo "OK, that will do." >&4
3325 else
3326echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3327 exit 1
3328 fi
3329fi
3330
3331case "$ok" in
3332false)
3333 cppstdin="$x_cpp"
3334 cppminus="$x_minus"
3335 cpprun="$x_cpp"
3336 cpplast="$x_minus"
3337 set X $x_cpp
3338 shift
3339 case "$1" in
3340 "$cpp")
3341 echo "Perhaps can we force $cc -E using a wrapper..."
3342 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3343 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3344 then
3345 echo "Yup, we can."
3346 cppstdin="$wrapper"
3347 cppminus='';
3348 else
3349 echo "Nope, we'll have to live without it..."
3350 fi
3351 ;;
3352 esac
3353 case "$cpprun" in
3354 "$wrapper")
3355 cpprun=''
3356 cpplast=''
3357 ;;
3358 esac
3359 ;;
3360esac
3361
3362case "$cppstdin" in
3363"$wrapper"|'cppstdin') ;;
3364*) $rm -f $wrapper;;
3365esac
3366$rm -f testcpp.c testcpp.out
3367
bd9b35c9
JH
3368: decide how portable to be. Allow command line overrides.
3369case "$d_portable" in
3370"$undef") ;;
3371*) d_portable="$define" ;;
104d25b7 3372esac
85ab1d1d 3373
bd9b35c9
JH
3374: set up shell script to do ~ expansion
3375cat >filexp <<EOSS
3376$startsh
3377: expand filename
3378case "\$1" in
3379 ~/*|~)
3380 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3381 ;;
3382 ~*)
3383 if $test -f /bin/csh; then
3384 /bin/csh -f -c "glob \$1"
3385 failed=\$?
3386 echo ""
3387 exit \$failed
e5e20432 3388 else
bd9b35c9
JH
3389 name=\`$expr x\$1 : '..\([^/]*\)'\`
3390 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3391 if $test ! -d "\$dir"; then
3392 me=\`basename \$0\`
3393 echo "\$me: can't locate home directory for: \$name" >&2
3394 exit 1
3395 fi
3396 case "\$1" in
3397 */*)
3398 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3399 ;;
3400 *)
3401 echo \$dir
e5e20432
JH
3402 ;;
3403 esac
3404 fi
b691c02f 3405 ;;
4633a7c4 3406*)
bd9b35c9 3407 echo \$1
2304df62
AD
3408 ;;
3409esac
4633a7c4
LW
3410EOSS
3411chmod +x filexp
3412$eunicefix filexp
2304df62
AD
3413
3414: now set up to get a file name
28757baa 3415cat <<EOS >getfile
3416$startsh
3417EOS
3418cat <<'EOSC' >>getfile
2304df62
AD
3419tilde=''
3420fullpath=''
3421already=''
3422skip=''
3423none_ok=''
3424exp_file=''
a0d0e21e 3425nopath_ok=''
2304df62
AD
3426orig_rp="$rp"
3427orig_dflt="$dflt"
b233458b
JH
3428case "$gfpth" in
3429'') gfpth='.' ;;
3430esac
2304df62
AD
3431
3432case "$fn" in
ecfc5424 3433*\(*)
381aa1ff 3434 expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
3435 fn=`echo $fn | sed 's/(.*)//'`
3436 ;;
3437esac
3438
3439case "$fn" in
a0d0e21e
LW
3440*:*)
3441 loc_file=`expr $fn : '.*:\(.*\)'`
3442 fn=`expr $fn : '\(.*\):.*'`
3443 ;;
3444esac
3445
3446case "$fn" in
2304df62
AD
3447*~*) tilde=true;;
3448esac
3449case "$fn" in
3450*/*) fullpath=true;;
3451esac
3452case "$fn" in
3453*+*) skip=true;;
3454esac
3455case "$fn" in
3456*n*) none_ok=true;;
3457esac
3458case "$fn" in
3459*e*) exp_file=true;;
3460esac
a0d0e21e
LW
3461case "$fn" in
3462*p*) nopath_ok=true;;
3463esac
2304df62
AD
3464
3465case "$fn" in
3466*f*) type='File';;
3467*d*) type='Directory';;
a0d0e21e 3468*l*) type='Locate';;
2304df62
AD
3469esac
3470
3471what="$type"
3472case "$what" in
3473Locate) what='File';;
3474esac
3475
3476case "$exp_file" in
3477'')
3478 case "$d_portable" in
3479 "$define") ;;
3480 *) exp_file=true;;
3481 esac
3482 ;;
3483esac
3484
3485cd ..
3486while test "$type"; do
3487 redo=''
3488 rp="$orig_rp"
3489 dflt="$orig_dflt"
3490 case "$tilde" in
3491 true) rp="$rp (~name ok)";;
3492 esac
3493 . UU/myread
ecfc5424
AD
3494 if test -f UU/getfile.ok && \
3495 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3496 then
3497 value="$ans"
3498 ansexp="$ans"
3499 break
3500 fi
2304df62
AD
3501 case "$ans" in
3502 none)
3503 value=''
3504 ansexp=''
3505 case "$none_ok" in
3506 true) type='';;
3507 esac
3508 ;;
3509 *)
3510 case "$tilde" in
3511 '') value="$ans"
3512 ansexp="$ans";;
3513 *)
3514 value=`UU/filexp $ans`
3515 case $? in
3516 0)
3517 if test "$ans" != "$value"; then
ecfc5424 3518 echo "(That expands to $value on this system.)"
2304df62
AD
3519 fi
3520 ;;
3521 *) value="$ans";;
3522 esac
3523 ansexp="$value"
3524 case "$exp_file" in
3525 '') value="$ans";;
3526 esac
3527 ;;
3528 esac
3529 case "$fullpath" in
3530 true)
3531 case "$ansexp" in
3532 /*) value="$ansexp" ;;
23da6c43 3533 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
3534 *)
3535 redo=true
3536 case "$already" in
3537 true)
3538 echo "I shall only accept a full path name, as in /bin/ls." >&4
3539 echo "Use a ! shell escape if you wish to check pathnames." >&4
3540 ;;
3541 *)
3542 echo "Please give a full path name, starting with slash." >&4
3543 case "$tilde" in
3544 true)
3545 echo "Note that using ~name is ok provided it expands well." >&4
3546 already=true
3547 ;;
3548 esac
3549 esac
3550 ;;
3551 esac
3552 ;;
3553 esac
3554 case "$redo" in
3555 '')
3556 case "$type" in
3557 File)
b233458b
JH
3558 for fp in $gfpth; do
3559 if test "X$fp" = X.; then
3560 pf="$ansexp"
3561 else
3562 pf="$fp/$ansexp"
3563 fi
3564 if test -f "$pf"; then
3565 type=''
3566 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3567 then
3568 echo "($value is not a plain file, but that's ok.)"
3569 type=''
3570 fi
3571 if test X"$type" = X; then
3572 value="$pf"
3573 break
3574 fi
3575 done
2304df62
AD
3576 ;;
3577 Directory)
b233458b
JH
3578 for fp in $gfpth; do
3579 if test "X$fp" = X.; then
f78bfc9c
JH
3580 dir="$ans"
3581 direxp="$ansexp"
b233458b 3582 else
dd858076 3583 dir="$fp/$ansexp"
f78bfc9c 3584 direxp="$fp/$ansexp"
b233458b 3585 fi
f78bfc9c 3586 if test -d "$direxp"; then
b233458b 3587 type=''
f78bfc9c 3588 value="$dir"
b233458b
JH
3589 break
3590 fi
3591 done
2304df62
AD
3592 ;;
3593 Locate)
40000a8c 3594 if test -d "$ansexp"; then
a0d0e21e
LW
3595 echo "(Looking for $loc_file in directory $value.)"
3596 value="$value/$loc_file"
40000a8c 3597 ansexp="$ansexp/$loc_file"
2304df62 3598 fi
40000a8c 3599 if test -f "$ansexp"; then
2304df62
AD
3600 type=''
3601 fi
a0d0e21e
LW
3602 case "$nopath_ok" in
3603 true) case "$value" in
3604 */*) ;;
3605 *) echo "Assuming $value will be in people's path."
3606 type=''
3607 ;;
3608 esac
3609 ;;
3610 esac
2304df62
AD
3611 ;;
3612 esac
3613
3614 case "$skip" in
3615 true) type='';
3616 esac
3617
3618 case "$type" in
3619 '') ;;
3620 *)
3621 if test "$fastread" = yes; then
3622 dflt=y
3623 else
3624 dflt=n
3625 fi
3626 rp="$what $value doesn't exist. Use that name anyway?"
3627 . UU/myread
3628 dflt=''
3629 case "$ans" in
3630 y*) type='';;
3631 *) echo " ";;
3632 esac
3633 ;;
3634 esac
3635 ;;
3636 esac
3637 ;;
3638 esac
3639done
3640cd UU
3641ans="$value"
3642rp="$orig_rp"
3643dflt="$orig_dflt"
ecfc5424 3644rm -f getfile.ok
b233458b 3645test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3646EOSC
3647
bd9b35c9
JH
3648: What should the include directory be ?
3649echo " "
3650$echo $n "Hmm... $c"
3651dflt='/usr/include'
3652incpath=''
3653mips_type=''
3654if $test -f /bin/mips && /bin/mips; then
3655 echo "Looks like a MIPS system..."
3656 $cat >usr.c <<'EOCP'
3657#ifdef SYSTYPE_BSD43
3658/bsd43
3659#endif
3660EOCP
8a27cf78 3661 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
3662 dflt='/bsd43/usr/include'
3663 incpath='/bsd43'
3664 mips_type='BSD 4.3'
3665 else
3666 mips_type='System V'
3667 fi
3668 $rm -f usr.c usr.out
3669 echo "and you're compiling with the $mips_type compiler and libraries."
3670 xxx_prompt=y
3671 echo "exit 0" >mips
3672else
3673 echo "Doesn't look like a MIPS system."
3674 xxx_prompt=n
3675 echo "exit 1" >mips
3676fi
3677chmod +x mips
3678$eunicefix mips
3679case "$usrinc" in
3680'') ;;
3681*) dflt="$usrinc";;
3682esac
3683case "$xxx_prompt" in
3684y) fn=d/
3685 echo " "
3686 rp='Where are the include files you want to use?'
3687 . ./getfile
3688 usrinc="$ans"
8e07c86e 3689 ;;
bd9b35c9 3690*) usrinc="$dflt"
8e07c86e
AD
3691 ;;
3692esac
2304df62 3693
bd9b35c9
JH
3694: Set private lib path
3695case "$plibpth" in
3696'') if ./mips; then
3697 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3698 fi;;
3699esac
3700case "$libpth" in
3701' ') dlist='';;
3702'') dlist="$loclibpth $plibpth $glibpth";;
3703*) dlist="$libpth";;
3704esac
3705
3706: Now check and see which directories actually exist, avoiding duplicates
3707libpth=''
3708for xxx in $dlist
3709do
3710 if $test -d $xxx; then
3711 case " $libpth " in
3712 *" $xxx "*) ;;
3713 *) libpth="$libpth $xxx";;
3714 esac
3715 fi
3716done
3717$cat <<'EOM'
3718
3719Some systems have incompatible or broken versions of libraries. Among
3720the directories listed in the question below, please remove any you
3721know not to be holding relevant libraries, and add any that are needed.
3722Say "none" for none.
8e07c86e
AD
3723
3724EOM
bd9b35c9
JH
3725case "$libpth" in
3726'') dflt='none';;
8e07c86e 3727*)
bd9b35c9
JH
3728 set X $libpth
3729 shift
3730 dflt=${1+"$@"}
8e07c86e 3731 ;;
a0d0e21e 3732esac
bd9b35c9
JH
3733rp="Directories to use for library searches?"
3734. ./myread
3735case "$ans" in
3736none) libpth=' ';;
3737*) libpth="$ans";;
3738esac
a0d0e21e 3739
bd9b35c9
JH
3740: compute shared library extension
3741case "$so" in
3742'')
3743 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3744 dflt='sl'
dd4e71fd 3745 else
bd9b35c9 3746 dflt='so'
dd4e71fd
JH
3747 fi
3748 ;;
bd9b35c9 3749*) dflt="$so";;
dd4e71fd 3750esac
dd4e71fd
JH
3751$cat <<EOM
3752
bd9b35c9 3753On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 3754you want to suppress searching of shared libraries for the remainder
bd9b35c9 3755of this configuration.
dd4e71fd
JH
3756
3757EOM
bd9b35c9
JH
3758rp='What is the file extension used for shared libraries?'
3759. ./myread
3760so="$ans"
dd4e71fd 3761
bd9b35c9
JH
3762: Define several unixisms.
3763: Hints files or command line option can be used to override them.
3764: The convoluted testing is in case hints files set either the old
3765: or the new name.
3766case "$_exe" in
3767'') case "$exe_ext" in
3768 '') ;;
3769 *) _exe="$exe_ext" ;;
dd4e71fd 3770 esac
bd9b35c9 3771 ;;
bfb7748a 3772esac
bd9b35c9
JH
3773case "$_a" in
3774'') case "$lib_ext" in
3775 '') _a='.a';;
3776 *) _a="$lib_ext" ;;
dd4e71fd
JH
3777 esac
3778 ;;
dd4e71fd 3779esac
bd9b35c9
JH
3780case "$_o" in
3781'') case "$obj_ext" in
3782 '') _o='.o';;
3783 *) _o="$obj_ext";;
3784 esac
3785 ;;
3786esac
3787case "$p_" in
3788'') case "$path_sep" in
3789 '') p_=':';;
3790 *) p_="$path_sep";;
3791 esac
3792 ;;
3793esac
3794exe_ext=$_exe
3795lib_ext=$_a
3796obj_ext=$_o
3797path_sep=$p_
dd4e71fd 3798
b4eb6b3d
JH
3799: Which makefile gets called first. This is used by make depend.
3800case "$firstmakefile" in
3801'') firstmakefile='makefile';;
4633a7c4 3802esac
4633a7c4 3803
0f0995ae
JH
3804case "$usesocks" in
3805$define|true|[yY]*) dflt='y';;
3806*) dflt='n';;
3807esac
bd9b35c9 3808cat <<EOM
4633a7c4 3809
bd9b35c9 3810Perl can be built to use the SOCKS proxy protocol library. To do so,
cf829ab0
JH
3811Configure must be run with -Dusesocks. If you use SOCKS you also need
3812to use the PerlIO abstraction layer, this will be implicitly selected.
4633a7c4 3813
0f0995ae 3814If this doesn't make any sense to you, just accept the default '$dflt'.
bd9b35c9 3815EOM
bd9b35c9
JH
3816rp='Build Perl for SOCKS?'
3817. ./myread
3818case "$ans" in
3819y|Y) val="$define" ;;
3820*) val="$undef" ;;
3821esac
3822set usesocks
3823eval $setvar
3824
cf829ab0
JH
3825case "$usesocks" in
3826$define|true|[yY]*) useperlio="$define";;
3827esac
3828
bd9b35c9
JH
3829: Looking for optional libraries
3830echo " "
3831echo "Checking for optional libraries..." >&4
3832case "$libs" in
3833' '|'') dflt='';;
3834*) dflt="$libs";;
3835esac
3836case "$libswanted" in
3837'') libswanted='c_s';;
3838esac
3839case "$usesocks" in
923fc586 3840"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 3841esac
68435ea7
JH
3842libsfound=''
3843libsfiles=''
3844libsdirs=''
13b3f787
JH
3845libspath=''
3846for thisdir in $libpth $xlibpth; do
3847 test -d $thisdir && libspath="$libspath $thisdir"
3848done
bd9b35c9 3849for thislib in $libswanted; do
13b3f787 3850 for thisdir in $libspath; do
f7dd4e7f
JH
3851 xxx=''
3852 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3853 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3854 $test -f "$xxx" && eval $libscheck
3855 $test -f "$xxx" && libstyle=shared
3856 fi
3857 if test ! -f "$xxx"; then
3858 xxx=$thisdir/lib$thislib.$so
3859 $test -f "$xxx" && eval $libscheck
3860 $test -f "$xxx" && libstyle=shared
3861 fi
3862 if test ! -f "$xxx"; then
3863 xxx=$thisdir/lib$thislib$_a
3864 $test -f "$xxx" && eval $libscheck
3865 $test -f "$xxx" && libstyle=static
3866 fi
3867 if test ! -f "$xxx"; then
3868 xxx=$thisdir/$thislib$_a
3869 $test -f "$xxx" && eval $libscheck
3870 $test -f "$xxx" && libstyle=static
3871 fi
3872 if test ! -f "$xxx"; then
3873 xxx=$thisdir/lib${thislib}_s$_a
3874 $test -f "$xxx" && eval $libscheck
3875 $test -f "$xxx" && libstyle=static
09ea5ba9 3876 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
3877 fi
3878 if test ! -f "$xxx"; then
3879 xxx=$thisdir/Slib$thislib$_a
3880 $test -f "$xxx" && eval $libscheck
3881 $test -f "$xxx" && libstyle=static
3882 fi
3883 if $test -f "$xxx"; then
43999f95 3884 case "$libstyle" in
f7dd4e7f
JH
3885 shared) echo "Found -l$thislib (shared)." ;;
3886 static) echo "Found -l$thislib." ;;
3887 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 3888 esac
bd9b35c9
JH
3889 case " $dflt " in
3890 *"-l$thislib "*);;
f7dd4e7f 3891 *) dflt="$dflt -l$thislib"
43999f95
JH
3892 libsfound="$libsfound $xxx"
3893 yyy=`basename $xxx`
3894 libsfiles="$libsfiles $yyy"
1e127011 3895 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
3896 case " $libsdirs " in
3897 *" $yyy "*) ;;
3898 *) libsdirs="$libsdirs $yyy" ;;
3899 esac
3900 ;;
bd9b35c9 3901 esac
f7dd4e7f
JH
3902 break
3903 fi
3904 done
3905 if $test ! -f "$xxx"; then
3906 echo "No -l$thislib."
bd9b35c9
JH
3907 fi
3908done
3909set X $dflt
3910shift
3911dflt="$*"
3912case "$libs" in
3913'') dflt="$dflt";;
3914*) dflt="$libs";;
3915esac
3916case "$dflt" in
3917' '|'') dflt='none';;
3918esac
4633a7c4 3919
bd9b35c9 3920$cat <<EOM
4633a7c4 3921
bd9b35c9
JH
3922In order to compile $package on your machine, a number of libraries
3923are usually needed. Include any other special libraries here as well.
3924Say "none" for none. The default list is almost always right.
8e07c86e 3925EOM
8e07c86e 3926
bd9b35c9
JH
3927echo " "
3928rp="What libraries to use?"
3929. ./myread
3930case "$ans" in
3931none) libs=' ';;
3932*) libs="$ans";;
3933esac
d71b2b6b 3934
bd9b35c9
JH
3935: determine optimization, if desired, or use for debug flag also
3936case "$optimize" in
3937' '|$undef) dflt='none';;
3938'') dflt='-O';;
3939*) dflt="$optimize";;
3940esac
3941$cat <<EOH
d71b2b6b 3942
bd9b35c9
JH
3943By default, $package compiles with the -O flag to use the optimizer.
3944Alternately, you might want to use the symbolic debugger, which uses
3945the -g flag (on traditional Unix systems). Either flag can be
3946specified here. To use neither flag, specify the word "none".
d71b2b6b 3947
bd9b35c9
JH
3948EOH
3949rp="What optimizer/debugger flag should be used?"
3950. ./myread
3951optimize="$ans"
3952case "$optimize" in
3953'none') optimize=" ";;
3954esac
3955
3956dflt=''
3957: We will not override a previous value, but we might want to
3958: augment a hint file
3959case "$hint" in
3960default|recommended)
3961 case "$gccversion" in
3962 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 3963 esac
bd9b35c9
JH
3964 case "$optimize" in
3965 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 3966 esac
bd9b35c9
JH
3967 case "$gccversion" in
3968 2*) if test -d /etc/conf/kconfig.d &&
3969 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3970 then
3971 dflt="$dflt -posix"
3972 fi
f0d04425 3973 ;;
bd9b35c9
JH
3974 esac
3975 case "$gccversion" in
3976 1*) ;;
3977 2.[0-8]*) ;;
3978 ?*) echo " "
3979 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3980 echo 'int main(void) { return 0; }' > gcctest.c
3981 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3982 echo "Yes, it does." 2>&1
3983 case "$ccflags" in
3984 *strict-aliasing*)
3985 echo "Leaving current flags $ccflags alone." 2>&1
3986 ;;
3987 *) dflt="$dflt -fno-strict-aliasing" ;;
3988 esac
3989 else
3990 echo "Nope, it doesn't, but that's ok." 2>&1
3991 fi
f0d04425 3992 ;;
e5e20432
JH
3993 esac
3994 ;;
3995esac
3996
bd9b35c9
JH
3997case "$mips_type" in
3998*BSD*|'') inclwanted="$locincpth $usrinc";;
3999*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4000esac
4001for thisincl in $inclwanted; do
4002 if $test -d $thisincl; then
4003 if $test x$thisincl != x$usrinc; then
4004 case "$dflt" in
422af00a
LC
4005 *" -I$thisincl "*);;
4006 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
4007 esac
4008 fi
4009 fi
4010done
40a7a20a 4011
bd9b35c9
JH
4012inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4013 xxx=true;
4014elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4015 xxx=true;
4016else
4017 xxx=false;
4018fi;
4019if $xxx; then
4020 case "$dflt" in
4021 *$2*);;
4022 *) dflt="$dflt -D$2";;
4023 esac;
4024fi'
40a7a20a 4025
bd9b35c9 4026set signal.h LANGUAGE_C; eval $inctest
40a7a20a 4027
bd9b35c9
JH
4028case "$usesocks" in
4029$define)
4030 ccflags="$ccflags -DSOCKS"
4031 ;;
4032esac
40a7a20a 4033
bd9b35c9
JH
4034case "$hint" in
4035default|recommended) dflt="$ccflags $dflt" ;;
4036*) dflt="$ccflags";;
4037esac
40a7a20a 4038
bd9b35c9
JH
4039case "$dflt" in
4040''|' ') dflt=none;;
4041esac
422af00a 4042
bd9b35c9 4043$cat <<EOH
40a7a20a 4044
bd9b35c9
JH
4045Your C compiler may want other flags. For this question you should include
4046-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4047but you should NOT include libraries or ld flags like -lwhatever. If you
4048want $package to honor its debug switch, you should include -DDEBUGGING here.
4049Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 4050
bd9b35c9 4051To use no flags, specify the word "none".
40a7a20a 4052
bd9b35c9
JH
4053EOH
4054set X $dflt
4055shift
4056dflt=${1+"$@"}
4057rp="Any additional cc flags?"
4058. ./myread
4059case "$ans" in
4060none) ccflags='';;
4061*) ccflags="$ans";;
4062esac
8e07c86e 4063
bd9b35c9 4064: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
4065case "$cppflags" in
4066'') cppflags="$ccflags" ;;
4067*) cppflags="$cppflags $ccflags" ;;
4068esac
bd9b35c9
JH
4069case "$gccversion" in
40701*) cppflags="$cppflags -D__GNUC__"
4633a7c4 4071esac
bd9b35c9
JH
4072case "$mips_type" in
4073'');;
4074*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4075esac
4076case "$cppflags" in
4077'');;
4078*)
4079 echo " "
4080 echo "Let me guess what the preprocessor flags are..." >&4
4081 set X $cppflags
4082 shift
4083 cppflags=''
4084 $cat >cpp.c <<'EOM'
4085#define BLURFL foo
8e07c86e 4086
bd9b35c9
JH
4087BLURFL xx LFRULB
4088EOM
4089 previous=''
4090 for flag in $*
4091 do
4092 case "$flag" in
4093 -*) ftry="$flag";;
4094 *) ftry="$previous $flag";;
4095 esac
4096 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4097 >cpp1.out 2>/dev/null && \
4098 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4099 >cpp2.out 2>/dev/null && \
4100 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4101 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4102 then
4103 cppflags="$cppflags $ftry"
4104 previous=''
4105 else
4106 previous="$flag"
4107 fi
4108 done
4109 set X $cppflags
4110 shift
4111 cppflags=${1+"$@"}
4112 case "$cppflags" in
4113 *-*) echo "They appear to be: $cppflags";;
4114 esac
4115 $rm -f cpp.c cpp?.out
2afac517 4116 ;;
4117esac
8e07c86e 4118
bd9b35c9
JH
4119: flags used in final linking phase
4120case "$ldflags" in
4121'') if ./venix; then
4122 dflt='-i -z'
10a23457 4123 else
bd9b35c9 4124 dflt=''
10a23457 4125 fi
bd9b35c9
JH
4126 case "$ccflags" in
4127 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 4128 esac
bd9b35c9
JH
4129 ;;
4130*) dflt="$ldflags";;
4131esac
4132
4133: Try to guess additional flags to pick up local libraries.
4134for thislibdir in $libpth; do
4135 case " $loclibpth " in
4136 *" $thislibdir "*)
4137 case "$dflt " in
4138 *"-L$thislibdir "*) ;;
4139 *) dflt="$dflt -L$thislibdir" ;;
4140 esac
c4f23d77
AD
4141 ;;
4142 esac
bd9b35c9 4143done
c4f23d77 4144
bd9b35c9
JH
4145case "$dflt" in
4146'') dflt='none' ;;
4147esac
c4f23d77 4148
bd9b35c9
JH
4149$cat <<EOH
4150
4151Your C linker may need flags. For this question you should
4152include -L/whatever and any other flags used by the C linker, but you
4153should NOT include libraries like -lwhatever.
4154
4155Make sure you include the appropriate -L/path flags if your C linker
4156does not normally search all of the directories you specified above,
4157namely
4158 $libpth
4159To use no flags, specify the word "none".
4160
4161EOH
4162
4163rp="Any additional ld flags (NOT including libraries)?"
4164. ./myread
4165case "$ans" in
4166none) ldflags='';;
4167*) ldflags="$ans";;
4168esac
4169rmlist="$rmlist pdp11"
4170
4171: coherency check
4172echo " "
4173echo "Checking your choice of C compiler and flags for coherency..." >&4
4174$cat > try.c <<'EOF'
4175#include <stdio.h>
4176int main() { printf("Ok\n"); exit(0); }
4177EOF
7a282f6d 4178set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
4179shift
4180$cat >try.msg <<'EOM'
4181I've tried to compile and run the following simple program:
4182
4183EOM
4184$cat try.c >> try.msg
4185
4186$cat >> try.msg <<EOM
4187
4188I used the command:
4189
4190 $*
4191 ./try
4192
4193and I got the following output:
4194
4195EOM
4196dflt=y
73614538
JH
4197if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4198 if $sh -c './try' >>try.msg 2>&1; then
bd9b35c9
JH
4199 xxx=`./try`
4200 case "$xxx" in
4201 "Ok") dflt=n ;;
4202 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4203 case " $libs " in
4204 *" -lsfio "*)
4205 cat >> try.msg <<'EOQS'
4206If $libs contains -lsfio, and sfio is mis-configured, then it
4207sometimes (apparently) runs and exits with a 0 status, but with no
4208output! It may have to do with sfio's use of _exit vs. exit.
4209
4210EOQS
4211 rp="You have a big problem. Shall I abort Configure"
4212 dflt=y
4213 ;;
4214 esac
4215 ;;
4216 esac
4217 else
4218 echo "The program compiled OK, but exited with status $?." >>try.msg
4219 rp="You have a problem. Shall I abort Configure"
4220 dflt=y
4221 fi
4222else
4223 echo "I can't compile the test program." >>try.msg
4224 rp="You have a BIG problem. Shall I abort Configure"
4225 dflt=y
4226fi
4227case "$dflt" in
4228y)
4229 $cat try.msg >&4
4230 case "$knowitall" in
4231 '')
4232 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 4233 ;;
bd9b35c9 4234 *) dflt=n;;
c4f23d77 4235 esac
bd9b35c9
JH
4236 echo " "
4237 . ./myread
4238 case "$ans" in
4239 n*|N*) ;;
4240 *) echo "Ok. Stopping Configure." >&4
4241 exit 1
c4f23d77
AD
4242 ;;
4243 esac
4244 ;;
bd9b35c9 4245n) echo "OK, that should do.";;
c4f23d77 4246esac
bd9b35c9 4247$rm -f try try.* core
c4f23d77 4248
b4eb6b3d
JH
4249: define an is-a-typedef? function
4250typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4251case "$inclist" in
4252"") inclist="sys/types.h";;
4253esac;
4254eval "varval=\$$var";
4255case "$varval" in
4256"")
4257 $rm -f temp.c;
4258 for inc in $inclist; do
4259 echo "#include <$inc>" >>temp.c;
4260 done;
4261 echo "#ifdef $type" >> temp.c;
4262 echo "printf(\"We have $type\");" >> temp.c;
4263 echo "#endif" >> temp.c;
4264 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4265 if $contains $type temp.E >/dev/null 2>&1; then
4266 eval "$var=\$type";
4267 else
4268 eval "$var=\$def";
4269 fi;
4270 $rm -f temp.?;;
4271*) eval "$var=\$varval";;
4272esac'
4273
4274: define an is-a-typedef? function that prompts if the type is not available.
4275typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4276case "$inclist" in
4277"") inclist="sys/types.h";;
4278esac;
4279eval "varval=\$$var";
4280case "$varval" in
4281"")
4282 $rm -f temp.c;
4283 for inc in $inclist; do
4284 echo "#include <$inc>" >>temp.c;
4285 done;
4286 echo "#ifdef $type" >> temp.c;
4287 echo "printf(\"We have $type\");" >> temp.c;
4288 echo "#endif" >> temp.c;
4289 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4290 echo " " ;
4291 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4292 if $contains $type temp.E >/dev/null 2>&1; then
4293 echo "$type found." >&4;
4294 eval "$var=\$type";
4295 else
4296 echo "$type NOT found." >&4;
4297 dflt="$def";
4298 . ./myread ;
4299 eval "$var=\$ans";
4300 fi;
4301 $rm -f temp.?;;
4302*) eval "$var=\$varval";;
4303esac'
4304
bd9b35c9
JH
4305: define a shorthand compile call
4306compile='
4307mc_file=$1;
4308shift;
08413ebc 4309$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
4310: define a shorthand compile call for compilations that should be ok.
4311compile_ok='
4312mc_file=$1;
4313shift;
7a282f6d 4314$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 4315
b4eb6b3d 4316: check for lengths of integral types
bd9b35c9 4317echo " "
b4eb6b3d
JH
4318case "$intsize" in
4319'')
4320 echo "Checking to see how big your integers are..." >&4
4321 $cat >intsize.c <<'EOCP'
bd9b35c9
JH
4322#include <stdio.h>
4323int main()
4324{
b4eb6b3d
JH
4325 printf("intsize=%d;\n", (int)sizeof(int));
4326 printf("longsize=%d;\n", (int)sizeof(long));
4327 printf("shortsize=%d;\n", (int)sizeof(short));
4328 exit(0);
bd9b35c9 4329}
b4eb6b3d
JH
4330EOCP
4331 set intsize
4332 if eval $compile_ok && ./intsize > /dev/null; then
4333 eval `./intsize`
4334 echo "Your integers are $intsize bytes long."
4335 echo "Your long integers are $longsize bytes long."
4336 echo "Your short integers are $shortsize bytes long."
4337 else
4338 $cat >&4 <<EOM
4339!
4340Help! I can't compile and run the intsize test program: please enlighten me!
4341(This is probably a misconfiguration in your system or libraries, and
4342you really ought to fix it. Still, I'll try anyway.)
4343!
bd9b35c9 4344EOM
b4eb6b3d
JH
4345 dflt=4
4346 rp="What is the size of an integer (in bytes)?"
4347 . ./myread
4348 intsize="$ans"
4349 dflt=$intsize
4350 rp="What is the size of a long integer (in bytes)?"
4351 . ./myread
4352 longsize="$ans"
4353 dflt=2
4354 rp="What is the size of a short integer (in bytes)?"
4355 . ./myread
4356 shortsize="$ans"
4357 fi
4358 ;;
4359esac
4360$rm -f intsize intsize.*
c1a7f87b 4361
b4eb6b3d
JH
4362: see what type lseek is declared as in the kernel
4363rp="What is the type used for lseek's offset on this system?"
4364set off_t lseektype long stdio.h sys/types.h
4365eval $typedef_ask
4366
4367echo " "
4368echo "Checking to see how big your file offsets are..." >&4
4369$cat >try.c <<EOCP
4370#include <sys/types.h>
4371#include <stdio.h>
4372int main()
4373{
4374 printf("%d\n", (int)sizeof($lseektype));
4375 return(0);
4376}
4377EOCP
4378set try
4379if eval $compile_ok; then
4380 lseeksize=`./try`
4381 echo "Your file offsets are $lseeksize bytes long."
4382else
4383 dflt=$longsize
4384 echo " "
4385 echo "(I can't seem to compile the test program. Guessing...)"
4386 rp="What is the size of your file offsets (in bytes)?"
4387 . ./myread
4388 lseeksize="$ans"
4389fi
4390$rm -f try.c try
4391
4392: see what type file positions are declared as in the library
4393rp="What is the type for file position used by fsetpos()?"
4394set fpos_t fpostype long stdio.h sys/types.h
4395eval $typedef_ask
4396
4397echo " "
4398case "$fpostype" in
4399*_t) zzz="$fpostype" ;;
4400*) zzz="fpos_t" ;;
4401esac
4402echo "Checking the size of $zzz..." >&4
4403cat > try.c <<EOCP
4404#include <sys/types.h>
4405#include <stdio.h>
4406int main() {
4407 printf("%d\n", (int)sizeof($fpostype));
4408 exit(0);
4409}
4410EOCP
4411set try
4412if eval $compile_ok; then
4413 yyy=`./try`
4414 case "$yyy" in
4415 '') fpossize=4
4416 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4417 ;;
4418 *) fpossize=$yyy
4419 echo "Your $zzz is $fpossize bytes long."
4420 ;;
4421 esac
4422else
4423 dflt="$longsize"
4424 echo " " >&4
4425 echo "(I can't compile the test program. Guessing...)" >&4
4426 rp="What is the size of your file positions (in bytes)?"
4427 . ./myread
4428 fpossize="$ans"
4429fi
4430
4431
4432
4433# Backward compatibility (uselfs is deprecated).
4434case "$uselfs" in
4435"$define"|true|[yY]*)
4436 cat <<EOM >&4
4437
4438*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4439EOM
4440 uselargefiles="$define"
4441 ;;
4442esac
4443
4444case "$lseeksize:$fpossize" in
44458:8) cat <<EOM
4446
4447You can have files larger than 2 gigabytes.
4448EOM
4449 val="$define" ;;
4450*) case "$uselargefiles" in
4451 "$undef"|false|[nN]*) dflt='n' ;;
4452 *) dflt='y' ;;
4453 esac
4454 cat <<EOM
4455
4456Perl can be built to understand large files (files larger than 2 gigabytes)
4457on some systems. To do so, Configure can be run with -Duselargefiles.
4458
4459If this doesn't make any sense to you, just accept the default '$dflt'.
4460EOM
4461 rp='Try to understand large files, if available?'
4462 . ./myread
4463 case "$ans" in
4464 y|Y) val="$define" ;;
4465 *) val="$undef" ;;
4466 esac
4467 ;;
4468esac
4469set uselargefiles
4470eval $setvar
4471case "$uselargefiles" in
4472"$define")
4473: Look for a hint-file generated 'call-back-unit'. If the
4474: user has specified that a large files perl is to be built,
4475: we may need to set or change some other defaults.
4476 if $test -f uselargefiles.cbu; then
4477 echo "Your platform has some specific hints for large file builds, using them..."
4478 . ./uselargefiles.cbu
4479 echo " "
4480 echo "Rechecking to see how big your file offsets are..." >&4
4481 $cat >try.c <<EOCP
4482#include <sys/types.h>
4483#include <stdio.h>
4484int main()
4485{
4486 printf("%d\n", (int)sizeof($lseektype));
4487 return(0);
4488}
4489EOCP
4490 set try
4491 if eval $compile_ok; then
4492 lseeksize=`./try`
4493 $echo "Your file offsets are now $lseeksize bytes long."
4494 else
4495 dflt="$lseeksize"
4496 echo " "
4497 echo "(I can't seem to compile the test program. Guessing...)"
4498 rp="What is the size of your file offsets (in bytes)?"
4499 . ./myread
4500 lseeksize="$ans"
4501 fi
4502 case "$fpostype" in
4503 *_t) zzz="$fpostype" ;;
4504 *) zzz="fpos_t" ;;
4505 esac
4506 $echo $n "Rechecking the size of $zzz...$c" >&4
4507 $cat > try.c <<EOCP
4508#include <sys/types.h>
4509#include <stdio.h>
4510int main() {
4511 printf("%d\n", (int)sizeof($fpostype));
4512 exit(0);
4513}
4514EOCP
4515 set try
4516 if eval $compile_ok; then
4517 yyy=`./try`
4518 dflt="$lseeksize"
4519 case "$yyy" in
4520 '') echo " "
4521 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4522 ;;
4523 *) fpossize=$yyy
4524 echo " $fpossize bytes." >&4
4525 ;;
4526 esac
4527 else
4528 dflt="$fpossize"
4529 echo " "
4530 echo "(I can't compile the test program. Guessing...)" >&4
4531 rp="What is the size of your file positions (in bytes)?"
4532 . ./myread
4533 fpossize="$ans"
4534 fi
4535 $rm -f try.c try
4536 fi
4537 ;;
4538esac
4539
4540
4541case "$usemorebits" in
4542"$define"|true|[yY]*)
4543 use64bitint="$define"
4544 uselongdouble="$define"
4545 usemorebits="$define"
4546 ;;
4547*) usemorebits="$undef"
4548 ;;
4549esac
4550
8dfa8df9
JH
4551: check for void type
4552echo " "
4553echo "Checking to see how well your C compiler groks the void type..." >&4
4554case "$voidflags" in
4555'')
4556 $cat >try.c <<'EOCP'
4557#if TRY & 1
4558void sub() {
4559#else
4560sub() {
4561#endif
4562 extern void moo(); /* function returning void */
4563 void (*goo)(); /* ptr to func returning void */
4564#if TRY & 8
4565 void *hue; /* generic ptr */
4566#endif
4567#if TRY & 2
4568 void (*foo[10])();
4569#endif
4570
4571#if TRY & 4
4572 if(goo == moo) {
4573 exit(0);
4574 }
4575#endif
4576 exit(0);
4577}
4578int main() { sub(); }
4579EOCP
4580 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4581 voidflags=$defvoidused
4582 echo "Good. It appears to support void to the level $package wants.">&4
4583 if $contains warning .out >/dev/null 2>&1; then
4584 echo "However, you might get some warnings that look like this:"
4585 $cat .out
4586 fi
4587 else
4588echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4589 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4590 echo "It supports 1..."
4591 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4592 echo "It also supports 2..."
4593 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4594 voidflags=7
4595 echo "And it supports 4 but not 8 definitely."
4596 else
4597 echo "It doesn't support 4..."
4598 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4599 voidflags=11
4600 echo "But it supports 8."
4601 else
4602 voidflags=3
4603 echo "Neither does it support 8."
4604 fi
4605 fi
4606 else
4607 echo "It does not support 2..."
4608 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4609 voidflags=13
4610 echo "But it supports 4 and 8."
4611 else
4612 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4613 voidflags=5
4614 echo "And it supports 4 but has not heard about 8."
4615 else
4616 echo "However it supports 8 but not 4."
4617 fi
4618 fi
4619 fi
4620 else
4621 echo "There is no support at all for void."
4622 voidflags=0
4623 fi
4624 fi
4625esac
4626case "$voidflags" in
4627"$defvoidused") ;;
4628*) $cat >&4 <<'EOM'
4629 Support flag bits are:
4630 1: basic void declarations.
4631 2: arrays of pointers to functions returning void.
4632 4: operations between pointers to and addresses of void functions.
4633 8: generic void pointers.
4634EOM
4635 dflt="$voidflags";
4636 rp="Your void support flags add up to what?"
4637 . ./myread
4638 voidflags="$ans"
4639 ;;
4640esac
4641$rm -f try.* .out
4642
4643: check for length of pointer
4644echo " "
4645case "$ptrsize" in
4646'')
4647 echo "Checking to see how big your pointers are..." >&4
4648 if test "$voidflags" -gt 7; then
4649 echo '#define VOID_PTR char *' > try.c
4650 else
4651 echo '#define VOID_PTR void *' > try.c
4652 fi
4653 $cat >>try.c <<'EOCP'
4654#include <stdio.h>
4655int main()
4656{
4657 printf("%d\n", (int)sizeof(VOID_PTR));
4658 exit(0);
4659}
4660EOCP
4661 set try
4662 if eval $compile_ok; then
4663 ptrsize=`./try`
4664 echo "Your pointers are $ptrsize bytes long."
4665 else
4666 dflt='4'
4667 echo "(I can't seem to compile the test program. Guessing...)" >&4
4668 rp="What is the size of a pointer (in bytes)?"
4669 . ./myread
4670 ptrsize="$ans"
4671 fi
4672 ;;
4673esac
4674$rm -f try.c try
4675
4676: check for long long
4677echo " "
4678echo "Checking to see if you have long long..." >&4
4679echo 'int main() { long long x = 7; return 0; }' > try.c
4680set try
4681if eval $compile; then
4682 val="$define"
4683 echo "You have long long."
4684else
4685 val="$undef"
4686 echo "You do not have long long."
4687fi
4688$rm try.*
4689set d_longlong
4690eval $setvar
4691
4692: check for length of long long
4693case "${d_longlong}${longlongsize}" in
4694$define)
4695 echo " "
4696 echo "Checking to see how big your long longs are..." >&4
4697 $cat >try.c <<'EOCP'
4698#include <stdio.h>
4699int main()
4700{
4701 printf("%d\n", (int)sizeof(long long));
4702 return(0);
4703}
4704EOCP
4705 set try
4706 if eval $compile_ok; then
4707 longlongsize=`./try$exe_ext`
4708 echo "Your long longs are $longlongsize bytes long."
4709 else
4710 dflt='8'
4711 echo " "
4712 echo "(I can't seem to compile the test program. Guessing...)"
4713 rp="What is the size of a long long (in bytes)?"
4714 . ./myread
4715 longlongsize="$ans"
4716 fi
4717 if $test "X$longsize" = "X$longlongsize"; then
4718 echo "(That isn't any different from an ordinary long.)"
4719 fi
4720 ;;
4721esac
4722$rm -f try.* try
4723
4724: determine filename position in cpp output
4725echo " "
4726echo "Computing filename position in cpp output for #include directives..." >&4
4727echo '#include <stdio.h>' > foo.c
4728$cat >fieldn <<EOF
4729$startsh
4730$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4731$grep '^[ ]*#.*stdio\.h' | \
4732while read cline; do
4733 pos=1
4734 set \$cline
4735 while $test \$# -gt 0; do
4736 if $test -r \`echo \$1 | $tr -d '"'\`; then
4737 echo "\$pos"
4738 exit 0
4739 fi
4740 shift
4741 pos=\`expr \$pos + 1\`
4742 done
4743done
4744EOF
4745chmod +x fieldn
4746fieldn=`./fieldn`
4747$rm -f foo.c fieldn
4748case $fieldn in
4749'') pos='???';;
47501) pos=first;;
47512) pos=second;;
47523) pos=third;;
4753*) pos="${fieldn}th";;
4754esac
4755echo "Your cpp writes the filename in the $pos field of the line."
4756
4757: locate header file
4758$cat >findhdr <<EOF
4759$startsh
4760wanted=\$1
4761name=''
4762for usrincdir in $usrinc
4763do
4764 if test -f \$usrincdir/\$wanted; then
4765 echo "\$usrincdir/\$wanted"
4766 exit 0
4767 fi
4768done
4769awkprg='{ print \$$fieldn }'
4770echo "#include <\$wanted>" > foo\$\$.c
4771$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4772$grep "^[ ]*#.*\$wanted" | \
4773while read cline; do
4774 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4775 case "\$name" in
4776 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4777 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4778 *) exit 2;;
4779 esac;
4780done;
4781#
4782# status = 0: grep returned 0 lines, case statement not executed
4783# status = 1: headerfile found
4784# status = 2: while loop executed, no headerfile found
4785#
4786status=\$?
4787$rm -f foo\$\$.c;
4788if test \$status -eq 1; then
4789 exit 0;
4790fi
4791exit 1
4792EOF
4793chmod +x findhdr
4794
4795: define an alternate in-header-list? function
4796inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4797cont=true; xxf="echo \"<\$1> found.\" >&4";
4798case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4799*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4800esac;
4801case $# in 4) instead=instead;; *) instead="at last";; esac;
4802while $test "$cont"; do
4803 xxx=`./findhdr $1`
4804 var=$2; eval "was=\$$2";
4805 if $test "$xxx" && $test -r "$xxx";
4806 then eval $xxf;
4807 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4808 cont="";
4809 else eval $xxnf;
4810 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4811 set $yyy; shift; shift; yyy=$@;
4812 case $# in 0) cont="";;
4813 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4814 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4815 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4816 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4817 esac;
4818done;
4819while $test "$yyy";
4820do set $yyy; var=$2; eval "was=\$$2";
4821 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4822 set $yyy; shift; shift; yyy=$@;
4823done'
4824
4825: see if inttypes.h is available
4826: we want a real compile instead of Inhdr because some systems
4827: have an inttypes.h which includes non-existent headers
4828echo " "
4829$cat >try.c <<EOCP
4830#include <inttypes.h>
4831int main() {
4832 static int32_t foo32 = 0x12345678;
4833}
4834EOCP
4835set try
4836if eval $compile; then
4837 echo "<inttypes.h> found." >&4
4838 val="$define"
4839else
4840 echo "<inttypes.h> NOT found." >&4
4841 val="$undef"
4842fi
4843$rm -f try.c try
4844set i_inttypes
4845eval $setvar
4846
4847: check for int64_t
4848echo " "
4849echo "Checking to see if you have int64_t..." >&4
4850$cat >try.c <<EOCP
4851#include <sys/types.h>
4852#$i_inttypes I_INTTYPES
4853#ifdef I_INTTYPES
4854#include <inttypes.h>
4855#endif
4856int main() { int64_t x = 7; }
4857EOCP
4858set try
4859if eval $compile; then
4860 val="$define"
4861 echo "You have int64_t."
4862else
4863 val="$undef"
4864 echo "You do not have int64_t."
4865fi
4866$rm -f try try.*
4867set d_int64_t
4868eval $setvar
4869
4870
4871echo " "
4872echo "Checking which 64-bit integer type we could use..." >&4
4873
4874case "$intsize" in
48758) val=int
4876 set quadtype
4877 eval $setvar
4878 val='"unsigned int"'
4879 set uquadtype
4880 eval $setvar
4881 quadkind=1
4882 ;;
4883*) case "$longsize" in
4884 8) val=long
4885 set quadtype
4886 eval $setvar
4887 val='"unsigned long"'
4888 set uquadtype
4889 eval $setvar
4890 quadkind=2
4891 ;;
4892 *) case "$d_longlong:$longlongsize" in
4893 define:8)
4894 val='"long long"'
4895 set quadtype
4896 eval $setvar
4897 val='"unsigned long long"'
4898 set uquadtype
4899 eval $setvar
4900 quadkind=3
4901 ;;
4902 *) case "$d_int64_t" in
4903 define)
4904 val=int64_t
4905 set quadtype
4906 eval $setvar
4907 val=uint64_t
4908 set uquadtype
4909 eval $setvar
4910 quadkind=4
4911 ;;
4912 esac
4913 ;;
4914 esac
4915 ;;
4916 esac
4917 ;;
4918esac
4919
4920case "$quadtype" in
4921'') echo "Alas, no 64-bit integer types in sight." >&4
4922 d_quad="$undef"
4923 ;;
4924*) echo "We could use '$quadtype' for 64-bit integers." >&4
4925 d_quad="$define"
4926 ;;
4927esac
4928
b4eb6b3d
JH
4929
4930case "$uselonglong" in
4931"$define"|true|[yY]*)
4932 cat <<EOM >&4
4933
4934*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4935EOM
4936 use64bitint="$define"
4937 ;;
4938esac
4939case "$use64bits" in
4940"$define"|true|[yY]*)
4941 cat <<EOM >&4
4942
4943*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4944EOM
4945 use64bitint="$define"
4946 ;;
4947esac
4948case "$use64bitints" in
4949"$define"|true|[yY]*)
4950 cat <<EOM >&4
4951
4952*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4953EOM
4954 use64bitint="$define"
4955 ;;
4956esac
4957case "$use64bitsint" in
4958"$define"|true|[yY]*)
4959 cat <<EOM >&4
4960
4961*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4962EOM
4963 use64bitint="$define"
4964 ;;
4965esac
4966case "$uselonglongs" in
4967"$define"|true|[yY]*)
4968 cat <<EOM >&4
4969
4970*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4971EOM
4972 use64bitint="$define"
4973 ;;
4974esac
4975case "$use64bitsall" in
4976"$define"|true|[yY]*)
4977 cat <<EOM >&4
4978
4979*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4980EOM
4981 use64bitall="$define"
4982 ;;
4983esac
4984
4985case "$ccflags" in
4986*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4987esac
4988case "$use64bitall" in
4989"$define"|true|[yY]*) use64bitint="$define" ;;
4990esac
4991
4992case "$longsize" in
49938) cat <<EOM
4994
4995You have natively 64-bit long integers.
4996EOM
4997 val="$define"
4998 ;;
4999*) case "$use64bitint" in
5000 "$define"|true|[yY]*) dflt='y';;
5001 *) dflt='n';;
5002 esac
8dfa8df9
JH
5003 case "$d_quad" in
5004 "$define") ;;
5005 *) dflt='n' ;;
5006 esac
b4eb6b3d
JH
5007 cat <<EOM
5008
5009Perl can be built to take advantage of 64-bit integer types
5010on some systems. To do so, Configure can be run with -Duse64bitint.
5011Choosing this option will most probably introduce binary incompatibilities.
5012
5013If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5014(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5015EOM
5016 rp='Try to use 64-bit integers, if available?'
5017 . ./myread
5018 case "$ans" in
5019 [yY]*) val="$define" ;;
5020 *) val="$undef" ;;
5021 esac
5022 ;;
5023esac
5024set use64bitint
5025eval $setvar
5026
5027case "$use64bitall" in
5028"$define"|true|[yY]*) dflt='y' ;;
5029*) case "$longsize" in
5030 8) dflt='y' ;;
5031 *) dflt='n' ;;
5032 esac
5033 ;;
5034esac
5035cat <<EOM
5036
5037You may also choose to try maximal 64-bitness. It means using as much
503864-bitness as possible on the platform. This in turn means even more
5039binary incompatibilities. On the other hand, your platform may not
5040have any more 64-bitness available than what you already have chosen.
5041
5042If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5043(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5044EOM
5045rp='Try to use maximal 64-bit support, if available?'
5046. ./myread
5047case "$ans" in
5048[yY]*) val="$define" ;;
5049*) val="$undef" ;;
5050esac
5051set use64bitall
5052eval $setvar
5053case "$use64bitall" in
5054"$define")
5055 case "$use64bitint" in
5056 "$undef")
5057 cat <<EOM
5058
5059Since you have chosen a maximally 64-bit build, I'm also turning on
5060the use of 64-bit integers.
5061EOM
5062 use64bitint="$define" ;;
5063 esac
5064 ;;
5065esac
5066
8dfa8df9
JH
5067case "$use64bitall" in
5068"$define"|true|[yY]*)
5069 case "$ptrsize" in
5070 4) cat <<EOM >&4
5071
5072*** You have chosen a maximally 64-bit build, but your pointers
5073*** are only 4 bytes wide, disabling maximal 64-bitness.
5074
5075EOM
5076 use64bitall="$undef"
5077 case "$use64bitint" in
5078 "$define"|true|[yY]*) ;;
5079 *) cat <<EOM >&4
5080
5081*** Downgrading from maximal 64-bitness to using 64-bit integers.
5082
5083EOM
5084 use64bitint="$define"
5085 ;;
5086 esac
5087 ;;
5088 esac
5089 ;;
5090esac
5091
b4eb6b3d
JH
5092case "$use64bitint" in
5093"$define"|true|[yY]*)
5094: Look for a hint-file generated 'call-back-unit'. If the
5095: user has specified that a 64-bit perl is to be built,
5096: we may need to set or change some other defaults.
5097 if $test -f use64bitint.cbu; then
5098 echo "Your platform has some specific hints for 64-bit integers, using them..."
5099 . ./use64bitint.cbu
5100 fi
5101 case "$longsize" in
5102 4) case "$archname64" in
5103 '') archname64=64int ;;
5104 esac
5105 ;;
5106 esac
5107 ;;
5108esac
5109
5110case "$use64bitall" in
5111"$define"|true|[yY]*)
5112: Look for a hint-file generated 'call-back-unit'. If the
5113: user has specified that a maximally 64-bit perl is to be built,
5114: we may need to set or change some other defaults.
5115 if $test -f use64bitall.cbu; then
5116 echo "Your platform has some specific hints for 64-bit builds, using them..."
5117 . ./use64bitall.cbu
5118 fi
5119 case "$longsize" in
5120 4) case "$archname64" in
5121 ''|64int) archname64=64all ;;
5122 esac
5123 ;;
5124 esac
5125 ;;
5126esac
5127
5128echo " "
5129echo "Checking for GNU C Library..." >&4
5130cat >gnulibc.c <<EOM
5131#include <stdio.h>
5132int main()
5133{
5134#ifdef __GLIBC__
5135 exit(0);
5136#else
5137 exit(1);
5138#endif
5139}
5140EOM
5141set gnulibc
5142if eval $compile_ok && ./gnulibc; then
5143 val="$define"
5144 echo "You are using the GNU C Library"
5145else
5146 val="$undef"
5147 echo "You are not using the GNU C Library"
5148fi
5149$rm -f gnulibc*
5150set d_gnulibc
5151eval $setvar
5152
5153: see if nm is to be used to determine whether a symbol is defined or not
5154case "$usenm" in
5155'')
5156 dflt=''
c1a7f87b
JH
5157 case "$d_gnulibc" in
5158 "$define")
5159 echo " "
5160 echo "nm probably won't work on the GNU C Library." >&4
5161 dflt=n
bd9b35c9 5162 ;;
c1a7f87b
JH
5163 esac
5164 case "$dflt" in
5165 '')
5166 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5167 echo " "
5168 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
5169 echo "'nm' won't be sufficient on this sytem." >&4
5170 dflt=n
5171 fi
5172 ;;
5173 esac
5174 case "$dflt" in
5175 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5176 if $test $dflt -gt 20; then
5177 dflt=y
5178 else
5179 dflt=n
5180 fi
bd9b35c9
JH
5181 ;;
5182 esac
bd9b35c9
JH
5183 ;;
5184*)
c1a7f87b
JH
5185 case "$usenm" in
5186 true|$define) dflt=y;;
5187 *) dflt=n;;
5188 esac
bd9b35c9
JH
5189 ;;
5190esac
5191$cat <<EOM
5192
c1a7f87b
JH
5193I can use $nm to extract the symbols from your C libraries. This
5194is a time consuming task which may generate huge output on the disk (up
5195to 3 megabytes) but that should make the symbols extraction faster. The
5196alternative is to skip the 'nm' extraction part and to compile a small
5197test program instead to determine whether each symbol is present. If
5198you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5199this may be the best solution.
5200
5201You probably shouldn't let me use 'nm' if you are using the GNU C Library.
bd9b35c9
JH
5202
5203EOM
c1a7f87b
JH
5204rp="Shall I use $nm to extract C symbols from the libraries?"
5205. ./myread
5206case "$ans" in
5207[Nn]*) usenm=false;;
5208*) usenm=true;;
bd9b35c9 5209esac
bd9b35c9 5210
c1a7f87b
JH
5211runnm=$usenm
5212case "$reuseval" in
5213true) runnm=false;;
8e07c86e 5214esac
29209bc5 5215
c1a7f87b
JH
5216: nm options which may be necessary
5217case "$nm_opt" in
5218'') if $test -f /mach_boot; then
5219 nm_opt='' # Mach
5220 elif $test -d /usr/ccs/lib; then
5221 nm_opt='-p' # Solaris (and SunOS?)
5222 elif $test -f /dgux; then
5223 nm_opt='-p' # DG-UX
5224 elif $test -f /lib64/rld; then
5225 nm_opt='-p' # 64-bit Irix
5226 else
5227 nm_opt=''
5228 fi;;
5229esac
bd9b35c9 5230
c1a7f87b
JH
5231: nm options which may be necessary for shared libraries but illegal
5232: for archive libraries. Thank you, Linux.
5233case "$nm_so_opt" in
5234'') case "$myuname" in
5235 *linux*)
5236 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5237 nm_so_opt='--dynamic'
5238 fi
5239 ;;
bd9b35c9 5240 esac
c1a7f87b
JH
5241 ;;
5242esac
8e07c86e 5243
c1a7f87b
JH
5244case "$runnm" in
5245true)
5246: get list of predefined functions in a handy place
5247echo " "
5248case "$libc" in
5249'') libc=unknown
5250 case "$libs" in
5251 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
bd9b35c9 5252 esac
ff935051
JH
5253 ;;
5254esac
c1a7f87b
JH
5255libnames='';
5256case "$libs" in
5257'') ;;
5258*) for thislib in $libs; do
5259 case "$thislib" in
5260 -lc|-lc_s)
5261 : Handle C library specially below.
5262 ;;
5263 -l*)
5264 thislib=`echo $thislib | $sed -e 's/^-l//'`
5265 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5266 :
5267 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5268 :
5269 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5270 :
5271 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5272 :
5273 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5274 :
5275 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5276 :
5277 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5278 :
5279 else
5280 try=''
5281 fi
5282 libnames="$libnames $try"
5283 ;;
5284 *) libnames="$libnames $thislib" ;;
34d1710f 5285 esac
c1a7f87b 5286 done
4633a7c4
LW
5287 ;;
5288esac
c1a7f87b
JH
5289xxx=normal
5290case "$libc" in
5291unknown)
5292 set /lib/libc.$so
5293 for xxx in $libpth; do
5294 $test -r $1 || set $xxx/libc.$so
5295 : The messy sed command sorts on library version numbers.
5296 $test -r $1 || \
5297 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5298 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5299 h
5300 s/[0-9][0-9]*/0000&/g
5301 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5302 G
5303 s/\n/ /' | \
381aa1ff 5304 $sort | $sed -e 's/^.* //'`
c1a7f87b
JH
5305 eval set \$$#
5306 done
5307 $test -r $1 || set /usr/ccs/lib/libc.$so
5308 $test -r $1 || set /lib/libsys_s$_a
5309 ;;
5310*)
5311 set blurfl
5312 ;;
a4f3eea9 5313esac
c1a7f87b
JH
5314if $test -r "$1"; then
5315 echo "Your (shared) C library seems to be in $1."
5316 libc="$1"
5317elif $test -r /lib/libc && $test -r /lib/clib; then
5318 echo "Your C library seems to be in both /lib/clib and /lib/libc."
5319 xxx=apollo
5320 libc='/lib/clib /lib/libc'
5321 if $test -r /lib/syslib; then
5322 echo "(Your math library is in /lib/syslib.)"
5323 libc="$libc /lib/syslib"
5324 fi
5325elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5326 echo "Your C library seems to be in $libc, as you said before."
5327elif $test -r $incpath/usr/lib/libc$_a; then
5328 libc=$incpath/usr/lib/libc$_a;
5329 echo "Your C library seems to be in $libc. That's fine."
5330elif $test -r /lib/libc$_a; then
5331 libc=/lib/libc$_a;
5332 echo "Your C library seems to be in $libc. You're normal."
5333else
5334 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5335 :
5336 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5337 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5338 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5339 :
5340 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5341 :
5342 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5343 :
5344 else
5345 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5346 fi
5347 if $test -r "$tans"; then
5348 echo "Your C library seems to be in $tans, of all places."
5349 libc=$tans
5350 else
5351 libc='blurfl'
5352 fi
5353fi
5354if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5355 dflt="$libc"
5356 cat <<EOM
a4f3eea9 5357
c1a7f87b
JH
5358If the guess above is wrong (which it might be if you're using a strange
5359compiler, or your machine supports multiple models), you can override it here.
bd9b35c9
JH
5360
5361EOM
a4f3eea9 5362else
c1a7f87b 5363 dflt=''
381aa1ff 5364 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
c1a7f87b
JH
5365 cat >&4 <<EOM
5366I can't seem to find your C library. I've looked in the following places:
a4f3eea9 5367
c1a7f87b
JH
5368EOM
5369 $sed 's/^/ /' libpath
5370 cat <<EOM
29209bc5 5371
c1a7f87b 5372None of these seems to contain your C library. I need to get its name...
a4f3eea9 5373
bd9b35c9 5374EOM
bd9b35c9 5375fi
c1a7f87b
JH
5376fn=f
5377rp='Where is your C library?'
5378. ./getfile
5379libc="$ans"
a4f3eea9 5380
c1a7f87b 5381echo " "
381aa1ff 5382echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
c1a7f87b
JH
5383set X `cat libnames`
5384shift
5385xxx=files
5386case $# in 1) xxx=file; esac
5387echo "Extracting names from the following $xxx for later perusal:" >&4
5388echo " "
5389$sed 's/^/ /' libnames >&4
5390echo " "
5391$echo $n "This may take a while...$c" >&4
a4f3eea9 5392
c1a7f87b
JH
5393for file in $*; do
5394 case $file in
5395 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5396 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 5397 esac
c1a7f87b 5398done >libc.tmp
a4f3eea9 5399
c1a7f87b
JH
5400$echo $n ".$c"
5401$grep fprintf libc.tmp > libc.ptf
5402xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5403xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5404xxx='[ADTSIW]'
5405if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
5406 eval $xscan;\
5407 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5408 eval $xrun
5409elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5410 eval $xscan;\
5411 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5412 eval $xrun
5413elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5414 eval $xscan;\
5415 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5416 eval $xrun
5417elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5418 eval $xscan;\
5419 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5420 eval $xrun
5421elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5422 eval $xscan;\
5423 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5424 eval $xrun
5425elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5426 eval $xscan;\
5427 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5428 eval $xrun
5429elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5430 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
5431 eval $xscan;\
5432 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5433 eval $xrun
5434elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5435 eval $xscan;\
5436 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5437 eval $xrun
5438elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5439 eval $xscan;\
5440 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5441 eval $xrun
5442elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5443 eval $xscan;\
5444 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5445 eval $xrun
5446elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5447 eval $xscan;\
5448 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5449 eval $xrun
5450elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5451 eval $xscan;\
5452 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5453 eval $xrun
5454elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5455 eval $xscan;\
5456 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5457 eval $xrun
5458elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
5459 eval $xscan;\
5460 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5461 eval $xrun
5462else
5463 $nm -p $* 2>/dev/null >libc.tmp
5464 $grep fprintf libc.tmp > libc.ptf
5465 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5466 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5467 then
5468 nm_opt='-p'
5469 eval $xrun
bd9b35c9 5470 else
c1a7f87b
JH
5471 echo " "
5472 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5473 com=''
5474 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5475 for thisname in $libnames $libc; do
5476 $ar t $thisname >>libc.tmp
5477 done
5478 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5479 echo "Ok." >&4
5480 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5481 # Repeat libc to extract forwarders to DLL entries too
5482 for thisname in $libnames $libc; do
5483 $ar tv $thisname >>libc.tmp
5484 # Revision 50 of EMX has bug in $ar.
5485 # it will not extract forwarders to DLL entries
5486 # Use emximp which will extract exactly them.
5487 emximp -o tmp.imp $thisname \
5488 2>/dev/null && \
5489 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5490 < tmp.imp >>libc.tmp
5491 $rm tmp.imp
5492 done
5493 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5494 echo "Ok." >&4
5495 else
5496 echo "$ar didn't seem to work right." >&4
5497 echo "Maybe this is a Cray...trying bld instead..." >&4
5498 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5499 then
5500 for thisname in $libnames; do
5501 bld t $libnames | \
5502 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5503 $ar t $thisname >>libc.tmp
5504 done
5505 echo "Ok." >&4
bd9b35c9 5506 else
c1a7f87b
JH
5507 echo "That didn't work either. Giving up." >&4
5508 exit 1
bd9b35c9 5509 fi
c1a7f87b 5510 fi
a4f3eea9 5511 fi
a4f3eea9 5512fi
c1a7f87b
JH
5513nm_extract="$com"
5514if $test -f /lib/syscalls.exp; then
5515 echo " "
5516 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5517 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5518fi
5519;;
5520esac
5521$rm -f libnames libpath
bd9b35c9 5522
c1a7f87b
JH
5523: is a C symbol defined?
5524csym='tlook=$1;
5525case "$3" in
5526-v) tf=libc.tmp; tc=""; tdc="";;
5527-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5528*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5529esac;
5530tx=yes;
5531case "$reuseval-$4" in
5532true-) ;;
5533true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5534esac;
5535case "$tx" in
5536yes)
5537 case "$runnm" in
5538 true)
5539 if $contains $tlook $tf >/dev/null 2>&1;
5540 then tval=true;
5541 else tval=false;
5542 fi;;
5543 *)
5544 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
7a282f6d 5545 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
c1a7f87b
JH
5546 then tval=true;
5547 else tval=false;
5548 fi;
5549 $rm -f t t.c;;
5550 esac;;
5551*)
5552 case "$tval" in
5553 $define) tval=true;;
5554 *) tval=false;;
5555 esac;;
5556esac;
5557eval "$2=$tval"'
bd9b35c9 5558
c1a7f87b
JH
5559: define an is-in-libc? function
5560inlibc='echo " "; td=$define; tu=$undef;
5561sym=$1; var=$2; eval "was=\$$2";
5562tx=yes;
5563case "$reuseval$was" in
5564true) ;;
5565true*) tx=no;;
5566esac;
5567case "$tx" in
5568yes)
5569 set $sym tres -f;
5570 eval $csym;
5571 case "$tres" in
5572 true)
5573 echo "$sym() found." >&4;
5574 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5575 *)
5576 echo "$sym() NOT found." >&4;
5577 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5578 esac;;
bd9b35c9 5579*)
c1a7f87b
JH
5580 case "$was" in
5581 $define) echo "$sym() found." >&4;;
5582 *) echo "$sym() NOT found." >&4;;
5583 esac;;
5584esac'
5585
b4eb6b3d
JH
5586: see if sqrtl exists
5587set sqrtl d_sqrtl
c1a7f87b
JH
5588eval $inlibc
5589
b4eb6b3d
JH
5590case "$ccflags" in
5591*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
c1a7f87b 5592esac
b4eb6b3d
JH
5593
5594case "$uselongdouble" in
5595$define|true|[yY]*) dflt='y';;
5596*) dflt='n';;
5597esac
5598cat <<EOM
5599
5600Perl can be built to take advantage of long doubles which
5601(if available) may give more accuracy and range for floating point numbers.
5602
5603If this doesn't make any sense to you, just accept the default '$dflt'.
5604EOM
5605rp='Try to use long doubles if available?'
c1a7f87b
JH
5606. ./myread
5607case "$ans" in
b4eb6b3d
JH
5608y|Y) val="$define" ;;
5609*) val="$undef" ;;
5610esac
5611set uselongdouble
5612eval $setvar
bfb7748a 5613
b4eb6b3d
JH
5614case "$uselongdouble" in
5615true|[yY]*) uselongdouble="$define" ;;
5616esac
bfb7748a 5617
b4eb6b3d
JH
5618case "$uselongdouble" in
5619$define)
5620: Look for a hint-file generated 'call-back-unit'. If the
5621: user has specified that long doubles should be used,
5622: we may need to set or change some other defaults.
5623 if $test -f uselongdouble.cbu; then
5624 echo "Your platform has some specific hints for long doubles, using them..."
5625 . ./uselongdouble.cbu
5626 else
5627 $cat <<EOM
5628(Your platform doesn't have any specific hints for long doubles.)
c1a7f87b 5629EOM
b4eb6b3d
JH
5630 fi
5631 ;;
5632esac
5633
5634case "$uselongdouble:$d_sqrtl" in
5635$define:$undef)
5636 $cat <<EOM >&4
5637
5638*** You requested the use of long doubles but you do not seem to have
5639*** the mathematic functions for long doubles. I'm disabling the use
5640*** of long doubles.
5641
5642EOM
5643 uselongdouble=$undef
5644 ;;
5645esac
5646
5647: check for length of double
5648echo " "
5649case "$doublesize" in
5650'')
5651 echo "Checking to see how big your double precision numbers are..." >&4
5652 $cat >try.c <<'EOCP'
5653#include <stdio.h>
5654int main()
5655{
5656 printf("%d\n", (int)sizeof(double));
5657 exit(0);
5658}
5659EOCP
5660 set try
5661 if eval $compile_ok; then
5662 doublesize=`./try`
5663 echo "Your double is $doublesize bytes long."
5664 else
5665 dflt='8'
5666 echo "(I can't seem to compile the test program. Guessing...)"
5667 rp="What is the size of a double precision number (in bytes)?"
5668 . ./myread
5669 doublesize="$ans"
5670 fi
5671 ;;
5672esac
5673$rm -f try.c try
5674
5675: check for long doubles
5676echo " "
5677echo "Checking to see if you have long double..." >&4
5678echo 'int main() { long double x = 7.0; }' > try.c
5679set try
5680if eval $compile; then
5681 val="$define"
5682 echo "You have long double."
5683else
5684 val="$undef"
5685 echo "You do not have long double."
5686fi
5687$rm try.*
5688set d_longdbl
5689eval $setvar
5690
5691: check for length of long double
5692case "${d_longdbl}${longdblsize}" in
5693$define)
5694 echo " "
5695 echo "Checking to see how big your long doubles are..." >&4
5696 $cat >try.c <<'EOCP'
5697#include <stdio.h>
5698int main()
5699{
5700 printf("%d\n", sizeof(long double));
5701}
5702EOCP
5703 set try
5704 set try
5705 if eval $compile; then
5706 longdblsize=`./try$exe_ext`
5707 echo "Your long doubles are $longdblsize bytes long."
5708 else
5709 dflt='8'
5710 echo " "
5711 echo "(I can't seem to compile the test program. Guessing...)" >&4
5712 rp="What is the size of a long double (in bytes)?"
5713 . ./myread
5714 longdblsize="$ans"
5715 fi
5716 if $test "X$doublesize" = "X$longdblsize"; then
5717 echo "(That isn't any different from an ordinary double.)"
5718 fi
5719 ;;
5720esac
5721$rm -f try.* try
5722
51de783f 5723case "$useperlio" in
5a3a8a02 5724$define|true|[yY]*|'') dflt='y';;
51de783f
JH
5725*) dflt='n';;
5726esac
5727cat <<EOM
5728
5729Previous version of $package used the standard IO mechanisms as
5a3a8a02 5730defined in <stdio.h>. Versions 5.003_02 and later of $package allow
51de783f 5731alternate IO mechanisms via the PerlIO abstraction layer, but the
5a3a8a02
JH
5732stdio mechanism is still available if needed. The abstraction layer
5733can use AT&T's sfio (if you already have sfio installed) or regular stdio.
51de783f
JH
5734Using PerlIO with sfio may cause problems with some extension modules.
5735
5736If this doesn't make any sense to you, just accept the default '$dflt'.
5737EOM
5a3a8a02 5738rp='Use the PerlIO abstraction layer?'
51de783f
JH
5739. ./myread
5740case "$ans" in
5741y|Y)
5742 val="$define"
5a3a8a02 5743 ;;
51de783f
JH
5744*)
5745 echo "Ok, doing things the stdio way."
5746 val="$undef"
5747 ;;
5748esac
5749set useperlio
5750eval $setvar
5751
5752case "$usesocks" in
5753$define|true|[yY]*)
5754 case "$useperlio" in
5755 $define|true|[yY]*) ;;
5756 *) cat >&4 <<EOM
5757
5758You are using the SOCKS proxy protocol library which means that you
5759should also use the PerlIO layer. You may be headed for trouble.
5760
5761EOM
5762 ;;
5763 esac
5764 ;;
5765esac
5766
5767
b4eb6b3d
JH
5768: determine the architecture name
5769echo " "
5770if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5771 tarch=`arch`"-$osname"
5772elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5773 if uname -m > tmparch 2>&1 ; then
5774 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5775 -e 's/$/'"-$osname/" tmparch`
5776 else
5777 tarch="$osname"
5778 fi
5779 $rm -f tmparch
5780else
5781 tarch="$osname"
5782fi
5783case "$myarchname" in
5784''|"$tarch") ;;
5785*)
5786 echo "(Your architecture name used to be $myarchname.)"
5787 archname=''
5788 ;;
5789esac
5790myarchname="$tarch"
5791case "$archname" in
5792'') dflt="$tarch";;
5793*) dflt="$archname";;
5794esac
5795rp='What is your architecture name'
5796. ./myread
5797archname="$ans"
5798case "$usethreads" in
5799$define)
5800 echo "Threads selected." >&4
5801 case "$archname" in
5802 *-thread*) echo "...and architecture name already has -thread." >&4
5803 ;;
5804 *) archname="$archname-thread"
5805 echo "...setting architecture name to $archname." >&4
5806 ;;
5807 esac
5808 ;;
5809esac
5810case "$usemultiplicity" in
5811$define)
5812 echo "Multiplicity selected." >&4
5813 case "$archname" in
5814 *-multi*) echo "...and architecture name already has -multi." >&4
5815 ;;
5816 *) archname="$archname-multi"
5817 echo "...setting architecture name to $archname." >&4
5818 ;;
5819 esac
5820 ;;
5821esac
5822case "$use64bitint$use64bitall" in
5823*"$define"*)
5824 case "$archname64" in
5825 '')
5826 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5827 ;;
5828 *)
5829 case "$use64bitint" in
5830 "$define") echo "64 bit integers selected." >&4 ;;
5831 esac
5832 case "$use64bitall" in
5833 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5834 esac
5835 case "$archname" in
5836 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5837 ;;
5838 *) archname="$archname-$archname64"
5839 echo "...setting architecture name to $archname." >&4
5840 ;;
5841 esac
5842 ;;
5843 esac
5844esac
5845case "$uselongdouble" in
5846$define)
5847 echo "Long doubles selected." >&4
5848 case "$longdblsize" in
5849 $doublesize)
5850 "...but long doubles are equal to doubles, not changing architecture name." >&4
5851 ;;
5852 *)
5853 case "$archname" in
5854 *-ld*) echo "...and architecture name already has -ld." >&4
5855 ;;
5856 *) archname="$archname-ld"
5857 echo "...setting architecture name to $archname." >&4
5858 ;;
5859 esac
5860 ;;
5861 esac
5862 ;;
5863esac
51de783f
JH
5864case "$useperlio" in
5865$define)
5866 echo "Perlio selected." >&4
d46c9a2d
JH
5867 ;;
5868*)
5869 echo "Perlio not selected, using stdio." >&4
51de783f 5870 case "$archname" in
d46c9a2d 5871 *-stdio*) echo "...and architecture name already has -stdio." >&4
51de783f 5872 ;;
d46c9a2d 5873 *) archname="$archname-stdio"
51de783f
JH
5874 echo "...setting architecture name to $archname." >&4
5875 ;;
5876 esac
5877 ;;
5878esac
b4eb6b3d
JH
5879
5880: determine root of directory hierarchy where package will be installed.
5881case "$prefix" in
5882'')
5883 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5884 ;;
5885*)
5886 dflt="$prefix"
5887 ;;
5888esac
5889$cat <<EOM
5890
5891By default, $package will be installed in $dflt/bin, manual pages
5892under $dflt/man, etc..., i.e. with $dflt as prefix for all
5893installation directories. Typically this is something like /usr/local.
5894If you wish to have binaries under /usr/bin but other parts of the
5895installation under /usr/local, that's ok: you will be prompted
5896separately for each of the installation directories, the prefix being
5897only used to set the defaults.
5898
5899EOM
5900fn=d~
5901rp='Installation prefix to use?'
5902. ./getfile
5903oldprefix=''
5904case "$prefix" in
5905'') ;;
5906*)
5907 case "$ans" in
5908 "$prefix") ;;
5909 *) oldprefix="$prefix";;
5910 esac
5911 ;;
5912esac
5913prefix="$ans"
5914prefixexp="$ansexp"
5915
5916: is AFS running?
5917echo " "
5918case "$afs" in
5919$define|true) afs=true ;;
5920$undef|false) afs=false ;;
5921*) if test -d /afs; then
5922 afs=true
5923 else
5924 afs=false
5925 fi
5926 ;;
5927esac
5928if $afs; then
5929 echo "AFS may be running... I'll be extra cautious then..." >&4
5930else
5931 echo "AFS does not seem to be running..." >&4
5932fi
5933
5934: determine installation prefix for where package is to be installed.
5935if $afs; then
5936$cat <<EOM
5937
5938Since you are running AFS, I need to distinguish the directory in which
5939files will reside from the directory in which they are installed (and from
5940which they are presumably copied to the former directory by occult means).
5941
5942EOM
5943 case "$installprefix" in
5944 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5945 *) dflt="$installprefix";;
5946 esac
5947else
5948$cat <<EOM
5949
5950In some special cases, particularly when building $package for distribution,
5951it is convenient to distinguish between the directory in which files should
5952be installed from the directory ($prefix) in which they
5953will eventually reside. For most users, these two directories are the same.
5954
5955EOM
5956 case "$installprefix" in
5957 '') dflt=$prefix ;;
5958 *) dflt=$installprefix;;
5959 esac
5960fi
5961fn=d~
5962rp='What installation prefix should I use for installing files?'
5963. ./getfile
5964installprefix="$ans"
5965installprefixexp="$ansexp"
5966
5967: set the prefixit variable, to compute a suitable default value
5968prefixit='case "$3" in
5969""|none)
5970 case "$oldprefix" in
5971 "") eval "$1=\"\$$2\"";;
5972 *)
5973 case "$3" in
5974 "") eval "$1=";;
5975 none)
5976 eval "tp=\"\$$2\"";
5977 case "$tp" in
5978 ""|" ") eval "$1=\"\$$2\"";;
5979 *) eval "$1=";;
5980 esac;;
5981 esac;;
5982 esac;;
5983*)
5984 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5985 case "$tp" in
5986 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5987 /*-$oldprefix/*|\~*-$oldprefix/*)
5988 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5989 *) eval "$1=\"\$$2\"";;
5990 esac;;
5991esac'
5992
5993
5994: get the patchlevel
5995echo " "
5996echo "Getting the current patchlevel..." >&4
5997if $test -r $rsrc/patchlevel.h;then
5998 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5999 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6000 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6001 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6002 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6003 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6004else
6005 revision=0
6006 patchlevel=0
6007 subversion=0
6008 api_revision=0
6009 api_version=0
6010 api_subversion=0
6011fi
6012$echo "(You have $package version $patchlevel subversion $subversion.)"
6013case "$osname" in
6014dos|vms)
6015 : XXX Should be a Configure test for double-dots in filenames.
6016 version=`echo $revision $patchlevel $subversion | \
6017 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6018 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6019 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6020 ;;
6021*)
6022 version=`echo $revision $patchlevel $subversion | \
6023 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6024 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6025 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6026 ;;
6027esac
6028: Special case the 5.005_xx maintenance series, which used 5.005
6029: without any subversion label as a subdirectory in $sitelib
6030if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6031 api_versionstring='5.005'
6032fi
6033
6034: determine installation style
6035: For now, try to deduce it from prefix unless it is already set.
6036: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6037case "$installstyle" in
6038'') case "$prefix" in
6039 *perl*) dflt='lib';;
6040 *) dflt='lib/perl5' ;;
6041 esac
6042 ;;
6043*) dflt="$installstyle" ;;
6044esac
6045: Probably not worth prompting for this since we prompt for all
6046: the directories individually, and the prompt would be too long and
6047: confusing anyway.
6048installstyle=$dflt
6049
6050: determine where private library files go
6051: Usual default is /usr/local/lib/perl5/$version.
6052: Also allow things like /opt/perl/lib/$version, since
6053: /opt/perl/lib/perl5... would be redundant.
6054: The default "style" setting is made in installstyle.U
6055case "$installstyle" in
6056*lib/perl5*) set dflt privlib lib/$package/$version ;;
6057*) set dflt privlib lib/$version ;;
6058esac
6059eval $prefixit
6060$cat <<EOM
6061
6062There are some auxiliary files for $package that need to be put into a
6063private library directory that is accessible by everyone.
6064
6065EOM
6066fn=d~+
6067rp='Pathname where the private library files will reside?'
6068. ./getfile
6069privlib="$ans"
6070privlibexp="$ansexp"
6071: Change installation prefix, if necessary.
6072if $test X"$prefix" != X"$installprefix"; then
6073 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6074else
6075 installprivlib="$privlibexp"
6076fi
6077
6078: set the prefixup variable, to restore leading tilda escape
6079prefixup='case "$prefixexp" in
6080"$prefix") ;;
6081*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6082esac'
6083
6084: determine where public architecture dependent libraries go
6085set archlib archlib
6086eval $prefixit
6087: privlib default is /usr/local/lib/$package/$version
6088: archlib default is /usr/local/lib/$package/$version/$archname
6089: privlib may have an optional trailing /share.
6090tdflt=`echo $privlib | $sed 's,/share$,,'`
6091tdflt=$tdflt/$archname
6092case "$archlib" in
6093'') dflt=$tdflt
6094 ;;
6095*) dflt="$archlib"
6096 ;;
6097esac
6098$cat <<EOM
6099
6100$spackage contains architecture-dependent library files. If you are
6101sharing libraries in a heterogeneous environment, you might store
6102these files in a separate location. Otherwise, you can just include
6103them with the rest of the public library files.
6104
6105EOM
6106fn=d+~
6107rp='Where do you want to put the public architecture-dependent libraries?'
6108. ./getfile
6109archlib="$ans"
6110archlibexp="$ansexp"
6111if $test X"$archlib" = X"$privlib"; then
6112 d_archlib="$undef"
6113else
6114 d_archlib="$define"
6115fi
6116: Change installation prefix, if necessary.
6117if $test X"$prefix" != X"$installprefix"; then
6118 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6119else
6120 installarchlib="$archlibexp"
6121fi
6122
6123
6124: Binary compatibility with 5.005 is not possible for builds
6125: with advanced features
6126case "$usethreads$usemultiplicity" in
6127*define*)
6128 bincompat5005="$undef"
6129 d_bincompat5005="$undef"
6130 ;;
6131*) $cat <<EOM
6132
6133This version of Perl can be compiled for binary compatibility with 5.005.
6134If you decide to do so, you will be able to continue using most of the
6135extensions that were compiled for Perl 5.005.
6136
6137EOM
6138 case "$bincompat5005$d_bincompat5005" in
6139 *"$undef"*) dflt=n ;;
6140 *) dflt=y ;;
6141 esac
6142 rp='Binary compatibility with Perl 5.005?'
6143 . ./myread
6144 case "$ans" in
6145 y*) val="$define" ;;
6146 *) val="$undef" ;;
6147 esac
6148 set d_bincompat5005
6149 eval $setvar
6150 case "$d_bincompat5005" in
6151 "$define")
6152 bincompat5005="$define"
6153 ;;
6154 *) bincompat5005="$undef"
6155 d_bincompat5005="$undef"
6156 ;;
6157 esac
6158 ;;
6159esac
6160
6161
6162: see if setuid scripts can be secure
6163$cat <<EOM
6164
6165Some kernels have a bug that prevents setuid #! scripts from being
6166secure. Some sites have disabled setuid #! scripts because of this.
6167
6168First let's decide if your kernel supports secure setuid #! scripts.
6169(If setuid #! scripts would be secure but have been disabled anyway,
6170don't say that they are secure if asked.)
6171
6172EOM
6173
6174val="$undef"
6175if $test -d /dev/fd; then
6176 echo "#!$ls" >reflect
6177 chmod +x,u+s reflect
6178 ./reflect >flect 2>&1
6179 if $contains "/dev/fd" flect >/dev/null; then
6180 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6181 val="$define"
6182 else
6183 $cat <<EOM
6184If you are not sure if they are secure, I can check but I'll need a
6185username and password different from the one you are using right now.
6186If you don't have such a username or don't want me to test, simply
6187enter 'none'.
6188
6189EOM
6190 rp='Other username to test security of setuid scripts with?'
6191 dflt='none'
6192 . ./myread
6193 case "$ans" in
6194 n|none)
6195 case "$d_suidsafe" in
6196 '') echo "I'll assume setuid scripts are *not* secure." >&4
6197 dflt=n;;
6198 "$undef")
6199 echo "Well, the $hint value is *not* secure." >&4
6200 dflt=n;;
6201 *) echo "Well, the $hint value *is* secure." >&4
6202 dflt=y;;
6203 esac
c1a7f87b 6204 ;;
b4eb6b3d
JH
6205 *)
6206 $rm -f reflect flect
6207 echo "#!$ls" >reflect
6208 chmod +x,u+s reflect
6209 echo >flect
6210 chmod a+w flect
6211 echo '"su" will (probably) prompt you for '"$ans's password."
6212 su $ans -c './reflect >flect'
6213 if $contains "/dev/fd" flect >/dev/null; then
6214 echo "Okay, it looks like setuid scripts are secure." >&4
6215 dflt=y
6216 else
6217 echo "I don't think setuid scripts are secure." >&4
6218 dflt=n
6219 fi
6220 ;;
6221 esac
6222 rp='Does your kernel have *secure* setuid scripts?'
6223 . ./myread
6224 case "$ans" in
6225 [yY]*) val="$define";;
6226 *) val="$undef";;
6227 esac
6228 fi
6229else
6230 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6231 echo "(That's for file descriptors, not floppy disks.)"
6232 val="$undef"
6233fi
6234set d_suidsafe
6235eval $setvar
6236
6237$rm -f reflect flect
6238
6239: now see if they want to do setuid emulation
6240echo " "
6241val="$undef"
6242case "$d_suidsafe" in
6243"$define")
6244 val="$undef"
6245 echo "No need to emulate SUID scripts since they are secure here." >& 4
6246 ;;
6247*)
6248 $cat <<EOM
6249Some systems have disabled setuid scripts, especially systems where
6250setuid scripts cannot be secure. On systems where setuid scripts have
6251been disabled, the setuid/setgid bits on scripts are currently
6252useless. It is possible for $package to detect those bits and emulate
6253setuid/setgid in a secure fashion. This emulation will only work if
6254setuid scripts have been disabled in your kernel.
6255
6256EOM
6257 case "$d_dosuid" in
6258 "$define") dflt=y ;;
6259 *) dflt=n ;;
6260 esac
6261 rp="Do you want to do setuid/setgid emulation?"
6262 . ./myread
6263 case "$ans" in
6264 [yY]*) val="$define";;
6265 *) val="$undef";;
6266 esac
6267 ;;
6268esac
6269set d_dosuid
6270eval $setvar
6271
b4eb6b3d
JH
6272: see if this is a malloc.h system
6273set malloc.h i_malloc
6274eval $inhdr
6275
6276: see if stdlib is available
6277set stdlib.h i_stdlib
6278eval $inhdr
6279
6280: determine which malloc to compile in
6281echo " "
6282case "$usemymalloc" in
6283''|[yY]*|true|$define) dflt='y' ;;
6284*) dflt='n' ;;
6285esac
8dfa8df9
JH
6286case "$ptrsize" in
62874) ;;
6288*) dflt='n' ;;
6289esac
b4eb6b3d
JH
6290rp="Do you wish to attempt to use the malloc that comes with $package?"
6291. ./myread
6292usemymalloc="$ans"
6293case "$ans" in
6294y*|true)
6295 usemymalloc='y'
6296 mallocsrc='malloc.c'
6297 mallocobj="malloc$_o"
6298 d_mymalloc="$define"
6299 case "$libs" in
6300 *-lmalloc*)
6301 : Remove malloc from list of libraries to use
6302 echo "Removing unneeded -lmalloc from library list" >&4
6303 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6304 shift
6305 libs="$*"
6306 echo "libs = $libs" >&4
6307 ;;
6308 esac
6309 ;;
6310*)
6311 usemymalloc='n'
6312 mallocsrc=''
6313 mallocobj=''
6314 d_mymalloc="$undef"
6315 ;;
6316esac
6317
6318: compute the return types of malloc and free
6319echo " "
6320$cat >malloc.c <<END
6321#$i_malloc I_MALLOC
6322#$i_stdlib I_STDLIB
6323#include <stdio.h>
6324#include <sys/types.h>
6325#ifdef I_MALLOC
6326#include <malloc.h>
6327#endif
6328#ifdef I_STDLIB
6329#include <stdlib.h>
6330#endif
6331#ifdef TRY_MALLOC
6332void *malloc();
6333#endif
6334#ifdef TRY_FREE
6335void free();
6336#endif
6337END
6338case "$malloctype" in
6339'')
6340 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6341 malloctype='void *'
6342 else
6343 malloctype='char *'
6344 fi
6345 ;;
6346esac
6347echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6348
6349case "$freetype" in
6350'')
6351 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6352 freetype='void'
6353 else
6354 freetype='int'
6355 fi
6356 ;;
6357esac
6358echo "Your system uses $freetype free(), it would seem." >&4
6359$rm -f malloc.[co]
6360$cat <<EOM
6361
6362After $package is installed, you may wish to install various
6363add-on modules and utilities. Typically, these add-ons will
6364be installed under $prefix with the rest
6365of this package. However, you may wish to install such add-ons
6366elsewhere under a different prefix.
6367
6368If you do not wish to put everything under a single prefix, that's
6369ok. You will be prompted for the individual locations; this siteprefix
6370is only used to suggest the defaults.
6371
6372The default should be fine for most people.
6373
6374EOM
6375fn=d~+
6376rp='Installation prefix to use for add-on modules and utilities?'
6377: XXX Here might be another good place for an installstyle setting.
6378case "$siteprefix" in
6379'') dflt=$prefix ;;
6380*) dflt=$siteprefix ;;
6381esac
6382. ./getfile
6383: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6384oldsiteprefix=''
6385case "$siteprefix" in
6386'') ;;
6387*) case "$ans" in
6388 "$prefix") ;;
6389 *) oldsiteprefix="$prefix";;
6390 esac
6391 ;;
6392esac
6393siteprefix="$ans"
6394siteprefixexp="$ansexp"
6395
6396: determine where site specific libraries go.
6397: Usual default is /usr/local/lib/perl5/site_perl/$version
6398: The default "style" setting is made in installstyle.U
6399: XXX No longer works with Prefixit stuff.
6400prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6401case "$sitelib" in
6402'') case "$installstyle" in
6403 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6404 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6405 esac
6406 ;;
6407*) dflt="$sitelib"
6408 ;;
6409esac
6410$cat <<EOM
6411
6412The installation process will create a directory for
6413site-specific extensions and modules. Most users find it convenient
6414to place all site-specific files in this directory rather than in the
6415main distribution directory.
6416
6417EOM
6418fn=d~+
6419rp='Pathname for the site-specific library files?'
6420. ./getfile
6421sitelib="$ans"
6422sitelibexp="$ansexp"
6423sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6424: Change installation prefix, if necessary.
6425if $test X"$prefix" != X"$installprefix"; then
6426 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6427else
6428 installsitelib="$sitelibexp"
6429fi
6430
6431: determine where site specific architecture-dependent libraries go.
6432: sitelib default is /usr/local/lib/perl5/site_perl/$version
6433: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6434: sitelib may have an optional trailing /share.
6435case "$sitearch" in
6436'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6437 dflt="$dflt/$archname"
6438 ;;
6439*) dflt="$sitearch"
6440 ;;
6441esac
6442set sitearch sitearch none
6443eval $prefixit
6444$cat <<EOM
6445
6446The installation process will also create a directory for
6447architecture-dependent site-specific extensions and modules.
6448
6449EOM
6450fn=d~+
6451rp='Pathname for the site-specific architecture-dependent library files?'
6452. ./getfile
6453sitearch="$ans"
6454sitearchexp="$ansexp"
6455: Change installation prefix, if necessary.
6456if $test X"$prefix" != X"$installprefix"; then
6457 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6458else
6459 installsitearch="$sitearchexp"
6460fi
6461
6462$cat <<EOM
6463
6464The installation process will also create a directory for
6465vendor-supplied add-ons. Vendors who supply perl with their system
6466may find it convenient to place all vendor-supplied files in this
6467directory rather than in the main distribution directory. This will
6468ease upgrades between binary-compatible maintenance versions of perl.
6469
6470Of course you may also use these directories in whatever way you see
6471fit. For example, you might use them to access modules shared over a
6472company-wide network.
6473
6474The default answer should be fine for most people.
6475This causes further questions about vendor add-ons to be skipped
6476and no vendor-specific directories will be configured for perl.
6477
6478EOM
6479rp='Do you want to configure vendor-specific add-on directories?'
6480case "$usevendorprefix" in
6481define|true|[yY]*) dflt=y ;;
6482*) : User may have set vendorprefix directly on Configure command line.
6483 case "$vendorprefix" in
6484 ''|' ') dflt=n ;;
6485 *) dflt=y ;;
6486 esac
6487 ;;
6488esac
6489. ./myread
6490case "$ans" in
6491[yY]*) fn=d~+
6492 rp='Installation prefix to use for vendor-supplied add-ons?'
6493 case "$vendorprefix" in
6494 '') dflt='' ;;
6495 *) dflt=$vendorprefix ;;
6496 esac
6497 . ./getfile
6498 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6499 oldvendorprefix=''
6500 case "$vendorprefix" in
6501 '') ;;
6502 *) case "$ans" in
6503 "$prefix") ;;
6504 *) oldvendorprefix="$prefix";;
6505 esac
6506 ;;
6507 esac
6508 usevendorprefix="$define"
6509 vendorprefix="$ans"
6510 vendorprefixexp="$ansexp"
6511 ;;
6512*) usevendorprefix="$undef"
6513 vendorprefix=''
6514 vendorprefixexp=''
6515 ;;
6516esac
6517
6518case "$vendorprefix" in
6519'') d_vendorlib="$undef"
6520 vendorlib=''
6521 vendorlibexp=''
6522 ;;
6523*) d_vendorlib="$define"
6524 : determine where vendor-supplied modules go.
6525 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6526 case "$vendorlib" in
6527 '')
6528 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6529 case "$installstyle" in
6530 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6531 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6532 esac
6533 ;;
6534 *) dflt="$vendorlib"
6535 ;;
6536 esac
6537 fn=d~+
6538 rp='Pathname for the vendor-supplied library files?'
6539 . ./getfile
6540 vendorlib="$ans"
6541 vendorlibexp="$ansexp"
6542 ;;
6543esac
6544vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6545: Change installation prefix, if necessary.
6546if $test X"$prefix" != X"$installprefix"; then
6547 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6548else
6549 installvendorlib="$vendorlibexp"
6550fi
6551
6552case "$vendorprefix" in
6553'') d_vendorarch="$undef"
6554 vendorarch=''
6555 vendorarchexp=''
6556 ;;
6557*) d_vendorarch="$define"
6558 : determine where vendor-supplied architecture-dependent libraries go.
6559 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6560 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6561 : vendorlib may have an optional trailing /share.
6562 case "$vendorarch" in
6563 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6564 dflt="$dflt/$archname"
6565 ;;
6566 *) dflt="$vendorarch" ;;
6567 esac
6568 fn=d~+
6569 rp='Pathname for vendor-supplied architecture-dependent files?'
6570 . ./getfile
6571 vendorarch="$ans"
6572 vendorarchexp="$ansexp"
6573 ;;
6574esac
6575: Change installation prefix, if necessary.
6576if $test X"$prefix" != X"$installprefix"; then
6577 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6578else
6579 installvendorarch="$vendorarchexp"
6580fi
6581
6582: Final catch-all directories to search
6583$cat <<EOM
6584
6585Lastly, you can have perl look in other directories for extensions and
6586modules in addition to those already specified.
6587These directories will be searched after
6588 $sitearch
6589 $sitelib
6590EOM
6591test X"$vendorlib" != "X" && echo ' ' $vendorlib
6592test X"$vendorarch" != "X" && echo ' ' $vendorarch
6593echo ' '
6594case "$otherlibdirs" in
6595''|' ') dflt='none' ;;
6596*) dflt="$otherlibdirs" ;;
6597esac
6598$cat <<EOM
6599Enter a colon-separated set of extra paths to include in perl's @INC
6600search path, or enter 'none' for no extra paths.
6601
6602EOM
6603
6604rp='Colon-separated list of additional directories for perl to search?'
6605. ./myread
6606case "$ans" in
6607' '|''|none) otherlibdirs=' ' ;;
6608*) otherlibdirs="$ans" ;;
6609esac
6610case "$otherlibdirs" in
6611' ') val=$undef ;;
6612*) val=$define ;;
6613esac
6614set d_perl_otherlibdirs
6615eval $setvar
6616
6617: Cruising for prototypes
6618echo " "
6619echo "Checking out function prototypes..." >&4
6620$cat >prototype.c <<'EOCP'
6621int main(int argc, char *argv[]) {
6622 exit(0);}
6623EOCP
6624if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6625 echo "Your C compiler appears to support function prototypes."
6626 val="$define"
6627else
6628 echo "Your C compiler doesn't seem to understand function prototypes."
6629 val="$undef"
6630fi
6631set prototype
6632eval $setvar
6633$rm -f prototype*
6634
6635case "$prototype" in
6636"$define") ;;
6637*) ansi2knr='ansi2knr'
6638 echo " "
6639 cat <<EOM >&4
6640
6641$me: FATAL ERROR:
6642This version of $package can only be compiled by a compiler that
6643understands function prototypes. Unfortunately, your C compiler
6644 $cc $ccflags
6645doesn't seem to understand them. Sorry about that.
6646
6647If GNU cc is available for your system, perhaps you could try that instead.
6648
6649Eventually, we hope to support building Perl with pre-ANSI compilers.
6650If you would like to help in that effort, please contact <perlbug@perl.org>.
6651
6652Aborting Configure now.
6653EOM
6654 exit 2
6655 ;;
6656esac
6657
6658: determine where public executables go
6659echo " "
6660set dflt bin bin
6661eval $prefixit
6662fn=d~
6663rp='Pathname where the public executables will reside?'
6664. ./getfile
6665if $test "X$ansexp" != "X$binexp"; then
6666 installbin=''
6667fi
6668bin="$ans"
6669binexp="$ansexp"
6670: Change installation prefix, if necessary.
6671: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6672if $test X"$prefix" != X"$installprefix"; then
6673 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6674else
6675 installbin="$binexp"
6676fi
6677
6678: Find perl5.005 or later.
6679echo "Looking for a previously installed perl5.005 or later... "
6680case "$perl5" in
6681'') for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6682 : Check if this perl is recent and can load a simple module
6683 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6684 perl5=$tdir/perl
6685 break;
6686 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6687 perl5=$tdir/perl
6688 break;
6689 fi
6690 done
6691 ;;
6692*) perl5="$perl5"
6693 ;;
6694esac
6695case "$perl5" in
6696'') echo "None found. That's ok.";;
6697*) echo "Using $perl5." ;;
6698esac
6699
6700: Determine list of previous versions to include in @INC
6701$cat > getverlist <<EOPL
6702#!$perl5 -w
6703use File::Basename;
6704\$api_versionstring = "$api_versionstring";
6705\$version = "$version";
6706\$stem = "$sitelib_stem";
6707\$archname = "$archname";
6708EOPL
6709 $cat >> getverlist <<'EOPL'
6710# Can't have leading @ because metaconfig interprets it as a command!
6711;@inc_version_list=();
6712# XXX Redo to do opendir/readdir?
6713if (-d $stem) {
6714 chdir($stem);
6715 ;@candidates = glob("5.*");
6716}
6717else {
6718 ;@candidates = ();
6719}
6720
6721# XXX ToDo: These comparisons must be reworked when two-digit
6722# subversions come along, so that 5.7.10 compares as greater than
6723# 5.7.3! By that time, hope that 5.6.x is sufficiently
6724# widespread that we can use the built-in version vectors rather
6725# than reinventing them here. For 5.6.0, however, we must
6726# assume this script will likely be run by 5.005_0x. --AD 1/2000.
6727foreach $d (@candidates) {
6728 if ($d lt $version) {
6729 if ($d ge $api_versionstring) {
6730 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6731 }
6732 elsif ($d ge "5.005") {
6733 unshift(@inc_version_list, grep { -d } $d);
6734 }
6735 }
6736 else {
6737 # Skip newer version. I.e. don't look in
6738 # 5.7.0 if we're installing 5.6.1.
6739 }
6740}
6741
6742if (@inc_version_list) {
6743 print join(' ', @inc_version_list);
6744}
6745else {
6746 # Blank space to preserve value for next Configure run.
6747 print " ";
6748}
6749EOPL
6750chmod +x getverlist
6751case "$inc_version_list" in
6752'') if test -x "$perl5"; then
6753 dflt=`$perl5 getverlist`
6754 else
6755 dflt='none'
6756 fi
6757 ;;
6758$undef) dflt='none' ;;
6759*) dflt="$inc_version_list" ;;
6760esac
6761case "$dflt" in
6762''|' ') dflt=none ;;
6763esac
6764case "$dflt" in
67655.005) case "$bincompat5005" in
6766 $define|true|[yY]*) ;;
6767 *) dflt=none ;;
6768 esac
6769 ;;
6770esac
6771$cat <<'EOM'
6772
6773In order to ease the process of upgrading, this version of perl
6774can be configured to use modules built and installed with earlier
6775versions of perl that were installed under $prefix. Specify here
6776the list of earlier versions that this version of perl should check.
6777If Configure detected no earlier versions of perl installed under
6778$prefix, then the list will be empty. Answer 'none' to tell perl
6779to not search earlier versions.
6780
6781The default should almost always be sensible, so if you're not sure,
6782just accept the default.
6783EOM
6784
6785rp='List of earlier versions to include in @INC?'
6786. ./myread
6787case "$ans" in
6788[Nn]one|''|' ') inc_version_list=' ' ;;
6789*) inc_version_list="$ans" ;;
6790esac
6791case "$inc_version_list" in
6792''|' ')
6793 inc_version_list_init='0';;
6794*) inc_version_list_init=`echo $inc_version_list |
6795 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6796 ;;
6797esac
6798$rm -f getverlist
6799
6800: determine whether to install perl also as /usr/bin/perl
6801
6802echo " "
6803if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6804 $cat <<EOM
6805Many scripts expect perl to be installed as /usr/bin/perl.
6806I can install the perl you are about to compile also as /usr/bin/perl
6807(in addition to $installbin/perl).
6808EOM
6809 case "$installusrbinperl" in
6810 "$undef"|[nN]*) dflt='n';;
6811 *) dflt='y';;
6812 esac
6813 rp="Do you want to install perl as /usr/bin/perl?"
6814 . ./myread
6815 case "$ans" in
6816 [yY]*) val="$define";;
6817 *) val="$undef" ;;
6818 esac
6819else
6820 val="$undef"
6821fi
6822set installusrbinperl
6823eval $setvar
6824
6825: see if dld is available
6826set dld.h i_dld
6827eval $inhdr
6828
6829: see if dlopen exists
6830xxx_runnm="$runnm"
6831runnm=false
6832set dlopen d_dlopen
6833eval $inlibc
6834runnm="$xxx_runnm"
6835
6836: determine which dynamic loading, if any, to compile in
6837echo " "
6838dldir="ext/DynaLoader"
6839case "$usedl" in
6840$define|y|true)
6841 dflt='y'
6842 usedl="$define"
6843 ;;
6844$undef|n|false)
6845 dflt='n'
6846 usedl="$undef"
6847 ;;
6848*)
6849 dflt='n'
6850 case "$d_dlopen" in
6851 $define) dflt='y' ;;
6852 esac
6853 case "$i_dld" in
6854 $define) dflt='y' ;;
6855 esac
6856 : Does a dl_xxx.xs file exist for this operating system
6857 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6858 ;;
6859esac
6860rp="Do you wish to use dynamic loading?"
6861. ./myread
6862usedl="$ans"
6863case "$ans" in
6864y*) usedl="$define"
6865 case "$dlsrc" in
6866 '')
6867 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6868 dflt="$dldir/dl_${osname}.xs"
6869 elif $test "$d_dlopen" = "$define" ; then
6870 dflt="$dldir/dl_dlopen.xs"
6871 elif $test "$i_dld" = "$define" ; then
6872 dflt="$dldir/dl_dld.xs"
6873 else
6874 dflt=''
6875 fi
6876 ;;
6877 *) dflt="$dldir/$dlsrc"
6878 ;;
6879 esac
6880 echo "The following dynamic loading files are available:"
6881 : Can not go over to $dldir because getfile has path hard-coded in.
6882 tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6883 rp="Source file to use for dynamic loading"
6884 fn="fne"
6885 gfpth="$src"
6886 . ./getfile
6887 usedl="$define"
6888 : emulate basename
6889 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6890
6891 $cat << EOM
6892
6893Some systems may require passing special flags to $cc -c to
6894compile modules that will be used to create a shared library.
6895To use no flags, say "none".
6896
6897EOM
6898 case "$cccdlflags" in
6899 '') case "$gccversion" in
6900 '') case "$osname" in
6901 hpux) dflt='+z' ;;
6902 next) dflt='none' ;;
6903 irix*) dflt='-KPIC' ;;
48bcfe03 6904 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
6905 sunos) dflt='-pic' ;;
6906 *) dflt='none' ;;
6907 esac
6908 ;;
6909 *) case "$osname" in
48bcfe03 6910 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
6911 *) dflt='-fpic' ;;
6912 esac ;;
6913 esac ;;
6914 ' ') dflt='none' ;;
6915 *) dflt="$cccdlflags" ;;
6916 esac
6917 rp="Any special flags to pass to $cc -c to compile shared library modules?"
6918 . ./myread
6919 case "$ans" in
6920 none) cccdlflags=' ' ;;
6921 *) cccdlflags="$ans" ;;
6922 esac
6923
6924 cat << EOM
6925
6926Some systems use ld to create libraries that can be dynamically loaded,
6927while other systems (such as those using ELF) use $cc.
6928
6929EOM
6930 case "$ld" in
6931 '') $cat >try.c <<'EOM'
6932/* Test for whether ELF binaries are produced */
6933#include <fcntl.h>
6934#include <stdlib.h>
6935int main() {
6936 char b[4];
6937 int i = open("a.out",O_RDONLY);
6938 if(i == -1)
6939 exit(1); /* fail */
6940 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6941 exit(0); /* succeed (yes, it's ELF) */
6942 else
6943 exit(1); /* fail */
6944}
6945EOM
e4778687 6946 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && ./a.out; then
b4eb6b3d
JH
6947 cat <<EOM
6948You appear to have ELF support. I'll use $cc to build dynamic libraries.
6949EOM
6950 dflt="$cc"
6951 else
6952 echo "I'll use ld to build dynamic libraries."
6953 dflt='ld'
6954 fi
6955 rm -f try.c a.out
6956 ;;
6957 *) dflt="$ld"
6958 ;;
6959 esac
6960
6961 rp="What command should be used to create dynamic libraries?"
6962 . ./myread
6963 ld="$ans"
6964
6965 cat << EOM
6966
6967Some systems may require passing special flags to $ld to create a
6968library that can be dynamically loaded. If your ld flags include
6969-L/other/path options to locate libraries outside your loader's normal
6970search path, you may need to specify those -L options here as well. To
6971use no flags, say "none".
6972
6973EOM
6974 case "$lddlflags" in
6975 '') case "$osname" in
6976 beos) dflt='-nostart' ;;
6977 hpux) dflt='-b';
6978 case "$gccversion" in
6979 '') dflt="$dflt +vnocompatwarnings" ;;
6980 esac
6981 ;;
6982 linux|irix*) dflt='-shared' ;;
6983 next) dflt='none' ;;
6984 solaris) dflt='-G' ;;
6985 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 6986 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
6987 *) dflt='none' ;;
6988 esac
6989 ;;
6990 *) dflt="$lddlflags" ;;
6991 esac
6992
6993 : Try to guess additional flags to pick up local libraries.
6994 : Be careful not to append to a plain 'none'
6995 case "$dflt" in
6996 none) dflt='' ;;
6997 esac
6998 for thisflag in $ldflags; do
6999 case "$thisflag" in
7000 -L*|-R*)
7001 case " $dflt " in
7002 *" $thisflag "*) ;;
7003 *) dflt="$dflt $thisflag" ;;
7004 esac
7005 ;;
7006 esac
7007 done
7008
7009 case "$dflt" in
7010 ''|' ') dflt='none' ;;
7011 esac
7012
7013 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7014 . ./myread
7015 case "$ans" in
7016 none) lddlflags=' ' ;;
7017 *) lddlflags="$ans" ;;
7018 esac
7019
7020 cat <<EOM
7021
7022Some systems may require passing special flags to $cc to indicate that
7023the resulting executable will use dynamic linking. To use no flags,
7024say "none".
7025
7026EOM
7027 case "$ccdlflags" in
7028 '') case "$osname" in
7029 hpux) dflt='-Wl,-E' ;;
7030 linux) dflt='-rdynamic' ;;
7031 next) dflt='none' ;;
7032 sunos) dflt='none' ;;
7033 *) dflt='none' ;;
7034 esac ;;
7035 ' ') dflt='none' ;;
7036 *) dflt="$ccdlflags" ;;
7037 esac
7038 rp="Any special flags to pass to $cc to use dynamic linking?"
7039 . ./myread
7040 case "$ans" in
7041 none) ccdlflags=' ' ;;
7042 *) ccdlflags="$ans" ;;
7043 esac
7044 ;;
7045*) usedl="$undef"
7046 ld='ld'
7047 dlsrc='dl_none.xs'
7048 lddlflags=''
7049 ccdlflags=''
7050 ;;
7051esac
7052
7053also=''
7054case "$usedl" in
7055$undef)
7056 # No dynamic loading being used, so don't bother even to prompt.
7057 useshrplib='false'
7058 ;;
7059*) case "$useshrplib" in
7060 '') case "$osname" in
48bcfe03 7061 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7062 dflt=y
7063 also='Building a shared libperl is required for dynamic loading to work on your system.'
7064 ;;
7065 next*)
7066 case "$osvers" in
7067 4*) dflt=y
7068 also='Building a shared libperl is needed for MAB support.'
7069 ;;
7070 *) dflt=n
7071 ;;
7072 esac
7073 ;;
7074 *) dflt=n
7075 ;;
7076 esac
7077 ;;
7078 $define|true|[Yy]*)
7079 dflt=y
7080 ;;
7081 *) dflt=n
7082 ;;
7083 esac
7084 $cat << EOM
7085
7086The perl executable is normally obtained by linking perlmain.c with
7087libperl${_a}, any static extensions (usually just DynaLoader), and
7088any other libraries needed on this system (such as -lm, etc.). Since
7089your system supports dynamic loading, it is probably possible to build
7090a shared libperl.$so. If you will have more than one executable linked
7091to libperl.$so, this will significantly reduce the size of each
7092executable, but it may have a noticeable affect on performance. The
7093default is probably sensible for your system.
7094$also
7095
7096EOM
7097 rp="Build a shared libperl.$so (y/n)"
7098 . ./myread
7099 case "$ans" in
7100 true|$define|[Yy]*)
7101 useshrplib='true' ;;
7102 *) useshrplib='false' ;;
7103 esac
7104 ;;
7105esac
7106
7107case "$useshrplib" in
7108true)
7109 case "$libperl" in
7110 '')
7111 # Figure out a good name for libperl.so. Since it gets stored in
7112 # a version-specific architecture-dependent library, the version
7113 # number isn't really that important, except for making cc/ld happy.
7114 #
7115 # A name such as libperl.so.3.1
7116 majmin="libperl.$so.$patchlevel.$subversion"
7117 # A name such as libperl.so.301
7118 majonly=`echo $patchlevel $subversion |
7119 $awk '{printf "%d%02d", $1, $2}'`
7120 majonly=libperl.$so.$majonly
7121 # I'd prefer to keep the os-specific stuff here to a minimum, and
7122 # rely on figuring it out from the naming of libc.
7123 case "${osname}${osvers}" in
7124 next4*)
7125 dflt=libperl.5.$so
7126 # XXX How handle the --version stuff for MAB?
7127 ;;
7128 linux*) # ld won't link with a bare -lperl otherwise.
7129 dflt=libperl.$so
7130 ;;
7131 cygwin*) # include version
7132 dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7133 ;;
7134 *) # Try to guess based on whether libc has major.minor.
7135 case "$libc" in
7136 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7137 *libc.$so.[0-9]*) dflt=$majonly ;;
7138 *) dflt=libperl.$so ;;
7139 esac
7140 ;;
7141 esac
7142 ;;
7143 *) dflt=$libperl
7144 ;;
7145 esac
7146 cat << EOM
7147
7148I need to select a good name for the shared libperl. If your system uses
7149library names with major and minor numbers, then you might want something
7150like $majmin. Alternatively, if your system uses a single version
7151number for shared libraries, then you might want to use $majonly.
7152Or, your system might be quite happy with a simple libperl.$so.
7153
7154Since the shared libperl will get installed into a version-specific
7155architecture-dependent directory, the version number of the shared perl
7156library probably isn't important, so the default should be o.k.
7157
7158EOM
7159 rp='What name do you want to give to the shared libperl?'
7160 . ./myread
7161 libperl=$ans
7162 echo "Ok, I'll use $libperl"
7163 ;;
7164*)
7165 libperl="libperl${_a}"
7166 ;;
7167esac
7168
7169# Detect old use of shrpdir via undocumented Configure -Dshrpdir
7170case "$shrpdir" in
7171'') ;;
7172*) $cat >&4 <<EOM
7173WARNING: Use of the shrpdir variable for the installation location of
7174the shared $libperl is not supported. It was never documented and
7175will not work in this version. Let me (perlbug@perl.org)
7176know of any problems this may cause.
7177
7178EOM
7179 case "$shrpdir" in
7180 "$archlibexp/CORE")
7181 $cat >&4 <<EOM
7182But your current setting of $shrpdir is
7183the default anyway, so it's harmless.
7184EOM
7185 ;;
7186 *)
7187 $cat >&4 <<EOM
7188Further, your current attempted setting of $shrpdir
7189conflicts with the value of $archlibexp/CORE
7190that installperl will use.
7191EOM
7192 ;;
7193 esac
7194 ;;
7195esac
7196
7197# How will the perl executable find the installed shared $libperl?
7198# Add $xxx to ccdlflags.
7199# If we can't figure out a command-line option, use $shrpenv to
7200# set env LD_RUN_PATH. The main perl makefile uses this.
7201shrpdir=$archlibexp/CORE
7202xxx=''
7203tmp_shrpenv=''
7204if "$useshrplib"; then
7205 case "$osname" in
7206 aix)
7207 # We'll set it in Makefile.SH...
7208 ;;
7209 solaris|netbsd)
7210 xxx="-R $shrpdir"
7211 ;;
7212 freebsd)
7213 xxx="-Wl,-R$shrpdir"
7214 ;;
7215 linux|irix*|dec_osf)
7216 xxx="-Wl,-rpath,$shrpdir"
7217 ;;
7218 next)
7219 # next doesn't like the default...
7220 ;;
7221 beos)
7222 # beos doesn't like the default, either.
7223 ;;
7224 hpux*)
7225 # hpux doesn't like the default, either.
7226 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7227 ;;
7228 *)
7229 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7230 ;;
7231 esac
7232 case "$xxx" in
7233 '') ;;
7234 *)
7235 # Only add $xxx if it isn't already in ccdlflags.
7236 case " $ccdlflags " in
7237 *" $xxx "*) ;;
7238 *) ccdlflags="$ccdlflags $xxx"
7239 cat <<EOM >&4
7240
7241Adding $xxx to the flags
7242passed to $ld so that the perl executable will find the
7243installed shared $libperl.
7244
7245EOM
7246 ;;
7247 esac
7248 ;;
7249 esac
7250fi
7251# Fix ccdlflags in AIX for building external extensions.
7252# (For building Perl itself bare -bE:perl.exp is needed,
7253# Makefile.SH takes care of this.)
7254case "$osname" in
7255aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7256esac
7257# Respect a hint or command-line value.
7258case "$shrpenv" in
7259'') shrpenv="$tmp_shrpenv" ;;
7260esac
7261case "$ldlibpthname" in
7262'') ldlibpthname=LD_LIBRARY_PATH ;;
7263none) ldlibpthname='' ;;
7264esac
7265
7266: determine where manual pages are on this system
7267echo " "
7268case "$sysman" in
7269'')
7270 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
7271 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
7272 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7273 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7274 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7275 sysman=`./loc . /usr/man/man1 $syspath`
7276 ;;
7277esac
7278if $test -d "$sysman"; then
7279 echo "System manual is in $sysman." >&4
7280else
7281 echo "Could not find manual pages in source form." >&4
7282fi
7283
7284: determine where manual pages go
7285set man1dir man1dir none
7286eval $prefixit
7287$cat <<EOM
7288
7289$spackage has manual pages available in source form.
7290EOM
7291case "$nroff" in
7292nroff)
7293 echo "However, you don't have nroff, so they're probably useless to you."
7294 case "$man1dir" in
7295 '') man1dir="none";;
7296 esac;;
7297esac
7298echo "If you don't want the manual sources installed, answer 'none'."
7299case "$man1dir" in
7300' ') dflt=none
7301 ;;
7302'')
7303 lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
7304 lookpath="$lookpath $prefixexp/man/p_man/man1"
7305 lookpath="$lookpath $prefixexp/man/u_man/man1"
7306 lookpath="$lookpath $prefixexp/man/man.1"
7307 case "$sysman" in
7308 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7309 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7310 esac
7311 set dflt
7312 eval $prefixup
7313 ;;
7314*) dflt="$man1dir"
7315 ;;
7316esac
7317echo " "
7318fn=dn+~
7319rp="Where do the main $spackage manual pages (source) go?"
7320. ./getfile
7321if $test "X$man1direxp" != "X$ansexp"; then
7322 installman1dir=''
7323fi
7324man1dir="$ans"
7325man1direxp="$ansexp"
7326case "$man1dir" in
7327'') man1dir=' '
7328 installman1dir='';;
7329esac
7330
7331: Change installation prefix, if necessary.
7332if $test X"$prefix" != X"$installprefix"; then
7333 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7334else
7335 installman1dir="$man1direxp"
7336fi
7337
7338: What suffix to use on installed man pages
7339
7340case "$man1dir" in
7341' ')
7342 man1ext='0'
7343 ;;
7344*)
7345 rp="What suffix should be used for the main $spackage man pages?"
7346 case "$man1ext" in
7347 '') case "$man1dir" in
7348 *1) dflt=1 ;;
7349 *1p) dflt=1p ;;
7350 *1pm) dflt=1pm ;;
7351 *l) dflt=l;;
7352 *n) dflt=n;;
7353 *o) dflt=o;;
7354 *p) dflt=p;;
7355 *C) dflt=C;;
7356 *L) dflt=L;;
7357 *L1) dflt=L1;;
7358 *) dflt=1;;
7359 esac
7360 ;;
7361 *) dflt="$man1ext";;
7362 esac
7363 . ./myread
7364 man1ext="$ans"
7365 ;;
7366esac
7367
7368: see if we can have long filenames
7369echo " "
7370first=123456789abcdef
7371$rm -f $first
7372if (echo hi >$first) 2>/dev/null; then
7373 if $test -f 123456789abcde; then
7374 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
7375 val="$undef"
7376 else
7377 echo 'You can have filenames longer than 14 characters.'>&4
7378 val="$define"
7379 fi
7380else
7381 $cat <<'EOM'
7382You can't have filenames longer than 14 chars.
7383You can't even think about them!
7384EOM
7385 val="$undef"
7386fi
7387set d_flexfnam
7388eval $setvar
7389$rm -rf 123456789abcde*
7390
7391: determine where library module manual pages go
7392set man3dir man3dir none
7393eval $prefixit
7394$cat <<EOM
7395
7396$spackage has manual pages for many of the library modules.
7397EOM
7398
7399case "$nroff" in
7400nroff)
7401 $cat <<'EOM'
7402However, you don't have nroff, so they're probably useless to you.
7403EOM
7404 case "$man3dir" in
7405 '') man3dir="none";;
7406 esac;;
7407esac
7408
7409case "$d_flexfnam" in
7410undef)
7411 $cat <<'EOM'
7412However, your system can't handle the long file names like File::Basename.3.
7413EOM
7414 case "$man3dir" in
7415 '') man3dir="none";;
7416 esac;;
7417esac
7418
7419echo "If you don't want the manual sources installed, answer 'none'."
7420prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7421case "$man3dir" in
7422'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7423 if $test -d "$privlib/man/man3"; then
7424 cat <<EOM >&4
7425
7426WARNING: Previous versions of perl installed man3 pages into
7427$privlib/man/man3. This version will suggest a
7428new default of $dflt.
7429EOM
7430 tdflt=$dflt
7431 dflt='n'
7432 rp='Do you wish to preserve the old behavior?(y/n)'
7433 . ./myread
7434 case "$ans" in
7435 y*) dflt="$privlib/man/man3" ;;
7436 *) dflt=$tdflt ;;
7437 esac
7438 fi
7439 ;;
7440*) dflt="$man3dir" ;;
7441esac
7442case "$dflt" in
7443' ') dflt=none ;;
7444esac
7445echo " "
7446fn=dn+~
7447rp="Where do the $package library man pages (source) go?"
7448. ./getfile
7449man3dir="$ans"
7450man3direxp="$ansexp"
7451case "$man3dir" in
7452'') man3dir=' '
7453 installman3dir='';;
7454esac
7455
7456: Change installation prefix, if necessary.
7457if $test X"$prefix" != X"$installprefix"; then
7458 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7459else
7460 installman3dir="$man3direxp"
7461fi
7462
7463: What suffix to use on installed man pages
7464case "$man3dir" in
7465' ')
7466 man3ext='0'
7467 ;;
7468*)
7469 rp="What suffix should be used for the $package library man pages?"
7470 case "$man3ext" in
7471 '') case "$man3dir" in
7472 *3) dflt=3 ;;
7473 *3p) dflt=3p ;;
7474 *3pm) dflt=3pm ;;
7475 *l) dflt=l;;
7476 *n) dflt=n;;
7477 *o) dflt=o;;
7478 *p) dflt=p;;
7479 *C) dflt=C;;
7480 *L) dflt=L;;
7481 *L3) dflt=L3;;
7482 *) dflt=3;;
7483 esac
7484 ;;
7485 *) dflt="$man3ext";;
7486 esac
7487 . ./myread
7488 man3ext="$ans"
7489 ;;
7490esac
7491
7492: see if we have to deal with yellow pages, now NIS.
7493if $test -d /usr/etc/yp || $test -d /etc/yp; then
7494 if $test -f /usr/etc/nibindd; then
7495 echo " "
7496 echo "I'm fairly confident you're on a NeXT."
7497 echo " "
7498 rp='Do you get the hosts file via NetInfo?'
7499 dflt=y
7500 case "$hostcat" in
7501 nidump*) ;;
7502 '') ;;
7503 *) dflt=n;;
7504 esac
7505 . ./myread
7506 case "$ans" in
7507 y*) hostcat='nidump hosts .';;
7508 *) case "$hostcat" in
7509 nidump*) hostcat='';;
7510 esac
7511 ;;
7512 esac
7513 fi
7514 case "$hostcat" in
7515 nidump*) ;;
7516 *)
7517 case "$hostcat" in
7518 *ypcat*) dflt=y;;
7519 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7520 dflt=y
7521 else
7522 dflt=n
7523 fi;;
7524 *) dflt=n;;
7525 esac
7526 echo " "
7527 rp='Are you getting the hosts file via yellow pages?'
7528 . ./myread
7529 case "$ans" in
7530 y*) hostcat='ypcat hosts';;
7531 *) hostcat='cat /etc/hosts';;
7532 esac
7533 ;;
7534 esac
7535fi
7536case "$hostcat" in
7537'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7538esac
7539case "$groupcat" in
7540'') test -f /etc/group && groupcat='cat /etc/group';;
7541esac
7542case "$passcat" in
7543'') test -f /etc/passwd && passcat='cat /etc/passwd';;
7544esac
7545
7546: now get the host name
7547echo " "
7548echo "Figuring out host name..." >&4
7549case "$myhostname" in
7550'') cont=true
7551 echo 'Maybe "hostname" will work...'
73614538 7552 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
7553 myhostname=$tans
7554 phostname=hostname
7555 cont=''
7556 fi
7557 ;;
7558*) cont='';;
7559esac
7560if $test "$cont"; then
7561 if ./xenix; then
7562 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
7563 if tans=`cat /etc/systemid 2>&1` ; then
7564 myhostname=$tans
7565 phostname='cat /etc/systemid'
7566 echo "Whadyaknow. Xenix always was a bit strange..."
7567 cont=''
7568 fi
7569 elif $test -r /etc/systemid; then
7570 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7571 fi
7572fi
7573if $test "$cont"; then
7574 echo 'No, maybe "uuname -l" will work...'
73614538 7575 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
7576 myhostname=$tans
7577 phostname='uuname -l'
7578 else
7579 echo 'Strange. Maybe "uname -n" will work...'
73614538 7580 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
7581 myhostname=$tans
7582 phostname='uname -n'
7583 else
7584 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 7585 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
7586 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7587 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7588 else
7589 case "$myhostname" in
7590 '') echo "Does this machine have an identity crisis or something?"
7591 phostname='';;
7592 *)
7593 echo "Well, you said $myhostname before..."
7594 phostname='echo $myhostname';;
7595 esac
7596 fi
7597 fi
7598 fi
7599fi
7600: you do not want to know about this
7601set $myhostname
7602myhostname=$1
7603
7604: verify guess
7605if $test "$myhostname" ; then
7606 dflt=y
7607 rp='Your host name appears to be "'$myhostname'".'" Right?"
7608 . ./myread
7609 case "$ans" in
7610 y*) ;;
7611 *) myhostname='';;
7612 esac
7613fi
7614
7615: bad guess or no guess
7616while $test "X$myhostname" = X ; do
7617 dflt=''
7618 rp="Please type the (one word) name of your host:"
7619 . ./myread
7620 myhostname="$ans"
7621done
7622
7623: translate upper to lower if necessary
7624case "$myhostname" in
7625*[A-Z]*)
7626 echo "(Normalizing case in your host name)"
7627 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7628 ;;
7629esac
7630
7631case "$myhostname" in
7632*.*)
7633 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7634 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7635 echo "(Trimming domain name from host name--host name is now $myhostname)"
7636 ;;
7637*) case "$mydomain" in
7638 '')
7639 {
7640 test "X$hostcat" = "Xypcat hosts" &&
7641 ypmatch "$myhostname" hosts 2>/dev/null |\
7642 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
7643 $test -s hosts
7644 } || {
7645 test "X$hostcat" != "X" &&
7646 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
7647 /[ ]$myhostname[ . ]/p" > hosts
7648 }
7649 tmp_re="[ . ]"
f08cbdd1
PP
7650 if $test -f hosts; then
7651 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 7652 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
7653 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7654 hosts | $sort | $uniq | \
7655 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7656 case `$echo X$dflt` in
7657 X*\ *) echo "(Several hosts in the database matched hostname)"
7658 dflt=.
7659 ;;
7660 X.) echo "(You do not have fully-qualified names in the hosts database)"
7661 ;;
7662 esac
7663 else
7664 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 7665 dflt=.
f08cbdd1 7666 fi
b4eb6b3d
JH
7667 case "$dflt" in
7668 .)
7669 tans=`./loc resolv.conf X /etc /usr/etc`
7670 if $test -f "$tans"; then
7671 echo "(Attempting domain name extraction from $tans)"
7672 dflt=.`$sed -n -e 's/ / /g' \
7673 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
7674 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7675 case "$dflt" in
7676 .) dflt=.`$sed -n -e 's/ / /g' \
7677 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
7678 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7679 ;;
7680 esac
7681 fi
7682 ;;
7683 esac
7684 case "$dflt" in
7685 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 7686 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
7687 case "$dflt" in
7688 '') dflt='.';;
7689 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7690 esac
7691 ;;
7692 esac
59c9e5d6
PP
7693 case "$dflt$osname" in
7694 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 7695 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
7696 ;;
7697 esac
b4eb6b3d
JH
7698 case "$dflt" in
7699 .) echo "(Lost all hope -- silly guess then)"
7700 dflt='.uucp'
7701 ;;
7702 esac
7703 $rm -f hosts
7704 ;;
7705 *) dflt="$mydomain";;
7706 esac;;
7707esac
7708echo " "
7709rp="What is your domain name?"
7710. ./myread
7711tans="$ans"
7712case "$ans" in
7713'') ;;
7714.*) ;;
7715*) tans=".$tans";;
7716esac
7717mydomain="$tans"
7718
7719: translate upper to lower if necessary
7720case "$mydomain" in
7721*[A-Z]*)
7722 echo "(Normalizing case in your domain name)"
7723 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7724 ;;
7725esac
7726
7727: a little sanity check here
7728case "$phostname" in
7729'') ;;
7730*)
7731 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7732 $myhostname$mydomain|$myhostname) ;;
7733 *)
7734 case "$phostname" in
7735 sed*)
7736 echo "(That doesn't agree with your whoami.h file, by the way.)"
7737 ;;
7738 *)
7739 echo "(That doesn't agree with your $phostname command, by the way.)"
7740 ;;
7741 esac
7742 ;;
7743 esac
7744 ;;
7745esac
7746
7747$cat <<EOM
7748
7749I need to get your e-mail address in Internet format if possible, i.e.
7750something like user@host.domain. Please answer accurately since I have
7751no easy means to double check it. The default value provided below
7752is most probably close to reality but may not be valid from outside
7753your organization...
7754
7755EOM
7756cont=x
7757while test "$cont"; do
7758 case "$cf_email" in
7759 '') dflt="$cf_by@$myhostname$mydomain";;
7760 *) dflt="$cf_email";;
7761 esac
7762 rp='What is your e-mail address?'
7763 . ./myread
7764 cf_email="$ans"
7765 case "$cf_email" in
7766 *@*.*) cont='' ;;
7767 *)
7768 rp='Address does not look like an Internet one. Use it anyway?'
7769 case "$fastread" in
7770 yes) dflt=y ;;
7771 *) dflt=n ;;
7772 esac
7773 . ./myread
7774 case "$ans" in
7775 y*) cont='' ;;
7776 *) echo " " ;;
7777 esac
7778 ;;
7779 esac
7780done
7781
7782$cat <<EOM
7783
7784If you or somebody else will be maintaining perl at your site, please
7785fill in the correct e-mail address here so that they may be contacted
7786if necessary. Currently, the "perlbug" program included with perl
7787will send mail to this address in addition to perlbug@perl.org. You may
7788enter "none" for no administrator.
7789
7790EOM
7791case "$perladmin" in
7792'') dflt="$cf_email";;
7793*) dflt="$perladmin";;
7794esac
7795rp='Perl administrator e-mail address'
7796. ./myread
7797perladmin="$ans"
7798
674912d7
RB
7799: determine whether to only install version-specific parts.
7800echo " "
7801$cat <<EOM
7802Do you want to install only the version-specific parts of the perl
7803distribution? Usually you do *not* want to do this.
7804EOM
7805case "$versiononly" in
7806"$define"|[Yy]*|true) dflt='y' ;;
7807*) dflt='n';
7808esac
7809rp="Do you want to install only the version-specific parts of perl?"
7810. ./myread
7811case "$ans" in
7812[yY]*) val="$define";;
7813*) val="$undef" ;;
7814esac
7815set versiononly
7816eval $setvar
7817
b4eb6b3d
JH
7818: figure out how to guarantee perl startup
7819case "$startperl" in
7820'')
7821 case "$sharpbang" in
7822 *!)
7823 $cat <<EOH
7824
7825I can use the #! construct to start perl on your system. This will
7826make startup of perl scripts faster, but may cause problems if you
7827want to share those scripts and perl is not in a standard place
7828($binexp/perl) on all your platforms. The alternative is to force
7829a shell by starting the script with a single ':' character.
7830
7831EOH
674912d7
RB
7832 case "$versiononly" in
7833 "$define") dflt="$binexp/perl$version";;
7834 *) dflt="$binexp/perl";;
7835 esac
b4eb6b3d
JH
7836 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7837 . ./myread
7838 case "$ans" in
7839 none) startperl=": # use perl";;
7840 *) startperl="#!$ans"
7841 if $test 30 -lt `echo "$ans" | wc -c`; then
7842 $cat >&4 <<EOM
7843
7844WARNING: Some systems limit the #! command to 32 characters.
7845If you experience difficulty running Perl scripts with #!, try
7846installing Perl in a directory with a shorter pathname.
7847
7848EOM
7849 fi ;;
7850 esac
7851 ;;
7852 *) startperl=": # use perl"
7853 ;;
7854 esac
7855 ;;
7856esac
7857echo "I'll use $startperl to start perl scripts."
7858
7859: figure best path for perl in scripts
7860case "$perlpath" in
7861'')
7862 perlpath="$binexp/perl"
7863 case "$startperl" in
7864 *!*) ;;
7865 *)
7866 $cat <<EOH
7867
7868I will use the "eval 'exec'" idiom to start Perl on your system.
7869I can use the full path of your Perl binary for this purpose, but
7870doing so may cause problems if you want to share those scripts and
7871Perl is not always in a standard place ($binexp/perl).
7872
7873EOH
7874 dflt="$binexp/perl"
7875 rp="What path shall I use in \"eval 'exec'\"?"
7876 . ./myread
7877 perlpath="$ans"
7878 ;;
7879 esac
7880 ;;
7881esac
7882case "$startperl" in
7883*!*) ;;
7884*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7885esac
7886
7887: determine where public executable scripts go
7888set scriptdir scriptdir
7889eval $prefixit
7890case "$scriptdir" in
7891'')
7892 dflt="$bin"
7893 : guess some guesses
7894 $test -d /usr/share/scripts && dflt=/usr/share/scripts
7895 $test -d /usr/share/bin && dflt=/usr/share/bin
7896 $test -d /usr/local/script && dflt=/usr/local/script
7897 $test -d /usr/local/scripts && dflt=/usr/local/scripts
7898 $test -d $prefixexp/script && dflt=$prefixexp/script
7899 set dflt
7900 eval $prefixup
7901 ;;
7902*) dflt="$scriptdir"
7903 ;;
7904esac
7905$cat <<EOM
7906
7907Some installations have a separate directory just for executable scripts so
7908that they can mount it across multiple architectures but keep the scripts in
7909one spot. You might, for example, have a subdirectory of /usr/share for this.
7910Or you might just lump your scripts in with all your other executables.
7911
7912EOM
7913fn=d~
7914rp='Where do you keep publicly executable scripts?'
7915. ./getfile
7916if $test "X$ansexp" != "X$scriptdirexp"; then
7917 installscript=''
7918fi
7919scriptdir="$ans"
7920scriptdirexp="$ansexp"
7921: Change installation prefix, if necessary.
7922if $test X"$prefix" != X"$installprefix"; then
7923 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7924else
7925 installscript="$scriptdirexp"
7926fi
7927
7928: determine where add-on public executables go
7929case "$sitebin" in
7930'') dflt=$siteprefix/bin ;;
7931*) dflt=$sitebin ;;
7932esac
7933fn=d~
7934rp='Pathname where the add-on public executables should be installed?'
7935. ./getfile
7936sitebin="$ans"
7937sitebinexp="$ansexp"
7938: Change installation prefix, if necessary.
7939if $test X"$prefix" != X"$installprefix"; then
7940 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7941else
7942 installsitebin="$sitebinexp"
7943fi
7944
b4eb6b3d
JH
7945case "$vendorprefix" in
7946'') d_vendorbin="$undef"
7947 vendorbin=''
7948 vendorbinexp=''
7949 ;;
7950*) d_vendorbin="$define"
7951 : determine where vendor-supplied executables go.
7952 case "$vendorbin" in
7953 '') dflt=$vendorprefix/bin ;;
7954 *) dflt="$vendorbin" ;;
7955 esac
7956 fn=d~+
7957 rp='Pathname for the vendor-supplied executables directory?'
7958 . ./getfile
7959 vendorbin="$ans"
7960 vendorbinexp="$ansexp"
7961 ;;
7962esac
7963: Change installation prefix, if necessary.
7964if $test X"$prefix" != X"$installprefix"; then
7965 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7966else
7967 installvendorbin="$vendorbinexp"
7968fi
7969
7970: see if qgcvt exists
7971set qgcvt d_qgcvt
7972eval $inlibc
7973
7974echo " "
7975
7976if $test X"$d_longdbl" = X"$define"; then
7977
7978echo "Checking how to print long doubles..." >&4
7979
7980if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7981 $cat >try.c <<'EOCP'
7982#include <sys/types.h>
7983#include <stdio.h>
7984int main() {
7985 double d = 123.456;
7986 printf("%.3f\n", d);
7987}
7988EOCP
7989 set try
7990 if eval $compile; then
7991 yyy=`./try$exe_ext`
7992 case "$yyy" in
7993 123.456)
7994 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7995 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7996 echo "We will use %f."
7997 ;;
7998 esac
7999 fi
8000fi
8001
8002if $test X"$sPRIfldbl" = X; then
8003 $cat >try.c <<'EOCP'
8004#include <sys/types.h>
8005#include <stdio.h>
8006int main() {
8007 long double d = 123.456;
8008 printf("%.3llf\n", d);
8009}
8010EOCP
8011 set try
8012 if eval $compile; then
8013 yyy=`./try$exe_ext`
8014 case "$yyy" in
8015 123.456)
8016 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8017 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8018 echo "We will use %llf."
8019 ;;
8020 esac
8021 fi
8022fi
8023
8024if $test X"$sPRIfldbl" = X; then
8025 $cat >try.c <<'EOCP'
8026#include <sys/types.h>
8027#include <stdio.h>
8028int main() {
8029 long double d = 123.456;
8030 printf("%.3Lf\n", d);
8031}
8032EOCP
8033 set try
8034 if eval $compile; then
8035 yyy=`./try$exe_ext`
8036 case "$yyy" in
8037 123.456)
8038 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8039 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8040 echo "We will use %Lf."
8041 ;;
8042 esac
8043 fi
8044fi
8045
8046if $test X"$sPRIfldbl" = X; then
8047 $cat >try.c <<'EOCP'
8048#include <sys/types.h>
8049#include <stdio.h>
8050int main() {
8051 long double d = 123.456;
8052 printf("%.3lf\n", d);
8053}
8054EOCP
8055 set try
8056 if eval $compile; then
8057 yyy=`./try$exe_ext`
8058 case "$yyy" in
8059 123.456)
8060 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8061 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8062 echo "We will use %lf."
8063 ;;
8064 esac
8065 fi
8066fi
8067
8068if $test X"$sPRIfldbl" = X; then
8069 echo "Cannot figure out how to print long doubles." >&4
8070else
8071 sSCNfldbl=$sPRIfldbl # expect consistency
8072fi
8073
8074$rm -f try try.*
8075
8076fi # d_longdbl
8077
8078case "$sPRIfldbl" in
8079'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
8080 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
8081 d_SCNfldbl="$undef";
8082 ;;
8083*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
8084 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
8085 d_SCNfldbl="$define";
8086 ;;
8087esac
8088
8089: Check how to convert floats to strings.
8090echo " "
8091echo "Checking for an efficient way to convert floats to strings."
8092echo " " > try.c
8093case "$uselongdouble" in
8094"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8095esac
8096case "$d_longdbl" in
8097"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8098esac
8099case "$d_PRIgldbl" in
8100"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
8101esac
8102$cat >>try.c <<EOP
8103#ifdef TRY_gconvert
8104#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8105char *myname = "gconvert";
8106#endif
8107#ifdef TRY_gcvt
8108#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8109char *myname = "gcvt";
8110#endif
8111#ifdef TRY_qgcvt
8112#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8113char *myname = "qgcvt";
8114#define DOUBLETYPE long double
8115#endif
8116#ifdef TRY_sprintf
8117#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8118#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8119#else
8120#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8121#endif
8122char *myname = "sprintf";
8123#endif
8124
8125#ifndef DOUBLETYPE
8126#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8127#define DOUBLETYPE long double
8128#else
8129#define DOUBLETYPE double
8130#endif
8131#endif
8132
8133#include <stdio.h>
8134
8135#define I_STDLIB $i_stdlib
8136#ifdef I_STDLIB
8137#include <stdlib.h>
8138#endif
8139
8140int
8141checkit(expect, got)
8142char *expect;
8143char *got;
8144{
8145 if (strcmp(expect, got)) {
8146 printf("%s oddity: Expected %s, got %s\n",
8147 myname, expect, got);
8148 exit(1);
8149 }
8150}
8151
8152int main()
8153{
8154 char buf[64];
8155 buf[63] = '\0';
8156
8157 /* This must be 1st test on (which?) platform */
8158 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8159 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8160 checkit("0.1", buf);
8161
8162 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
8163 checkit("1", buf);
8164
8165 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
8166 checkit("1.1", buf);
8167
8168 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
8169 checkit("1.01", buf);
8170
8171 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
8172 checkit("1.001", buf);
8173
8174 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
8175 checkit("1.0001", buf);
8176
8177 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
8178 checkit("1.00001", buf);
8179
8180 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
8181 checkit("1.000001", buf);
8182
8183 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
8184 checkit("0", buf);
8185
8186 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
8187 checkit("-1", buf);
8188
8189 /* Some Linux gcvt's give 1.e+5 here. */
8190 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
8191 checkit("100000", buf);
8192
8193 /* Some Linux gcvt's give -1.e+5 here. */
8194 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
8195 checkit("-100000", buf);
8196
8197 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
8198 checkit("123.456", buf);
8199
8200 exit(0);
8201}
8202EOP
8203case "$d_Gconvert" in
8204gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8205gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8206sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8207*) xxx_list='gconvert gcvt sprintf' ;;
8208esac
8209
8210case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8211"$define$define$define")
8212 # for long doubles prefer first qgcvt, then sprintf
8213 xxx_list="`echo $xxx_list|sed s/sprintf//`"
8214 xxx_list="sprintf $xxx_list"
8215 case "$d_qgcvt" in
8216 "$define") xxx_list="qgcvt $xxx_list" ;;
8217 esac
8218 ;;
8219esac
8220
8221for xxx_convert in $xxx_list; do
8222 echo "Trying $xxx_convert..."
8223 $rm -f try try$_o
8224 set try -DTRY_$xxx_convert
8225 if eval $compile; then
8226 echo "$xxx_convert() found." >&4
8227 if ./try; then
8228 echo "I'll use $xxx_convert to convert floats into a string." >&4
8229 break;
8230 else
8231 echo "...But $xxx_convert didn't work as I expected."
8232 fi
8233 else
8234 echo "$xxx_convert NOT found." >&4
8235 fi
8236done
8237
8238case "$xxx_convert" in
8239gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8240gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8241qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8242*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8243 "$define$define$define")
8244 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8245 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8246 esac
8247 ;;
8248esac
8249
74cac757
JH
8250: see if _fwalk exists
8251set fwalk d__fwalk
8252eval $inlibc
8253
b4eb6b3d
JH
8254: Initialize h_fcntl
8255h_fcntl=false
8256
8257: Initialize h_sysfile
8258h_sysfile=false
8259
8260: access call always available on UNIX
8261set access d_access
8262eval $inlibc
8263
8264: locate the flags for 'access()'
8265case "$d_access" in
8266"$define")
8267 echo " "
8268 $cat >access.c <<'EOCP'
8269#include <sys/types.h>
8270#ifdef I_FCNTL
8271#include <fcntl.h>
8272#endif
8273#ifdef I_SYS_FILE
8274#include <sys/file.h>
8275#endif
8276#ifdef I_UNISTD
8277#include <unistd.h>
8278#endif
8279int main() {
8280 exit(R_OK);
8281}
8282EOCP
8283 : check sys/file.h first, no particular reason here
8284 if $test `./findhdr sys/file.h` && \
7a282f6d 8285 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
8286 h_sysfile=true;
8287 echo "<sys/file.h> defines the *_OK access constants." >&4
8288 elif $test `./findhdr fcntl.h` && \
7a282f6d 8289 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
8290 h_fcntl=true;
8291 echo "<fcntl.h> defines the *_OK access constants." >&4
8292 elif $test `./findhdr unistd.h` && \
7a282f6d 8293 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
8294 echo "<unistd.h> defines the *_OK access constants." >&4
8295 else
8296 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8297 fi
8298 ;;
8299esac
8300$rm -f access*
8301
8302: see if accessx exists
8303set accessx d_accessx
8304eval $inlibc
8305
8306: see if alarm exists
8307set alarm d_alarm
8308eval $inlibc
8309
8310: see if atolf exists
8311set atolf d_atolf
8312eval $inlibc
8313
8314: see if atoll exists
8315set atoll d_atoll
8316eval $inlibc
8317
8318: Look for GNU-cc style attribute checking
8319echo " "
8320echo "Checking whether your compiler can handle __attribute__ ..." >&4
8321$cat >attrib.c <<'EOCP'
8322#include <stdio.h>
8323void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8324EOCP
8325if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8326 if $contains 'warning' attrib.out >/dev/null 2>&1; then
8327 echo "Your C compiler doesn't fully support __attribute__."
8328 val="$undef"
8329 else
8330 echo "Your C compiler supports __attribute__."
8331 val="$define"
8332 fi
8333else
8334 echo "Your C compiler doesn't seem to understand __attribute__ at all."
8335 val="$undef"
8336fi
8337set d_attribut
8338eval $setvar
8339$rm -f attrib*
8340
8341: see if bcmp exists
8342set bcmp d_bcmp
8343eval $inlibc
8344
8345: see if bcopy exists
8346set bcopy d_bcopy
8347eval $inlibc
8348
8349: see if this is a unistd.h system
8350set unistd.h i_unistd
8351eval $inhdr
8352
8353: see if getpgrp exists
8354set getpgrp d_getpgrp
8355eval $inlibc
8356
8357case "$d_getpgrp" in
8358"$define")
8359 echo " "
8360 echo "Checking to see which flavor of getpgrp is in use..."
8361 $cat >set.c <<EOP
8362#$i_unistd I_UNISTD
8363#include <sys/types.h>
8364#ifdef I_UNISTD
8365# include <unistd.h>
8366#endif
8367int main()
8368{
8369 if (getuid() == 0) {
8370 printf("(I see you are running Configure as super-user...)\n");
8371 setuid(1);
8372 }
8373#ifdef TRY_BSD_PGRP
8374 if (getpgrp(1) == 0)
8375 exit(0);
8376#else
8377 if (getpgrp() > 0)
8378 exit(0);
8379#endif
8380 exit(1);
8381}
8382EOP
7a282f6d 8383 if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
8384 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8385 val="$define"
7a282f6d 8386 elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
8387 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8388 val="$undef"
8389 else
8390 echo "I can't seem to compile and run the test program."
8391 if ./usg; then
8392 xxx="a USG one, i.e. you use getpgrp()."
8393 else
8394 # SVR4 systems can appear rather BSD-ish.
8395 case "$i_unistd" in
8396 $undef)
8397 xxx="a BSD one, i.e. you use getpgrp(pid)."
8398 val="$define"
8399 ;;
8400 $define)
8401 xxx="probably a USG one, i.e. you use getpgrp()."
8402 val="$undef"
8403 ;;
8404 esac
8405 fi
8406 echo "Assuming your getpgrp is $xxx" >&4
8407 fi
8408 ;;
8409*) val="$undef";;
8410esac
8411set d_bsdgetpgrp
8412eval $setvar
8413$rm -f set set.c
8414
8415: see if setpgrp exists
8416set setpgrp d_setpgrp
8417eval $inlibc
8418
8419case "$d_setpgrp" in
8420"$define")
8421 echo " "
8422 echo "Checking to see which flavor of setpgrp is in use..."
8423 $cat >set.c <<EOP
8424#$i_unistd I_UNISTD
8425#include <sys/types.h>
8426#ifdef I_UNISTD
8427# include <unistd.h>
8428#endif
8429int main()
8430{
8431 if (getuid() == 0) {
8432 printf("(I see you are running Configure as super-user...)\n");
8433 setuid(1);
8434 }
8435#ifdef TRY_BSD_PGRP
8436 if (-1 == setpgrp(1, 1))
8437 exit(0);
8438#else
8439 if (setpgrp() != -1)
8440 exit(0);
8441#endif
8442 exit(1);
8443}
8444EOP
7a282f6d 8445 if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
8446 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8447 val="$define"
7a282f6d 8448 elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
8449 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8450 val="$undef"
8451 else
8452 echo "(I can't seem to compile and run the test program.)"
8453 if ./usg; then
8454 xxx="a USG one, i.e. you use setpgrp()."
8455 else
8456 # SVR4 systems can appear rather BSD-ish.
8457 case "$i_unistd" in
8458 $undef)
8459 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8460 val="$define"
8461 ;;
8462 $define)
8463 xxx="probably a USG one, i.e. you use setpgrp()."
8464 val="$undef"
8465 ;;
8466 esac
8467 fi
8468 echo "Assuming your setpgrp is $xxx" >&4
8469 fi
8470 ;;
8471*) val="$undef";;
8472esac
8473set d_bsdsetpgrp
8474eval $setvar
8475$rm -f set set.c
8476: see if bzero exists
8477set bzero d_bzero
8478eval $inlibc
8479
8480: see if signal is declared as pointer to function returning int or void
8481echo " "
8482xxx=`./findhdr signal.h`
8483$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8484if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
8485 echo "You have int (*signal())() instead of void." >&4
8486 val="$undef"
8487elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
8488 echo "You have void (*signal())()." >&4
8489 val="$define"
8490elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8491 echo "You have int (*signal())() instead of void." >&4
8492 val="$undef"
8493elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8494 echo "You have void (*signal())()." >&4
8495 val="$define"
8496else
8497 case "$d_voidsig" in
8498 '')
8499 echo "I can't determine whether signal handler returns void or int..." >&4
8500 dflt=void
8501 rp="What type does your signal handler return?"
8502 . ./myread
8503 case "$ans" in
8504 v*) val="$define";;
8505 *) val="$undef";;
8506 esac;;
8507 "$define")
8508 echo "As you already told me, signal handler returns void." >&4
8509 val="$define"
8510 ;;
8511 *) echo "As you already told me, signal handler returns int." >&4
8512 val="$undef"
8513 ;;
8514 esac
8515fi
8516set d_voidsig
8517eval $setvar
8518case "$d_voidsig" in
8519"$define") signal_t="void";;
8520*) signal_t="int";;
8521esac
8522$rm -f $$.tmp
8523
8524: check for ability to cast large floats to 32-bit ints.
8525echo " "
8526echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8527if $test "$intsize" -ge 4; then
8528 xxx=int
8529else
8530 xxx=long
8531fi
8532$cat >try.c <<EOCP
8533#include <stdio.h>
8534#include <sys/types.h>
8535#include <signal.h>
8536$signal_t blech(s) int s; { exit(3); }
8537int main()
8538{
8539 $xxx i32;
8540 double f, g;
8541 int result = 0;
8542 char str[16];
8543 signal(SIGFPE, blech);
8544
8545 /* Don't let compiler optimize the test away. Store the number
8546 in a writable string for gcc to pass to sscanf under HP/UX.
8547 */
8548 sprintf(str, "2147483647");
8549 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8550 g = 10 * f;
8551 i32 = ($xxx) g;
8552
8553 /* x86 processors will probably give 0x8000 0000, which is a
8554 sign change. We don't want that. We want to mimic SPARC
8555 behavior here, which is to preserve the sign and give
8556 back 0x7fff ffff.
8557 */
8558 if (i32 != ($xxx) f)
8559 result |= 1;
8560 exit(result);
8561}
8562EOCP
8563set try
8564if eval $compile_ok; then
8565 ./try
8566 yyy=$?
8567else
8568 echo "(I can't seem to compile the test program--assuming it can't)"
8569 yyy=1
8570fi
8571case "$yyy" in
85720) val="$define"
8573 echo "Yup, it can."
8574 ;;
8575*) val="$undef"
8576 echo "Nope, it can't."
8577 ;;
8578esac
8579set d_casti32
8580eval $setvar
8581$rm -f try try.*
8582
8583: check for ability to cast negative floats to unsigned
8584echo " "
8585echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8586$cat >try.c <<EOCP
8587#include <stdio.h>
8588#include <sys/types.h>
8589#include <signal.h>
8590$signal_t blech(s) int s; { exit(7); }
8591$signal_t blech_in_list(s) int s; { exit(4); }
8592unsigned long dummy_long(p) unsigned long p; { return p; }
8593unsigned int dummy_int(p) unsigned int p; { return p; }
8594unsigned short dummy_short(p) unsigned short p; { return p; }
8595int main()
8596{
8597 double f;
8598 unsigned long along;
8599 unsigned int aint;
8600 unsigned short ashort;
8601 int result = 0;
8602 char str[16];
8603
8604 /* Frustrate gcc-2.7.2's optimizer which failed this test with
8605 a direct f = -123. assignment. gcc-2.8.0 reportedly
8606 optimized the whole file away
8607 */
8608 /* Store the number in a writable string for gcc to pass to
8609 sscanf under HP/UX.
8610 */
8611 sprintf(str, "-123");
8612 sscanf(str, "%lf", &f); /* f = -123.; */
8613
8614 signal(SIGFPE, blech);
8615 along = (unsigned long)f;
8616 aint = (unsigned int)f;
8617 ashort = (unsigned short)f;
8618 if (along != (unsigned long)-123)
8619 result |= 1;
8620 if (aint != (unsigned int)-123)
8621 result |= 1;
8622 if (ashort != (unsigned short)-123)
8623 result |= 1;
8624 sprintf(str, "1073741824.");
8625 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8626 f = f + f;
8627 along = 0;
8628 along = (unsigned long)f;
8629 if (along != 0x80000000)
8630 result |= 2;
8631 f -= 1.;
8632 along = 0;
8633 along = (unsigned long)f;
8634 if (along != 0x7fffffff)
8635 result |= 1;
8636 f += 2.;
8637 along = 0;
8638 along = (unsigned long)f;
8639 if (along != 0x80000001)
8640 result |= 2;
8641 if (result)
8642 exit(result);
8643 signal(SIGFPE, blech_in_list);
8644 sprintf(str, "123.");
8645 sscanf(str, "%lf", &f); /* f = 123.; */
8646 along = dummy_long((unsigned long)f);
8647 aint = dummy_int((unsigned int)f);
8648 ashort = dummy_short((unsigned short)f);
8649 if (along != (unsigned long)123)
8650 result |= 4;
8651 if (aint != (unsigned int)123)
8652 result |= 4;
8653 if (ashort != (unsigned short)123)
8654 result |= 4;
8655 exit(result);
8656
8657}
8658EOCP
8659set try
8660if eval $compile_ok; then
8661 ./try
8662 castflags=$?
8663else
8664 echo "(I can't seem to compile the test program--assuming it can't)"
8665 castflags=7
8666fi
8667case "$castflags" in
86680) val="$define"
8669 echo "Yup, it can."
8670 ;;
8671*) val="$undef"
8672 echo "Nope, it can't."
8673 ;;
8674esac
8675set d_castneg
8676eval $setvar
8677$rm -f try.*
8678
8679: see if vprintf exists
8680echo " "
8681if set vprintf val -f d_vprintf; eval $csym; $val; then
8682 echo 'vprintf() found.' >&4
8683 val="$define"
8684 $cat >vprintf.c <<'EOF'
8685#include <varargs.h>
8686
8687int main() { xxx("foo"); }
8688
8689xxx(va_alist)
8690va_dcl
8691{
8692 va_list args;
8693 char buf[10];
8694
8695 va_start(args);
8696 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8697}
8698EOF
8699 set vprintf
8700 if eval $compile && ./vprintf; then
8701 echo "Your vsprintf() returns (int)." >&4
8702 val2="$undef"
8703 else
8704 echo "Your vsprintf() returns (char*)." >&4
8705 val2="$define"
8706 fi
8707else
8708 echo 'vprintf() NOT found.' >&4
8709 val="$undef"
8710 val2="$undef"
8711fi
8712set d_vprintf
8713eval $setvar
8714val=$val2
8715set d_charvspr
8716eval $setvar
8717
8718: see if chown exists
8719set chown d_chown
8720eval $inlibc
8721
8722: see if chroot exists
8723set chroot d_chroot
8724eval $inlibc
8725
8726: see if chsize exists
8727set chsize d_chsize
8728eval $inlibc
8729
4e0554ec
JH
8730hasstruct='varname=$1; struct=$2; shift; shift;
8731while $test $# -ge 2; do
8732 case "$1" in
8733 $define) echo "#include <$2>";;
8734 esac ;
8735 shift 2;
8736done > try.c;
8737echo "int main () { struct $struct foo; }" >> try.c;
8738set try;
8739if eval $compile; then
8740 val="$define";
8741else
8742 val="$undef";
8743fi;
8744set $varname;
8745eval $setvar;
8746$rm -f try.c try.o'
8747
8748: see if sys/types.h has to be included
8749set sys/types.h i_systypes
8750eval $inhdr
8751
8752hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8753while $test $# -ge 2; do
8754 case "$1" in
8755 $define) echo "#include <$2>";;
8756 esac ;
8757 shift 2;
8758done > try.c;
8759echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8760set try;
8761if eval $compile; then
8762 val="$define";
8763else
8764 val="$undef";
8765fi;
8766set $varname;
8767eval $setvar;
8768$rm -f try.c try.o'
8769
8770socketlib=''
8771sockethdr=''
8772: see whether socket exists
8773echo " "
8774$echo $n "Hmm... $c" >&4
8775if set socket val -f d_socket; eval $csym; $val; then
8776 echo "Looks like you have Berkeley networking support." >&4
8777 d_socket="$define"
8778 if set setsockopt val -f; eval $csym; $val; then
8779 d_oldsock="$undef"
8780 else
8781 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8782 d_oldsock="$define"
8783 fi
8784else
8785 if $contains socklib libc.list >/dev/null 2>&1; then
8786 echo "Looks like you have Berkeley networking support." >&4
8787 d_socket="$define"
8788 : we will have to assume that it supports the 4.2 BSD interface
8789 d_oldsock="$undef"
8790 else
8791 echo "You don't have Berkeley networking in libc$_a..." >&4
8792 if test "X$d_socket" = "X$define"; then
8793 echo "...but you seem to believe that you have sockets." >&4
8794 else
8795 for net in net socket
8796 do
8797 if test -f /usr/lib/lib$net$_a; then
8798 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
8799 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8800 if $contains socket libc.list >/dev/null 2>&1; then
8801 d_socket="$define"
8802 socketlib="-l$net"
8803 case "$net" in
8804 net)
8805 echo "...but the Wollongong group seems to have hacked it in." >&4
8806 sockethdr="-I/usr/netinclude"
8807 ;;
8808 esac
8809 echo "Found Berkeley sockets interface in lib$net." >& 4
8810 if $contains setsockopt libc.list >/dev/null 2>&1; then
8811 d_oldsock="$undef"
8812 else
8813 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8814 d_oldsock="$define"
8815 fi
8816 break
8817 fi
8818 fi
8819 done
8820 if test "X$d_socket" != "X$define"; then
8821 echo "or anywhere else I see." >&4
8822 d_socket="$undef"
8823 d_oldsock="$undef"
8824 fi
8825 fi
8826 fi
8827fi
8828
8829: see if socketpair exists
8830set socketpair d_sockpair
8831eval $inlibc
8832
8833
8834echo " "
8835echo "Checking the availability of certain socket constants..." >& 4
8836for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8837 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8838 $cat >try.c <<EOF
8839#include <sys/types.h>
8840#include <sys/socket.h>
8841int main() {
8842 int i = $ENUM;
8843}
8844EOF
8845 val="$undef"
8846 set try; if eval $compile; then
8847 val="$define"
8848 fi
8849 set d_${enum}; eval $setvar
8850 $rm -f try.c try
8851done
8852
8853: see if this is a sys/uio.h system
8854set sys/uio.h i_sysuio
8855eval $inhdr
8856
8857
8858echo " "
8859echo "Checking to see if your system supports struct cmsghdr..." >&4
8860set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
8861eval $hasstruct
8862case "$d_cmsghdr_s" in
8863"$define") echo "Yes, it does." ;;
8864*) echo "No, it doesn't." ;;
8865esac
8866
8867
b4eb6b3d
JH
8868: check for const keyword
8869echo " "
8870echo 'Checking to see if your C compiler knows about "const"...' >&4
8871$cat >const.c <<'EOCP'
8872typedef struct spug { int drokk; } spug;
8873int main()
8874{
8875 const char *foo;
8876 const spug y;
8877}
8878EOCP
8879if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8880 val="$define"
8881 echo "Yup, it does."
8882else
8883 val="$undef"
8884 echo "Nope, it doesn't."
8885fi
8886set d_const
8887eval $setvar
8888
8889: see if crypt exists
8890echo " "
8891if set crypt val -f d_crypt; eval $csym; $val; then
8892 echo 'crypt() found.' >&4
8893 val="$define"
8894 cryptlib=''
8895else
8896 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8897 if $test -z "$cryptlib"; then
8898 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8899 else
8900 cryptlib=-lcrypt
8901 fi
8902 if $test -z "$cryptlib"; then
8903 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8904 else
8905 cryptlib=-lcrypt
8906 fi
8907 if $test -z "$cryptlib"; then
8908 cryptlib=`./loc libcrypt$_a "" $libpth`
8909 else
8910 cryptlib=-lcrypt
8911 fi
8912 if $test -z "$cryptlib"; then
8913 echo 'crypt() NOT found.' >&4
8914 val="$undef"
8915 else
8916 val="$define"
8917 fi
8918fi
8919set d_crypt
8920eval $setvar
8921
8922: get csh whereabouts
8923case "$csh" in
8924'csh') val="$undef" ;;
8925*) val="$define" ;;
8926esac
8927set d_csh
8928eval $setvar
8929: Respect a hint or command line value for full_csh.
8930case "$full_csh" in
8931'') full_csh=$csh ;;
8932esac
8933
8934: see if cuserid exists
8935set cuserid d_cuserid
8936eval $inlibc
8937
8938: see if this is a limits.h system
8939set limits.h i_limits
8940eval $inhdr
8941
8942: see if this is a float.h system
8943set float.h i_float
8944eval $inhdr
8945
8946: See if number of significant digits in a double precision number is known
8947echo " "
8948$cat >dbl_dig.c <<EOM
8949#$i_limits I_LIMITS
8950#$i_float I_FLOAT
8951#ifdef I_LIMITS
8952#include <limits.h>
8953#endif
8954#ifdef I_FLOAT
8955#include <float.h>
8956#endif
8957#ifdef DBL_DIG
8958printf("Contains DBL_DIG");
8959#endif
8960EOM
8961$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8962if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8963 echo "DBL_DIG found." >&4
8964 val="$define"
8965else
8966 echo "DBL_DIG NOT found." >&4
8967 val="$undef"
8968fi
8969$rm -f dbl_dig.?
8970set d_dbl_dig
8971eval $setvar
8972
8973: see if difftime exists
8974set difftime d_difftime
8975eval $inlibc
8976
8977: see if this is a dirent system
8978echo " "
8979if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8980 val="$define"
8981 echo "<dirent.h> found." >&4
8982else
8983 val="$undef"
8984 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8985 echo "<sys/dir.h> found." >&4
8986 echo " "
8987 else
8988 xinc=`./findhdr sys/ndir.h`
8989 fi
8990 echo "<dirent.h> NOT found." >&4
8991fi
8992set i_dirent
8993eval $setvar
8994
8995: Look for type of directory structure.
8996echo " "
8997$cppstdin $cppflags $cppminus < "$xinc" > try.c
8998
8999case "$direntrytype" in
9000''|' ')
9001 case "$i_dirent" in
9002 $define) guess1='struct dirent' ;;
9003 *) guess1='struct direct' ;;
9004 esac
9005 ;;
9006*) guess1="$direntrytype"
9007 ;;
9008esac
9009
9010case "$guess1" in
9011'struct dirent') guess2='struct direct' ;;
9012*) guess2='struct dirent' ;;
9013esac
9014
9015if $contains "$guess1" try.c >/dev/null 2>&1; then
9016 direntrytype="$guess1"
9017 echo "Your directory entries are $direntrytype." >&4
9018elif $contains "$guess2" try.c >/dev/null 2>&1; then
9019 direntrytype="$guess2"
9020 echo "Your directory entries seem to be $direntrytype." >&4
9021else
9022 echo "I don't recognize your system's directory entries." >&4
9023 rp="What type is used for directory entries on this system?"
9024 dflt="$guess1"
9025 . ./myread
9026 direntrytype="$ans"
9027fi
9028$rm -f try.c
9029
9030
9031: see if the directory entry stores field length
9032echo " "
9033$cppstdin $cppflags $cppminus < "$xinc" > try.c
9034if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9035 echo "Good, your directory entry keeps length information in d_namlen." >&4
9036 val="$define"
9037else
9038 echo "Your directory entry does not know about the d_namlen field." >&4
9039 val="$undef"
9040fi
9041set d_dirnamlen
9042eval $setvar
9043$rm -f try.c
9044
9045: see if dlerror exists
9046xxx_runnm="$runnm"
9047runnm=false
9048set dlerror d_dlerror
9049eval $inlibc
9050runnm="$xxx_runnm"
9051
9052: see if dlfcn is available
9053set dlfcn.h i_dlfcn
9054eval $inhdr
9055
9056case "$usedl" in
9057$define|y|true)
9058 $cat << EOM
9059
9060On a few systems, the dynamically loaded modules that perl generates and uses
9061will need a different extension than shared libs. The default will probably
9062be appropriate.
9063
9064EOM
9065 case "$dlext" in
9066 '') dflt="$so" ;;
9067 *) dflt="$dlext" ;;
9068 esac
9069 rp='What is the extension of dynamically loaded modules'
9070 . ./myread
9071 dlext="$ans"
9072 ;;
9073*)
9074 dlext="none"
9075 ;;
9076esac
9077
9078: Check if dlsym need a leading underscore
9079echo " "
9080val="$undef"
9081
9082case "$dlsrc" in
9083dl_dlopen.xs)
9084 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9085 $cat >dyna.c <<'EOM'
9086fred () { }
9087EOM
9088
9089$cat >fred.c<<EOM
9090
9091#include <stdio.h>
9092#$i_dlfcn I_DLFCN
9093#ifdef I_DLFCN
9094#include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
9095#else
9096#include <sys/types.h>
9097#include <nlist.h>
9098#include <link.h>
9099#endif
9100
9101extern int fred() ;
9102
9103int main()
9104{
9105 void * handle ;
9106 void * symbol ;
9107#ifndef RTLD_LAZY
9108 int mode = 1 ;
9109#else
9110 int mode = RTLD_LAZY ;
9111#endif
9112 handle = dlopen("./dyna.$dlext", mode) ;
9113 if (handle == NULL) {
9114 printf ("1\n") ;
9115 fflush (stdout) ;
9116 exit(0);
9117 }
9118 symbol = dlsym(handle, "fred") ;
9119 if (symbol == NULL) {
9120 /* try putting a leading underscore */
9121 symbol = dlsym(handle, "_fred") ;
9122 if (symbol == NULL) {
9123 printf ("2\n") ;
9124 fflush (stdout) ;
9125 exit(0);
9126 }
9127 printf ("3\n") ;
9128 }
9129 else
9130 printf ("4\n") ;
9131 fflush (stdout) ;
9132 exit(0);
9133}
9134EOM
9135 : Call the object file tmp-dyna.o in case dlext=o.
9136 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
9137 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 9138 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
7a282f6d 9139 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
b4eb6b3d
JH
9140 xxx=`./fred`
9141 case $xxx in
9142 1) echo "Test program failed using dlopen." >&4
9143 echo "Perhaps you should not use dynamic loading." >&4;;
9144 2) echo "Test program failed using dlsym." >&4
9145 echo "Perhaps you should not use dynamic loading." >&4;;
9146 3) echo "dlsym needs a leading underscore" >&4
9147 val="$define" ;;
9148 4) echo "dlsym doesn't need a leading underscore." >&4;;
9149 esac
9150 else
9151 echo "I can't compile and run the test program." >&4
9152 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9153 fi
9154 ;;
9155esac
9156
9157$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
9158
9159set d_dlsymun
9160eval $setvar
9161
9162hasproto='varname=$1; func=$2; shift; shift;
9163while $test $# -ge 2; do
9164 case "$1" in
9165 $define) echo "#include <$2>";;
9166 esac ;
9167 shift 2;
9168done > try.c;
9169$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9170if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9171 echo "$func() prototype found.";
9172 val="$define";
9173else
9174 echo "$func() prototype NOT found.";
9175 val="$undef";
9176fi;
9177set $varname;
9178eval $setvar;
9179$rm -f try.c tryout.c'
9180
9181: see if prototype for drand48 is available
9182echo " "
9183set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9184eval $hasproto
9185
9186: see if dup2 exists
9187set dup2 d_dup2
9188eval $inlibc
9189
9190: see if eaccess exists
9191set eaccess d_eaccess
9192eval $inlibc
9193
9194: see if endgrent exists
9195set endgrent d_endgrent
9196eval $inlibc
9197
9198: see if endhostent exists
9199set endhostent d_endhent
9200eval $inlibc
9201
9202: see if endnetent exists
9203set endnetent d_endnent
9204eval $inlibc
9205
9206: see if endprotoent exists
9207set endprotoent d_endpent
9208eval $inlibc
9209
9210: see if endpwent exists
9211set endpwent d_endpwent
9212eval $inlibc
9213
9214: see if endservent exists
9215set endservent d_endsent
9216eval $inlibc
9217
9218: Locate the flags for 'open()'
9219echo " "
9220$cat >open3.c <<'EOCP'
9221#include <sys/types.h>
9222#ifdef I_FCNTL
9223#include <fcntl.h>
9224#endif
9225#ifdef I_SYS_FILE
9226#include <sys/file.h>
9227#endif
9228int main() {
9229 if(O_RDONLY);
9230#ifdef O_TRUNC
9231 exit(0);
9232#else
9233 exit(1);
9234#endif
9235}
9236EOCP
9237: check sys/file.h first to get FREAD on Sun
9238if $test `./findhdr sys/file.h` && \
9239 set open3 -DI_SYS_FILE && eval $compile; then
9240 h_sysfile=true;
9241 echo "<sys/file.h> defines the O_* constants..." >&4
9242 if ./open3; then
9243 echo "and you have the 3 argument form of open()." >&4
9244 val="$define"
9245 else
9246 echo "but not the 3 argument form of open(). Oh, well." >&4
9247 val="$undef"
9248 fi
9249elif $test `./findhdr fcntl.h` && \
9250 set open3 -DI_FCNTL && eval $compile; then
9251 h_fcntl=true;
9252 echo "<fcntl.h> defines the O_* constants..." >&4
9253 if ./open3; then
9254 echo "and you have the 3 argument form of open()." >&4
9255 val="$define"
9256 else
9257 echo "but not the 3 argument form of open(). Oh, well." >&4
9258 val="$undef"
9259 fi
9260else
9261 val="$undef"
9262 echo "I can't find the O_* constant definitions! You got problems." >&4
9263fi
9264set d_open3
9265eval $setvar
9266$rm -f open3*
9267
9268: see which of string.h or strings.h is needed
9269echo " "
9270strings=`./findhdr string.h`
9271if $test "$strings" && $test -r "$strings"; then
9272 echo "Using <string.h> instead of <strings.h>." >&4
9273 val="$define"
9274else
9275 val="$undef"
9276 strings=`./findhdr strings.h`
9277 if $test "$strings" && $test -r "$strings"; then
9278 echo "Using <strings.h> instead of <string.h>." >&4
9279 else
9280 echo "No string header found -- You'll surely have problems." >&4
9281 fi
9282fi
9283set i_string
9284eval $setvar
9285case "$i_string" in
9286"$undef") strings=`./findhdr strings.h`;;
9287*) strings=`./findhdr string.h`;;
9288esac
9289
9290: check for non-blocking I/O stuff
9291case "$h_sysfile" in
a0acbdc3
JH
9292true) echo "#include <sys/file.h>" > head.c;;
9293*)
9294 case "$h_fcntl" in
9295 true) echo "#include <fcntl.h>" > head.c;;
9296 *) echo "#include <sys/fcntl.h>" > head.c;;
9297 esac
9298 ;;
b4eb6b3d
JH
9299esac
9300echo " "
9301echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9302case "$o_nonblock" in
9303'')
9304 $cat head.c > try.c
9305 $cat >>try.c <<'EOCP'
9306#include <stdio.h>
9307int main() {
9308#ifdef O_NONBLOCK
9309 printf("O_NONBLOCK\n");
9310 exit(0);
9311#endif
9312#ifdef O_NDELAY
9313 printf("O_NDELAY\n");
9314 exit(0);
9315#endif
9316#ifdef FNDELAY
9317 printf("FNDELAY\n");
9318 exit(0);
9319#endif
9320 exit(0);
9321}
9322EOCP
9323 set try
9324 if eval $compile_ok; then
9325 o_nonblock=`./try`
9326 case "$o_nonblock" in
9327 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9328 *) echo "Seems like we can use $o_nonblock.";;
9329 esac
9330 else
9331 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9332 fi
9333 ;;
9334*) echo "Using $hint value $o_nonblock.";;
9335esac
9336$rm -f try try.* .out core
9337
9338echo " "
9339echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9340case "$eagain" in
9341'')
9342 $cat head.c > try.c
9343 $cat >>try.c <<EOCP
9344#include <errno.h>
9345#include <sys/types.h>
9346#include <signal.h>
9347#include <stdio.h>
9348#define MY_O_NONBLOCK $o_nonblock
9349#ifndef errno /* XXX need better Configure test */
9350extern int errno;
9351#endif
9352#$i_unistd I_UNISTD
9353#ifdef I_UNISTD
9354#include <unistd.h>
9355#endif
9356#$i_string I_STRING
9357#ifdef I_STRING
9358#include <string.h>
9359#else
9360#include <strings.h>
9361#endif
9362$signal_t blech(x) int x; { exit(3); }
9363EOCP
9364 $cat >> try.c <<'EOCP'
9365int main()
9366{
9367 int pd[2];
9368 int pu[2];
9369 char buf[1];
9370 char string[100];
9371
9372 pipe(pd); /* Down: child -> parent */
9373 pipe(pu); /* Up: parent -> child */
9374 if (0 != fork()) {
9375 int ret;
9376 close(pd[1]); /* Parent reads from pd[0] */
9377 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 9378#ifdef F_SETFL
b4eb6b3d
JH
9379 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
9380 exit(1);
a0acbdc3
JH
9381#else
9382 exit(4);
9383#endif
b4eb6b3d
JH
9384 signal(SIGALRM, blech);
9385 alarm(5);
9386 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
9387 exit(2);
9388 sprintf(string, "%d\n", ret);
9389 write(2, string, strlen(string));
9390 alarm(0);
9391#ifdef EAGAIN
9392 if (errno == EAGAIN) {
9393 printf("EAGAIN\n");
9394 goto ok;
9395 }
9396#endif
9397#ifdef EWOULDBLOCK
9398 if (errno == EWOULDBLOCK)
9399 printf("EWOULDBLOCK\n");
9400#endif
9401 ok:
9402 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
9403 sleep(2); /* Give it time to close our pipe */
9404 alarm(5);
9405 ret = read(pd[0], buf, 1); /* Should read EOF */
9406 alarm(0);
9407 sprintf(string, "%d\n", ret);
9408 write(3, string, strlen(string));
9409 exit(0);
9410 }
9411
9412 close(pd[0]); /* We write to pd[1] */
9413 close(pu[1]); /* We read from pu[0] */
9414 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
9415 close(pd[1]); /* Pipe pd is now fully closed! */
9416 exit(0); /* Bye bye, thank you for playing! */
9417}
9418EOCP
9419 set try
9420 if eval $compile_ok; then
9421 echo "$startsh" >mtry
9422 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
9423 chmod +x mtry
9424 ./mtry >/dev/null 2>&1
9425 case $? in
9426 0) eagain=`$cat try.out`;;
9427 1) echo "Could not perform non-blocking setting!";;
9428 2) echo "I did a successful read() for something that was not there!";;
9429 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 9430 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
9431 *) echo "Something terribly wrong happened during testing.";;
9432 esac
9433 rd_nodata=`$cat try.ret`
9434 echo "A read() system call with no data present returns $rd_nodata."
9435 case "$rd_nodata" in
9436 0|-1) ;;
9437 *)
9438 echo "(That's peculiar, fixing that to be -1.)"
9439 rd_nodata=-1
9440 ;;
9441 esac
9442 case "$eagain" in
9443 '')
9444 echo "Forcing errno EAGAIN on read() with no data available."
9445 eagain=EAGAIN
9446 ;;
9447 *)
9448 echo "Your read() sets errno to $eagain when no data is available."
9449 ;;
9450 esac
9451 status=`$cat try.err`
9452 case "$status" in
9453 0) echo "And it correctly returns 0 to signal EOF.";;
9454 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
9455 *) echo "However, your read() returns '$status' on EOF??";;
9456 esac
9457 val="$define"
9458 if test "$status" = "$rd_nodata"; then
9459 echo "WARNING: you can't distinguish between EOF and no data!"
9460 val="$undef"
9461 fi
9462 else
9463 echo "I can't compile the test program--assuming errno EAGAIN will do."
9464 eagain=EAGAIN
9465 fi
9466 set d_eofnblk
9467 eval $setvar
9468 ;;
9469*)
9470 echo "Using $hint value $eagain."
9471 echo "Your read() returns $rd_nodata when no data is present."
9472 case "$d_eofnblk" in
9473 "$define") echo "And you can see EOF because read() returns 0.";;
9474 "$undef") echo "But you can't see EOF status from read() returned value.";;
9475 *)
9476 echo "(Assuming you can't see EOF status from read anyway.)"
9477 d_eofnblk=$undef
9478 ;;
9479 esac
9480 ;;
9481esac
9482$rm -f try try.* .out core head.c mtry
9483
9484: see if fchmod exists
9485set fchmod d_fchmod
9486eval $inlibc
9487
9488: see if fchown exists
9489set fchown d_fchown
9490eval $inlibc
9491
9492: see if this is an fcntl system
9493set fcntl d_fcntl
9494eval $inlibc
9495
9d9004a9
AD
9496echo " "
9497: See if fcntl-based locking works.
9498$cat >try.c <<'EOCP'
9499#include <stdlib.h>
9500#include <unistd.h>
9501#include <fcntl.h>
9502int main() {
9503#if defined(F_SETLK) && defined(F_SETLKW)
9504 struct flock flock;
9505 int retval, fd;
9506 fd = open("try.c", O_RDONLY);
9507 flock.l_type = F_RDLCK;
9508 flock.l_whence = SEEK_SET;
9509 flock.l_start = flock.l_len = 0;
9510 retval = fcntl(fd, F_SETLK, &flock);
9511 close(fd);
9512 (retval < 0 ? exit(2) : exit(0));
9513#else
9514 exit(2);
9515#endif
9516}
9517EOCP
9518echo "Checking if fcntl-based file locking works... "
9519case "$d_fcntl" in
9520"$define")
9521 set try
9522 if eval $compile_ok; then
9523 if ./try; then
9524 echo "Yes, it seems to work."
9525 val="$define"
9526 else
9527 echo "Nope, it didn't work."
9528 val="$undef"
9529 fi
9530 else
9531 echo "I'm unable to compile the test program, so I'll assume not."
9532 val="$undef"
9533 fi
9534 ;;
9535*) val="$undef";
9536 echo "Nope, since you don't even have fcntl()."
9537 ;;
9538esac
9539set d_fcntl_can_lock
9540eval $setvar
9541$rm -f try*
9542
9543
b4eb6b3d
JH
9544: see if sys/select.h has to be included
9545set sys/select.h i_sysselct
9546eval $inhdr
9547
9548: see if we should include time.h, sys/time.h, or both
9549echo " "
9550if test "X$timeincl" = X; then
9551 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9552 $echo $n "I'm now running the test program...$c"
9553 $cat >try.c <<'EOCP'
9554#include <sys/types.h>
9555#ifdef I_TIME
9556#include <time.h>
9557#endif
9558#ifdef I_SYSTIME
9559#ifdef SYSTIMEKERNEL
9560#define KERNEL
9561#endif
9562#include <sys/time.h>
9563#endif
9564#ifdef I_SYSSELECT
9565#include <sys/select.h>
9566#endif
9567int main()
9568{
9569 struct tm foo;
9570#ifdef S_TIMEVAL
9571 struct timeval bar;
9572#endif
9573#ifdef S_TIMEZONE
9574 struct timezone tzp;
9575#endif
9576 if (foo.tm_sec == foo.tm_sec)
9577 exit(0);
9578#ifdef S_TIMEVAL
9579 if (bar.tv_sec == bar.tv_sec)
9580 exit(0);
9581#endif
9582 exit(1);
9583}
9584EOCP
9585 flags=''
9586 for s_timezone in '-DS_TIMEZONE' ''; do
9587 sysselect=''
9588 for s_timeval in '-DS_TIMEVAL' ''; do
9589 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9590 for i_time in '' '-DI_TIME'; do
9591 for i_systime in '-DI_SYSTIME' ''; do
9592 case "$flags" in
9593 '') $echo $n ".$c"
9594 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9595 if eval $compile; then
9596 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9597 shift
9598 flags="$*"
9599 echo " "
9600 $echo $n "Succeeded with $flags$c"
9601 fi
9602 ;;
9603 esac
9604 done
9605 done
9606 done
9607 done
9608 done
9609 timeincl=''
9610 echo " "
9611 case "$flags" in
9612 *SYSTIMEKERNEL*) i_systimek="$define"
9613 timeincl=`./findhdr sys/time.h`
9614 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9615 *) i_systimek="$undef";;
9616 esac
9617 case "$flags" in
9618 *I_TIME*) i_time="$define"
9619 timeincl=`./findhdr time.h`" $timeincl"
9620 echo "We'll include <time.h>." >&4;;
9621 *) i_time="$undef";;
9622 esac
9623 case "$flags" in
9624 *I_SYSTIME*) i_systime="$define"
9625 timeincl=`./findhdr sys/time.h`" $timeincl"
9626 echo "We'll include <sys/time.h>." >&4;;
9627 *) i_systime="$undef";;
9628 esac
9629 $rm -f try.c try
9630fi
9631
9632: check for fd_set items
9633$cat <<EOM
9634
9635Checking to see how well your C compiler handles fd_set and friends ...
9636EOM
9637$cat >fd_set.c <<EOCP
9638#$i_systime I_SYS_TIME
9639#$i_sysselct I_SYS_SELECT
9640#$d_socket HAS_SOCKET
9641#include <sys/types.h>
9642#ifdef HAS_SOCKET
9643#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9644#endif
9645#ifdef I_SYS_TIME
9646#include <sys/time.h>
9647#endif
9648#ifdef I_SYS_SELECT
9649#include <sys/select.h>
9650#endif
9651int main() {
9652 fd_set fds;
9653
9654#ifdef TRYBITS
9655 if(fds.fds_bits);
9656#endif
9657
9658#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9659 exit(0);
9660#else
9661 exit(1);
9662#endif
9663}
9664EOCP
9665set fd_set -DTRYBITS
9666if eval $compile; then
9667 d_fds_bits="$define"
9668 d_fd_set="$define"
9669 echo "Well, your system knows about the normal fd_set typedef..." >&4
9670 if ./fd_set; then
9671 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9672 d_fd_macros="$define"
9673 else
9674 $cat >&4 <<'EOM'
9675but not the normal fd_set macros! Gaaack! I'll have to cover for you.
9676EOM
9677 d_fd_macros="$undef"
9678 fi
9679else
9680 $cat <<'EOM'
9681Hmm, your compiler has some difficulty with fd_set. Checking further...
9682EOM
9683 set fd_set
9684 if eval $compile; then
9685 d_fds_bits="$undef"
9686 d_fd_set="$define"
9687 echo "Well, your system has some sort of fd_set available..." >&4
9688 if ./fd_set; then
9689 echo "and you have the normal fd_set macros." >&4
9690 d_fd_macros="$define"
9691 else
9692 $cat <<'EOM'
9693but not the normal fd_set macros! Gross! More work for me...
9694EOM
9695 d_fd_macros="$undef"
9696 fi
9697 else
9698 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
9699 d_fd_set="$undef"
9700 d_fds_bits="$undef"
9701 d_fd_macros="$undef"
9702 fi
9703fi
9704$rm -f fd_set*
9705
9706: see if fgetpos exists
9707set fgetpos d_fgetpos
9708eval $inlibc
9709
9710: see if flock exists
9711set flock d_flock
9712eval $inlibc
9713
9714: see if fork exists
9715set fork d_fork
9716eval $inlibc
9717
9718: see if pathconf exists
9719set pathconf d_pathconf
9720eval $inlibc
9721
9722: see if fpathconf exists
9723set fpathconf d_fpathconf
9724eval $inlibc
9725
9726
9727: check for fpos64_t
9728echo " "
9729echo "Checking to see if you have fpos64_t..." >&4
9730$cat >try.c <<EOCP
9731#include <stdio.h>
9732int main() { fpos64_t x = 7; }
9733EOCP
9734set try
9735if eval $compile; then
9736 val="$define"
9737 echo "You have fpos64_t."
9738else
9739 val="$undef"
9740 echo "You do not have fpos64_t."
9741 case "$fpossize" in
9742 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9743 esac
9744fi
9745$rm -f try.* try
9746set d_fpos64_t
9747eval $setvar
9748
9749: see if frexpl exists
9750set frexpl d_frexpl
9751eval $inlibc
9752
b4eb6b3d
JH
9753: see if this is a sys/param system
9754set sys/param.h i_sysparam
9755eval $inhdr
9756
9757: see if this is a sys/mount.h system
9758set sys/mount.h i_sysmount
9759eval $inhdr
9760
b4eb6b3d
JH
9761
9762echo " "
9763echo "Checking to see if your system supports struct fs_data..." >&4
9764set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9765eval $hasstruct
9766case "$d_fs_data_s" in
9767"$define") echo "Yes, it does." ;;
9768*) echo "No, it doesn't." ;;
9769esac
9770
9771: see if fseeko exists
9772set fseeko d_fseeko
9773eval $inlibc
9774case "$longsize" in
97758) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9776esac
9777
9778: see if fsetpos exists
9779set fsetpos d_fsetpos
9780eval $inlibc
9781
9782
9783: see if fstatfs exists
9784set fstatfs d_fstatfs
9785eval $inlibc
9786
9787
9788: see if statvfs exists
9789set statvfs d_statvfs
9790eval $inlibc
9791
9792: see if fstatvfs exists
9793set fstatvfs d_fstatvfs
9794eval $inlibc
9795
9796
411ab01c
JH
9797: see if fsync exists
9798set fsync d_fsync
9799eval $inlibc
9800
b4eb6b3d
JH
9801: see if ftello exists
9802set ftello d_ftello
9803eval $inlibc
9804case "$longsize" in
98058) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9806esac
9807
9808: see if getcwd exists
9809set getcwd d_getcwd
9810eval $inlibc
9811
9812: see if getespwnam exists
9813set getespwnam d_getespwnam
9814eval $inlibc
9815
9816
9817: see if getfsstat exists
9818set getfsstat d_getfsstat
9819eval $inlibc
9820
9821: see if getgrent exists
9822set getgrent d_getgrent
9823eval $inlibc
9824
9825: see if gethostbyaddr exists
9826set gethostbyaddr d_gethbyaddr
9827eval $inlibc
9828
9829: see if gethostbyname exists
9830set gethostbyname d_gethbyname
9831eval $inlibc
9832
9833: see if gethostent exists
9834set gethostent d_gethent
9835eval $inlibc
9836
9837: see how we will look up host name
9838echo " "
9839call=''
9840if set gethostname val -f d_gethname; eval $csym; $val; then
9841 echo 'gethostname() found.' >&4
9842 d_gethname="$define"
9843 call=gethostname
9844fi
9845if set uname val -f d_uname; eval $csym; $val; then
9846 if ./xenix; then
9847 $cat <<'EOM'
9848uname() was found, but you're running xenix, and older versions of xenix
9849have a broken uname(). If you don't really know whether your xenix is old
9850enough to have a broken system call, use the default answer.
9851
9852EOM
9853 dflt=y
9854 case "$d_uname" in
9855 "$define") dflt=n;;
9856 esac
9857 rp='Is your uname() broken?'
9858 . ./myread
9859 case "$ans" in
9860 n*) d_uname="$define"; call=uname;;
9861 esac
9862 else
9863 echo 'uname() found.' >&4
9864 d_uname="$define"
9865 case "$call" in
9866 '') call=uname ;;
9867 esac
9868 fi
9869fi
9870case "$d_gethname" in
9871'') d_gethname="$undef";;
9872esac
9873case "$d_uname" in
9874'') d_uname="$undef";;
9875esac
9876case "$d_uname$d_gethname" in
9877*define*)
9878 dflt=n
9879 cat <<EOM
9880
9881Every now and then someone has a $call() that lies about the hostname
9882but can't be fixed for political or economic reasons. If you wish, I can
9883pretend $call() isn't there and maybe compute hostname at run-time
9884thanks to the '$phostname' command.
9885
9886EOM
9887 rp="Shall I ignore $call() from now on?"
9888 . ./myread
9889 case "$ans" in
9890 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9891 esac;;
9892esac
9893case "$phostname" in
9894'') aphostname='';;
9895*) case "$aphostname" in
9896 /*) ;;
9897 *) set X $phostname
9898 shift
9899 file=$1
9900 shift
9901 file=`./loc $file $file $pth`
9902 aphostname=`echo $file $*`
9903 ;;
9904 esac
9905 ;;
9906esac
9907case "$d_uname$d_gethname" in
9908*define*) ;;
9909*)
9910 case "$phostname" in
9911 '')
9912 echo "There will be no way for $package to get your hostname." >&4;;
9913 *)
9914 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9915 ;;
9916 esac;;
9917esac
9918case "$d_phostname" in
9919'') d_phostname="$undef";;
9920esac
9921
9922: see if this is a netdb.h system
9923set netdb.h i_netdb
9924eval $inhdr
9925
9926: see if prototypes for various gethostxxx netdb.h functions are available
9927echo " "
9928set d_gethostprotos gethostent $i_netdb netdb.h
9929eval $hasproto
9930
4e0554ec
JH
9931: see if getitimer exists
9932set getitimer d_getitimer
9933eval $inlibc
9934
b4eb6b3d
JH
9935: see if getlogin exists
9936set getlogin d_getlogin
9937eval $inlibc
9938
9939: see if getmnt exists
9940set getmnt d_getmnt
9941eval $inlibc
9942
9943: see if getmntent exists
9944set getmntent d_getmntent
9945eval $inlibc
9946
9947: see if getnetbyaddr exists
9948set getnetbyaddr d_getnbyaddr
9949eval $inlibc
9950
9951: see if getnetbyname exists
9952set getnetbyname d_getnbyname
9953eval $inlibc
9954
9955: see if getnetent exists
9956set getnetent d_getnent
9957eval $inlibc
9958
9959: see if prototypes for various getnetxxx netdb.h functions are available
9960echo " "
9961set d_getnetprotos getnetent $i_netdb netdb.h
9962eval $hasproto
9963
0c0643d0
JH
9964: see if getpagesize exists
9965set getpagesize d_getpagsz
9966eval $inlibc
9967
b4eb6b3d
JH
9968
9969: see if getprotobyname exists
9970set getprotobyname d_getpbyname
9971eval $inlibc
9972
9973: see if getprotobynumber exists
9974set getprotobynumber d_getpbynumber
9975eval $inlibc
9976
9977: see if getprotoent exists
9978set getprotoent d_getpent
9979eval $inlibc
9980
9981: see if getpgid exists
9982set getpgid d_getpgid
9983eval $inlibc
9984
9985: see if getpgrp2 exists
9986set getpgrp2 d_getpgrp2
9987eval $inlibc
9988
9989: see if getppid exists
9990set getppid d_getppid
9991eval $inlibc
9992
9993: see if getpriority exists
9994set getpriority d_getprior
9995eval $inlibc
9996
9997: see if prototypes for various getprotoxxx netdb.h functions are available
9998echo " "
9999set d_getprotoprotos getprotoent $i_netdb netdb.h
10000eval $hasproto
10001
10002: see if getprpwnam exists
10003set getprpwnam d_getprpwnam
10004eval $inlibc
10005
10006: see if getpwent exists
10007set getpwent d_getpwent
10008eval $inlibc
10009
10010
10011: see if getservbyname exists
10012set getservbyname d_getsbyname
10013eval $inlibc
10014
10015: see if getservbyport exists
10016set getservbyport d_getsbyport
10017eval $inlibc
10018
10019: see if getservent exists
10020set getservent d_getsent
10021eval $inlibc
10022
10023: see if prototypes for various getservxxx netdb.h functions are available
10024echo " "
10025set d_getservprotos getservent $i_netdb netdb.h
10026eval $hasproto
10027
10028: see if getspnam exists
10029set getspnam d_getspnam
10030eval $inlibc
10031
10032: see if gettimeofday or ftime exists
10033set gettimeofday d_gettimeod
10034eval $inlibc
10035case "$d_gettimeod" in
10036"$undef")
10037 set ftime d_ftime
10038 eval $inlibc
10039 ;;
10040*)
10041 val="$undef"; set d_ftime; eval $setvar
10042 ;;
10043esac
10044case "$d_gettimeod$d_ftime" in
10045"$undef$undef")
10046 echo " "
10047 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10048 ;;
10049esac
10050
10051: see if this is an grp system
10052set grp.h i_grp
10053eval $inhdr
10054
10055case "$i_grp" in
10056$define)
10057 xxx=`./findhdr grp.h`
10058 $cppstdin $cppflags $cppminus < $xxx >$$.h
10059
10060 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10061 val="$define"
10062 else
10063 val="$undef"
10064 fi
10065 set d_grpasswd
10066 eval $setvar
10067
10068 $rm -f $$.h
10069 ;;
10070*)
10071 val="$undef";
10072 set d_grpasswd; eval $setvar
10073 ;;
10074esac
10075
10076: see if hasmntopt exists
10077set hasmntopt d_hasmntopt
10078eval $inlibc
10079
10080: see if this is a netinet/in.h or sys/in.h system
10081set netinet/in.h i_niin sys/in.h i_sysin
10082eval $inhdr
10083
10084: see if arpa/inet.h has to be included
10085set arpa/inet.h i_arpainet
10086eval $inhdr
10087
10088: see if htonl --and friends-- exists
10089val=''
10090set htonl val
10091eval $inlibc
10092
10093: Maybe they are macros.
10094case "$val" in
10095$undef)
10096 $cat >htonl.c <<EOM
10097#include <stdio.h>
10098#include <sys/types.h>
10099#$i_niin I_NETINET_IN
10100#$i_sysin I_SYS_IN
10101#$i_arpainet I_ARPA_INET
10102#ifdef I_NETINET_IN
10103#include <netinet/in.h>
10104#endif
10105#ifdef I_SYS_IN
10106#include <sys/in.h>
10107#endif
10108#ifdef I_ARPA_INET
10109#include <arpa/inet.h>
10110#endif
10111#ifdef htonl
10112printf("Defined as a macro.");
10113#endif
10114EOM
10115 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10116 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10117 val="$define"
10118 echo "But it seems to be defined as a macro." >&4
10119 fi
10120 $rm -f htonl.?
10121 ;;
10122esac
10123set d_htonl
10124eval $setvar
10125
10126: see if iconv exists
10127set iconv d_iconv
10128eval $inlibc
10129
10130: index or strchr
10131echo " "
10132if set index val -f; eval $csym; $val; then
10133 if set strchr val -f d_strchr; eval $csym; $val; then
10134 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10135 val="$define"
10136 vali="$undef"
10137 echo "strchr() found." >&4
10138 else
10139 val="$undef"
10140 vali="$define"
10141 echo "index() found." >&4
10142 fi
10143 else
10144 val="$undef"
10145 vali="$define"
8dfa8df9
JH
10146 echo "index() found." >&4
10147 fi
b4eb6b3d 10148else
8dfa8df9
JH
10149 if set strchr val -f d_strchr; eval $csym; $val; then
10150 val="$define"
10151 vali="$undef"
10152 echo "strchr() found." >&4
10153 else
10154 echo "No index() or strchr() found!" >&4
10155 val="$undef"
10156 vali="$undef"
10157 fi
b4eb6b3d 10158fi
8dfa8df9
JH
10159set d_strchr; eval $setvar
10160val="$vali"
10161set d_index; eval $setvar
10162
10163: check whether inet_aton exists
10164set inet_aton d_inetaton
10165eval $inlibc
b4eb6b3d
JH
10166
10167: Look for isascii
10168echo " "
10169$cat >isascii.c <<'EOCP'
10170#include <stdio.h>
10171#include <ctype.h>
10172int main() {
10173 int c = 'A';
10174 if (isascii(c))
10175 exit(0);
10176 else
10177 exit(1);
10178}
10179EOCP
10180set isascii
10181if eval $compile; then
10182 echo "isascii() found." >&4
10183 val="$define"
10184else
10185 echo "isascii() NOT found." >&4
10186 val="$undef"
10187fi
10188set d_isascii
10189eval $setvar
10190$rm -f isascii*
10191
10192: see if isnan exists
10193set isnan d_isnan
10194eval $inlibc
10195
10196: see if isnanl exists
10197set isnanl d_isnanl
10198eval $inlibc
10199
10200: see if killpg exists
10201set killpg d_killpg
10202eval $inlibc
10203
10204: see if lchown exists
10205echo " "
10206$cat > try.c <<'EOCP'
10207/* System header to define __stub macros and hopefully few prototypes,
10208 which can conflict with char lchown(); below. */
10209#include <assert.h>
10210/* Override any gcc2 internal prototype to avoid an error. */
10211/* We use char because int might match the return type of a gcc2
10212 builtin and then its argument prototype would still apply. */
10213char lchown();
10214int main() {
10215 /* The GNU C library defines this for functions which it implements
10216 to always fail with ENOSYS. Some functions are actually named
10217 something starting with __ and the normal name is an alias. */
10218#if defined (__stub_lchown) || defined (__stub___lchown)
10219choke me
10220#else
10221lchown();
10222#endif
10223; return 0; }
10224EOCP
10225set try
10226if eval $compile; then
10227 $echo "lchown() found." >&4
10228 val="$define"
10229else
10230 $echo "lchown() NOT found." >&4
10231 val="$undef"
10232fi
10233set d_lchown
10234eval $setvar
10235
10236: See if number of significant digits in a double precision number is known
10237echo " "
10238$cat >ldbl_dig.c <<EOM
10239#$i_limits I_LIMITS
10240#$i_float I_FLOAT
10241#ifdef I_LIMITS
10242#include <limits.h>
10243#endif
10244#ifdef I_FLOAT
10245#include <float.h>
10246#endif
10247#ifdef LDBL_DIG
10248printf("Contains LDBL_DIG");
10249#endif
10250EOM
10251$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10252if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10253 echo "LDBL_DIG found." >&4
10254 val="$define"
10255else
10256 echo "LDBL_DIG NOT found." >&4
10257 val="$undef"
10258fi
10259$rm -f ldbl_dig.?
10260set d_ldbl_dig
10261eval $setvar
10262
10263: see if link exists
10264set link d_link
10265eval $inlibc
10266
10267: see if localeconv exists
10268set localeconv d_locconv
10269eval $inlibc
10270
10271: see if lockf exists
10272set lockf d_lockf
10273eval $inlibc
10274
b4eb6b3d
JH
10275: see if prototype for lseek is available
10276echo " "
10277set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10278eval $hasproto
10279
10280: see if lstat exists
10281set lstat d_lstat
10282eval $inlibc
10283
10284: see if madvise exists
10285set madvise d_madvise
10286eval $inlibc
10287
10288: see if mblen exists
10289set mblen d_mblen
10290eval $inlibc
10291
10292: see if mbstowcs exists
10293set mbstowcs d_mbstowcs
10294eval $inlibc
10295
10296: see if mbtowc exists
10297set mbtowc d_mbtowc
10298eval $inlibc
10299
10300: see if memchr exists
10301set memchr d_memchr
10302eval $inlibc
10303
10304: see if memcmp exists
10305set memcmp d_memcmp
10306eval $inlibc
10307
10308: see if memcpy exists
10309set memcpy d_memcpy
10310eval $inlibc
10311
10312: see if memmove exists
10313set memmove d_memmove
10314eval $inlibc
10315
10316: see if memset exists
10317set memset d_memset
10318eval $inlibc
10319
10320: see if mkdir exists
10321set mkdir d_mkdir
10322eval $inlibc
10323
10324: see if mkdtemp exists
10325set mkdtemp d_mkdtemp
10326eval $inlibc
10327
10328: see if mkfifo exists
10329set mkfifo d_mkfifo
10330eval $inlibc
10331
10332: see if mkstemp exists
10333set mkstemp d_mkstemp
10334eval $inlibc
10335
10336: see if mkstemps exists
10337set mkstemps d_mkstemps
10338eval $inlibc
10339
10340: see if mktime exists
10341set mktime d_mktime
10342eval $inlibc
10343
10344: see if this is a sys/mman.h system
10345set sys/mman.h i_sysmman
10346eval $inhdr
10347
10348: see if mmap exists
10349set mmap d_mmap
10350eval $inlibc
10351: see what shmat returns
10352: default to something harmless
10353mmaptype='void *'
10354case "$i_sysmman$d_mmap" in
10355"$define$define")
10356 $cat >mmap.c <<'END'
10357#include <sys/mman.h>
10358void *mmap();
10359END
10360 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10361 mmaptype='void *'
10362 else
10363 mmaptype='caddr_t'
10364 fi
10365 echo "and it returns ($mmaptype)." >&4
10366 ;;
10367esac
10368
10369
10370
10371: see if modfl exists
10372set modfl d_modfl
10373eval $inlibc
10374
10375: see if mprotect exists
10376set mprotect d_mprotect
10377eval $inlibc
10378
10379: see if msgctl exists
10380set msgctl d_msgctl
10381eval $inlibc
10382
10383: see if msgget exists
10384set msgget d_msgget
10385eval $inlibc
10386
10387: see if msgsnd exists
10388set msgsnd d_msgsnd
10389eval $inlibc
10390
10391: see if msgrcv exists
10392set msgrcv d_msgrcv
10393eval $inlibc
10394
10395: see how much of the 'msg*(2)' library is present.
10396h_msg=true
10397echo " "
10398case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10399*"$undef"*) h_msg=false;;
10400esac
10401case "$osname" in
10402freebsd)
10403 case "`ipcs 2>&1`" in
10404 "SVID messages"*"not configured"*)
10405 echo "Your $osname does not have the msg*(2) configured." >&4
10406 h_msg=false
10407 val="$undef"
10408 set msgctl d_msgctl
10409 eval $setvar
10410 set msgget d_msgget
10411 eval $setvar
10412 set msgsnd d_msgsnd
10413 eval $setvar
10414 set msgrcv d_msgrcv
10415 eval $setvar
10416 ;;
10417 esac
10418 ;;
10419esac
10420: we could also check for sys/ipc.h ...
10421if $h_msg && $test `./findhdr sys/msg.h`; then
10422 echo "You have the full msg*(2) library." >&4
10423 val="$define"
10424else
10425 echo "You don't have the full msg*(2) library." >&4
10426 val="$undef"
10427fi
10428set d_msg
10429eval $setvar
10430
4e0554ec
JH
10431
10432echo " "
10433echo "Checking to see if your system supports struct msghdr..." >&4
10434set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10435eval $hasstruct
10436case "$d_msghdr_s" in
10437"$define") echo "Yes, it does." ;;
10438*) echo "No, it doesn't." ;;
10439esac
10440
10441
b4eb6b3d
JH
10442: see if msync exists
10443set msync d_msync
10444eval $inlibc
10445
10446: see if munmap exists
10447set munmap d_munmap
10448eval $inlibc
10449
10450: see if nice exists
10451set nice d_nice
10452eval $inlibc
10453
b4eb6b3d
JH
10454: check for length of character
10455echo " "
10456case "$charsize" in
10457'')
10458 echo "Checking to see how big your characters are (hey, you never know)..." >&4
10459 $cat >try.c <<'EOCP'
10460#include <stdio.h>
10461int main()
10462{
10463 printf("%d\n", (int)sizeof(char));
10464 exit(0);
10465}
10466EOCP
10467 set try
10468 if eval $compile_ok; then
10469 dflt=`./try`
10470 else
10471 dflt='1'
10472 echo "(I can't seem to compile the test program. Guessing...)"
10473 fi
10474 ;;
10475*)
10476 dflt="$charsize"
10477 ;;
10478esac
10479rp="What is the size of a character (in bytes)?"
10480. ./myread
10481charsize="$ans"
10482$rm -f try.c try
10483
1d1be0dc
NC
10484: check for volatile keyword
10485echo " "
10486echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10487$cat >try.c <<'EOCP'
10488int main()
10489{
10490 typedef struct _goo_struct goo_struct;
10491 goo_struct * volatile goo = ((goo_struct *)0);
10492 struct _goo_struct {
10493 long long_int;
10494 int reg_int;
10495 char char_var;
10496 };
10497 typedef unsigned short foo_t;
10498 char *volatile foo;
10499 volatile int bar;
10500 volatile foo_t blech;
10501 foo = foo;
10502}
10503EOCP
10504if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10505 val="$define"
10506 echo "Yup, it does."
10507else
10508 val="$undef"
10509 echo "Nope, it doesn't."
10510fi
10511set d_volatile
10512eval $setvar
10513$rm -f try.*
10514
b4eb6b3d
JH
10515
10516echo " "
10517$echo "Choosing the C types to be used for Perl's internal types..." >&4
10518
10519case "$use64bitint:$d_quad:$quadtype" in
10520define:define:?*)
10521 ivtype="$quadtype"
10522 uvtype="$uquadtype"
10523 ivsize=8
10524 uvsize=8
10525 ;;
10526*) ivtype="long"
10527 uvtype="unsigned long"
10528 ivsize=$longsize
10529 uvsize=$longsize
10530 ;;
10531esac
10532
10533case "$uselongdouble:$d_longdbl" in
10534define:define)
10535 nvtype="long double"
10536 nvsize=$longdblsize
10537 ;;
10538*) nvtype=double
10539 nvsize=$doublesize
10540 ;;
10541esac
10542
10543$echo "(IV will be "$ivtype", $ivsize bytes)"
10544$echo "(UV will be "$uvtype", $uvsize bytes)"
10545$echo "(NV will be "$nvtype", $nvsize bytes)"
10546
10547$cat >try.c <<EOCP
10548#$i_inttypes I_INTTYPES
10549#ifdef I_INTTYPES
10550#include <inttypes.h>
10551#endif
10552#include <stdio.h>
10553int main() {
10554#ifdef INT8
10555 int8_t i = INT8_MAX;
10556 uint8_t u = UINT8_MAX;
10557 printf("int8_t\n");
10558#endif
10559#ifdef INT16
10560 int16_t i = INT16_MAX;
10561 uint16_t i = UINT16_MAX;
10562 printf("int16_t\n");
10563#endif
10564#ifdef INT32
10565 int32_t i = INT32_MAX;
10566 uint32_t u = UINT32_MAX;
10567 printf("int32_t\n");
10568#endif
10569}
10570EOCP
10571
10572case "$i8type" in
10573'') case "$charsize" in
10574 1) i8type=char
10575 u8type="unsigned char"
10576 i8size=$charsize
10577 u8size=$charsize
10578 ;;
10579 esac
10580 ;;
10581esac
10582case "$i8type" in
10583'') set try -DINT8
10584 if eval $compile; then
10585 case "`./try$exe_ext`" in
10586 int8_t) i8type=int8_t
10587 u8type=uint8_t
10588 i8size=1
10589 u8size=1
10590 ;;
10591 esac
10592 fi
10593 ;;
10594esac
10595case "$i8type" in
10596'') if $test $charsize -ge 1; then
10597 i8type=char
10598 u8type="unsigned char"
10599 i8size=$charsize
10600 u8size=$charsize
10601 fi
10602 ;;
10603esac
10604
10605case "$i16type" in
10606'') case "$shortsize" in
10607 2) i16type=short
10608 u16type="unsigned short"
10609 i16size=$shortsize
10610 u16size=$shortsize
10611 ;;
10612 esac
10613 ;;
10614esac
10615case "$i16type" in
10616'') set try -DINT16
10617 if eval $compile; then
10618 case "`./try$exe_ext`" in
10619 int16_t)
10620 i16type=int16_t
10621 u16type=uint16_t
10622 i16size=2
10623 u16size=2
10624 ;;
10625 esac
10626 fi
10627 ;;
10628esac
10629case "$i16type" in
10630'') if $test $shortsize -ge 2; then
10631 i16type=short
10632 u16type="unsigned short"
10633 i16size=$shortsize
10634 u16size=$shortsize
10635 fi
10636 ;;
10637esac
10638
10639case "$i32type" in
10640'') case "$longsize" in
10641 4) i32type=long
10642 u32type="unsigned long"
10643 i32size=$longsize
10644 u32size=$longsize
10645 ;;
10646 *) case "$intsize" in
10647 4) i32type=int
10648 u32type="unsigned int"
10649 i32size=$intsize
10650 u32size=$intsize
10651 ;;
10652 esac
10653 ;;
10654 esac
10655 ;;
10656esac
10657case "$i32type" in
10658'') set try -DINT32
10659 if eval $compile; then
10660 case "`./try$exe_ext`" in
10661 int32_t)
10662 i32type=int32_t
10663 u32type=uint32_t
10664 i32size=4
10665 u32size=4
10666 ;;
10667 esac
10668 fi
10669 ;;
10670esac
10671case "$i32type" in
10672'') if $test $intsize -ge 4; then
10673 i32type=int
10674 u32type="unsigned int"
10675 i32size=$intsize
10676 u32size=$intsize
10677 fi
10678 ;;
10679esac
10680
10681case "$i64type" in
10682'') case "$d_quad:$quadtype" in
10683 define:?*)
10684 i64type="$quadtype"
10685 u64type="$uquadtype"
10686 i64size=8
10687 u64size=8
10688 ;;
10689 esac
10690 ;;
10691esac
10692
1d1be0dc
NC
10693$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10694: volatile so that the compiler has to store it out to memory.
10695if test X"$d_volatile" = X"$define"; then
10696 volatile=volatile
10697fi
b4eb6b3d
JH
10698$cat <<EOP >try.c
10699#include <stdio.h>
1d1be0dc
NC
10700#include <sys/types.h>
10701#include <signal.h>
10702#ifdef SIGFPE
10703$volatile int bletched = 0;
10704$signal_t blech(s) int s; { bletched = 1; }
10705#endif
b4eb6b3d
JH
10706int main() {
10707 $uvtype u = 0;
1d1be0dc 10708 $nvtype d;
b4eb6b3d
JH
10709 int n = 8 * $uvsize;
10710 int i;
1d1be0dc
NC
10711#ifdef SIGFPE
10712 signal(SIGFPE, blech);
10713#endif
10714
b4eb6b3d
JH
10715 for (i = 0; i < n; i++) {
10716 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
10717 d = ($nvtype)u;
10718 if (($uvtype)d != u)
b4eb6b3d 10719 break;
1d1be0dc
NC
10720 if (d <= 0)
10721 break;
10722 d = ($nvtype)(u - 1);
10723 if (($uvtype)d != (u - 1))
10724 break;
10725#ifdef SIGFPE
10726 if (bletched) {
10727 break;
10728#endif
10729 }
b4eb6b3d 10730 }
efd1522b 10731 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
10732 exit(0);
10733}
10734EOP
1d1be0dc
NC
10735set try
10736
10737d_nv_preserves_uv="$undef"
10738if eval $compile; then
10739 d_nv_preserves_uv_bits="`./try$exe_ext`"
10740fi
10741case "$d_nv_preserves_uv_bits" in
10742\-[1-9]*)
10743 d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10744 $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs." 2>&1
10745 d_nv_preserves_uv="$define"
b4eb6b3d 10746 ;;
1d1be0dc
NC
10747[1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs." 2>&1
10748 d_nv_preserves_uv="$undef" ;;
10749*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
10750 d_nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
10751esac
10752
1d1be0dc
NC
10753$rm -f try.* try
10754
b4eb6b3d
JH
10755
10756: check for off64_t
10757echo " "
10758echo "Checking to see if you have off64_t..." >&4
10759$cat >try.c <<EOCP
10760#include <sys/types.h>
10761#include <unistd.h>
10762int main() { off64_t x = 7; }
10763EOCP
10764set try
10765if eval $compile; then
10766 val="$define"
10767 echo "You have off64_t."
10768else
10769 val="$undef"
10770 echo "You do not have off64_t."
10771 case "$lseeksize" in
10772 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10773 esac
10774fi
10775$rm -f try.* try
10776set d_off64_t
10777eval $setvar
10778
10779: see if POSIX threads are available
10780set pthread.h i_pthread
10781eval $inhdr
10782
10783
10784
10785
10786: how to create joinable pthreads
10787if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10788 echo " "
10789 echo "Checking what constant to use for creating joinable pthreads..." >&4
10790 $cat >try.c <<'EOCP'
10791#include <pthread.h>
10792int main() {
10793 int detachstate = JOINABLE;
10794}
10795EOCP
10796 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10797 if eval $compile; then
10798 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10799 val="$undef" # Yes, undef.
10800 set d_old_pthread_create_joinable
10801 eval $setvar
10802 val=""
10803 set old_pthread_create_joinable
10804 eval $setvar
10805 else
10806 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10807 if eval $compile; then
10808 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10809 val="$define"
10810 set d_old_pthread_create_joinable
10811 eval $setvar
10812 val=PTHREAD_CREATE_UNDETACHED
10813 set old_pthread_create_joinable
10814 eval $setvar
10815 else
10816 set try -DJOINABLE=__UNDETACHED
10817 if eval $compile; then
10818 echo "You seem to use __UNDETACHED." >&4
10819 val="$define"
10820 set d_old_pthread_create_joinable
10821 eval $setvar
10822 val=__UNDETACHED
10823 set old_pthread_create_joinable
10824 eval $setvar
10825 else
10826 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
10827 val="$define"
10828 set d_old_pthread_create_joinable
10829 eval $setvar
10830 val=0
10831 set old_pthread_create_joinable
10832 eval $setvar
10833 fi
10834 fi
10835 fi
10836 $rm -f try try.*
10837else
10838 d_old_pthread_create_joinable="$undef"
10839 old_pthread_create_joinable=""
10840fi
10841
10842: see if pause exists
10843set pause d_pause
10844eval $inlibc
10845
10846: see if pipe exists
10847set pipe d_pipe
10848eval $inlibc
10849
10850: see if poll exists
10851set poll d_poll
10852eval $inlibc
10853
10854
10855: see whether the various POSIXish _yields exist
10856$cat >try.c <<EOP
10857#include <pthread.h>
10858#include <stdio.h>
10859int main() {
10860#ifdef SCHED_YIELD
10861 sched_yield();
10862#else
10863#ifdef PTHREAD_YIELD
10864 pthread_yield();
10865#else
10866#ifdef PTHREAD_YIELD_NULL
10867 pthread_yield(NULL);
10868#endif
10869#endif
10870#endif
10871}
10872EOP
10873: see if sched_yield exists
10874set try -DSCHED_YIELD
10875if eval $compile; then
10876 val="$define"
10877 sched_yield='sched_yield()'
10878else
10879 val="$undef"
10880fi
10881case "$usethreads" in
10882$define)
10883 case "$val" in
10884 $define) echo 'sched_yield() found.' >&4 ;;
10885 *) echo 'sched_yield() NOT found.' >&4 ;;
10886 esac
10887esac
10888set d_sched_yield
10889eval $setvar
10890
10891: see if pthread_yield exists
10892set try -DPTHREAD_YIELD
10893if eval $compile; then
10894 val="$define"
10895 case "$sched_yield" in
10896 '') sched_yield='pthread_yield()' ;;
10897 esac
10898else
10899 set try -DPTHREAD_YIELD_NULL
10900 if eval $compile; then
10901 val="$define"
10902 case "$sched_yield" in
10903 '') sched_yield='pthread_yield(NULL)' ;;
10904 esac
10905 else
10906 val="$undef"
10907 fi
10908fi
10909case "$usethreads" in
10910$define)
10911 case "$val" in
10912 $define) echo 'pthread_yield() found.' >&4 ;;
10913 *) echo 'pthread_yield() NOT found.' >&4 ;;
10914 esac
10915 ;;
10916esac
10917set d_pthread_yield
10918eval $setvar
10919
10920case "$sched_yield" in
10921'') sched_yield=undef ;;
10922esac
10923
10924$rm -f try try.*
10925
10926: see if this is a pwd.h system
10927set pwd.h i_pwd
10928eval $inhdr
10929
10930case "$i_pwd" in
10931$define)
10932 xxx=`./findhdr pwd.h`
10933 $cppstdin $cppflags $cppminus < $xxx >$$.h
10934
10935 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10936 val="$define"
10937 else
10938 val="$undef"
10939 fi
10940 set d_pwquota
10941 eval $setvar
10942
10943 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10944 val="$define"
10945 else
10946 val="$undef"
10947 fi
10948 set d_pwage
10949 eval $setvar
10950
10951 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10952 val="$define"
10953 else
10954 val="$undef"
10955 fi
10956 set d_pwchange
10957 eval $setvar
10958
10959 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10960 val="$define"
10961 else
10962 val="$undef"
10963 fi
10964 set d_pwclass
10965 eval $setvar
10966
10967 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10968 val="$define"
10969 else
10970 val="$undef"
10971 fi
10972 set d_pwexpire
10973 eval $setvar
10974
10975 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10976 val="$define"
10977 else
10978 val="$undef"
10979 fi
10980 set d_pwcomment
10981 eval $setvar
10982
10983 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10984 val="$define"
10985 else
10986 val="$undef"
10987 fi
10988 set d_pwgecos
10989 eval $setvar
10990
10991 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10992 val="$define"
10993 else
10994 val="$undef"
10995 fi
10996 set d_pwpasswd
10997 eval $setvar
10998
10999 $rm -f $$.h
11000 ;;
11001*)
11002 val="$undef";
11003 set d_pwquota; eval $setvar
11004 set d_pwage; eval $setvar
11005 set d_pwchange; eval $setvar
11006 set d_pwclass; eval $setvar
11007 set d_pwexpire; eval $setvar
11008 set d_pwcomment; eval $setvar
11009 set d_pwgecos; eval $setvar
11010 set d_pwpasswd; eval $setvar
11011 ;;
11012esac
11013
11014: see if readdir and friends exist
11015set readdir d_readdir
11016eval $inlibc
11017set seekdir d_seekdir
11018eval $inlibc
11019set telldir d_telldir
11020eval $inlibc
11021set rewinddir d_rewinddir
11022eval $inlibc
11023
11024: see if readlink exists
11025set readlink d_readlink
11026eval $inlibc
11027
4e0554ec
JH
11028: see if readv exists
11029set readv d_readv
11030eval $inlibc
11031
11032: see if recvmsg exists
11033set recvmsg d_recvmsg
11034eval $inlibc
11035
b4eb6b3d
JH
11036: see if rename exists
11037set rename d_rename
11038eval $inlibc
11039
11040: see if rmdir exists
11041set rmdir d_rmdir
11042eval $inlibc
11043
11044: see if memory.h is available.
11045val=''
11046set memory.h val
11047eval $inhdr
11048
11049: See if it conflicts with string.h
11050case "$val" in
11051$define)
11052 case "$strings" in
11053 '') ;;
11054 *)
11055 $cppstdin $cppflags $cppminus < $strings > mem.h
11056 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11057 echo " "
11058 echo "We won't be including <memory.h>."
11059 val="$undef"
11060 fi
11061 $rm -f mem.h
11062 ;;
11063 esac
11064esac
11065set i_memory
11066eval $setvar
11067
11068: can bcopy handle overlapping blocks?
11069val="$undef"
11070case "$d_bcopy" in
11071"$define")
11072 echo " "
11073 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
11074 $cat >try.c <<EOCP
11075#$i_memory I_MEMORY
11076#$i_stdlib I_STDLIB
11077#$i_string I_STRING
11078#$i_unistd I_UNISTD
11079EOCP
11080 $cat >>try.c <<'EOCP'
11081#include <stdio.h>
11082#ifdef I_MEMORY
11083# include <memory.h>
11084#endif
11085#ifdef I_STDLIB
11086# include <stdlib.h>
11087#endif
11088#ifdef I_STRING
11089# include <string.h>
11090#else
11091# include <strings.h>
11092#endif
11093#ifdef I_UNISTD
11094# include <unistd.h> /* Needed for NetBSD */
11095#endif
11096int main()
11097{
11098char buf[128], abc[128];
11099char *b;
11100int len;
11101int off;
11102int align;
11103
11104bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11105
11106for (align = 7; align >= 0; align--) {
11107 for (len = 36; len; len--) {
11108 b = buf+align;
11109 bcopy(abc, b, len);
11110 for (off = 1; off <= len; off++) {
11111 bcopy(b, b+off, len);
11112 bcopy(b+off, b, len);
11113 if (bcmp(b, abc, len))
11114 exit(1);
11115 }
11116 }
11117}
11118exit(0);
11119}
11120EOCP
11121 set try
11122 if eval $compile_ok; then
11123 if ./try 2>/dev/null; then
11124 echo "Yes, it can."
11125 val="$define"
11126 else
11127 echo "It can't, sorry."
11128 case "$d_memmove" in
11129 "$define") echo "But that's Ok since you have memmove()." ;;
11130 esac
11131 fi
11132 else
11133 echo "(I can't compile the test program, so we'll assume not...)"
11134 case "$d_memmove" in
11135 "$define") echo "But that's Ok since you have memmove()." ;;
11136 esac
11137 fi
11138 ;;
11139esac
11140$rm -f try.* try core
11141set d_safebcpy
11142eval $setvar
11143
11144: can memcpy handle overlapping blocks?
11145val="$undef"
11146case "$d_memcpy" in
11147"$define")
11148 echo " "
11149 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
11150 $cat >try.c <<EOCP
11151#$i_memory I_MEMORY
11152#$i_stdlib I_STDLIB
11153#$i_string I_STRING
11154#$i_unistd I_UNISTD
11155EOCP
11156 $cat >>try.c <<'EOCP'
11157#include <stdio.h>
11158#ifdef I_MEMORY
11159# include <memory.h>
11160#endif
11161#ifdef I_STDLIB
11162# include <stdlib.h>
11163#endif
11164#ifdef I_STRING
11165# include <string.h>
11166#else
11167# include <strings.h>
11168#endif
11169#ifdef I_UNISTD
11170# include <unistd.h> /* Needed for NetBSD */
11171#endif
11172int main()
11173{
11174char buf[128], abc[128];
11175char *b;
11176int len;
11177int off;
11178int align;
11179
11180/* Copy "abcde..." string to char abc[] so that gcc doesn't
11181 try to store the string in read-only memory. */
11182memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11183
11184for (align = 7; align >= 0; align--) {
11185 for (len = 36; len; len--) {
11186 b = buf+align;
11187 memcpy(b, abc, len);
11188 for (off = 1; off <= len; off++) {
11189 memcpy(b+off, b, len);
11190 memcpy(b, b+off, len);
11191 if (memcmp(b, abc, len))
11192 exit(1);
11193 }
11194 }
11195}
11196exit(0);
11197}
11198EOCP
11199 set try
11200 if eval $compile_ok; then
11201 if ./try 2>/dev/null; then
11202 echo "Yes, it can."
11203 val="$define"
11204 else
11205 echo "It can't, sorry."
11206 case "$d_memmove" in
11207 "$define") echo "But that's Ok since you have memmove()." ;;
11208 esac
11209 fi
11210 else
11211 echo "(I can't compile the test program, so we'll assume not...)"
11212 case "$d_memmove" in
11213 "$define") echo "But that's Ok since you have memmove()." ;;
11214 esac
11215 fi
11216 ;;
11217esac
11218$rm -f try.* try core
11219set d_safemcpy
11220eval $setvar
11221
11222: can memcmp be trusted to compare relative magnitude?
11223val="$undef"
11224case "$d_memcmp" in
11225"$define")
11226 echo " "
11227 echo "Checking if your memcmp() can compare relative magnitude..." >&4
11228 $cat >try.c <<EOCP
11229#$i_memory I_MEMORY
11230#$i_stdlib I_STDLIB
11231#$i_string I_STRING
11232#$i_unistd I_UNISTD
11233EOCP
11234 $cat >>try.c <<'EOCP'
11235#include <stdio.h>
11236#ifdef I_MEMORY
11237# include <memory.h>
11238#endif
11239#ifdef I_STDLIB
11240# include <stdlib.h>
11241#endif
11242#ifdef I_STRING
11243# include <string.h>
11244#else
11245# include <strings.h>
11246#endif
11247#ifdef I_UNISTD
11248# include <unistd.h> /* Needed for NetBSD */
11249#endif
11250int main()
11251{
11252char a = -1;
11253char b = 0;
11254if ((a < b) && memcmp(&a, &b, 1) < 0)
11255 exit(1);
11256exit(0);
11257}
11258EOCP
11259 set try
11260 if eval $compile_ok; then
11261 if ./try 2>/dev/null; then
11262 echo "Yes, it can."
11263 val="$define"
11264 else
11265 echo "No, it can't (it uses signed chars)."
11266 fi
11267 else
11268 echo "(I can't compile the test program, so we'll assume not...)"
11269 fi
11270 ;;
11271esac
11272$rm -f try.* try core
11273set d_sanemcmp
11274eval $setvar
11275
ef9f17be
JH
11276: see if prototype for sbrk is available
11277echo " "
11278set d_sbrkproto sbrk $i_unistd unistd.h
11279eval $hasproto
11280
b4eb6b3d
JH
11281: see if select exists
11282set select d_select
11283eval $inlibc
11284
11285: see if semctl exists
11286set semctl d_semctl
11287eval $inlibc
11288
11289: see if semget exists
11290set semget d_semget
11291eval $inlibc
11292
11293: see if semop exists
11294set semop d_semop
11295eval $inlibc
11296
11297: see how much of the 'sem*(2)' library is present.
11298h_sem=true
11299echo " "
11300case "$d_semctl$d_semget$d_semop" in
11301*"$undef"*) h_sem=false;;
11302esac
11303case "$osname" in
11304freebsd)
11305 case "`ipcs 2>&1`" in
11306 "SVID messages"*"not configured"*)
11307 echo "Your $osname does not have the sem*(2) configured." >&4
11308 h_sem=false
11309 val="$undef"
11310 set semctl d_semctl
11311 eval $setvar
11312 set semget d_semget
11313 eval $setvar
11314 set semop d_semop
11315 eval $setvar
11316 ;;
11317 esac
11318 ;;
11319esac
11320: we could also check for sys/ipc.h ...
11321if $h_sem && $test `./findhdr sys/sem.h`; then
11322 echo "You have the full sem*(2) library." >&4
11323 val="$define"
11324else
11325 echo "You don't have the full sem*(2) library." >&4
11326 val="$undef"
11327fi
11328set d_sem
11329eval $setvar
11330
11331: see whether sys/sem.h defines union semun
11332echo " "
11333$cat > try.c <<'END'
11334#include <sys/types.h>
11335#include <sys/ipc.h>
11336#include <sys/sem.h>
11337int main () { union semun semun; semun.buf = 0; }
11338END
11339set try
11340if eval $compile; then
11341 echo "You have union semun in <sys/sem.h>." >&4
11342 val="$define"
11343else
11344 echo "You do not have union semun in <sys/sem.h>." >&4
11345 val="$undef"
11346fi
11347$rm -f try try.c try.h
11348set d_union_semun
11349eval $setvar
11350
11351: see how to do semctl IPC_STAT
11352case "$d_sem" in
11353$define)
11354 : see whether semctl IPC_STAT can use union semun
11355 echo " "
11356 $cat > try.h <<END
11357#ifndef S_IRUSR
11358# ifdef S_IREAD
11359# define S_IRUSR S_IREAD
11360# define S_IWUSR S_IWRITE
11361# define S_IXUSR S_IEXEC
11362# else
11363# define S_IRUSR 0400
11364# define S_IWUSR 0200
11365# define S_IXUSR 0100
11366# endif
11367# define S_IRGRP (S_IRUSR>>3)
11368# define S_IWGRP (S_IWUSR>>3)
11369# define S_IXGRP (S_IXUSR>>3)
11370# define S_IROTH (S_IRUSR>>6)
11371# define S_IWOTH (S_IWUSR>>6)
11372# define S_IXOTH (S_IXUSR>>6)
11373#endif
11374#ifndef S_IRWXU
11375# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11376# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11377# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11378#endif
11379END
11380
11381 $cat > try.c <<END
11382#include <sys/types.h>
11383#include <sys/ipc.h>
11384#include <sys/sem.h>
11385#include <sys/stat.h>
11386#include <stdio.h>
11387#include <errno.h>
11388#include "try.h"
11389#ifndef errno
11390extern int errno;
11391#endif
11392#$d_union_semun HAS_UNION_SEMUN
11393int main() {
11394 union semun
11395#ifndef HAS_UNION_SEMUN
11396 {
11397 int val;
11398 struct semid_ds *buf;
11399 unsigned short *array;
11400 }
11401#endif
11402 arg;
11403 int sem, st;
11404
11405#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11406 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11407 if (sem > -1) {
11408 struct semid_ds argbuf;
11409 arg.buf = &argbuf;
11410# ifdef IPC_STAT
11411 st = semctl(sem, 0, IPC_STAT, arg);
11412 if (st == 0)
11413 printf("semun\n");
11414 else
11415# endif /* IPC_STAT */
11416 printf("semctl IPC_STAT failed: errno = %d\n", errno);
11417# ifdef IPC_RMID
11418 if (semctl(sem, 0, IPC_RMID, arg) != 0)
11419# endif /* IPC_RMID */
11420 printf("semctl IPC_RMID failed: errno = %d\n", errno);
11421 } else
11422#endif /* IPC_PRIVATE && ... */
11423 printf("semget failed: errno = %d\n", errno);
11424 return 0;
11425}
11426END
11427 val="$undef"
11428 set try
11429 if eval $compile; then
11430 xxx=`./try`
11431 case "$xxx" in
11432 semun) val="$define" ;;
11433 esac
11434 fi
11435 $rm -f try try.c
11436 set d_semctl_semun
11437 eval $setvar
11438 case "$d_semctl_semun" in
11439 $define)
11440 echo "You can use union semun for semctl IPC_STAT." >&4
11441 also='also'
11442 ;;
11443 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
11444 also=''
11445 ;;
11446 esac
11447
11448 : see whether semctl IPC_STAT can use struct semid_ds pointer
11449 $cat > try.c <<'END'
11450#include <sys/types.h>
11451#include <sys/ipc.h>
11452#include <sys/sem.h>
11453#include <sys/stat.h>
11454#include "try.h"
11455#include <stdio.h>
11456#include <errno.h>
11457#ifndef errno
11458extern int errno;
11459#endif
11460int main() {
11461 struct semid_ds arg;
11462 int sem, st;
11463
11464#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11465 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11466 if (sem > -1) {
11467# ifdef IPC_STAT
11468 st = semctl(sem, 0, IPC_STAT, &arg);
11469 if (st == 0)
11470 printf("semid_ds\n");
11471 else
11472# endif /* IPC_STAT */
11473 printf("semctl IPC_STAT failed: errno = %d\n", errno);
11474# ifdef IPC_RMID
11475 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11476# endif /* IPC_RMID */
11477 printf("semctl IPC_RMID failed: errno = %d\n", errno);
11478 } else
11479#endif /* IPC_PRIVATE && ... */
11480 printf("semget failed: errno = %d\n", errno);
11481
11482 return 0;
11483}
11484END
11485 val="$undef"
11486 set try
11487 if eval $compile; then
11488 xxx=`./try`
11489 case "$xxx" in
11490 semid_ds) val="$define" ;;
11491 esac
11492 fi
11493 $rm -f try try.c
11494 set d_semctl_semid_ds
11495 eval $setvar
11496 case "$d_semctl_semid_ds" in
11497 $define)
11498 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11499 ;;
11500 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11501 ;;
11502 esac
11503 $rm -f try.h
11504 ;;
11505*) val="$undef"
11506
11507 # We do not have the full sem*(2) library, so assume we can not
11508 # use either.
11509
11510 set d_semctl_semun
11511 eval $setvar
11512
11513 set d_semctl_semid_ds
11514 eval $setvar
11515 ;;
11516esac
11517
4e0554ec
JH
11518: see if sendmsg exists
11519set sendmsg d_sendmsg
11520eval $inlibc
11521
b4eb6b3d
JH
11522: see if setegid exists
11523set setegid d_setegid
11524eval $inlibc
11525
11526: see if seteuid exists
11527set seteuid d_seteuid
11528eval $inlibc
11529
11530: see if setgrent exists
11531set setgrent d_setgrent
11532eval $inlibc
11533
11534: see if sethostent exists
11535set sethostent d_sethent
11536eval $inlibc
11537
4e0554ec
JH
11538: see if setitimer exists
11539set setitimer d_setitimer
11540eval $inlibc
11541
b4eb6b3d
JH
11542: see if setlinebuf exists
11543set setlinebuf d_setlinebuf
11544eval $inlibc
11545
11546: see if setlocale exists
11547set setlocale d_setlocale
11548eval $inlibc
11549
11550: see if setnetent exists
11551set setnetent d_setnent
11552eval $inlibc
11553
11554: see if setprotoent exists
11555set setprotoent d_setpent
11556eval $inlibc
11557
11558: see if setpgid exists
11559set setpgid d_setpgid
11560eval $inlibc
11561
11562: see if setpgrp2 exists
11563set setpgrp2 d_setpgrp2
11564eval $inlibc
11565
11566: see if setpriority exists
11567set setpriority d_setprior
11568eval $inlibc
11569
11570: see if setproctitle exists
11571set setproctitle d_setproctitle
11572eval $inlibc
11573
11574: see if setpwent exists
11575set setpwent d_setpwent
11576eval $inlibc
11577
11578: see if setregid exists
11579set setregid d_setregid
11580eval $inlibc
11581set setresgid d_setresgid
11582eval $inlibc
11583
11584: see if setreuid exists
11585set setreuid d_setreuid
11586eval $inlibc
11587set setresuid d_setresuid
11588eval $inlibc
11589
11590: see if setrgid exists
11591set setrgid d_setrgid
11592eval $inlibc
11593
11594: see if setruid exists
11595set setruid d_setruid
11596eval $inlibc
11597
11598: see if setservent exists
11599set setservent d_setsent
11600eval $inlibc
11601
11602: see if setsid exists
11603set setsid d_setsid
11604eval $inlibc
11605
11606: see if setvbuf exists
11607set setvbuf d_setvbuf
11608eval $inlibc
11609
11610: see if sfio.h is available
11611set sfio.h i_sfio
11612eval $inhdr
11613
11614
11615: see if sfio library is available
11616case "$i_sfio" in
11617$define)
11618 val=''
11619 set sfreserve val
11620 eval $inlibc
11621 ;;
11622*)
11623 val="$undef"
11624 ;;
11625esac
11626: Ok, but do we want to use it.
11627case "$val" in
11628$define)
11629 case "$usesfio" in
11630 true|$define|[yY]*) dflt='y';;
11631 *) dflt='n';;
11632 esac
11633 echo "$package can use the sfio library, but it is experimental."
11634 case "$useperlio" in
11635 "$undef")
11636 echo "For sfio also the PerlIO abstraction layer is needed."
11637 echo "Earlier you said you wouldn't want that."
11638 ;;
11639 esac
11640 rp="You seem to have sfio available, do you want to try using it?"
11641 . ./myread
11642 case "$ans" in
11643 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
11644 useperlio="$define"
11645 val="$define"
11646 ;;
11647 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
11648 val="$undef"
b4eb6b3d
JH
11649 ;;
11650 esac
11651 ;;
11652*) case "$usesfio" in
11653 true|$define|[yY]*)
11654 echo "Sorry, cannot find sfio on this machine." >&4
11655 echo "Ignoring your setting of usesfio=$usesfio." >&4
11656 val="$undef"
11657 ;;
11658 esac
11659 ;;
11660esac
11661set d_sfio
11662eval $setvar
11663case "$d_sfio" in
11664$define) usesfio='true';;
11665*) usesfio='false';;
11666esac
3659ebf1
JH
11667case "$d_sfio" in
11668$define) ;;
11669*) : Remove sfio from list of libraries to use
11670 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11671 shift
11672 libs="$*"
11673 echo "libs = $libs" >&4
11674;;
11675esac
11676
b4eb6b3d
JH
11677
11678: see if shmctl exists
11679set shmctl d_shmctl
11680eval $inlibc
11681
11682: see if shmget exists
11683set shmget d_shmget
11684eval $inlibc
11685
11686: see if shmat exists
11687set shmat d_shmat
11688eval $inlibc
11689: see what shmat returns
11690case "$d_shmat" in
11691"$define")
11692 $cat >shmat.c <<'END'
11693#include <sys/shm.h>
11694void *shmat();
11695END
11696 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11697 shmattype='void *'
11698 else
11699 shmattype='char *'
11700 fi
11701 echo "and it returns ($shmattype)." >&4
11702 : see if a prototype for shmat is available
11703 xxx=`./findhdr sys/shm.h`
11704 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11705 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11706 val="$define"
11707 else
11708 val="$undef"
11709 fi
11710 $rm -f shmat.[co]
11711 ;;
11712*)
11713 val="$undef"
11714 ;;
11715esac
11716set d_shmatprototype
11717eval $setvar
11718
11719: see if shmdt exists
11720set shmdt d_shmdt
11721eval $inlibc
11722
11723: see how much of the 'shm*(2)' library is present.
11724h_shm=true
11725echo " "
11726case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11727*"$undef"*) h_shm=false;;
11728esac
11729case "$osname" in
11730freebsd)
11731 case "`ipcs 2>&1`" in
11732 "SVID shared memory"*"not configured"*)
11733 echo "Your $osname does not have the shm*(2) configured." >&4
11734 h_shm=false
11735 val="$undef"
11736 set shmctl d_shmctl
11737 evat $setvar
11738 set shmget d_shmget
11739 evat $setvar
11740 set shmat d_shmat
11741 evat $setvar
11742 set shmdt d_shmdt
11743 evat $setvar
11744 ;;
11745 esac
11746 ;;
11747esac
11748: we could also check for sys/ipc.h ...
11749if $h_shm && $test `./findhdr sys/shm.h`; then
11750 echo "You have the full shm*(2) library." >&4
11751 val="$define"
11752else
11753 echo "You don't have the full shm*(2) library." >&4
11754 val="$undef"
11755fi
11756set d_shm
11757eval $setvar
11758
11759echo " "
11760: see if we have sigaction
11761if set sigaction val -f d_sigaction; eval $csym; $val; then
11762 echo 'sigaction() found.' >&4
11763 $cat > try.c <<'EOP'
11764#include <stdio.h>
11765#include <sys/types.h>
11766#include <signal.h>
11767int main()
11768{
11769 struct sigaction act, oact;
11770 act.sa_flags = 0;
11771 oact.sa_handler = 0;
11772 /* so that act and oact are used */
11773 exit(act.sa_flags == 0 && oact.sa_handler == 0);
11774}
11775EOP
11776 set try
11777 if eval $compile_ok; then
11778 val="$define"
11779 else
11780 echo "But you don't seem to have a useable struct sigaction." >&4
11781 val="$undef"
11782 fi
11783else
11784 echo 'sigaction NOT found.' >&4
11785 val="$undef"
11786fi
11787set d_sigaction; eval $setvar
11788$rm -f try try$_o try.c
11789
983dbef6
JH
11790: see if sigprocmask exists
11791set sigprocmask d_sigprocmask
11792eval $inlibc
11793
b4eb6b3d
JH
11794: see if sigsetjmp exists
11795echo " "
11796case "$d_sigsetjmp" in
11797'')
11798 $cat >try.c <<'EOP'
11799#include <setjmp.h>
11800sigjmp_buf env;
11801int set = 1;
11802int main()
11803{
11804 if (sigsetjmp(env,1))
11805 exit(set);
11806 set = 0;
11807 siglongjmp(env, 1);
11808 exit(1);
11809}
11810EOP
11811 set try
11812 if eval $compile; then
11813 if ./try >/dev/null 2>&1; then
11814 echo "POSIX sigsetjmp found." >&4
11815 val="$define"
11816 else
11817 $cat >&4 <<EOM
11818Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11819I'll ignore them.
11820EOM
11821 val="$undef"
11822 fi
11823 else
11824 echo "sigsetjmp not found." >&4
11825 val="$undef"
11826 fi
11827 ;;
11828*) val="$d_sigsetjmp"
11829 case "$d_sigsetjmp" in
11830 $define) echo "POSIX sigsetjmp found." >&4;;
11831 $undef) echo "sigsetjmp not found." >&4;;
11832 esac
11833 ;;
11834esac
11835set d_sigsetjmp
11836eval $setvar
11837$rm -f try.c try
11838
49a78c82
JH
11839: see if sockatmark exists
11840set sockatmark d_sockatmark
11841eval $inlibc
11842
b4eb6b3d
JH
11843: see if socks5_init exists
11844set socks5_init d_socks5_init
11845eval $inlibc
11846
11847: see if sys/stat.h is available
11848set sys/stat.h i_sysstat
11849eval $inhdr
11850
11851
11852: see if stat knows about block sizes
11853echo " "
11854echo "Checking to see if your struct stat has st_blocks field..." >&4
11855set d_statblks stat st_blocks $i_sysstat sys/stat.h
11856eval $hasfield
11857
11858
11859: see if this is a sys/vfs.h system
11860set sys/vfs.h i_sysvfs
11861eval $inhdr
11862
11863
11864: see if this is a sys/statfs.h system
11865set sys/statfs.h i_sysstatfs
11866eval $inhdr
11867
11868
11869echo " "
11870echo "Checking to see if your system supports struct statfs..." >&4
11871set 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
11872eval $hasstruct
11873case "$d_statfs_s" in
11874"$define") echo "Yes, it does." ;;
11875*) echo "No, it doesn't." ;;
11876esac
11877
11878
11879
11880: see if struct statfs knows about f_flags
11881case "$d_statfs_s" in
11882define)
11883 echo " "
11884 echo "Checking to see if your struct statfs has f_flags field..." >&4
11885 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
11886 eval $hasfield
11887 ;;
11888*) val="$undef"
11889 set d_statfs_f_flags
11890 eval $setvar
11891 ;;
11892esac
11893case "$d_statfs_f_flags" in
11894"$define") echo "Yes, it does." ;;
11895*) echo "No, it doesn't." ;;
11896esac
11897
11898: see if _ptr and _cnt from stdio act std
11899echo " "
80f36755
NC
11900
11901if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11902 echo "(Looks like you have stdio.h from BSD.)"
11903 case "$stdio_ptr" in
11904 '') stdio_ptr='((fp)->_p)'
11905 ptr_lval=$define
11906 ;;
11907 *) ptr_lval=$d_stdio_ptr_lval;;
11908 esac
11909 case "$stdio_cnt" in
11910 '') stdio_cnt='((fp)->_r)'
11911 cnt_lval=$define
11912 ;;
11913 *) cnt_lval=$d_stdio_cnt_lval;;
11914 esac
11915 case "$stdio_base" in
11916 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11917 esac
11918 case "$stdio_bufsiz" in
11919 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11920 esac
11921elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
b4eb6b3d
JH
11922 echo "(Looks like you have stdio.h from Linux.)"
11923 case "$stdio_ptr" in
11924 '') stdio_ptr='((fp)->_IO_read_ptr)'
11925 ptr_lval=$define
11926 ;;
11927 *) ptr_lval=$d_stdio_ptr_lval;;
11928 esac
11929 case "$stdio_cnt" in
11930 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11931 cnt_lval=$undef
11932 ;;
11933 *) cnt_lval=$d_stdio_cnt_lval;;
11934 esac
11935 case "$stdio_base" in
11936 '') stdio_base='((fp)->_IO_read_base)';;
11937 esac
11938 case "$stdio_bufsiz" in
11939 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11940 esac
11941else
11942 case "$stdio_ptr" in
11943 '') stdio_ptr='((fp)->_ptr)'
11944 ptr_lval=$define
11945 ;;
11946 *) ptr_lval=$d_stdio_ptr_lval;;
11947 esac
11948 case "$stdio_cnt" in
11949 '') stdio_cnt='((fp)->_cnt)'
11950 cnt_lval=$define
11951 ;;
11952 *) cnt_lval=$d_stdio_cnt_lval;;
11953 esac
11954 case "$stdio_base" in
11955 '') stdio_base='((fp)->_base)';;
11956 esac
11957 case "$stdio_bufsiz" in
11958 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11959 esac
11960fi
80f36755 11961
b4eb6b3d
JH
11962: test whether _ptr and _cnt really work
11963echo "Checking how std your stdio is..." >&4
11964$cat >try.c <<EOP
11965#include <stdio.h>
11966#define FILE_ptr(fp) $stdio_ptr
11967#define FILE_cnt(fp) $stdio_cnt
11968int main() {
11969 FILE *fp = fopen("try.c", "r");
11970 char c = getc(fp);
11971 if (
11972 18 <= FILE_cnt(fp) &&
11973 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11974 )
11975 exit(0);
11976 exit(1);
11977}
11978EOP
11979val="$undef"
11980set try
11981if eval $compile; then
11982 if ./try; then
11983 echo "Your stdio acts pretty std."
11984 val="$define"
11985 else
11986 echo "Your stdio isn't very std."
11987 fi
11988else
11989 echo "Your stdio doesn't appear very std."
11990fi
11991$rm -f try.c try
11992set d_stdstdio
11993eval $setvar
11994
11995: Can _ptr be used as an lvalue?
11996case "$d_stdstdio$ptr_lval" in
11997$define$define) val=$define ;;
11998*) val=$undef ;;
11999esac
12000set d_stdio_ptr_lval
12001eval $setvar
12002
12003: Can _cnt be used as an lvalue?
12004case "$d_stdstdio$cnt_lval" in
12005$define$define) val=$define ;;
12006*) val=$undef ;;
12007esac
12008set d_stdio_cnt_lval
12009eval $setvar
12010
a7ffa9b9
NC
12011
12012: test whether setting _ptr sets _cnt as a side effect
12013d_stdio_ptr_lval_sets_cnt="$undef"
12014d_stdio_ptr_lval_nochange_cnt="$undef"
12015case "$d_stdio_ptr_lval$d_stdstdio" in
12016$define$define)
12017 echo "Checking to see what happens if we set the stdio ptr..." >&4
12018$cat >try.c <<EOP
12019#include <stdio.h>
12020/* Can we scream? */
12021/* Eat dust sed :-) */
c1d9e6fa 12022/* In the buffer space, no one can hear you scream. */
0bbfc344
JH
12023#define FILE_ptr(fp) $stdio_ptr
12024#define FILE_cnt(fp) $stdio_cnt
c1d9e6fa 12025#include <sys/types.h>
a7ffa9b9
NC
12026int main() {
12027 FILE *fp = fopen("try.c", "r");
c1d9e6fa 12028 int c;
a7ffa9b9
NC
12029 char *ptr;
12030 size_t cnt;
c1d9e6fa
JH
12031 if (!fp) {
12032 puts("Fail even to read");
12033 exit(1);
12034 }
12035 c = getc(fp); /* Read away the first # */
12036 if (c == EOF) {
12037 puts("Fail even to read");
12038 exit(1);
12039 }
a7ffa9b9
NC
12040 if (!(
12041 18 <= FILE_cnt(fp) &&
12042 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12043 )) {
12044 puts("Fail even to read");
12045 exit (1);
12046 }
c1d9e6fa
JH
12047 ptr = (char*) FILE_ptr(fp);
12048 cnt = (size_t)FILE_cnt(fp);
a7ffa9b9 12049
c1d9e6fa 12050 FILE_ptr(fp) += 42;
a7ffa9b9 12051
c1d9e6fa 12052 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
a7ffa9b9
NC
12053 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12054 exit (1);
12055 }
12056 if (FILE_cnt(fp) <= 20) {
12057 printf ("Fail (<20 chars to test)");
12058 exit (1);
12059 }
12060 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12061 puts("Fail compare");
12062 exit (1);
12063 }
12064 if (cnt == FILE_cnt(fp)) {
12065 puts("Pass_unchanged");
12066 exit (0);
12067 }
12068 if (FILE_cnt(fp) == (cnt - 42)) {
12069 puts("Pass_changed");
12070 exit (0);
12071 }
12072 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12073 return 1;
12074
12075}
12076EOP
12077 set try
12078 if eval $compile; then
12079 case `./try$exe_ext` in
12080 Pass_changed)
2e32dcfe 12081 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
a7ffa9b9
NC
12082 d_stdio_ptr_lval_sets_cnt="$define" ;;
12083 Pass_unchanged)
12084 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12085 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12086 Fail*)
12087 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12088 *)
12089 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12090 esac
12091 else
12092 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12093 fi
12094 $rm -f try.c try
12095 ;;
12096esac
12097
b4eb6b3d
JH
12098: see if _base is also standard
12099val="$undef"
12100case "$d_stdstdio" in
12101$define)
12102 $cat >try.c <<EOP
12103#include <stdio.h>
12104#define FILE_base(fp) $stdio_base
12105#define FILE_bufsiz(fp) $stdio_bufsiz
12106int main() {
12107 FILE *fp = fopen("try.c", "r");
12108 char c = getc(fp);
12109 if (
12110 19 <= FILE_bufsiz(fp) &&
12111 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12112 )
12113 exit(0);
12114 exit(1);
12115}
12116EOP
12117 set try
12118 if eval $compile; then
12119 if ./try; then
12120 echo "And its _base field acts std."
12121 val="$define"
12122 else
12123 echo "But its _base field isn't std."
12124 fi
12125 else
12126 echo "However, it seems to be lacking the _base field."
12127 fi
12128 $rm -f try.c try
12129 ;;
12130esac
12131set d_stdiobase
12132eval $setvar
12133
12134$cat >&4 <<EOM
12135Checking how to access stdio streams by file descriptor number...
12136EOM
12137case "$stdio_stream_array" in
12138'') $cat >try.c <<EOCP
12139#include <stdio.h>
12140int main() {
12141 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12142 printf("yes\n");
12143}
12144EOCP
12145 for s in _iob __iob __sF
12146 do
12147 set try -DSTDIO_STREAM_ARRAY=$s
12148 if eval $compile; then
12149 case "`./try$exe_ext`" in
12150 yes) stdio_stream_array=$s; break ;;
12151 esac
12152 fi
12153 done
12154 $rm -f try.* try$exe_ext
12155esac
12156case "$stdio_stream_array" in
12157'') $cat >&4 <<EOM
12158I can't figure out how to access stdio streams by file descriptor number.
12159EOM
12160 d_stdio_stream_array="$undef"
12161 ;;
12162*) $cat >&4 <<EOM
12163You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12164EOM
12165 d_stdio_stream_array="$define"
12166 ;;
12167esac
12168
12169: see if strcoll exists
12170set strcoll d_strcoll
12171eval $inlibc
12172
12173: check for structure copying
12174echo " "
12175echo "Checking to see if your C compiler can copy structs..." >&4
12176$cat >try.c <<'EOCP'
12177int main()
12178{
12179 struct blurfl {
12180 int dyick;
12181 } foo, bar;
12182
12183 foo = bar;
12184}
12185EOCP
12186if $cc -c try.c >/dev/null 2>&1 ; then
12187 val="$define"
12188 echo "Yup, it can."
12189else
12190 val="$undef"
12191 echo "Nope, it can't."
12192fi
12193set d_strctcpy
12194eval $setvar
12195$rm -f try.*
12196
12197: see if strerror and/or sys_errlist[] exist
12198echo " "
12199if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12200 if set strerror val -f d_strerror; eval $csym; $val; then
12201 echo 'strerror() found.' >&4
12202 d_strerror="$define"
12203 d_strerrm='strerror(e)'
12204 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12205 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
12206 d_syserrlst="$define"
12207 else
12208 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12209 d_syserrlst="$undef"
12210 fi
12211 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12212 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12213 echo 'strerror() found in string header.' >&4
12214 d_strerror="$define"
12215 d_strerrm='strerror(e)'
12216 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12217 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12218 d_syserrlst="$define"
12219 else
12220 echo "(You don't appear to have any sys_errlist[], how can this be?)"
12221 d_syserrlst="$undef"
12222 fi
12223 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12224 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12225 d_strerror="$undef"
12226 d_syserrlst="$define"
12227 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12228 else
12229 echo 'strerror() and sys_errlist[] NOT found.' >&4
12230 d_strerror="$undef"
12231 d_syserrlst="$undef"
12232 d_strerrm='"unknown"'
12233 fi
12234fi
12235
b3c85772
JH
12236: see if strftime exists
12237set strftime d_strftime
12238eval $inlibc
12239
b4eb6b3d
JH
12240: see if strtod exists
12241set strtod d_strtod
12242eval $inlibc
12243
12244: see if strtol exists
12245set strtol d_strtol
12246eval $inlibc
12247
12248: see if strtold exists
12249set strtold d_strtold
12250eval $inlibc
12251
12252: see if strtoll exists
12253set strtoll d_strtoll
12254eval $inlibc
12255
12256case "$d_longlong-$d_strtoll" in
12257"$define-$define")
12258 $cat <<EOM
12259Checking whether your strtoll() works okay...
12260EOM
12261 $cat >try.c <<'EOCP'
12262#include <errno.h>
12263#ifdef __hpux
12264#define strtoll __strtoll
12265#endif
e75931a7
YST
12266#ifdef __EMX__
12267#define strtoll _strtoll
12268#endif
b4eb6b3d
JH
12269#include <stdio.h>
12270extern long long int strtoll(char *s, char **, int);
12271static int bad = 0;
12272int check(char *s, long long ell, int een) {
12273 long long gll;
12274 errno = 0;
12275 gll = strtoll(s, 0, 10);
12276 if (!((gll == ell) && (errno == een)))
12277 bad++;
12278}
12279int main() {
12280 check(" 1", 1LL, 0);
12281 check(" 0", 0LL, 0);
12282 check("-1", -1LL, 0);
12283 check("-9223372036854775808", -9223372036854775808LL, 0);
12284 check("-9223372036854775808", -9223372036854775808LL, 0);
12285 check(" 9223372036854775807", 9223372036854775807LL, 0);
12286 check("-9223372036854775808", -9223372036854775808LL, 0);
12287 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
12288 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12289 if (!bad)
12290 printf("ok\n");
12291}
12292EOCP
12293 set try
12294 if eval $compile; then
e75931a7
YST
12295 yyy=`./try`
12296 case "$yyy" in
b4eb6b3d
JH
12297 ok) echo "Your strtoll() seems to be working okay." ;;
12298 *) cat <<EOM >&4
12299Your strtoll() doesn't seem to be working okay.
12300EOM
12301 d_strtoll="$undef"
12302 ;;
69eadf66 12303 esac
e75931a7
YST
12304 else
12305 echo "(I can't seem to compile the test program--assuming it doesn't)"
12306 d_strtoll="$undef"
b4eb6b3d
JH
12307 fi
12308 ;;
12309esac
12310
28e5dec8
JH
12311: see if strtoq exists
12312set strtoq d_strtoq
12313eval $inlibc
12314
b4eb6b3d
JH
12315: see if strtoul exists
12316set strtoul d_strtoul
12317eval $inlibc
12318
d0e6d399
NC
12319case "$d_strtoul" in
12320"$define")
12321 $cat <<EOM
12322Checking whether your strtoul() works okay...
12323EOM
12324 $cat >try.c <<'EOCP'
12325#include <errno.h>
12326#include <stdio.h>
12327extern unsigned long int strtoul(char *s, char **, int);
12328static int bad = 0;
12329void check(char *s, unsigned long eul, int een) {
12330 unsigned long gul;
12331 errno = 0;
12332 gul = strtoul(s, 0, 10);
12333 if (!((gul == eul) && (errno == een)))
12334 bad++;
12335}
12336int main() {
12337 check(" 1", 1L, 0);
12338 check(" 0", 0L, 0);
12339EOCP
12340 case "$longsize" in
12341 8)
12342 $cat >>try.c <<'EOCP'
09c0d2c4
JH
12343 check("18446744073709551615", 18446744073709551615UL, 0);
12344 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 12345#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 12346 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
12347 check("-18446744073709551614", 2, 0);
12348 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
12349 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12350 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 12351#endif
d0e6d399
NC
12352EOCP
12353 ;;
12354 4)
12355 $cat >>try.c <<'EOCP'
12356 check("4294967295", 4294967295UL, 0);
12357 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 12358#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
12359 check("-1", 4294967295UL, 0);
12360 check("-4294967294", 2, 0);
12361 check("-4294967295", 1, 0);
12362 check("-4294967296", 4294967295UL, ERANGE);
12363 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 12364#endif
d0e6d399
NC
12365EOCP
12366 ;;
12367 *)
12368: Should we write these tests to be more portable by sprintf-ing
12369: ~0 and then manipulating that char string as input for strtol?
12370 ;;
12371 esac
12372 $cat >>try.c <<'EOCP'
12373 if (!bad)
12374 printf("ok\n");
12375 return 0;
12376}
12377EOCP
12378 set try
12379 if eval $compile; then
12380 case "`./try`" in
12381 ok) echo "Your strtoul() seems to be working okay." ;;
12382 *) cat <<EOM >&4
12383Your strtoul() doesn't seem to be working okay.
12384EOM
12385 d_strtoul="$undef"
12386 ;;
12387 esac
12388 fi
12389 ;;
12390esac
12391
b4eb6b3d
JH
12392: see if strtoull exists
12393set strtoull d_strtoull
12394eval $inlibc
12395
12396case "$d_longlong-$d_strtoull" in
12397"$define-$define")
12398 $cat <<EOM
12399Checking whether your strtoull() works okay...
12400EOM
12401 $cat >try.c <<'EOCP'
12402#include <errno.h>
12403#ifdef __hpux
12404#define strtoull __strtoull
12405#endif
12406#include <stdio.h>
12407extern unsigned long long int strtoull(char *s, char **, int);
12408static int bad = 0;
12409int check(char *s, long long eull, int een) {
12410 long long gull;
12411 errno = 0;
12412 gull = strtoull(s, 0, 10);
12413 if (!((gull == eull) && (errno == een)))
12414 bad++;
12415}
12416int main() {
d0e6d399
NC
12417 check(" 1", 1LL, 0);
12418 check(" 0", 0LL, 0);
12419 check("18446744073709551615", 18446744073709551615ULL, 0);
12420 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 12421#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
12422 check("-1", 18446744073709551615ULL, 0);
12423 check("-18446744073709551614", 2LL, 0);
12424 check("-18446744073709551615", 1LL, 0);
12425 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12426 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 12427#endif
b4eb6b3d
JH
12428 if (!bad)
12429 printf("ok\n");
12430}
12431EOCP
12432 set try
12433 if eval $compile; then
12434 case "`./try`" in
12435 ok) echo "Your strtoull() seems to be working okay." ;;
12436 *) cat <<EOM >&4
12437Your strtoull() doesn't seem to be working okay.
12438EOM
12439 d_strtoull="$undef"
12440 ;;
12441 esac
12442 fi
12443 ;;
12444esac
12445
12446: see if strtouq exists
12447set strtouq d_strtouq
12448eval $inlibc
12449
d0e6d399
NC
12450case "$d_strtouq" in
12451"$define")
12452 $cat <<EOM
12453Checking whether your strtouq() works okay...
12454EOM
12455 $cat >try.c <<'EOCP'
12456#include <errno.h>
12457#include <stdio.h>
12458extern unsigned long long int strtouq(char *s, char **, int);
12459static int bad = 0;
12460void check(char *s, unsigned long long eull, int een) {
12461 unsigned long long gull;
12462 errno = 0;
12463 gull = strtouq(s, 0, 10);
12464 if (!((gull == eull) && (errno == een)))
12465 bad++;
12466}
12467int main() {
12468 check(" 1", 1LL, 0);
12469 check(" 0", 0LL, 0);
12470 check("18446744073709551615", 18446744073709551615ULL, 0);
12471 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 12472#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
12473 check("-1", 18446744073709551615ULL, 0);
12474 check("-18446744073709551614", 2LL, 0);
12475 check("-18446744073709551615", 1LL, 0);
12476 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12477 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 12478#endif
d0e6d399
NC
12479 if (!bad)
12480 printf("ok\n");
12481 return 0;
12482}
12483EOCP
12484 set try
12485 if eval $compile; then
12486 case "`./try`" in
12487 ok) echo "Your strtouq() seems to be working okay." ;;
12488 *) cat <<EOM >&4
12489Your strtouq() doesn't seem to be working okay.
12490EOM
12491 d_strtouq="$undef"
12492 ;;
12493 esac
12494 fi
12495 ;;
12496esac
12497
b4eb6b3d
JH
12498: see if strxfrm exists
12499set strxfrm d_strxfrm
12500eval $inlibc
12501
12502: see if symlink exists
12503set symlink d_symlink
12504eval $inlibc
12505
12506: see if syscall exists
12507set syscall d_syscall
12508eval $inlibc
12509
12510: see if sysconf exists
12511set sysconf d_sysconf
12512eval $inlibc
12513
12514: see if system exists
12515set system d_system
12516eval $inlibc
12517
12518: see if tcgetpgrp exists
12519set tcgetpgrp d_tcgetpgrp
12520eval $inlibc
12521
12522: see if tcsetpgrp exists
12523set tcsetpgrp d_tcsetpgrp
12524eval $inlibc
12525
12526: see if prototype for telldir is available
12527echo " "
12528set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12529eval $hasproto
12530
12531: see if this is a sys/times.h system
12532set sys/times.h i_systimes
12533eval $inhdr
12534
12535: see if times exists
12536echo " "
12537if set times val -f d_times; eval $csym; $val; then
12538 echo 'times() found.' >&4
12539 d_times="$define"
12540 inc=''
12541 case "$i_systimes" in
12542 "$define") inc='sys/times.h';;
12543 esac
12544 rp="What is the type returned by times() on this system?"
12545 set clock_t clocktype long stdio.h sys/types.h $inc
12546 eval $typedef_ask
12547else
12548 echo 'times() NOT found, hope that will do.' >&4
12549 d_times="$undef"
12550 clocktype='int'
12551fi
12552
12553: see if truncate exists
12554set truncate d_truncate
12555eval $inlibc
12556
12557: see if tzname[] exists
12558echo " "
12559if set tzname val -a d_tzname; eval $csym; $val; then
12560 val="$define"
12561 echo 'tzname[] found.' >&4
12562else
12563 val="$undef"
12564 echo 'tzname[] NOT found.' >&4
12565fi
12566set d_tzname
12567eval $setvar
12568
4e0554ec
JH
12569case "$crosscompile" in
12570''|[nN]*) crosscompile="$undef" ;;
12571esac
12572
12573case "$osname" in
12574next|rhapsody|darwin) multiarch="$define" ;;
12575esac
12576case "$multiarch" in
12577''|[nN]*) multiarch="$undef" ;;
12578esac
12579
12580: check for ordering of bytes in a long
12581echo " "
12582case "$crosscompile$multiarch" in
12583*$define*)
12584 $cat <<EOM
12585You seem to be either cross-compiling or doing a multiarchitecture build,
12586skipping the byteorder check.
12587
12588EOM
12589 byteorder='0xffff'
12590 ;;
12591*)
12592 case "$byteorder" in
12593 '')
12594 $cat <<'EOM'
12595In the following, larger digits indicate more significance. A big-endian
12596machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12597little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12598machines may have weird orders like 3412. A Cray will report 87654321,
12599an Alpha will report 12345678. If the test program works the default is
12600probably right.
12601I'm now running the test program...
12602EOM
12603 $cat >try.c <<'EOCP'
12604#include <stdio.h>
12605int main()
12606{
12607 int i;
12608 union {
12609 unsigned long l;
12610 char c[sizeof(long)];
12611 } u;
12612
12613 if (sizeof(long) > 4)
12614 u.l = (0x08070605L << 32) | 0x04030201L;
12615 else
12616 u.l = 0x04030201L;
12617 for (i = 0; i < sizeof(long); i++)
12618 printf("%c", u.c[i]+'0');
12619 printf("\n");
12620 exit(0);
12621}
12622EOCP
12623 xxx_prompt=y
12624 set try
12625 if eval $compile && ./try > /dev/null; then
12626 dflt=`./try`
12627 case "$dflt" in
12628 [1-4][1-4][1-4][1-4]|12345678|87654321)
12629 echo "(The test program ran ok.)"
12630 echo "byteorder=$dflt"
12631 xxx_prompt=n
12632 ;;
12633 ????|????????) echo "(The test program ran ok.)" ;;
12634 *) echo "(The test program didn't run right for some reason.)" ;;
12635 esac
12636 else
12637 dflt='4321'
12638 cat <<'EOM'
12639(I can't seem to compile the test program. Guessing big-endian...)
12640EOM
12641 fi
12642 case "$xxx_prompt" in
12643 y)
12644 rp="What is the order of bytes in a long?"
12645 . ./myread
12646 byteorder="$ans"
12647 ;;
12648 *) byteorder=$dflt
12649 ;;
12650 esac
12651 ;;
12652 esac
12653 $rm -f try.c try
12654 ;;
12655esac
12656
12657
12658$cat <<EOM
12659
12660Checking to see whether you can access character data unalignedly...
12661EOM
12662$cat >try.c <<EOCP
12663#include <stdio.h>
12664#define U32 $u32type
12665#define BYTEORDER $byteorder
12666int main() {
12667#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
12668 U8 buf[] = "\0\0\0\1\0\0\0\0";
12669 U32 *up;
12670 int i;
12671
12672 if (sizeof(U32) != 4) {
12673 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
12674 exit(1);
12675 }
12676
12677 fflush(stdout);
12678
12679 for (i = 0; i < 4; i++) {
12680 up = (U32*)(buf + i);
12681 if (! ((*up == 1 << (8*i)) || /* big-endian */
12682 (*up == 1 << (8*(3-i))) /* little-endian */
12683 )
12684 )
12685 {
12686 printf("read failed (%x)\n", *up);
12687 exit(2);
12688 }
12689 }
12690
12691 /* write test */
12692 for (i = 0; i < 4; i++) {
12693 up = (U32*)(buf + i);
12694 *up = 0xBeef;
12695 if (*up != 0xBeef) {
12696 printf("write failed (%x)\n", *up);
12697 exit(3);
12698 }
12699 }
12700
12701 exit(0);
12702#else
12703 printf("1\n");
12704 exit(1);
12705#endif
12706 return 0;
12707}
12708EOCP
12709set try
12710if eval $compile_ok; then
12711 echo "(This test may dump core.)" >&4
12712 ./try >&2 >/dev/null
12713 case "$?" in
12714 0) cat >&4 <<EOM
12715You can access character data pretty unalignedly.
12716EOM
12717 d_u32align="$undef"
12718 ;;
12719 *) cat >&4 <<EOM
12720It seems that you must access character data in an aligned manner.
12721EOM
12722 d_u32align="$define"
12723 ;;
12724 esac
12725 $rm -f core core.try.* try.core
12726else
12727 rp='Can you access character data at unaligned addresses?'
12728 dflt='n'
12729 . ./myread
12730 case "$ans" in
12731 [yY]*) d_u32align="$undef" ;;
12732 *) d_u32align="$define" ;;
12733 esac
12734fi
12735
12736: see if ualarm exists
12737set ualarm d_ualarm
12738eval $inlibc
12739
b4eb6b3d
JH
12740: see if umask exists
12741set umask d_umask
12742eval $inlibc
12743
4e0554ec
JH
12744: see if usleep exists
12745set usleep d_usleep
12746eval $inlibc
12747
b4eb6b3d
JH
12748: see if ustat exists
12749set ustat d_ustat
12750eval $inlibc
12751
12752: backward compatibility for d_hvfork
12753if test X$d_hvfork != X; then
12754 d_vfork="$d_hvfork"
12755 d_hvfork=''
12756fi
12757: see if there is a vfork
12758val=''
12759set vfork val
12760eval $inlibc
12761
12762: Ok, but do we want to use it. vfork is reportedly unreliable in
12763: perl on Solaris 2.x, and probably elsewhere.
12764case "$val" in
12765$define)
12766 echo " "
12767 case "$usevfork" in
12768 false) dflt='n';;
12769 *) dflt='y';;
12770 esac
12771 cat <<'EOM'
12772
12773Perl can only use a vfork() that doesn't suffer from strict
12774restrictions on calling functions or modifying global data in
12775the child. For example, glibc-2.1 contains such a vfork()
12776that is unsuitable. If your system provides a proper fork()
12777call, chances are that you do NOT want perl to use vfork().
12778
12779EOM
12780 rp="Do you still want to use vfork()?"
12781 . ./myread
12782 case "$ans" in
12783 y|Y) ;;
12784 *)
12785 echo "Ok, we won't use vfork()."
12786 val="$undef"
12787 ;;
12788 esac
12789 ;;
12790esac
12791set d_vfork
12792eval $setvar
12793case "$d_vfork" in
12794$define) usevfork='true';;
12795*) usevfork='false';;
12796esac
12797
12798: see if this is an sysdir system
12799set sys/dir.h i_sysdir
12800eval $inhdr
12801
12802: see if this is an sysndir system
12803set sys/ndir.h i_sysndir
12804eval $inhdr
12805
12806: see if closedir exists
12807set closedir d_closedir
12808eval $inlibc
12809
12810case "$d_closedir" in
12811"$define")
12812 echo " "
12813 echo "Checking whether closedir() returns a status..." >&4
12814 cat > closedir.c <<EOM
12815#$i_dirent I_DIRENT /**/
12816#$i_sysdir I_SYS_DIR /**/
12817#$i_sysndir I_SYS_NDIR /**/
12818#$i_systypes I_SYS_TYPES /**/
12819
12820#if defined(I_SYS_TYPES)
12821#include <sys/types.h>
12822#endif
12823#if defined(I_DIRENT)
12824#include <dirent.h>
12825#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12826#include <sys/dir.h>
12827#endif
12828#else
12829#ifdef I_SYS_NDIR
12830#include <sys/ndir.h>
12831#else
12832#ifdef I_SYS_DIR
12833#ifdef hp9000s500
12834#include <ndir.h> /* may be wrong in the future */
12835#else
12836#include <sys/dir.h>
12837#endif
12838#endif
12839#endif
12840#endif
12841int main() { return closedir(opendir(".")); }
12842EOM
12843 set closedir
12844 if eval $compile_ok; then
12845 if ./closedir > /dev/null 2>&1 ; then
12846 echo "Yes, it does."
12847 val="$undef"
12848 else
12849 echo "No, it doesn't."
12850 val="$define"
12851 fi
12852 else
12853 echo "(I can't seem to compile the test program--assuming it doesn't)"
12854 val="$define"
12855 fi
12856 ;;
12857*)
12858 val="$undef";
12859 ;;
12860esac
12861set d_void_closedir
12862eval $setvar
12863$rm -f closedir*
b4eb6b3d
JH
12864: see if there is a wait4
12865set wait4 d_wait4
12866eval $inlibc
12867
12868: see if waitpid exists
12869set waitpid d_waitpid
12870eval $inlibc
12871
12872: see if wcstombs exists
12873set wcstombs d_wcstombs
12874eval $inlibc
12875
12876: see if wctomb exists
12877set wctomb d_wctomb
12878eval $inlibc
12879
4e0554ec
JH
12880: see if writev exists
12881set writev d_writev
12882eval $inlibc
12883
b4eb6b3d
JH
12884: preserve RCS keywords in files with variable substitution, grrr
12885Date='$Date'
12886Id='$Id'
12887Log='$Log'
12888RCSfile='$RCSfile'
12889Revision='$Revision'
12890
b4eb6b3d
JH
12891: check for alignment requirements
12892echo " "
12893case "$crosscompile$multiarch" in
12894*$define*)
12895 $cat <<EOM
12896You seem to be either cross-compiling or doing a multiarchitecture build,
12897skipping the memory alignment check.
12898
12899EOM
12900 case "$alignbytes" in
12901 '') alignbytes=8 ;;
12902 esac
12903 ;;
12904*)
12905 case "$alignbytes" in
12906 '') echo "Checking alignment constraints..." >&4
12907 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12908 $cat >try.c <<'EOCP'
12909typedef long double NV;
12910EOCP
12911 else
12912 $cat >try.c <<'EOCP'
12913typedef double NV;
12914EOCP
12915 fi
12916 $cat >>try.c <<'EOCP'
12917#include <stdio.h>
12918struct foobar {
12919 char foo;
12920 NV bar;
12921} try_algn;
12922int main()
12923{
12924 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12925 return(0);
12926}
12927EOCP
12928 set try
12929 if eval $compile_ok; then
12930 dflt=`./try`
12931 else
12932 dflt='8'
12933 echo "(I can't seem to compile the test program...)"
12934 fi
12935 ;;
12936 *) dflt="$alignbytes"
12937 ;;
12938 esac
12939 rp="Doubles must be aligned on a how-many-byte boundary?"
12940 . ./myread
12941 alignbytes="$ans"
12942 $rm -f try.c try
12943 ;;
12944esac
12945
12946
12947: set the base revision
12948baserev=5.0
12949
b4eb6b3d
JH
12950: how do we catenate cpp tokens here?
12951echo " "
12952echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12953$cat >cpp_stuff.c <<'EOCP'
12954#define RCAT(a,b)a/**/b
12955#define ACAT(a,b)a ## b
12956RCAT(Rei,ser)
12957ACAT(Cir,cus)
12958EOCP
12959$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12960if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12961 echo "Oh! Smells like ANSI's been here." >&4
12962 echo "We can catify or stringify, separately or together!"
12963 cpp_stuff=42
12964elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12965 echo "Ah, yes! The good old days!" >&4
12966 echo "However, in the good old days we don't know how to stringify and"
12967 echo "catify at the same time."
12968 cpp_stuff=1
12969else
12970 $cat >&4 <<EOM
12971Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
12972to have to edit the values of CAT[2-5] in config.h...
12973EOM
12974 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12975fi
12976$rm -f cpp_stuff.*
12977
12978: see if this is a db.h system
12979set db.h i_db
12980eval $inhdr
12981
12982case "$i_db" in
12983$define)
12984 : Check db version.
12985 echo " "
12986 echo "Checking Berkeley DB version ..." >&4
12987 $cat >try.c <<EOCP
12988#$d_const HASCONST
12989#ifndef HASCONST
12990#define const
12991#endif
12992#include <sys/types.h>
12993#include <stdio.h>
12994#include <db.h>
12995int main()
12996{
12997#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12998 int Major, Minor, Patch ;
12999 unsigned long Version ;
13000 (void)db_version(&Major, &Minor, &Patch) ;
13001 printf("You have Berkeley DB Version 2 or greater\n");
13002
13003 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13004 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13005 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13006 Major, Minor, Patch) ;
13007
13008 /* check that db.h & libdb are compatible */
13009 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
13010 printf("db.h and libdb are incompatible\n") ;
13011 exit(3);
13012 }
13013
13014 printf("db.h and libdb are compatible\n") ;
13015
13016 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13017 + DB_VERSION_PATCH ;
13018
13019 /* needs to be >= 2.3.4 */
13020 if (Version < 2003004) {
13021 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
13022 printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
13023 exit(2);
13024 }
13025
13026 exit(0);
13027#else
13028#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
13029 printf("You have Berkeley DB Version 1\n");
13030 exit(0); /* DB version < 2: the coast is clear. */
13031#else
13032 exit(1); /* <db.h> not Berkeley DB? */
13033#endif
13034#endif
13035}
13036EOCP
13037 set try
13038 if eval $compile_ok && ./try; then
13039 echo 'Looks OK.' >&4
13040 else
13041 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
13042 i_db=$undef
13043 case " $libs " in
13044 *"-ldb "*)
13045 : Remove db from list of libraries to use
13046 echo "Removing unusable -ldb from library list" >&4
13047 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13048 shift
13049 libs="$*"
13050 echo "libs = $libs" >&4
13051 ;;
13052 esac
13053 fi
13054 $rm -f try.*
13055 ;;
13056esac
13057
13058case "$i_db" in
13059define)
13060 : Check the return type needed for hash
13061 echo " "
13062 echo "Checking return type needed for hash for Berkeley DB ..." >&4
13063 $cat >try.c <<EOCP
13064#$d_const HASCONST
13065#ifndef HASCONST
13066#define const
13067#endif
13068#include <sys/types.h>
13069#include <db.h>
13070
13071#ifndef DB_VERSION_MAJOR
13072u_int32_t hash_cb (ptr, size)
13073const void *ptr;
13074size_t size;
13075{
13076}
13077HASHINFO info;
13078int main()
13079{
13080 info.hash = hash_cb;
13081}
13082#endif
13083EOCP
13084 if $cc $ccflags -c try.c >try.out 2>&1 ; then
13085 if $contains warning try.out >>/dev/null 2>&1 ; then
13086 db_hashtype='int'
13087 else
13088 db_hashtype='u_int32_t'
13089 fi
13090 else
13091 : XXX Maybe we should just give up here.
13092 db_hashtype=u_int32_t
13093 $cat try.out >&4
13094 echo "Help: I can't seem to compile the db test program." >&4
13095 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13096 fi
13097 $rm -f try.*
13098 echo "Your version of Berkeley DB uses $db_hashtype for hash."
13099 ;;
13100*) db_hashtype=u_int32_t
13101 ;;
13102esac
13103case "$i_db" in
13104define)
13105 : Check the return type needed for prefix
13106 echo " "
13107 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13108 cat >try.c <<EOCP
13109#$d_const HASCONST
13110#ifndef HASCONST
13111#define const
13112#endif
13113#include <sys/types.h>
13114#include <db.h>
13115
13116#ifndef DB_VERSION_MAJOR
13117size_t prefix_cb (key1, key2)
13118const DBT *key1;
13119const DBT *key2;
13120{
13121}
13122BTREEINFO info;
13123int main()
13124{
13125 info.prefix = prefix_cb;
13126}
13127#endif
13128EOCP
13129 if $cc $ccflags -c try.c >try.out 2>&1 ; then
13130 if $contains warning try.out >>/dev/null 2>&1 ; then
13131 db_prefixtype='int'
13132 else
13133 db_prefixtype='size_t'
13134 fi
13135 else
13136 db_prefixtype='size_t'
13137 : XXX Maybe we should just give up here.
13138 $cat try.out >&4
13139 echo "Help: I can't seem to compile the db test program." >&4
13140 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13141 fi
13142 $rm -f try.*
13143 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13144 ;;
13145*) db_prefixtype='size_t'
13146 ;;
13147esac
13148
b4eb6b3d
JH
13149
13150: How can we generate normalized random numbers ?
13151echo " "
13152echo "Looking for a random number function..." >&4
13153case "$randfunc" in
13154'')
13155 if set drand48 val -f; eval $csym; $val; then
13156 dflt="drand48"
13157 echo "Good, found drand48()." >&4
13158 elif set random val -f; eval $csym; $val; then
13159 dflt="random"
13160 echo "OK, found random()." >&4
13161 else
13162 dflt="rand"
13163 echo "Yick, looks like I have to use rand()." >&4
13164 fi
13165 echo " "
13166 ;;
13167*)
13168 dflt="$randfunc"
13169 ;;
13170esac
13171cont=true
13172
13173case "$ccflags" in
13174*-Dmy_rand=*|*-Dmy_srand=*)
13175 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13176 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13177 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13178 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13179 ;;
13180esac
13181
13182while $test "$cont"; do
13183 rp="Use which function to generate random numbers?"
13184 . ./myread
13185 if $test "$ans" = "$dflt"; then
13186 : null
13187 else
13188 randbits=''
13189 fi
13190 randfunc="$ans"
13191 if set $ans val -f; eval $csym; $val; then
13192 cont=''
13193 else
13194 dflt=y
13195 rp="I cannot find function $ans. Use that name anyway?"
13196 . ./myread
13197 dflt=rand
13198 case "$ans" in
13199 [yY]*) cont='';;
13200 esac
13201 fi
13202 case "$cont" in
13203 '')
13204 case "$randfunc" in
13205 drand48)
13206 drand01="drand48()"
13207 seedfunc="srand48"
13208 randbits=48
13209 randseedtype=long
13210 ;;
13211 rand|random)
13212 case "$randbits" in
13213 '')
13214echo "Checking to see how many bits your $randfunc() function produces..." >&4
13215 $cat >try.c <<EOCP
13216#$i_unistd I_UNISTD
13217#$i_stdlib I_STDLIB
13218#include <stdio.h>
13219#ifdef I_UNISTD
13220# include <unistd.h>
13221#endif
13222#ifdef I_STDLIB
13223# include <stdlib.h>
13224#endif
13225int main()
13226{
13227 register int i;
13228 register unsigned long tmp;
13229 register unsigned long max = 0L;
13230
13231 for (i = 1000; i; i--) {
13232 tmp = (unsigned long) $randfunc();
13233 if (tmp > max) max = tmp;
13234 }
13235 for (i = 0; max; i++)
13236 max /= 2;
13237 printf("%d\n",i);
13238}
13239EOCP
13240 set try
13241 if eval $compile_ok; then
13242 dflt=`try`
13243 else
13244 dflt='?'
13245 echo "(I can't seem to compile the test program...)"
13246 fi
13247 ;;
13248 *)
13249 dflt="$randbits"
13250 ;;
13251 esac
13252 rp="How many bits does your $randfunc() function produce?"
13253 . ./myread
13254 randbits="$ans"
13255 $rm -f try.c try
13256 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13257 seedfunc="s$randfunc"
13258 randseedtype=unsigned
13259 ;;
13260 *)
13261 dflt="31"
13262 rp="How many bits does your $randfunc() function produce?"
13263 . ./myread
13264 randbits="$ans"
13265 seedfunc="s$randfunc"
13266 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13267 if set $seedfunc val -f; eval $csym; $val; then
13268 echo "(Using $seedfunc() to seed random generator)"
13269 else
13270 echo "(Warning: no $seedfunc() to seed random generator)"
13271 seedfunc=rand
13272 fi
13273 randseedtype=unsigned
13274 ;;
13275 esac
13276 ;;
13277 esac
13278done
13279
13280echo " "
13281echo "Determining whether or not we are on an EBCDIC system..." >&4
13282$cat >tebcdic.c <<'EOM'
13283int main()
13284{
13285 if ('M'==0xd4) return 0;
13286 return 1;
13287}
13288EOM
13289
13290val=$undef
13291set tebcdic
13292if eval $compile_ok; then
13293 if ./tebcdic; then
13294 echo "You seem to speak EBCDIC." >&4
13295 val="$define"
13296 else
13297 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13298 fi
13299else
13300 echo "I'm unable to compile the test program." >&4
13301 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13302fi
13303$rm -f tebcdic.c tebcdic
13304set ebcdic
13305eval $setvar
13306
13307echo " "
13308$cat >&4 <<EOM
13309Checking how to flush all pending stdio output...
13310EOM
13311# I only know how to find the first 32 possibly open files on SunOS.
13312# See also hints/sunos_4_1.sh and util.c --AD
13313case "$osname" in
13314sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13315esac
13316$cat >>try.c <<EOCP
13317#include <stdio.h>
13318#$i_unistd I_UNISTD
13319#ifdef I_UNISTD
13320# include <unistd.h>
13321#endif
13322#$d_sysconf HAS_SYSCONF
13323#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13324#ifdef HAS_STDIO_STREAM_ARRAY
13325# define STDIO_STREAM_ARRAY $stdio_stream_array
13326#endif
13327int main() {
13328 FILE* p = fopen("try.out", "w");
13329#ifdef TRY_FPUTC
13330 fputc('x', p);
13331#else
13332# ifdef TRY_FPRINTF
13333 fprintf(p, "x");
13334# endif
13335#endif
13336#ifdef TRY_FFLUSH_NULL
13337 fflush(NULL);
13338#endif
13339#ifdef TRY_FFLUSH_ALL
13340 {
13341 long open_max = -1;
13342# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13343 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13344# else
13345# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13346 open_max = sysconf(_SC_OPEN_MAX);
13347# else
13348# ifdef FOPEN_MAX
13349 open_max = FOPEN_MAX;
13350# else
13351# ifdef OPEN_MAX
13352 open_max = OPEN_MAX;
13353# else
13354# ifdef _NFILE
13355 open_max = _NFILE;
13356# endif
13357# endif
13358# endif
13359# endif
13360# endif
13361# ifdef HAS_STDIO_STREAM_ARRAY
13362 if (open_max > 0) {
13363 long i;
13364 for (i = 0; i < open_max; i++)
13365 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13366 STDIO_STREAM_ARRAY[i]._file < open_max &&
13367 STDIO_STREAM_ARRAY[i]._flag)
13368 fflush(&STDIO_STREAM_ARRAY[i]);
13369 }
13370 }
13371# endif
13372#endif
13373 _exit(42);
13374}
13375EOCP
13376: first we have to find out how _not_ to flush
13377if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13378 output=''
13379 set try -DTRY_FPUTC
13380 if eval $compile; then
13381 $rm -f try.out
13382 ./try$exe_ext 2>/dev/null
13383 if $test ! -s try.out -a "X$?" = X42; then
13384 output=-DTRY_FPUTC
13385 fi
13386 fi
13387 case "$output" in
13388 '')
13389 set try -DTRY_FPRINTF
13390 $rm -f try.out
13391 if eval $compile; then
13392 $rm -f try.out
13393 ./try$exe_ext 2>/dev/null
13394 if $test ! -s try.out -a "X$?" = X42; then
13395 output=-DTRY_FPRINTF
13396 fi
13397 fi
13398 ;;
13399 esac
13400fi
13401: check for fflush NULL behaviour
13402case "$fflushNULL" in
13403'') set try -DTRY_FFLUSH_NULL $output
13404 if eval $compile; then
13405 $rm -f try.out
13406 ./try$exe_ext 2>/dev/null
13407 code="$?"
13408 if $test -s try.out -a "X$code" = X42; then
13409 fflushNULL="`$cat try.out`"
13410 else
13411 if $test "X$code" != X42; then
13412 $cat >&4 <<EOM
13413(If this test failed, don't worry, we'll try another method shortly.)
13414EOM
13415 fi
13416 fi
13417 fi
13418 $rm -f core try.core core.try.*
13419 case "$fflushNULL" in
13420 x) $cat >&4 <<EOM
13421Your fflush(NULL) works okay for output streams.
13422Let's see if it clobbers input pipes...
13423EOM
13424# As of mid-March 2000 all versions of Solaris appear to have a stdio
13425# bug that improperly flushes the input end of pipes. So we avoid the
13426# autoflush on fork/system/exec support for now. :-(
13427$cat >tryp.c <<EOCP
13428#include <stdio.h>
13429int
13430main(int argc, char **argv)
13431{
13432 char buf[1024];
13433 int i;
13434 char *bp = buf;
13435 while (1) {
13436 while ((i = getc(stdin)) != -1
13437 && (*bp++ = i) != '\n'
13438 && bp < &buf[1024])
13439 /* DO NOTHING */ ;
13440 *bp = '\0';
13441 fprintf(stdout, "%s", buf);
13442 fflush(NULL);
13443 if (i == -1)
13444 return 0;
13445 bp = buf;
13446 }
13447}
13448EOCP
13449 fflushNULL="$define"
13450 set tryp
13451 if eval $compile; then
13452 $rm -f tryp.out
13453 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13454 if cmp tryp.c tryp.out >/dev/null 2>&1; then
13455 $cat >&4 <<EOM
13456fflush(NULL) seems to behave okay with input streams.
13457EOM
13458 fflushNULL="$define"
13459 else
13460 $cat >&4 <<EOM
13461Ouch, fflush(NULL) clobbers input pipes! We will not use it.
13462EOM
13463 fflushNULL="$undef"
13464 fi
13465 fi
13466 $rm -f core tryp.c tryp.core core.tryp.*
13467 ;;
13468 '') $cat >&4 <<EOM
13469Your fflush(NULL) isn't working (contrary to ANSI C).
13470EOM
13471 fflushNULL="$undef"
13472 ;;
13473 *) $cat >&4 <<EOM
13474Cannot figure out whether your fflush(NULL) works or not.
13475I'm assuming it doesn't (contrary to ANSI C).
13476EOM
13477 fflushNULL="$undef"
13478 ;;
13479 esac
13480 ;;
13481$define|true|[yY]*)
13482 fflushNULL="$define"
13483 ;;
13484*)
13485 fflushNULL="$undef"
13486 ;;
13487esac
13488: check explicit looping only if NULL did not work, and if the pipe
13489: bug does not show up on an explicit flush too
13490case "$fflushNULL" in
13491"$undef")
13492 $cat >tryp.c <<EOCP
13493#include <stdio.h>
13494int
13495main(int argc, char **argv)
13496{
13497 char buf[1024];
13498 int i;
13499 char *bp = buf;
13500 while (1) {
13501 while ((i = getc(stdin)) != -1
13502 && (*bp++ = i) != '\n'
13503 && bp < &buf[1024])
13504 /* DO NOTHING */ ;
13505 *bp = '\0';
13506 fprintf(stdout, "%s", buf);
13507 fflush(stdin);
13508 if (i == -1)
13509 return 0;
13510 bp = buf;
13511 }
13512}
13513EOCP
13514 set tryp
13515 if eval $compile; then
13516 $rm -f tryp.out
13517 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13518 if cmp tryp.c tryp.out >/dev/null 2>&1; then
13519 $cat >&4 <<EOM
13520Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13521EOM
13522 : now check for fflushall behaviour
13523 case "$fflushall" in
13524 '') set try -DTRY_FFLUSH_ALL $output
13525 if eval $compile; then
13526 $cat >&4 <<EOM
13527(Now testing the other method--but note that this also may fail.)
13528EOM
13529 $rm -f try.out
13530 ./try$exe_ext 2>/dev/null
13531 if $test -s try.out -a "X$?" = X42; then
13532 fflushall="`$cat try.out`"
13533 fi
13534 fi
13535 $rm -f core try.core core.try.*
13536 case "$fflushall" in
13537 x) $cat >&4 <<EOM
13538Whew. Flushing explicitly all the stdio streams works.
13539EOM
13540 fflushall="$define"
13541 ;;
13542 '') $cat >&4 <<EOM
13543Sigh. Flushing explicitly all the stdio streams doesn't work.
13544EOM
13545 fflushall="$undef"
13546 ;;
13547 *) $cat >&4 <<EOM
13548Cannot figure out whether flushing stdio streams explicitly works or not.
13549I'm assuming it doesn't.
13550EOM
13551 fflushall="$undef"
13552 ;;
13553 esac
13554 ;;
13555 "$define"|true|[yY]*)
13556 fflushall="$define"
13557 ;;
13558 *)
13559 fflushall="$undef"
13560 ;;
13561 esac
13562 else
13563 $cat >&4 <<EOM
13564All is futile. Even fflush(stdin) clobbers input pipes!
13565EOM
13566 fflushall="$undef"
13567 fi
13568 else
13569 fflushall="$undef"
13570 fi
13571 $rm -f core tryp.c tryp.core core.tryp.*
13572 ;;
13573*) fflushall="$undef"
13574 ;;
13575esac
13576
13577case "$fflushNULL$fflushall" in
13578undefundef)
13579 $cat <<EOM
13580OK, I give up. I cannot figure out how to flush pending stdio output.
13581We won't be flushing handles at all before fork/exec/popen.
13582EOM
13583 ;;
13584esac
13585$rm -f try.* try$exe_ext
13586
13587: Store the full pathname to the ar program for use in the C program
13588: Respect a hint or command line value for full_ar.
13589case "$full_ar" in
13590'') full_ar=$ar ;;
13591esac
13592
13593: Store the full pathname to the sed program for use in the C program
13594full_sed=$sed
13595
13596: see what type gids are declared as in the kernel
13597echo " "
13598echo "Looking for the type for group ids returned by getgid()."
13599set gid_t gidtype xxx stdio.h sys/types.h
13600eval $typedef
13601case "$gidtype" in
13602xxx)
13603 xxx=`./findhdr sys/user.h`
13604 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13605 case $1 in
13606 unsigned) dflt="$1 $2" ;;
13607 *) dflt="$1" ;;
13608 esac
13609 ;;
13610*) dflt="$gidtype";;
13611esac
13612case "$gidtype" in
13613gid_t) echo "gid_t found." ;;
13614*) rp="What is the type for group ids returned by getgid()?"
13615 . ./myread
13616 gidtype="$ans"
13617 ;;
13618esac
13619
13620echo " "
13621case "$gidtype" in
13622*_t) zzz="$gidtype" ;;
13623*) zzz="gid" ;;
13624esac
13625echo "Checking the size of $zzz..." >&4
13626cat > try.c <<EOCP
13627#include <sys/types.h>
13628#include <stdio.h>
13629int main() {
13630 printf("%d\n", (int)sizeof($gidtype));
13631 exit(0);
13632}
13633EOCP
13634set try
13635if eval $compile_ok; then
13636 yyy=`./try`
13637 case "$yyy" in
13638 '') gidsize=4
13639 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13640 ;;
13641 *) gidsize=$yyy
13642 echo "Your $zzz is $gidsize bytes long."
13643 ;;
13644 esac
13645else
13646 gidsize=4
13647 echo "(I can't compile the test program--guessing $gidsize.)" >&4
13648fi
13649
13650
13651echo " "
13652case "$gidtype" in
13653*_t) zzz="$gidtype" ;;
13654*) zzz="gid" ;;
13655esac
13656echo "Checking the sign of $zzz..." >&4
13657cat > try.c <<EOCP
13658#include <sys/types.h>
13659#include <stdio.h>
13660int main() {
13661 $gidtype foo = -1;
13662 if (foo < 0)
13663 printf("-1\n");
13664 else
13665 printf("1\n");
13666}
13667EOCP
13668set try
13669if eval $compile; then
13670 yyy=`./try`
13671 case "$yyy" in
13672 '') gidsign=1
13673 echo "(I can't execute the test program--guessing unsigned.)" >&4
13674 ;;
13675 *) gidsign=$yyy
13676 case "$gidsign" in
13677 1) echo "Your $zzz is unsigned." ;;
13678 -1) echo "Your $zzz is signed." ;;
13679 esac
13680 ;;
13681 esac
13682else
13683 gidsign=1
13684 echo "(I can't compile the test program--guessing unsigned.)" >&4
13685fi
13686
13687
13688echo " "
13689
13690if $test X"$quadtype" != X; then
13691
13692echo "Checking how to print 64-bit integers..." >&4
13693
13694if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13695 $cat >try.c <<'EOCP'
13696#include <sys/types.h>
13697#include <stdio.h>
13698int main() {
13699 int q = 12345678901;
13700 printf("%ld\n", q);
13701}
13702EOCP
13703 set try
13704 if eval $compile; then
13705 yyy=`./try$exe_ext`
13706 case "$yyy" in
13707 12345678901)
13708 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13709 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13710 echo "We will use %d."
13711 ;;
13712 esac
13713 fi
13714fi
13715
13716if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13717 $cat >try.c <<'EOCP'
13718#include <sys/types.h>
13719#include <stdio.h>
13720int main() {
13721 long q = 12345678901;
13722 printf("%ld\n", q);
13723}
13724EOCP
13725 set try
13726 if eval $compile; then
13727 yyy=`./try$exe_ext`
13728 case "$yyy" in
13729 12345678901)
13730 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13731 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13732 echo "We will use %ld."
13733 ;;
13734 esac
13735 fi
13736fi
13737
13738if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13739 $cat >try.c <<'EOCP'
13740#include <sys/types.h>
13741#include <inttypes.h>
13742#include <stdio.h>
13743int main() {
13744 int64_t q = 12345678901;
13745 printf("%" PRId64 "\n", q);
13746}
13747EOCP
13748 set try
13749 if eval $compile; then
13750 yyy=`./try$exe_ext`
13751 case "$yyy" in
13752 12345678901)
13753 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13754 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13755 echo "We will use the C9X style."
13756 ;;
13757 esac
13758 fi
13759fi
13760
13761if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13762 $cat >try.c <<'EOCP'
13763#include <sys/types.h>
13764#include <stdio.h>
13765int main() {
13766 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13767 printf("%lld\n", q);
13768}
13769EOCP
13770 set try
13771 if eval $compile; then
13772 yyy=`./try$exe_ext`
13773 case "$yyy" in
13774 12345678901)
13775 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13776 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13777 echo "We will use the %lld style."
13778 ;;
13779 esac
13780 fi
13781fi
13782
13783if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13784 $cat >try.c <<EOCP
13785#include <sys/types.h>
13786#include <stdio.h>
13787int main() {
13788 $quadtype q = 12345678901;
13789 printf("%Ld\n", q);
13790}
13791EOCP
13792 set try
13793 if eval $compile; then
13794 yyy=`./try$exe_ext`
13795 case "$yyy" in
13796 12345678901)
13797 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13798 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13799 echo "We will use %Ld."
13800 ;;
13801 esac
13802 fi
13803fi
13804
13805if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13806 $cat >try.c <<EOCP
13807#include <sys/types.h>
13808#include <stdio.h>
13809int main() {
13810 $quadtype q = 12345678901;
13811 printf("%qd\n", q);
13812}
13813EOCP
13814 set try
13815 if eval $compile; then
13816 yyy=`./try$exe_ext`
13817 case "$yyy" in
13818 12345678901)
13819 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13820 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13821 echo "We will use %qd."
13822 ;;
13823 esac
13824 fi
13825fi
13826
13827if $test X"$sPRId64" = X; then
13828 echo "Cannot figure out how to print 64-bit integers." >&4
13829fi
13830
13831$rm -f try try.*
13832
13833fi
13834
13835case "$sPRId64" in
13836'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
13837 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
13838 ;;
13839*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
13840 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
13841 ;;
13842esac
13843
13844
13845echo " "
13846$echo "Checking the format strings to be used for Perl's internal types..." >&4
13847
13848if $test X"$ivsize" = X8; then
13849 ivdformat="$sPRId64"
13850 uvuformat="$sPRIu64"
13851 uvoformat="$sPRIo64"
13852 uvxformat="$sPRIx64"
13853 uvXUformat="$sPRIXU64"
13854else
13855 if $test X"$ivsize" = X"$longsize"; then
13856 ivdformat='"ld"'
13857 uvuformat='"lu"'
13858 uvoformat='"lo"'
13859 uvxformat='"lx"'
13860 uvXUformat='"lX"'
13861 else
13862 if $test X"$ivsize" = X"$intsize"; then
13863 ivdformat='"d"'
13864 uvuformat='"u"'
13865 uvoformat='"o"'
13866 uvxformat='"x"'
13867 uvXUformat='"X"'
13868 else
13869 : far out
13870 if $test X"$ivsize" = X"$shortsize"; then
13871 ivdformat='"hd"'
13872 uvuformat='"hu"'
13873 uvoformat='"ho"'
13874 uvxformat='"hx"'
13875 uvXUformat='"hX"'
13876 fi
13877 fi
13878 fi
13879fi
13880
13881if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13882 nveformat="$sPRIeldbl"
13883 nvfformat="$sPRIfldbl"
13884 nvgformat="$sPRIgldbl"
13885 nvEUformat="$sPRIEUldbl"
13886 nvFUformat="$sPRIFUldbl"
13887 nvGUformat="$sPRIGUldbl"
13888else
13889 nveformat='"e"'
13890 nvfformat='"f"'
13891 nvgformat='"g"'
13892 nvEUformat='"E"'
13893 nvFUformat='"F"'
13894 nvGUformat='"G"'
13895fi
13896
13897case "$ivdformat" in
13898'') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13899 exit 1
13900 ;;
13901esac
13902
13903
13904echo " "
13905$echo "Checking the format string to be used for gids..." >&4
13906
13907case "$gidsign" in
13908-1) if $test X"$gidsize" = X"$ivsize"; then
13909 gidformat="$ivdformat"
13910 else
13911 if $test X"$gidsize" = X"$longsize"; then
13912 gidformat='"ld"'
13913 else
13914 if $test X"$gidsize" = X"$intsize"; then
13915 gidformat='"d"'
13916 else
13917 if $test X"$gidsize" = X"$shortsize"; then
13918 gidformat='"hd"'
13919 fi
13920 fi
13921 fi
13922 fi
13923 ;;
13924*) if $test X"$gidsize" = X"$uvsize"; then
13925 gidformat="$uvuformat"
13926 else
13927 if $test X"$gidsize" = X"$longsize"; then
13928 gidformat='"lu"'
13929 else
13930 if $test X"$gidsize" = X"$intsize"; then
13931 gidformat='"u"'
13932 else
13933 if $test X"$gidsize" = X"$shortsize"; then
13934 gidformat='"hu"'
13935 fi
13936 fi
13937 fi
13938 fi
13939 ;;
13940esac
13941
13942: see if getgroups exists
13943set getgroups d_getgrps
13944eval $inlibc
13945
13946: see if setgroups exists
13947set setgroups d_setgrps
13948eval $inlibc
13949
13950
13951: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13952echo " "
13953case "$d_getgrps$d_setgrps" in
13954*define*)
13955 case "$groupstype" in
13956 '') dflt="$gidtype" ;;
13957 *) dflt="$groupstype" ;;
13958 esac
13959 $cat <<EOM
13960What type of pointer is the second argument to getgroups() and setgroups()?
13961Usually this is the same as group ids, $gidtype, but not always.
13962
13963EOM
13964 rp='What type pointer is the second argument to getgroups() and setgroups()?'
13965 . ./myread
13966 groupstype="$ans"
13967 ;;
13968*) groupstype="$gidtype";;
13969esac
13970
13971echo " "
13972echo "Checking if your $make program sets \$(MAKE)..." >&4
13973case "$make_set_make" in
13974'')
13975 $sed 's/^X //' > testmake.mak << 'EOF'
13976Xall:
13977X @echo 'maketemp="$(MAKE)"'
13978EOF
13979 case "`$make -f testmake.mak 2>/dev/null`" in
13980 *maketemp=*) make_set_make='#' ;;
13981 *) make_set_make="MAKE=$make" ;;
13982 esac
13983 $rm -f testmake.mak
13984 ;;
13985esac
13986case "$make_set_make" in
13987'#') echo "Yup, it does.";;
13988*) echo "Nope, it doesn't.";;
13989esac
13990
13991: see what type is used for mode_t
13992rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13993set mode_t modetype int stdio.h sys/types.h
13994eval $typedef_ask
13995
2cc61e15
DD
13996: see if stdarg is available
13997echo " "
13998if $test `./findhdr stdarg.h`; then
13999 echo "<stdarg.h> found." >&4
14000 valstd="$define"
14001else
14002 echo "<stdarg.h> NOT found." >&4
14003 valstd="$undef"
14004fi
14005
14006: see if varags is available
14007echo " "
14008if $test `./findhdr varargs.h`; then
14009 echo "<varargs.h> found." >&4
14010else
14011 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14012fi
14013
14014: set up the varargs testing programs
14015$cat > varargs.c <<EOP
14016#ifdef I_STDARG
14017#include <stdarg.h>
14018#endif
14019#ifdef I_VARARGS
14020#include <varargs.h>
14021#endif
14022
14023#ifdef I_STDARG
14024int f(char *p, ...)
14025#else
14026int f(va_alist)
14027va_dcl
14028#endif
14029{
14030 va_list ap;
14031#ifndef I_STDARG
14032 char *p;
14033#endif
14034#ifdef I_STDARG
14035 va_start(ap,p);
14036#else
14037 va_start(ap);
14038 p = va_arg(ap, char *);
14039#endif
14040 va_end(ap);
14041}
14042EOP
14043$cat > varargs <<EOP
14044$startsh
14045if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14046 echo "true"
14047else
14048 echo "false"
14049fi
14050$rm -f varargs$_o
14051EOP
14052chmod +x varargs
14053
14054: now check which varargs header should be included
14055echo " "
14056i_varhdr=''
14057case "$valstd" in
14058"$define")
14059 if `./varargs I_STDARG`; then
14060 val='stdarg.h'
14061 elif `./varargs I_VARARGS`; then
14062 val='varargs.h'
14063 fi
14064 ;;
14065*)
14066 if `./varargs I_VARARGS`; then
14067 val='varargs.h'
14068 fi
14069 ;;
14070esac
14071case "$val" in
14072'')
14073echo "I could not find the definition for va_dcl... You have problems..." >&4
14074 val="$undef"; set i_stdarg; eval $setvar
14075 val="$undef"; set i_varargs; eval $setvar
14076 ;;
14077*)
14078 set i_varhdr
14079 eval $setvar
14080 case "$i_varhdr" in
14081 stdarg.h)
14082 val="$define"; set i_stdarg; eval $setvar
14083 val="$undef"; set i_varargs; eval $setvar
14084 ;;
14085 varargs.h)
14086 val="$undef"; set i_stdarg; eval $setvar
14087 val="$define"; set i_varargs; eval $setvar
14088 ;;
14089 esac
14090 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14091esac
14092$rm -f varargs*
14093
14094: see if we need va_copy
14095echo " "
14096case "$i_stdarg" in
14097"$define")
14098 $cat >try.c <<EOCP
14099#include <stdarg.h>
14100#include <stdio.h>
85c8a686
DD
14101#$i_stdlib I_STDLIB
14102#ifdef I_STDLIB
14103#include <stdlib.h>
14104#endif
14105#include <signal.h>
2cc61e15
DD
14106
14107int
14108ivfprintf(FILE *f, const char *fmt, va_list *valp)
14109{
14110 return vfprintf(f, fmt, *valp);
14111}
14112
14113int
14114myvfprintf(FILE *f, const char *fmt, va_list val)
14115{
14116 return ivfprintf(f, fmt, &val);
14117}
14118
14119int
14120myprintf(char *fmt, ...)
14121{
14122 va_list val;
14123 va_start(val, fmt);
14124 return myvfprintf(stdout, fmt, val);
14125}
14126
14127int
14128main(int ac, char **av)
14129{
85c8a686
DD
14130 signal(SIGSEGV, exit);
14131
2cc61e15
DD
14132 myprintf("%s%cs all right, then\n", "that", '\'');
14133 exit(0);
14134}
14135EOCP
14136 set try
d50de4df 14137 if eval $compile && ./try 2>&1 >/dev/null; then
2cc61e15
DD
14138 case "`./try`" in
14139 "that's all right, then")
14140 okay=yes
14141 ;;
14142 esac
14143 fi
14144 case "$okay" in
14145 yes) echo "It seems that you don't need va_copy()." >&4
14146 need_va_copy="$undef"
14147 ;;
14148 *) echo "It seems that va_copy() or similar will be needed." >&4
14149 need_va_copy="$define"
14150 ;;
14151 esac
14152 $rm -f try.* core core.* *.core *.core.*
14153 ;;
14154*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14155 ;;
14156esac
14157
b4eb6b3d
JH
14158: define a fucntion to check prototypes
14159$cat > protochk <<EOSH
14160$startsh
14161cc="$cc"
14162optimize="$optimize"
14163ccflags="$ccflags"
14164prototype="$prototype"
14165define="$define"
14166rm=$rm
14167EOSH
14168
14169$cat >> protochk <<'EOSH'
14170
14171$rm -f try.c
14172foo="$1"
14173shift
14174while test $# -ge 2; do
14175 case "$1" in
14176 $define) echo "#include <$2>" >> try.c ;;
14177 literal) echo "$2" >> try.c ;;
14178 esac
14179 shift 2
14180done
14181test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
14182cat >> try.c <<'EOCP'
14183#ifdef CAN_PROTOTYPE
14184#define _(args) args
14185#else
14186#define _(args) ()
14187#endif
14188EOCP
14189echo "$foo" >> try.c
14190echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14191$cc $optimize $ccflags -c try.c > /dev/null 2>&1
14192status=$?
14193$rm -f try.[co]
14194exit $status
14195EOSH
14196chmod +x protochk
14197$eunicefix protochk
14198
14199: see what type is used for size_t
14200rp="What is the type used for the length parameter for string functions?"
14201set size_t sizetype 'unsigned int' stdio.h sys/types.h
14202eval $typedef_ask
14203
14204: check for type of arguments to gethostbyaddr.
14205if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14206 case "$d_gethbyaddr" in
14207 $define)
14208 $cat <<EOM
14209
14210Checking to see what type of arguments are accepted by gethostbyaddr().
14211EOM
14212 hdrs="$define sys/types.h
14213 $d_socket sys/socket.h
14214 $i_niin netinet/in.h
14215 $i_netdb netdb.h
14216 $i_unistd unistd.h"
14217 : The first arg can 'char *' or 'void *'
14218 : The second arg is some of integral type
14219 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14220 for yyy in size_t long int; do
14221 case "$netdb_host_type" in
14222 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14223 if ./protochk "$try" $hdrs; then
14224 echo "Your system accepts $xxx for the first arg."
14225 echo "...and $yyy for the second arg."
14226 netdb_host_type="$xxx"
14227 netdb_hlen_type="$yyy"
14228 fi
14229 ;;
14230 esac
14231 done
14232 done
14233 : In case none of those worked, prompt the user.
14234 case "$netdb_host_type" in
14235 '') rp='What is the type for the 1st argument to gethostbyaddr?'
14236 dflt='char *'
14237 . ./myread
14238 netdb_host_type=$ans
14239 rp='What is the type for the 2nd argument to gethostbyaddr?'
14240 dflt="$sizetype"
14241 . ./myread
14242 netdb_hlen_type=$ans
14243 ;;
14244 esac
14245 ;;
14246 *) : no gethostbyaddr, so pick harmless defaults
14247 netdb_host_type='char *'
14248 netdb_hlen_type="$sizetype"
14249 ;;
14250 esac
14251 # Remove the "const" if needed. -- but then we'll have a
14252 # prototype clash!
14253 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14254fi
14255
14256: check for type of argument to gethostbyname.
14257if test "X$netdb_name_type" = X ; then
14258 case "$d_gethbyname" in
14259 $define)
14260 $cat <<EOM
14261
14262Checking to see what type of argument is accepted by gethostbyname().
14263EOM
14264 hdrs="$define sys/types.h
14265 $d_socket sys/socket.h
14266 $i_niin netinet/in.h
14267 $i_netdb netdb.h
14268 $i_unistd unistd.h"
14269 for xxx in "const char *" "char *"; do
14270 case "$netdb_name_type" in
14271 '') try="extern struct hostent *gethostbyname($xxx);"
14272 if ./protochk "$try" $hdrs; then
14273 echo "Your system accepts $xxx."
14274 netdb_name_type="$xxx"
14275 fi
14276 ;;
14277 esac
14278 done
14279 : In case none of those worked, prompt the user.
14280 case "$netdb_name_type" in
14281 '') rp='What is the type for the 1st argument to gethostbyname?'
14282 dflt='char *'
14283 . ./myread
14284 netdb_name_type=$ans
14285 ;;
14286 esac
14287 ;;
14288 *) : no gethostbyname, so pick harmless default
14289 netdb_name_type='char *'
14290 ;;
14291 esac
14292fi
14293
14294: check for type of 1st argument to getnetbyaddr.
14295if test "X$netdb_net_type" = X ; then
14296 case "$d_getnbyaddr" in
14297 $define)
14298 $cat <<EOM
14299
14300Checking to see what type of 1st argument is accepted by getnetbyaddr().
14301EOM
14302 hdrs="$define sys/types.h
14303 $d_socket sys/socket.h
14304 $i_niin netinet/in.h
14305 $i_netdb netdb.h
14306 $i_unistd unistd.h"
14307 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14308 case "$netdb_net_type" in
14309 '') try="extern struct netent *getnetbyaddr($xxx, int);"
14310 if ./protochk "$try" $hdrs; then
14311 echo "Your system accepts $xxx."
14312 netdb_net_type="$xxx"
14313 fi
14314 ;;
14315 esac
14316 done
14317 : In case none of those worked, prompt the user.
14318 case "$netdb_net_type" in
14319 '') rp='What is the type for the 1st argument to getnetbyaddr?'
14320 dflt='long'
14321 . ./myread
14322 netdb_net_type=$ans
14323 ;;
14324 esac
14325 ;;
14326 *) : no getnetbyaddr, so pick harmless default
14327 netdb_net_type='long'
14328 ;;
14329 esac
14330fi
14331: locate the preferred pager for this system
14332case "$pager" in
14333'')
14334 dflt=''
14335 case "$pg" in
14336 /*) dflt=$pg;;
14337 [a-zA-Z]:/*) dflt=$pg;;
14338 esac
14339 case "$more" in
14340 /*) dflt=$more;;
14341 [a-zA-Z]:/*) dflt=$more;;
14342 esac
14343 case "$less" in
14344 /*) dflt=$less;;
14345 [a-zA-Z]:/*) dflt=$less;;
14346 esac
14347 case "$dflt" in
14348 '') dflt=/usr/ucb/more;;
14349 esac
14350 ;;
14351*) dflt="$pager";;
14352esac
14353echo " "
14354fn=f/
14355rp='What pager is used on your system?'
14356. ./getfile
14357pager="$ans"
14358
14359: see what type pids are declared as in the kernel
14360rp="What is the type of process ids on this system?"
14361set pid_t pidtype int stdio.h sys/types.h
14362eval $typedef_ask
14363
14364: Find earliest binary compatible site_perl subdirectory perl can use.
14365case "$bincompat5005" in
14366"$define") xs_apiversion='5.005' ;;
14367*) xs_apiversion=$version ;; # The current site_perl version.
14368esac
14369: Find earliest pure perl site_perl subdirectory perl can use.
14370: The versioned directories started at 5.005.
14371pm_apiversion='5.005'
14372
b4eb6b3d
JH
14373: see if ar generates random libraries by itself
14374echo " "
14375echo "Checking how to generate random libraries on your machine..." >&4
14376echo 'int bar1() { return bar2(); }' > bar1.c
14377echo 'int bar2() { return 2; }' > bar2.c
14378$cat > foo.c <<'EOP'
14379int main() { printf("%d\n", bar1()); exit(0); }
14380EOP
14381$cc $ccflags -c bar1.c >/dev/null 2>&1
14382$cc $ccflags -c bar2.c >/dev/null 2>&1
14383$cc $ccflags -c foo.c >/dev/null 2>&1
14384$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 14385if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
b4eb6b3d
JH
14386 ./foobar >/dev/null 2>&1; then
14387 echo "$ar appears to generate random libraries itself."
14388 orderlib=false
14389 ranlib=":"
14390elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 14391 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
b4eb6b3d
JH
14392 ./foobar >/dev/null 2>&1; then
14393 echo "a table of contents needs to be added with '$ar ts'."
14394 orderlib=false
14395 ranlib="$ar ts"
14396else
14397 case "$ranlib" in
14398 :) ranlib='';;
14399 '')
14400 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14401 $test -f $ranlib || ranlib=''
14402 ;;
14403 esac
14404 if $test -n "$ranlib"; then
14405 echo "your system has '$ranlib'; we'll use that."
14406 orderlib=false
14407 else
14408 echo "your system doesn't seem to support random libraries"
14409 echo "so we'll use lorder and tsort to order the libraries."
14410 orderlib=true
14411 ranlib=":"
14412 fi
14413fi
14414$rm -f foo* bar*
14415
14416: check for type of arguments to select.
14417case "$selecttype" in
14418'') case "$d_select" in
14419 $define)
14420 echo " "
14421 $cat <<EOM
14422Checking to see what type of arguments are accepted by select().
14423EOM
14424 hdrs="$define sys/types.h
14425 $i_systime sys/time.h
14426 $i_sysselct sys/select.h
14427 $d_socket sys/socket.h"
14428 : The first arg can be int, unsigned, or size_t
14429 : The last arg may or may not be 'const'
14430 val=''
14431 : void pointer has been seen but using that
14432 : breaks the selectminbits test
14433 for xxx in 'fd_set *' 'int *'; do
14434 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14435 for tmo in 'struct timeval *' 'const struct timeval *'; do
14436 case "$val" in
14437 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14438 if ./protochk "$try" $hdrs; then
14439 echo "Your system accepts $xxx."
14440 val="$xxx"
14441 fi
14442 ;;
14443 esac
14444 done
14445 done
14446 done
14447 case "$val" in
14448 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14449 case "$d_fd_set" in
14450 $define) dflt="fd_set *" ;;
14451 *) dflt="int *" ;;
14452 esac
14453 . ./myread
14454 val=$ans
14455 ;;
14456 esac
14457 selecttype="$val"
14458 ;;
14459 *) : no select, so pick a harmless default
14460 selecttype='int *'
14461 ;;
14462 esac
14463 ;;
14464esac
14465
14466: check for the select 'width'
14467case "$selectminbits" in
14468'') case "$d_select" in
14469 $define)
14470 $cat <<EOM
14471
14472Checking to see on how many bits at a time your select() operates...
14473EOM
14474 $cat >try.c <<EOCP
14475#include <sys/types.h>
14476#$i_time I_TIME
14477#$i_systime I_SYS_TIME
14478#$i_systimek I_SYS_TIME_KERNEL
14479#ifdef I_TIME
14480# include <time.h>
14481#endif
14482#ifdef I_SYS_TIME
14483# ifdef I_SYS_TIME_KERNEL
14484# define KERNEL
14485# endif
14486# include <sys/time.h>
14487# ifdef I_SYS_TIME_KERNEL
14488# undef KERNEL
14489# endif
14490#endif
14491#$i_sysselct I_SYS_SELECT
14492#ifdef I_SYS_SELECT
14493#include <sys/select.h>
14494#endif
14495#$d_socket HAS_SOCKET
14496#ifdef HAS_SOCKET
14497# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14498#endif
14499#include <stdio.h>
14500$selecttype b;
14501#define S sizeof(*(b))
14502#define MINBITS 64
14503#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14504#define NBITS (NBYTES * 8)
14505int main() {
14506 char s[NBYTES];
14507 struct timeval t;
14508 int i;
14509 FILE* fp;
14510 int fd;
14511
14512 fclose(stdin);
14513 fp = fopen("try.c", "r");
14514 if (fp == 0)
14515 exit(1);
14516 fd = fileno(fp);
14517 if (fd < 0)
14518 exit(2);
14519 b = ($selecttype)s;
14520 for (i = 0; i < NBITS; i++)
14521 FD_SET(i, b);
14522 t.tv_sec = 0;
14523 t.tv_usec = 0;
14524 select(fd + 1, b, 0, 0, &t);
14525 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14526 printf("%d\n", i + 1);
14527 return 0;
14528}
14529EOCP
14530 set try
14531 if eval $compile_ok; then
14532 selectminbits=`./try`
14533 case "$selectminbits" in
14534 '') cat >&4 <<EOM
14535Cannot figure out on how many bits at a time your select() operates.
14536I'll play safe and guess it is 32 bits.
14537EOM
14538 selectminbits=32
14539 bits="32 bits"
14540 ;;
14541 1) bits="1 bit" ;;
14542 *) bits="$selectminbits bits" ;;
14543 esac
14544 echo "Your select() operates on $bits at a time." >&4
14545 else
14546 rp='What is the minimum number of bits your select() operates on?'
14547 case "$byteorder" in
14548 1234|12345678) dflt=32 ;;
14549 *) dflt=1 ;;
14550 esac
14551 . ./myread
14552 val=$ans
14553 selectminbits="$val"
14554 fi
14555 $rm -f try.* try
14556 ;;
14557 *) : no select, so pick a harmless default
14558 selectminbits='32'
14559 ;;
14560 esac
14561 ;;
14562esac
14563
14564: Trace out the files included by signal.h, then look for SIGxxx names.
14565: Remove SIGARRAYSIZE used by HPUX.
14566: Remove SIGSTKSIZE used by Linux.
14567: Remove SIGSTKSZ used by Posix.
14568: Remove SIGTYP void lines used by OS2.
14569: Some cpps, like os390, dont give the file name anywhere
14570if [ "X$fieldn" = X ]; then
14571 : Just make some guesses. We check them later.
14572 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14573else
14574 xxx=`echo '#include <signal.h>' |
14575 $cppstdin $cppminus $cppflags 2>/dev/null |
14576 $grep '^[ ]*#.*include' |
14577 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
14578fi
14579: Check this list of files to be sure we have parsed the cpp output ok.
14580: This will also avoid potentially non-existent files, such
14581: as ../foo/bar.h
14582xxxfiles=''
14583for xx in $xxx /dev/null ; do
14584 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14585done
14586: If we have found no files, at least try signal.h
14587case "$xxxfiles" in
14588'') xxxfiles=`./findhdr signal.h` ;;
14589esac
14590xxx=`awk '
14591$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14592 print substr($2, 4, 20)
14593}
14594$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14595 print substr($3, 4, 20)
14596}' $xxxfiles`
14597: Append some common names just in case the awk scan failed.
14598xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14599xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14600xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14601xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14602xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14603
14604: generate a few handy files for later
14605$cat > signal.c <<'EOCP'
14606#include <sys/types.h>
14607#include <signal.h>
14608#include <stdio.h>
14609int main() {
14610
14611/* Strange style to avoid deeply-nested #if/#else/#endif */
14612#ifndef NSIG
14613# ifdef _NSIG
14614# define NSIG (_NSIG)
14615# endif
14616#endif
14617
14618#ifndef NSIG
14619# ifdef SIGMAX
14620# define NSIG (SIGMAX+1)
14621# endif
14622#endif
14623
14624#ifndef NSIG
14625# ifdef SIG_MAX
14626# define NSIG (SIG_MAX+1)
14627# endif
14628#endif
14629
14630#ifndef NSIG
14631# ifdef MAXSIG
14632# define NSIG (MAXSIG+1)
14633# endif
14634#endif
14635
14636#ifndef NSIG
14637# ifdef MAX_SIG
14638# define NSIG (MAX_SIG+1)
14639# endif
14640#endif
14641
14642#ifndef NSIG
14643# ifdef SIGARRAYSIZE
14644# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14645# endif
14646#endif
14647
14648#ifndef NSIG
14649# ifdef _sys_nsig
14650# define NSIG (_sys_nsig) /* Solaris 2.5 */
14651# endif
14652#endif
14653
14654/* Default to some arbitrary number that's big enough to get most
14655 of the common signals.
14656*/
14657#ifndef NSIG
14658# define NSIG 50
14659#endif
14660
14661printf("NSIG %d\n", NSIG);
14662
14663#ifndef JUST_NSIG
14664
14665EOCP
14666
14667echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14668{
14669 printf "#ifdef SIG"; printf $1; printf "\n"
14670 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14671 printf $1; printf ");\n"
14672 printf "#endif\n"
14673}
14674END {
14675 printf "#endif /* JUST_NSIG */\n";
14676 printf "exit(0);\n}\n";
14677}
14678' >>signal.c
14679$cat >signal.awk <<'EOP'
14680BEGIN { ndups = 0 }
14681$1 ~ /^NSIG$/ { nsig = $2 }
14682($1 !~ /^NSIG$/) && (NF == 2) {
14683 if ($2 > maxsig) { maxsig = $2 }
14684 if (sig_name[$2]) {
14685 dup_name[ndups] = $1
14686 dup_num[ndups] = $2
14687 ndups++
14688 }
14689 else {
14690 sig_name[$2] = $1
14691 sig_num[$2] = $2
14692 }
14693}
14694END {
14695 if (nsig == 0) {
14696 nsig = maxsig + 1
14697 }
14698 printf("NSIG %d\n", nsig);
14699 for (n = 1; n < nsig; n++) {
14700 if (sig_name[n]) {
14701 printf("%s %d\n", sig_name[n], sig_num[n])
14702 }
14703 else {
14704 printf("NUM%d %d\n", n, n)
14705 }
14706 }
14707 for (n = 0; n < ndups; n++) {
14708 printf("%s %d\n", dup_name[n], dup_num[n])
14709 }
14710}
14711EOP
14712$cat >signal_cmd <<EOS
14713$startsh
14714if $test -s signal.lst; then
14715 echo "Using your existing signal.lst file"
14716 exit 0
14717fi
14718xxx="$xxx"
14719EOS
14720$cat >>signal_cmd <<'EOS'
14721
14722set signal
14723if eval $compile_ok; then
14724 ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14725else
14726 echo "(I can't seem be able to compile the whole test program)" >&4
14727 echo "(I'll try it in little pieces.)" >&4
14728 set signal -DJUST_NSIG
14729 if eval $compile_ok; then
14730 ./signal$_exe > signal.nsg
14731 $cat signal.nsg
14732 else
14733 echo "I can't seem to figure out how many signals you have." >&4
14734 echo "Guessing 50." >&4
14735 echo 'NSIG 50' > signal.nsg
14736 fi
14737 : Now look at all the signal names, one at a time.
14738 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14739 $cat > signal.c <<EOCP
14740#include <sys/types.h>
14741#include <signal.h>
14742#include <stdio.h>
14743int main() {
14744printf("$xx %d\n", SIG${xx});
14745return 0;
14746}
14747EOCP
14748 set signal
14749 if eval $compile; then
14750 echo "SIG${xx} found."
14751 ./signal$_exe >> signal.ls1
14752 else
14753 echo "SIG${xx} NOT found."
14754 fi
14755 done
14756 if $test -s signal.ls1; then
14757 $cat signal.nsg signal.ls1 |
14758 $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14759 fi
14760
14761fi
14762if $test -s signal.lst; then
14763 :
14764else
14765 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14766 echo 'kill -l' >signal
14767 set X `csh -f <signal`
14768 $rm -f signal
14769 shift
14770 case $# in
14771 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14772 esac
14773 echo $@ | $tr ' ' $trnl | \
14774 $awk '{ printf "%s %d\n", $1, ++s; }
14775 END { printf "NSIG %d\n", ++s }' >signal.lst
14776fi
14777$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14778EOS
14779chmod a+x signal_cmd
14780$eunicefix signal_cmd
14781
14782: generate list of signal names
14783echo " "
14784case "$sig_name_init" in
14785'') doinit=yes ;;
14786*) case "$sig_num_init" in
14787 ''|*,*) doinit=yes ;;
14788 esac ;;
14789esac
14790case "$doinit" in
14791yes)
14792 echo "Generating a list of signal names and numbers..." >&4
14793 . ./signal_cmd
14794 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14795 sig_name=`$awk 'BEGIN { printf "ZERO " }
14796 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14797 sig_num=`$awk 'BEGIN { printf "0 " }
14798 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14799 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
14800 !/^NSIG/ { printf "\"%s\", ", $1 }
14801 END { printf "0\n" }' signal.lst`
14802 sig_num_init=`$awk 'BEGIN { printf "0, " }
14803 !/^NSIG/ { printf "%d, ", $2}
14804 END { printf "0\n"}' signal.lst`
14805 ;;
14806esac
14807echo "The following $sig_count signals are available:"
14808echo " "
14809echo $sig_name | $awk \
14810'BEGIN { linelen = 0 }
14811{
14812 for (i = 1; i <= NF; i++) {
14813 name = "SIG" $i " "
14814 linelen = linelen + length(name)
14815 if (linelen > 70) {
14816 printf "\n"
14817 linelen = length(name)
14818 }
14819 printf "%s", name
14820 }
14821 printf "\n"
14822}'
76d3c696 14823sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
14824$rm -f signal signal.c signal.awk signal.lst signal_cmd
14825
14826echo " "
14827case "$sizetype" in
14828*_t) zzz="$sizetype" ;;
14829*) zzz="filesize" ;;
14830esac
14831echo "Checking the size of $zzz..." >&4
14832cat > try.c <<EOCP
14833#include <sys/types.h>
14834#include <stdio.h>
14835int main() {
14836 printf("%d\n", (int)sizeof($sizetype));
14837 exit(0);
14838}
14839EOCP
14840set try
14841if eval $compile_ok; then
14842 yyy=`./try`
14843 case "$yyy" in
14844 '') sizesize=4
14845 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14846 ;;
14847 *) sizesize=$yyy
14848 echo "Your $zzz size is $sizesize bytes."
14849 ;;
14850 esac
14851else
14852 sizesize=4
14853 echo "(I can't compile the test program--guessing $sizesize.)" >&4
14854fi
14855
14856
14857: check for socklen_t
14858echo " "
14859echo "Checking to see if you have socklen_t..." >&4
14860$cat >try.c <<EOCP
14861#include <sys/types.h>
14862#$d_socket HAS_SOCKET
14863#ifdef HAS_SOCKET
14864#include <sys/socket.h>
14865#endif
14866int main() { socklen_t x = 16; }
14867EOCP
14868set try
14869if eval $compile; then
14870 val="$define"
14871 echo "You have socklen_t."
14872else
14873 val="$undef"
14874 echo "You do not have socklen_t."
14875 case "$sizetype" in
14876 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14877 esac
14878fi
14879$rm -f try try.*
14880set d_socklen_t
14881eval $setvar
14882
a7710f8d
JH
14883: see if this is a socks.h system
14884set socks.h i_socks
14885eval $inhdr
14886
b4eb6b3d
JH
14887: check for type of the size argument to socket calls
14888case "$d_socket" in
14889"$define")
14890 $cat <<EOM
14891
14892Checking to see what type is the last argument of accept().
14893EOM
b4eb6b3d
JH
14894 yyy=''
14895 case "$d_socklen_t" in
14896 "$define") yyy="$yyy socklen_t"
14897 esac
14898 yyy="$yyy $sizetype int long unsigned"
14899 for xxx in $yyy; do
14900 case "$socksizetype" in
14901 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
14902 case "$usesocks" in
14903 "$define")
14904 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14905 echo "Your system accepts '$xxx *' for the last argument of accept()."
14906 socksizetype="$xxx"
14907 fi
14908 ;;
14909 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
14910 echo "Your system accepts '$xxx *' for the last argument of accept()."
14911 socksizetype="$xxx"
14912 fi
14913 ;;
14914 esac
b4eb6b3d
JH
14915 ;;
14916 esac
14917 done
14918: In case none of those worked, prompt the user.
14919 case "$socksizetype" in
14920 '') rp='What is the type for socket address structure sizes?'
14921 dflt='int'
14922 . ./myread
14923 socksizetype=$ans
14924 ;;
14925 esac
14926 ;;
14927*) : no sockets, so pick relatively harmless default
14928 socksizetype='int'
14929 ;;
14930esac
14931
14932: see what type is used for signed size_t
14933set ssize_t ssizetype int stdio.h sys/types.h
14934eval $typedef
14935dflt="$ssizetype"
14936$cat > ssize.c <<EOM
14937#include <stdio.h>
14938#include <sys/types.h>
14939#define Size_t $sizetype
14940#define SSize_t $dflt
14941int main()
14942{
14943 if (sizeof(Size_t) == sizeof(SSize_t))
14944 printf("$dflt\n");
14945 else if (sizeof(Size_t) == sizeof(int))
14946 printf("int\n");
14947 else
14948 printf("long\n");
14949 exit(0);
14950}
14951EOM
14952echo " "
14953set ssize
14954if eval $compile_ok && ./ssize > /dev/null; then
14955 ssizetype=`./ssize`
14956 echo "I'll be using $ssizetype for functions returning a byte count." >&4
14957else
14958 $cat >&4 <<EOM
14959Help! I can't compile and run the ssize_t test program: please enlighten me!
14960(This is probably a misconfiguration in your system or libraries, and
14961you really ought to fix it. Still, I'll try anyway.)
14962
14963I need a type that is the same size as $sizetype, but is guaranteed to
14964be signed. Common values are ssize_t, int and long.
14965
14966EOM
14967 rp="What signed type is the same size as $sizetype?"
14968 . ./myread
14969 ssizetype="$ans"
14970fi
14971$rm -f ssize ssize.*
14972
14973: see what type of char stdio uses.
14974echo " "
aa517f50
JH
14975echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
14976if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
14977 echo "Your stdio uses unsigned chars." >&4
14978 stdchar="unsigned char"
14979else
aa517f50
JH
14980 echo "Your stdio uses signed chars." >&4
14981 stdchar="char"
b4eb6b3d 14982fi
aa517f50
JH
14983$rm -f stdioh
14984
14985
b4eb6b3d
JH
14986
14987: see if time exists
14988echo " "
14989if test "X$d_time" = X -o X"$timetype" = X; then
14990 if set time val -f d_time; eval $csym; $val; then
14991 echo 'time() found.' >&4
14992 val="$define"
14993 rp="What is the type returned by time() on this system?"
14994 set time_t timetype long stdio.h sys/types.h
14995 eval $typedef_ask
14996 else
14997 echo 'time() not found, hope that will do.' >&4
14998 val="$undef"
14999 timetype='int';
15000 fi
15001 set d_time
15002 eval $setvar
15003fi
15004
15005: see what type uids are declared as in the kernel
15006echo " "
15007echo "Looking for the type for user ids returned by getuid()."
15008set uid_t uidtype xxx stdio.h sys/types.h
15009eval $typedef
15010case "$uidtype" in
15011xxx)
15012 xxx=`./findhdr sys/user.h`
15013 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15014 case $1 in
15015 unsigned) dflt="$1 $2" ;;
15016 *) dflt="$1" ;;
15017 esac
15018 ;;
15019*) dflt="$uidtype";;
15020esac
15021case "$uidtype" in
15022uid_t) echo "uid_t found." ;;
15023*) rp="What is the type for user ids returned by getuid()?"
15024 . ./myread
15025 uidtype="$ans"
15026 ;;
15027esac
15028
15029echo " "
15030case "$uidtype" in
15031*_t) zzz="$uidtype" ;;
15032*) zzz="uid" ;;
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($uidtype));
15040 exit(0);
15041}
15042EOCP
15043set try
15044if eval $compile_ok; then
15045 yyy=`./try`
15046 case "$yyy" in
15047 '') uidsize=4
15048 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15049 ;;
15050 *) uidsize=$yyy
15051 echo "Your $zzz is $uidsize bytes long."
15052 ;;
15053 esac
15054else
15055 uidsize=4
15056 echo "(I can't compile the test program--guessing $uidsize.)" >&4
15057fi
15058
15059echo " "
15060case "$uidtype" in
15061*_t) zzz="$uidtype" ;;
15062*) zzz="uid" ;;
15063esac
15064echo "Checking the sign of $zzz..." >&4
15065cat > try.c <<EOCP
15066#include <sys/types.h>
15067#include <stdio.h>
15068int main() {
15069 $uidtype foo = -1;
15070 if (foo < 0)
15071 printf("-1\n");
15072 else
15073 printf("1\n");
15074}
15075EOCP
15076set try
15077if eval $compile; then
15078 yyy=`./try`
15079 case "$yyy" in
15080 '') uidsign=1
15081 echo "(I can't execute the test program--guessing unsigned.)" >&4
15082 ;;
15083 *) uidsign=$yyy
15084 case "$uidsign" in
15085 1) echo "Your $zzz is unsigned." ;;
15086 -1) echo "Your $zzz is signed." ;;
15087 esac
15088 ;;
15089 esac
15090else
15091 uidsign=1
15092 echo "(I can't compile the test program--guessing unsigned.)" >&4
15093fi
15094
15095
15096
15097echo " "
15098$echo "Checking the format string to be used for uids..." >&4
15099
15100case "$uidsign" in
15101-1) if $test X"$uidsize" = X"$ivsize"; then
15102 uidformat="$ivdformat"
15103 else
15104 if $test X"$uidsize" = X"$longsize"; then
15105 uidformat='"ld"'
15106 else
15107 if $test X"$uidsize" = X"$intsize"; then
15108 uidformat='"d"'
15109 else
15110 if $test X"$uidsize" = X"$shortsize"; then
15111 uidformat='"hd"'
15112 fi
15113 fi
15114 fi
15115 fi
15116 ;;
15117*) if $test X"$uidsize" = X"$uvsize"; then
15118 uidformat="$uvuformat"
15119 else
15120 if $test X"$uidsize" = X"$longsize"; then
15121 uidformat='"lu"'
15122 else
15123 if $test X"$uidsize" = X"$intsize"; then
15124 uidformat='"u"'
15125 else
15126 if $test X"$uidsize" = X"$shortsize"; then
15127 uidformat='"hu"'
15128 fi
15129 fi
15130 fi
15131 fi
15132 ;;
15133esac
15134
3659ebf1
JH
15135: determine compiler compiler
15136case "$yacc" in
15137'')
15138 dflt=yacc;;
15139*)
15140 dflt="$yacc";;
15141esac
15142echo " "
15143comp='yacc'
15144if $test -f "$byacc"; then
15145 dflt="$byacc"
15146 comp="byacc or $comp"
15147fi
15148if $test -f "$bison"; then
15149 comp="$comp or bison -y"
15150fi
15151rp="Which compiler compiler ($comp) shall I use?"
15152. ./myread
15153yacc="$ans"
15154case "$yacc" in
15155*bis*)
15156 case "$yacc" in
15157 *-y*) ;;
15158 *)
15159 yacc="$yacc -y"
15160 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15161 ;;
15162 esac
15163 ;;
15164esac
15165
b4eb6b3d
JH
15166: see if dbm.h is available
15167: see if dbmclose exists
15168set dbmclose d_dbmclose
15169eval $inlibc
15170
15171case "$d_dbmclose" in
15172$define)
15173 set dbm.h i_dbm
15174 eval $inhdr
15175 case "$i_dbm" in
15176 $define)
15177 val="$undef"
15178 set i_rpcsvcdbm
15179 eval $setvar
15180 ;;
15181 *) set rpcsvc/dbm.h i_rpcsvcdbm
15182 eval $inhdr
15183 ;;
15184 esac
15185 ;;
15186*) echo "We won't be including <dbm.h>"
15187 val="$undef"
15188 set i_dbm
15189 eval $setvar
15190 val="$undef"
15191 set i_rpcsvcdbm
15192 eval $setvar
15193 ;;
15194esac
15195
15196: see if this is a sys/file.h system
15197val=''
15198set sys/file.h val
15199eval $inhdr
15200
15201: do we need to include sys/file.h ?
15202case "$val" in
15203"$define")
15204 echo " "
15205 if $h_sysfile; then
15206 val="$define"
15207 echo "We'll be including <sys/file.h>." >&4
15208 else
15209 val="$undef"
15210 echo "We won't be including <sys/file.h>." >&4
15211 fi
15212 ;;
15213*)
15214 h_sysfile=false
15215 ;;
15216esac
15217set i_sysfile
15218eval $setvar
15219
15220: see if fcntl.h is there
15221val=''
15222set fcntl.h val
15223eval $inhdr
15224
15225: see if we can include fcntl.h
15226case "$val" in
15227"$define")
15228 echo " "
15229 if $h_fcntl; then
15230 val="$define"
15231 echo "We'll be including <fcntl.h>." >&4
15232 else
15233 val="$undef"
15234 if $h_sysfile; then
15235 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15236 else
15237 echo "We won't be including <fcntl.h>." >&4
15238 fi
15239 fi
15240 ;;
15241*)
15242 h_fcntl=false
15243 val="$undef"
15244 ;;
15245esac
15246set i_fcntl
15247eval $setvar
15248
15249: see if this is a iconv.h system
15250set iconv.h i_iconv
15251eval $inhdr
15252
15253: see if this is a ieeefp.h system
15254set ieeefp.h i_ieeefp
15255eval $inhdr
15256
15257: see if this is a libutil.h system
15258set libutil.h i_libutil
15259eval $inhdr
15260
15261: see if locale.h is available
15262set locale.h i_locale
15263eval $inhdr
15264
15265: see if mach cthreads are available
15266if test "X$usethreads" = "X$define"; then
15267 set mach/cthreads.h i_machcthr
15268 eval $inhdr
15269else
15270 i_machcthr="$undef"
15271fi
15272
15273
15274
15275: see if this is a math.h system
15276set math.h i_math
15277eval $inhdr
15278
15279: see if this is a mntent.h system
15280set mntent.h i_mntent
15281eval $inhdr
15282
15283: see if ndbm.h is available
15284set ndbm.h t_ndbm
15285eval $inhdr
15286case "$t_ndbm" in
15287$define)
15288 : see if dbm_open exists
15289 set dbm_open d_dbm_open
15290 eval $inlibc
15291 case "$d_dbm_open" in
15292 $undef)
15293 t_ndbm="$undef"
15294 echo "We won't be including <ndbm.h>"
15295 ;;
15296 esac
15297 ;;
15298esac
15299val="$t_ndbm"
15300set i_ndbm
15301eval $setvar
15302
15303: see if net/errno.h is available
15304val=''
15305set net/errno.h val
15306eval $inhdr
15307
15308: Unfortunately, it causes problems on some systems. Arrgh.
15309case "$val" in
15310$define)
15311 cat > try.c <<'EOM'
15312#include <stdio.h>
15313#include <errno.h>
15314#include <net/errno.h>
15315int func()
15316{
15317 return ENOTSOCK;
15318}
15319EOM
15320 if $cc $ccflags -c try.c >/dev/null 2>&1; then
15321 echo "We'll be including <net/errno.h>." >&4
15322 else
15323 echo "We won't be including <net/errno.h>." >&4
15324 val="$undef"
15325 fi
15326 $rm -f try.* try
15327 ;;
15328esac
15329set i_neterrno
15330eval $setvar
15331
15332: see if netinet/tcp.h is available
15333set netinet/tcp.h i_netinettcp
15334eval $inhdr
15335
15336: see if this is a poll.h system
15337set poll.h i_poll
15338eval $inhdr
15339
15340: see if this is a prot.h system
15341set prot.h i_prot
15342eval $inhdr
15343
15344echo " "
15345$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
15346$cat <<'EOSH' > Cppsym.know
15347a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15348AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
d46c9a2d
JH
15349alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15350ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15351BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
15352BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15353bull c cadmus clipper CMU COFF COMPILER_VERSION
15354concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15355CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15356Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15357FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15358GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15359H3050R H3050RX hbullx20 hcx host_mips
15360hp200 hp300 hp700 HP700 hp800 hp9000
15361hp9000s200 hp9000s300 hp9000s400 hp9000s500
15362hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15363i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 15364IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
15365INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15366LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15367LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15368Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15369LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15370M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15371M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15372M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15373MATH_HAS_NO_SIDE_EFFECTS
15374mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15375mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15376mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15377MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15378mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15379NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 15380news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
15381ns32016 ns32332 ns32k nsc32000
15382OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15383pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15384pc532 pdp11 PGC PIC plexus PORTAR posix
15385POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15386POSIX_C_SOURCE POSIX_SOURCE POWER
15387PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 15388riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
15389SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15390sony sony_news sonyrisc sparc sparclite spectrum
15391stardent stdc STDC_EXT stratos sun sun3 sun386
15392Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15393SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15394SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15395sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 15396TM3200 TM5400 TM5600
b4eb6b3d
JH
15397tower tower32 tower32_200 tower32_600 tower32_700
15398tower32_800 tower32_850 tss
15399u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15400ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15401unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15402Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15403XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15404XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15405z8000
15406EOSH
15407# Maybe put other stuff here too.
15408cat <<EOSH >>Cppsym.know
15409$osname
15410EOSH
15411./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15412./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15413$cat Cppsym.know > Cppsym.c
381aa1ff 15414$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
15415$rm -f Cppsym.a Cppsym.b Cppsym.c
15416cat <<EOSH > Cppsym
15417$startsh
15418if $test \$# -gt 0; then
15419 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15420 if $test -s Cppsym.got; then
15421 $rm -f Cppsym.got
15422 exit 0
15423 fi
15424 $rm -f Cppsym.got
15425 exit 1
15426else
15427 $tr " " "$trnl" | ./Cppsym.try
15428 exit 0
15429fi
15430EOSH
15431chmod +x Cppsym
15432$eunicefix Cppsym
15433cat <<EOSH > Cppsym.try
15434$startsh
15435cat <<'EOCP' > try.c
15436#include <stdio.h>
15437int main() {
15438EOCP
15439$awk \\
15440EOSH
15441cat <<'EOSH' >> Cppsym.try
15442'length($1) > 0 {
15443 printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", %s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15444 printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", _%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15445 printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", __%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15446 printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", __%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15447}' >> try.c
15448echo '}' >> try.c
15449EOSH
15450cat <<EOSH >> Cppsym.try
15451ccflags="$ccflags"
15452case "$osname-$gccversion" in
15453irix-) ccflags="\$ccflags -woff 1178" ;;
15454os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15455esac
7a282f6d 15456$cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
b4eb6b3d
JH
15457EOSH
15458chmod +x Cppsym.try
15459$eunicefix Cppsym.try
15460./Cppsym < Cppsym.know > Cppsym.true
15461: now check the C compiler for additional symbols
15462postprocess_cc_v=''
15463case "$osname" in
15464aix) postprocess_cc_v="|$tr , ' '" ;;
15465esac
15466$cat >ccsym <<EOS
15467$startsh
15468$cat >tmp.c <<EOF
15469extern int foo;
15470EOF
15471for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15472do
15473 case "\$i" in
15474 -D*) echo "\$i" | $sed 's/^-D//';;
15475 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15476 esac
15477done
15478$rm -f try.c
15479EOS
15480postprocess_cc_v=''
15481chmod +x ccsym
15482$eunicefix ccsym
15483./ccsym > ccsym1.raw
15484if $test -s ccsym1.raw; then
15485 $sort ccsym1.raw | $uniq >ccsym.raw
15486else
15487 mv ccsym1.raw ccsym.raw
15488fi
15489
15490$awk '/\=/ { print $0; next }
15491 { print $0"=1" }' ccsym.raw >ccsym.list
15492$awk '/\=/ { print $0; next }
15493 { print $0"=1" }' Cppsym.true >ccsym.true
15494$comm -13 ccsym.true ccsym.list >ccsym.own
15495$comm -12 ccsym.true ccsym.list >ccsym.com
15496$comm -23 ccsym.true ccsym.list >ccsym.cpp
15497also=''
15498if $test -z ccsym.raw; then
15499 echo "Your C compiler doesn't seem to define any symbols!" >&4
15500 echo " "
15501 echo "However, your C preprocessor defines the following symbols:"
15502 $cat Cppsym.true
15503 ccsymbols=''
15504 cppsymbols=`$cat Cppsym.true`
15505 cppsymbols=`echo $cppsymbols`
15506 cppccsymbols="$cppsymbols"
15507else
15508 if $test -s ccsym.com; then
15509 echo "Your C compiler and pre-processor define these symbols:"
15510 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15511 also='also '
15512 symbols='ones'
15513 cppccsymbols=`$cat ccsym.com`
15514 cppccsymbols=`echo $cppccsymbols`
15515 $test "$silent" || sleep 1
15516 fi
15517 if $test -s ccsym.cpp; then
15518 $test "$also" && echo " "
15519 echo "Your C pre-processor ${also}defines the following symbols:"
15520 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15521 also='further '
15522 cppsymbols=`$cat ccsym.cpp`
15523 cppsymbols=`echo $cppsymbols`
15524 $test "$silent" || sleep 1
15525 fi
15526 if $test -s ccsym.own; then
15527 $test "$also" && echo " "
15528 echo "Your C compiler ${also}defines the following cpp symbols:"
15529 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15530 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15531 ccsymbols=`$cat ccsym.own`
15532 ccsymbols=`echo $ccsymbols`
15533 $test "$silent" || sleep 1
15534 fi
15535fi
15536$rm -f ccsym* Cppsym.*
15537
15538: see if this is a termio system
15539val="$undef"
15540val2="$undef"
15541val3="$undef"
15542if $test `./findhdr termios.h`; then
15543 set tcsetattr i_termios
15544 eval $inlibc
15545 val3="$i_termios"
15546fi
15547echo " "
15548case "$val3" in
15549"$define") echo "You have POSIX termios.h... good!" >&4;;
15550*) if ./Cppsym pyr; then
15551 case "`/bin/universe`" in
15552 ucb) if $test `./findhdr sgtty.h`; then
15553 val2="$define"
15554 echo "<sgtty.h> found." >&4
15555 else
15556 echo "System is pyramid with BSD universe."
15557 echo "<sgtty.h> not found--you could have problems." >&4
15558 fi;;
15559 *) if $test `./findhdr termio.h`; then
15560 val="$define"
15561 echo "<termio.h> found." >&4
15562 else
15563 echo "System is pyramid with USG universe."
15564 echo "<termio.h> not found--you could have problems." >&4
15565 fi;;
15566 esac
15567 elif ./usg; then
15568 if $test `./findhdr termio.h`; then
15569 echo "<termio.h> found." >&4
15570 val="$define"
15571 elif $test `./findhdr sgtty.h`; then
15572 echo "<sgtty.h> found." >&4
15573 val2="$define"
15574 else
15575echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15576 fi
15577 else
15578 if $test `./findhdr sgtty.h`; then
15579 echo "<sgtty.h> found." >&4
15580 val2="$define"
15581 elif $test `./findhdr termio.h`; then
15582 echo "<termio.h> found." >&4
15583 val="$define"
15584 else
15585echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15586 fi
15587 fi;;
15588esac
15589set i_termio; eval $setvar
15590val=$val2; set i_sgtty; eval $setvar
15591val=$val3; set i_termios; eval $setvar
15592
15593: see if this is a shadow.h system
15594set shadow.h i_shadow
15595eval $inhdr
15596
b4eb6b3d
JH
15597: see if stddef is available
15598set stddef.h i_stddef
15599eval $inhdr
923fc586 15600
b4eb6b3d
JH
15601: see if this is a sunmath.h system
15602set sunmath.h i_sunmath
15603eval $inhdr
5f80c64f 15604
b4eb6b3d
JH
15605: see if sys/access.h is available
15606set sys/access.h i_sysaccess
15607eval $inhdr
15608
15609: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15610set sys/filio.h i_sysfilio
15611eval $inhdr
15612echo " "
15613if $test `./findhdr sys/ioctl.h`; then
15614 val="$define"
15615 echo '<sys/ioctl.h> found.' >&4
15616else
15617 val="$undef"
15618 if $test $i_sysfilio = "$define"; then
15619 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 15620 else
b4eb6b3d
JH
15621 $test $i_sgtty = "$define" && xxx="sgtty.h"
15622 $test $i_termio = "$define" && xxx="termio.h"
15623 $test $i_termios = "$define" && xxx="termios.h"
15624echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15625 fi
15626fi
15627set i_sysioctl
15628eval $setvar
15629
49a78c82
JH
15630: see if socket ioctl defs are in sys/sockio.h
15631echo " "
15632xxx=`./findhdr sys/sockio.h`
15633if $test "$xxx"; then
15634 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
15635 val="$define"
15636 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
15637 else
15638 val="$undef"
15639 echo "No socket ioctls found in <sys/sockio.h>." >&4
15640 fi
15641else
15642 val="$undef"
15643 $cat <<EOM
15644<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
15645EOM
15646fi
15647set i_syssockio
15648eval $setvar
15649
b4eb6b3d
JH
15650
15651: see if this is a syslog.h system
15652set syslog.h i_syslog
15653eval $inhdr
15654
15655
15656: see if this is a sys/mode.h system
15657set sys/mode.h i_sysmode
15658eval $inhdr
15659
15660: see if sys/resource.h has to be included
15661set sys/resource.h i_sysresrc
15662eval $inhdr
15663
15664: see if sys/security.h is available
15665set sys/security.h i_syssecrt
15666eval $inhdr
15667
15668: see if this is a sys/statvfs.h system
15669set sys/statvfs.h i_sysstatvfs
15670eval $inhdr
15671
b4eb6b3d
JH
15672: see if this is a sys/un.h system
15673set sys/un.h i_sysun
15674eval $inhdr
15675
15676
15677: see if this is a sys/utsname.h system
15678set sys/utsname.h i_sysutsname
15679eval $inhdr
15680
15681: see if this is a syswait system
15682set sys/wait.h i_syswait
15683eval $inhdr
15684
15685: see if this is a ustat.h system
15686set ustat.h i_ustat
15687eval $inhdr
15688
15689: see if this is an utime system
15690set utime.h i_utime
15691eval $inhdr
15692
15693: see if this is a values.h system
15694set values.h i_values
15695eval $inhdr
15696
15697: see if this is a vfork system
15698case "$d_vfork" in
15699"$define")
15700 set vfork.h i_vfork
15701 eval $inhdr
15702 ;;
15703*)
15704 i_vfork="$undef"
15705 ;;
15706esac
15707
15708: see if gdbm.h is available
15709set gdbm.h t_gdbm
15710eval $inhdr
15711case "$t_gdbm" in
15712$define)
15713 : see if gdbm_open exists
15714 set gdbm_open d_gdbm_open
15715 eval $inlibc
15716 case "$d_gdbm_open" in
15717 $undef)
15718 t_gdbm="$undef"
15719 echo "We won't be including <gdbm.h>"
5f80c64f 15720 ;;
b4eb6b3d
JH
15721 esac
15722 ;;
15723esac
15724val="$t_gdbm"
15725set i_gdbm
15726eval $setvar
15727
15728echo " "
15729echo "Looking for extensions..." >&4
15730: If we are using the old config.sh, known_extensions may contain
15731: old or inaccurate or duplicate values.
15732known_extensions=''
15733nonxs_extensions=''
15734: We do not use find because it might not be available.
15735: We do not just use MANIFEST because the user may have dropped
15736: some additional extensions into the source tree and expect them
15737: to be built.
15738
15739: Function to recursively find available extensions, ignoring DynaLoader
15740: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15741find_extensions='
15742 for xxx in *; do
15743 case "$xxx" in
15744 DynaLoader|dynaload) ;;
15745 *)
15746 if $test -f $xxx/$xxx.xs; then
15747 known_extensions="$known_extensions $1$xxx";
15748 elif $test -f $xxx/Makefile.PL; then
15749 nonxs_extensions="$nonxs_extensions $1$xxx";
15750 else
15751 if $test -d $xxx -a $# -lt 10; then
15752 set $1$xxx/ $*;
15753 cd $xxx;
15754 eval $find_extensions;
15755 cd ..;
15756 shift;
15757 fi;
15758 fi
15759 ;;
15760 esac;
15761 done'
15762tdir=`pwd`
15763cd $rsrc/ext
15764set X
15765shift
15766eval $find_extensions
15767set X $nonxs_extensions
15768shift
15769nonxs_extensions="$*"
15770set X $known_extensions
15771shift
15772known_extensions="$*"
15773cd $tdir
15774
15775: Now see which are supported on this system.
15776avail_ext=''
15777for xxx in $known_extensions ; do
15778 case "$xxx" in
15779 DB_File|db_file)
15780 case "$i_db" in
15781 $define) avail_ext="$avail_ext $xxx" ;;
15782 esac
15783 ;;
15784 GDBM_File|gdbm_fil)
15785 case "$i_gdbm" in
15786 $define) avail_ext="$avail_ext $xxx" ;;
15787 esac
15788 ;;
15789 NDBM_File|ndbm_fil)
15790 case "$i_ndbm" in
15791 $define)
15792 case "$osname-$use64bitint" in
15793 hpux-define)
15794 case "$libs" in
15795 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15796 esac
15797 ;;
15798 *) avail_ext="$avail_ext $xxx" ;;
15799 esac
15800 ;;
15801 esac
15802 ;;
15803 ODBM_File|odbm_fil)
15804 case "${i_dbm}${i_rpcsvcdbm}" in
15805 *"${define}"*)
15806 case "$osname-$use64bitint" in
15807 hpux-define)
15808 case "$libs" in
15809 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15810 esac
15811 ;;
15812 *) avail_ext="$avail_ext $xxx" ;;
15813 esac
15814 ;;
15815 esac
15816 ;;
15817 POSIX|posix)
15818 case "$useposix" in
15819 true|define|y) avail_ext="$avail_ext $xxx" ;;
15820 esac
15821 ;;
15822 Opcode|opcode)
15823 case "$useopcode" in
15824 true|define|y) avail_ext="$avail_ext $xxx" ;;
15825 esac
15826 ;;
15827 Socket|socket)
15828 case "$d_socket" in
15829 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15830 esac
15831 ;;
15832 Sys/Syslog|sys/syslog)
15833 : XXX syslog requires socket
15834 case "$d_socket" in
15835 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15836 esac
15837 ;;
15838 Thread|thread)
15839 case "$usethreads" in
15840 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15841 esac
15842 ;;
15843 IPC/SysV|ipc/sysv)
15844 : XXX Do we need a useipcsysv variable here
15845 case "${d_msg}${d_sem}${d_shm}" in
15846 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15847 esac
15848 ;;
15849 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
15850 ;;
15851 esac
b4eb6b3d 15852done
5f80c64f 15853
b4eb6b3d
JH
15854set X $avail_ext
15855shift
15856avail_ext="$*"
5f80c64f 15857
b4eb6b3d
JH
15858: Now see which nonxs extensions are supported on this system.
15859: For now assume all are.
15860nonxs_ext=''
15861for xxx in $nonxs_extensions ; do
15862 case "$xxx" in
15863 *) nonxs_ext="$nonxs_ext $xxx"
15864 ;;
15865 esac
15866done
5f80c64f 15867
b4eb6b3d
JH
15868set X $nonxs_ext
15869shift
15870nonxs_ext="$*"
15871
15872case $usedl in
15873$define)
15874 $cat <<EOM
15875A number of extensions are supplied with $package. You may choose to
15876compile these extensions for dynamic loading (the default), compile
15877them into the $package executable (static loading), or not include
15878them at all. Answer "none" to include no extensions.
15879Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
15880
15881EOM
b4eb6b3d
JH
15882 case "$dynamic_ext" in
15883 '') dflt="$avail_ext" ;;
15884 *) dflt="$dynamic_ext"
15885 # Perhaps we are reusing an old out-of-date config.sh.
15886 case "$hint" in
15887 previous)
15888 if test X"$dynamic_ext" != X"$avail_ext"; then
15889 $cat <<EOM
15890NOTICE: Your previous config.sh list may be incorrect.
15891The extensions now available to you are
15892 ${avail_ext}
15893but the default list from your previous config.sh is
15894 ${dynamic_ext}
9c839522 15895
b4eb6b3d
JH
15896EOM
15897 fi
9c839522
PM
15898 ;;
15899 esac
b4eb6b3d
JH
15900 ;;
15901 esac
5f80c64f 15902 case "$dflt" in
b4eb6b3d
JH
15903 '') dflt=none;;
15904 esac
15905 rp="What extensions do you wish to load dynamically?"
15906 . ./myread
15907 case "$ans" in
15908 none) dynamic_ext=' ' ;;
15909 *) dynamic_ext="$ans" ;;
5f80c64f 15910 esac
5f80c64f 15911
b4eb6b3d
JH
15912 case "$static_ext" in
15913 '')
15914 : Exclude those already listed in dynamic linking
15915 dflt=''
15916 for xxx in $avail_ext; do
15917 case " $dynamic_ext " in
15918 *" $xxx "*) ;;
15919 *) dflt="$dflt $xxx" ;;
15920 esac
15921 done
15922 set X $dflt
15923 shift
15924 dflt="$*"
15925 ;;
15926 *) dflt="$static_ext"
15927 ;;
15928 esac
9c839522 15929
b4eb6b3d
JH
15930 case "$dflt" in
15931 '') dflt=none;;
15932 esac
15933 rp="What extensions do you wish to load statically?"
15934 . ./myread
15935 case "$ans" in
15936 none) static_ext=' ' ;;
15937 *) static_ext="$ans" ;;
15938 esac
15939 ;;
15940*)
15941 $cat <<EOM
15942A number of extensions are supplied with $package. Answer "none"
15943to include no extensions.
15944Note that DynaLoader is always built and need not be mentioned here.
9c839522 15945
b4eb6b3d
JH
15946EOM
15947 case "$static_ext" in
15948 '') dflt="$avail_ext" ;;
15949 *) dflt="$static_ext"
15950 # Perhaps we are reusing an old out-of-date config.sh.
15951 case "$hint" in
15952 previous)
15953 if test X"$static_ext" != X"$avail_ext"; then
15954 $cat <<EOM
15955NOTICE: Your previous config.sh list may be incorrect.
15956The extensions now available to you are
15957 ${avail_ext}
15958but the default list from your previous config.sh is
15959 ${static_ext}
5f80c64f
JH
15960
15961EOM
b4eb6b3d
JH
15962 fi
15963 ;;
15964 esac
15965 ;;
15966 esac
15967 : Exclude those that are not xs extensions
15968 case "$dflt" in
15969 '') dflt=none;;
15970 esac
15971 rp="What extensions do you wish to include?"
15972 . ./myread
15973 case "$ans" in
15974 none) static_ext=' ' ;;
15975 *) static_ext="$ans" ;;
15976 esac
15977 ;;
5f80c64f
JH
15978esac
15979
b4eb6b3d
JH
15980set X $dynamic_ext $static_ext $nonxs_ext
15981shift
15982extensions="$*"
15983
9c839522
PM
15984: Remove libraries needed only for extensions
15985: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
15986: The exception is SunOS 4.x, which needs them.
15987case "${osname}X${osvers}" in
15988sunos*X4*)
15989 perllibs="$libs"
15990 ;;
15991*) case "$usedl" in
15992 $define|true|[yY]*)
15993 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
15994 shift
15995 perllibs="$*"
15996 ;;
15997 *) perllibs="$libs"
15998 ;;
15999 esac
16000 ;;
9c839522 16001esac
5f80c64f
JH
16002
16003: Remove build directory name from cppstdin so it can be used from
16004: either the present location or the final installed location.
16005echo " "
16006: Get out of the UU directory to get correct path name.
16007cd ..
16008case "$cppstdin" in
16009`pwd`/cppstdin)
16010 echo "Stripping down cppstdin path name"
16011 cppstdin=cppstdin
16012 ;;
16013esac
16014cd UU
16015
16016: end of configuration questions
16017echo " "
16018echo "End of configuration questions."
16019echo " "
16020
16021: back to where it started
16022if test -d ../UU; then
16023 cd ..
16024fi
16025
16026: configuration may be patched via a 'config.over' file
16027if $test -f config.over; then
16028 echo " "
16029 dflt=y
16030 rp='I see a config.over file. Do you wish to load it?'
16031 . UU/myread
16032 case "$ans" in
16033 n*) echo "OK, I'll ignore it.";;
16034 *) . ./config.over
16035 echo "Configuration override changes have been loaded."
16036 ;;
16037 esac
16038fi
16039
16040: in case they want portability, strip down executable paths
16041case "$d_portable" in
16042"$define")
16043 echo " "
16044 echo "Stripping down executable paths..." >&4
16045 for file in $loclist $trylist; do
534ac15a
JH
16046 eval temp=\$$file
16047 eval $file=`basename $temp`
5f80c64f
JH
16048 done
16049 ;;
16050esac
16051
16052: create config.sh file
16053echo " "
16054echo "Creating config.sh..." >&4
16055$spitshell <<EOT >config.sh
16056$startsh
16057#
16058# This file was produced by running the Configure script. It holds all the
16059# definitions figured out by Configure. Should you modify one of these values,
16060# do not forget to propagate your changes by running "Configure -der". You may
16061# instead choose to run each of the .SH files by yourself, or "Configure -S".
16062#
16063
16064# Package name : $package
16065# Source directory : $src
16066# Configuration time: $cf_time
16067# Configured by : $cf_by
16068# Target system : $myuname
16069
16070Author='$Author'
16071Date='$Date'
16072Header='$Header'
16073Id='$Id'
16074Locker='$Locker'
16075Log='$Log'
16076Mcc='$Mcc'
16077RCSfile='$RCSfile'
16078Revision='$Revision'
16079Source='$Source'
16080State='$State'
16081_a='$_a'
16082_exe='$_exe'
16083_o='$_o'
b4eb6b3d
JH
16084afs='$afs'
16085alignbytes='$alignbytes'
16086ansi2knr='$ansi2knr'
16087aphostname='$aphostname'
16088api_revision='$api_revision'
16089api_subversion='$api_subversion'
16090api_version='$api_version'
16091api_versionstring='$api_versionstring'
5f80c64f 16092ar='$ar'
b4eb6b3d
JH
16093archlib='$archlib'
16094archlibexp='$archlibexp'
16095archname64='$archname64'
16096archname='$archname'
5f80c64f
JH
16097archobjs='$archobjs'
16098awk='$awk'
b4eb6b3d 16099baserev='$baserev'
5f80c64f 16100bash='$bash'
b4eb6b3d
JH
16101bin='$bin'
16102bincompat5005='$bincompat5005'
16103binexp='$binexp'
5f80c64f
JH
16104bison='$bison'
16105byacc='$byacc'
b4eb6b3d 16106byteorder='$byteorder'
5f80c64f 16107c='$c'
b4eb6b3d 16108castflags='$castflags'
5f80c64f
JH
16109cat='$cat'
16110cc='$cc'
16111cccdlflags='$cccdlflags'
16112ccdlflags='$ccdlflags'
16113ccflags='$ccflags'
b4eb6b3d 16114ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 16115ccname='$ccname'
b4eb6b3d 16116ccsymbols='$ccsymbols'
6b356c8e 16117ccversion='$ccversion'
5f80c64f 16118cf_by='$cf_by'
b4eb6b3d 16119cf_email='$cf_email'
5f80c64f 16120cf_time='$cf_time'
b4eb6b3d 16121charsize='$charsize'
5f80c64f
JH
16122chgrp='$chgrp'
16123chmod='$chmod'
16124chown='$chown'
b4eb6b3d 16125clocktype='$clocktype'
5f80c64f
JH
16126comm='$comm'
16127compress='$compress'
16128contains='$contains'
16129cp='$cp'
16130cpio='$cpio'
16131cpp='$cpp'
b4eb6b3d
JH
16132cpp_stuff='$cpp_stuff'
16133cppccsymbols='$cppccsymbols'
5f80c64f
JH
16134cppflags='$cppflags'
16135cpplast='$cpplast'
16136cppminus='$cppminus'
16137cpprun='$cpprun'
16138cppstdin='$cppstdin'
b4eb6b3d
JH
16139cppsymbols='$cppsymbols'
16140crosscompile='$crosscompile'
16141cryptlib='$cryptlib'
5f80c64f 16142csh='$csh'
b4eb6b3d
JH
16143d_Gconvert='$d_Gconvert'
16144d_PRIEUldbl='$d_PRIEUldbl'
16145d_PRIFUldbl='$d_PRIFUldbl'
16146d_PRIGUldbl='$d_PRIGUldbl'
16147d_PRIXU64='$d_PRIXU64'
16148d_PRId64='$d_PRId64'
16149d_PRIeldbl='$d_PRIeldbl'
16150d_PRIfldbl='$d_PRIfldbl'
16151d_PRIgldbl='$d_PRIgldbl'
16152d_PRIi64='$d_PRIi64'
16153d_PRIo64='$d_PRIo64'
16154d_PRIu64='$d_PRIu64'
16155d_PRIx64='$d_PRIx64'
16156d_SCNfldbl='$d_SCNfldbl'
74cac757 16157d__fwalk='$d__fwalk'
b4eb6b3d
JH
16158d_access='$d_access'
16159d_accessx='$d_accessx'
16160d_alarm='$d_alarm'
16161d_archlib='$d_archlib'
16162d_atolf='$d_atolf'
16163d_atoll='$d_atoll'
16164d_attribut='$d_attribut'
16165d_bcmp='$d_bcmp'
16166d_bcopy='$d_bcopy'
16167d_bincompat5005='$d_bincompat5005'
5f80c64f 16168d_bsd='$d_bsd'
b4eb6b3d
JH
16169d_bsdgetpgrp='$d_bsdgetpgrp'
16170d_bsdsetpgrp='$d_bsdsetpgrp'
16171d_bzero='$d_bzero'
16172d_casti32='$d_casti32'
16173d_castneg='$d_castneg'
16174d_charvspr='$d_charvspr'
16175d_chown='$d_chown'
16176d_chroot='$d_chroot'
16177d_chsize='$d_chsize'
16178d_closedir='$d_closedir'
4e0554ec 16179d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d
JH
16180d_const='$d_const'
16181d_crypt='$d_crypt'
16182d_csh='$d_csh'
16183d_cuserid='$d_cuserid'
16184d_dbl_dig='$d_dbl_dig'
16185d_difftime='$d_difftime'
16186d_dirnamlen='$d_dirnamlen'
16187d_dlerror='$d_dlerror'
5f80c64f 16188d_dlopen='$d_dlopen'
b4eb6b3d
JH
16189d_dlsymun='$d_dlsymun'
16190d_dosuid='$d_dosuid'
16191d_drand48proto='$d_drand48proto'
16192d_dup2='$d_dup2'
16193d_eaccess='$d_eaccess'
16194d_endgrent='$d_endgrent'
16195d_endhent='$d_endhent'
16196d_endnent='$d_endnent'
16197d_endpent='$d_endpent'
16198d_endpwent='$d_endpwent'
16199d_endsent='$d_endsent'
16200d_eofnblk='$d_eofnblk'
5f80c64f 16201d_eunice='$d_eunice'
b4eb6b3d
JH
16202d_fchmod='$d_fchmod'
16203d_fchown='$d_fchown'
16204d_fcntl='$d_fcntl'
9d9004a9 16205d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
16206d_fd_macros='$d_fd_macros'
16207d_fd_set='$d_fd_set'
16208d_fds_bits='$d_fds_bits'
16209d_fgetpos='$d_fgetpos'
16210d_flexfnam='$d_flexfnam'
16211d_flock='$d_flock'
16212d_fork='$d_fork'
16213d_fpathconf='$d_fpathconf'
16214d_fpos64_t='$d_fpos64_t'
16215d_frexpl='$d_frexpl'
16216d_fs_data_s='$d_fs_data_s'
16217d_fseeko='$d_fseeko'
16218d_fsetpos='$d_fsetpos'
16219d_fstatfs='$d_fstatfs'
16220d_fstatvfs='$d_fstatvfs'
411ab01c 16221d_fsync='$d_fsync'
b4eb6b3d
JH
16222d_ftello='$d_ftello'
16223d_ftime='$d_ftime'
16224d_getcwd='$d_getcwd'
16225d_getespwnam='$d_getespwnam'
16226d_getfsstat='$d_getfsstat'
16227d_getgrent='$d_getgrent'
16228d_getgrps='$d_getgrps'
16229d_gethbyaddr='$d_gethbyaddr'
16230d_gethbyname='$d_gethbyname'
16231d_gethent='$d_gethent'
16232d_gethname='$d_gethname'
16233d_gethostprotos='$d_gethostprotos'
4e0554ec 16234d_getitimer='$d_getitimer'
b4eb6b3d
JH
16235d_getlogin='$d_getlogin'
16236d_getmnt='$d_getmnt'
16237d_getmntent='$d_getmntent'
16238d_getnbyaddr='$d_getnbyaddr'
16239d_getnbyname='$d_getnbyname'
16240d_getnent='$d_getnent'
16241d_getnetprotos='$d_getnetprotos'
0c0643d0 16242d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
16243d_getpbyname='$d_getpbyname'
16244d_getpbynumber='$d_getpbynumber'
16245d_getpent='$d_getpent'
16246d_getpgid='$d_getpgid'
16247d_getpgrp2='$d_getpgrp2'
16248d_getpgrp='$d_getpgrp'
16249d_getppid='$d_getppid'
16250d_getprior='$d_getprior'
16251d_getprotoprotos='$d_getprotoprotos'
16252d_getprpwnam='$d_getprpwnam'
16253d_getpwent='$d_getpwent'
16254d_getsbyname='$d_getsbyname'
16255d_getsbyport='$d_getsbyport'
16256d_getsent='$d_getsent'
16257d_getservprotos='$d_getservprotos'
16258d_getspnam='$d_getspnam'
16259d_gettimeod='$d_gettimeod'
5f80c64f 16260d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
16261d_grpasswd='$d_grpasswd'
16262d_hasmntopt='$d_hasmntopt'
16263d_htonl='$d_htonl'
16264d_iconv='$d_iconv'
16265d_index='$d_index'
16266d_inetaton='$d_inetaton'
16267d_int64_t='$d_int64_t'
16268d_isascii='$d_isascii'
16269d_isnan='$d_isnan'
16270d_isnanl='$d_isnanl'
16271d_killpg='$d_killpg'
16272d_lchown='$d_lchown'
16273d_ldbl_dig='$d_ldbl_dig'
16274d_link='$d_link'
16275d_locconv='$d_locconv'
16276d_lockf='$d_lockf'
16277d_longdbl='$d_longdbl'
16278d_longlong='$d_longlong'
16279d_lseekproto='$d_lseekproto'
16280d_lstat='$d_lstat'
16281d_madvise='$d_madvise'
16282d_mblen='$d_mblen'
16283d_mbstowcs='$d_mbstowcs'
16284d_mbtowc='$d_mbtowc'
16285d_memchr='$d_memchr'
16286d_memcmp='$d_memcmp'
16287d_memcpy='$d_memcpy'
16288d_memmove='$d_memmove'
16289d_memset='$d_memset'
16290d_mkdir='$d_mkdir'
16291d_mkdtemp='$d_mkdtemp'
16292d_mkfifo='$d_mkfifo'
16293d_mkstemp='$d_mkstemp'
16294d_mkstemps='$d_mkstemps'
16295d_mktime='$d_mktime'
16296d_mmap='$d_mmap'
16297d_modfl='$d_modfl'
16298d_mprotect='$d_mprotect'
16299d_msg='$d_msg'
16300d_msg_ctrunc='$d_msg_ctrunc'
16301d_msg_dontroute='$d_msg_dontroute'
16302d_msg_oob='$d_msg_oob'
16303d_msg_peek='$d_msg_peek'
16304d_msg_proxy='$d_msg_proxy'
16305d_msgctl='$d_msgctl'
16306d_msgget='$d_msgget'
4e0554ec 16307d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
16308d_msgrcv='$d_msgrcv'
16309d_msgsnd='$d_msgsnd'
16310d_msync='$d_msync'
16311d_munmap='$d_munmap'
16312d_mymalloc='$d_mymalloc'
16313d_nice='$d_nice'
16314d_nv_preserves_uv='$d_nv_preserves_uv'
16315d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16316d_off64_t='$d_off64_t'
16317d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16318d_oldpthreads='$d_oldpthreads'
16319d_oldsock='$d_oldsock'
16320d_open3='$d_open3'
16321d_pathconf='$d_pathconf'
16322d_pause='$d_pause'
16323d_perl_otherlibdirs='$d_perl_otherlibdirs'
16324d_phostname='$d_phostname'
16325d_pipe='$d_pipe'
16326d_poll='$d_poll'
5f80c64f 16327d_portable='$d_portable'
b4eb6b3d
JH
16328d_pthread_yield='$d_pthread_yield'
16329d_pwage='$d_pwage'
16330d_pwchange='$d_pwchange'
16331d_pwclass='$d_pwclass'
16332d_pwcomment='$d_pwcomment'
16333d_pwexpire='$d_pwexpire'
16334d_pwgecos='$d_pwgecos'
16335d_pwpasswd='$d_pwpasswd'
16336d_pwquota='$d_pwquota'
16337d_qgcvt='$d_qgcvt'
16338d_quad='$d_quad'
16339d_readdir='$d_readdir'
16340d_readlink='$d_readlink'
4e0554ec
JH
16341d_readv='$d_readv'
16342d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
16343d_rename='$d_rename'
16344d_rewinddir='$d_rewinddir'
16345d_rmdir='$d_rmdir'
16346d_safebcpy='$d_safebcpy'
16347d_safemcpy='$d_safemcpy'
16348d_sanemcmp='$d_sanemcmp'
ef9f17be 16349d_sbrkproto='$d_sbrkproto'
b4eb6b3d
JH
16350d_sched_yield='$d_sched_yield'
16351d_scm_rights='$d_scm_rights'
16352d_seekdir='$d_seekdir'
16353d_select='$d_select'
16354d_sem='$d_sem'
16355d_semctl='$d_semctl'
16356d_semctl_semid_ds='$d_semctl_semid_ds'
16357d_semctl_semun='$d_semctl_semun'
16358d_semget='$d_semget'
16359d_semop='$d_semop'
4e0554ec 16360d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
16361d_setegid='$d_setegid'
16362d_seteuid='$d_seteuid'
16363d_setgrent='$d_setgrent'
16364d_setgrps='$d_setgrps'
16365d_sethent='$d_sethent'
4e0554ec 16366d_setitimer='$d_setitimer'
b4eb6b3d
JH
16367d_setlinebuf='$d_setlinebuf'
16368d_setlocale='$d_setlocale'
16369d_setnent='$d_setnent'
16370d_setpent='$d_setpent'
16371d_setpgid='$d_setpgid'
16372d_setpgrp2='$d_setpgrp2'
16373d_setpgrp='$d_setpgrp'
16374d_setprior='$d_setprior'
16375d_setproctitle='$d_setproctitle'
16376d_setpwent='$d_setpwent'
16377d_setregid='$d_setregid'
16378d_setresgid='$d_setresgid'
16379d_setresuid='$d_setresuid'
16380d_setreuid='$d_setreuid'
16381d_setrgid='$d_setrgid'
16382d_setruid='$d_setruid'
16383d_setsent='$d_setsent'
16384d_setsid='$d_setsid'
16385d_setvbuf='$d_setvbuf'
16386d_sfio='$d_sfio'
16387d_shm='$d_shm'
16388d_shmat='$d_shmat'
16389d_shmatprototype='$d_shmatprototype'
16390d_shmctl='$d_shmctl'
16391d_shmdt='$d_shmdt'
16392d_shmget='$d_shmget'
16393d_sigaction='$d_sigaction'
983dbef6 16394d_sigprocmask='$d_sigprocmask'
b4eb6b3d 16395d_sigsetjmp='$d_sigsetjmp'
49a78c82 16396d_sockatmark='$d_sockatmark'
b4eb6b3d
JH
16397d_socket='$d_socket'
16398d_socklen_t='$d_socklen_t'
16399d_sockpair='$d_sockpair'
16400d_socks5_init='$d_socks5_init'
16401d_sqrtl='$d_sqrtl'
16402d_statblks='$d_statblks'
16403d_statfs_f_flags='$d_statfs_f_flags'
16404d_statfs_s='$d_statfs_s'
16405d_statvfs='$d_statvfs'
16406d_stdio_cnt_lval='$d_stdio_cnt_lval'
16407d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
16408d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16409d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
16410d_stdio_stream_array='$d_stdio_stream_array'
16411d_stdiobase='$d_stdiobase'
16412d_stdstdio='$d_stdstdio'
16413d_strchr='$d_strchr'
16414d_strcoll='$d_strcoll'
16415d_strctcpy='$d_strctcpy'
16416d_strerrm='$d_strerrm'
16417d_strerror='$d_strerror'
b3c85772 16418d_strftime='$d_strftime'
b4eb6b3d
JH
16419d_strtod='$d_strtod'
16420d_strtol='$d_strtol'
16421d_strtold='$d_strtold'
16422d_strtoll='$d_strtoll'
28e5dec8 16423d_strtoq='$d_strtoq'
b4eb6b3d
JH
16424d_strtoul='$d_strtoul'
16425d_strtoull='$d_strtoull'
16426d_strtouq='$d_strtouq'
16427d_strxfrm='$d_strxfrm'
16428d_suidsafe='$d_suidsafe'
16429d_symlink='$d_symlink'
16430d_syscall='$d_syscall'
16431d_sysconf='$d_sysconf'
16432d_sysernlst='$d_sysernlst'
16433d_syserrlst='$d_syserrlst'
16434d_system='$d_system'
16435d_tcgetpgrp='$d_tcgetpgrp'
16436d_tcsetpgrp='$d_tcsetpgrp'
16437d_telldir='$d_telldir'
16438d_telldirproto='$d_telldirproto'
16439d_time='$d_time'
16440d_times='$d_times'
16441d_truncate='$d_truncate'
16442d_tzname='$d_tzname'
4e0554ec
JH
16443d_u32align='$d_u32align'
16444d_ualarm='$d_ualarm'
b4eb6b3d
JH
16445d_umask='$d_umask'
16446d_uname='$d_uname'
16447d_union_semun='$d_union_semun'
4e0554ec 16448d_usleep='$d_usleep'
b4eb6b3d
JH
16449d_ustat='$d_ustat'
16450d_vendorarch='$d_vendorarch'
16451d_vendorbin='$d_vendorbin'
16452d_vendorlib='$d_vendorlib'
16453d_vfork='$d_vfork'
16454d_void_closedir='$d_void_closedir'
16455d_voidsig='$d_voidsig'
16456d_voidtty='$d_voidtty'
16457d_volatile='$d_volatile'
16458d_vprintf='$d_vprintf'
16459d_wait4='$d_wait4'
16460d_waitpid='$d_waitpid'
16461d_wcstombs='$d_wcstombs'
16462d_wctomb='$d_wctomb'
4e0554ec 16463d_writev='$d_writev'
5f80c64f
JH
16464d_xenix='$d_xenix'
16465date='$date'
b4eb6b3d
JH
16466db_hashtype='$db_hashtype'
16467db_prefixtype='$db_prefixtype'
16468defvoidused='$defvoidused'
16469direntrytype='$direntrytype'
16470dlext='$dlext'
5f80c64f 16471dlsrc='$dlsrc'
b4eb6b3d
JH
16472doublesize='$doublesize'
16473drand01='$drand01'
16474dynamic_ext='$dynamic_ext'
16475eagain='$eagain'
16476ebcdic='$ebcdic'
5f80c64f
JH
16477echo='$echo'
16478egrep='$egrep'
16479emacs='$emacs'
16480eunicefix='$eunicefix'
16481exe_ext='$exe_ext'
16482expr='$expr'
b4eb6b3d
JH
16483extensions='$extensions'
16484fflushNULL='$fflushNULL'
16485fflushall='$fflushall'
5f80c64f
JH
16486find='$find'
16487firstmakefile='$firstmakefile'
16488flex='$flex'
b4eb6b3d
JH
16489fpossize='$fpossize'
16490fpostype='$fpostype'
16491freetype='$freetype'
16492full_ar='$full_ar'
16493full_csh='$full_csh'
16494full_sed='$full_sed'
5b463ca7 16495gccosandvers='$gccosandvers'
5f80c64f 16496gccversion='$gccversion'
b4eb6b3d
JH
16497gidformat='$gidformat'
16498gidsign='$gidsign'
16499gidsize='$gidsize'
16500gidtype='$gidtype'
5f80c64f
JH
16501glibpth='$glibpth'
16502grep='$grep'
b4eb6b3d
JH
16503groupcat='$groupcat'
16504groupstype='$groupstype'
5f80c64f 16505gzip='$gzip'
b4eb6b3d
JH
16506h_fcntl='$h_fcntl'
16507h_sysfile='$h_sysfile'
5f80c64f 16508hint='$hint'
b4eb6b3d
JH
16509hostcat='$hostcat'
16510i16size='$i16size'
16511i16type='$i16type'
16512i32size='$i32size'
16513i32type='$i32type'
16514i64size='$i64size'
16515i64type='$i64type'
16516i8size='$i8size'
16517i8type='$i8type'
16518i_arpainet='$i_arpainet'
16519i_bsdioctl='$i_bsdioctl'
16520i_db='$i_db'
16521i_dbm='$i_dbm'
16522i_dirent='$i_dirent'
5f80c64f 16523i_dld='$i_dld'
b4eb6b3d
JH
16524i_dlfcn='$i_dlfcn'
16525i_fcntl='$i_fcntl'
16526i_float='$i_float'
16527i_gdbm='$i_gdbm'
16528i_grp='$i_grp'
16529i_iconv='$i_iconv'
16530i_ieeefp='$i_ieeefp'
16531i_inttypes='$i_inttypes'
16532i_libutil='$i_libutil'
16533i_limits='$i_limits'
16534i_locale='$i_locale'
16535i_machcthr='$i_machcthr'
16536i_malloc='$i_malloc'
16537i_math='$i_math'
16538i_memory='$i_memory'
16539i_mntent='$i_mntent'
16540i_ndbm='$i_ndbm'
16541i_netdb='$i_netdb'
16542i_neterrno='$i_neterrno'
16543i_netinettcp='$i_netinettcp'
16544i_niin='$i_niin'
16545i_poll='$i_poll'
16546i_prot='$i_prot'
16547i_pthread='$i_pthread'
16548i_pwd='$i_pwd'
16549i_rpcsvcdbm='$i_rpcsvcdbm'
16550i_sfio='$i_sfio'
16551i_sgtty='$i_sgtty'
16552i_shadow='$i_shadow'
16553i_socks='$i_socks'
16554i_stdarg='$i_stdarg'
16555i_stddef='$i_stddef'
16556i_stdlib='$i_stdlib'
16557i_string='$i_string'
16558i_sunmath='$i_sunmath'
16559i_sysaccess='$i_sysaccess'
16560i_sysdir='$i_sysdir'
16561i_sysfile='$i_sysfile'
16562i_sysfilio='$i_sysfilio'
16563i_sysin='$i_sysin'
16564i_sysioctl='$i_sysioctl'
16565i_syslog='$i_syslog'
16566i_sysmman='$i_sysmman'
16567i_sysmode='$i_sysmode'
16568i_sysmount='$i_sysmount'
16569i_sysndir='$i_sysndir'
16570i_sysparam='$i_sysparam'
16571i_sysresrc='$i_sysresrc'
16572i_syssecrt='$i_syssecrt'
16573i_sysselct='$i_sysselct'
16574i_syssockio='$i_syssockio'
16575i_sysstat='$i_sysstat'
16576i_sysstatfs='$i_sysstatfs'
16577i_sysstatvfs='$i_sysstatvfs'
16578i_systime='$i_systime'
16579i_systimek='$i_systimek'
16580i_systimes='$i_systimes'
16581i_systypes='$i_systypes'
16582i_sysuio='$i_sysuio'
16583i_sysun='$i_sysun'
16584i_sysutsname='$i_sysutsname'
16585i_sysvfs='$i_sysvfs'
16586i_syswait='$i_syswait'
16587i_termio='$i_termio'
16588i_termios='$i_termios'
16589i_time='$i_time'
16590i_unistd='$i_unistd'
16591i_ustat='$i_ustat'
16592i_utime='$i_utime'
16593i_values='$i_values'
16594i_varargs='$i_varargs'
16595i_varhdr='$i_varhdr'
16596i_vfork='$i_vfork'
5f80c64f 16597ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
16598inc_version_list='$inc_version_list'
16599inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
16600incpath='$incpath'
16601inews='$inews'
b4eb6b3d
JH
16602installarchlib='$installarchlib'
16603installbin='$installbin'
16604installman1dir='$installman1dir'
16605installman3dir='$installman3dir'
16606installprefix='$installprefix'
16607installprefixexp='$installprefixexp'
16608installprivlib='$installprivlib'
16609installscript='$installscript'
16610installsitearch='$installsitearch'
16611installsitebin='$installsitebin'
16612installsitelib='$installsitelib'
16613installstyle='$installstyle'
16614installusrbinperl='$installusrbinperl'
16615installvendorarch='$installvendorarch'
16616installvendorbin='$installvendorbin'
16617installvendorlib='$installvendorlib'
16618intsize='$intsize'
4b661809 16619issymlink='$issymlink'
b4eb6b3d
JH
16620ivdformat='$ivdformat'
16621ivsize='$ivsize'
16622ivtype='$ivtype'
16623known_extensions='$known_extensions'
5f80c64f 16624ksh='$ksh'
5f80c64f
JH
16625ld='$ld'
16626lddlflags='$lddlflags'
16627ldflags='$ldflags'
b4eb6b3d
JH
16628ldflags_uselargefiles='$ldflags_uselargefiles'
16629ldlibpthname='$ldlibpthname'
5f80c64f
JH
16630less='$less'
16631lib_ext='$lib_ext'
16632libc='$libc'
b4eb6b3d 16633libperl='$libperl'
5f80c64f
JH
16634libpth='$libpth'
16635libs='$libs'
43999f95
JH
16636libsdirs='$libsdirs'
16637libsfiles='$libsfiles'
16638libsfound='$libsfound'
13b3f787 16639libspath='$libspath'
5f80c64f 16640libswanted='$libswanted'
b4eb6b3d 16641libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
16642line='$line'
16643lint='$lint'
16644lkflags='$lkflags'
16645ln='$ln'
16646lns='$lns'
16647locincpth='$locincpth'
16648loclibpth='$loclibpth'
b4eb6b3d
JH
16649longdblsize='$longdblsize'
16650longlongsize='$longlongsize'
16651longsize='$longsize'
5f80c64f
JH
16652lp='$lp'
16653lpr='$lpr'
16654ls='$ls'
b4eb6b3d
JH
16655lseeksize='$lseeksize'
16656lseektype='$lseektype'
5f80c64f
JH
16657mail='$mail'
16658mailx='$mailx'
16659make='$make'
16660make_set_make='$make_set_make'
b4eb6b3d
JH
16661mallocobj='$mallocobj'
16662mallocsrc='$mallocsrc'
16663malloctype='$malloctype'
16664man1dir='$man1dir'
16665man1direxp='$man1direxp'
16666man1ext='$man1ext'
16667man3dir='$man3dir'
16668man3direxp='$man3direxp'
16669man3ext='$man3ext'
5f80c64f
JH
16670mips_type='$mips_type'
16671mkdir='$mkdir'
b4eb6b3d
JH
16672mmaptype='$mmaptype'
16673modetype='$modetype'
5f80c64f 16674more='$more'
b4eb6b3d 16675multiarch='$multiarch'
5f80c64f 16676mv='$mv'
b4eb6b3d
JH
16677myarchname='$myarchname'
16678mydomain='$mydomain'
16679myhostname='$myhostname'
5f80c64f
JH
16680myuname='$myuname'
16681n='$n'
2cc61e15 16682need_va_copy='$need_va_copy'
b4eb6b3d
JH
16683netdb_hlen_type='$netdb_hlen_type'
16684netdb_host_type='$netdb_host_type'
16685netdb_name_type='$netdb_name_type'
16686netdb_net_type='$netdb_net_type'
5f80c64f
JH
16687nm='$nm'
16688nm_opt='$nm_opt'
16689nm_so_opt='$nm_so_opt'
b4eb6b3d 16690nonxs_ext='$nonxs_ext'
5f80c64f 16691nroff='$nroff'
b4eb6b3d
JH
16692nvEUformat='$nvEUformat'
16693nvFUformat='$nvFUformat'
16694nvGUformat='$nvGUformat'
16695nveformat='$nveformat'
16696nvfformat='$nvfformat'
16697nvgformat='$nvgformat'
16698nvsize='$nvsize'
16699nvtype='$nvtype'
16700o_nonblock='$o_nonblock'
5f80c64f 16701obj_ext='$obj_ext'
b4eb6b3d 16702old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 16703optimize='$optimize'
b4eb6b3d 16704orderlib='$orderlib'
5f80c64f
JH
16705osname='$osname'
16706osvers='$osvers'
b4eb6b3d 16707otherlibdirs='$otherlibdirs'
5f80c64f 16708package='$package'
b4eb6b3d
JH
16709pager='$pager'
16710passcat='$passcat'
16711patchlevel='$patchlevel'
5f80c64f 16712path_sep='$path_sep'
b4eb6b3d 16713perl5='$perl5'
5f80c64f 16714perl='$perl'
b4eb6b3d 16715perladmin='$perladmin'
9c839522 16716perllibs='$perllibs'
b4eb6b3d 16717perlpath='$perlpath'
5f80c64f 16718pg='$pg'
b4eb6b3d
JH
16719phostname='$phostname'
16720pidtype='$pidtype'
5f80c64f 16721plibpth='$plibpth'
b4eb6b3d 16722pm_apiversion='$pm_apiversion'
5f80c64f
JH
16723pmake='$pmake'
16724pr='$pr'
b4eb6b3d
JH
16725prefix='$prefix'
16726prefixexp='$prefixexp'
16727privlib='$privlib'
16728privlibexp='$privlibexp'
16729prototype='$prototype'
16730ptrsize='$ptrsize'
16731quadkind='$quadkind'
16732quadtype='$quadtype'
16733randbits='$randbits'
16734randfunc='$randfunc'
16735randseedtype='$randseedtype'
16736ranlib='$ranlib'
16737rd_nodata='$rd_nodata'
16738revision='$revision'
5f80c64f
JH
16739rm='$rm'
16740rmail='$rmail'
16741runnm='$runnm'
b4eb6b3d
JH
16742sPRIEUldbl='$sPRIEUldbl'
16743sPRIFUldbl='$sPRIFUldbl'
16744sPRIGUldbl='$sPRIGUldbl'
16745sPRIXU64='$sPRIXU64'
16746sPRId64='$sPRId64'
16747sPRIeldbl='$sPRIeldbl'
16748sPRIfldbl='$sPRIfldbl'
16749sPRIgldbl='$sPRIgldbl'
16750sPRIi64='$sPRIi64'
16751sPRIo64='$sPRIo64'
16752sPRIu64='$sPRIu64'
16753sPRIx64='$sPRIx64'
16754sSCNfldbl='$sSCNfldbl'
16755sched_yield='$sched_yield'
16756scriptdir='$scriptdir'
16757scriptdirexp='$scriptdirexp'
5f80c64f 16758sed='$sed'
b4eb6b3d
JH
16759seedfunc='$seedfunc'
16760selectminbits='$selectminbits'
16761selecttype='$selecttype'
5f80c64f
JH
16762sendmail='$sendmail'
16763sh='$sh'
16764shar='$shar'
16765sharpbang='$sharpbang'
b4eb6b3d
JH
16766shmattype='$shmattype'
16767shortsize='$shortsize'
16768shrpenv='$shrpenv'
5f80c64f 16769shsharp='$shsharp'
b4eb6b3d
JH
16770sig_count='$sig_count'
16771sig_name='$sig_name'
16772sig_name_init='$sig_name_init'
16773sig_num='$sig_num'
16774sig_num_init='$sig_num_init'
76d3c696 16775sig_size='$sig_size'
b4eb6b3d
JH
16776signal_t='$signal_t'
16777sitearch='$sitearch'
16778sitearchexp='$sitearchexp'
16779sitebin='$sitebin'
16780sitebinexp='$sitebinexp'
16781sitelib='$sitelib'
16782sitelib_stem='$sitelib_stem'
16783sitelibexp='$sitelibexp'
16784siteprefix='$siteprefix'
16785siteprefixexp='$siteprefixexp'
16786sizesize='$sizesize'
16787sizetype='$sizetype'
5f80c64f
JH
16788sleep='$sleep'
16789smail='$smail'
5f80c64f 16790so='$so'
b4eb6b3d
JH
16791sockethdr='$sockethdr'
16792socketlib='$socketlib'
16793socksizetype='$socksizetype'
5f80c64f
JH
16794sort='$sort'
16795spackage='$spackage'
16796spitshell='$spitshell'
5f80c64f 16797src='$src'
b4eb6b3d
JH
16798ssizetype='$ssizetype'
16799startperl='$startperl'
5f80c64f 16800startsh='$startsh'
b4eb6b3d
JH
16801static_ext='$static_ext'
16802stdchar='$stdchar'
16803stdio_base='$stdio_base'
16804stdio_bufsiz='$stdio_bufsiz'
16805stdio_cnt='$stdio_cnt'
16806stdio_filbuf='$stdio_filbuf'
16807stdio_ptr='$stdio_ptr'
16808stdio_stream_array='$stdio_stream_array'
16809strings='$strings'
5f80c64f 16810submit='$submit'
b4eb6b3d
JH
16811subversion='$subversion'
16812sysman='$sysman'
5f80c64f
JH
16813tail='$tail'
16814tar='$tar'
16815tbl='$tbl'
16816tee='$tee'
16817test='$test'
b4eb6b3d
JH
16818timeincl='$timeincl'
16819timetype='$timetype'
5f80c64f
JH
16820touch='$touch'
16821tr='$tr'
16822trnl='$trnl'
16823troff='$troff'
b4eb6b3d
JH
16824u16size='$u16size'
16825u16type='$u16type'
16826u32size='$u32size'
16827u32type='$u32type'
16828u64size='$u64size'
16829u64type='$u64type'
16830u8size='$u8size'
16831u8type='$u8type'
16832uidformat='$uidformat'
16833uidsign='$uidsign'
16834uidsize='$uidsize'
16835uidtype='$uidtype'
5f80c64f
JH
16836uname='$uname'
16837uniq='$uniq'
b4eb6b3d
JH
16838uquadtype='$uquadtype'
16839use5005threads='$use5005threads'
16840use64bitall='$use64bitall'
16841use64bitint='$use64bitint'
5f80c64f 16842usedl='$usedl'
b4eb6b3d
JH
16843useithreads='$useithreads'
16844uselargefiles='$uselargefiles'
16845uselongdouble='$uselongdouble'
16846usemorebits='$usemorebits'
16847usemultiplicity='$usemultiplicity'
16848usemymalloc='$usemymalloc'
5f80c64f 16849usenm='$usenm'
b4eb6b3d
JH
16850useopcode='$useopcode'
16851useperlio='$useperlio'
16852useposix='$useposix'
16853usesfio='$usesfio'
16854useshrplib='$useshrplib'
29209bc5 16855usesocks='$usesocks'
b4eb6b3d
JH
16856usethreads='$usethreads'
16857usevendorprefix='$usevendorprefix'
16858usevfork='$usevfork'
5f80c64f
JH
16859usrinc='$usrinc'
16860uuname='$uuname'
b4eb6b3d
JH
16861uvXUformat='$uvXUformat'
16862uvoformat='$uvoformat'
16863uvsize='$uvsize'
16864uvtype='$uvtype'
16865uvuformat='$uvuformat'
16866uvxformat='$uvxformat'
16867vendorarch='$vendorarch'
16868vendorarchexp='$vendorarchexp'
16869vendorbin='$vendorbin'
16870vendorbinexp='$vendorbinexp'
16871vendorlib='$vendorlib'
16872vendorlib_stem='$vendorlib_stem'
16873vendorlibexp='$vendorlibexp'
16874vendorprefix='$vendorprefix'
16875vendorprefixexp='$vendorprefixexp'
16876version='$version'
d56c5707 16877versiononly='$versiononly'
5f80c64f 16878vi='$vi'
b4eb6b3d 16879voidflags='$voidflags'
5f80c64f 16880xlibpth='$xlibpth'
b4eb6b3d 16881xs_apiversion='$xs_apiversion'
3659ebf1
JH
16882yacc='$yacc'
16883yaccflags='$yaccflags'
5f80c64f
JH
16884zcat='$zcat'
16885zip='$zip'
16886EOT
16887
16888: Add in command line options if available
16889$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16890
16891: add special variables
16892$test -f $src/patchlevel.h && \
d00b958f 16893awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
2000072c 16894echo "CONFIGDOTSH=true" >>config.sh
5f80c64f
JH
16895
16896: propagate old symbols
16897if $test -f UU/config.sh; then
381aa1ff 16898 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 16899 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 16900 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
16901 set X `cat UU/oldsyms`
16902 shift
16903 case $# in
16904 0) ;;
16905 *)
16906 cat <<EOM
16907Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16908EOM
16909 echo "# Variables propagated from previous config.sh file." >>config.sh
16910 for sym in `cat UU/oldsyms`; do
16911 echo " Propagating $hint variable "'$'"$sym..."
16912 eval 'tmp="$'"${sym}"'"'
16913 echo "$tmp" | \
16914 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16915 done
16916 ;;
16917 esac
16918fi
16919
16920: Finish up by extracting the .SH files
16921case "$alldone" in
16922exit)
16923 $rm -rf UU
16924 echo "Done."
16925 exit 0
16926 ;;
16927cont)
16928 ;;
16929'')
16930 dflt=''
16931 nostick=true
16932 $cat <<EOM
16933
16934If you'd like to make any changes to the config.sh file before I begin
16935to configure things, do it as a shell escape now (e.g. !vi config.sh).
16936
16937EOM
16938 rp="Press return or use a shell escape to edit config.sh:"
16939 . UU/myread
16940 nostick=''
16941 case "$ans" in
16942 '') ;;
16943 *) : in case they cannot read
16944 sh 1>&4 -c "$ans";;
16945 esac
16946 ;;
16947esac
16948
16949: if this fails, just run all the .SH files by hand
16950. ./config.sh
16951
16952echo " "
16953exec 1>&4
16954. ./UU/extract
16955
16956if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16957 dflt=y
16958 case "$silent" in
16959 true) ;;
16960 *)
16961 $cat <<EOM
16962
16963Now you need to generate make dependencies by running "$make depend".
16964You might prefer to run it in background: "$make depend > makedepend.out &"
16965It can take a while, so you might not want to run it right now.
16966
16967EOM
16968 ;;
16969 esac
16970 rp="Run $make depend now?"
16971 . UU/myread
16972 case "$ans" in
16973 y*)
3d5d58b1 16974 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
16975 ;;
16976 *)
16977 echo "You must run '$make depend' then '$make'."
16978 ;;
16979 esac
16980elif test -f [Mm]akefile; then
16981 echo " "
16982 echo "Now you must run a $make."
16983else
16984 echo "Done."
16985fi
16986
16987if $test -f Policy.sh; then
16988 $cat <<EOM
16989
16990If you compile $package on a different machine or from a different object
16991directory, copy the Policy.sh file from this object directory to the
16992new one before you run Configure -- this will help you with most of
16993the policy defaults.
16994
16995EOM
16996fi
16997if $test -f config.msg; then
16998 echo "Hmm. I also noted the following information while running:"
16999 echo " "
17000 $cat config.msg >&4
17001 $rm -f config.msg
17002fi
17003$rm -f kit*isdone ark*isdone
17004$rm -rf UU
17005
17006: End of Configure
17007