This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Changes.
[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#
d0e6d399 23# Generated on Fri Dec 15 04:41:40 EET 2000 [metaconfig 3.0 PL70]
7f2de2d2 24# (with additional metaconfig patches by perlbug@perl.org)
2304df62 25
283fdd21 26cat >c1$$ <<EOF
2304df62
AD
27ARGGGHHHH!!!!!
28
29SCO csh still thinks true is false. Write to SCO today and tell them that next
30year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
33we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35[End of diatribe. We now return you to your regularly scheduled programming...]
36EOF
283fdd21 37cat >c2$$ <<EOF
2304df62
AD
38
39OOPS! You naughty creature! You didn't run Configure with sh!
40I will attempt to remedy the situation by running sh for you...
41EOF
42
283fdd21 43true || cat c1$$ c2$$
2304df62
AD
44true || exec sh $0 $argv:q
45
283fdd21 46(exit $?0) || cat c2$$
2304df62 47(exit $?0) || exec sh $0 $argv:q
283fdd21 48rm -f c1$$ c2$$
2304df62 49
a0d0e21e
LW
50: compute my invocation name
51me=$0
52case "$0" in
53*/*)
54 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55 test "$me" || me=$0
56 ;;
57esac
58
dfe9444c 59: Proper separator for the PATH environment variable
8e07c86e
AD
60p_=:
61: On OS/2 this directory should exist if this is not floppy only system :-]
dfe9444c
AD
62if test -d c:/. ; then
63 if test -n "$OS2_SHELL"; then
64 p_=\;
65 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
c4f23d77 67 elif test -n "$DJGPP"; then
dfe9444c
AD
68 p_=\;
69 fi
39e571d4 70fi
a0d0e21e
LW
71
72: Proper PATH setting
73paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 74paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 75paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 76paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e
AD
77paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80paths="$paths /sbin /usr/sbin /usr/libexec"
a0d0e21e
LW
81
82for p in $paths
83do
8e07c86e
AD
84 case "$p_$PATH$p_" in
85 *$p_$p$p_*) ;;
86 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
87 esac
88done
89
8e07c86e 90PATH=.$p_$PATH
2304df62
AD
91export PATH
92
dfe9444c
AD
93: shall we be using ksh?
94inksh=''
95needksh=''
96avoidksh=''
97newsh=/bin/ksh
98changesh=''
ff0cee69 99if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
100 inksh=true
101fi
102if test -f /hp-ux -a -f /bin/ksh; then
103 needksh='to avoid sh bug in "here document" expansion'
104fi
105if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106 if test X`/usr/bin/uname -v` = X4; then
107 avoidksh="to avoid AIX 4's /bin/sh"
108 newsh=/usr/bin/bsh
2304df62 109 fi
dfe9444c 110fi
cf04f91f
JH
111if test -f /osf_boot -a -f /usr/sbin/setld; then
112 if test X`/usr/bin/uname -s` = XOSF1; then
113 avoidksh="to avoid Digital UNIX' ksh"
114 newsh=/bin/sh
115 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116 fi
117fi
dfe9444c
AD
118case "$inksh/$needksh" in
119/[a-z]*)
c4f23d77 120 ENV=''
dfe9444c
AD
121 changesh=true
122 reason="$needksh"
123 ;;
124esac
125case "$inksh/$avoidksh" in
126true/[a-z]*)
127 changesh=true
128 reason="$avoidksh"
129 ;;
130esac
131case "$inksh/$needksh-$avoidksh-" in
132true/--)
a0d0e21e
LW
133 cat <<EOM
134(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 135mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 136EOM
dfe9444c
AD
137 ;;
138esac
139case "$changesh" in
140true)
141 echo "(Feeding myself to $newsh $reason.)"
142 case "$0" in
143 Configure|*/Configure) exec $newsh $0 "$@";;
144 *) exec $newsh Configure "$@";;
145 esac
146 ;;
147esac
2304df62 148
bfb7748a
AD
149: if needed set CDPATH to a harmless value that is not chatty
150: avoid bash 2.02 problems with empty CDPATH.
151case "$CDPATH" in
152'') ;;
153*) case "$SHELL" in
154 *bash*) CDPATH='.' ;;
155 *) CDPATH='' ;;
156 esac
157 ;;
158esac
2304df62
AD
159: Configure runs within the UU subdirectory
160test -d UU || mkdir UU
8e07c86e 161cd UU && rm -f ./*
2304df62 162
6b356c8e
JH
163ccname=''
164ccversion=''
b4eb6b3d
JH
165ccsymbols=''
166cppccsymbols=''
167cppsymbols=''
9c839522 168perllibs=''
b4eb6b3d
JH
169dynamic_ext=''
170extensions=''
171known_extensions=''
172nonxs_ext=''
173static_ext=''
174useopcode=''
175useposix=''
ecfc5424 176d_bsd=''
40a7a20a 177d_eunice=''
2304df62
AD
178d_xenix=''
179eunicefix=''
180Mcc=''
dfe9444c 181ar=''
2304df62
AD
182awk=''
183bash=''
184bison=''
185byacc=''
186cat=''
187chgrp=''
188chmod=''
189chown=''
ecfc5424 190comm=''
2304df62
AD
191compress=''
192cp=''
193cpio=''
194cpp=''
195csh=''
196date=''
197echo=''
198egrep=''
199emacs=''
200expr=''
201find=''
202flex=''
2304df62 203grep=''
8ff267be 204gzip=''
2304df62
AD
205inews=''
206ksh=''
207less=''
208line=''
209lint=''
210ln=''
211lp=''
212lpr=''
213ls=''
214mail=''
215mailx=''
dfe9444c 216make=''
2304df62
AD
217mkdir=''
218more=''
219mv=''
693762b4 220nm=''
2304df62
AD
221nroff=''
222perl=''
223pg=''
224pmake=''
225pr=''
226rm=''
227rmail=''
228sed=''
229sendmail=''
2304df62
AD
230shar=''
231sleep=''
232smail=''
233sort=''
234submit=''
235tail=''
236tar=''
237tbl=''
693762b4 238tee=''
2304df62
AD
239test=''
240touch=''
241tr=''
242troff=''
243uname=''
244uniq=''
245uuname=''
246vi=''
247zcat=''
8ff267be 248zip=''
b4eb6b3d
JH
249full_ar=''
250full_sed=''
a0d0e21e 251libswanted=''
2304df62
AD
252hint=''
253myuname=''
85e6fe83
LW
254osname=''
255osvers=''
2304df62
AD
256Author=''
257Date=''
258Header=''
259Id=''
260Locker=''
261Log=''
262RCSfile=''
263Revision=''
264Source=''
265State=''
dfe9444c
AD
266_a=''
267_exe=''
268_o=''
4633a7c4
LW
269archobjs=''
270exe_ext=''
271firstmakefile=''
272lib_ext=''
273obj_ext=''
274path_sep=''
b4eb6b3d
JH
275afs=''
276alignbytes=''
277ansi2knr=''
278archlib=''
279archlibexp=''
280d_archlib=''
281installarchlib=''
282archname=''
283myarchname=''
284d_atolf=''
285d_atoll=''
286baserev=''
287bin=''
288binexp=''
289installbin=''
290bincompat5005=''
291d_bincompat5005=''
292byteorder=''
2304df62 293cc=''
2304df62
AD
294ccflags=''
295cppflags=''
296ldflags=''
297lkflags=''
8e07c86e 298locincpth=''
2304df62 299optimize=''
b4eb6b3d 300cf_email=''
2304df62
AD
301cf_by=''
302cf_time=''
b4eb6b3d 303charsize=''
2304df62 304contains=''
b4eb6b3d 305cpp_stuff=''
2304df62
AD
306cpplast=''
307cppminus=''
308cpprun=''
309cppstdin=''
b4eb6b3d 310crosscompile=''
74cac757 311d__fwalk=''
b4eb6b3d
JH
312d_access=''
313d_accessx=''
314d_alarm=''
315d_attribut=''
316d_bcmp=''
317d_bcopy=''
318d_bzero=''
319d_casti32=''
320castflags=''
321d_castneg=''
322d_chown=''
323d_chroot=''
324d_chsize=''
325d_closedir=''
326d_void_closedir=''
327d_const=''
328cryptlib=''
329d_crypt=''
330d_csh=''
331full_csh=''
332d_cuserid=''
333d_dbl_dig=''
334d_difftime=''
335d_dlerror=''
a0d0e21e 336d_dlopen=''
b4eb6b3d
JH
337d_dlsymun=''
338d_dosuid=''
339d_suidsafe=''
340d_drand48proto=''
341d_dup2=''
342d_eaccess=''
343d_endgrent=''
344d_endhent=''
345d_endnent=''
346d_endpent=''
347d_endpwent=''
348d_endsent=''
349d_fchmod=''
350d_fchown=''
351d_fcntl=''
9d9004a9 352d_fcntl_can_lock=''
b4eb6b3d
JH
353d_fd_macros=''
354d_fd_set=''
355d_fds_bits=''
356d_fgetpos=''
357d_flexfnam=''
358d_flock=''
359d_fork=''
360d_fpos64_t=''
361d_frexpl=''
362d_fs_data_s=''
363d_fseeko=''
364d_fsetpos=''
365d_fstatfs=''
411ab01c 366d_fsync=''
b4eb6b3d
JH
367d_ftello=''
368d_ftime=''
369d_gettimeod=''
370d_Gconvert=''
371d_getcwd=''
372d_getespwnam=''
373d_getfsstat=''
374d_getgrent=''
375d_getgrps=''
376d_gethbyaddr=''
377d_gethbyname=''
378d_gethent=''
379aphostname=''
380d_gethname=''
381d_phostname=''
382d_uname=''
383d_gethostprotos=''
384d_getlogin=''
385d_getmnt=''
386d_getmntent=''
387d_getnbyaddr=''
388d_getnbyname=''
389d_getnent=''
390d_getnetprotos=''
0c0643d0 391d_getpagsz=''
b4eb6b3d
JH
392d_getpent=''
393d_getpgid=''
394d_getpgrp2=''
395d_bsdgetpgrp=''
396d_getpgrp=''
397d_getppid=''
398d_getprior=''
399d_getpbyname=''
400d_getpbynumber=''
401d_getprotoprotos=''
402d_getprpwnam=''
403d_getpwent=''
404d_getsent=''
405d_getservprotos=''
406d_getspnam=''
407d_getsbyname=''
408d_getsbyport=''
a4f3eea9 409d_gnulibc=''
b4eb6b3d
JH
410d_hasmntopt=''
411d_htonl=''
412d_iconv=''
413d_inetaton=''
414d_int64_t=''
415d_isascii=''
416d_isnan=''
417d_isnanl=''
418d_killpg=''
419d_lchown=''
420d_ldbl_dig=''
421d_link=''
422d_locconv=''
423d_lockf=''
424d_longdbl=''
425longdblsize=''
426d_longlong=''
427longlongsize=''
428d_lseekproto=''
429d_lstat=''
430d_madvise=''
431d_mblen=''
432d_mbstowcs=''
433d_mbtowc=''
434d_memchr=''
435d_memcmp=''
436d_memcpy=''
437d_memmove=''
438d_memset=''
439d_mkdir=''
440d_mkdtemp=''
441d_mkfifo=''
442d_mkstemp=''
443d_mkstemps=''
444d_mktime=''
445d_mmap=''
446mmaptype=''
447d_modfl=''
448d_mprotect=''
449d_msg=''
450d_msgctl=''
451d_msgget=''
452d_msgrcv=''
453d_msgsnd=''
454d_msync=''
455d_munmap=''
456d_nice=''
457d_off64_t=''
458d_open3=''
459d_fpathconf=''
460d_pathconf=''
461d_pause=''
462d_pipe=''
463d_poll=''
2304df62 464d_portable=''
b4eb6b3d
JH
465d_old_pthread_create_joinable=''
466old_pthread_create_joinable=''
467d_pthread_yield=''
468d_sched_yield=''
469sched_yield=''
470d_qgcvt=''
471d_readdir=''
472d_rewinddir=''
473d_seekdir=''
474d_telldir=''
475d_readlink=''
476d_rename=''
477d_rmdir=''
478d_safebcpy=''
479d_safemcpy=''
480d_sanemcmp=''
ef9f17be 481d_sbrkproto=''
b4eb6b3d
JH
482d_select=''
483d_sem=''
484d_semctl=''
485d_semget=''
486d_semop=''
487d_setegid=''
488d_seteuid=''
489d_setgrent=''
490d_setgrps=''
491d_sethent=''
492d_setlinebuf=''
493d_setlocale=''
494d_setnent=''
495d_setpent=''
496d_setpgid=''
497d_setpgrp2=''
498d_bsdsetpgrp=''
499d_setpgrp=''
500d_setprior=''
501d_setproctitle=''
502d_setpwent=''
503d_setregid=''
504d_setresgid=''
505d_setresuid=''
506d_setreuid=''
507d_setrgid=''
508d_setruid=''
509d_setsent=''
510d_setsid=''
511d_setvbuf=''
512d_sfio=''
513usesfio=''
514d_shm=''
515d_shmat=''
516d_shmatprototype=''
517shmattype=''
518d_shmctl=''
519d_shmdt=''
520d_shmget=''
521d_sigaction=''
522d_sigsetjmp=''
523d_msg_ctrunc=''
524d_msg_dontroute=''
525d_msg_oob=''
526d_msg_peek=''
527d_msg_proxy=''
528d_oldsock=''
529d_scm_rights=''
530d_socket=''
531d_sockpair=''
532sockethdr=''
533socketlib=''
534d_socklen_t=''
535d_socks5_init=''
536d_sqrtl=''
537d_statblks=''
538d_statfs_f_flags=''
539d_statfs_s=''
540d_fstatvfs=''
541d_statvfs=''
542d_stdio_cnt_lval=''
543d_stdio_ptr_lval=''
a7ffa9b9
NC
544d_stdio_ptr_lval_nochange_cnt=''
545d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
546d_stdiobase=''
547d_stdstdio=''
548stdio_base=''
549stdio_bufsiz=''
550stdio_cnt=''
551stdio_filbuf=''
552stdio_ptr=''
553d_index=''
554d_strchr=''
555d_strcoll=''
556d_strctcpy=''
557d_strerrm=''
558d_strerror=''
559d_sysernlst=''
560d_syserrlst=''
561d_strtod=''
562d_strtol=''
563d_strtold=''
564d_strtoll=''
d0e6d399 565d_strtoq=''
b4eb6b3d
JH
566d_strtoul=''
567d_strtoull=''
568d_strtouq=''
569d_strxfrm=''
570d_symlink=''
571d_syscall=''
572d_sysconf=''
573d_system=''
574d_tcgetpgrp=''
575d_tcsetpgrp=''
576d_telldirproto=''
577d_time=''
578timetype=''
579clocktype=''
580d_times=''
581d_truncate=''
582d_tzname=''
583d_umask=''
584d_semctl_semid_ds=''
585d_semctl_semun=''
586d_union_semun=''
587d_ustat=''
588d_vfork=''
589usevfork=''
590d_voidsig=''
591signal_t=''
592d_volatile=''
593d_charvspr=''
594d_vprintf=''
595d_wait4=''
596d_waitpid=''
597d_wcstombs=''
598d_wctomb=''
599dlext=''
85e6fe83
LW
600cccdlflags=''
601ccdlflags=''
2304df62 602dlsrc=''
232e078e 603ld=''
85e6fe83 604lddlflags=''
2304df62 605usedl=''
b4eb6b3d
JH
606doublesize=''
607ebcdic=''
608fflushNULL=''
609fflushall=''
610fpossize=''
611fpostype=''
5b463ca7 612gccosandvers=''
8a27cf78 613gccversion=''
b4eb6b3d
JH
614gidformat=''
615gidsign=''
616gidsize=''
617gidtype=''
618groupstype=''
619h_fcntl=''
620h_sysfile=''
621i_arpainet=''
622db_hashtype=''
623db_prefixtype=''
624i_db=''
625i_dbm=''
626i_rpcsvcdbm=''
627d_dirnamlen=''
628direntrytype=''
629i_dirent=''
a0d0e21e 630i_dld=''
b4eb6b3d
JH
631i_dlfcn=''
632i_fcntl=''
633i_float=''
634i_gdbm=''
635d_grpasswd=''
636i_grp=''
637i_iconv=''
638i_ieeefp=''
639i_inttypes=''
640i_libutil=''
641i_limits=''
642i_locale=''
643i_machcthr=''
644i_malloc=''
645i_math=''
646i_memory=''
647i_mntent=''
648i_ndbm=''
649i_netdb=''
650i_neterrno=''
651i_netinettcp=''
652i_niin=''
653i_sysin=''
654i_poll=''
655i_prot=''
656i_pthread=''
657d_pwage=''
658d_pwchange=''
659d_pwclass=''
660d_pwcomment=''
661d_pwexpire=''
662d_pwgecos=''
663d_pwpasswd=''
664d_pwquota=''
665i_pwd=''
666i_sfio=''
667i_shadow=''
668i_socks=''
669i_stddef=''
670i_stdlib=''
671i_string=''
672strings=''
673i_sunmath=''
674i_sysaccess=''
675i_sysdir=''
676i_sysfile=''
677d_voidtty=''
678i_bsdioctl=''
679i_sysfilio=''
680i_sysioctl=''
681i_syssockio=''
682i_syslog=''
683i_sysmman=''
684i_sysmode=''
685i_sysmount=''
686i_sysndir=''
687i_sysparam=''
688i_sysresrc=''
689i_syssecrt=''
690i_sysselct=''
691i_sysstat=''
692i_sysstatfs=''
693i_sysstatvfs=''
694i_systimes=''
695i_systypes=''
696i_sysuio=''
697i_sysun=''
698i_sysutsname=''
699i_sysvfs=''
700i_syswait=''
701i_sgtty=''
702i_termio=''
703i_termios=''
704i_systime=''
705i_systimek=''
706i_time=''
707timeincl=''
708i_unistd=''
709i_ustat=''
710i_utime=''
711i_values=''
712i_stdarg=''
713i_varargs=''
714i_varhdr=''
715i_vfork=''
716inc_version_list=''
717inc_version_list_init=''
718installprefix=''
719installprefixexp=''
720installstyle=''
721installusrbinperl=''
722intsize=''
723longsize=''
724shortsize=''
2304df62 725libc=''
b4eb6b3d
JH
726ldlibpthname=''
727libperl=''
728shrpenv=''
729useshrplib=''
a0d0e21e 730glibpth=''
2304df62 731libpth=''
8e07c86e 732loclibpth=''
2304df62
AD
733plibpth=''
734xlibpth=''
1cfa4ec7 735ignore_versioned_solibs=''
2304df62 736libs=''
43999f95
JH
737libsdirs=''
738libsfiles=''
739libsfound=''
13b3f787 740libspath=''
85e6fe83 741lns=''
b4eb6b3d
JH
742d_PRIEUldbl=''
743d_PRIFUldbl=''
744d_PRIGUldbl=''
745d_PRIeldbl=''
746d_PRIfldbl=''
747d_PRIgldbl=''
748d_SCNfldbl=''
749sPRIEUldbl=''
750sPRIFUldbl=''
751sPRIGUldbl=''
752sPRIeldbl=''
753sPRIfldbl=''
754sPRIgldbl=''
755sSCNfldbl=''
756lseeksize=''
757lseektype=''
8ff267be 758make_set_make=''
b4eb6b3d
JH
759d_mymalloc=''
760freetype=''
761mallocobj=''
762mallocsrc=''
763malloctype=''
764usemymalloc=''
765installman1dir=''
766man1dir=''
767man1direxp=''
768man1ext=''
769installman3dir=''
770man3dir=''
771man3direxp=''
772man3ext=''
773modetype=''
774multiarch=''
775mydomain=''
776myhostname=''
777phostname=''
2304df62
AD
778c=''
779n=''
b4eb6b3d
JH
780d_eofnblk=''
781eagain=''
782o_nonblock=''
783rd_nodata=''
2cc61e15 784need_va_copy=''
b4eb6b3d
JH
785netdb_hlen_type=''
786netdb_host_type=''
787netdb_name_type=''
788netdb_net_type=''
789groupcat=''
790hostcat=''
791passcat=''
792orderlib=''
793ranlib=''
794d_perl_otherlibdirs=''
795otherlibdirs=''
2304df62
AD
796package=''
797spackage=''
b4eb6b3d
JH
798pager=''
799api_revision=''
800api_subversion=''
801api_version=''
802api_versionstring=''
803patchlevel=''
804revision=''
805subversion=''
806version=''
807perl5=''
808perladmin=''
809perlpath=''
810d_nv_preserves_uv=''
811d_nv_preserves_uv_bits=''
812i16size=''
813i16type=''
814i32size=''
815i32type=''
816i64size=''
817i64type=''
818i8size=''
819i8type=''
820ivsize=''
821ivtype=''
822nvsize=''
823nvtype=''
824u16size=''
825u16type=''
826u32size=''
827u32type=''
828u64size=''
829u64type=''
830u8size=''
831u8type=''
832uvsize=''
833uvtype=''
834ivdformat=''
835nvEUformat=''
836nvFUformat=''
837nvGUformat=''
838nveformat=''
839nvfformat=''
840nvgformat=''
841uvXUformat=''
842uvoformat=''
843uvuformat=''
844uvxformat=''
845pidtype=''
846prefix=''
847prefixexp=''
848installprivlib=''
849privlib=''
850privlibexp=''
851prototype=''
852ptrsize=''
853d_PRIXU64=''
854d_PRId64=''
855d_PRIi64=''
856d_PRIo64=''
857d_PRIu64=''
858d_PRIx64=''
859sPRIXU64=''
860sPRId64=''
861sPRIi64=''
862sPRIo64=''
863sPRIu64=''
864sPRIx64=''
865d_quad=''
866quadkind=''
867quadtype=''
868uquadtype=''
869drand01=''
870randbits=''
871randfunc=''
872randseedtype=''
873seedfunc=''
874installscript=''
875scriptdir=''
876scriptdirexp=''
877selectminbits=''
878selecttype=''
8ff267be 879sh=''
b4eb6b3d
JH
880sig_count=''
881sig_name=''
882sig_name_init=''
883sig_num=''
884sig_num_init=''
885installsitearch=''
886sitearch=''
887sitearchexp=''
888installsitebin=''
889sitebin=''
890sitebinexp=''
891installsitelib=''
892sitelib=''
893sitelib_stem=''
894sitelibexp=''
895siteprefix=''
896siteprefixexp=''
897sizesize=''
898sizetype=''
a0d0e21e 899so=''
b4eb6b3d 900socksizetype=''
2304df62
AD
901sharpbang=''
902shsharp=''
903spitshell=''
dfe9444c 904src=''
b4eb6b3d
JH
905ssizetype=''
906startperl=''
2304df62 907startsh=''
b4eb6b3d
JH
908stdchar=''
909d_stdio_stream_array=''
910stdio_stream_array=''
911sysman=''
5ff3f7a4 912trnl=''
b4eb6b3d
JH
913uidformat=''
914uidsign=''
915uidsize=''
916uidtype=''
917archname64=''
918use64bitall=''
919use64bitint=''
920ccflags_uselargefiles=''
921ldflags_uselargefiles=''
922libswanted_uselargefiles=''
923uselargefiles=''
924uselongdouble=''
925usemorebits=''
926usemultiplicity=''
2304df62 927nm_opt=''
40a7a20a 928nm_so_opt=''
2304df62
AD
929runnm=''
930usenm=''
b4eb6b3d 931useperlio=''
29209bc5 932usesocks=''
b4eb6b3d
JH
933d_oldpthreads=''
934use5005threads=''
935useithreads=''
936usethreads=''
2304df62 937incpath=''
2304df62
AD
938mips_type=''
939usrinc=''
b4eb6b3d
JH
940d_vendorarch=''
941installvendorarch=''
942vendorarch=''
943vendorarchexp=''
944d_vendorbin=''
945installvendorbin=''
946vendorbin=''
947vendorbinexp=''
948d_vendorlib=''
949installvendorlib=''
950vendorlib=''
951vendorlib_stem=''
952vendorlibexp=''
953usevendorprefix=''
954vendorprefix=''
955vendorprefixexp=''
d56c5707 956versiononly=''
b4eb6b3d
JH
957defvoidused=''
958voidflags=''
959pm_apiversion=''
960xs_apiversion=''
2304df62
AD
961CONFIG=''
962
ecfc5424
AD
963define='define'
964undef='undef'
965smallmach='pdp11 i8086 z8000 i80286 iAPX286'
966rmlist=''
967
968: We must find out about Eunice early
969eunicefix=':'
970if test -f /etc/unixtovms; then
971 eunicefix=/etc/unixtovms
972fi
973if test -f /etc/unixtovms.exe; then
974 eunicefix=/etc/unixtovms.exe
975fi
976
b4eb6b3d 977i_whoami=''
6b356c8e
JH
978ccname=''
979ccversion=''
9c839522 980perllibs=''
b4eb6b3d
JH
981: set useposix=false in your hint file to disable the POSIX extension.
982useposix=true
983: set useopcode=false in your hint file to disable the Opcode extension.
984useopcode=true
dfe9444c 985: Trailing extension. Override this in a hint file, if needed.
4e2a5f63 986_exe=''
dfe9444c
AD
987: Extra object files, if any, needed on this platform.
988archobjs=''
b4eb6b3d 989archname=''
ff935051
JH
990: Possible local include directories to search.
991: Set locincpth to "" in a hint file to defeat local include searches.
992locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
993locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
994:
995: no include file wanted by default
996inclwanted=''
997
b4eb6b3d 998groupstype=''
732c9516
JH
999: change the next line if compiling for Xenix/286 on Xenix/386
1000xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1001: Possible local library directories to search.
1002loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1003loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1004
1005: general looking path for locating libraries
5869b1f1 1006glibpth="/lib /usr/lib $xlibpth"
732c9516 1007glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1008test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1009test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1010
1011: Private path used by Configure to find libraries. Its value
1012: is prepended to libpth. This variable takes care of special
1013: machines, like the mips. Usually, it should be empty.
1014plibpth=''
1015
1cfa4ec7
GS
1016: default library list
1017libswanted=''
921b2963 1018: some systems want to use only the non-versioned libso:s
1cfa4ec7 1019ignore_versioned_solibs=''
b4eb6b3d
JH
1020archname64=''
1021ccflags_uselargefiles=''
1022ldflags_uselargefiles=''
1023libswanted_uselargefiles=''
1024: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1025: set usesocks on the Configure command line to enable socks.
b4eb6b3d
JH
1026: set usethreads on the Configure command line to enable threads.
1027: full support for void wanted by default
1028defvoidused=15
1029
ecfc5424 1030: List of libraries we want.
693762b4 1031: If anyone needs -lnet, put it in a hint file.
997d70a2 1032libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
69e84d1d 1033libswanted="$libswanted dld ld sun m c cposix posix"
f1066039 1034libswanted="$libswanted ndir dir crypt sec"
0c9177ab 1035libswanted="$libswanted ucb bsd BSD PW x iconv util"
1aef975c 1036: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1037: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1038glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1039glibpth="/usr/shlib $glibpth"
1040: Do not use vfork unless overridden by a hint file.
1041usevfork=false
1042
8ff267be 1043: Find the basic shell for Bourne shell scripts
1044case "$sh" in
1045'')
8ff267be 1046 case "$SYSTYPE" in
1047 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1048 *) xxx='/bin/sh';;
1049 esac
1050 if test -f "$xxx"; then
1051 sh="$xxx"
1052 else
1053 : Build up a list and do a single loop so we can 'break' out.
1054 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1055 for xxx in sh bash ksh pdksh ash; do
1056 for p in $pth; do
1057 try="$try ${p}/${xxx}"
1058 done
1059 done
1060 for xxx in $try; do
1061 if test -f "$xxx"; then
1062 sh="$xxx";
8ff267be 1063 break
1064 elif test -f "$xxx.exe"; then
1065 sh="$xxx";
8ff267be 1066 break
1067 fi
1068 done
1069 fi
1070 ;;
1071esac
1072
1073case "$sh" in
1074'') cat <<EOM >&2
1075$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1076
8ff267be 1077Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1078Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1079we'll try to straighten this all out.
8ff267be 1080EOM
1081 exit 1
1082 ;;
1083esac
1084
760ac839 1085: see if sh knows # comments
8ff267be 1086if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1087 shsharp=true
1088 spitshell=cat
760ac839
LW
1089 xcat=/bin/cat
1090 test -f $xcat || xcat=/usr/bin/cat
1091 echo "#!$xcat" >try
1092 $eunicefix try
1093 chmod +x try
1094 ./try > today
1095 if test -s today; then
760ac839
LW
1096 sharpbang='#!'
1097 else
1098 echo "#! $xcat" > try
1099 $eunicefix try
1100 chmod +x try
1101 ./try > today
1102 if test -s today; then
760ac839
LW
1103 sharpbang='#! '
1104 else
760ac839
LW
1105 sharpbang=': use '
1106 fi
1107 fi
1108else
dfe9444c 1109 echo " "
8ff267be 1110 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1111 shsharp=false
1112 cd ..
1113 echo "exec grep -v '^[ ]*#'" >spitshell
1114 chmod +x spitshell
1115 $eunicefix spitshell
1116 spitshell=`pwd`/spitshell
1117 cd UU
1118 echo "I presume that if # doesn't work, #! won't work either!"
1119 sharpbang=': use '
1120fi
1121rm -f try today
1122
1123: figure out how to guarantee sh startup
8ff267be 1124case "$startsh" in
1125'') startsh=${sharpbang}${sh} ;;
1126*)
760ac839 1127esac
760ac839
LW
1128cat >try <<EOSS
1129$startsh
1130set abc
1131test "$?abc" != 1
1132EOSS
1133
1134chmod +x try
1135$eunicefix try
1136if ./try; then
8ff267be 1137 : echo "Yup, it does."
760ac839 1138else
dfe9444c
AD
1139 echo "Hmm... '$startsh' does not guarantee sh startup..."
1140 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839
LW
1141fi
1142rm -f try
1143
aebf16e7
AD
1144
1145: Save command line options in file UU/cmdline.opt for later use in
1146: generating config.sh.
1147cat > cmdline.opt <<EOSH
1148# Configure command line arguments.
1149config_arg0='$0'
1150config_args='$*'
1151config_argc=$#
1152EOSH
1153argn=1
1154for arg in "$@"; do
1155 cat >>cmdline.opt <<EOSH
1156config_arg$argn='$arg'
1157EOSH
1158 argn=`expr $argn + 1`
1159done
1160
2304df62
AD
1161: produce awk script to parse command line options
1162cat >options.awk <<'EOF'
1163BEGIN {
02e93a22 1164 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1165
1166 len = length(optstr);
1167 for (i = 1; i <= len; i++) {
1168 c = substr(optstr, i, 1);
1169 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1170 if (a == ":") {
1171 arg[c] = 1;
1172 i++;
1173 }
1174 opt[c] = 1;
1175 }
1176}
1177{
1178 expect = 0;
1179 str = $0;
1180 if (substr(str, 1, 1) != "-") {
1181 printf("'%s'\n", str);
1182 next;
1183 }
1184 len = length($0);
1185 for (i = 2; i <= len; i++) {
1186 c = substr(str, i, 1);
1187 if (!opt[c]) {
1188 printf("-%s\n", substr(str, i));
1189 next;
1190 }
1191 printf("-%s\n", c);
1192 if (arg[c]) {
1193 if (i < len)
1194 printf("'%s'\n", substr(str, i + 1));
1195 else
1196 expect = 1;
1197 next;
1198 }
1199 }
1200}
1201END {
1202 if (expect)
1203 print "?";
1204}
1205EOF
1206
1207: process the command line options
4633a7c4
LW
1208set X `for arg in "$@"; do echo "X$arg"; done |
1209 sed -e s/X// | awk -f options.awk`
2304df62
AD
1210eval "set $*"
1211shift
1212rm -f options.awk
1213
1214: set up default values
1215fastread=''
1216reuseval=false
1217config_sh=''
1218alldone=''
1219error=''
1220silent=''
1221extractsh=''
ecfc5424 1222override=''
16d20bd9 1223knowitall=''
02e93a22 1224rm -f optdef.sh posthint.sh
28757baa 1225cat >optdef.sh <<EOS
1226$startsh
1227EOS
2304df62 1228
dfe9444c 1229
2304df62
AD
1230: option parsing
1231while test $# -gt 0; do
1232 case "$1" in
1233 -d) shift; fastread=yes;;
1234 -e) shift; alldone=cont;;
1235 -f)
1236 shift
1237 cd ..
1238 if test -r "$1"; then
1239 config_sh="$1"
1240 else
a0d0e21e 1241 echo "$me: cannot read config file $1." >&2
2304df62
AD
1242 error=true
1243 fi
1244 cd UU
1245 shift;;
1246 -h) shift; error=true;;
1247 -r) shift; reuseval=true;;
dfe9444c 1248 -s) shift; silent=true; realsilent=true;;
2304df62 1249 -E) shift; alldone=exit;;
16d20bd9 1250 -K) shift; knowitall=true;;
ecfc5424 1251 -O) shift; override=true;;
dfe9444c 1252 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1253 -D)
1254 shift
1255 case "$1" in
1256 *=)
1257 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1258 echo "$me: ignoring -D $1" >&2
1259 ;;
ecfc5424 1260 *=*) echo "$1" | \
1aef975c
AD
1261 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1262 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1263 esac
1264 shift
1265 ;;
1266 -U)
1267 shift
1268 case "$1" in
1aef975c 1269 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1270 *=*)
1271 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1272 echo "$me: ignoring -U $1" >&2
1273 ;;
1aef975c 1274 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1275 esac
1276 shift
1277 ;;
02e93a22
JH
1278 -A)
1279 shift
1280 xxx=''
1281 yyy="$1"
02e93a22 1282 zzz=''
5f83a3e9 1283 uuu=undef
02e93a22 1284 case "$yyy" in
5f83a3e9
JH
1285 *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1286 case "$zzz" in
1287 *:*) zzz='' ;;
1288 *) xxx=append
1289 zzz=" "`echo $yyy|sed 's!^[^=]*=!!'`
1290 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1291 esac
1292 ;;
1293 esac
1294 case "$xxx" in
1295 '') case "$yyy" in
1296 *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1297 yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1298 zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1299 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1300 *) xxx=`echo $yyy|sed 's!:.*!!'`
1301 yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1302 esac
1303 ;;
1304 esac
02e93a22
JH
1305 case "$xxx" in
1306 append)
5f83a3e9 1307 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1308 clear)
5f83a3e9 1309 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1310 define)
1311 case "$zzz" in
1312 '') zzz=define ;;
1313 esac
5f83a3e9 1314 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1315 eval)
5f83a3e9 1316 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1317 prepend)
5f83a3e9 1318 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1319 undef)
1320 case "$zzz" in
1321 '') zzz="$uuu" ;;
1322 esac
5f83a3e9
JH
1323 echo "$yyy=$zzz" >> posthint.sh ;;
1324 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1325 esac
bde6b06b 1326 shift
02e93a22 1327 ;;
dfe9444c 1328 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1329 exit 0;;
2304df62 1330 --) break;;
a0d0e21e 1331 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1332 *) break;;
1333 esac
1334done
1335
1336case "$error" in
1337true)
1338 cat >&2 <<EOM
2afac517 1339Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1340 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1341 -d : use defaults for all answers.
1342 -e : go on without questioning past the production of config.sh.
1343 -f : specify an alternate default configuration file.
1344 -h : print this help message and exit (with an error status).
1345 -r : reuse C symbols value if possible (skips costly nm extraction).
1346 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1347 -D : define symbol to have some value:
1348 -D symbol symbol gets the value 'define'
1349 -D symbol=value symbol gets the value 'value'
2304df62 1350 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1351 -K : do not use unless you know what you are doing.
ecfc5424 1352 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1353 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1354 -U : undefine symbol:
1355 -U symbol symbol gets the value 'undef'
1356 -U symbol= symbol gets completely empty
02e93a22 1357 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1358 -A symbol=value append " "value to symbol
02e93a22
JH
1359 -A append:symbol=value append value to symbol
1360 -A define:symbol=value define symbol to have value
02e93a22
JH
1361 -A clear:symbol define symbol to be ''
1362 -A define:symbol define symbol to be 'define'
1363 -A eval:symbol=value define symbol to be eval of value
1364 -A prepend:symbol=value prepend value to symbol
1365 -A undef:symbol define symbol to be 'undef'
1366 -A undef:symbol= define symbol to be ''
2304df62
AD
1367 -V : print version number and exit (with a zero status).
1368EOM
1369 exit 1
1370 ;;
1371esac
1372
dfe9444c
AD
1373: Sanity checks
1374case "$fastread$alldone" in
1375yescont|yesexit) ;;
1376*)
aaeb8e51
GS
1377 case "$extractsh" in
1378 true) ;;
1379 *)
1380 if test ! -t 0; then
1381 echo "Say 'sh Configure', not 'sh <Configure'"
1382 exit 1
1383 fi
1384 ;;
1385 esac
dfe9444c
AD
1386 ;;
1387esac
1388
2304df62
AD
1389exec 4>&1
1390case "$silent" in
1391true) exec 1>/dev/null;;
1392esac
1393
ecfc5424 1394: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1395touch optdef.sh
1396. ./optdef.sh
02e93a22
JH
1397: create the posthint manipulation script and leave the file out there...
1398touch posthint.sh
a0d0e21e 1399
2304df62 1400: set package name
85e6fe83 1401package=perl5
b4eb6b3d
JH
1402first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1403last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1404case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1405ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1406*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1407esac
2304df62 1408
2304df62
AD
1409: Some greps do not return status, grrr.
1410echo "grimblepritz" >grimble
1411if grep blurfldyick grimble >/dev/null 2>&1 ; then
1412 contains=contains
1413elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1414 contains=grep
1415else
1416 contains=contains
1417fi
1418rm -f grimble
1419: the following should work in any shell
1420case "$contains" in
1421contains*)
1422 echo " "
1423 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1424 cat >contains <<'EOSS'
1425grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1426EOSS
1427chmod +x contains
1428esac
1429
dfe9444c
AD
1430: Find the path to the source tree
1431case "$src" in
1432'') case "$0" in
b233458b
JH
1433 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1434 case "$src" in
1435 /*) ;;
1436 *) src=`cd ../$src && pwd` ;;
1437 esac
1438 ;;
dfe9444c
AD
1439 *) src='.';;
1440 esac;;
1441esac
1442case "$src" in
1443'') src=/
1444 rsrc=/
1445 ;;
1446/*) rsrc="$src";;
1447*) rsrc="../$src";;
1448esac
1449if test -f $rsrc/Configure && \
1450 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1451then
1452 : found it, so we are ok.
1453else
1454 rsrc=''
1455 for src in . .. ../.. ../../.. ../../../..; do
1456 if test -f ../$src/Configure && \
1457 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1458 then
1459 rsrc=../$src
1460 break
1461 fi
1462 done
1463fi
1464case "$rsrc" in
1465'')
1466 cat <<EOM >&4
1467
1468Sorry, I can't seem to locate the source dir for $package. Please start
1469Configure with an explicit path -- i.e. /some/path/Configure.
1470
1471EOM
1472 exit 1
1473 ;;
1474../.) rsrc='..';;
1475*)
1476 echo " "
1477 echo "Sources for $package found in \"$src\"." >&4
1478 ;;
1479esac
1480
1481: script used to extract .SH files with variable substitutions
1482cat >extract <<'EOS'
2000072c 1483CONFIGDOTSH=true
dfe9444c
AD
1484echo "Doing variable substitutions on .SH files..."
1485if test -f $src/MANIFEST; then
f7ab18e9 1486 set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
dfe9444c
AD
1487else
1488 echo "(Looking for .SH files under the source directory.)"
1489 set x `(cd $src; find . -name "*.SH" -print)`
1490fi
1491shift
1492case $# in
14930) set x `(cd $src; echo *.SH)`; shift;;
1494esac
1495if test ! -f $src/$1; then
1496 shift
1497fi
1498mkdir_p='
1499name=$1;
1500create="";
1501while test $name; do
1502 if test ! -d "$name"; then
1503 create="$name $create";
1504 name=`echo $name | sed -e "s|^[^/]*$||"`;
1505 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1506 else
1507 name="";
1508 fi;
1509done;
1510for file in $create; do
1511 mkdir $file;
1512done
1513'
1514for file in $*; do
1515 case "$src" in
1516 ".")
1517 case "$file" in
1518 */*)
1519 dir=`expr X$file : 'X\(.*\)/'`
1520 file=`expr X$file : 'X.*/\(.*\)'`
1521 (cd $dir && . ./$file)
1522 ;;
1523 *)
1524 . ./$file
1525 ;;
1526 esac
1527 ;;
1528 *)
1529 case "$file" in
1530 */*)
1531 dir=`expr X$file : 'X\(.*\)/'`
1532 file=`expr X$file : 'X.*/\(.*\)'`
1533 (set x $dir; shift; eval $mkdir_p)
1534 sh <$src/$dir/$file
1535 ;;
1536 *)
1537 sh <$src/$file
1538 ;;
1539 esac
1540 ;;
1541 esac
1542done
1543if test -f $src/config_h.SH; then
1544 if test ! -f config.h; then
1545 : oops, they left it out of MANIFEST, probably, so do it anyway.
1546 . $src/config_h.SH
1547 fi
1548fi
1549EOS
1550
1551: extract files and exit if asked to do so
1552case "$extractsh" in
1553true)
1554 case "$realsilent" in
1555 true) ;;
1556 *) exec 1>&4;;
1557 esac
1558 case "$config_sh" in
1559 '') config_sh='config.sh';;
1560 esac
1561 echo " "
1562 echo "Fetching answers from $config_sh..."
1563 cd ..
1564 . $config_sh
1565 test "$override" && . ./optdef.sh
1566 echo " "
1567 . UU/extract
1568 rm -rf UU
1569 echo "Done."
1570 exit 0
1571 ;;
1572esac
1573
1574: Eunice requires " " instead of "", can you believe it
1575echo " "
1576: Here we go...
1577echo "Beginning of configuration questions for $package."
1578
1579trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1580
2304df62
AD
1581: first determine how to suppress newline on echo command
1582echo " "
1583echo "Checking echo to see how to suppress newlines..."
1584(echo "hi there\c" ; echo " ") >.echotmp
1585if $contains c .echotmp >/dev/null 2>&1 ; then
1586 echo "...using -n."
1587 n='-n'
1588 c=''
1589else
1590 cat <<'EOM'
1591...using \c
1592EOM
1593 n=''
1594 c='\c'
1595fi
1596echo $n "The star should be here-->$c"
1597echo '*'
1598rm -f .echotmp
1599
1600: Now test for existence of everything in MANIFEST
1601echo " "
dfe9444c 1602if test -f $rsrc/MANIFEST; then
2304df62 1603 echo "First let's make sure your kit is complete. Checking..." >&4
dfe9444c 1604 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
2304df62 1605 rm -f missing
dfe9444c 1606 tmppwd=`pwd`
2304df62 1607 for filelist in x??; do
dfe9444c 1608 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
2304df62
AD
1609 done
1610 if test -s missing; then
1611 cat missing >&4
1612 cat >&4 <<'EOM'
1613
1614THIS PACKAGE SEEMS TO BE INCOMPLETE.
1615
1616You have the option of continuing the configuration process, despite the
1617distinct possibility that your kit is damaged, by typing 'y'es. If you
1618do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1619and contact the author (perlbug@perl.org).
2304df62
AD
1620
1621EOM
1622 echo $n "Continue? [n] $c" >&4
1623 read ans
1624 case "$ans" in
1625 y*)
1626 echo "Continuing..." >&4
1627 rm -f missing
1628 ;;
1629 *)
1630 echo "ABORTING..." >&4
1631 kill $$
1632 ;;
1633 esac
1634 else
dfe9444c 1635 echo "Looks good..."
2304df62
AD
1636 fi
1637else
1638 echo "There is no MANIFEST file. I hope your kit is complete !"
1639fi
1640rm -f missing x??
1641
5ff3f7a4
GS
1642echo " "
1643: Find the appropriate value for a newline for tr
1644if test -n "$DJGPP"; then
1645 trnl='\012'
1646fi
1647if test X"$trnl" = X; then
1648 case "`echo foo|tr '\n' x 2>/dev/null`" in
1649 foox) trnl='\n' ;;
1650 esac
1651fi
1652if test X"$trnl" = X; then
1653 case "`echo foo|tr '\012' x 2>/dev/null`" in
1654 foox) trnl='\012' ;;
1655 esac
1656fi
1657if test X"$trnl" = X; then
1658 cat <<EOM >&2
1659
1660$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1661
1662EOM
1663 exit 1
1664fi
1665
2304df62
AD
1666: compute the number of columns on the terminal for proper question formatting
1667case "$COLUMNS" in
1668'') COLUMNS='80';;
1669esac
1670
1671: set up the echo used in my read
1672myecho="case \"\$xxxm\" in
1673'') echo $n \"\$rp $c\" >&4;;
1674*) case \"\$rp\" in
1675 '') echo $n \"[\$xxxm] $c\";;
1676 *)
1677 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1678 echo \"\$rp\" >&4
1679 echo $n \"[\$xxxm] $c\" >&4
1680 else
1681 echo $n \"\$rp [\$xxxm] $c\" >&4
1682 fi
1683 ;;
1684 esac;;
1685esac"
1686
1687: now set up to do reads with possible shell escape and default assignment
1688cat <<EOSC >myread
28757baa 1689$startsh
2304df62
AD
1690xxxm=\$dflt
1691$myecho
1692ans='!'
1693case "\$fastread" in
1694yes) case "\$dflt" in
1695 '') ;;
1696 *) ans='';
1697 case "\$silent-\$rp" in
1698 true-) ;;
1699 *) echo " " >&4;;
1700 esac;;
1701 esac;;
1702*) case "\$silent" in
1703 true) case "\$rp" in
1704 '') ans='';;
1705 esac;;
1706 esac;;
1707esac
1708while expr "X\$ans" : "X!" >/dev/null; do
1709 read answ
1710 set x \$xxxm
1711 shift
dfe9444c 1712 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1713 case "\$answ" in
dfe9444c
AD
1714 "!")
1715 sh 1>&4
1716 echo " "
1717 $myecho
1718 ;;
1719 !*)
1720 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1721 shift
1722 sh 1>&4 -c "\$*"
1723 echo " "
1724 $myecho
1725 ;;
2304df62
AD
1726 "\$ans")
1727 case "\$ans" in
ecfc5424
AD
1728 \\&*)
1729 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1730 shift
1731 case "\$1" in
1732 -d)
1733 fastread=yes
40a7a20a 1734 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1735 ;;
1736 -*)
40a7a20a 1737 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1738 ;;
1739 esac
1740 $myecho
1741 ans=!
1742 ;;
2304df62
AD
1743 esac;;
1744 *)
1745 case "\$aok" in
1746 y)
1747 echo "*** Substitution done -- please confirm."
1748 xxxm="\$ans"
c9795ab7 1749 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1750 xxxm="\$ans"
1751 ans=!
1752 ;;
1753 *)
1754 echo "*** Error -- try again."
1755 ans=!
1756 ;;
1757 esac
1758 $myecho
1759 ;;
1760 esac
1761 case "\$ans\$xxxm\$nostick" in
1762 '')
1763 ans=!
1764 $myecho
1765 ;;
1766 esac
1767done
1768case "\$ans" in
1769'') ans="\$xxxm";;
1770esac
1771EOSC
1772
1773: create .config dir to save info across Configure sessions
1774test -d ../.config || mkdir ../.config
1775cat >../.config/README <<EOF
1776This directory created by Configure to save information that should
dfe9444c 1777persist across sessions for $package.
2304df62
AD
1778
1779You may safely delete it if you wish.
1780EOF
1781
9507cadf 1782xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 1783case "$usedevel" in
0107c034 1784$define|true|[yY]*) ;;
9507cadf 1785*) case "$xversion" in
0107c034
JH
1786 *[13579])
1787 cat >&4 <<EOH
1788*** WHOA THERE!!! ***
1789
1790 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
1791 The version of this $package distribution is $xversion, that is, odd,
1792 (as opposed to even) and that signifies a development release.
3d5d58b1 1793 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
1794
1795 Do ***NOT*** install this into production use.
1796 Data corruption and crashes are possible.
1797
1798 It is most seriously suggested that you do not continue any further
1799 unless you want to help in developing and debugging Perl.
1800
1801EOH
1802 rp='Do you really want to continue?'
1803 dflt='n'
1804 . ./myread
1805 case "$ans" in
1806 [yY]) echo >&4 "Okay, continuing." ;;
1807 *) echo >&4 "Okay, bye."
1808 exit 1
1809 ;;
1810 esac
1811 ;;
1812 esac
1813 ;;
1814esac
1815
2304df62
AD
1816: general instructions
1817needman=true
1818firsttime=true
760ac839 1819user=`(logname) 2>/dev/null`
dfe9444c
AD
1820case "$user" in
1821'') user=`whoami 2>&1`;;
760ac839 1822esac
2304df62
AD
1823if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1824 firsttime=false
1825 echo " "
1826 rp='Would you like to see the instructions?'
1827 dflt=n
1828 . ./myread
1829 case "$ans" in
1830 [yY]*) ;;
1831 *) needman=false;;
1832 esac
1833fi
1834if $needman; then
1835 cat <<EOH
4e2a5f63 1836
2304df62 1837This installation shell script will examine your system and ask you questions
a0d0e21e 1838to determine how the perl5 package should be installed. If you get
2304df62
AD
1839stuck on a question, you may use a ! shell escape to start a subshell or
1840execute a command. Many of the questions will have default answers in square
1841brackets; typing carriage return will give you the default.
1842
1843On some of the questions which ask for file or directory names you are allowed
1844to use the ~name construct to specify the login directory belonging to "name",
1845even if you don't have a shell which knows about that. Questions where this is
1846allowed will be marked "(~name ok)".
1847
1848EOH
1849 rp=''
1850 dflt='Type carriage return to continue'
1851 . ./myread
1852 cat <<'EOH'
1853
1854The prompter used in this script allows you to use shell variables and
1855backticks in your answers. You may use $1, $2, etc... to refer to the words
1856in the default answer, as if the default line was a set of arguments given to a
1857script shell. This means you may also use $* to repeat the whole default line,
1858so you do not have to re-type everything to add something to the default.
1859
1860Everytime there is a substitution, you will have to confirm. If there is an
1861error (e.g. an unmatched backtick), the default answer will remain unchanged
1862and you will be prompted again.
1863
1864If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1865the questions and use the computed defaults (or the previous answers if there
1866was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1867You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1868on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1869
1870EOH
1871 . ./myread
1872 cat <<EOH
1873
1874Much effort has been expended to ensure that this shell script will run on any
1875Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1876Configure and run it again. If you can't run Configure for some reason,
1877you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 1878have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
1879
1880This installation script affects things in two ways:
1881
18821) it may do direct variable substitutions on some of the files included
1883 in this kit.
18842) it builds a config.h file for inclusion in C programs. You may edit
1885 any of these files as the need arises after running this script.
1886
1887If you make a mistake on a question, there is no easy way to back up to it
1888currently. The easiest thing to do is to edit config.sh and rerun all the SH
1889files. Configure will offer to let you do this before it runs the SH files.
1890
1891EOH
1892 dflt='Type carriage return to continue'
1893 . ./myread
1894 case "$firsttime" in
1895 true) echo $user >>../.config/instruct;;
1896 esac
1897fi
1898
2304df62
AD
1899: find out where common programs are
1900echo " "
1901echo "Locating common programs..." >&4
1902cat <<EOSC >loc
1903$startsh
1904case \$# in
19050) exit 1;;
1906esac
1907thing=\$1
1908shift
1909dflt=\$1
1910shift
1911for dir in \$*; do
1912 case "\$thing" in
1913 .)
1914 if test -d \$dir/\$thing; then
1915 echo \$dir
1916 exit 0
1917 fi
1918 ;;
1919 *)
a0d0e21e 1920 for thisthing in \$dir/\$thing; do
ecfc5424 1921 : just loop through to pick last item
a0d0e21e 1922 done
25f94b33 1923 if test -f \$thisthing; then
a0d0e21e 1924 echo \$thisthing
2304df62
AD
1925 exit 0
1926 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
1927 if test -n "$DJGPP"; then
1928 echo \$dir/\$thing.exe
1929 else
1930 : on Eunice apparently
1931 echo \$dir/\$thing
1932 fi
2304df62
AD
1933 exit 0
1934 fi
1935 ;;
1936 esac
1937done
1938echo \$dflt
1939exit 1
1940EOSC
1941chmod +x loc
1942$eunicefix loc
1943loclist="
1944awk
1945cat
b4eb6b3d
JH
1946comm
1947cp
2304df62
AD
1948echo
1949expr
1950grep
a0d0e21e 1951ls
dfe9444c 1952make
b4eb6b3d 1953mkdir
2304df62
AD
1954rm
1955sed
b4eb6b3d 1956sort
85e6fe83 1957touch
2304df62 1958tr
b4eb6b3d 1959uniq
2304df62
AD
1960"
1961trylist="
1962Mcc
dfe9444c 1963ar
b4eb6b3d 1964byacc
2304df62 1965cpp
b4eb6b3d 1966csh
2304df62
AD
1967date
1968egrep
8ff267be 1969gzip
b4eb6b3d 1970less
8ff267be 1971ln
b4eb6b3d 1972more
693762b4 1973nm
b4eb6b3d
JH
1974nroff
1975pg
2304df62
AD
1976test
1977uname
8ff267be 1978zip
2304df62 1979"
8e07c86e 1980pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
1981pth="$pth /lib /usr/lib"
1982for file in $loclist; do
dfe9444c
AD
1983 eval xxx=\$$file
1984 case "$xxx" in
1985 /*|?:[\\/]*)
1986 if test -f "$xxx"; then
1987 : ok
1988 else
1989 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1990 xxx=`./loc $file $file $pth`
1991 fi
1992 ;;
1993 '') xxx=`./loc $file $file $pth`;;
1994 *) xxx=`./loc $xxx $xxx $pth`;;
1995 esac
2304df62
AD
1996 eval $file=$xxx
1997 eval _$file=$xxx
1998 case "$xxx" in
1999 /*)
2000 echo $file is in $xxx.
2001 ;;
8e07c86e
AD
2002 ?:[\\/]*)
2003 echo $file is in $xxx.
2004 ;;
2304df62 2005 *)
25f94b33
AD
2006 echo "I don't know where '$file' is, and my life depends on it." >&4
2007 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2008 exit 1
2304df62
AD
2009 ;;
2010 esac
2011done
2012echo " "
2013echo "Don't worry if any of the following aren't found..."
2014say=offhand
2015for file in $trylist; do
dfe9444c
AD
2016 eval xxx=\$$file
2017 case "$xxx" in
2018 /*|?:[\\/]*)
2019 if test -f "$xxx"; then
2020 : ok
2021 else
2022 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2023 xxx=`./loc $file $file $pth`
2024 fi
2025 ;;
2026 '') xxx=`./loc $file $file $pth`;;
2027 *) xxx=`./loc $xxx $xxx $pth`;;
2028 esac
2304df62
AD
2029 eval $file=$xxx
2030 eval _$file=$xxx
2031 case "$xxx" in
2032 /*)
2033 echo $file is in $xxx.
2034 ;;
8e07c86e
AD
2035 ?:[\\/]*)
2036 echo $file is in $xxx.
2037 ;;
2304df62
AD
2038 *)
2039 echo "I don't see $file out there, $say."
2040 say=either
2041 ;;
2042 esac
2043done
2044case "$egrep" in
2045egrep)
2046 echo "Substituting grep for egrep."
2047 egrep=$grep
2048 ;;
2049esac
8ff267be 2050case "$ln" in
2051ln)
2052 echo "Substituting cp for ln."
2053 ln=$cp
2054 ;;
2055esac
2304df62
AD
2056case "$test" in
2057test)
2058 echo "Hopefully test is built into your sh."
2059 ;;
2060*)
ecfc5424 2061 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2304df62
AD
2062 echo "Using the test built into your sh."
2063 test=test
2064 _test=test
2065 fi
2066 ;;
2067esac
2068case "$echo" in
2069echo)
2070 echo "Hopefully echo is built into your sh."
2071 ;;
2072'') ;;
2073*)
2074 echo " "
2075echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2076 $echo $n "hi there$c" >foo1
2077 echo $n "hi there$c" >foo2
2078 if cmp foo1 foo2 >/dev/null 2>&1; then
2079 echo "They are compatible. In fact, they may be identical."
2080 else
2081 case "$n" in
2082 '-n') n='' c='\c';;
2083 *) n='-n' c='';;
2084 esac
2085 cat <<FOO
2086They are not compatible! You are probably running ksh on a non-USG system.
2087I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2088have echo built in and we may have to run some Bourne shell scripts. That
2089means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2090
2091FOO
2092 $echo $n "The star should be here-->$c"
2093 $echo "*"
2094 fi
2095 $rm -f foo1 foo2
2096 ;;
2097esac
2098
2573c5f9
JH
2099cat <<EOS >checkcc
2100$startsh
2101EOS
2102cat <<'EOSC' >>checkcc
2103case "$cc" in
2104'') ;;
2105*) $rm -f try try.*
2106 $cat >try.c <<EOM
2107int main(int argc, char *argv[]) {
2108 return 0;
2109}
2110EOM
7a282f6d 2111 if $cc -o try $ccflags try.c; then
2573c5f9
JH
2112 :
2113 else
2114 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2115 despair=yes
2116 trygcc=yes
2117 case "$cc" in
2118 *gcc*) trygcc=no ;;
2119 esac
2120 case "`$cc -v -c try.c 2>&1`" in
2121 *gcc*) trygcc=no ;;
2122 esac
2123 if $test X"$trygcc" = Xyes; then
2124 if gcc -o try -c try.c; then
2125 echo " "
2126 echo "You seem to have a working gcc, though." >&4
2127 rp="Would you like to use it?"
2128 dflt=y
2129 if $test -f myread; then
2130 . ./myread
2131 else
2132 if $test -f UU/myread; then
2133 . ./UU/myread
2134 else
2135 echo "Cannot find myread, sorry. Aborting." >&2
2136 exit 1
2137 fi
2138 fi
2139 case "$ans" in
e723fc21 2140 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2573c5f9
JH
2141 esac
2142 fi
2143 fi
2144 if $test X"$despair" = Xyes; then
5dd4fbdf
MB
2145 $cat >&4 <<EOM
2146You need to find a working C compiler.
2147Either (purchase and) install the C compiler supplied by your OS vendor,
2148or for a free C compiler try http://gcc.gnu.org/
2149I cannot continue any further, aborting.
2150EOM
2573c5f9
JH
2151 exit 1
2152 fi
2153 fi
2154 $rm -f try try.*
2155 ;;
2156esac
2157EOSC
2158
a0d0e21e
LW
2159: determine whether symbolic links are supported
2160echo " "
2161$touch blurfl
2162if $ln -s blurfl sym > /dev/null 2>&1 ; then
2163 echo "Symbolic links are supported." >&4
2164 lns="$ln -s"
2165else
2166 echo "Symbolic links are NOT supported." >&4
2167 lns="$ln"
2168fi
2169$rm -f blurfl sym
2170
ecfc5424
AD
2171: see whether [:lower:] and [:upper:] are supported character classes
2172echo " "
ecfc5424
AD
2173case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2174ABYZ)
2175 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2176 up='[:upper:]'
2177 low='[:lower:]'
2178 ;;
28e8609d
JH
2179*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2180 # (0xc9 and 0xd1), therefore that is a nice testing point.
2181 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2182 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2183 ij) up='[A-Z]'
2184 low='[a-z]'
2185 ;;
2186 esac
2187 fi
2188 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2189 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2190 ij) up='A-Z'
2191 low='a-z'
2192 ;;
2193 esac
2194 fi
2195 if test "X$up" = X -o "X$low" = X; then
2196 case "`echo IJ | od -x 2>/dev/null`" in
2197 *C9D1*|*c9d1*)
2198 echo "Hey, this might be EBCDIC." >&4
2199 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2200 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2201 ij) up='[A-IJ-RS-Z]'
2202 low='[a-ij-rs-z]'
2203 ;;
2204 esac
2205 fi
2206 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2207 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2208 ij) up='A-IJ-RS-Z'
2209 low='a-ij-rs-z'
2210 ;;
2211 esac
2212 fi
2213 ;;
2214 esac
2215 fi
2216esac
3eaeeeae 2217case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2218ij)
2219 echo "Using $up and $low to convert case." >&4
2220 ;;
ecfc5424 2221*)
28e8609d
JH
2222 echo "I don't know how to translate letters from upper to lower case." >&4
2223 echo "Your tr is not acting any way I know of." >&4
2224 exit 1
2225 ;;
ecfc5424
AD
2226esac
2227: set up the translation script tr, must be called with ./tr of course
2228cat >tr <<EOSC
2229$startsh
2230case "\$1\$2" in
2231'[A-Z][a-z]') exec $tr '$up' '$low';;
2232'[a-z][A-Z]') exec $tr '$low' '$up';;
2233esac
2234exec $tr "\$@"
2235EOSC
2236chmod +x tr
2237$eunicefix tr
2238
2304df62
AD
2239: Try to determine whether config.sh was made on this system
2240case "$config_sh" in
2241'')
43999f95
JH
2242myuname=`$uname -a 2>/dev/null`
2243$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2244# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2245# because the A-Z/a-z are not consecutive.
a0d0e21e 2246myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2247 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2248newmyuname="$myuname"
2304df62 2249dflt=n
16d20bd9
AD
2250case "$knowitall" in
2251'')
2252 if test -f ../config.sh; then
2253 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2254 eval "`grep myuname= ../config.sh`"
2255 fi
2256 if test "X$myuname" = "X$newmyuname"; then
2257 dflt=y
2258 fi
2304df62 2259 fi
16d20bd9
AD
2260 ;;
2261*) dflt=y;;
2262esac
2304df62
AD
2263
2264: Get old answers from old config file if Configure was run on the
2265: same system, otherwise use the hints.
2266hint=default
2267cd ..
2268if test -f config.sh; then
16d20bd9
AD
2269 echo " "
2270 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2271 . UU/myread
2272 case "$ans" in
f83701cd
AD
2273 n*|N*) echo "OK, I'll ignore it."
2274 mv config.sh config.sh.old
2275 myuname="$newmyuname"
2276 ;;
2304df62 2277 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2278 tmp_n="$n"
2279 tmp_c="$c"
85cad39c 2280 tmp_sh="$sh"
2304df62
AD
2281 . ./config.sh
2282 cp config.sh UU
ecfc5424
AD
2283 n="$tmp_n"
2284 c="$tmp_c"
85cad39c 2285 : Older versions did not always set $sh. Catch re-use of such
2286 : an old config.sh.
2287 case "$sh" in
2288 '') sh="$tmp_sh" ;;
2289 esac
2304df62
AD
2290 hint=previous
2291 ;;
2292 esac
2293fi
2573c5f9 2294. ./UU/checkcc
2304df62
AD
2295if test ! -f config.sh; then
2296 $cat <<EOM
2297
4e2a5f63
AD
2298First time through, eh? I have some defaults handy for some systems
2299that need some extra help getting the Configure answers right:
2304df62
AD
2300
2301EOM
dfe9444c 2302 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2303 dflt=''
2304 : Half the following guesses are probably wrong... If you have better
7f2de2d2 2305 : tests or hints, please send them to perlbug@perl.org
2304df62 2306 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2307 $test -f /irix && osname=irix
85e6fe83
LW
2308 $test -f /xenix && osname=sco_xenix
2309 $test -f /dynix && osname=dynix
2310 $test -f /dnix && osname=dnix
5f05dabc 2311 $test -f /lynx.os && osname=lynxos
2312 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2313 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2314 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2315 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2316 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2317 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2318 $test -d /usr/apollo/bin && osname=apollo
2319 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2320 $test -d /usr/include/minix && osname=minix
e060872b 2321 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2322 osname=machten
4633a7c4 2323 if $test -x /sbin/version; then
dfe9444c 2324 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2325 $sed -e 's/[A-Za-z]$//'`
2326 elif $test -x /usr/etc/version; then
dfe9444c 2327 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2328 $sed -e 's/[A-Za-z]$//'`
2329 else
2330 osvers="$2.$3"
2331 fi
2332 fi
aaacdc8b
GS
2333
2334 $test -f /sys/posix.dll &&
2335 $test -f /usr/bin/what &&
2336 set X `/usr/bin/what /sys/posix.dll` &&
2337 $test "$3" = UWIN &&
2338 osname=uwin &&
2339 osvers="$5"
2340
2304df62
AD
2341 if $test -f $uname; then
2342 set X $myuname
2343 shift
2344
2304df62 2345 case "$5" in
85e6fe83 2346 fps*) osname=fps ;;
2304df62
AD
2347 mips*)
2348 case "$4" in
85e6fe83
LW
2349 umips) osname=umips ;;
2350 *) osname=mips ;;
2304df62 2351 esac;;
85e6fe83
LW
2352 [23]100) osname=mips ;;
2353 next*) osname=next ;;
ecfc5424 2354 i386*)
c6912327
JH
2355 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2356 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2357 osname='sco'
2358 osvers=$tmp
2359 elif $test -f /etc/kconfig; then
ecfc5424 2360 osname=isc
bd628c73 2361 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2362 osvers=4
2363 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2364 osvers=3
2304df62 2365 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2366 osvers=2
ecfc5424
AD
2367 fi
2368 fi
2000072c 2369 tmp=''
ecfc5424 2370 ;;
c4f23d77
AD
2371 pc*)
2372 if test -n "$DJGPP"; then
2373 osname=dos
2374 osvers=djgpp
2375 fi
2376 ;;
2304df62
AD
2377 esac
2378
2379 case "$1" in
a0d0e21e
LW
2380 aix) osname=aix
2381 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2382 case "$tmp" in
1aef975c 2383 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2384 '<3240'|'<>3240') osvers=3.2.0 ;;
2385 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2386 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2387 *) osvers=$tmp;;
a0d0e21e
LW
2388 esac
2389 ;;
aaacdc8b
GS
2390 bsd386) osname=bsd386
2391 osvers=`$uname -r`
2392 ;;
2393 cygwin*) osname=cygwin
2394 osvers="$3"
2395 ;;
23f87696
SZ
2396 *dc.osx) osname=dcosx
2397 osvers="$3"
2398 ;;
a0d0e21e
LW
2399 dnix) osname=dnix
2400 osvers="$3"
2401 ;;
2402 domainos) osname=apollo
2403 osvers="$3"
2404 ;;
2405 dgux) osname=dgux
2406 osvers="$3"
2407 ;;
760ac839 2408 dynixptx*) osname=dynixptx
e58e581d 2409 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2410 ;;
a0d0e21e
LW
2411 freebsd) osname=freebsd
2412 osvers="$3" ;;
2413 genix) osname=genix ;;
2414 hp*) osname=hpux
bfb7748a 2415 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2416 ;;
a78b0d02 2417 irix*) osname=irix
a0d0e21e
LW
2418 case "$3" in
2419 4*) osvers=4 ;;
2420 5*) osvers=5 ;;
ecfc5424 2421 *) osvers="$3" ;;
a0d0e21e
LW
2422 esac
2423 ;;
2424 linux) osname=linux
2425 case "$3" in
a0d0e21e
LW
2426 *) osvers="$3" ;;
2427 esac
2428 ;;
28e8609d
JH
2429 MiNT) osname=mint
2430 ;;
2431 netbsd*) osname=netbsd
ecfc5424
AD
2432 osvers="$3"
2433 ;;
4e81affe
MM
2434 news-os) osvers="$3"
2435 case "$3" in
2436 4*) osname=newsos4 ;;
2437 *) osname=newsos ;;
2438 esac
2439 ;;
aaacdc8b 2440 next*) osname=next ;;
28bb1e2c 2441 nonstop-ux) osname=nonstopux ;;
aaacdc8b
GS
2442 POSIX-BC | posix-bc ) osname=posix-bc
2443 osvers="$3"
a0d0e21e 2444 ;;
ae3afa4e
TH
2445 powerux | power_ux | powermax_os | powermaxos | \
2446 powerunix | power_unix) osname=powerux
2447 osvers="$3"
2448 ;;
aaacdc8b
GS
2449 qnx) osname=qnx
2450 osvers="$4"
2451 ;;
a0d0e21e
LW
2452 solaris) osname=solaris
2453 case "$3" in
2454 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2455 *) osvers="$3" ;;
a0d0e21e
LW
2456 esac
2457 ;;
85e6fe83
LW
2458 sunos) osname=sunos
2459 case "$3" in
85e6fe83
LW
2460 5*) osname=solaris
2461 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2462 *) osvers="$3" ;;
2304df62
AD
2463 esac
2464 ;;
a0d0e21e 2465 titanos) osname=titanos
85e6fe83 2466 case "$3" in
a0d0e21e
LW
2467 1*) osvers=1 ;;
2468 2*) osvers=2 ;;
2469 3*) osvers=3 ;;
2470 4*) osvers=4 ;;
ecfc5424 2471 *) osvers="$3" ;;
2304df62
AD
2472 esac
2473 ;;
85e6fe83 2474 ultrix) osname=ultrix
ecfc5424 2475 osvers="$3"
2304df62 2476 ;;
28757baa 2477 osf1|mls+) case "$5" in
fed7345c
AD
2478 alpha)
2479 osname=dec_osf
2aa76180
JH
2480 osvers=`sizer -v | awk '{print $3}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2481 case "$osvers" in
2482 [1-9].[0-9]*) ;;
2483 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2484 esac
ecfc5424
AD
2485 ;;
2486 hp*) osname=hp_osf1 ;;
2487 mips) osname=mips_osf1 ;;
85e6fe83
LW
2488 esac
2489 ;;
0337d152
BG
2490 unixware) osname=svr5
2491 osvers="$4"
2492 ;;
2493 uts) osname=uts
a0d0e21e
LW
2494 osvers="$3"
2495 ;;
85e6fe83 2496 $2) case "$osname" in
2304df62 2497 *isc*) ;;
a0d0e21e 2498 *freebsd*) ;;
5f05dabc 2499 svr*)
a0d0e21e
LW
2500 : svr4.x or possibly later
2501 case "svr$3" in
2502 ${osname}*)
2503 osname=svr$3
2504 osvers=$4
2505 ;;
2506 esac
2507 case "$osname" in
2508 svr4.0)
2509 : Check for ESIX
2510 if test -f /stand/boot ; then
2511 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2512 if test -n "$INITPROG" -a -f "$INITPROG"; then
2513 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2514 if test -n "$isesix"; then
a0d0e21e
LW
2515 osname=esix4
2516 fi
2517 fi
2518 fi
2519 ;;
2520 esac
2521 ;;
2304df62 2522 *) if test -f /etc/systemid; then
a0d0e21e
LW
2523 osname=sco
2524 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2525 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2526 osvers=$1.$2.$3
c4f23d77 2527 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2528 osvers=$1.$2
c4f23d77 2529 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2530 osvers=$1
2304df62 2531 fi
a0d0e21e
LW
2532 else
2533 case "$osname" in
2534 '') : Still unknown. Probably a generic Sys V.
2535 osname="sysv"
2536 osvers="$3"
2537 ;;
2538 esac
2304df62
AD
2539 fi
2540 ;;
2541 esac
2542 ;;
a0d0e21e
LW
2543 *) case "$osname" in
2544 '') : Still unknown. Probably a generic BSD.
2545 osname="$1"
2546 osvers="$3"
2547 ;;
2548 esac
2549 ;;
2304df62
AD
2550 esac
2551 else
dfe9444c
AD
2552 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2553 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2554 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2555 osname=news_os
2304df62 2556 fi
dfe9444c 2557 $rm -f UU/kernel.what
8e07c86e
AD
2558 elif test -d c:/.; then
2559 set X $myuname
2560 osname=os2
2561 osvers="$5"
2304df62
AD
2562 fi
2563 fi
85e6fe83 2564
a0d0e21e
LW
2565 : Now look for a hint file osname_osvers, unless one has been
2566 : specified already.
2567 case "$hintfile" in
2568 ''|' ')
1e127011 2569 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 2570 : Also try without trailing minor version numbers.
1e127011
DD
2571 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2572 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2573 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2574 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
2575 case "$file" in
2576 '') dflt=none ;;
2577 *) case "$osvers" in
2578 '') dflt=$file
2579 ;;
dfe9444c 2580 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 2581 dflt=$file
dfe9444c 2582 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 2583 dflt=$xfile
dfe9444c 2584 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 2585 dflt=$xxfile
dfe9444c 2586 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 2587 dflt=$xxxfile
dfe9444c 2588 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 2589 dflt=$xxxxfile
dfe9444c 2590 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
2591 dflt="${osname}"
2592 else
2593 dflt=none
2594 fi
2595 ;;
2596 esac
85e6fe83
LW
2597 ;;
2598 esac
4e2a5f63
AD
2599 if $test -f Policy.sh ; then
2600 case "$dflt" in
2601 *Policy*) ;;
2602 none) dflt="Policy" ;;
2603 *) dflt="Policy $dflt" ;;
2604 esac
2605 fi
85e6fe83 2606 ;;
a0d0e21e 2607 *)
ecfc5424 2608 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 2609 ;;
2304df62 2610 esac
1aef975c 2611
4e2a5f63
AD
2612 if $test -f Policy.sh ; then
2613 $cat <<EOM
2614
2615There's also a Policy hint file available, which should make the
2616site-specific (policy) questions easier to answer.
2617EOM
2618
2619 fi
2620
2304df62
AD
2621 $cat <<EOM
2622
2623You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 2624A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 2625is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
2626
2627EOM
4e2a5f63 2628
2304df62 2629 rp="Which of these apply, if any?"
dfe9444c 2630 . UU/myread
85e6fe83
LW
2631 tans=$ans
2632 for file in $tans; do
4e2a5f63
AD
2633 if $test X$file = XPolicy -a -f Policy.sh; then
2634 . Policy.sh
2635 $cat Policy.sh >> UU/config.sh
2636 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
2637 . $src/hints/$file.sh
2638 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83 2639 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
2640 : nothing
2641 else
85e6fe83
LW
2642 : Give one chance to correct a possible typo.
2643 echo "$file.sh does not exist"
2644 dflt=$file
2645 rp="hint to use instead?"
dfe9444c 2646 . UU/myread
85e6fe83 2647 for file in $ans; do
dfe9444c
AD
2648 if $test -f "$src/hints/$file.sh"; then
2649 . $src/hints/$file.sh
2650 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
2651 elif $test X$ans = X -o X$ans = Xnone ; then
2652 : nothing
2653 else
2654 echo "$file.sh does not exist -- ignored."
2655 fi
2656 done
2304df62
AD
2657 fi
2658 done
85e6fe83 2659
2304df62 2660 hint=recommended
85e6fe83 2661 : Remember our hint file for later.
dfe9444c 2662 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 2663 hintfile="$file"
85e6fe83 2664 else
a0d0e21e 2665 hintfile=''
85e6fe83 2666 fi
2304df62
AD
2667fi
2668cd UU
2669;;
2670*)
2671 echo " "
2672 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
2673 tmp_n="$n"
2674 tmp_c="$c"
2304df62
AD
2675 cd ..
2676 cp $config_sh config.sh 2>/dev/null
a78b0d02 2677 chmod +w config.sh
2304df62
AD
2678 . ./config.sh
2679 cd UU
2680 cp ../config.sh .
ecfc5424
AD
2681 n="$tmp_n"
2682 c="$tmp_c"
2304df62
AD
2683 hint=previous
2684 ;;
2685esac
1aef975c 2686test "$override" && . ./optdef.sh
2304df62
AD
2687
2688: Restore computed paths
2689for file in $loclist $trylist; do
2690 eval $file="\$_$file"
2691done
2692
85e6fe83 2693cat << EOM
a0d0e21e 2694
85e6fe83 2695Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
2696The default value is probably right if the name rings a bell. Otherwise,
2697since spelling matters for me, either accept the default or answer "none"
2698to leave it blank.
a0d0e21e 2699
85e6fe83 2700EOM
85e6fe83 2701case "$osname" in
a0d0e21e 2702 ''|' ')
85e6fe83 2703 case "$hintfile" in
a0d0e21e 2704 ''|' '|none) dflt=none ;;
ecfc5424 2705 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
2706 esac
2707 ;;
2708 *) dflt="$osname" ;;
2709esac
2710rp="Operating system name?"
2711. ./myread
2712case "$ans" in
ecfc5424
AD
2713none) osname='' ;;
2714*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 2715esac
8ff267be 2716echo " "
2717case "$osvers" in
2718 ''|' ')
2719 case "$hintfile" in
2720 ''|' '|none) dflt=none ;;
2721 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2722 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2723 case "$dflt" in
2724 ''|' ') dflt=none ;;
2725 esac
2726 ;;
2727 esac
2728 ;;
2729 *) dflt="$osvers" ;;
2730esac
2731rp="Operating system version?"
2732. ./myread
2733case "$ans" in
2734none) osvers='' ;;
2735*) osvers="$ans" ;;
2736esac
2737
02e93a22
JH
2738
2739. ./posthint.sh
2740
2304df62 2741: who configured the system
59b83a6f 2742cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 2743cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
2744case "$cf_by" in
2745"")
8ff267be 2746 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
2747 case "$cf_by" in
2748 "") cf_by=unknown ;;
8ff267be 2749 esac ;;
2750esac
2304df62 2751
b4eb6b3d
JH
2752: set up the script used to warn in case of inconsistency
2753cat <<EOS >whoa
2754$startsh
2755EOS
2756cat <<'EOSC' >>whoa
2757dflt=y
2758echo " "
2759echo "*** WHOA THERE!!! ***" >&4
2760echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2761rp=" Keep the $hint value?"
2762. ./myread
2763case "$ans" in
2764y) td=$was; tu=$was;;
2765esac
2766EOSC
2767
2768: function used to set $1 to $val
2769setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2770case "$val$was" in
2771$define$undef) . ./whoa; eval "$var=\$td";;
2772$undef$define) . ./whoa; eval "$var=\$tu";;
2773*) eval "$var=$val";;
2774esac'
2775
2776case "$usethreads" in
2777$define|true|[yY]*) dflt='y';;
2778*) dflt='n';;
2779esac
2780cat <<EOM
2781
2782Perl can be built to take advantage of threads on some systems.
2783To do so, Configure can be run with -Dusethreads.
2784
2785Note that threading is a highly experimental feature, and
2786some known race conditions still remain. If you choose to try
2787it, be very sure to not actually deploy it for production
2788purposes. README.threads has more details, and is required
2789reading if you enable threads.
2790
2791If this doesn't make any sense to you, just accept the default '$dflt'.
2792EOM
2793rp='Build a threading Perl?'
2794. ./myread
2795case "$ans" in
2796y|Y) val="$define" ;;
2797*) val="$undef" ;;
2798esac
2799set usethreads
2800eval $setvar
2801
2802case "$usethreads" in
2803$define)
2804 $cat <<EOM
2805
2806As of 5.5.640, Perl has two different internal threading implementations,
2807the 5.005 version (5005threads) and an interpreter-based version
2808(ithreads) that has one interpreter per thread. Both are very
2809experimental. This arrangement exists to help developers work out
2810which one is better.
2811
2812If you're a casual user, you probably don't want interpreter-threads
2813at this time. There doesn't yet exist a way to create threads from
2814within Perl in this model, i.e., "use Thread;" will NOT work.
2815EOM
2816 : Default to ithreads unless overridden on command line or with
2817 : old config.sh
2818 dflt='y'
2819 case "$use5005threads" in
2820 $define|true|[yY]*) dflt='n';;
2821 esac
2822 case "$useithreads" in
2823 $undef|false|[nN]*) dflt='n';;
2824 esac
2825 rp='Use interpreter-based ithreads?'
2826 . ./myread
2827 case "$ans" in
2828 y|Y) val="$define" ;;
2829 *) val="$undef" ;;
2830 esac
2831 set useithreads
2832 eval $setvar
2833 : Now set use5005threads to the opposite value.
2834 case "$useithreads" in
2835 $define) val="$undef" ;;
2836 *) val="$define" ;;
2837 esac
2838 set use5005threads
2839 eval $setvar
2840 ;;
2841*)
2842 useithreads="$undef"
2843 use5005threads="$undef"
2844 ;;
2845esac
2846
2847case "$d_oldpthreads" in
2848'') : Configure tests would be welcome here. For now, assume undef.
2849 val="$undef" ;;
2850*) val="$d_oldpthreads" ;;
2851esac
2852set d_oldpthreads
2853eval $setvar
2854
2855
2856case "$usethreads" in
2857"$define"|true|[yY]*)
2858: Look for a hint-file generated 'call-back-unit'. If the
2859: user has specified that a threading perl is to be built,
2860: we may need to set or change some other defaults.
2861 if $test -f usethreads.cbu; then
2862 echo "Your platform has some specific hints for threaded builds, using them..."
2863 . ./usethreads.cbu
2864 else
2865 $cat <<EOM
2866(Your platform doesn't have any specific hints for threaded builds.
2867 Assuming POSIX threads, then.)
2868EOM
2869 fi
2870 ;;
2871esac
2872
2873cat <<EOM
2874
2875Perl can be built so that multiple Perl interpreters can coexist
2876within the same Perl executable.
2877EOM
2878
2879case "$useithreads" in
2880$define)
2881 cat <<EOM
2882This multiple interpreter support is required for interpreter-based threads.
2883EOM
2884 val="$define"
2885 ;;
2886*) case "$usemultiplicity" in
2887 $define|true|[yY]*) dflt='y';;
2888 *) dflt='n';;
2889 esac
2890 echo " "
2891 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2892 rp='Build Perl for multiplicity?'
2893 . ./myread
2894 case "$ans" in
2895 y|Y) val="$define" ;;
2896 *) val="$undef" ;;
2897 esac
2898 ;;
2899esac
2900set usemultiplicity
2901eval $setvar
2902
e5e20432
JH
2903: make some quick guesses about what we are up against
2904echo " "
2905$echo $n "Hmm... $c"
2906echo exit 1 >bsd
2907echo exit 1 >usg
2908echo exit 1 >v7
2909echo exit 1 >osf1
2910echo exit 1 >eunice
2911echo exit 1 >xenix
2912echo exit 1 >venix
2913echo exit 1 >os2
2914d_bsd="$undef"
2915$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2916if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2917then
2918 echo "Looks kind of like an OSF/1 system, but we'll see..."
2919 echo exit 0 >osf1
381aa1ff 2920elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
2921 xxx=`./loc addbib blurfl $pth`
2922 if $test -f $xxx; then
2923 echo "Looks kind of like a USG system with BSD features, but we'll see..."
2924 echo exit 0 >bsd
2925 echo exit 0 >usg
2926 else
2927 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2928 echo "Looks kind of like an extended USG system, but we'll see..."
2929 else
2930 echo "Looks kind of like a USG system, but we'll see..."
2931 fi
2932 echo exit 0 >usg
2933 fi
2934elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2935 echo "Looks kind of like a BSD system, but we'll see..."
2936 d_bsd="$define"
2937 echo exit 0 >bsd
2938else
2939 echo "Looks kind of like a Version 7 system, but we'll see..."
2940 echo exit 0 >v7
2941fi
2942case "$eunicefix" in
2943*unixtovms*)
2944 $cat <<'EOI'
2945There is, however, a strange, musty smell in the air that reminds me of
2946something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2947EOI
2948 echo exit 0 >eunice
2949 d_eunice="$define"
2950: it so happens the Eunice I know will not run shell scripts in Unix format
2951 ;;
2952*)
2953 echo " "
2954 echo "Congratulations. You aren't running Eunice."
2955 d_eunice="$undef"
2956 ;;
2957esac
2958: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
2959: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
2960: semicolon as a patch separator
e5e20432
JH
2961case "$p_" in
2962:) ;;
2963*)
2964 $cat <<'EOI'
2965I have the feeling something is not exactly right, however...don't tell me...
2966lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 2967(Or you may be running DOS with DJGPP.)
e5e20432
JH
2968EOI
2969 echo exit 0 >os2
2970 ;;
2971esac
2972if test -f /xenix; then
2973 echo "Actually, this looks more like a XENIX system..."
2974 echo exit 0 >xenix
2975 d_xenix="$define"
2976else
2977 echo " "
2978 echo "It's not Xenix..."
2979 d_xenix="$undef"
2980fi
2981chmod +x xenix
2982$eunicefix xenix
2983if test -f /venix; then
2984 echo "Actually, this looks more like a VENIX system..."
2985 echo exit 0 >venix
2986else
2987 echo " "
2988 if ./xenix; then
2989 : null
2990 else
2991 echo "Nor is it Venix..."
2992 fi
2993fi
2994chmod +x bsd usg v7 osf1 eunice xenix venix os2
2995$eunicefix bsd usg v7 osf1 eunice xenix venix os2
2996$rm -f foo
2997
5869b1f1
JH
2998case "$cc" in
2999'') dflt=cc;;
3000*) dflt="$cc";;
3001esac
3002rp="Use which C compiler?"
3003. ./myread
3004cc="$ans"
e5e20432
JH
3005: Look for a hint-file generated 'call-back-unit'. Now that the
3006: user has specified the compiler, we may need to set or change some
3007: other defaults.
3008if $test -f cc.cbu; then
3009 . ./cc.cbu
3010fi
2573c5f9 3011. ./checkcc
8a27cf78 3012
e5e20432
JH
3013echo " "
3014echo "Checking for GNU cc in disguise and/or its version number..." >&4
3015$cat >gccvers.c <<EOM
3016#include <stdio.h>
3017int main() {
3018#ifdef __GNUC__
3019#ifdef __VERSION__
3020 printf("%s\n", __VERSION__);
3021#else
3022 printf("%s\n", "1");
3023#endif
3024#endif
3025 exit(0);
3026}
3027EOM
7a282f6d 3028if $cc -o gccvers $ldflags gccvers.c; then
e5e20432
JH
3029 gccversion=`./gccvers`
3030 case "$gccversion" in
3031 '') echo "You are not using GNU cc." ;;
fc68435e 3032 *) echo "You are using GNU cc $gccversion."
e723fc21 3033 ccname=gcc
fc68435e 3034 ;;
e5e20432
JH
3035 esac
3036else
3037 echo " "
3038 echo "*** WHOA THERE!!! ***" >&4
3039 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3040 case "$knowitall" in
3041 '')
3042 echo " You'd better start hunting for one and let me know about it." >&4
3043 exit 1
3044 ;;
3045 esac
3046fi
3047$rm -f gccvers*
3048case "$gccversion" in
30491*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3050esac
5b463ca7
KS
3051case "$gccversion" in
3052'') gccosandvers='' ;;
10b4ebb5
JH
3053*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3054 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3055 gccshortvers=''
5b463ca7 3056 case "$gccosandvers" in
02903077
JH
3057 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3058 $osname$osvers) ;; # looking good
5b463ca7
KS
3059 $osname*) cat <<EOM >&4
3060
3061*** WHOA THERE!!! ***
3062
3063 Your gcc has not been compiled for the exact release of
3064 your operating system ($gccosandvers versus $osname$osvers).
3065
3066 In general it is a good idea to keep gcc synchronized with
3067 the operating system because otherwise serious problems
3068 may ensue when trying to compile software, like Perl.
3069
3070 I'm trying to be optimistic here, though, and will continue.
3071 If later during the configuration and build icky compilation
02903077
JH
3072 problems appear (headerfile conflicts being the most common
3073 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3074 your operating system release.
3075
3076EOM
3077 ;;
81575342 3078 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3079 esac
3080 ;;
3081esac
e723fc21
JH
3082case "$ccname" in
3083'') ccname="$cc" ;;
3084esac
e5e20432 3085
8a27cf78
JH
3086: see how we invoke the C preprocessor
3087echo " "
3088echo "Now, how can we feed standard input to your C preprocessor..." >&4
3089cat <<'EOT' >testcpp.c
3090#define ABC abc
3091#define XYZ xyz
3092ABC.XYZ
3093EOT
3094cd ..
3095if test ! -f cppstdin; then
3096 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3097 # AIX cc -E doesn't show the absolute headerfile
3098 # locations but we'll cheat by using the -M flag.
3099 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
3100 else
3101 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3102 fi
3103else
3104 echo "Keeping your $hint cppstdin wrapper."
3105fi
3106chmod 755 cppstdin
3107wrapper=`pwd`/cppstdin
3108ok='false'
3109cd UU
3110
3111if $test "X$cppstdin" != "X" && \
3112 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3113 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3114then
3115 echo "You used to use $cppstdin $cppminus so we'll use that again."
3116 case "$cpprun" in
3117 '') echo "But let's see if we can live without a wrapper..." ;;
3118 *)
3119 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3120 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3121 then
3122 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3123 ok='true'
3124 else
3125 echo "(However, $cpprun $cpplast does not work, let's see...)"
3126 fi
3127 ;;
3128 esac
3129else
3130 case "$cppstdin" in
3131 '') ;;
3132 *)
3133 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3134 ;;
3135 esac
3136fi
3137
3138if $ok; then
3139 : nothing
3140elif echo 'Maybe "'"$cc"' -E" will work...'; \
3141 $cc -E <testcpp.c >testcpp.out 2>&1; \
3142 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3143 echo "Yup, it does."
3144 x_cpp="$cc -E"
3145 x_minus='';
3146elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3147 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3148 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3149 echo "Yup, it does."
3150 x_cpp="$cc -E"
3151 x_minus='-';
3152elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3153 $cc -P <testcpp.c >testcpp.out 2>&1; \
3154 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3155 echo "Yipee, that works!"
3156 x_cpp="$cc -P"
3157 x_minus='';
3158elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3159 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3160 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3161 echo "At long last!"
3162 x_cpp="$cc -P"
3163 x_minus='-';
3164elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3165 $cpp <testcpp.c >testcpp.out 2>&1; \
3166 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3167 echo "It works!"
3168 x_cpp="$cpp"
3169 x_minus='';
3170elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3171 $cpp - <testcpp.c >testcpp.out 2>&1; \
3172 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3173 echo "Hooray, it works! I was beginning to wonder."
3174 x_cpp="$cpp"
3175 x_minus='-';
3176elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3177 $wrapper <testcpp.c >testcpp.out 2>&1; \
3178 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3179 x_cpp="$wrapper"
3180 x_minus=''
3181 echo "Eureka!"
3182else
3183 dflt=''
3184 rp="No dice. I can't find a C preprocessor. Name one:"
3185 . ./myread
3186 x_cpp="$ans"
3187 x_minus=''
3188 $x_cpp <testcpp.c >testcpp.out 2>&1
3189 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3190 echo "OK, that will do." >&4
3191 else
3192echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3193 exit 1
3194 fi
3195fi
3196
3197case "$ok" in
3198false)
3199 cppstdin="$x_cpp"
3200 cppminus="$x_minus"
3201 cpprun="$x_cpp"
3202 cpplast="$x_minus"
3203 set X $x_cpp
3204 shift
3205 case "$1" in
3206 "$cpp")
3207 echo "Perhaps can we force $cc -E using a wrapper..."
3208 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3209 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3210 then
3211 echo "Yup, we can."
3212 cppstdin="$wrapper"
3213 cppminus='';
3214 else
3215 echo "Nope, we'll have to live without it..."
3216 fi
3217 ;;
3218 esac
3219 case "$cpprun" in
3220 "$wrapper")
3221 cpprun=''
3222 cpplast=''
3223 ;;
3224 esac
3225 ;;
3226esac
3227
3228case "$cppstdin" in
3229"$wrapper"|'cppstdin') ;;
3230*) $rm -f $wrapper;;
3231esac
3232$rm -f testcpp.c testcpp.out
3233
bd9b35c9
JH
3234: decide how portable to be. Allow command line overrides.
3235case "$d_portable" in
3236"$undef") ;;
3237*) d_portable="$define" ;;
104d25b7 3238esac
85ab1d1d 3239
bd9b35c9
JH
3240: set up shell script to do ~ expansion
3241cat >filexp <<EOSS
3242$startsh
3243: expand filename
3244case "\$1" in
3245 ~/*|~)
3246 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3247 ;;
3248 ~*)
3249 if $test -f /bin/csh; then
3250 /bin/csh -f -c "glob \$1"
3251 failed=\$?
3252 echo ""
3253 exit \$failed
e5e20432 3254 else
bd9b35c9
JH
3255 name=\`$expr x\$1 : '..\([^/]*\)'\`
3256 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3257 if $test ! -d "\$dir"; then
3258 me=\`basename \$0\`
3259 echo "\$me: can't locate home directory for: \$name" >&2
3260 exit 1
3261 fi
3262 case "\$1" in
3263 */*)
3264 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3265 ;;
3266 *)
3267 echo \$dir
e5e20432
JH
3268 ;;
3269 esac
3270 fi
b691c02f 3271 ;;
4633a7c4 3272*)
bd9b35c9 3273 echo \$1
2304df62
AD
3274 ;;
3275esac
4633a7c4
LW
3276EOSS
3277chmod +x filexp
3278$eunicefix filexp
2304df62
AD
3279
3280: now set up to get a file name
28757baa 3281cat <<EOS >getfile
3282$startsh
3283EOS
3284cat <<'EOSC' >>getfile
2304df62
AD
3285tilde=''
3286fullpath=''
3287already=''
3288skip=''
3289none_ok=''
3290exp_file=''
a0d0e21e 3291nopath_ok=''
2304df62
AD
3292orig_rp="$rp"
3293orig_dflt="$dflt"
b233458b
JH
3294case "$gfpth" in
3295'') gfpth='.' ;;
3296esac
2304df62
AD
3297
3298case "$fn" in
ecfc5424 3299*\(*)
381aa1ff 3300 expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
3301 fn=`echo $fn | sed 's/(.*)//'`
3302 ;;
3303esac
3304
3305case "$fn" in
a0d0e21e
LW
3306*:*)
3307 loc_file=`expr $fn : '.*:\(.*\)'`
3308 fn=`expr $fn : '\(.*\):.*'`
3309 ;;
3310esac
3311
3312case "$fn" in
2304df62
AD
3313*~*) tilde=true;;
3314esac
3315case "$fn" in
3316*/*) fullpath=true;;
3317esac
3318case "$fn" in
3319*+*) skip=true;;
3320esac
3321case "$fn" in
3322*n*) none_ok=true;;
3323esac
3324case "$fn" in
3325*e*) exp_file=true;;
3326esac
a0d0e21e
LW
3327case "$fn" in
3328*p*) nopath_ok=true;;
3329esac
2304df62
AD
3330
3331case "$fn" in
3332*f*) type='File';;
3333*d*) type='Directory';;
a0d0e21e 3334*l*) type='Locate';;
2304df62
AD
3335esac
3336
3337what="$type"
3338case "$what" in
3339Locate) what='File';;
3340esac
3341
3342case "$exp_file" in
3343'')
3344 case "$d_portable" in
3345 "$define") ;;
3346 *) exp_file=true;;
3347 esac
3348 ;;
3349esac
3350
3351cd ..
3352while test "$type"; do
3353 redo=''
3354 rp="$orig_rp"
3355 dflt="$orig_dflt"
3356 case "$tilde" in
3357 true) rp="$rp (~name ok)";;
3358 esac
3359 . UU/myread
ecfc5424
AD
3360 if test -f UU/getfile.ok && \
3361 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3362 then
3363 value="$ans"
3364 ansexp="$ans"
3365 break
3366 fi
2304df62
AD
3367 case "$ans" in
3368 none)
3369 value=''
3370 ansexp=''
3371 case "$none_ok" in
3372 true) type='';;
3373 esac
3374 ;;
3375 *)
3376 case "$tilde" in
3377 '') value="$ans"
3378 ansexp="$ans";;
3379 *)
3380 value=`UU/filexp $ans`
3381 case $? in
3382 0)
3383 if test "$ans" != "$value"; then
ecfc5424 3384 echo "(That expands to $value on this system.)"
2304df62
AD
3385 fi
3386 ;;
3387 *) value="$ans";;
3388 esac
3389 ansexp="$value"
3390 case "$exp_file" in
3391 '') value="$ans";;
3392 esac
3393 ;;
3394 esac
3395 case "$fullpath" in
3396 true)
3397 case "$ansexp" in
3398 /*) value="$ansexp" ;;
23da6c43 3399 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
3400 *)
3401 redo=true
3402 case "$already" in
3403 true)
3404 echo "I shall only accept a full path name, as in /bin/ls." >&4
3405 echo "Use a ! shell escape if you wish to check pathnames." >&4
3406 ;;
3407 *)
3408 echo "Please give a full path name, starting with slash." >&4
3409 case "$tilde" in
3410 true)
3411 echo "Note that using ~name is ok provided it expands well." >&4
3412 already=true
3413 ;;
3414 esac
3415 esac
3416 ;;
3417 esac
3418 ;;
3419 esac
3420 case "$redo" in
3421 '')
3422 case "$type" in
3423 File)
b233458b
JH
3424 for fp in $gfpth; do
3425 if test "X$fp" = X.; then
3426 pf="$ansexp"
3427 else
3428 pf="$fp/$ansexp"
3429 fi
3430 if test -f "$pf"; then
3431 type=''
3432 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3433 then
3434 echo "($value is not a plain file, but that's ok.)"
3435 type=''
3436 fi
3437 if test X"$type" = X; then
3438 value="$pf"
3439 break
3440 fi
3441 done
2304df62
AD
3442 ;;
3443 Directory)
b233458b
JH
3444 for fp in $gfpth; do
3445 if test "X$fp" = X.; then
f78bfc9c
JH
3446 dir="$ans"
3447 direxp="$ansexp"
b233458b 3448 else
dd858076 3449 dir="$fp/$ansexp"
f78bfc9c 3450 direxp="$fp/$ansexp"
b233458b 3451 fi
f78bfc9c 3452 if test -d "$direxp"; then
b233458b 3453 type=''
f78bfc9c 3454 value="$dir"
b233458b
JH
3455 break
3456 fi
3457 done
2304df62
AD
3458 ;;
3459 Locate)
40000a8c 3460 if test -d "$ansexp"; then
a0d0e21e
LW
3461 echo "(Looking for $loc_file in directory $value.)"
3462 value="$value/$loc_file"
40000a8c 3463 ansexp="$ansexp/$loc_file"
2304df62 3464 fi
40000a8c 3465 if test -f "$ansexp"; then
2304df62
AD
3466 type=''
3467 fi
a0d0e21e
LW
3468 case "$nopath_ok" in
3469 true) case "$value" in
3470 */*) ;;
3471 *) echo "Assuming $value will be in people's path."
3472 type=''
3473 ;;
3474 esac
3475 ;;
3476 esac
2304df62
AD
3477 ;;
3478 esac
3479
3480 case "$skip" in
3481 true) type='';
3482 esac
3483
3484 case "$type" in
3485 '') ;;
3486 *)
3487 if test "$fastread" = yes; then
3488 dflt=y
3489 else
3490 dflt=n
3491 fi
3492 rp="$what $value doesn't exist. Use that name anyway?"
3493 . UU/myread
3494 dflt=''
3495 case "$ans" in
3496 y*) type='';;
3497 *) echo " ";;
3498 esac
3499 ;;
3500 esac
3501 ;;
3502 esac
3503 ;;
3504 esac
3505done
3506cd UU
3507ans="$value"
3508rp="$orig_rp"
3509dflt="$orig_dflt"
ecfc5424 3510rm -f getfile.ok
b233458b 3511test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3512EOSC
3513
bd9b35c9
JH
3514: What should the include directory be ?
3515echo " "
3516$echo $n "Hmm... $c"
3517dflt='/usr/include'
3518incpath=''
3519mips_type=''
3520if $test -f /bin/mips && /bin/mips; then
3521 echo "Looks like a MIPS system..."
3522 $cat >usr.c <<'EOCP'
3523#ifdef SYSTYPE_BSD43
3524/bsd43
3525#endif
3526EOCP
8a27cf78 3527 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
3528 dflt='/bsd43/usr/include'
3529 incpath='/bsd43'
3530 mips_type='BSD 4.3'
3531 else
3532 mips_type='System V'
3533 fi
3534 $rm -f usr.c usr.out
3535 echo "and you're compiling with the $mips_type compiler and libraries."
3536 xxx_prompt=y
3537 echo "exit 0" >mips
3538else
3539 echo "Doesn't look like a MIPS system."
3540 xxx_prompt=n
3541 echo "exit 1" >mips
3542fi
3543chmod +x mips
3544$eunicefix mips
3545case "$usrinc" in
3546'') ;;
3547*) dflt="$usrinc";;
3548esac
3549case "$xxx_prompt" in
3550y) fn=d/
3551 echo " "
3552 rp='Where are the include files you want to use?'
3553 . ./getfile
3554 usrinc="$ans"
8e07c86e 3555 ;;
bd9b35c9 3556*) usrinc="$dflt"
8e07c86e
AD
3557 ;;
3558esac
2304df62 3559
bd9b35c9
JH
3560: Set private lib path
3561case "$plibpth" in
3562'') if ./mips; then
3563 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3564 fi;;
3565esac
3566case "$libpth" in
3567' ') dlist='';;
3568'') dlist="$loclibpth $plibpth $glibpth";;
3569*) dlist="$libpth";;
3570esac
3571
3572: Now check and see which directories actually exist, avoiding duplicates
3573libpth=''
3574for xxx in $dlist
3575do
3576 if $test -d $xxx; then
3577 case " $libpth " in
3578 *" $xxx "*) ;;
3579 *) libpth="$libpth $xxx";;
3580 esac
3581 fi
3582done
3583$cat <<'EOM'
3584
3585Some systems have incompatible or broken versions of libraries. Among
3586the directories listed in the question below, please remove any you
3587know not to be holding relevant libraries, and add any that are needed.
3588Say "none" for none.
8e07c86e
AD
3589
3590EOM
bd9b35c9
JH
3591case "$libpth" in
3592'') dflt='none';;
8e07c86e 3593*)
bd9b35c9
JH
3594 set X $libpth
3595 shift
3596 dflt=${1+"$@"}
8e07c86e 3597 ;;
a0d0e21e 3598esac
bd9b35c9
JH
3599rp="Directories to use for library searches?"
3600. ./myread
3601case "$ans" in
3602none) libpth=' ';;
3603*) libpth="$ans";;
3604esac
a0d0e21e 3605
bd9b35c9
JH
3606: compute shared library extension
3607case "$so" in
3608'')
3609 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3610 dflt='sl'
dd4e71fd 3611 else
bd9b35c9 3612 dflt='so'
dd4e71fd
JH
3613 fi
3614 ;;
bd9b35c9 3615*) dflt="$so";;
dd4e71fd 3616esac
dd4e71fd
JH
3617$cat <<EOM
3618
bd9b35c9 3619On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 3620you want to suppress searching of shared libraries for the remainder
bd9b35c9 3621of this configuration.
dd4e71fd
JH
3622
3623EOM
bd9b35c9
JH
3624rp='What is the file extension used for shared libraries?'
3625. ./myread
3626so="$ans"
dd4e71fd 3627
bd9b35c9
JH
3628: Define several unixisms.
3629: Hints files or command line option can be used to override them.
3630: The convoluted testing is in case hints files set either the old
3631: or the new name.
3632case "$_exe" in
3633'') case "$exe_ext" in
3634 '') ;;
3635 *) _exe="$exe_ext" ;;
dd4e71fd 3636 esac
bd9b35c9 3637 ;;
bfb7748a 3638esac
bd9b35c9
JH
3639case "$_a" in
3640'') case "$lib_ext" in
3641 '') _a='.a';;
3642 *) _a="$lib_ext" ;;
dd4e71fd
JH
3643 esac
3644 ;;
dd4e71fd 3645esac
bd9b35c9
JH
3646case "$_o" in
3647'') case "$obj_ext" in
3648 '') _o='.o';;
3649 *) _o="$obj_ext";;
3650 esac
3651 ;;
3652esac
3653case "$p_" in
3654'') case "$path_sep" in
3655 '') p_=':';;
3656 *) p_="$path_sep";;
3657 esac
3658 ;;
3659esac
3660exe_ext=$_exe
3661lib_ext=$_a
3662obj_ext=$_o
3663path_sep=$p_
dd4e71fd 3664
b4eb6b3d
JH
3665: Which makefile gets called first. This is used by make depend.
3666case "$firstmakefile" in
3667'') firstmakefile='makefile';;
4633a7c4 3668esac
4633a7c4 3669
0f0995ae
JH
3670case "$usesocks" in
3671$define|true|[yY]*) dflt='y';;
3672*) dflt='n';;
3673esac
bd9b35c9 3674cat <<EOM
4633a7c4 3675
bd9b35c9 3676Perl can be built to use the SOCKS proxy protocol library. To do so,
cf829ab0
JH
3677Configure must be run with -Dusesocks. If you use SOCKS you also need
3678to use the PerlIO abstraction layer, this will be implicitly selected.
4633a7c4 3679
0f0995ae 3680If this doesn't make any sense to you, just accept the default '$dflt'.
bd9b35c9 3681EOM
bd9b35c9
JH
3682rp='Build Perl for SOCKS?'
3683. ./myread
3684case "$ans" in
3685y|Y) val="$define" ;;
3686*) val="$undef" ;;
3687esac
3688set usesocks
3689eval $setvar
3690
cf829ab0
JH
3691case "$usesocks" in
3692$define|true|[yY]*) useperlio="$define";;
3693esac
3694
bd9b35c9
JH
3695: Looking for optional libraries
3696echo " "
3697echo "Checking for optional libraries..." >&4
3698case "$libs" in
3699' '|'') dflt='';;
3700*) dflt="$libs";;
3701esac
3702case "$libswanted" in
3703'') libswanted='c_s';;
3704esac
3705case "$usesocks" in
923fc586 3706"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 3707esac
68435ea7
JH
3708libsfound=''
3709libsfiles=''
3710libsdirs=''
13b3f787
JH
3711libspath=''
3712for thisdir in $libpth $xlibpth; do
3713 test -d $thisdir && libspath="$libspath $thisdir"
3714done
bd9b35c9 3715for thislib in $libswanted; do
13b3f787 3716 for thisdir in $libspath; do
f7dd4e7f
JH
3717 xxx=''
3718 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3719 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3720 $test -f "$xxx" && eval $libscheck
3721 $test -f "$xxx" && libstyle=shared
3722 fi
3723 if test ! -f "$xxx"; then
3724 xxx=$thisdir/lib$thislib.$so
3725 $test -f "$xxx" && eval $libscheck
3726 $test -f "$xxx" && libstyle=shared
3727 fi
3728 if test ! -f "$xxx"; then
3729 xxx=$thisdir/lib$thislib$_a
3730 $test -f "$xxx" && eval $libscheck
3731 $test -f "$xxx" && libstyle=static
3732 fi
3733 if test ! -f "$xxx"; then
3734 xxx=$thisdir/$thislib$_a
3735 $test -f "$xxx" && eval $libscheck
3736 $test -f "$xxx" && libstyle=static
3737 fi
3738 if test ! -f "$xxx"; then
3739 xxx=$thisdir/lib${thislib}_s$_a
3740 $test -f "$xxx" && eval $libscheck
3741 $test -f "$xxx" && libstyle=static
09ea5ba9 3742 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
3743 fi
3744 if test ! -f "$xxx"; then
3745 xxx=$thisdir/Slib$thislib$_a
3746 $test -f "$xxx" && eval $libscheck
3747 $test -f "$xxx" && libstyle=static
3748 fi
3749 if $test -f "$xxx"; then
43999f95 3750 case "$libstyle" in
f7dd4e7f
JH
3751 shared) echo "Found -l$thislib (shared)." ;;
3752 static) echo "Found -l$thislib." ;;
3753 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 3754 esac
bd9b35c9
JH
3755 case " $dflt " in
3756 *"-l$thislib "*);;
f7dd4e7f 3757 *) dflt="$dflt -l$thislib"
43999f95
JH
3758 libsfound="$libsfound $xxx"
3759 yyy=`basename $xxx`
3760 libsfiles="$libsfiles $yyy"
1e127011 3761 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
3762 case " $libsdirs " in
3763 *" $yyy "*) ;;
3764 *) libsdirs="$libsdirs $yyy" ;;
3765 esac
3766 ;;
bd9b35c9 3767 esac
f7dd4e7f
JH
3768 break
3769 fi
3770 done
3771 if $test ! -f "$xxx"; then
3772 echo "No -l$thislib."
bd9b35c9
JH
3773 fi
3774done
3775set X $dflt
3776shift
3777dflt="$*"
3778case "$libs" in
3779'') dflt="$dflt";;
3780*) dflt="$libs";;
3781esac
3782case "$dflt" in
3783' '|'') dflt='none';;
3784esac
4633a7c4 3785
bd9b35c9 3786$cat <<EOM
4633a7c4 3787
bd9b35c9
JH
3788In order to compile $package on your machine, a number of libraries
3789are usually needed. Include any other special libraries here as well.
3790Say "none" for none. The default list is almost always right.
8e07c86e 3791EOM
8e07c86e 3792
bd9b35c9
JH
3793echo " "
3794rp="What libraries to use?"
3795. ./myread
3796case "$ans" in
3797none) libs=' ';;
3798*) libs="$ans";;
3799esac
d71b2b6b 3800
bd9b35c9
JH
3801: determine optimization, if desired, or use for debug flag also
3802case "$optimize" in
3803' '|$undef) dflt='none';;
3804'') dflt='-O';;
3805*) dflt="$optimize";;
3806esac
3807$cat <<EOH
d71b2b6b 3808
bd9b35c9
JH
3809By default, $package compiles with the -O flag to use the optimizer.
3810Alternately, you might want to use the symbolic debugger, which uses
3811the -g flag (on traditional Unix systems). Either flag can be
3812specified here. To use neither flag, specify the word "none".
d71b2b6b 3813
bd9b35c9
JH
3814EOH
3815rp="What optimizer/debugger flag should be used?"
3816. ./myread
3817optimize="$ans"
3818case "$optimize" in
3819'none') optimize=" ";;
3820esac
3821
3822dflt=''
3823: We will not override a previous value, but we might want to
3824: augment a hint file
3825case "$hint" in
3826default|recommended)
3827 case "$gccversion" in
3828 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 3829 esac
bd9b35c9
JH
3830 case "$optimize" in
3831 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 3832 esac
bd9b35c9
JH
3833 case "$gccversion" in
3834 2*) if test -d /etc/conf/kconfig.d &&
3835 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3836 then
3837 dflt="$dflt -posix"
3838 fi
f0d04425 3839 ;;
bd9b35c9
JH
3840 esac
3841 case "$gccversion" in
3842 1*) ;;
3843 2.[0-8]*) ;;
3844 ?*) echo " "
3845 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3846 echo 'int main(void) { return 0; }' > gcctest.c
3847 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3848 echo "Yes, it does." 2>&1
3849 case "$ccflags" in
3850 *strict-aliasing*)
3851 echo "Leaving current flags $ccflags alone." 2>&1
3852 ;;
3853 *) dflt="$dflt -fno-strict-aliasing" ;;
3854 esac
3855 else
3856 echo "Nope, it doesn't, but that's ok." 2>&1
3857 fi
f0d04425 3858 ;;
e5e20432
JH
3859 esac
3860 ;;
3861esac
3862
bd9b35c9
JH
3863case "$mips_type" in
3864*BSD*|'') inclwanted="$locincpth $usrinc";;
3865*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3866esac
3867for thisincl in $inclwanted; do
3868 if $test -d $thisincl; then
3869 if $test x$thisincl != x$usrinc; then
3870 case "$dflt" in
422af00a
LC
3871 *" -I$thisincl "*);;
3872 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
3873 esac
3874 fi
3875 fi
3876done
40a7a20a 3877
bd9b35c9
JH
3878inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3879 xxx=true;
3880elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3881 xxx=true;
3882else
3883 xxx=false;
3884fi;
3885if $xxx; then
3886 case "$dflt" in
3887 *$2*);;
3888 *) dflt="$dflt -D$2";;
3889 esac;
3890fi'
40a7a20a 3891
bd9b35c9 3892set signal.h LANGUAGE_C; eval $inctest
40a7a20a 3893
bd9b35c9
JH
3894case "$usesocks" in
3895$define)
3896 ccflags="$ccflags -DSOCKS"
3897 ;;
3898esac
40a7a20a 3899
bd9b35c9
JH
3900case "$hint" in
3901default|recommended) dflt="$ccflags $dflt" ;;
3902*) dflt="$ccflags";;
3903esac
40a7a20a 3904
bd9b35c9
JH
3905case "$dflt" in
3906''|' ') dflt=none;;
3907esac
422af00a 3908
bd9b35c9 3909$cat <<EOH
40a7a20a 3910
bd9b35c9
JH
3911Your C compiler may want other flags. For this question you should include
3912-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3913but you should NOT include libraries or ld flags like -lwhatever. If you
3914want $package to honor its debug switch, you should include -DDEBUGGING here.
3915Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 3916
bd9b35c9 3917To use no flags, specify the word "none".
40a7a20a 3918
bd9b35c9
JH
3919EOH
3920set X $dflt
3921shift
3922dflt=${1+"$@"}
3923rp="Any additional cc flags?"
3924. ./myread
3925case "$ans" in
3926none) ccflags='';;
3927*) ccflags="$ans";;
3928esac
8e07c86e 3929
bd9b35c9
JH
3930: the following weeds options from ccflags that are of no interest to cpp
3931cppflags="$ccflags"
3932case "$gccversion" in
39331*) cppflags="$cppflags -D__GNUC__"
4633a7c4 3934esac
bd9b35c9
JH
3935case "$mips_type" in
3936'');;
3937*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3938esac
3939case "$cppflags" in
3940'');;
3941*)
3942 echo " "
3943 echo "Let me guess what the preprocessor flags are..." >&4
3944 set X $cppflags
3945 shift
3946 cppflags=''
3947 $cat >cpp.c <<'EOM'
3948#define BLURFL foo
8e07c86e 3949
bd9b35c9
JH
3950BLURFL xx LFRULB
3951EOM
3952 previous=''
3953 for flag in $*
3954 do
3955 case "$flag" in
3956 -*) ftry="$flag";;
3957 *) ftry="$previous $flag";;
3958 esac
3959 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3960 >cpp1.out 2>/dev/null && \
3961 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3962 >cpp2.out 2>/dev/null && \
3963 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3964 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3965 then
3966 cppflags="$cppflags $ftry"
3967 previous=''
3968 else
3969 previous="$flag"
3970 fi
3971 done
3972 set X $cppflags
3973 shift
3974 cppflags=${1+"$@"}
3975 case "$cppflags" in
3976 *-*) echo "They appear to be: $cppflags";;
3977 esac
3978 $rm -f cpp.c cpp?.out
2afac517 3979 ;;
3980esac
8e07c86e 3981
bd9b35c9
JH
3982: flags used in final linking phase
3983case "$ldflags" in
3984'') if ./venix; then
3985 dflt='-i -z'
10a23457 3986 else
bd9b35c9 3987 dflt=''
10a23457 3988 fi
bd9b35c9
JH
3989 case "$ccflags" in
3990 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 3991 esac
bd9b35c9
JH
3992 ;;
3993*) dflt="$ldflags";;
3994esac
3995
3996: Try to guess additional flags to pick up local libraries.
3997for thislibdir in $libpth; do
3998 case " $loclibpth " in
3999 *" $thislibdir "*)
4000 case "$dflt " in
4001 *"-L$thislibdir "*) ;;
4002 *) dflt="$dflt -L$thislibdir" ;;
4003 esac
c4f23d77
AD
4004 ;;
4005 esac
bd9b35c9 4006done
c4f23d77 4007
bd9b35c9
JH
4008case "$dflt" in
4009'') dflt='none' ;;
4010esac
c4f23d77 4011
bd9b35c9
JH
4012$cat <<EOH
4013
4014Your C linker may need flags. For this question you should
4015include -L/whatever and any other flags used by the C linker, but you
4016should NOT include libraries like -lwhatever.
4017
4018Make sure you include the appropriate -L/path flags if your C linker
4019does not normally search all of the directories you specified above,
4020namely
4021 $libpth
4022To use no flags, specify the word "none".
4023
4024EOH
4025
4026rp="Any additional ld flags (NOT including libraries)?"
4027. ./myread
4028case "$ans" in
4029none) ldflags='';;
4030*) ldflags="$ans";;
4031esac
4032rmlist="$rmlist pdp11"
4033
4034: coherency check
4035echo " "
4036echo "Checking your choice of C compiler and flags for coherency..." >&4
4037$cat > try.c <<'EOF'
4038#include <stdio.h>
4039int main() { printf("Ok\n"); exit(0); }
4040EOF
7a282f6d 4041set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
4042shift
4043$cat >try.msg <<'EOM'
4044I've tried to compile and run the following simple program:
4045
4046EOM
4047$cat try.c >> try.msg
4048
4049$cat >> try.msg <<EOM
4050
4051I used the command:
4052
4053 $*
4054 ./try
4055
4056and I got the following output:
4057
4058EOM
4059dflt=y
7a282f6d 4060if sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
bd9b35c9
JH
4061 if sh -c './try' >>try.msg 2>&1; then
4062 xxx=`./try`
4063 case "$xxx" in
4064 "Ok") dflt=n ;;
4065 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4066 case " $libs " in
4067 *" -lsfio "*)
4068 cat >> try.msg <<'EOQS'
4069If $libs contains -lsfio, and sfio is mis-configured, then it
4070sometimes (apparently) runs and exits with a 0 status, but with no
4071output! It may have to do with sfio's use of _exit vs. exit.
4072
4073EOQS
4074 rp="You have a big problem. Shall I abort Configure"
4075 dflt=y
4076 ;;
4077 esac
4078 ;;
4079 esac
4080 else
4081 echo "The program compiled OK, but exited with status $?." >>try.msg
4082 rp="You have a problem. Shall I abort Configure"
4083 dflt=y
4084 fi
4085else
4086 echo "I can't compile the test program." >>try.msg
4087 rp="You have a BIG problem. Shall I abort Configure"
4088 dflt=y
4089fi
4090case "$dflt" in
4091y)
4092 $cat try.msg >&4
4093 case "$knowitall" in
4094 '')
4095 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 4096 ;;
bd9b35c9 4097 *) dflt=n;;
c4f23d77 4098 esac
bd9b35c9
JH
4099 echo " "
4100 . ./myread
4101 case "$ans" in
4102 n*|N*) ;;
4103 *) echo "Ok. Stopping Configure." >&4
4104 exit 1
c4f23d77
AD
4105 ;;
4106 esac
4107 ;;
bd9b35c9 4108n) echo "OK, that should do.";;
c4f23d77 4109esac
bd9b35c9 4110$rm -f try try.* core
c4f23d77 4111
b4eb6b3d
JH
4112: define an is-a-typedef? function
4113typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4114case "$inclist" in
4115"") inclist="sys/types.h";;
4116esac;
4117eval "varval=\$$var";
4118case "$varval" in
4119"")
4120 $rm -f temp.c;
4121 for inc in $inclist; do
4122 echo "#include <$inc>" >>temp.c;
4123 done;
4124 echo "#ifdef $type" >> temp.c;
4125 echo "printf(\"We have $type\");" >> temp.c;
4126 echo "#endif" >> temp.c;
4127 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4128 if $contains $type temp.E >/dev/null 2>&1; then
4129 eval "$var=\$type";
4130 else
4131 eval "$var=\$def";
4132 fi;
4133 $rm -f temp.?;;
4134*) eval "$var=\$varval";;
4135esac'
4136
4137: define an is-a-typedef? function that prompts if the type is not available.
4138typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4139case "$inclist" in
4140"") inclist="sys/types.h";;
4141esac;
4142eval "varval=\$$var";
4143case "$varval" in
4144"")
4145 $rm -f temp.c;
4146 for inc in $inclist; do
4147 echo "#include <$inc>" >>temp.c;
4148 done;
4149 echo "#ifdef $type" >> temp.c;
4150 echo "printf(\"We have $type\");" >> temp.c;
4151 echo "#endif" >> temp.c;
4152 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4153 echo " " ;
4154 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4155 if $contains $type temp.E >/dev/null 2>&1; then
4156 echo "$type found." >&4;
4157 eval "$var=\$type";
4158 else
4159 echo "$type NOT found." >&4;
4160 dflt="$def";
4161 . ./myread ;
4162 eval "$var=\$ans";
4163 fi;
4164 $rm -f temp.?;;
4165*) eval "$var=\$varval";;
4166esac'
4167
bd9b35c9
JH
4168: define a shorthand compile call
4169compile='
4170mc_file=$1;
4171shift;
08413ebc 4172$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
4173: define a shorthand compile call for compilations that should be ok.
4174compile_ok='
4175mc_file=$1;
4176shift;
7a282f6d 4177$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 4178
b4eb6b3d 4179: check for lengths of integral types
bd9b35c9 4180echo " "
b4eb6b3d
JH
4181case "$intsize" in
4182'')
4183 echo "Checking to see how big your integers are..." >&4
4184 $cat >intsize.c <<'EOCP'
bd9b35c9
JH
4185#include <stdio.h>
4186int main()
4187{
b4eb6b3d
JH
4188 printf("intsize=%d;\n", (int)sizeof(int));
4189 printf("longsize=%d;\n", (int)sizeof(long));
4190 printf("shortsize=%d;\n", (int)sizeof(short));
4191 exit(0);
bd9b35c9 4192}
b4eb6b3d
JH
4193EOCP
4194 set intsize
4195 if eval $compile_ok && ./intsize > /dev/null; then
4196 eval `./intsize`
4197 echo "Your integers are $intsize bytes long."
4198 echo "Your long integers are $longsize bytes long."
4199 echo "Your short integers are $shortsize bytes long."
4200 else
4201 $cat >&4 <<EOM
4202!
4203Help! I can't compile and run the intsize test program: please enlighten me!
4204(This is probably a misconfiguration in your system or libraries, and
4205you really ought to fix it. Still, I'll try anyway.)
4206!
bd9b35c9 4207EOM
b4eb6b3d
JH
4208 dflt=4
4209 rp="What is the size of an integer (in bytes)?"
4210 . ./myread
4211 intsize="$ans"
4212 dflt=$intsize
4213 rp="What is the size of a long integer (in bytes)?"
4214 . ./myread
4215 longsize="$ans"
4216 dflt=2
4217 rp="What is the size of a short integer (in bytes)?"
4218 . ./myread
4219 shortsize="$ans"
4220 fi
4221 ;;
4222esac
4223$rm -f intsize intsize.*
c1a7f87b 4224
b4eb6b3d
JH
4225: see what type lseek is declared as in the kernel
4226rp="What is the type used for lseek's offset on this system?"
4227set off_t lseektype long stdio.h sys/types.h
4228eval $typedef_ask
4229
4230echo " "
4231echo "Checking to see how big your file offsets are..." >&4
4232$cat >try.c <<EOCP
4233#include <sys/types.h>
4234#include <stdio.h>
4235int main()
4236{
4237 printf("%d\n", (int)sizeof($lseektype));
4238 return(0);
4239}
4240EOCP
4241set try
4242if eval $compile_ok; then
4243 lseeksize=`./try`
4244 echo "Your file offsets are $lseeksize bytes long."
4245else
4246 dflt=$longsize
4247 echo " "
4248 echo "(I can't seem to compile the test program. Guessing...)"
4249 rp="What is the size of your file offsets (in bytes)?"
4250 . ./myread
4251 lseeksize="$ans"
4252fi
4253$rm -f try.c try
4254
4255: see what type file positions are declared as in the library
4256rp="What is the type for file position used by fsetpos()?"
4257set fpos_t fpostype long stdio.h sys/types.h
4258eval $typedef_ask
4259
4260echo " "
4261case "$fpostype" in
4262*_t) zzz="$fpostype" ;;
4263*) zzz="fpos_t" ;;
4264esac
4265echo "Checking the size of $zzz..." >&4
4266cat > try.c <<EOCP
4267#include <sys/types.h>
4268#include <stdio.h>
4269int main() {
4270 printf("%d\n", (int)sizeof($fpostype));
4271 exit(0);
4272}
4273EOCP
4274set try
4275if eval $compile_ok; then
4276 yyy=`./try`
4277 case "$yyy" in
4278 '') fpossize=4
4279 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4280 ;;
4281 *) fpossize=$yyy
4282 echo "Your $zzz is $fpossize bytes long."
4283 ;;
4284 esac
4285else
4286 dflt="$longsize"
4287 echo " " >&4
4288 echo "(I can't compile the test program. Guessing...)" >&4
4289 rp="What is the size of your file positions (in bytes)?"
4290 . ./myread
4291 fpossize="$ans"
4292fi
4293
4294
4295
4296# Backward compatibility (uselfs is deprecated).
4297case "$uselfs" in
4298"$define"|true|[yY]*)
4299 cat <<EOM >&4
4300
4301*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4302EOM
4303 uselargefiles="$define"
4304 ;;
4305esac
4306
4307case "$lseeksize:$fpossize" in
43088:8) cat <<EOM
4309
4310You can have files larger than 2 gigabytes.
4311EOM
4312 val="$define" ;;
4313*) case "$uselargefiles" in
4314 "$undef"|false|[nN]*) dflt='n' ;;
4315 *) dflt='y' ;;
4316 esac
4317 cat <<EOM
4318
4319Perl can be built to understand large files (files larger than 2 gigabytes)
4320on some systems. To do so, Configure can be run with -Duselargefiles.
4321
4322If this doesn't make any sense to you, just accept the default '$dflt'.
4323EOM
4324 rp='Try to understand large files, if available?'
4325 . ./myread
4326 case "$ans" in
4327 y|Y) val="$define" ;;
4328 *) val="$undef" ;;
4329 esac
4330 ;;
4331esac
4332set uselargefiles
4333eval $setvar
4334case "$uselargefiles" in
4335"$define")
4336: Look for a hint-file generated 'call-back-unit'. If the
4337: user has specified that a large files perl is to be built,
4338: we may need to set or change some other defaults.
4339 if $test -f uselargefiles.cbu; then
4340 echo "Your platform has some specific hints for large file builds, using them..."
4341 . ./uselargefiles.cbu
4342 echo " "
4343 echo "Rechecking to see how big your file offsets are..." >&4
4344 $cat >try.c <<EOCP
4345#include <sys/types.h>
4346#include <stdio.h>
4347int main()
4348{
4349 printf("%d\n", (int)sizeof($lseektype));
4350 return(0);
4351}
4352EOCP
4353 set try
4354 if eval $compile_ok; then
4355 lseeksize=`./try`
4356 $echo "Your file offsets are now $lseeksize bytes long."
4357 else
4358 dflt="$lseeksize"
4359 echo " "
4360 echo "(I can't seem to compile the test program. Guessing...)"
4361 rp="What is the size of your file offsets (in bytes)?"
4362 . ./myread
4363 lseeksize="$ans"
4364 fi
4365 case "$fpostype" in
4366 *_t) zzz="$fpostype" ;;
4367 *) zzz="fpos_t" ;;
4368 esac
4369 $echo $n "Rechecking the size of $zzz...$c" >&4
4370 $cat > try.c <<EOCP
4371#include <sys/types.h>
4372#include <stdio.h>
4373int main() {
4374 printf("%d\n", (int)sizeof($fpostype));
4375 exit(0);
4376}
4377EOCP
4378 set try
4379 if eval $compile_ok; then
4380 yyy=`./try`
4381 dflt="$lseeksize"
4382 case "$yyy" in
4383 '') echo " "
4384 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4385 ;;
4386 *) fpossize=$yyy
4387 echo " $fpossize bytes." >&4
4388 ;;
4389 esac
4390 else
4391 dflt="$fpossize"
4392 echo " "
4393 echo "(I can't compile the test program. Guessing...)" >&4
4394 rp="What is the size of your file positions (in bytes)?"
4395 . ./myread
4396 fpossize="$ans"
4397 fi
4398 $rm -f try.c try
4399 fi
4400 ;;
4401esac
4402
4403
4404case "$usemorebits" in
4405"$define"|true|[yY]*)
4406 use64bitint="$define"
4407 uselongdouble="$define"
4408 usemorebits="$define"
4409 ;;
4410*) usemorebits="$undef"
4411 ;;
4412esac
4413
4414
4415case "$uselonglong" in
4416"$define"|true|[yY]*)
4417 cat <<EOM >&4
4418
4419*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4420EOM
4421 use64bitint="$define"
4422 ;;
4423esac
4424case "$use64bits" in
4425"$define"|true|[yY]*)
4426 cat <<EOM >&4
4427
4428*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4429EOM
4430 use64bitint="$define"
4431 ;;
4432esac
4433case "$use64bitints" in
4434"$define"|true|[yY]*)
4435 cat <<EOM >&4
4436
4437*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4438EOM
4439 use64bitint="$define"
4440 ;;
4441esac
4442case "$use64bitsint" in
4443"$define"|true|[yY]*)
4444 cat <<EOM >&4
4445
4446*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4447EOM
4448 use64bitint="$define"
4449 ;;
4450esac
4451case "$uselonglongs" in
4452"$define"|true|[yY]*)
4453 cat <<EOM >&4
4454
4455*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4456EOM
4457 use64bitint="$define"
4458 ;;
4459esac
4460case "$use64bitsall" in
4461"$define"|true|[yY]*)
4462 cat <<EOM >&4
4463
4464*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4465EOM
4466 use64bitall="$define"
4467 ;;
4468esac
4469
4470case "$ccflags" in
4471*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4472esac
4473case "$use64bitall" in
4474"$define"|true|[yY]*) use64bitint="$define" ;;
4475esac
4476
4477case "$longsize" in
44788) cat <<EOM
4479
4480You have natively 64-bit long integers.
4481EOM
4482 val="$define"
4483 ;;
4484*) case "$use64bitint" in
4485 "$define"|true|[yY]*) dflt='y';;
4486 *) dflt='n';;
4487 esac
4488 cat <<EOM
4489
4490Perl can be built to take advantage of 64-bit integer types
4491on some systems. To do so, Configure can be run with -Duse64bitint.
4492Choosing this option will most probably introduce binary incompatibilities.
4493
4494If this doesn't make any sense to you, just accept the default '$dflt'.
4495EOM
4496 rp='Try to use 64-bit integers, if available?'
4497 . ./myread
4498 case "$ans" in
4499 [yY]*) val="$define" ;;
4500 *) val="$undef" ;;
4501 esac
4502 ;;
4503esac
4504set use64bitint
4505eval $setvar
4506
4507case "$use64bitall" in
4508"$define"|true|[yY]*) dflt='y' ;;
4509*) case "$longsize" in
4510 8) dflt='y' ;;
4511 *) dflt='n' ;;
4512 esac
4513 ;;
4514esac
4515cat <<EOM
4516
4517You may also choose to try maximal 64-bitness. It means using as much
451864-bitness as possible on the platform. This in turn means even more
4519binary incompatibilities. On the other hand, your platform may not
4520have any more 64-bitness available than what you already have chosen.
4521
4522If this doesn't make any sense to you, just accept the default '$dflt'.
4523EOM
4524rp='Try to use maximal 64-bit support, if available?'
4525. ./myread
4526case "$ans" in
4527[yY]*) val="$define" ;;
4528*) val="$undef" ;;
4529esac
4530set use64bitall
4531eval $setvar
4532case "$use64bitall" in
4533"$define")
4534 case "$use64bitint" in
4535 "$undef")
4536 cat <<EOM
4537
4538Since you have chosen a maximally 64-bit build, I'm also turning on
4539the use of 64-bit integers.
4540EOM
4541 use64bitint="$define" ;;
4542 esac
4543 ;;
4544esac
4545
4546case "$use64bitint" in
4547"$define"|true|[yY]*)
4548: Look for a hint-file generated 'call-back-unit'. If the
4549: user has specified that a 64-bit perl is to be built,
4550: we may need to set or change some other defaults.
4551 if $test -f use64bitint.cbu; then
4552 echo "Your platform has some specific hints for 64-bit integers, using them..."
4553 . ./use64bitint.cbu
4554 fi
4555 case "$longsize" in
4556 4) case "$archname64" in
4557 '') archname64=64int ;;
4558 esac
4559 ;;
4560 esac
4561 ;;
4562esac
4563
4564case "$use64bitall" in
4565"$define"|true|[yY]*)
4566: Look for a hint-file generated 'call-back-unit'. If the
4567: user has specified that a maximally 64-bit perl is to be built,
4568: we may need to set or change some other defaults.
4569 if $test -f use64bitall.cbu; then
4570 echo "Your platform has some specific hints for 64-bit builds, using them..."
4571 . ./use64bitall.cbu
4572 fi
4573 case "$longsize" in
4574 4) case "$archname64" in
4575 ''|64int) archname64=64all ;;
4576 esac
4577 ;;
4578 esac
4579 ;;
4580esac
4581
4582echo " "
4583echo "Checking for GNU C Library..." >&4
4584cat >gnulibc.c <<EOM
4585#include <stdio.h>
4586int main()
4587{
4588#ifdef __GLIBC__
4589 exit(0);
4590#else
4591 exit(1);
4592#endif
4593}
4594EOM
4595set gnulibc
4596if eval $compile_ok && ./gnulibc; then
4597 val="$define"
4598 echo "You are using the GNU C Library"
4599else
4600 val="$undef"
4601 echo "You are not using the GNU C Library"
4602fi
4603$rm -f gnulibc*
4604set d_gnulibc
4605eval $setvar
4606
4607: see if nm is to be used to determine whether a symbol is defined or not
4608case "$usenm" in
4609'')
4610 dflt=''
c1a7f87b
JH
4611 case "$d_gnulibc" in
4612 "$define")
4613 echo " "
4614 echo "nm probably won't work on the GNU C Library." >&4
4615 dflt=n
bd9b35c9 4616 ;;
c1a7f87b
JH
4617 esac
4618 case "$dflt" in
4619 '')
4620 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4621 echo " "
4622 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
4623 echo "'nm' won't be sufficient on this sytem." >&4
4624 dflt=n
4625 fi
4626 ;;
4627 esac
4628 case "$dflt" in
4629 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4630 if $test $dflt -gt 20; then
4631 dflt=y
4632 else
4633 dflt=n
4634 fi
bd9b35c9
JH
4635 ;;
4636 esac
bd9b35c9
JH
4637 ;;
4638*)
c1a7f87b
JH
4639 case "$usenm" in
4640 true|$define) dflt=y;;
4641 *) dflt=n;;
4642 esac
bd9b35c9
JH
4643 ;;
4644esac
4645$cat <<EOM
4646
c1a7f87b
JH
4647I can use $nm to extract the symbols from your C libraries. This
4648is a time consuming task which may generate huge output on the disk (up
4649to 3 megabytes) but that should make the symbols extraction faster. The
4650alternative is to skip the 'nm' extraction part and to compile a small
4651test program instead to determine whether each symbol is present. If
4652you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4653this may be the best solution.
4654
4655You probably shouldn't let me use 'nm' if you are using the GNU C Library.
bd9b35c9
JH
4656
4657EOM
c1a7f87b
JH
4658rp="Shall I use $nm to extract C symbols from the libraries?"
4659. ./myread
4660case "$ans" in
4661[Nn]*) usenm=false;;
4662*) usenm=true;;
bd9b35c9 4663esac
bd9b35c9 4664
c1a7f87b
JH
4665runnm=$usenm
4666case "$reuseval" in
4667true) runnm=false;;
8e07c86e 4668esac
29209bc5 4669
c1a7f87b
JH
4670: nm options which may be necessary
4671case "$nm_opt" in
4672'') if $test -f /mach_boot; then
4673 nm_opt='' # Mach
4674 elif $test -d /usr/ccs/lib; then
4675 nm_opt='-p' # Solaris (and SunOS?)
4676 elif $test -f /dgux; then
4677 nm_opt='-p' # DG-UX
4678 elif $test -f /lib64/rld; then
4679 nm_opt='-p' # 64-bit Irix
4680 else
4681 nm_opt=''
4682 fi;;
4683esac
bd9b35c9 4684
c1a7f87b
JH
4685: nm options which may be necessary for shared libraries but illegal
4686: for archive libraries. Thank you, Linux.
4687case "$nm_so_opt" in
4688'') case "$myuname" in
4689 *linux*)
4690 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4691 nm_so_opt='--dynamic'
4692 fi
4693 ;;
bd9b35c9 4694 esac
c1a7f87b
JH
4695 ;;
4696esac
8e07c86e 4697
c1a7f87b
JH
4698case "$runnm" in
4699true)
4700: get list of predefined functions in a handy place
4701echo " "
4702case "$libc" in
4703'') libc=unknown
4704 case "$libs" in
4705 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
bd9b35c9 4706 esac
ff935051
JH
4707 ;;
4708esac
c1a7f87b
JH
4709libnames='';
4710case "$libs" in
4711'') ;;
4712*) for thislib in $libs; do
4713 case "$thislib" in
4714 -lc|-lc_s)
4715 : Handle C library specially below.
4716 ;;
4717 -l*)
4718 thislib=`echo $thislib | $sed -e 's/^-l//'`
4719 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4720 :
4721 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4722 :
4723 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4724 :
4725 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4726 :
4727 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4728 :
4729 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4730 :
4731 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4732 :
4733 else
4734 try=''
4735 fi
4736 libnames="$libnames $try"
4737 ;;
4738 *) libnames="$libnames $thislib" ;;
34d1710f 4739 esac
c1a7f87b 4740 done
4633a7c4
LW
4741 ;;
4742esac
c1a7f87b
JH
4743xxx=normal
4744case "$libc" in
4745unknown)
4746 set /lib/libc.$so
4747 for xxx in $libpth; do
4748 $test -r $1 || set $xxx/libc.$so
4749 : The messy sed command sorts on library version numbers.
4750 $test -r $1 || \
4751 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4752 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4753 h
4754 s/[0-9][0-9]*/0000&/g
4755 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4756 G
4757 s/\n/ /' | \
381aa1ff 4758 $sort | $sed -e 's/^.* //'`
c1a7f87b
JH
4759 eval set \$$#
4760 done
4761 $test -r $1 || set /usr/ccs/lib/libc.$so
4762 $test -r $1 || set /lib/libsys_s$_a
4763 ;;
4764*)
4765 set blurfl
4766 ;;
a4f3eea9 4767esac
c1a7f87b
JH
4768if $test -r "$1"; then
4769 echo "Your (shared) C library seems to be in $1."
4770 libc="$1"
4771elif $test -r /lib/libc && $test -r /lib/clib; then
4772 echo "Your C library seems to be in both /lib/clib and /lib/libc."
4773 xxx=apollo
4774 libc='/lib/clib /lib/libc'
4775 if $test -r /lib/syslib; then
4776 echo "(Your math library is in /lib/syslib.)"
4777 libc="$libc /lib/syslib"
4778 fi
4779elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4780 echo "Your C library seems to be in $libc, as you said before."
4781elif $test -r $incpath/usr/lib/libc$_a; then
4782 libc=$incpath/usr/lib/libc$_a;
4783 echo "Your C library seems to be in $libc. That's fine."
4784elif $test -r /lib/libc$_a; then
4785 libc=/lib/libc$_a;
4786 echo "Your C library seems to be in $libc. You're normal."
4787else
4788 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4789 :
4790 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4791 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4792 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4793 :
4794 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4795 :
4796 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4797 :
4798 else
4799 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4800 fi
4801 if $test -r "$tans"; then
4802 echo "Your C library seems to be in $tans, of all places."
4803 libc=$tans
4804 else
4805 libc='blurfl'
4806 fi
4807fi
4808if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4809 dflt="$libc"
4810 cat <<EOM
a4f3eea9 4811
c1a7f87b
JH
4812If the guess above is wrong (which it might be if you're using a strange
4813compiler, or your machine supports multiple models), you can override it here.
bd9b35c9
JH
4814
4815EOM
a4f3eea9 4816else
c1a7f87b 4817 dflt=''
381aa1ff 4818 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
c1a7f87b
JH
4819 cat >&4 <<EOM
4820I can't seem to find your C library. I've looked in the following places:
a4f3eea9 4821
c1a7f87b
JH
4822EOM
4823 $sed 's/^/ /' libpath
4824 cat <<EOM
29209bc5 4825
c1a7f87b 4826None of these seems to contain your C library. I need to get its name...
a4f3eea9 4827
bd9b35c9 4828EOM
bd9b35c9 4829fi
c1a7f87b
JH
4830fn=f
4831rp='Where is your C library?'
4832. ./getfile
4833libc="$ans"
a4f3eea9 4834
c1a7f87b 4835echo " "
381aa1ff 4836echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
c1a7f87b
JH
4837set X `cat libnames`
4838shift
4839xxx=files
4840case $# in 1) xxx=file; esac
4841echo "Extracting names from the following $xxx for later perusal:" >&4
4842echo " "
4843$sed 's/^/ /' libnames >&4
4844echo " "
4845$echo $n "This may take a while...$c" >&4
a4f3eea9 4846
c1a7f87b
JH
4847for file in $*; do
4848 case $file in
4849 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4850 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 4851 esac
c1a7f87b 4852done >libc.tmp
a4f3eea9 4853
c1a7f87b
JH
4854$echo $n ".$c"
4855$grep fprintf libc.tmp > libc.ptf
4856xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4857xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4858xxx='[ADTSIW]'
4859if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
4860 eval $xscan;\
4861 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4862 eval $xrun
4863elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4864 eval $xscan;\
4865 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4866 eval $xrun
4867elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4868 eval $xscan;\
4869 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4870 eval $xrun
4871elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4872 eval $xscan;\
4873 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4874 eval $xrun
4875elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4876 eval $xscan;\
4877 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4878 eval $xrun
4879elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4880 eval $xscan;\
4881 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4882 eval $xrun
4883elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4884 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
4885 eval $xscan;\
4886 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4887 eval $xrun
4888elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4889 eval $xscan;\
4890 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4891 eval $xrun
4892elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4893 eval $xscan;\
4894 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4895 eval $xrun
4896elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4897 eval $xscan;\
4898 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4899 eval $xrun
4900elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4901 eval $xscan;\
4902 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4903 eval $xrun
4904elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4905 eval $xscan;\
4906 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4907 eval $xrun
4908elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4909 eval $xscan;\
4910 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4911 eval $xrun
4912elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
4913 eval $xscan;\
4914 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4915 eval $xrun
4916else
4917 $nm -p $* 2>/dev/null >libc.tmp
4918 $grep fprintf libc.tmp > libc.ptf
4919 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4920 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4921 then
4922 nm_opt='-p'
4923 eval $xrun
bd9b35c9 4924 else
c1a7f87b
JH
4925 echo " "
4926 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
4927 com=''
4928 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
4929 for thisname in $libnames $libc; do
4930 $ar t $thisname >>libc.tmp
4931 done
4932 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
4933 echo "Ok." >&4
4934 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
4935 # Repeat libc to extract forwarders to DLL entries too
4936 for thisname in $libnames $libc; do
4937 $ar tv $thisname >>libc.tmp
4938 # Revision 50 of EMX has bug in $ar.
4939 # it will not extract forwarders to DLL entries
4940 # Use emximp which will extract exactly them.
4941 emximp -o tmp.imp $thisname \
4942 2>/dev/null && \
4943 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
4944 < tmp.imp >>libc.tmp
4945 $rm tmp.imp
4946 done
4947 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
4948 echo "Ok." >&4
4949 else
4950 echo "$ar didn't seem to work right." >&4
4951 echo "Maybe this is a Cray...trying bld instead..." >&4
4952 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
4953 then
4954 for thisname in $libnames; do
4955 bld t $libnames | \
4956 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
4957 $ar t $thisname >>libc.tmp
4958 done
4959 echo "Ok." >&4
bd9b35c9 4960 else
c1a7f87b
JH
4961 echo "That didn't work either. Giving up." >&4
4962 exit 1
bd9b35c9 4963 fi
c1a7f87b 4964 fi
a4f3eea9 4965 fi
a4f3eea9 4966fi
c1a7f87b
JH
4967nm_extract="$com"
4968if $test -f /lib/syscalls.exp; then
4969 echo " "
4970 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4971 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
4972fi
4973;;
4974esac
4975$rm -f libnames libpath
bd9b35c9 4976
c1a7f87b
JH
4977: is a C symbol defined?
4978csym='tlook=$1;
4979case "$3" in
4980-v) tf=libc.tmp; tc=""; tdc="";;
4981-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
4982*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4983esac;
4984tx=yes;
4985case "$reuseval-$4" in
4986true-) ;;
4987true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4988esac;
4989case "$tx" in
4990yes)
4991 case "$runnm" in
4992 true)
4993 if $contains $tlook $tf >/dev/null 2>&1;
4994 then tval=true;
4995 else tval=false;
4996 fi;;
4997 *)
4998 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
7a282f6d 4999 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
c1a7f87b
JH
5000 then tval=true;
5001 else tval=false;
5002 fi;
5003 $rm -f t t.c;;
5004 esac;;
5005*)
5006 case "$tval" in
5007 $define) tval=true;;
5008 *) tval=false;;
5009 esac;;
5010esac;
5011eval "$2=$tval"'
bd9b35c9 5012
c1a7f87b
JH
5013: define an is-in-libc? function
5014inlibc='echo " "; td=$define; tu=$undef;
5015sym=$1; var=$2; eval "was=\$$2";
5016tx=yes;
5017case "$reuseval$was" in
5018true) ;;
5019true*) tx=no;;
5020esac;
5021case "$tx" in
5022yes)
5023 set $sym tres -f;
5024 eval $csym;
5025 case "$tres" in
5026 true)
5027 echo "$sym() found." >&4;
5028 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5029 *)
5030 echo "$sym() NOT found." >&4;
5031 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5032 esac;;
bd9b35c9 5033*)
c1a7f87b
JH
5034 case "$was" in
5035 $define) echo "$sym() found." >&4;;
5036 *) echo "$sym() NOT found." >&4;;
5037 esac;;
5038esac'
5039
b4eb6b3d
JH
5040: see if sqrtl exists
5041set sqrtl d_sqrtl
c1a7f87b
JH
5042eval $inlibc
5043
b4eb6b3d
JH
5044case "$ccflags" in
5045*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
c1a7f87b 5046esac
b4eb6b3d
JH
5047
5048case "$uselongdouble" in
5049$define|true|[yY]*) dflt='y';;
5050*) dflt='n';;
5051esac
5052cat <<EOM
5053
5054Perl can be built to take advantage of long doubles which
5055(if available) may give more accuracy and range for floating point numbers.
5056
5057If this doesn't make any sense to you, just accept the default '$dflt'.
5058EOM
5059rp='Try to use long doubles if available?'
c1a7f87b
JH
5060. ./myread
5061case "$ans" in
b4eb6b3d
JH
5062y|Y) val="$define" ;;
5063*) val="$undef" ;;
5064esac
5065set uselongdouble
5066eval $setvar
bfb7748a 5067
b4eb6b3d
JH
5068case "$uselongdouble" in
5069true|[yY]*) uselongdouble="$define" ;;
5070esac
bfb7748a 5071
b4eb6b3d
JH
5072case "$uselongdouble" in
5073$define)
5074: Look for a hint-file generated 'call-back-unit'. If the
5075: user has specified that long doubles should be used,
5076: we may need to set or change some other defaults.
5077 if $test -f uselongdouble.cbu; then
5078 echo "Your platform has some specific hints for long doubles, using them..."
5079 . ./uselongdouble.cbu
5080 else
5081 $cat <<EOM
5082(Your platform doesn't have any specific hints for long doubles.)
c1a7f87b 5083EOM
b4eb6b3d
JH
5084 fi
5085 ;;
5086esac
5087
5088case "$uselongdouble:$d_sqrtl" in
5089$define:$undef)
5090 $cat <<EOM >&4
5091
5092*** You requested the use of long doubles but you do not seem to have
5093*** the mathematic functions for long doubles. I'm disabling the use
5094*** of long doubles.
5095
5096EOM
5097 uselongdouble=$undef
5098 ;;
5099esac
5100
5101: check for length of double
5102echo " "
5103case "$doublesize" in
5104'')
5105 echo "Checking to see how big your double precision numbers are..." >&4
5106 $cat >try.c <<'EOCP'
5107#include <stdio.h>
5108int main()
5109{
5110 printf("%d\n", (int)sizeof(double));
5111 exit(0);
5112}
5113EOCP
5114 set try
5115 if eval $compile_ok; then
5116 doublesize=`./try`
5117 echo "Your double is $doublesize bytes long."
5118 else
5119 dflt='8'
5120 echo "(I can't seem to compile the test program. Guessing...)"
5121 rp="What is the size of a double precision number (in bytes)?"
5122 . ./myread
5123 doublesize="$ans"
5124 fi
5125 ;;
5126esac
5127$rm -f try.c try
5128
5129: check for long doubles
5130echo " "
5131echo "Checking to see if you have long double..." >&4
5132echo 'int main() { long double x = 7.0; }' > try.c
5133set try
5134if eval $compile; then
5135 val="$define"
5136 echo "You have long double."
5137else
5138 val="$undef"
5139 echo "You do not have long double."
5140fi
5141$rm try.*
5142set d_longdbl
5143eval $setvar
5144
5145: check for length of long double
5146case "${d_longdbl}${longdblsize}" in
5147$define)
5148 echo " "
5149 echo "Checking to see how big your long doubles are..." >&4
5150 $cat >try.c <<'EOCP'
5151#include <stdio.h>
5152int main()
5153{
5154 printf("%d\n", sizeof(long double));
5155}
5156EOCP
5157 set try
5158 set try
5159 if eval $compile; then
5160 longdblsize=`./try$exe_ext`
5161 echo "Your long doubles are $longdblsize bytes long."
5162 else
5163 dflt='8'
5164 echo " "
5165 echo "(I can't seem to compile the test program. Guessing...)" >&4
5166 rp="What is the size of a long double (in bytes)?"
5167 . ./myread
5168 longdblsize="$ans"
5169 fi
5170 if $test "X$doublesize" = "X$longdblsize"; then
5171 echo "(That isn't any different from an ordinary double.)"
5172 fi
5173 ;;
5174esac
5175$rm -f try.* try
5176
5177: determine the architecture name
5178echo " "
5179if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5180 tarch=`arch`"-$osname"
5181elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5182 if uname -m > tmparch 2>&1 ; then
5183 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5184 -e 's/$/'"-$osname/" tmparch`
5185 else
5186 tarch="$osname"
5187 fi
5188 $rm -f tmparch
5189else
5190 tarch="$osname"
5191fi
5192case "$myarchname" in
5193''|"$tarch") ;;
5194*)
5195 echo "(Your architecture name used to be $myarchname.)"
5196 archname=''
5197 ;;
5198esac
5199myarchname="$tarch"
5200case "$archname" in
5201'') dflt="$tarch";;
5202*) dflt="$archname";;
5203esac
5204rp='What is your architecture name'
5205. ./myread
5206archname="$ans"
5207case "$usethreads" in
5208$define)
5209 echo "Threads selected." >&4
5210 case "$archname" in
5211 *-thread*) echo "...and architecture name already has -thread." >&4
5212 ;;
5213 *) archname="$archname-thread"
5214 echo "...setting architecture name to $archname." >&4
5215 ;;
5216 esac
5217 ;;
5218esac
5219case "$usemultiplicity" in
5220$define)
5221 echo "Multiplicity selected." >&4
5222 case "$archname" in
5223 *-multi*) echo "...and architecture name already has -multi." >&4
5224 ;;
5225 *) archname="$archname-multi"
5226 echo "...setting architecture name to $archname." >&4
5227 ;;
5228 esac
5229 ;;
5230esac
5231case "$use64bitint$use64bitall" in
5232*"$define"*)
5233 case "$archname64" in
5234 '')
5235 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5236 ;;
5237 *)
5238 case "$use64bitint" in
5239 "$define") echo "64 bit integers selected." >&4 ;;
5240 esac
5241 case "$use64bitall" in
5242 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5243 esac
5244 case "$archname" in
5245 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5246 ;;
5247 *) archname="$archname-$archname64"
5248 echo "...setting architecture name to $archname." >&4
5249 ;;
5250 esac
5251 ;;
5252 esac
5253esac
5254case "$uselongdouble" in
5255$define)
5256 echo "Long doubles selected." >&4
5257 case "$longdblsize" in
5258 $doublesize)
5259 "...but long doubles are equal to doubles, not changing architecture name." >&4
5260 ;;
5261 *)
5262 case "$archname" in
5263 *-ld*) echo "...and architecture name already has -ld." >&4
5264 ;;
5265 *) archname="$archname-ld"
5266 echo "...setting architecture name to $archname." >&4
5267 ;;
5268 esac
5269 ;;
5270 esac
5271 ;;
5272esac
5273
5274: determine root of directory hierarchy where package will be installed.
5275case "$prefix" in
5276'')
5277 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5278 ;;
5279*)
5280 dflt="$prefix"
5281 ;;
5282esac
5283$cat <<EOM
5284
5285By default, $package will be installed in $dflt/bin, manual pages
5286under $dflt/man, etc..., i.e. with $dflt as prefix for all
5287installation directories. Typically this is something like /usr/local.
5288If you wish to have binaries under /usr/bin but other parts of the
5289installation under /usr/local, that's ok: you will be prompted
5290separately for each of the installation directories, the prefix being
5291only used to set the defaults.
5292
5293EOM
5294fn=d~
5295rp='Installation prefix to use?'
5296. ./getfile
5297oldprefix=''
5298case "$prefix" in
5299'') ;;
5300*)
5301 case "$ans" in
5302 "$prefix") ;;
5303 *) oldprefix="$prefix";;
5304 esac
5305 ;;
5306esac
5307prefix="$ans"
5308prefixexp="$ansexp"
5309
5310: is AFS running?
5311echo " "
5312case "$afs" in
5313$define|true) afs=true ;;
5314$undef|false) afs=false ;;
5315*) if test -d /afs; then
5316 afs=true
5317 else
5318 afs=false
5319 fi
5320 ;;
5321esac
5322if $afs; then
5323 echo "AFS may be running... I'll be extra cautious then..." >&4
5324else
5325 echo "AFS does not seem to be running..." >&4
5326fi
5327
5328: determine installation prefix for where package is to be installed.
5329if $afs; then
5330$cat <<EOM
5331
5332Since you are running AFS, I need to distinguish the directory in which
5333files will reside from the directory in which they are installed (and from
5334which they are presumably copied to the former directory by occult means).
5335
5336EOM
5337 case "$installprefix" in
5338 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5339 *) dflt="$installprefix";;
5340 esac
5341else
5342$cat <<EOM
5343
5344In some special cases, particularly when building $package for distribution,
5345it is convenient to distinguish between the directory in which files should
5346be installed from the directory ($prefix) in which they
5347will eventually reside. For most users, these two directories are the same.
5348
5349EOM
5350 case "$installprefix" in
5351 '') dflt=$prefix ;;
5352 *) dflt=$installprefix;;
5353 esac
5354fi
5355fn=d~
5356rp='What installation prefix should I use for installing files?'
5357. ./getfile
5358installprefix="$ans"
5359installprefixexp="$ansexp"
5360
5361: set the prefixit variable, to compute a suitable default value
5362prefixit='case "$3" in
5363""|none)
5364 case "$oldprefix" in
5365 "") eval "$1=\"\$$2\"";;
5366 *)
5367 case "$3" in
5368 "") eval "$1=";;
5369 none)
5370 eval "tp=\"\$$2\"";
5371 case "$tp" in
5372 ""|" ") eval "$1=\"\$$2\"";;
5373 *) eval "$1=";;
5374 esac;;
5375 esac;;
5376 esac;;
5377*)
5378 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5379 case "$tp" in
5380 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5381 /*-$oldprefix/*|\~*-$oldprefix/*)
5382 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5383 *) eval "$1=\"\$$2\"";;
5384 esac;;
5385esac'
5386
5387
5388: get the patchlevel
5389echo " "
5390echo "Getting the current patchlevel..." >&4
5391if $test -r $rsrc/patchlevel.h;then
5392 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5393 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5394 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5395 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5396 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5397 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5398else
5399 revision=0
5400 patchlevel=0
5401 subversion=0
5402 api_revision=0
5403 api_version=0
5404 api_subversion=0
5405fi
5406$echo "(You have $package version $patchlevel subversion $subversion.)"
5407case "$osname" in
5408dos|vms)
5409 : XXX Should be a Configure test for double-dots in filenames.
5410 version=`echo $revision $patchlevel $subversion | \
5411 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5412 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5413 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5414 ;;
5415*)
5416 version=`echo $revision $patchlevel $subversion | \
5417 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5418 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5419 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5420 ;;
5421esac
5422: Special case the 5.005_xx maintenance series, which used 5.005
5423: without any subversion label as a subdirectory in $sitelib
5424if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5425 api_versionstring='5.005'
5426fi
5427
5428: determine installation style
5429: For now, try to deduce it from prefix unless it is already set.
5430: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5431case "$installstyle" in
5432'') case "$prefix" in
5433 *perl*) dflt='lib';;
5434 *) dflt='lib/perl5' ;;
5435 esac
5436 ;;
5437*) dflt="$installstyle" ;;
5438esac
5439: Probably not worth prompting for this since we prompt for all
5440: the directories individually, and the prompt would be too long and
5441: confusing anyway.
5442installstyle=$dflt
5443
5444: determine where private library files go
5445: Usual default is /usr/local/lib/perl5/$version.
5446: Also allow things like /opt/perl/lib/$version, since
5447: /opt/perl/lib/perl5... would be redundant.
5448: The default "style" setting is made in installstyle.U
5449case "$installstyle" in
5450*lib/perl5*) set dflt privlib lib/$package/$version ;;
5451*) set dflt privlib lib/$version ;;
5452esac
5453eval $prefixit
5454$cat <<EOM
5455
5456There are some auxiliary files for $package that need to be put into a
5457private library directory that is accessible by everyone.
5458
5459EOM
5460fn=d~+
5461rp='Pathname where the private library files will reside?'
5462. ./getfile
5463privlib="$ans"
5464privlibexp="$ansexp"
5465: Change installation prefix, if necessary.
5466if $test X"$prefix" != X"$installprefix"; then
5467 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5468else
5469 installprivlib="$privlibexp"
5470fi
5471
5472: set the prefixup variable, to restore leading tilda escape
5473prefixup='case "$prefixexp" in
5474"$prefix") ;;
5475*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5476esac'
5477
5478: determine where public architecture dependent libraries go
5479set archlib archlib
5480eval $prefixit
5481: privlib default is /usr/local/lib/$package/$version
5482: archlib default is /usr/local/lib/$package/$version/$archname
5483: privlib may have an optional trailing /share.
5484tdflt=`echo $privlib | $sed 's,/share$,,'`
5485tdflt=$tdflt/$archname
5486case "$archlib" in
5487'') dflt=$tdflt
5488 ;;
5489*) dflt="$archlib"
5490 ;;
5491esac
5492$cat <<EOM
5493
5494$spackage contains architecture-dependent library files. If you are
5495sharing libraries in a heterogeneous environment, you might store
5496these files in a separate location. Otherwise, you can just include
5497them with the rest of the public library files.
5498
5499EOM
5500fn=d+~
5501rp='Where do you want to put the public architecture-dependent libraries?'
5502. ./getfile
5503archlib="$ans"
5504archlibexp="$ansexp"
5505if $test X"$archlib" = X"$privlib"; then
5506 d_archlib="$undef"
5507else
5508 d_archlib="$define"
5509fi
5510: Change installation prefix, if necessary.
5511if $test X"$prefix" != X"$installprefix"; then
5512 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5513else
5514 installarchlib="$archlibexp"
5515fi
5516
5517
5518: Binary compatibility with 5.005 is not possible for builds
5519: with advanced features
5520case "$usethreads$usemultiplicity" in
5521*define*)
5522 bincompat5005="$undef"
5523 d_bincompat5005="$undef"
5524 ;;
5525*) $cat <<EOM
5526
5527This version of Perl can be compiled for binary compatibility with 5.005.
5528If you decide to do so, you will be able to continue using most of the
5529extensions that were compiled for Perl 5.005.
5530
5531EOM
5532 case "$bincompat5005$d_bincompat5005" in
5533 *"$undef"*) dflt=n ;;
5534 *) dflt=y ;;
5535 esac
5536 rp='Binary compatibility with Perl 5.005?'
5537 . ./myread
5538 case "$ans" in
5539 y*) val="$define" ;;
5540 *) val="$undef" ;;
5541 esac
5542 set d_bincompat5005
5543 eval $setvar
5544 case "$d_bincompat5005" in
5545 "$define")
5546 bincompat5005="$define"
5547 ;;
5548 *) bincompat5005="$undef"
5549 d_bincompat5005="$undef"
5550 ;;
5551 esac
5552 ;;
5553esac
5554
5555
5556: see if setuid scripts can be secure
5557$cat <<EOM
5558
5559Some kernels have a bug that prevents setuid #! scripts from being
5560secure. Some sites have disabled setuid #! scripts because of this.
5561
5562First let's decide if your kernel supports secure setuid #! scripts.
5563(If setuid #! scripts would be secure but have been disabled anyway,
5564don't say that they are secure if asked.)
5565
5566EOM
5567
5568val="$undef"
5569if $test -d /dev/fd; then
5570 echo "#!$ls" >reflect
5571 chmod +x,u+s reflect
5572 ./reflect >flect 2>&1
5573 if $contains "/dev/fd" flect >/dev/null; then
5574 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5575 val="$define"
5576 else
5577 $cat <<EOM
5578If you are not sure if they are secure, I can check but I'll need a
5579username and password different from the one you are using right now.
5580If you don't have such a username or don't want me to test, simply
5581enter 'none'.
5582
5583EOM
5584 rp='Other username to test security of setuid scripts with?'
5585 dflt='none'
5586 . ./myread
5587 case "$ans" in
5588 n|none)
5589 case "$d_suidsafe" in
5590 '') echo "I'll assume setuid scripts are *not* secure." >&4
5591 dflt=n;;
5592 "$undef")
5593 echo "Well, the $hint value is *not* secure." >&4
5594 dflt=n;;
5595 *) echo "Well, the $hint value *is* secure." >&4
5596 dflt=y;;
5597 esac
c1a7f87b 5598 ;;
b4eb6b3d
JH
5599 *)
5600 $rm -f reflect flect
5601 echo "#!$ls" >reflect
5602 chmod +x,u+s reflect
5603 echo >flect
5604 chmod a+w flect
5605 echo '"su" will (probably) prompt you for '"$ans's password."
5606 su $ans -c './reflect >flect'
5607 if $contains "/dev/fd" flect >/dev/null; then
5608 echo "Okay, it looks like setuid scripts are secure." >&4
5609 dflt=y
5610 else
5611 echo "I don't think setuid scripts are secure." >&4
5612 dflt=n
5613 fi
5614 ;;
5615 esac
5616 rp='Does your kernel have *secure* setuid scripts?'
5617 . ./myread
5618 case "$ans" in
5619 [yY]*) val="$define";;
5620 *) val="$undef";;
5621 esac
5622 fi
5623else
5624 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5625 echo "(That's for file descriptors, not floppy disks.)"
5626 val="$undef"
5627fi
5628set d_suidsafe
5629eval $setvar
5630
5631$rm -f reflect flect
5632
5633: now see if they want to do setuid emulation
5634echo " "
5635val="$undef"
5636case "$d_suidsafe" in
5637"$define")
5638 val="$undef"
5639 echo "No need to emulate SUID scripts since they are secure here." >& 4
5640 ;;
5641*)
5642 $cat <<EOM
5643Some systems have disabled setuid scripts, especially systems where
5644setuid scripts cannot be secure. On systems where setuid scripts have
5645been disabled, the setuid/setgid bits on scripts are currently
5646useless. It is possible for $package to detect those bits and emulate
5647setuid/setgid in a secure fashion. This emulation will only work if
5648setuid scripts have been disabled in your kernel.
5649
5650EOM
5651 case "$d_dosuid" in
5652 "$define") dflt=y ;;
5653 *) dflt=n ;;
5654 esac
5655 rp="Do you want to do setuid/setgid emulation?"
5656 . ./myread
5657 case "$ans" in
5658 [yY]*) val="$define";;
5659 *) val="$undef";;
5660 esac
5661 ;;
5662esac
5663set d_dosuid
5664eval $setvar
5665
5666: determine filename position in cpp output
5667echo " "
5668echo "Computing filename position in cpp output for #include directives..." >&4
5669echo '#include <stdio.h>' > foo.c
5670$cat >fieldn <<EOF
5671$startsh
5672$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5673$grep '^[ ]*#.*stdio\.h' | \
5674while read cline; do
5675 pos=1
5676 set \$cline
5677 while $test \$# -gt 0; do
5678 if $test -r \`echo \$1 | $tr -d '"'\`; then
5679 echo "\$pos"
5680 exit 0
5681 fi
5682 shift
5683 pos=\`expr \$pos + 1\`
5684 done
5685done
5686EOF
5687chmod +x fieldn
5688fieldn=`./fieldn`
5689$rm -f foo.c fieldn
5690case $fieldn in
5691'') pos='???';;
56921) pos=first;;
56932) pos=second;;
56943) pos=third;;
5695*) pos="${fieldn}th";;
5696esac
5697echo "Your cpp writes the filename in the $pos field of the line."
5698
5699: locate header file
5700$cat >findhdr <<EOF
5701$startsh
5702wanted=\$1
5703name=''
5704for usrincdir in $usrinc
5705do
5706 if test -f \$usrincdir/\$wanted; then
5707 echo "\$usrincdir/\$wanted"
5708 exit 0
5709 fi
5710done
5711awkprg='{ print \$$fieldn }'
5712echo "#include <\$wanted>" > foo\$\$.c
5713$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5714$grep "^[ ]*#.*\$wanted" | \
5715while read cline; do
5716 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5717 case "\$name" in
5718 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5719 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5720 *) exit 2;;
5721 esac;
5722done;
5723#
5724# status = 0: grep returned 0 lines, case statement not executed
5725# status = 1: headerfile found
5726# status = 2: while loop executed, no headerfile found
5727#
5728status=\$?
5729$rm -f foo\$\$.c;
5730if test \$status -eq 1; then
5731 exit 0;
5732fi
5733exit 1
5734EOF
5735chmod +x findhdr
5736
5737: define an alternate in-header-list? function
5738inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5739cont=true; xxf="echo \"<\$1> found.\" >&4";
5740case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5741*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5742esac;
5743case $# in 4) instead=instead;; *) instead="at last";; esac;
5744while $test "$cont"; do
5745 xxx=`./findhdr $1`
5746 var=$2; eval "was=\$$2";
5747 if $test "$xxx" && $test -r "$xxx";
5748 then eval $xxf;
5749 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5750 cont="";
5751 else eval $xxnf;
5752 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5753 set $yyy; shift; shift; yyy=$@;
5754 case $# in 0) cont="";;
5755 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5756 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5757 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5758 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5759 esac;
5760done;
5761while $test "$yyy";
5762do set $yyy; var=$2; eval "was=\$$2";
5763 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5764 set $yyy; shift; shift; yyy=$@;
5765done'
5766
5767: see if this is a malloc.h system
5768set malloc.h i_malloc
5769eval $inhdr
5770
5771: see if stdlib is available
5772set stdlib.h i_stdlib
5773eval $inhdr
5774
5775: determine which malloc to compile in
5776echo " "
5777case "$usemymalloc" in
5778''|[yY]*|true|$define) dflt='y' ;;
5779*) dflt='n' ;;
5780esac
5781rp="Do you wish to attempt to use the malloc that comes with $package?"
5782. ./myread
5783usemymalloc="$ans"
5784case "$ans" in
5785y*|true)
5786 usemymalloc='y'
5787 mallocsrc='malloc.c'
5788 mallocobj="malloc$_o"
5789 d_mymalloc="$define"
5790 case "$libs" in
5791 *-lmalloc*)
5792 : Remove malloc from list of libraries to use
5793 echo "Removing unneeded -lmalloc from library list" >&4
5794 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5795 shift
5796 libs="$*"
5797 echo "libs = $libs" >&4
5798 ;;
5799 esac
5800 ;;
5801*)
5802 usemymalloc='n'
5803 mallocsrc=''
5804 mallocobj=''
5805 d_mymalloc="$undef"
5806 ;;
5807esac
5808
5809: compute the return types of malloc and free
5810echo " "
5811$cat >malloc.c <<END
5812#$i_malloc I_MALLOC
5813#$i_stdlib I_STDLIB
5814#include <stdio.h>
5815#include <sys/types.h>
5816#ifdef I_MALLOC
5817#include <malloc.h>
5818#endif
5819#ifdef I_STDLIB
5820#include <stdlib.h>
5821#endif
5822#ifdef TRY_MALLOC
5823void *malloc();
5824#endif
5825#ifdef TRY_FREE
5826void free();
5827#endif
5828END
5829case "$malloctype" in
5830'')
5831 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5832 malloctype='void *'
5833 else
5834 malloctype='char *'
5835 fi
5836 ;;
5837esac
5838echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5839
5840case "$freetype" in
5841'')
5842 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5843 freetype='void'
5844 else
5845 freetype='int'
5846 fi
5847 ;;
5848esac
5849echo "Your system uses $freetype free(), it would seem." >&4
5850$rm -f malloc.[co]
5851$cat <<EOM
5852
5853After $package is installed, you may wish to install various
5854add-on modules and utilities. Typically, these add-ons will
5855be installed under $prefix with the rest
5856of this package. However, you may wish to install such add-ons
5857elsewhere under a different prefix.
5858
5859If you do not wish to put everything under a single prefix, that's
5860ok. You will be prompted for the individual locations; this siteprefix
5861is only used to suggest the defaults.
5862
5863The default should be fine for most people.
5864
5865EOM
5866fn=d~+
5867rp='Installation prefix to use for add-on modules and utilities?'
5868: XXX Here might be another good place for an installstyle setting.
5869case "$siteprefix" in
5870'') dflt=$prefix ;;
5871*) dflt=$siteprefix ;;
5872esac
5873. ./getfile
5874: XXX Prefixit unit does not yet support siteprefix and vendorprefix
5875oldsiteprefix=''
5876case "$siteprefix" in
5877'') ;;
5878*) case "$ans" in
5879 "$prefix") ;;
5880 *) oldsiteprefix="$prefix";;
5881 esac
5882 ;;
5883esac
5884siteprefix="$ans"
5885siteprefixexp="$ansexp"
5886
5887: determine where site specific libraries go.
5888: Usual default is /usr/local/lib/perl5/site_perl/$version
5889: The default "style" setting is made in installstyle.U
5890: XXX No longer works with Prefixit stuff.
5891prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5892case "$sitelib" in
5893'') case "$installstyle" in
5894 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5895 *) dflt=$siteprefix/lib/site_$prog/$version ;;
5896 esac
5897 ;;
5898*) dflt="$sitelib"
5899 ;;
5900esac
5901$cat <<EOM
5902
5903The installation process will create a directory for
5904site-specific extensions and modules. Most users find it convenient
5905to place all site-specific files in this directory rather than in the
5906main distribution directory.
5907
5908EOM
5909fn=d~+
5910rp='Pathname for the site-specific library files?'
5911. ./getfile
5912sitelib="$ans"
5913sitelibexp="$ansexp"
5914sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5915: Change installation prefix, if necessary.
5916if $test X"$prefix" != X"$installprefix"; then
5917 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5918else
5919 installsitelib="$sitelibexp"
5920fi
5921
5922: determine where site specific architecture-dependent libraries go.
5923: sitelib default is /usr/local/lib/perl5/site_perl/$version
5924: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5925: sitelib may have an optional trailing /share.
5926case "$sitearch" in
5927'') dflt=`echo $sitelib | $sed 's,/share$,,'`
5928 dflt="$dflt/$archname"
5929 ;;
5930*) dflt="$sitearch"
5931 ;;
5932esac
5933set sitearch sitearch none
5934eval $prefixit
5935$cat <<EOM
5936
5937The installation process will also create a directory for
5938architecture-dependent site-specific extensions and modules.
5939
5940EOM
5941fn=d~+
5942rp='Pathname for the site-specific architecture-dependent library files?'
5943. ./getfile
5944sitearch="$ans"
5945sitearchexp="$ansexp"
5946: Change installation prefix, if necessary.
5947if $test X"$prefix" != X"$installprefix"; then
5948 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5949else
5950 installsitearch="$sitearchexp"
5951fi
5952
5953$cat <<EOM
5954
5955The installation process will also create a directory for
5956vendor-supplied add-ons. Vendors who supply perl with their system
5957may find it convenient to place all vendor-supplied files in this
5958directory rather than in the main distribution directory. This will
5959ease upgrades between binary-compatible maintenance versions of perl.
5960
5961Of course you may also use these directories in whatever way you see
5962fit. For example, you might use them to access modules shared over a
5963company-wide network.
5964
5965The default answer should be fine for most people.
5966This causes further questions about vendor add-ons to be skipped
5967and no vendor-specific directories will be configured for perl.
5968
5969EOM
5970rp='Do you want to configure vendor-specific add-on directories?'
5971case "$usevendorprefix" in
5972define|true|[yY]*) dflt=y ;;
5973*) : User may have set vendorprefix directly on Configure command line.
5974 case "$vendorprefix" in
5975 ''|' ') dflt=n ;;
5976 *) dflt=y ;;
5977 esac
5978 ;;
5979esac
5980. ./myread
5981case "$ans" in
5982[yY]*) fn=d~+
5983 rp='Installation prefix to use for vendor-supplied add-ons?'
5984 case "$vendorprefix" in
5985 '') dflt='' ;;
5986 *) dflt=$vendorprefix ;;
5987 esac
5988 . ./getfile
5989 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5990 oldvendorprefix=''
5991 case "$vendorprefix" in
5992 '') ;;
5993 *) case "$ans" in
5994 "$prefix") ;;
5995 *) oldvendorprefix="$prefix";;
5996 esac
5997 ;;
5998 esac
5999 usevendorprefix="$define"
6000 vendorprefix="$ans"
6001 vendorprefixexp="$ansexp"
6002 ;;
6003*) usevendorprefix="$undef"
6004 vendorprefix=''
6005 vendorprefixexp=''
6006 ;;
6007esac
6008
6009case "$vendorprefix" in
6010'') d_vendorlib="$undef"
6011 vendorlib=''
6012 vendorlibexp=''
6013 ;;
6014*) d_vendorlib="$define"
6015 : determine where vendor-supplied modules go.
6016 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6017 case "$vendorlib" in
6018 '')
6019 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6020 case "$installstyle" in
6021 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6022 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6023 esac
6024 ;;
6025 *) dflt="$vendorlib"
6026 ;;
6027 esac
6028 fn=d~+
6029 rp='Pathname for the vendor-supplied library files?'
6030 . ./getfile
6031 vendorlib="$ans"
6032 vendorlibexp="$ansexp"
6033 ;;
6034esac
6035vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6036: Change installation prefix, if necessary.
6037if $test X"$prefix" != X"$installprefix"; then
6038 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6039else
6040 installvendorlib="$vendorlibexp"
6041fi
6042
6043case "$vendorprefix" in
6044'') d_vendorarch="$undef"
6045 vendorarch=''
6046 vendorarchexp=''
6047 ;;
6048*) d_vendorarch="$define"
6049 : determine where vendor-supplied architecture-dependent libraries go.
6050 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6051 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6052 : vendorlib may have an optional trailing /share.
6053 case "$vendorarch" in
6054 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6055 dflt="$dflt/$archname"
6056 ;;
6057 *) dflt="$vendorarch" ;;
6058 esac
6059 fn=d~+
6060 rp='Pathname for vendor-supplied architecture-dependent files?'
6061 . ./getfile
6062 vendorarch="$ans"
6063 vendorarchexp="$ansexp"
6064 ;;
6065esac
6066: Change installation prefix, if necessary.
6067if $test X"$prefix" != X"$installprefix"; then
6068 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6069else
6070 installvendorarch="$vendorarchexp"
6071fi
6072
6073: Final catch-all directories to search
6074$cat <<EOM
6075
6076Lastly, you can have perl look in other directories for extensions and
6077modules in addition to those already specified.
6078These directories will be searched after
6079 $sitearch
6080 $sitelib
6081EOM
6082test X"$vendorlib" != "X" && echo ' ' $vendorlib
6083test X"$vendorarch" != "X" && echo ' ' $vendorarch
6084echo ' '
6085case "$otherlibdirs" in
6086''|' ') dflt='none' ;;
6087*) dflt="$otherlibdirs" ;;
6088esac
6089$cat <<EOM
6090Enter a colon-separated set of extra paths to include in perl's @INC
6091search path, or enter 'none' for no extra paths.
6092
6093EOM
6094
6095rp='Colon-separated list of additional directories for perl to search?'
6096. ./myread
6097case "$ans" in
6098' '|''|none) otherlibdirs=' ' ;;
6099*) otherlibdirs="$ans" ;;
6100esac
6101case "$otherlibdirs" in
6102' ') val=$undef ;;
6103*) val=$define ;;
6104esac
6105set d_perl_otherlibdirs
6106eval $setvar
6107
6108: Cruising for prototypes
6109echo " "
6110echo "Checking out function prototypes..." >&4
6111$cat >prototype.c <<'EOCP'
6112int main(int argc, char *argv[]) {
6113 exit(0);}
6114EOCP
6115if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6116 echo "Your C compiler appears to support function prototypes."
6117 val="$define"
6118else
6119 echo "Your C compiler doesn't seem to understand function prototypes."
6120 val="$undef"
6121fi
6122set prototype
6123eval $setvar
6124$rm -f prototype*
6125
6126case "$prototype" in
6127"$define") ;;
6128*) ansi2knr='ansi2knr'
6129 echo " "
6130 cat <<EOM >&4
6131
6132$me: FATAL ERROR:
6133This version of $package can only be compiled by a compiler that
6134understands function prototypes. Unfortunately, your C compiler
6135 $cc $ccflags
6136doesn't seem to understand them. Sorry about that.
6137
6138If GNU cc is available for your system, perhaps you could try that instead.
6139
6140Eventually, we hope to support building Perl with pre-ANSI compilers.
6141If you would like to help in that effort, please contact <perlbug@perl.org>.
6142
6143Aborting Configure now.
6144EOM
6145 exit 2
6146 ;;
6147esac
6148
6149: determine where public executables go
6150echo " "
6151set dflt bin bin
6152eval $prefixit
6153fn=d~
6154rp='Pathname where the public executables will reside?'
6155. ./getfile
6156if $test "X$ansexp" != "X$binexp"; then
6157 installbin=''
6158fi
6159bin="$ans"
6160binexp="$ansexp"
6161: Change installation prefix, if necessary.
6162: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6163if $test X"$prefix" != X"$installprefix"; then
6164 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6165else
6166 installbin="$binexp"
6167fi
6168
6169: Find perl5.005 or later.
6170echo "Looking for a previously installed perl5.005 or later... "
6171case "$perl5" in
6172'') for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6173 : Check if this perl is recent and can load a simple module
6174 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6175 perl5=$tdir/perl
6176 break;
6177 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6178 perl5=$tdir/perl
6179 break;
6180 fi
6181 done
6182 ;;
6183*) perl5="$perl5"
6184 ;;
6185esac
6186case "$perl5" in
6187'') echo "None found. That's ok.";;
6188*) echo "Using $perl5." ;;
6189esac
6190
6191: Determine list of previous versions to include in @INC
6192$cat > getverlist <<EOPL
6193#!$perl5 -w
6194use File::Basename;
6195\$api_versionstring = "$api_versionstring";
6196\$version = "$version";
6197\$stem = "$sitelib_stem";
6198\$archname = "$archname";
6199EOPL
6200 $cat >> getverlist <<'EOPL'
6201# Can't have leading @ because metaconfig interprets it as a command!
6202;@inc_version_list=();
6203# XXX Redo to do opendir/readdir?
6204if (-d $stem) {
6205 chdir($stem);
6206 ;@candidates = glob("5.*");
6207}
6208else {
6209 ;@candidates = ();
6210}
6211
6212# XXX ToDo: These comparisons must be reworked when two-digit
6213# subversions come along, so that 5.7.10 compares as greater than
6214# 5.7.3! By that time, hope that 5.6.x is sufficiently
6215# widespread that we can use the built-in version vectors rather
6216# than reinventing them here. For 5.6.0, however, we must
6217# assume this script will likely be run by 5.005_0x. --AD 1/2000.
6218foreach $d (@candidates) {
6219 if ($d lt $version) {
6220 if ($d ge $api_versionstring) {
6221 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6222 }
6223 elsif ($d ge "5.005") {
6224 unshift(@inc_version_list, grep { -d } $d);
6225 }
6226 }
6227 else {
6228 # Skip newer version. I.e. don't look in
6229 # 5.7.0 if we're installing 5.6.1.
6230 }
6231}
6232
6233if (@inc_version_list) {
6234 print join(' ', @inc_version_list);
6235}
6236else {
6237 # Blank space to preserve value for next Configure run.
6238 print " ";
6239}
6240EOPL
6241chmod +x getverlist
6242case "$inc_version_list" in
6243'') if test -x "$perl5"; then
6244 dflt=`$perl5 getverlist`
6245 else
6246 dflt='none'
6247 fi
6248 ;;
6249$undef) dflt='none' ;;
6250*) dflt="$inc_version_list" ;;
6251esac
6252case "$dflt" in
6253''|' ') dflt=none ;;
6254esac
6255case "$dflt" in
62565.005) case "$bincompat5005" in
6257 $define|true|[yY]*) ;;
6258 *) dflt=none ;;
6259 esac
6260 ;;
6261esac
6262$cat <<'EOM'
6263
6264In order to ease the process of upgrading, this version of perl
6265can be configured to use modules built and installed with earlier
6266versions of perl that were installed under $prefix. Specify here
6267the list of earlier versions that this version of perl should check.
6268If Configure detected no earlier versions of perl installed under
6269$prefix, then the list will be empty. Answer 'none' to tell perl
6270to not search earlier versions.
6271
6272The default should almost always be sensible, so if you're not sure,
6273just accept the default.
6274EOM
6275
6276rp='List of earlier versions to include in @INC?'
6277. ./myread
6278case "$ans" in
6279[Nn]one|''|' ') inc_version_list=' ' ;;
6280*) inc_version_list="$ans" ;;
6281esac
6282case "$inc_version_list" in
6283''|' ')
6284 inc_version_list_init='0';;
6285*) inc_version_list_init=`echo $inc_version_list |
6286 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6287 ;;
6288esac
6289$rm -f getverlist
6290
6291: determine whether to install perl also as /usr/bin/perl
6292
6293echo " "
6294if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6295 $cat <<EOM
6296Many scripts expect perl to be installed as /usr/bin/perl.
6297I can install the perl you are about to compile also as /usr/bin/perl
6298(in addition to $installbin/perl).
6299EOM
6300 case "$installusrbinperl" in
6301 "$undef"|[nN]*) dflt='n';;
6302 *) dflt='y';;
6303 esac
6304 rp="Do you want to install perl as /usr/bin/perl?"
6305 . ./myread
6306 case "$ans" in
6307 [yY]*) val="$define";;
6308 *) val="$undef" ;;
6309 esac
6310else
6311 val="$undef"
6312fi
6313set installusrbinperl
6314eval $setvar
6315
6316: see if dld is available
6317set dld.h i_dld
6318eval $inhdr
6319
6320: see if dlopen exists
6321xxx_runnm="$runnm"
6322runnm=false
6323set dlopen d_dlopen
6324eval $inlibc
6325runnm="$xxx_runnm"
6326
6327: determine which dynamic loading, if any, to compile in
6328echo " "
6329dldir="ext/DynaLoader"
6330case "$usedl" in
6331$define|y|true)
6332 dflt='y'
6333 usedl="$define"
6334 ;;
6335$undef|n|false)
6336 dflt='n'
6337 usedl="$undef"
6338 ;;
6339*)
6340 dflt='n'
6341 case "$d_dlopen" in
6342 $define) dflt='y' ;;
6343 esac
6344 case "$i_dld" in
6345 $define) dflt='y' ;;
6346 esac
6347 : Does a dl_xxx.xs file exist for this operating system
6348 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6349 ;;
6350esac
6351rp="Do you wish to use dynamic loading?"
6352. ./myread
6353usedl="$ans"
6354case "$ans" in
6355y*) usedl="$define"
6356 case "$dlsrc" in
6357 '')
6358 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6359 dflt="$dldir/dl_${osname}.xs"
6360 elif $test "$d_dlopen" = "$define" ; then
6361 dflt="$dldir/dl_dlopen.xs"
6362 elif $test "$i_dld" = "$define" ; then
6363 dflt="$dldir/dl_dld.xs"
6364 else
6365 dflt=''
6366 fi
6367 ;;
6368 *) dflt="$dldir/$dlsrc"
6369 ;;
6370 esac
6371 echo "The following dynamic loading files are available:"
6372 : Can not go over to $dldir because getfile has path hard-coded in.
6373 tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6374 rp="Source file to use for dynamic loading"
6375 fn="fne"
6376 gfpth="$src"
6377 . ./getfile
6378 usedl="$define"
6379 : emulate basename
6380 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6381
6382 $cat << EOM
6383
6384Some systems may require passing special flags to $cc -c to
6385compile modules that will be used to create a shared library.
6386To use no flags, say "none".
6387
6388EOM
6389 case "$cccdlflags" in
6390 '') case "$gccversion" in
6391 '') case "$osname" in
6392 hpux) dflt='+z' ;;
6393 next) dflt='none' ;;
6394 irix*) dflt='-KPIC' ;;
48bcfe03 6395 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
6396 sunos) dflt='-pic' ;;
6397 *) dflt='none' ;;
6398 esac
6399 ;;
6400 *) case "$osname" in
48bcfe03 6401 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
6402 *) dflt='-fpic' ;;
6403 esac ;;
6404 esac ;;
6405 ' ') dflt='none' ;;
6406 *) dflt="$cccdlflags" ;;
6407 esac
6408 rp="Any special flags to pass to $cc -c to compile shared library modules?"
6409 . ./myread
6410 case "$ans" in
6411 none) cccdlflags=' ' ;;
6412 *) cccdlflags="$ans" ;;
6413 esac
6414
6415 cat << EOM
6416
6417Some systems use ld to create libraries that can be dynamically loaded,
6418while other systems (such as those using ELF) use $cc.
6419
6420EOM
6421 case "$ld" in
6422 '') $cat >try.c <<'EOM'
6423/* Test for whether ELF binaries are produced */
6424#include <fcntl.h>
6425#include <stdlib.h>
6426int main() {
6427 char b[4];
6428 int i = open("a.out",O_RDONLY);
6429 if(i == -1)
6430 exit(1); /* fail */
6431 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6432 exit(0); /* succeed (yes, it's ELF) */
6433 else
6434 exit(1); /* fail */
6435}
6436EOM
6437 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6438 cat <<EOM
6439You appear to have ELF support. I'll use $cc to build dynamic libraries.
6440EOM
6441 dflt="$cc"
6442 else
6443 echo "I'll use ld to build dynamic libraries."
6444 dflt='ld'
6445 fi
6446 rm -f try.c a.out
6447 ;;
6448 *) dflt="$ld"
6449 ;;
6450 esac
6451
6452 rp="What command should be used to create dynamic libraries?"
6453 . ./myread
6454 ld="$ans"
6455
6456 cat << EOM
6457
6458Some systems may require passing special flags to $ld to create a
6459library that can be dynamically loaded. If your ld flags include
6460-L/other/path options to locate libraries outside your loader's normal
6461search path, you may need to specify those -L options here as well. To
6462use no flags, say "none".
6463
6464EOM
6465 case "$lddlflags" in
6466 '') case "$osname" in
6467 beos) dflt='-nostart' ;;
6468 hpux) dflt='-b';
6469 case "$gccversion" in
6470 '') dflt="$dflt +vnocompatwarnings" ;;
6471 esac
6472 ;;
6473 linux|irix*) dflt='-shared' ;;
6474 next) dflt='none' ;;
6475 solaris) dflt='-G' ;;
6476 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 6477 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
6478 *) dflt='none' ;;
6479 esac
6480 ;;
6481 *) dflt="$lddlflags" ;;
6482 esac
6483
6484 : Try to guess additional flags to pick up local libraries.
6485 : Be careful not to append to a plain 'none'
6486 case "$dflt" in
6487 none) dflt='' ;;
6488 esac
6489 for thisflag in $ldflags; do
6490 case "$thisflag" in
6491 -L*|-R*)
6492 case " $dflt " in
6493 *" $thisflag "*) ;;
6494 *) dflt="$dflt $thisflag" ;;
6495 esac
6496 ;;
6497 esac
6498 done
6499
6500 case "$dflt" in
6501 ''|' ') dflt='none' ;;
6502 esac
6503
6504 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6505 . ./myread
6506 case "$ans" in
6507 none) lddlflags=' ' ;;
6508 *) lddlflags="$ans" ;;
6509 esac
6510
6511 cat <<EOM
6512
6513Some systems may require passing special flags to $cc to indicate that
6514the resulting executable will use dynamic linking. To use no flags,
6515say "none".
6516
6517EOM
6518 case "$ccdlflags" in
6519 '') case "$osname" in
6520 hpux) dflt='-Wl,-E' ;;
6521 linux) dflt='-rdynamic' ;;
6522 next) dflt='none' ;;
6523 sunos) dflt='none' ;;
6524 *) dflt='none' ;;
6525 esac ;;
6526 ' ') dflt='none' ;;
6527 *) dflt="$ccdlflags" ;;
6528 esac
6529 rp="Any special flags to pass to $cc to use dynamic linking?"
6530 . ./myread
6531 case "$ans" in
6532 none) ccdlflags=' ' ;;
6533 *) ccdlflags="$ans" ;;
6534 esac
6535 ;;
6536*) usedl="$undef"
6537 ld='ld'
6538 dlsrc='dl_none.xs'
6539 lddlflags=''
6540 ccdlflags=''
6541 ;;
6542esac
6543
6544also=''
6545case "$usedl" in
6546$undef)
6547 # No dynamic loading being used, so don't bother even to prompt.
6548 useshrplib='false'
6549 ;;
6550*) case "$useshrplib" in
6551 '') case "$osname" in
48bcfe03 6552 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
6553 dflt=y
6554 also='Building a shared libperl is required for dynamic loading to work on your system.'
6555 ;;
6556 next*)
6557 case "$osvers" in
6558 4*) dflt=y
6559 also='Building a shared libperl is needed for MAB support.'
6560 ;;
6561 *) dflt=n
6562 ;;
6563 esac
6564 ;;
6565 *) dflt=n
6566 ;;
6567 esac
6568 ;;
6569 $define|true|[Yy]*)
6570 dflt=y
6571 ;;
6572 *) dflt=n
6573 ;;
6574 esac
6575 $cat << EOM
6576
6577The perl executable is normally obtained by linking perlmain.c with
6578libperl${_a}, any static extensions (usually just DynaLoader), and
6579any other libraries needed on this system (such as -lm, etc.). Since
6580your system supports dynamic loading, it is probably possible to build
6581a shared libperl.$so. If you will have more than one executable linked
6582to libperl.$so, this will significantly reduce the size of each
6583executable, but it may have a noticeable affect on performance. The
6584default is probably sensible for your system.
6585$also
6586
6587EOM
6588 rp="Build a shared libperl.$so (y/n)"
6589 . ./myread
6590 case "$ans" in
6591 true|$define|[Yy]*)
6592 useshrplib='true' ;;
6593 *) useshrplib='false' ;;
6594 esac
6595 ;;
6596esac
6597
6598case "$useshrplib" in
6599true)
6600 case "$libperl" in
6601 '')
6602 # Figure out a good name for libperl.so. Since it gets stored in
6603 # a version-specific architecture-dependent library, the version
6604 # number isn't really that important, except for making cc/ld happy.
6605 #
6606 # A name such as libperl.so.3.1
6607 majmin="libperl.$so.$patchlevel.$subversion"
6608 # A name such as libperl.so.301
6609 majonly=`echo $patchlevel $subversion |
6610 $awk '{printf "%d%02d", $1, $2}'`
6611 majonly=libperl.$so.$majonly
6612 # I'd prefer to keep the os-specific stuff here to a minimum, and
6613 # rely on figuring it out from the naming of libc.
6614 case "${osname}${osvers}" in
6615 next4*)
6616 dflt=libperl.5.$so
6617 # XXX How handle the --version stuff for MAB?
6618 ;;
6619 linux*) # ld won't link with a bare -lperl otherwise.
6620 dflt=libperl.$so
6621 ;;
6622 cygwin*) # include version
6623 dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6624 ;;
6625 *) # Try to guess based on whether libc has major.minor.
6626 case "$libc" in
6627 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6628 *libc.$so.[0-9]*) dflt=$majonly ;;
6629 *) dflt=libperl.$so ;;
6630 esac
6631 ;;
6632 esac
6633 ;;
6634 *) dflt=$libperl
6635 ;;
6636 esac
6637 cat << EOM
6638
6639I need to select a good name for the shared libperl. If your system uses
6640library names with major and minor numbers, then you might want something
6641like $majmin. Alternatively, if your system uses a single version
6642number for shared libraries, then you might want to use $majonly.
6643Or, your system might be quite happy with a simple libperl.$so.
6644
6645Since the shared libperl will get installed into a version-specific
6646architecture-dependent directory, the version number of the shared perl
6647library probably isn't important, so the default should be o.k.
6648
6649EOM
6650 rp='What name do you want to give to the shared libperl?'
6651 . ./myread
6652 libperl=$ans
6653 echo "Ok, I'll use $libperl"
6654 ;;
6655*)
6656 libperl="libperl${_a}"
6657 ;;
6658esac
6659
6660# Detect old use of shrpdir via undocumented Configure -Dshrpdir
6661case "$shrpdir" in
6662'') ;;
6663*) $cat >&4 <<EOM
6664WARNING: Use of the shrpdir variable for the installation location of
6665the shared $libperl is not supported. It was never documented and
6666will not work in this version. Let me (perlbug@perl.org)
6667know of any problems this may cause.
6668
6669EOM
6670 case "$shrpdir" in
6671 "$archlibexp/CORE")
6672 $cat >&4 <<EOM
6673But your current setting of $shrpdir is
6674the default anyway, so it's harmless.
6675EOM
6676 ;;
6677 *)
6678 $cat >&4 <<EOM
6679Further, your current attempted setting of $shrpdir
6680conflicts with the value of $archlibexp/CORE
6681that installperl will use.
6682EOM
6683 ;;
6684 esac
6685 ;;
6686esac
6687
6688# How will the perl executable find the installed shared $libperl?
6689# Add $xxx to ccdlflags.
6690# If we can't figure out a command-line option, use $shrpenv to
6691# set env LD_RUN_PATH. The main perl makefile uses this.
6692shrpdir=$archlibexp/CORE
6693xxx=''
6694tmp_shrpenv=''
6695if "$useshrplib"; then
6696 case "$osname" in
6697 aix)
6698 # We'll set it in Makefile.SH...
6699 ;;
6700 solaris|netbsd)
6701 xxx="-R $shrpdir"
6702 ;;
6703 freebsd)
6704 xxx="-Wl,-R$shrpdir"
6705 ;;
6706 linux|irix*|dec_osf)
6707 xxx="-Wl,-rpath,$shrpdir"
6708 ;;
6709 next)
6710 # next doesn't like the default...
6711 ;;
6712 beos)
6713 # beos doesn't like the default, either.
6714 ;;
6715 hpux*)
6716 # hpux doesn't like the default, either.
6717 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6718 ;;
6719 *)
6720 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6721 ;;
6722 esac
6723 case "$xxx" in
6724 '') ;;
6725 *)
6726 # Only add $xxx if it isn't already in ccdlflags.
6727 case " $ccdlflags " in
6728 *" $xxx "*) ;;
6729 *) ccdlflags="$ccdlflags $xxx"
6730 cat <<EOM >&4
6731
6732Adding $xxx to the flags
6733passed to $ld so that the perl executable will find the
6734installed shared $libperl.
6735
6736EOM
6737 ;;
6738 esac
6739 ;;
6740 esac
6741fi
6742# Fix ccdlflags in AIX for building external extensions.
6743# (For building Perl itself bare -bE:perl.exp is needed,
6744# Makefile.SH takes care of this.)
6745case "$osname" in
6746aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6747esac
6748# Respect a hint or command-line value.
6749case "$shrpenv" in
6750'') shrpenv="$tmp_shrpenv" ;;
6751esac
6752case "$ldlibpthname" in
6753'') ldlibpthname=LD_LIBRARY_PATH ;;
6754none) ldlibpthname='' ;;
6755esac
6756
6757: determine where manual pages are on this system
6758echo " "
6759case "$sysman" in
6760'')
6761 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
6762 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
6763 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
6764 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6765 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
6766 sysman=`./loc . /usr/man/man1 $syspath`
6767 ;;
6768esac
6769if $test -d "$sysman"; then
6770 echo "System manual is in $sysman." >&4
6771else
6772 echo "Could not find manual pages in source form." >&4
6773fi
6774
6775: determine where manual pages go
6776set man1dir man1dir none
6777eval $prefixit
6778$cat <<EOM
6779
6780$spackage has manual pages available in source form.
6781EOM
6782case "$nroff" in
6783nroff)
6784 echo "However, you don't have nroff, so they're probably useless to you."
6785 case "$man1dir" in
6786 '') man1dir="none";;
6787 esac;;
6788esac
6789echo "If you don't want the manual sources installed, answer 'none'."
6790case "$man1dir" in
6791' ') dflt=none
6792 ;;
6793'')
6794 lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6795 lookpath="$lookpath $prefixexp/man/p_man/man1"
6796 lookpath="$lookpath $prefixexp/man/u_man/man1"
6797 lookpath="$lookpath $prefixexp/man/man.1"
6798 case "$sysman" in
6799 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6800 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6801 esac
6802 set dflt
6803 eval $prefixup
6804 ;;
6805*) dflt="$man1dir"
6806 ;;
6807esac
6808echo " "
6809fn=dn+~
6810rp="Where do the main $spackage manual pages (source) go?"
6811. ./getfile
6812if $test "X$man1direxp" != "X$ansexp"; then
6813 installman1dir=''
6814fi
6815man1dir="$ans"
6816man1direxp="$ansexp"
6817case "$man1dir" in
6818'') man1dir=' '
6819 installman1dir='';;
6820esac
6821
6822: Change installation prefix, if necessary.
6823if $test X"$prefix" != X"$installprefix"; then
6824 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6825else
6826 installman1dir="$man1direxp"
6827fi
6828
6829: What suffix to use on installed man pages
6830
6831case "$man1dir" in
6832' ')
6833 man1ext='0'
6834 ;;
6835*)
6836 rp="What suffix should be used for the main $spackage man pages?"
6837 case "$man1ext" in
6838 '') case "$man1dir" in
6839 *1) dflt=1 ;;
6840 *1p) dflt=1p ;;
6841 *1pm) dflt=1pm ;;
6842 *l) dflt=l;;
6843 *n) dflt=n;;
6844 *o) dflt=o;;
6845 *p) dflt=p;;
6846 *C) dflt=C;;
6847 *L) dflt=L;;
6848 *L1) dflt=L1;;
6849 *) dflt=1;;
6850 esac
6851 ;;
6852 *) dflt="$man1ext";;
6853 esac
6854 . ./myread
6855 man1ext="$ans"
6856 ;;
6857esac
6858
6859: see if we can have long filenames
6860echo " "
6861first=123456789abcdef
6862$rm -f $first
6863if (echo hi >$first) 2>/dev/null; then
6864 if $test -f 123456789abcde; then
6865 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
6866 val="$undef"
6867 else
6868 echo 'You can have filenames longer than 14 characters.'>&4
6869 val="$define"
6870 fi
6871else
6872 $cat <<'EOM'
6873You can't have filenames longer than 14 chars.
6874You can't even think about them!
6875EOM
6876 val="$undef"
6877fi
6878set d_flexfnam
6879eval $setvar
6880$rm -rf 123456789abcde*
6881
6882: determine where library module manual pages go
6883set man3dir man3dir none
6884eval $prefixit
6885$cat <<EOM
6886
6887$spackage has manual pages for many of the library modules.
6888EOM
6889
6890case "$nroff" in
6891nroff)
6892 $cat <<'EOM'
6893However, you don't have nroff, so they're probably useless to you.
6894EOM
6895 case "$man3dir" in
6896 '') man3dir="none";;
6897 esac;;
6898esac
6899
6900case "$d_flexfnam" in
6901undef)
6902 $cat <<'EOM'
6903However, your system can't handle the long file names like File::Basename.3.
6904EOM
6905 case "$man3dir" in
6906 '') man3dir="none";;
6907 esac;;
6908esac
6909
6910echo "If you don't want the manual sources installed, answer 'none'."
6911prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6912case "$man3dir" in
6913'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6914 if $test -d "$privlib/man/man3"; then
6915 cat <<EOM >&4
6916
6917WARNING: Previous versions of perl installed man3 pages into
6918$privlib/man/man3. This version will suggest a
6919new default of $dflt.
6920EOM
6921 tdflt=$dflt
6922 dflt='n'
6923 rp='Do you wish to preserve the old behavior?(y/n)'
6924 . ./myread
6925 case "$ans" in
6926 y*) dflt="$privlib/man/man3" ;;
6927 *) dflt=$tdflt ;;
6928 esac
6929 fi
6930 ;;
6931*) dflt="$man3dir" ;;
6932esac
6933case "$dflt" in
6934' ') dflt=none ;;
6935esac
6936echo " "
6937fn=dn+~
6938rp="Where do the $package library man pages (source) go?"
6939. ./getfile
6940man3dir="$ans"
6941man3direxp="$ansexp"
6942case "$man3dir" in
6943'') man3dir=' '
6944 installman3dir='';;
6945esac
6946
6947: Change installation prefix, if necessary.
6948if $test X"$prefix" != X"$installprefix"; then
6949 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6950else
6951 installman3dir="$man3direxp"
6952fi
6953
6954: What suffix to use on installed man pages
6955case "$man3dir" in
6956' ')
6957 man3ext='0'
6958 ;;
6959*)
6960 rp="What suffix should be used for the $package library man pages?"
6961 case "$man3ext" in
6962 '') case "$man3dir" in
6963 *3) dflt=3 ;;
6964 *3p) dflt=3p ;;
6965 *3pm) dflt=3pm ;;
6966 *l) dflt=l;;
6967 *n) dflt=n;;
6968 *o) dflt=o;;
6969 *p) dflt=p;;
6970 *C) dflt=C;;
6971 *L) dflt=L;;
6972 *L3) dflt=L3;;
6973 *) dflt=3;;
6974 esac
6975 ;;
6976 *) dflt="$man3ext";;
6977 esac
6978 . ./myread
6979 man3ext="$ans"
6980 ;;
6981esac
6982
6983: see if we have to deal with yellow pages, now NIS.
6984if $test -d /usr/etc/yp || $test -d /etc/yp; then
6985 if $test -f /usr/etc/nibindd; then
6986 echo " "
6987 echo "I'm fairly confident you're on a NeXT."
6988 echo " "
6989 rp='Do you get the hosts file via NetInfo?'
6990 dflt=y
6991 case "$hostcat" in
6992 nidump*) ;;
6993 '') ;;
6994 *) dflt=n;;
6995 esac
6996 . ./myread
6997 case "$ans" in
6998 y*) hostcat='nidump hosts .';;
6999 *) case "$hostcat" in
7000 nidump*) hostcat='';;
7001 esac
7002 ;;
7003 esac
7004 fi
7005 case "$hostcat" in
7006 nidump*) ;;
7007 *)
7008 case "$hostcat" in
7009 *ypcat*) dflt=y;;
7010 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7011 dflt=y
7012 else
7013 dflt=n
7014 fi;;
7015 *) dflt=n;;
7016 esac
7017 echo " "
7018 rp='Are you getting the hosts file via yellow pages?'
7019 . ./myread
7020 case "$ans" in
7021 y*) hostcat='ypcat hosts';;
7022 *) hostcat='cat /etc/hosts';;
7023 esac
7024 ;;
7025 esac
7026fi
7027case "$hostcat" in
7028'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7029esac
7030case "$groupcat" in
7031'') test -f /etc/group && groupcat='cat /etc/group';;
7032esac
7033case "$passcat" in
7034'') test -f /etc/passwd && passcat='cat /etc/passwd';;
7035esac
7036
7037: now get the host name
7038echo " "
7039echo "Figuring out host name..." >&4
7040case "$myhostname" in
7041'') cont=true
7042 echo 'Maybe "hostname" will work...'
7043 if tans=`sh -c hostname 2>&1` ; then
7044 myhostname=$tans
7045 phostname=hostname
7046 cont=''
7047 fi
7048 ;;
7049*) cont='';;
7050esac
7051if $test "$cont"; then
7052 if ./xenix; then
7053 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
7054 if tans=`cat /etc/systemid 2>&1` ; then
7055 myhostname=$tans
7056 phostname='cat /etc/systemid'
7057 echo "Whadyaknow. Xenix always was a bit strange..."
7058 cont=''
7059 fi
7060 elif $test -r /etc/systemid; then
7061 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7062 fi
7063fi
7064if $test "$cont"; then
7065 echo 'No, maybe "uuname -l" will work...'
7066 if tans=`sh -c 'uuname -l' 2>&1` ; then
7067 myhostname=$tans
7068 phostname='uuname -l'
7069 else
7070 echo 'Strange. Maybe "uname -n" will work...'
7071 if tans=`sh -c 'uname -n' 2>&1` ; then
7072 myhostname=$tans
7073 phostname='uname -n'
7074 else
7075 echo 'Oh well, maybe I can mine it out of whoami.h...'
7076 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7077 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7078 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7079 else
7080 case "$myhostname" in
7081 '') echo "Does this machine have an identity crisis or something?"
7082 phostname='';;
7083 *)
7084 echo "Well, you said $myhostname before..."
7085 phostname='echo $myhostname';;
7086 esac
7087 fi
7088 fi
7089 fi
7090fi
7091: you do not want to know about this
7092set $myhostname
7093myhostname=$1
7094
7095: verify guess
7096if $test "$myhostname" ; then
7097 dflt=y
7098 rp='Your host name appears to be "'$myhostname'".'" Right?"
7099 . ./myread
7100 case "$ans" in
7101 y*) ;;
7102 *) myhostname='';;
7103 esac
7104fi
7105
7106: bad guess or no guess
7107while $test "X$myhostname" = X ; do
7108 dflt=''
7109 rp="Please type the (one word) name of your host:"
7110 . ./myread
7111 myhostname="$ans"
7112done
7113
7114: translate upper to lower if necessary
7115case "$myhostname" in
7116*[A-Z]*)
7117 echo "(Normalizing case in your host name)"
7118 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7119 ;;
7120esac
7121
7122case "$myhostname" in
7123*.*)
7124 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7125 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7126 echo "(Trimming domain name from host name--host name is now $myhostname)"
7127 ;;
7128*) case "$mydomain" in
7129 '')
7130 {
7131 test "X$hostcat" = "Xypcat hosts" &&
7132 ypmatch "$myhostname" hosts 2>/dev/null |\
7133 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
7134 $test -s hosts
7135 } || {
7136 test "X$hostcat" != "X" &&
7137 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
7138 /[ ]$myhostname[ . ]/p" > hosts
7139 }
7140 tmp_re="[ . ]"
f08cbdd1
PP
7141 if $test -f hosts; then
7142 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 7143 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
7144 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7145 hosts | $sort | $uniq | \
7146 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7147 case `$echo X$dflt` in
7148 X*\ *) echo "(Several hosts in the database matched hostname)"
7149 dflt=.
7150 ;;
7151 X.) echo "(You do not have fully-qualified names in the hosts database)"
7152 ;;
7153 esac
7154 else
7155 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 7156 dflt=.
f08cbdd1 7157 fi
b4eb6b3d
JH
7158 case "$dflt" in
7159 .)
7160 tans=`./loc resolv.conf X /etc /usr/etc`
7161 if $test -f "$tans"; then
7162 echo "(Attempting domain name extraction from $tans)"
7163 dflt=.`$sed -n -e 's/ / /g' \
7164 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
7165 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7166 case "$dflt" in
7167 .) dflt=.`$sed -n -e 's/ / /g' \
7168 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
7169 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7170 ;;
7171 esac
7172 fi
7173 ;;
7174 esac
7175 case "$dflt" in
7176 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7177 dflt=.`sh -c domainname 2>/dev/null`
7178 case "$dflt" in
7179 '') dflt='.';;
7180 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7181 esac
7182 ;;
7183 esac
7184 case "$dflt" in
7185 .) echo "(Lost all hope -- silly guess then)"
7186 dflt='.uucp'
7187 ;;
7188 esac
7189 $rm -f hosts
7190 ;;
7191 *) dflt="$mydomain";;
7192 esac;;
7193esac
7194echo " "
7195rp="What is your domain name?"
7196. ./myread
7197tans="$ans"
7198case "$ans" in
7199'') ;;
7200.*) ;;
7201*) tans=".$tans";;
7202esac
7203mydomain="$tans"
7204
7205: translate upper to lower if necessary
7206case "$mydomain" in
7207*[A-Z]*)
7208 echo "(Normalizing case in your domain name)"
7209 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7210 ;;
7211esac
7212
7213: a little sanity check here
7214case "$phostname" in
7215'') ;;
7216*)
7217 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7218 $myhostname$mydomain|$myhostname) ;;
7219 *)
7220 case "$phostname" in
7221 sed*)
7222 echo "(That doesn't agree with your whoami.h file, by the way.)"
7223 ;;
7224 *)
7225 echo "(That doesn't agree with your $phostname command, by the way.)"
7226 ;;
7227 esac
7228 ;;
7229 esac
7230 ;;
7231esac
7232
7233$cat <<EOM
7234
7235I need to get your e-mail address in Internet format if possible, i.e.
7236something like user@host.domain. Please answer accurately since I have
7237no easy means to double check it. The default value provided below
7238is most probably close to reality but may not be valid from outside
7239your organization...
7240
7241EOM
7242cont=x
7243while test "$cont"; do
7244 case "$cf_email" in
7245 '') dflt="$cf_by@$myhostname$mydomain";;
7246 *) dflt="$cf_email";;
7247 esac
7248 rp='What is your e-mail address?'
7249 . ./myread
7250 cf_email="$ans"
7251 case "$cf_email" in
7252 *@*.*) cont='' ;;
7253 *)
7254 rp='Address does not look like an Internet one. Use it anyway?'
7255 case "$fastread" in
7256 yes) dflt=y ;;
7257 *) dflt=n ;;
7258 esac
7259 . ./myread
7260 case "$ans" in
7261 y*) cont='' ;;
7262 *) echo " " ;;
7263 esac
7264 ;;
7265 esac
7266done
7267
7268$cat <<EOM
7269
7270If you or somebody else will be maintaining perl at your site, please
7271fill in the correct e-mail address here so that they may be contacted
7272if necessary. Currently, the "perlbug" program included with perl
7273will send mail to this address in addition to perlbug@perl.org. You may
7274enter "none" for no administrator.
7275
7276EOM
7277case "$perladmin" in
7278'') dflt="$cf_email";;
7279*) dflt="$perladmin";;
7280esac
7281rp='Perl administrator e-mail address'
7282. ./myread
7283perladmin="$ans"
7284
674912d7
RB
7285: determine whether to only install version-specific parts.
7286echo " "
7287$cat <<EOM
7288Do you want to install only the version-specific parts of the perl
7289distribution? Usually you do *not* want to do this.
7290EOM
7291case "$versiononly" in
7292"$define"|[Yy]*|true) dflt='y' ;;
7293*) dflt='n';
7294esac
7295rp="Do you want to install only the version-specific parts of perl?"
7296. ./myread
7297case "$ans" in
7298[yY]*) val="$define";;
7299*) val="$undef" ;;
7300esac
7301set versiononly
7302eval $setvar
7303
b4eb6b3d
JH
7304: figure out how to guarantee perl startup
7305case "$startperl" in
7306'')
7307 case "$sharpbang" in
7308 *!)
7309 $cat <<EOH
7310
7311I can use the #! construct to start perl on your system. This will
7312make startup of perl scripts faster, but may cause problems if you
7313want to share those scripts and perl is not in a standard place
7314($binexp/perl) on all your platforms. The alternative is to force
7315a shell by starting the script with a single ':' character.
7316
7317EOH
674912d7
RB
7318 case "$versiononly" in
7319 "$define") dflt="$binexp/perl$version";;
7320 *) dflt="$binexp/perl";;
7321 esac
b4eb6b3d
JH
7322 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7323 . ./myread
7324 case "$ans" in
7325 none) startperl=": # use perl";;
7326 *) startperl="#!$ans"
7327 if $test 30 -lt `echo "$ans" | wc -c`; then
7328 $cat >&4 <<EOM
7329
7330WARNING: Some systems limit the #! command to 32 characters.
7331If you experience difficulty running Perl scripts with #!, try
7332installing Perl in a directory with a shorter pathname.
7333
7334EOM
7335 fi ;;
7336 esac
7337 ;;
7338 *) startperl=": # use perl"
7339 ;;
7340 esac
7341 ;;
7342esac
7343echo "I'll use $startperl to start perl scripts."
7344
7345: figure best path for perl in scripts
7346case "$perlpath" in
7347'')
7348 perlpath="$binexp/perl"
7349 case "$startperl" in
7350 *!*) ;;
7351 *)
7352 $cat <<EOH
7353
7354I will use the "eval 'exec'" idiom to start Perl on your system.
7355I can use the full path of your Perl binary for this purpose, but
7356doing so may cause problems if you want to share those scripts and
7357Perl is not always in a standard place ($binexp/perl).
7358
7359EOH
7360 dflt="$binexp/perl"
7361 rp="What path shall I use in \"eval 'exec'\"?"
7362 . ./myread
7363 perlpath="$ans"
7364 ;;
7365 esac
7366 ;;
7367esac
7368case "$startperl" in
7369*!*) ;;
7370*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7371esac
7372
7373: determine where public executable scripts go
7374set scriptdir scriptdir
7375eval $prefixit
7376case "$scriptdir" in
7377'')
7378 dflt="$bin"
7379 : guess some guesses
7380 $test -d /usr/share/scripts && dflt=/usr/share/scripts
7381 $test -d /usr/share/bin && dflt=/usr/share/bin
7382 $test -d /usr/local/script && dflt=/usr/local/script
7383 $test -d /usr/local/scripts && dflt=/usr/local/scripts
7384 $test -d $prefixexp/script && dflt=$prefixexp/script
7385 set dflt
7386 eval $prefixup
7387 ;;
7388*) dflt="$scriptdir"
7389 ;;
7390esac
7391$cat <<EOM
7392
7393Some installations have a separate directory just for executable scripts so
7394that they can mount it across multiple architectures but keep the scripts in
7395one spot. You might, for example, have a subdirectory of /usr/share for this.
7396Or you might just lump your scripts in with all your other executables.
7397
7398EOM
7399fn=d~
7400rp='Where do you keep publicly executable scripts?'
7401. ./getfile
7402if $test "X$ansexp" != "X$scriptdirexp"; then
7403 installscript=''
7404fi
7405scriptdir="$ans"
7406scriptdirexp="$ansexp"
7407: Change installation prefix, if necessary.
7408if $test X"$prefix" != X"$installprefix"; then
7409 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7410else
7411 installscript="$scriptdirexp"
7412fi
7413
7414: determine where add-on public executables go
7415case "$sitebin" in
7416'') dflt=$siteprefix/bin ;;
7417*) dflt=$sitebin ;;
7418esac
7419fn=d~
7420rp='Pathname where the add-on public executables should be installed?'
7421. ./getfile
7422sitebin="$ans"
7423sitebinexp="$ansexp"
7424: Change installation prefix, if necessary.
7425if $test X"$prefix" != X"$installprefix"; then
7426 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7427else
7428 installsitebin="$sitebinexp"
7429fi
7430
7431case "$useperlio" in
7432$define|true|[yY]*) dflt='y';;
7433*) dflt='n';;
7434esac
7435cat <<EOM
7436
cf829ab0
JH
7437Previous version of $package used the standard IO mechanisms as
7438defined in <stdio.h>. Versions 5.003_02 and later of perl allow
7439alternate IO mechanisms via the PerlIO abstraction layer, but the
7440stdio mechanism is still the default. This abstraction layer can
7441use AT&T's sfio (if you already have sfio installed) or regular stdio.
7442Using PerlIO with sfio may cause problems with some extension modules.
b4eb6b3d
JH
7443
7444If this doesn't make any sense to you, just accept the default '$dflt'.
7445EOM
7446rp='Use the experimental PerlIO abstraction layer?'
7447. ./myread
7448case "$ans" in
7449y|Y)
7450 val="$define"
7451 ;;
7452*)
cf829ab0 7453 echo "Ok, doing things the stdio way."
b4eb6b3d
JH
7454 val="$undef"
7455 ;;
7456esac
7457set useperlio
7458eval $setvar
7459
cf829ab0
JH
7460case "$usesocks" in
7461$define|true|[yY]*)
7462 case "$useperlio" in
7463 $define|true|[yY]*) ;;
7464 *) cat >&4 <<EOM
7465
7466You are using the SOCKS proxy protocol library which means that you
7467should also use the PerlIO layer. You may be headed for trouble.
7468
7469EOM
7470 ;;
7471 esac
7472 ;;
7473esac
7474
7475
b4eb6b3d
JH
7476case "$vendorprefix" in
7477'') d_vendorbin="$undef"
7478 vendorbin=''
7479 vendorbinexp=''
7480 ;;
7481*) d_vendorbin="$define"
7482 : determine where vendor-supplied executables go.
7483 case "$vendorbin" in
7484 '') dflt=$vendorprefix/bin ;;
7485 *) dflt="$vendorbin" ;;
7486 esac
7487 fn=d~+
7488 rp='Pathname for the vendor-supplied executables directory?'
7489 . ./getfile
7490 vendorbin="$ans"
7491 vendorbinexp="$ansexp"
7492 ;;
7493esac
7494: Change installation prefix, if necessary.
7495if $test X"$prefix" != X"$installprefix"; then
7496 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7497else
7498 installvendorbin="$vendorbinexp"
7499fi
7500
7501: see if qgcvt exists
7502set qgcvt d_qgcvt
7503eval $inlibc
7504
7505echo " "
7506
7507if $test X"$d_longdbl" = X"$define"; then
7508
7509echo "Checking how to print long doubles..." >&4
7510
7511if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7512 $cat >try.c <<'EOCP'
7513#include <sys/types.h>
7514#include <stdio.h>
7515int main() {
7516 double d = 123.456;
7517 printf("%.3f\n", d);
7518}
7519EOCP
7520 set try
7521 if eval $compile; then
7522 yyy=`./try$exe_ext`
7523 case "$yyy" in
7524 123.456)
7525 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7526 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7527 echo "We will use %f."
7528 ;;
7529 esac
7530 fi
7531fi
7532
7533if $test X"$sPRIfldbl" = X; then
7534 $cat >try.c <<'EOCP'
7535#include <sys/types.h>
7536#include <stdio.h>
7537int main() {
7538 long double d = 123.456;
7539 printf("%.3llf\n", d);
7540}
7541EOCP
7542 set try
7543 if eval $compile; then
7544 yyy=`./try$exe_ext`
7545 case "$yyy" in
7546 123.456)
7547 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7548 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7549 echo "We will use %llf."
7550 ;;
7551 esac
7552 fi
7553fi
7554
7555if $test X"$sPRIfldbl" = X; then
7556 $cat >try.c <<'EOCP'
7557#include <sys/types.h>
7558#include <stdio.h>
7559int main() {
7560 long double d = 123.456;
7561 printf("%.3Lf\n", d);
7562}
7563EOCP
7564 set try
7565 if eval $compile; then
7566 yyy=`./try$exe_ext`
7567 case "$yyy" in
7568 123.456)
7569 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7570 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7571 echo "We will use %Lf."
7572 ;;
7573 esac
7574 fi
7575fi
7576
7577if $test X"$sPRIfldbl" = X; then
7578 $cat >try.c <<'EOCP'
7579#include <sys/types.h>
7580#include <stdio.h>
7581int main() {
7582 long double d = 123.456;
7583 printf("%.3lf\n", d);
7584}
7585EOCP
7586 set try
7587 if eval $compile; then
7588 yyy=`./try$exe_ext`
7589 case "$yyy" in
7590 123.456)
7591 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7592 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7593 echo "We will use %lf."
7594 ;;
7595 esac
7596 fi
7597fi
7598
7599if $test X"$sPRIfldbl" = X; then
7600 echo "Cannot figure out how to print long doubles." >&4
7601else
7602 sSCNfldbl=$sPRIfldbl # expect consistency
7603fi
7604
7605$rm -f try try.*
7606
7607fi # d_longdbl
7608
7609case "$sPRIfldbl" in
7610'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
7611 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
7612 d_SCNfldbl="$undef";
7613 ;;
7614*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
7615 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
7616 d_SCNfldbl="$define";
7617 ;;
7618esac
7619
7620: Check how to convert floats to strings.
7621echo " "
7622echo "Checking for an efficient way to convert floats to strings."
7623echo " " > try.c
7624case "$uselongdouble" in
7625"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7626esac
7627case "$d_longdbl" in
7628"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7629esac
7630case "$d_PRIgldbl" in
7631"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
7632esac
7633$cat >>try.c <<EOP
7634#ifdef TRY_gconvert
7635#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7636char *myname = "gconvert";
7637#endif
7638#ifdef TRY_gcvt
7639#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7640char *myname = "gcvt";
7641#endif
7642#ifdef TRY_qgcvt
7643#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7644char *myname = "qgcvt";
7645#define DOUBLETYPE long double
7646#endif
7647#ifdef TRY_sprintf
7648#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7649#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7650#else
7651#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7652#endif
7653char *myname = "sprintf";
7654#endif
7655
7656#ifndef DOUBLETYPE
7657#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7658#define DOUBLETYPE long double
7659#else
7660#define DOUBLETYPE double
7661#endif
7662#endif
7663
7664#include <stdio.h>
7665
7666#define I_STDLIB $i_stdlib
7667#ifdef I_STDLIB
7668#include <stdlib.h>
7669#endif
7670
7671int
7672checkit(expect, got)
7673char *expect;
7674char *got;
7675{
7676 if (strcmp(expect, got)) {
7677 printf("%s oddity: Expected %s, got %s\n",
7678 myname, expect, got);
7679 exit(1);
7680 }
7681}
7682
7683int main()
7684{
7685 char buf[64];
7686 buf[63] = '\0';
7687
7688 /* This must be 1st test on (which?) platform */
7689 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7690 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7691 checkit("0.1", buf);
7692
7693 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
7694 checkit("1", buf);
7695
7696 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
7697 checkit("1.1", buf);
7698
7699 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
7700 checkit("1.01", buf);
7701
7702 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
7703 checkit("1.001", buf);
7704
7705 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
7706 checkit("1.0001", buf);
7707
7708 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
7709 checkit("1.00001", buf);
7710
7711 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
7712 checkit("1.000001", buf);
7713
7714 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
7715 checkit("0", buf);
7716
7717 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
7718 checkit("-1", buf);
7719
7720 /* Some Linux gcvt's give 1.e+5 here. */
7721 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
7722 checkit("100000", buf);
7723
7724 /* Some Linux gcvt's give -1.e+5 here. */
7725 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
7726 checkit("-100000", buf);
7727
7728 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
7729 checkit("123.456", buf);
7730
7731 exit(0);
7732}
7733EOP
7734case "$d_Gconvert" in
7735gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7736gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7737sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7738*) xxx_list='gconvert gcvt sprintf' ;;
7739esac
7740
7741case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7742"$define$define$define")
7743 # for long doubles prefer first qgcvt, then sprintf
7744 xxx_list="`echo $xxx_list|sed s/sprintf//`"
7745 xxx_list="sprintf $xxx_list"
7746 case "$d_qgcvt" in
7747 "$define") xxx_list="qgcvt $xxx_list" ;;
7748 esac
7749 ;;
7750esac
7751
7752for xxx_convert in $xxx_list; do
7753 echo "Trying $xxx_convert..."
7754 $rm -f try try$_o
7755 set try -DTRY_$xxx_convert
7756 if eval $compile; then
7757 echo "$xxx_convert() found." >&4
7758 if ./try; then
7759 echo "I'll use $xxx_convert to convert floats into a string." >&4
7760 break;
7761 else
7762 echo "...But $xxx_convert didn't work as I expected."
7763 fi
7764 else
7765 echo "$xxx_convert NOT found." >&4
7766 fi
7767done
7768
7769case "$xxx_convert" in
7770gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7771gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7772qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7773*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7774 "$define$define$define")
7775 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7776 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7777 esac
7778 ;;
7779esac
7780
74cac757
JH
7781: see if _fwalk exists
7782set fwalk d__fwalk
7783eval $inlibc
7784
b4eb6b3d
JH
7785: Initialize h_fcntl
7786h_fcntl=false
7787
7788: Initialize h_sysfile
7789h_sysfile=false
7790
7791: access call always available on UNIX
7792set access d_access
7793eval $inlibc
7794
7795: locate the flags for 'access()'
7796case "$d_access" in
7797"$define")
7798 echo " "
7799 $cat >access.c <<'EOCP'
7800#include <sys/types.h>
7801#ifdef I_FCNTL
7802#include <fcntl.h>
7803#endif
7804#ifdef I_SYS_FILE
7805#include <sys/file.h>
7806#endif
7807#ifdef I_UNISTD
7808#include <unistd.h>
7809#endif
7810int main() {
7811 exit(R_OK);
7812}
7813EOCP
7814 : check sys/file.h first, no particular reason here
7815 if $test `./findhdr sys/file.h` && \
7a282f6d 7816 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
7817 h_sysfile=true;
7818 echo "<sys/file.h> defines the *_OK access constants." >&4
7819 elif $test `./findhdr fcntl.h` && \
7a282f6d 7820 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
7821 h_fcntl=true;
7822 echo "<fcntl.h> defines the *_OK access constants." >&4
7823 elif $test `./findhdr unistd.h` && \
7a282f6d 7824 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
7825 echo "<unistd.h> defines the *_OK access constants." >&4
7826 else
7827 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7828 fi
7829 ;;
7830esac
7831$rm -f access*
7832
7833: see if accessx exists
7834set accessx d_accessx
7835eval $inlibc
7836
7837: see if alarm exists
7838set alarm d_alarm
7839eval $inlibc
7840
7841: see if atolf exists
7842set atolf d_atolf
7843eval $inlibc
7844
7845: see if atoll exists
7846set atoll d_atoll
7847eval $inlibc
7848
7849: Look for GNU-cc style attribute checking
7850echo " "
7851echo "Checking whether your compiler can handle __attribute__ ..." >&4
7852$cat >attrib.c <<'EOCP'
7853#include <stdio.h>
7854void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7855EOCP
7856if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7857 if $contains 'warning' attrib.out >/dev/null 2>&1; then
7858 echo "Your C compiler doesn't fully support __attribute__."
7859 val="$undef"
7860 else
7861 echo "Your C compiler supports __attribute__."
7862 val="$define"
7863 fi
7864else
7865 echo "Your C compiler doesn't seem to understand __attribute__ at all."
7866 val="$undef"
7867fi
7868set d_attribut
7869eval $setvar
7870$rm -f attrib*
7871
7872: see if bcmp exists
7873set bcmp d_bcmp
7874eval $inlibc
7875
7876: see if bcopy exists
7877set bcopy d_bcopy
7878eval $inlibc
7879
7880: see if this is a unistd.h system
7881set unistd.h i_unistd
7882eval $inhdr
7883
7884: see if getpgrp exists
7885set getpgrp d_getpgrp
7886eval $inlibc
7887
7888case "$d_getpgrp" in
7889"$define")
7890 echo " "
7891 echo "Checking to see which flavor of getpgrp is in use..."
7892 $cat >set.c <<EOP
7893#$i_unistd I_UNISTD
7894#include <sys/types.h>
7895#ifdef I_UNISTD
7896# include <unistd.h>
7897#endif
7898int main()
7899{
7900 if (getuid() == 0) {
7901 printf("(I see you are running Configure as super-user...)\n");
7902 setuid(1);
7903 }
7904#ifdef TRY_BSD_PGRP
7905 if (getpgrp(1) == 0)
7906 exit(0);
7907#else
7908 if (getpgrp() > 0)
7909 exit(0);
7910#endif
7911 exit(1);
7912}
7913EOP
7a282f6d 7914 if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
7915 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7916 val="$define"
7a282f6d 7917 elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
7918 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7919 val="$undef"
7920 else
7921 echo "I can't seem to compile and run the test program."
7922 if ./usg; then
7923 xxx="a USG one, i.e. you use getpgrp()."
7924 else
7925 # SVR4 systems can appear rather BSD-ish.
7926 case "$i_unistd" in
7927 $undef)
7928 xxx="a BSD one, i.e. you use getpgrp(pid)."
7929 val="$define"
7930 ;;
7931 $define)
7932 xxx="probably a USG one, i.e. you use getpgrp()."
7933 val="$undef"
7934 ;;
7935 esac
7936 fi
7937 echo "Assuming your getpgrp is $xxx" >&4
7938 fi
7939 ;;
7940*) val="$undef";;
7941esac
7942set d_bsdgetpgrp
7943eval $setvar
7944$rm -f set set.c
7945
7946: see if setpgrp exists
7947set setpgrp d_setpgrp
7948eval $inlibc
7949
7950case "$d_setpgrp" in
7951"$define")
7952 echo " "
7953 echo "Checking to see which flavor of setpgrp is in use..."
7954 $cat >set.c <<EOP
7955#$i_unistd I_UNISTD
7956#include <sys/types.h>
7957#ifdef I_UNISTD
7958# include <unistd.h>
7959#endif
7960int main()
7961{
7962 if (getuid() == 0) {
7963 printf("(I see you are running Configure as super-user...)\n");
7964 setuid(1);
7965 }
7966#ifdef TRY_BSD_PGRP
7967 if (-1 == setpgrp(1, 1))
7968 exit(0);
7969#else
7970 if (setpgrp() != -1)
7971 exit(0);
7972#endif
7973 exit(1);
7974}
7975EOP
7a282f6d 7976 if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
7977 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7978 val="$define"
7a282f6d 7979 elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
7980 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7981 val="$undef"
7982 else
7983 echo "(I can't seem to compile and run the test program.)"
7984 if ./usg; then
7985 xxx="a USG one, i.e. you use setpgrp()."
7986 else
7987 # SVR4 systems can appear rather BSD-ish.
7988 case "$i_unistd" in
7989 $undef)
7990 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7991 val="$define"
7992 ;;
7993 $define)
7994 xxx="probably a USG one, i.e. you use setpgrp()."
7995 val="$undef"
7996 ;;
7997 esac
7998 fi
7999 echo "Assuming your setpgrp is $xxx" >&4
8000 fi
8001 ;;
8002*) val="$undef";;
8003esac
8004set d_bsdsetpgrp
8005eval $setvar
8006$rm -f set set.c
8007: see if bzero exists
8008set bzero d_bzero
8009eval $inlibc
8010
8011: see if signal is declared as pointer to function returning int or void
8012echo " "
8013xxx=`./findhdr signal.h`
8014$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8015if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
8016 echo "You have int (*signal())() instead of void." >&4
8017 val="$undef"
8018elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
8019 echo "You have void (*signal())()." >&4
8020 val="$define"
8021elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8022 echo "You have int (*signal())() instead of void." >&4
8023 val="$undef"
8024elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8025 echo "You have void (*signal())()." >&4
8026 val="$define"
8027else
8028 case "$d_voidsig" in
8029 '')
8030 echo "I can't determine whether signal handler returns void or int..." >&4
8031 dflt=void
8032 rp="What type does your signal handler return?"
8033 . ./myread
8034 case "$ans" in
8035 v*) val="$define";;
8036 *) val="$undef";;
8037 esac;;
8038 "$define")
8039 echo "As you already told me, signal handler returns void." >&4
8040 val="$define"
8041 ;;
8042 *) echo "As you already told me, signal handler returns int." >&4
8043 val="$undef"
8044 ;;
8045 esac
8046fi
8047set d_voidsig
8048eval $setvar
8049case "$d_voidsig" in
8050"$define") signal_t="void";;
8051*) signal_t="int";;
8052esac
8053$rm -f $$.tmp
8054
8055: check for ability to cast large floats to 32-bit ints.
8056echo " "
8057echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8058if $test "$intsize" -ge 4; then
8059 xxx=int
8060else
8061 xxx=long
8062fi
8063$cat >try.c <<EOCP
8064#include <stdio.h>
8065#include <sys/types.h>
8066#include <signal.h>
8067$signal_t blech(s) int s; { exit(3); }
8068int main()
8069{
8070 $xxx i32;
8071 double f, g;
8072 int result = 0;
8073 char str[16];
8074 signal(SIGFPE, blech);
8075
8076 /* Don't let compiler optimize the test away. Store the number
8077 in a writable string for gcc to pass to sscanf under HP/UX.
8078 */
8079 sprintf(str, "2147483647");
8080 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8081 g = 10 * f;
8082 i32 = ($xxx) g;
8083
8084 /* x86 processors will probably give 0x8000 0000, which is a
8085 sign change. We don't want that. We want to mimic SPARC
8086 behavior here, which is to preserve the sign and give
8087 back 0x7fff ffff.
8088 */
8089 if (i32 != ($xxx) f)
8090 result |= 1;
8091 exit(result);
8092}
8093EOCP
8094set try
8095if eval $compile_ok; then
8096 ./try
8097 yyy=$?
8098else
8099 echo "(I can't seem to compile the test program--assuming it can't)"
8100 yyy=1
8101fi
8102case "$yyy" in
81030) val="$define"
8104 echo "Yup, it can."
8105 ;;
8106*) val="$undef"
8107 echo "Nope, it can't."
8108 ;;
8109esac
8110set d_casti32
8111eval $setvar
8112$rm -f try try.*
8113
8114: check for ability to cast negative floats to unsigned
8115echo " "
8116echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8117$cat >try.c <<EOCP
8118#include <stdio.h>
8119#include <sys/types.h>
8120#include <signal.h>
8121$signal_t blech(s) int s; { exit(7); }
8122$signal_t blech_in_list(s) int s; { exit(4); }
8123unsigned long dummy_long(p) unsigned long p; { return p; }
8124unsigned int dummy_int(p) unsigned int p; { return p; }
8125unsigned short dummy_short(p) unsigned short p; { return p; }
8126int main()
8127{
8128 double f;
8129 unsigned long along;
8130 unsigned int aint;
8131 unsigned short ashort;
8132 int result = 0;
8133 char str[16];
8134
8135 /* Frustrate gcc-2.7.2's optimizer which failed this test with
8136 a direct f = -123. assignment. gcc-2.8.0 reportedly
8137 optimized the whole file away
8138 */
8139 /* Store the number in a writable string for gcc to pass to
8140 sscanf under HP/UX.
8141 */
8142 sprintf(str, "-123");
8143 sscanf(str, "%lf", &f); /* f = -123.; */
8144
8145 signal(SIGFPE, blech);
8146 along = (unsigned long)f;
8147 aint = (unsigned int)f;
8148 ashort = (unsigned short)f;
8149 if (along != (unsigned long)-123)
8150 result |= 1;
8151 if (aint != (unsigned int)-123)
8152 result |= 1;
8153 if (ashort != (unsigned short)-123)
8154 result |= 1;
8155 sprintf(str, "1073741824.");
8156 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8157 f = f + f;
8158 along = 0;
8159 along = (unsigned long)f;
8160 if (along != 0x80000000)
8161 result |= 2;
8162 f -= 1.;
8163 along = 0;
8164 along = (unsigned long)f;
8165 if (along != 0x7fffffff)
8166 result |= 1;
8167 f += 2.;
8168 along = 0;
8169 along = (unsigned long)f;
8170 if (along != 0x80000001)
8171 result |= 2;
8172 if (result)
8173 exit(result);
8174 signal(SIGFPE, blech_in_list);
8175 sprintf(str, "123.");
8176 sscanf(str, "%lf", &f); /* f = 123.; */
8177 along = dummy_long((unsigned long)f);
8178 aint = dummy_int((unsigned int)f);
8179 ashort = dummy_short((unsigned short)f);
8180 if (along != (unsigned long)123)
8181 result |= 4;
8182 if (aint != (unsigned int)123)
8183 result |= 4;
8184 if (ashort != (unsigned short)123)
8185 result |= 4;
8186 exit(result);
8187
8188}
8189EOCP
8190set try
8191if eval $compile_ok; then
8192 ./try
8193 castflags=$?
8194else
8195 echo "(I can't seem to compile the test program--assuming it can't)"
8196 castflags=7
8197fi
8198case "$castflags" in
81990) val="$define"
8200 echo "Yup, it can."
8201 ;;
8202*) val="$undef"
8203 echo "Nope, it can't."
8204 ;;
8205esac
8206set d_castneg
8207eval $setvar
8208$rm -f try.*
8209
8210: see if vprintf exists
8211echo " "
8212if set vprintf val -f d_vprintf; eval $csym; $val; then
8213 echo 'vprintf() found.' >&4
8214 val="$define"
8215 $cat >vprintf.c <<'EOF'
8216#include <varargs.h>
8217
8218int main() { xxx("foo"); }
8219
8220xxx(va_alist)
8221va_dcl
8222{
8223 va_list args;
8224 char buf[10];
8225
8226 va_start(args);
8227 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8228}
8229EOF
8230 set vprintf
8231 if eval $compile && ./vprintf; then
8232 echo "Your vsprintf() returns (int)." >&4
8233 val2="$undef"
8234 else
8235 echo "Your vsprintf() returns (char*)." >&4
8236 val2="$define"
8237 fi
8238else
8239 echo 'vprintf() NOT found.' >&4
8240 val="$undef"
8241 val2="$undef"
8242fi
8243set d_vprintf
8244eval $setvar
8245val=$val2
8246set d_charvspr
8247eval $setvar
8248
8249: see if chown exists
8250set chown d_chown
8251eval $inlibc
8252
8253: see if chroot exists
8254set chroot d_chroot
8255eval $inlibc
8256
8257: see if chsize exists
8258set chsize d_chsize
8259eval $inlibc
8260
8261: check for const keyword
8262echo " "
8263echo 'Checking to see if your C compiler knows about "const"...' >&4
8264$cat >const.c <<'EOCP'
8265typedef struct spug { int drokk; } spug;
8266int main()
8267{
8268 const char *foo;
8269 const spug y;
8270}
8271EOCP
8272if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8273 val="$define"
8274 echo "Yup, it does."
8275else
8276 val="$undef"
8277 echo "Nope, it doesn't."
8278fi
8279set d_const
8280eval $setvar
8281
8282: see if crypt exists
8283echo " "
8284if set crypt val -f d_crypt; eval $csym; $val; then
8285 echo 'crypt() found.' >&4
8286 val="$define"
8287 cryptlib=''
8288else
8289 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8290 if $test -z "$cryptlib"; then
8291 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8292 else
8293 cryptlib=-lcrypt
8294 fi
8295 if $test -z "$cryptlib"; then
8296 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8297 else
8298 cryptlib=-lcrypt
8299 fi
8300 if $test -z "$cryptlib"; then
8301 cryptlib=`./loc libcrypt$_a "" $libpth`
8302 else
8303 cryptlib=-lcrypt
8304 fi
8305 if $test -z "$cryptlib"; then
8306 echo 'crypt() NOT found.' >&4
8307 val="$undef"
8308 else
8309 val="$define"
8310 fi
8311fi
8312set d_crypt
8313eval $setvar
8314
8315: get csh whereabouts
8316case "$csh" in
8317'csh') val="$undef" ;;
8318*) val="$define" ;;
8319esac
8320set d_csh
8321eval $setvar
8322: Respect a hint or command line value for full_csh.
8323case "$full_csh" in
8324'') full_csh=$csh ;;
8325esac
8326
8327: see if cuserid exists
8328set cuserid d_cuserid
8329eval $inlibc
8330
8331: see if this is a limits.h system
8332set limits.h i_limits
8333eval $inhdr
8334
8335: see if this is a float.h system
8336set float.h i_float
8337eval $inhdr
8338
8339: See if number of significant digits in a double precision number is known
8340echo " "
8341$cat >dbl_dig.c <<EOM
8342#$i_limits I_LIMITS
8343#$i_float I_FLOAT
8344#ifdef I_LIMITS
8345#include <limits.h>
8346#endif
8347#ifdef I_FLOAT
8348#include <float.h>
8349#endif
8350#ifdef DBL_DIG
8351printf("Contains DBL_DIG");
8352#endif
8353EOM
8354$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8355if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8356 echo "DBL_DIG found." >&4
8357 val="$define"
8358else
8359 echo "DBL_DIG NOT found." >&4
8360 val="$undef"
8361fi
8362$rm -f dbl_dig.?
8363set d_dbl_dig
8364eval $setvar
8365
8366: see if difftime exists
8367set difftime d_difftime
8368eval $inlibc
8369
8370: see if this is a dirent system
8371echo " "
8372if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8373 val="$define"
8374 echo "<dirent.h> found." >&4
8375else
8376 val="$undef"
8377 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8378 echo "<sys/dir.h> found." >&4
8379 echo " "
8380 else
8381 xinc=`./findhdr sys/ndir.h`
8382 fi
8383 echo "<dirent.h> NOT found." >&4
8384fi
8385set i_dirent
8386eval $setvar
8387
8388: Look for type of directory structure.
8389echo " "
8390$cppstdin $cppflags $cppminus < "$xinc" > try.c
8391
8392case "$direntrytype" in
8393''|' ')
8394 case "$i_dirent" in
8395 $define) guess1='struct dirent' ;;
8396 *) guess1='struct direct' ;;
8397 esac
8398 ;;
8399*) guess1="$direntrytype"
8400 ;;
8401esac
8402
8403case "$guess1" in
8404'struct dirent') guess2='struct direct' ;;
8405*) guess2='struct dirent' ;;
8406esac
8407
8408if $contains "$guess1" try.c >/dev/null 2>&1; then
8409 direntrytype="$guess1"
8410 echo "Your directory entries are $direntrytype." >&4
8411elif $contains "$guess2" try.c >/dev/null 2>&1; then
8412 direntrytype="$guess2"
8413 echo "Your directory entries seem to be $direntrytype." >&4
8414else
8415 echo "I don't recognize your system's directory entries." >&4
8416 rp="What type is used for directory entries on this system?"
8417 dflt="$guess1"
8418 . ./myread
8419 direntrytype="$ans"
8420fi
8421$rm -f try.c
8422
8423
8424: see if the directory entry stores field length
8425echo " "
8426$cppstdin $cppflags $cppminus < "$xinc" > try.c
8427if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8428 echo "Good, your directory entry keeps length information in d_namlen." >&4
8429 val="$define"
8430else
8431 echo "Your directory entry does not know about the d_namlen field." >&4
8432 val="$undef"
8433fi
8434set d_dirnamlen
8435eval $setvar
8436$rm -f try.c
8437
8438: see if dlerror exists
8439xxx_runnm="$runnm"
8440runnm=false
8441set dlerror d_dlerror
8442eval $inlibc
8443runnm="$xxx_runnm"
8444
8445: see if dlfcn is available
8446set dlfcn.h i_dlfcn
8447eval $inhdr
8448
8449case "$usedl" in
8450$define|y|true)
8451 $cat << EOM
8452
8453On a few systems, the dynamically loaded modules that perl generates and uses
8454will need a different extension than shared libs. The default will probably
8455be appropriate.
8456
8457EOM
8458 case "$dlext" in
8459 '') dflt="$so" ;;
8460 *) dflt="$dlext" ;;
8461 esac
8462 rp='What is the extension of dynamically loaded modules'
8463 . ./myread
8464 dlext="$ans"
8465 ;;
8466*)
8467 dlext="none"
8468 ;;
8469esac
8470
8471: Check if dlsym need a leading underscore
8472echo " "
8473val="$undef"
8474
8475case "$dlsrc" in
8476dl_dlopen.xs)
8477 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8478 $cat >dyna.c <<'EOM'
8479fred () { }
8480EOM
8481
8482$cat >fred.c<<EOM
8483
8484#include <stdio.h>
8485#$i_dlfcn I_DLFCN
8486#ifdef I_DLFCN
8487#include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
8488#else
8489#include <sys/types.h>
8490#include <nlist.h>
8491#include <link.h>
8492#endif
8493
8494extern int fred() ;
8495
8496int main()
8497{
8498 void * handle ;
8499 void * symbol ;
8500#ifndef RTLD_LAZY
8501 int mode = 1 ;
8502#else
8503 int mode = RTLD_LAZY ;
8504#endif
8505 handle = dlopen("./dyna.$dlext", mode) ;
8506 if (handle == NULL) {
8507 printf ("1\n") ;
8508 fflush (stdout) ;
8509 exit(0);
8510 }
8511 symbol = dlsym(handle, "fred") ;
8512 if (symbol == NULL) {
8513 /* try putting a leading underscore */
8514 symbol = dlsym(handle, "_fred") ;
8515 if (symbol == NULL) {
8516 printf ("2\n") ;
8517 fflush (stdout) ;
8518 exit(0);
8519 }
8520 printf ("3\n") ;
8521 }
8522 else
8523 printf ("4\n") ;
8524 fflush (stdout) ;
8525 exit(0);
8526}
8527EOM
8528 : Call the object file tmp-dyna.o in case dlext=o.
8529 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
8530 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
7a282f6d
JH
8531 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
8532 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
b4eb6b3d
JH
8533 xxx=`./fred`
8534 case $xxx in
8535 1) echo "Test program failed using dlopen." >&4
8536 echo "Perhaps you should not use dynamic loading." >&4;;
8537 2) echo "Test program failed using dlsym." >&4
8538 echo "Perhaps you should not use dynamic loading." >&4;;
8539 3) echo "dlsym needs a leading underscore" >&4
8540 val="$define" ;;
8541 4) echo "dlsym doesn't need a leading underscore." >&4;;
8542 esac
8543 else
8544 echo "I can't compile and run the test program." >&4
8545 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8546 fi
8547 ;;
8548esac
8549
8550$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8551
8552set d_dlsymun
8553eval $setvar
8554
8555hasproto='varname=$1; func=$2; shift; shift;
8556while $test $# -ge 2; do
8557 case "$1" in
8558 $define) echo "#include <$2>";;
8559 esac ;
8560 shift 2;
8561done > try.c;
8562$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8563if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8564 echo "$func() prototype found.";
8565 val="$define";
8566else
8567 echo "$func() prototype NOT found.";
8568 val="$undef";
8569fi;
8570set $varname;
8571eval $setvar;
8572$rm -f try.c tryout.c'
8573
8574: see if prototype for drand48 is available
8575echo " "
8576set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8577eval $hasproto
8578
8579: see if dup2 exists
8580set dup2 d_dup2
8581eval $inlibc
8582
8583: see if eaccess exists
8584set eaccess d_eaccess
8585eval $inlibc
8586
8587: see if endgrent exists
8588set endgrent d_endgrent
8589eval $inlibc
8590
8591: see if endhostent exists
8592set endhostent d_endhent
8593eval $inlibc
8594
8595: see if endnetent exists
8596set endnetent d_endnent
8597eval $inlibc
8598
8599: see if endprotoent exists
8600set endprotoent d_endpent
8601eval $inlibc
8602
8603: see if endpwent exists
8604set endpwent d_endpwent
8605eval $inlibc
8606
8607: see if endservent exists
8608set endservent d_endsent
8609eval $inlibc
8610
8611: Locate the flags for 'open()'
8612echo " "
8613$cat >open3.c <<'EOCP'
8614#include <sys/types.h>
8615#ifdef I_FCNTL
8616#include <fcntl.h>
8617#endif
8618#ifdef I_SYS_FILE
8619#include <sys/file.h>
8620#endif
8621int main() {
8622 if(O_RDONLY);
8623#ifdef O_TRUNC
8624 exit(0);
8625#else
8626 exit(1);
8627#endif
8628}
8629EOCP
8630: check sys/file.h first to get FREAD on Sun
8631if $test `./findhdr sys/file.h` && \
8632 set open3 -DI_SYS_FILE && eval $compile; then
8633 h_sysfile=true;
8634 echo "<sys/file.h> defines the O_* constants..." >&4
8635 if ./open3; then
8636 echo "and you have the 3 argument form of open()." >&4
8637 val="$define"
8638 else
8639 echo "but not the 3 argument form of open(). Oh, well." >&4
8640 val="$undef"
8641 fi
8642elif $test `./findhdr fcntl.h` && \
8643 set open3 -DI_FCNTL && eval $compile; then
8644 h_fcntl=true;
8645 echo "<fcntl.h> defines the O_* constants..." >&4
8646 if ./open3; then
8647 echo "and you have the 3 argument form of open()." >&4
8648 val="$define"
8649 else
8650 echo "but not the 3 argument form of open(). Oh, well." >&4
8651 val="$undef"
8652 fi
8653else
8654 val="$undef"
8655 echo "I can't find the O_* constant definitions! You got problems." >&4
8656fi
8657set d_open3
8658eval $setvar
8659$rm -f open3*
8660
8661: see which of string.h or strings.h is needed
8662echo " "
8663strings=`./findhdr string.h`
8664if $test "$strings" && $test -r "$strings"; then
8665 echo "Using <string.h> instead of <strings.h>." >&4
8666 val="$define"
8667else
8668 val="$undef"
8669 strings=`./findhdr strings.h`
8670 if $test "$strings" && $test -r "$strings"; then
8671 echo "Using <strings.h> instead of <string.h>." >&4
8672 else
8673 echo "No string header found -- You'll surely have problems." >&4
8674 fi
8675fi
8676set i_string
8677eval $setvar
8678case "$i_string" in
8679"$undef") strings=`./findhdr strings.h`;;
8680*) strings=`./findhdr string.h`;;
8681esac
8682
8683: check for non-blocking I/O stuff
8684case "$h_sysfile" in
8685true) echo "#include <sys/file.h>" > head.c;;
8686*)
8687 case "$h_fcntl" in
8688 true) echo "#include <fcntl.h>" > head.c;;
8689 *) echo "#include <sys/fcntl.h>" > head.c;;
8690 esac
8691 ;;
8692esac
8693echo " "
8694echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8695case "$o_nonblock" in
8696'')
8697 $cat head.c > try.c
8698 $cat >>try.c <<'EOCP'
8699#include <stdio.h>
8700int main() {
8701#ifdef O_NONBLOCK
8702 printf("O_NONBLOCK\n");
8703 exit(0);
8704#endif
8705#ifdef O_NDELAY
8706 printf("O_NDELAY\n");
8707 exit(0);
8708#endif
8709#ifdef FNDELAY
8710 printf("FNDELAY\n");
8711 exit(0);
8712#endif
8713 exit(0);
8714}
8715EOCP
8716 set try
8717 if eval $compile_ok; then
8718 o_nonblock=`./try`
8719 case "$o_nonblock" in
8720 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8721 *) echo "Seems like we can use $o_nonblock.";;
8722 esac
8723 else
8724 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8725 fi
8726 ;;
8727*) echo "Using $hint value $o_nonblock.";;
8728esac
8729$rm -f try try.* .out core
8730
8731echo " "
8732echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8733case "$eagain" in
8734'')
8735 $cat head.c > try.c
8736 $cat >>try.c <<EOCP
8737#include <errno.h>
8738#include <sys/types.h>
8739#include <signal.h>
8740#include <stdio.h>
8741#define MY_O_NONBLOCK $o_nonblock
8742#ifndef errno /* XXX need better Configure test */
8743extern int errno;
8744#endif
8745#$i_unistd I_UNISTD
8746#ifdef I_UNISTD
8747#include <unistd.h>
8748#endif
8749#$i_string I_STRING
8750#ifdef I_STRING
8751#include <string.h>
8752#else
8753#include <strings.h>
8754#endif
8755$signal_t blech(x) int x; { exit(3); }
8756EOCP
8757 $cat >> try.c <<'EOCP'
8758int main()
8759{
8760 int pd[2];
8761 int pu[2];
8762 char buf[1];
8763 char string[100];
8764
8765 pipe(pd); /* Down: child -> parent */
8766 pipe(pu); /* Up: parent -> child */
8767 if (0 != fork()) {
8768 int ret;
8769 close(pd[1]); /* Parent reads from pd[0] */
8770 close(pu[0]); /* Parent writes (blocking) to pu[1] */
8771 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8772 exit(1);
8773 signal(SIGALRM, blech);
8774 alarm(5);
8775 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
8776 exit(2);
8777 sprintf(string, "%d\n", ret);
8778 write(2, string, strlen(string));
8779 alarm(0);
8780#ifdef EAGAIN
8781 if (errno == EAGAIN) {
8782 printf("EAGAIN\n");
8783 goto ok;
8784 }
8785#endif
8786#ifdef EWOULDBLOCK
8787 if (errno == EWOULDBLOCK)
8788 printf("EWOULDBLOCK\n");
8789#endif
8790 ok:
8791 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
8792 sleep(2); /* Give it time to close our pipe */
8793 alarm(5);
8794 ret = read(pd[0], buf, 1); /* Should read EOF */
8795 alarm(0);
8796 sprintf(string, "%d\n", ret);
8797 write(3, string, strlen(string));
8798 exit(0);
8799 }
8800
8801 close(pd[0]); /* We write to pd[1] */
8802 close(pu[1]); /* We read from pu[0] */
8803 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
8804 close(pd[1]); /* Pipe pd is now fully closed! */
8805 exit(0); /* Bye bye, thank you for playing! */
8806}
8807EOCP
8808 set try
8809 if eval $compile_ok; then
8810 echo "$startsh" >mtry
8811 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8812 chmod +x mtry
8813 ./mtry >/dev/null 2>&1
8814 case $? in
8815 0) eagain=`$cat try.out`;;
8816 1) echo "Could not perform non-blocking setting!";;
8817 2) echo "I did a successful read() for something that was not there!";;
8818 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8819 *) echo "Something terribly wrong happened during testing.";;
8820 esac
8821 rd_nodata=`$cat try.ret`
8822 echo "A read() system call with no data present returns $rd_nodata."
8823 case "$rd_nodata" in
8824 0|-1) ;;
8825 *)
8826 echo "(That's peculiar, fixing that to be -1.)"
8827 rd_nodata=-1
8828 ;;
8829 esac
8830 case "$eagain" in
8831 '')
8832 echo "Forcing errno EAGAIN on read() with no data available."
8833 eagain=EAGAIN
8834 ;;
8835 *)
8836 echo "Your read() sets errno to $eagain when no data is available."
8837 ;;
8838 esac
8839 status=`$cat try.err`
8840 case "$status" in
8841 0) echo "And it correctly returns 0 to signal EOF.";;
8842 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8843 *) echo "However, your read() returns '$status' on EOF??";;
8844 esac
8845 val="$define"
8846 if test "$status" = "$rd_nodata"; then
8847 echo "WARNING: you can't distinguish between EOF and no data!"
8848 val="$undef"
8849 fi
8850 else
8851 echo "I can't compile the test program--assuming errno EAGAIN will do."
8852 eagain=EAGAIN
8853 fi
8854 set d_eofnblk
8855 eval $setvar
8856 ;;
8857*)
8858 echo "Using $hint value $eagain."
8859 echo "Your read() returns $rd_nodata when no data is present."
8860 case "$d_eofnblk" in
8861 "$define") echo "And you can see EOF because read() returns 0.";;
8862 "$undef") echo "But you can't see EOF status from read() returned value.";;
8863 *)
8864 echo "(Assuming you can't see EOF status from read anyway.)"
8865 d_eofnblk=$undef
8866 ;;
8867 esac
8868 ;;
8869esac
8870$rm -f try try.* .out core head.c mtry
8871
8872: see if fchmod exists
8873set fchmod d_fchmod
8874eval $inlibc
8875
8876: see if fchown exists
8877set fchown d_fchown
8878eval $inlibc
8879
8880: see if this is an fcntl system
8881set fcntl d_fcntl
8882eval $inlibc
8883
9d9004a9
AD
8884echo " "
8885: See if fcntl-based locking works.
8886$cat >try.c <<'EOCP'
8887#include <stdlib.h>
8888#include <unistd.h>
8889#include <fcntl.h>
8890int main() {
8891#if defined(F_SETLK) && defined(F_SETLKW)
8892 struct flock flock;
8893 int retval, fd;
8894 fd = open("try.c", O_RDONLY);
8895 flock.l_type = F_RDLCK;
8896 flock.l_whence = SEEK_SET;
8897 flock.l_start = flock.l_len = 0;
8898 retval = fcntl(fd, F_SETLK, &flock);
8899 close(fd);
8900 (retval < 0 ? exit(2) : exit(0));
8901#else
8902 exit(2);
8903#endif
8904}
8905EOCP
8906echo "Checking if fcntl-based file locking works... "
8907case "$d_fcntl" in
8908"$define")
8909 set try
8910 if eval $compile_ok; then
8911 if ./try; then
8912 echo "Yes, it seems to work."
8913 val="$define"
8914 else
8915 echo "Nope, it didn't work."
8916 val="$undef"
8917 fi
8918 else
8919 echo "I'm unable to compile the test program, so I'll assume not."
8920 val="$undef"
8921 fi
8922 ;;
8923*) val="$undef";
8924 echo "Nope, since you don't even have fcntl()."
8925 ;;
8926esac
8927set d_fcntl_can_lock
8928eval $setvar
8929$rm -f try*
8930
8931
b4eb6b3d
JH
8932hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8933while $test $# -ge 2; do
8934 case "$1" in
8935 $define) echo "#include <$2>";;
8936 esac ;
8937 shift 2;
8938done > try.c;
8939echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8940set try;
8941if eval $compile; then
8942 val="$define";
8943else
8944 val="$undef";
8945fi;
8946set $varname;
8947eval $setvar;
8948$rm -f try.c try.o'
8949
8950socketlib=''
8951sockethdr=''
8952: see whether socket exists
8953echo " "
8954$echo $n "Hmm... $c" >&4
8955if set socket val -f d_socket; eval $csym; $val; then
8956 echo "Looks like you have Berkeley networking support." >&4
8957 d_socket="$define"
8958 if set setsockopt val -f; eval $csym; $val; then
8959 d_oldsock="$undef"
8960 else
8961 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8962 d_oldsock="$define"
8963 fi
8964else
8965 if $contains socklib libc.list >/dev/null 2>&1; then
8966 echo "Looks like you have Berkeley networking support." >&4
8967 d_socket="$define"
8968 : we will have to assume that it supports the 4.2 BSD interface
8969 d_oldsock="$undef"
8970 else
8971 echo "You don't have Berkeley networking in libc$_a..." >&4
8972 if test "X$d_socket" = "X$define"; then
8973 echo "...but you seem to believe that you have sockets." >&4
8974 else
8975 for net in net socket
8976 do
8977 if test -f /usr/lib/lib$net$_a; then
8978 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
8979 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8980 if $contains socket libc.list >/dev/null 2>&1; then
8981 d_socket="$define"
8982 socketlib="-l$net"
8983 case "$net" in
8984 net)
8985 echo "...but the Wollongong group seems to have hacked it in." >&4
8986 sockethdr="-I/usr/netinclude"
8987 ;;
8988 esac
8989 echo "Found Berkeley sockets interface in lib$net." >& 4
8990 if $contains setsockopt libc.list >/dev/null 2>&1; then
8991 d_oldsock="$undef"
8992 else
8993 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8994 d_oldsock="$define"
8995 fi
8996 break
8997 fi
8998 fi
8999 done
9000 if test "X$d_socket" != "X$define"; then
9001 echo "or anywhere else I see." >&4
9002 d_socket="$undef"
9003 d_oldsock="$undef"
9004 fi
9005 fi
9006 fi
9007fi
9008
9009: see if socketpair exists
9010set socketpair d_sockpair
9011eval $inlibc
9012
9013
9014echo " "
9015echo "Checking the availability of certain socket constants..." >& 4
9016for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9017 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9018 $cat >try.c <<EOF
9019#include <sys/types.h>
9020#include <sys/socket.h>
9021int main() {
9022 int i = $ENUM;
9023}
9024EOF
9025 val="$undef"
9026 set try; if eval $compile; then
9027 val="$define"
9028 fi
9029 set d_${enum}; eval $setvar
9030 $rm -f try.c try
9031done
9032
9033: see if sys/select.h has to be included
9034set sys/select.h i_sysselct
9035eval $inhdr
9036
9037: see if we should include time.h, sys/time.h, or both
9038echo " "
9039if test "X$timeincl" = X; then
9040 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9041 $echo $n "I'm now running the test program...$c"
9042 $cat >try.c <<'EOCP'
9043#include <sys/types.h>
9044#ifdef I_TIME
9045#include <time.h>
9046#endif
9047#ifdef I_SYSTIME
9048#ifdef SYSTIMEKERNEL
9049#define KERNEL
9050#endif
9051#include <sys/time.h>
9052#endif
9053#ifdef I_SYSSELECT
9054#include <sys/select.h>
9055#endif
9056int main()
9057{
9058 struct tm foo;
9059#ifdef S_TIMEVAL
9060 struct timeval bar;
9061#endif
9062#ifdef S_TIMEZONE
9063 struct timezone tzp;
9064#endif
9065 if (foo.tm_sec == foo.tm_sec)
9066 exit(0);
9067#ifdef S_TIMEVAL
9068 if (bar.tv_sec == bar.tv_sec)
9069 exit(0);
9070#endif
9071 exit(1);
9072}
9073EOCP
9074 flags=''
9075 for s_timezone in '-DS_TIMEZONE' ''; do
9076 sysselect=''
9077 for s_timeval in '-DS_TIMEVAL' ''; do
9078 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9079 for i_time in '' '-DI_TIME'; do
9080 for i_systime in '-DI_SYSTIME' ''; do
9081 case "$flags" in
9082 '') $echo $n ".$c"
9083 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9084 if eval $compile; then
9085 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9086 shift
9087 flags="$*"
9088 echo " "
9089 $echo $n "Succeeded with $flags$c"
9090 fi
9091 ;;
9092 esac
9093 done
9094 done
9095 done
9096 done
9097 done
9098 timeincl=''
9099 echo " "
9100 case "$flags" in
9101 *SYSTIMEKERNEL*) i_systimek="$define"
9102 timeincl=`./findhdr sys/time.h`
9103 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9104 *) i_systimek="$undef";;
9105 esac
9106 case "$flags" in
9107 *I_TIME*) i_time="$define"
9108 timeincl=`./findhdr time.h`" $timeincl"
9109 echo "We'll include <time.h>." >&4;;
9110 *) i_time="$undef";;
9111 esac
9112 case "$flags" in
9113 *I_SYSTIME*) i_systime="$define"
9114 timeincl=`./findhdr sys/time.h`" $timeincl"
9115 echo "We'll include <sys/time.h>." >&4;;
9116 *) i_systime="$undef";;
9117 esac
9118 $rm -f try.c try
9119fi
9120
9121: check for fd_set items
9122$cat <<EOM
9123
9124Checking to see how well your C compiler handles fd_set and friends ...
9125EOM
9126$cat >fd_set.c <<EOCP
9127#$i_systime I_SYS_TIME
9128#$i_sysselct I_SYS_SELECT
9129#$d_socket HAS_SOCKET
9130#include <sys/types.h>
9131#ifdef HAS_SOCKET
9132#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9133#endif
9134#ifdef I_SYS_TIME
9135#include <sys/time.h>
9136#endif
9137#ifdef I_SYS_SELECT
9138#include <sys/select.h>
9139#endif
9140int main() {
9141 fd_set fds;
9142
9143#ifdef TRYBITS
9144 if(fds.fds_bits);
9145#endif
9146
9147#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9148 exit(0);
9149#else
9150 exit(1);
9151#endif
9152}
9153EOCP
9154set fd_set -DTRYBITS
9155if eval $compile; then
9156 d_fds_bits="$define"
9157 d_fd_set="$define"
9158 echo "Well, your system knows about the normal fd_set typedef..." >&4
9159 if ./fd_set; then
9160 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9161 d_fd_macros="$define"
9162 else
9163 $cat >&4 <<'EOM'
9164but not the normal fd_set macros! Gaaack! I'll have to cover for you.
9165EOM
9166 d_fd_macros="$undef"
9167 fi
9168else
9169 $cat <<'EOM'
9170Hmm, your compiler has some difficulty with fd_set. Checking further...
9171EOM
9172 set fd_set
9173 if eval $compile; then
9174 d_fds_bits="$undef"
9175 d_fd_set="$define"
9176 echo "Well, your system has some sort of fd_set available..." >&4
9177 if ./fd_set; then
9178 echo "and you have the normal fd_set macros." >&4
9179 d_fd_macros="$define"
9180 else
9181 $cat <<'EOM'
9182but not the normal fd_set macros! Gross! More work for me...
9183EOM
9184 d_fd_macros="$undef"
9185 fi
9186 else
9187 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
9188 d_fd_set="$undef"
9189 d_fds_bits="$undef"
9190 d_fd_macros="$undef"
9191 fi
9192fi
9193$rm -f fd_set*
9194
9195: see if fgetpos exists
9196set fgetpos d_fgetpos
9197eval $inlibc
9198
9199: see if flock exists
9200set flock d_flock
9201eval $inlibc
9202
9203: see if fork exists
9204set fork d_fork
9205eval $inlibc
9206
9207: see if pathconf exists
9208set pathconf d_pathconf
9209eval $inlibc
9210
9211: see if fpathconf exists
9212set fpathconf d_fpathconf
9213eval $inlibc
9214
9215
9216: check for fpos64_t
9217echo " "
9218echo "Checking to see if you have fpos64_t..." >&4
9219$cat >try.c <<EOCP
9220#include <stdio.h>
9221int main() { fpos64_t x = 7; }
9222EOCP
9223set try
9224if eval $compile; then
9225 val="$define"
9226 echo "You have fpos64_t."
9227else
9228 val="$undef"
9229 echo "You do not have fpos64_t."
9230 case "$fpossize" in
9231 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9232 esac
9233fi
9234$rm -f try.* try
9235set d_fpos64_t
9236eval $setvar
9237
9238: see if frexpl exists
9239set frexpl d_frexpl
9240eval $inlibc
9241
9242hasstruct='varname=$1; struct=$2; shift; shift;
9243while $test $# -ge 2; do
9244 case "$1" in
9245 $define) echo "#include <$2>";;
9246 esac ;
9247 shift 2;
9248done > try.c;
9249echo "int main () { struct $struct foo; }" >> try.c;
9250set try;
9251if eval $compile; then
9252 val="$define";
9253else
9254 val="$undef";
9255fi;
9256set $varname;
9257eval $setvar;
9258$rm -f try.c try.o'
9259
9260: see if this is a sys/param system
9261set sys/param.h i_sysparam
9262eval $inhdr
9263
9264: see if this is a sys/mount.h system
9265set sys/mount.h i_sysmount
9266eval $inhdr
9267
9268: see if sys/types.h has to be included
9269set sys/types.h i_systypes
9270eval $inhdr
9271
9272
9273echo " "
9274echo "Checking to see if your system supports struct fs_data..." >&4
9275set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9276eval $hasstruct
9277case "$d_fs_data_s" in
9278"$define") echo "Yes, it does." ;;
9279*) echo "No, it doesn't." ;;
9280esac
9281
9282: see if fseeko exists
9283set fseeko d_fseeko
9284eval $inlibc
9285case "$longsize" in
92868) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9287esac
9288
9289: see if fsetpos exists
9290set fsetpos d_fsetpos
9291eval $inlibc
9292
9293
9294: see if fstatfs exists
9295set fstatfs d_fstatfs
9296eval $inlibc
9297
9298
9299: see if statvfs exists
9300set statvfs d_statvfs
9301eval $inlibc
9302
9303: see if fstatvfs exists
9304set fstatvfs d_fstatvfs
9305eval $inlibc
9306
9307
411ab01c
JH
9308: see if fsync exists
9309set fsync d_fsync
9310eval $inlibc
9311
b4eb6b3d
JH
9312: see if ftello exists
9313set ftello d_ftello
9314eval $inlibc
9315case "$longsize" in
93168) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9317esac
9318
9319: see if getcwd exists
9320set getcwd d_getcwd
9321eval $inlibc
9322
9323: see if getespwnam exists
9324set getespwnam d_getespwnam
9325eval $inlibc
9326
9327
9328: see if getfsstat exists
9329set getfsstat d_getfsstat
9330eval $inlibc
9331
9332: see if getgrent exists
9333set getgrent d_getgrent
9334eval $inlibc
9335
9336: see if gethostbyaddr exists
9337set gethostbyaddr d_gethbyaddr
9338eval $inlibc
9339
9340: see if gethostbyname exists
9341set gethostbyname d_gethbyname
9342eval $inlibc
9343
9344: see if gethostent exists
9345set gethostent d_gethent
9346eval $inlibc
9347
9348: see how we will look up host name
9349echo " "
9350call=''
9351if set gethostname val -f d_gethname; eval $csym; $val; then
9352 echo 'gethostname() found.' >&4
9353 d_gethname="$define"
9354 call=gethostname
9355fi
9356if set uname val -f d_uname; eval $csym; $val; then
9357 if ./xenix; then
9358 $cat <<'EOM'
9359uname() was found, but you're running xenix, and older versions of xenix
9360have a broken uname(). If you don't really know whether your xenix is old
9361enough to have a broken system call, use the default answer.
9362
9363EOM
9364 dflt=y
9365 case "$d_uname" in
9366 "$define") dflt=n;;
9367 esac
9368 rp='Is your uname() broken?'
9369 . ./myread
9370 case "$ans" in
9371 n*) d_uname="$define"; call=uname;;
9372 esac
9373 else
9374 echo 'uname() found.' >&4
9375 d_uname="$define"
9376 case "$call" in
9377 '') call=uname ;;
9378 esac
9379 fi
9380fi
9381case "$d_gethname" in
9382'') d_gethname="$undef";;
9383esac
9384case "$d_uname" in
9385'') d_uname="$undef";;
9386esac
9387case "$d_uname$d_gethname" in
9388*define*)
9389 dflt=n
9390 cat <<EOM
9391
9392Every now and then someone has a $call() that lies about the hostname
9393but can't be fixed for political or economic reasons. If you wish, I can
9394pretend $call() isn't there and maybe compute hostname at run-time
9395thanks to the '$phostname' command.
9396
9397EOM
9398 rp="Shall I ignore $call() from now on?"
9399 . ./myread
9400 case "$ans" in
9401 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9402 esac;;
9403esac
9404case "$phostname" in
9405'') aphostname='';;
9406*) case "$aphostname" in
9407 /*) ;;
9408 *) set X $phostname
9409 shift
9410 file=$1
9411 shift
9412 file=`./loc $file $file $pth`
9413 aphostname=`echo $file $*`
9414 ;;
9415 esac
9416 ;;
9417esac
9418case "$d_uname$d_gethname" in
9419*define*) ;;
9420*)
9421 case "$phostname" in
9422 '')
9423 echo "There will be no way for $package to get your hostname." >&4;;
9424 *)
9425 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9426 ;;
9427 esac;;
9428esac
9429case "$d_phostname" in
9430'') d_phostname="$undef";;
9431esac
9432
9433: see if this is a netdb.h system
9434set netdb.h i_netdb
9435eval $inhdr
9436
9437: see if prototypes for various gethostxxx netdb.h functions are available
9438echo " "
9439set d_gethostprotos gethostent $i_netdb netdb.h
9440eval $hasproto
9441
9442: see if getlogin exists
9443set getlogin d_getlogin
9444eval $inlibc
9445
9446: see if getmnt exists
9447set getmnt d_getmnt
9448eval $inlibc
9449
9450: see if getmntent exists
9451set getmntent d_getmntent
9452eval $inlibc
9453
9454: see if getnetbyaddr exists
9455set getnetbyaddr d_getnbyaddr
9456eval $inlibc
9457
9458: see if getnetbyname exists
9459set getnetbyname d_getnbyname
9460eval $inlibc
9461
9462: see if getnetent exists
9463set getnetent d_getnent
9464eval $inlibc
9465
9466: see if prototypes for various getnetxxx netdb.h functions are available
9467echo " "
9468set d_getnetprotos getnetent $i_netdb netdb.h
9469eval $hasproto
9470
0c0643d0
JH
9471: see if getpagesize exists
9472set getpagesize d_getpagsz
9473eval $inlibc
9474
b4eb6b3d
JH
9475
9476: see if getprotobyname exists
9477set getprotobyname d_getpbyname
9478eval $inlibc
9479
9480: see if getprotobynumber exists
9481set getprotobynumber d_getpbynumber
9482eval $inlibc
9483
9484: see if getprotoent exists
9485set getprotoent d_getpent
9486eval $inlibc
9487
9488: see if getpgid exists
9489set getpgid d_getpgid
9490eval $inlibc
9491
9492: see if getpgrp2 exists
9493set getpgrp2 d_getpgrp2
9494eval $inlibc
9495
9496: see if getppid exists
9497set getppid d_getppid
9498eval $inlibc
9499
9500: see if getpriority exists
9501set getpriority d_getprior
9502eval $inlibc
9503
9504: see if prototypes for various getprotoxxx netdb.h functions are available
9505echo " "
9506set d_getprotoprotos getprotoent $i_netdb netdb.h
9507eval $hasproto
9508
9509: see if getprpwnam exists
9510set getprpwnam d_getprpwnam
9511eval $inlibc
9512
9513: see if getpwent exists
9514set getpwent d_getpwent
9515eval $inlibc
9516
9517
9518: see if getservbyname exists
9519set getservbyname d_getsbyname
9520eval $inlibc
9521
9522: see if getservbyport exists
9523set getservbyport d_getsbyport
9524eval $inlibc
9525
9526: see if getservent exists
9527set getservent d_getsent
9528eval $inlibc
9529
9530: see if prototypes for various getservxxx netdb.h functions are available
9531echo " "
9532set d_getservprotos getservent $i_netdb netdb.h
9533eval $hasproto
9534
9535: see if getspnam exists
9536set getspnam d_getspnam
9537eval $inlibc
9538
9539: see if gettimeofday or ftime exists
9540set gettimeofday d_gettimeod
9541eval $inlibc
9542case "$d_gettimeod" in
9543"$undef")
9544 set ftime d_ftime
9545 eval $inlibc
9546 ;;
9547*)
9548 val="$undef"; set d_ftime; eval $setvar
9549 ;;
9550esac
9551case "$d_gettimeod$d_ftime" in
9552"$undef$undef")
9553 echo " "
9554 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9555 ;;
9556esac
9557
9558: see if this is an grp system
9559set grp.h i_grp
9560eval $inhdr
9561
9562case "$i_grp" in
9563$define)
9564 xxx=`./findhdr grp.h`
9565 $cppstdin $cppflags $cppminus < $xxx >$$.h
9566
9567 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9568 val="$define"
9569 else
9570 val="$undef"
9571 fi
9572 set d_grpasswd
9573 eval $setvar
9574
9575 $rm -f $$.h
9576 ;;
9577*)
9578 val="$undef";
9579 set d_grpasswd; eval $setvar
9580 ;;
9581esac
9582
9583: see if hasmntopt exists
9584set hasmntopt d_hasmntopt
9585eval $inlibc
9586
9587: see if this is a netinet/in.h or sys/in.h system
9588set netinet/in.h i_niin sys/in.h i_sysin
9589eval $inhdr
9590
9591: see if arpa/inet.h has to be included
9592set arpa/inet.h i_arpainet
9593eval $inhdr
9594
9595: see if htonl --and friends-- exists
9596val=''
9597set htonl val
9598eval $inlibc
9599
9600: Maybe they are macros.
9601case "$val" in
9602$undef)
9603 $cat >htonl.c <<EOM
9604#include <stdio.h>
9605#include <sys/types.h>
9606#$i_niin I_NETINET_IN
9607#$i_sysin I_SYS_IN
9608#$i_arpainet I_ARPA_INET
9609#ifdef I_NETINET_IN
9610#include <netinet/in.h>
9611#endif
9612#ifdef I_SYS_IN
9613#include <sys/in.h>
9614#endif
9615#ifdef I_ARPA_INET
9616#include <arpa/inet.h>
9617#endif
9618#ifdef htonl
9619printf("Defined as a macro.");
9620#endif
9621EOM
9622 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9623 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9624 val="$define"
9625 echo "But it seems to be defined as a macro." >&4
9626 fi
9627 $rm -f htonl.?
9628 ;;
9629esac
9630set d_htonl
9631eval $setvar
9632
9633: see if iconv exists
9634set iconv d_iconv
9635eval $inlibc
9636
9637: index or strchr
9638echo " "
9639if set index val -f; eval $csym; $val; then
9640 if set strchr val -f d_strchr; eval $csym; $val; then
9641 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9642 val="$define"
9643 vali="$undef"
9644 echo "strchr() found." >&4
9645 else
9646 val="$undef"
9647 vali="$define"
9648 echo "index() found." >&4
9649 fi
9650 else
9651 val="$undef"
9652 vali="$define"
9653 echo "index() found." >&4
9654 fi
9655else
9656 if set strchr val -f d_strchr; eval $csym; $val; then
9657 val="$define"
9658 vali="$undef"
9659 echo "strchr() found." >&4
9660 else
9661 echo "No index() or strchr() found!" >&4
9662 val="$undef"
9663 vali="$undef"
9664 fi
9665fi
9666set d_strchr; eval $setvar
9667val="$vali"
9668set d_index; eval $setvar
9669
9670: check whether inet_aton exists
9671set inet_aton d_inetaton
9672eval $inlibc
9673
9674: see if inttypes.h is available
9675: we want a real compile instead of Inhdr because some systems
9676: have an inttypes.h which includes non-existent headers
9677echo " "
9678$cat >try.c <<EOCP
9679#include <inttypes.h>
9680int main() {
9681 static int32_t foo32 = 0x12345678;
9682}
9683EOCP
9684set try
9685if eval $compile; then
9686 echo "<inttypes.h> found." >&4
9687 val="$define"
9688else
9689 echo "<inttypes.h> NOT found." >&4
9690 val="$undef"
9691fi
9692$rm -f try.c try
9693set i_inttypes
9694eval $setvar
9695
9696: check for int64_t
9697echo " "
9698echo "Checking to see if you have int64_t..." >&4
9699$cat >try.c <<EOCP
9700#include <sys/types.h>
9701#$i_inttypes I_INTTYPES
9702#ifdef I_INTTYPES
9703#include <inttypes.h>
9704#endif
9705int main() { int64_t x = 7; }
9706EOCP
9707set try
9708if eval $compile; then
9709 val="$define"
9710 echo "You have int64_t."
9711else
9712 val="$undef"
9713 echo "You do not have int64_t."
9714fi
9715$rm -f try try.*
9716set d_int64_t
9717eval $setvar
9718
9719: Look for isascii
9720echo " "
9721$cat >isascii.c <<'EOCP'
9722#include <stdio.h>
9723#include <ctype.h>
9724int main() {
9725 int c = 'A';
9726 if (isascii(c))
9727 exit(0);
9728 else
9729 exit(1);
9730}
9731EOCP
9732set isascii
9733if eval $compile; then
9734 echo "isascii() found." >&4
9735 val="$define"
9736else
9737 echo "isascii() NOT found." >&4
9738 val="$undef"
9739fi
9740set d_isascii
9741eval $setvar
9742$rm -f isascii*
9743
9744: see if isnan exists
9745set isnan d_isnan
9746eval $inlibc
9747
9748: see if isnanl exists
9749set isnanl d_isnanl
9750eval $inlibc
9751
9752: see if killpg exists
9753set killpg d_killpg
9754eval $inlibc
9755
9756: see if lchown exists
9757echo " "
9758$cat > try.c <<'EOCP'
9759/* System header to define __stub macros and hopefully few prototypes,
9760 which can conflict with char lchown(); below. */
9761#include <assert.h>
9762/* Override any gcc2 internal prototype to avoid an error. */
9763/* We use char because int might match the return type of a gcc2
9764 builtin and then its argument prototype would still apply. */
9765char lchown();
9766int main() {
9767 /* The GNU C library defines this for functions which it implements
9768 to always fail with ENOSYS. Some functions are actually named
9769 something starting with __ and the normal name is an alias. */
9770#if defined (__stub_lchown) || defined (__stub___lchown)
9771choke me
9772#else
9773lchown();
9774#endif
9775; return 0; }
9776EOCP
9777set try
9778if eval $compile; then
9779 $echo "lchown() found." >&4
9780 val="$define"
9781else
9782 $echo "lchown() NOT found." >&4
9783 val="$undef"
9784fi
9785set d_lchown
9786eval $setvar
9787
9788: See if number of significant digits in a double precision number is known
9789echo " "
9790$cat >ldbl_dig.c <<EOM
9791#$i_limits I_LIMITS
9792#$i_float I_FLOAT
9793#ifdef I_LIMITS
9794#include <limits.h>
9795#endif
9796#ifdef I_FLOAT
9797#include <float.h>
9798#endif
9799#ifdef LDBL_DIG
9800printf("Contains LDBL_DIG");
9801#endif
9802EOM
9803$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9804if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9805 echo "LDBL_DIG found." >&4
9806 val="$define"
9807else
9808 echo "LDBL_DIG NOT found." >&4
9809 val="$undef"
9810fi
9811$rm -f ldbl_dig.?
9812set d_ldbl_dig
9813eval $setvar
9814
9815: see if link exists
9816set link d_link
9817eval $inlibc
9818
9819: see if localeconv exists
9820set localeconv d_locconv
9821eval $inlibc
9822
9823: see if lockf exists
9824set lockf d_lockf
9825eval $inlibc
9826
9827: check for long long
9828echo " "
9829echo "Checking to see if you have long long..." >&4
9830echo 'int main() { long long x = 7; return 0; }' > try.c
9831set try
9832if eval $compile; then
9833 val="$define"
9834 echo "You have long long."
9835else
9836 val="$undef"
9837 echo "You do not have long long."
9838fi
9839$rm try.*
9840set d_longlong
9841eval $setvar
9842
9843: check for length of long long
9844case "${d_longlong}${longlongsize}" in
9845$define)
9846 echo " "
9847 echo "Checking to see how big your long longs are..." >&4
9848 $cat >try.c <<'EOCP'
9849#include <stdio.h>
9850int main()
9851{
9852 printf("%d\n", (int)sizeof(long long));
9853 return(0);
9854}
9855EOCP
9856 set try
9857 if eval $compile_ok; then
9858 longlongsize=`./try$exe_ext`
9859 echo "Your long longs are $longlongsize bytes long."
9860 else
9861 dflt='8'
9862 echo " "
9863 echo "(I can't seem to compile the test program. Guessing...)"
9864 rp="What is the size of a long long (in bytes)?"
9865 . ./myread
9866 longlongsize="$ans"
9867 fi
9868 if $test "X$longsize" = "X$longlongsize"; then
9869 echo "(That isn't any different from an ordinary long.)"
9870 fi
9871 ;;
9872esac
9873$rm -f try.* try
9874
9875: see if prototype for lseek is available
9876echo " "
9877set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9878eval $hasproto
9879
9880: see if lstat exists
9881set lstat d_lstat
9882eval $inlibc
9883
9884: see if madvise exists
9885set madvise d_madvise
9886eval $inlibc
9887
9888: see if mblen exists
9889set mblen d_mblen
9890eval $inlibc
9891
9892: see if mbstowcs exists
9893set mbstowcs d_mbstowcs
9894eval $inlibc
9895
9896: see if mbtowc exists
9897set mbtowc d_mbtowc
9898eval $inlibc
9899
9900: see if memchr exists
9901set memchr d_memchr
9902eval $inlibc
9903
9904: see if memcmp exists
9905set memcmp d_memcmp
9906eval $inlibc
9907
9908: see if memcpy exists
9909set memcpy d_memcpy
9910eval $inlibc
9911
9912: see if memmove exists
9913set memmove d_memmove
9914eval $inlibc
9915
9916: see if memset exists
9917set memset d_memset
9918eval $inlibc
9919
9920: see if mkdir exists
9921set mkdir d_mkdir
9922eval $inlibc
9923
9924: see if mkdtemp exists
9925set mkdtemp d_mkdtemp
9926eval $inlibc
9927
9928: see if mkfifo exists
9929set mkfifo d_mkfifo
9930eval $inlibc
9931
9932: see if mkstemp exists
9933set mkstemp d_mkstemp
9934eval $inlibc
9935
9936: see if mkstemps exists
9937set mkstemps d_mkstemps
9938eval $inlibc
9939
9940: see if mktime exists
9941set mktime d_mktime
9942eval $inlibc
9943
9944: see if this is a sys/mman.h system
9945set sys/mman.h i_sysmman
9946eval $inhdr
9947
9948: see if mmap exists
9949set mmap d_mmap
9950eval $inlibc
9951: see what shmat returns
9952: default to something harmless
9953mmaptype='void *'
9954case "$i_sysmman$d_mmap" in
9955"$define$define")
9956 $cat >mmap.c <<'END'
9957#include <sys/mman.h>
9958void *mmap();
9959END
9960 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9961 mmaptype='void *'
9962 else
9963 mmaptype='caddr_t'
9964 fi
9965 echo "and it returns ($mmaptype)." >&4
9966 ;;
9967esac
9968
9969
9970
9971: see if modfl exists
9972set modfl d_modfl
9973eval $inlibc
9974
9975: see if mprotect exists
9976set mprotect d_mprotect
9977eval $inlibc
9978
9979: see if msgctl exists
9980set msgctl d_msgctl
9981eval $inlibc
9982
9983: see if msgget exists
9984set msgget d_msgget
9985eval $inlibc
9986
9987: see if msgsnd exists
9988set msgsnd d_msgsnd
9989eval $inlibc
9990
9991: see if msgrcv exists
9992set msgrcv d_msgrcv
9993eval $inlibc
9994
9995: see how much of the 'msg*(2)' library is present.
9996h_msg=true
9997echo " "
9998case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9999*"$undef"*) h_msg=false;;
10000esac
10001case "$osname" in
10002freebsd)
10003 case "`ipcs 2>&1`" in
10004 "SVID messages"*"not configured"*)
10005 echo "Your $osname does not have the msg*(2) configured." >&4
10006 h_msg=false
10007 val="$undef"
10008 set msgctl d_msgctl
10009 eval $setvar
10010 set msgget d_msgget
10011 eval $setvar
10012 set msgsnd d_msgsnd
10013 eval $setvar
10014 set msgrcv d_msgrcv
10015 eval $setvar
10016 ;;
10017 esac
10018 ;;
10019esac
10020: we could also check for sys/ipc.h ...
10021if $h_msg && $test `./findhdr sys/msg.h`; then
10022 echo "You have the full msg*(2) library." >&4
10023 val="$define"
10024else
10025 echo "You don't have the full msg*(2) library." >&4
10026 val="$undef"
10027fi
10028set d_msg
10029eval $setvar
10030
10031: see if msync exists
10032set msync d_msync
10033eval $inlibc
10034
10035: see if munmap exists
10036set munmap d_munmap
10037eval $inlibc
10038
10039: see if nice exists
10040set nice d_nice
10041eval $inlibc
10042
10043
10044echo " "
10045echo "Checking which 64-bit integer type we could use..." >&4
10046
10047case "$intsize" in
100488) val=int
10049 set quadtype
10050 eval $setvar
10051 val='"unsigned int"'
10052 set uquadtype
10053 eval $setvar
10054 quadkind=1
10055 ;;
10056*) case "$longsize" in
10057 8) val=long
10058 set quadtype
10059 eval $setvar
10060 val='"unsigned long"'
10061 set uquadtype
10062 eval $setvar
10063 quadkind=2
10064 ;;
10065 *) case "$d_longlong:$longlongsize" in
10066 define:8)
10067 val='"long long"'
10068 set quadtype
10069 eval $setvar
10070 val='"unsigned long long"'
10071 set uquadtype
10072 eval $setvar
10073 quadkind=3
10074 ;;
10075 *) case "$d_int64_t" in
10076 define)
10077 val=int64_t
10078 set quadtype
10079 eval $setvar
10080 val=uint64_t
10081 set uquadtype
10082 eval $setvar
10083 quadkind=4
10084 ;;
10085 esac
10086 ;;
10087 esac
10088 ;;
10089 esac
10090 ;;
10091esac
10092
10093case "$quadtype" in
10094'') echo "Alas, no 64-bit integer types in sight." >&4
10095 d_quad="$undef"
10096 ;;
10097*) if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10098 verb="will"
10099 else
10100 verb="could"
10101 fi
10102 echo "We $verb use '$quadtype' for 64-bit integers." >&4
10103 d_quad="$define"
10104 ;;
10105esac
10106
10107: check for length of character
10108echo " "
10109case "$charsize" in
10110'')
10111 echo "Checking to see how big your characters are (hey, you never know)..." >&4
10112 $cat >try.c <<'EOCP'
10113#include <stdio.h>
10114int main()
10115{
10116 printf("%d\n", (int)sizeof(char));
10117 exit(0);
10118}
10119EOCP
10120 set try
10121 if eval $compile_ok; then
10122 dflt=`./try`
10123 else
10124 dflt='1'
10125 echo "(I can't seem to compile the test program. Guessing...)"
10126 fi
10127 ;;
10128*)
10129 dflt="$charsize"
10130 ;;
10131esac
10132rp="What is the size of a character (in bytes)?"
10133. ./myread
10134charsize="$ans"
10135$rm -f try.c try
10136
1d1be0dc
NC
10137: check for volatile keyword
10138echo " "
10139echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10140$cat >try.c <<'EOCP'
10141int main()
10142{
10143 typedef struct _goo_struct goo_struct;
10144 goo_struct * volatile goo = ((goo_struct *)0);
10145 struct _goo_struct {
10146 long long_int;
10147 int reg_int;
10148 char char_var;
10149 };
10150 typedef unsigned short foo_t;
10151 char *volatile foo;
10152 volatile int bar;
10153 volatile foo_t blech;
10154 foo = foo;
10155}
10156EOCP
10157if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10158 val="$define"
10159 echo "Yup, it does."
10160else
10161 val="$undef"
10162 echo "Nope, it doesn't."
10163fi
10164set d_volatile
10165eval $setvar
10166$rm -f try.*
10167
b4eb6b3d
JH
10168
10169echo " "
10170$echo "Choosing the C types to be used for Perl's internal types..." >&4
10171
10172case "$use64bitint:$d_quad:$quadtype" in
10173define:define:?*)
10174 ivtype="$quadtype"
10175 uvtype="$uquadtype"
10176 ivsize=8
10177 uvsize=8
10178 ;;
10179*) ivtype="long"
10180 uvtype="unsigned long"
10181 ivsize=$longsize
10182 uvsize=$longsize
10183 ;;
10184esac
10185
10186case "$uselongdouble:$d_longdbl" in
10187define:define)
10188 nvtype="long double"
10189 nvsize=$longdblsize
10190 ;;
10191*) nvtype=double
10192 nvsize=$doublesize
10193 ;;
10194esac
10195
10196$echo "(IV will be "$ivtype", $ivsize bytes)"
10197$echo "(UV will be "$uvtype", $uvsize bytes)"
10198$echo "(NV will be "$nvtype", $nvsize bytes)"
10199
10200$cat >try.c <<EOCP
10201#$i_inttypes I_INTTYPES
10202#ifdef I_INTTYPES
10203#include <inttypes.h>
10204#endif
10205#include <stdio.h>
10206int main() {
10207#ifdef INT8
10208 int8_t i = INT8_MAX;
10209 uint8_t u = UINT8_MAX;
10210 printf("int8_t\n");
10211#endif
10212#ifdef INT16
10213 int16_t i = INT16_MAX;
10214 uint16_t i = UINT16_MAX;
10215 printf("int16_t\n");
10216#endif
10217#ifdef INT32
10218 int32_t i = INT32_MAX;
10219 uint32_t u = UINT32_MAX;
10220 printf("int32_t\n");
10221#endif
10222}
10223EOCP
10224
10225case "$i8type" in
10226'') case "$charsize" in
10227 1) i8type=char
10228 u8type="unsigned char"
10229 i8size=$charsize
10230 u8size=$charsize
10231 ;;
10232 esac
10233 ;;
10234esac
10235case "$i8type" in
10236'') set try -DINT8
10237 if eval $compile; then
10238 case "`./try$exe_ext`" in
10239 int8_t) i8type=int8_t
10240 u8type=uint8_t
10241 i8size=1
10242 u8size=1
10243 ;;
10244 esac
10245 fi
10246 ;;
10247esac
10248case "$i8type" in
10249'') if $test $charsize -ge 1; then
10250 i8type=char
10251 u8type="unsigned char"
10252 i8size=$charsize
10253 u8size=$charsize
10254 fi
10255 ;;
10256esac
10257
10258case "$i16type" in
10259'') case "$shortsize" in
10260 2) i16type=short
10261 u16type="unsigned short"
10262 i16size=$shortsize
10263 u16size=$shortsize
10264 ;;
10265 esac
10266 ;;
10267esac
10268case "$i16type" in
10269'') set try -DINT16
10270 if eval $compile; then
10271 case "`./try$exe_ext`" in
10272 int16_t)
10273 i16type=int16_t
10274 u16type=uint16_t
10275 i16size=2
10276 u16size=2
10277 ;;
10278 esac
10279 fi
10280 ;;
10281esac
10282case "$i16type" in
10283'') if $test $shortsize -ge 2; then
10284 i16type=short
10285 u16type="unsigned short"
10286 i16size=$shortsize
10287 u16size=$shortsize
10288 fi
10289 ;;
10290esac
10291
10292case "$i32type" in
10293'') case "$longsize" in
10294 4) i32type=long
10295 u32type="unsigned long"
10296 i32size=$longsize
10297 u32size=$longsize
10298 ;;
10299 *) case "$intsize" in
10300 4) i32type=int
10301 u32type="unsigned int"
10302 i32size=$intsize
10303 u32size=$intsize
10304 ;;
10305 esac
10306 ;;
10307 esac
10308 ;;
10309esac
10310case "$i32type" in
10311'') set try -DINT32
10312 if eval $compile; then
10313 case "`./try$exe_ext`" in
10314 int32_t)
10315 i32type=int32_t
10316 u32type=uint32_t
10317 i32size=4
10318 u32size=4
10319 ;;
10320 esac
10321 fi
10322 ;;
10323esac
10324case "$i32type" in
10325'') if $test $intsize -ge 4; then
10326 i32type=int
10327 u32type="unsigned int"
10328 i32size=$intsize
10329 u32size=$intsize
10330 fi
10331 ;;
10332esac
10333
10334case "$i64type" in
10335'') case "$d_quad:$quadtype" in
10336 define:?*)
10337 i64type="$quadtype"
10338 u64type="$uquadtype"
10339 i64size=8
10340 u64size=8
10341 ;;
10342 esac
10343 ;;
10344esac
10345
1d1be0dc
NC
10346$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10347: volatile so that the compiler has to store it out to memory.
10348if test X"$d_volatile" = X"$define"; then
10349 volatile=volatile
10350fi
b4eb6b3d
JH
10351$cat <<EOP >try.c
10352#include <stdio.h>
1d1be0dc
NC
10353#include <sys/types.h>
10354#include <signal.h>
10355#ifdef SIGFPE
10356$volatile int bletched = 0;
10357$signal_t blech(s) int s; { bletched = 1; }
10358#endif
b4eb6b3d
JH
10359int main() {
10360 $uvtype u = 0;
1d1be0dc 10361 $nvtype d;
b4eb6b3d
JH
10362 int n = 8 * $uvsize;
10363 int i;
1d1be0dc
NC
10364#ifdef SIGFPE
10365 signal(SIGFPE, blech);
10366#endif
10367
b4eb6b3d
JH
10368 for (i = 0; i < n; i++) {
10369 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
10370 d = ($nvtype)u;
10371 if (($uvtype)d != u)
b4eb6b3d 10372 break;
1d1be0dc
NC
10373 if (d <= 0)
10374 break;
10375 d = ($nvtype)(u - 1);
10376 if (($uvtype)d != (u - 1))
10377 break;
10378#ifdef SIGFPE
10379 if (bletched) {
10380 break;
10381#endif
10382 }
b4eb6b3d 10383 }
efd1522b 10384 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
10385 exit(0);
10386}
10387EOP
1d1be0dc
NC
10388set try
10389
10390d_nv_preserves_uv="$undef"
10391if eval $compile; then
10392 d_nv_preserves_uv_bits="`./try$exe_ext`"
10393fi
10394case "$d_nv_preserves_uv_bits" in
10395\-[1-9]*)
10396 d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10397 $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs." 2>&1
10398 d_nv_preserves_uv="$define"
b4eb6b3d 10399 ;;
1d1be0dc
NC
10400[1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs." 2>&1
10401 d_nv_preserves_uv="$undef" ;;
10402*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
10403 d_nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
10404esac
10405
1d1be0dc
NC
10406$rm -f try.* try
10407
b4eb6b3d
JH
10408
10409: check for off64_t
10410echo " "
10411echo "Checking to see if you have off64_t..." >&4
10412$cat >try.c <<EOCP
10413#include <sys/types.h>
10414#include <unistd.h>
10415int main() { off64_t x = 7; }
10416EOCP
10417set try
10418if eval $compile; then
10419 val="$define"
10420 echo "You have off64_t."
10421else
10422 val="$undef"
10423 echo "You do not have off64_t."
10424 case "$lseeksize" in
10425 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10426 esac
10427fi
10428$rm -f try.* try
10429set d_off64_t
10430eval $setvar
10431
10432: see if POSIX threads are available
10433set pthread.h i_pthread
10434eval $inhdr
10435
10436
10437
10438
10439: how to create joinable pthreads
10440if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10441 echo " "
10442 echo "Checking what constant to use for creating joinable pthreads..." >&4
10443 $cat >try.c <<'EOCP'
10444#include <pthread.h>
10445int main() {
10446 int detachstate = JOINABLE;
10447}
10448EOCP
10449 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10450 if eval $compile; then
10451 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10452 val="$undef" # Yes, undef.
10453 set d_old_pthread_create_joinable
10454 eval $setvar
10455 val=""
10456 set old_pthread_create_joinable
10457 eval $setvar
10458 else
10459 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10460 if eval $compile; then
10461 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10462 val="$define"
10463 set d_old_pthread_create_joinable
10464 eval $setvar
10465 val=PTHREAD_CREATE_UNDETACHED
10466 set old_pthread_create_joinable
10467 eval $setvar
10468 else
10469 set try -DJOINABLE=__UNDETACHED
10470 if eval $compile; then
10471 echo "You seem to use __UNDETACHED." >&4
10472 val="$define"
10473 set d_old_pthread_create_joinable
10474 eval $setvar
10475 val=__UNDETACHED
10476 set old_pthread_create_joinable
10477 eval $setvar
10478 else
10479 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
10480 val="$define"
10481 set d_old_pthread_create_joinable
10482 eval $setvar
10483 val=0
10484 set old_pthread_create_joinable
10485 eval $setvar
10486 fi
10487 fi
10488 fi
10489 $rm -f try try.*
10490else
10491 d_old_pthread_create_joinable="$undef"
10492 old_pthread_create_joinable=""
10493fi
10494
10495: see if pause exists
10496set pause d_pause
10497eval $inlibc
10498
10499: see if pipe exists
10500set pipe d_pipe
10501eval $inlibc
10502
10503: see if poll exists
10504set poll d_poll
10505eval $inlibc
10506
10507
10508: see whether the various POSIXish _yields exist
10509$cat >try.c <<EOP
10510#include <pthread.h>
10511#include <stdio.h>
10512int main() {
10513#ifdef SCHED_YIELD
10514 sched_yield();
10515#else
10516#ifdef PTHREAD_YIELD
10517 pthread_yield();
10518#else
10519#ifdef PTHREAD_YIELD_NULL
10520 pthread_yield(NULL);
10521#endif
10522#endif
10523#endif
10524}
10525EOP
10526: see if sched_yield exists
10527set try -DSCHED_YIELD
10528if eval $compile; then
10529 val="$define"
10530 sched_yield='sched_yield()'
10531else
10532 val="$undef"
10533fi
10534case "$usethreads" in
10535$define)
10536 case "$val" in
10537 $define) echo 'sched_yield() found.' >&4 ;;
10538 *) echo 'sched_yield() NOT found.' >&4 ;;
10539 esac
10540esac
10541set d_sched_yield
10542eval $setvar
10543
10544: see if pthread_yield exists
10545set try -DPTHREAD_YIELD
10546if eval $compile; then
10547 val="$define"
10548 case "$sched_yield" in
10549 '') sched_yield='pthread_yield()' ;;
10550 esac
10551else
10552 set try -DPTHREAD_YIELD_NULL
10553 if eval $compile; then
10554 val="$define"
10555 case "$sched_yield" in
10556 '') sched_yield='pthread_yield(NULL)' ;;
10557 esac
10558 else
10559 val="$undef"
10560 fi
10561fi
10562case "$usethreads" in
10563$define)
10564 case "$val" in
10565 $define) echo 'pthread_yield() found.' >&4 ;;
10566 *) echo 'pthread_yield() NOT found.' >&4 ;;
10567 esac
10568 ;;
10569esac
10570set d_pthread_yield
10571eval $setvar
10572
10573case "$sched_yield" in
10574'') sched_yield=undef ;;
10575esac
10576
10577$rm -f try try.*
10578
10579: see if this is a pwd.h system
10580set pwd.h i_pwd
10581eval $inhdr
10582
10583case "$i_pwd" in
10584$define)
10585 xxx=`./findhdr pwd.h`
10586 $cppstdin $cppflags $cppminus < $xxx >$$.h
10587
10588 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10589 val="$define"
10590 else
10591 val="$undef"
10592 fi
10593 set d_pwquota
10594 eval $setvar
10595
10596 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10597 val="$define"
10598 else
10599 val="$undef"
10600 fi
10601 set d_pwage
10602 eval $setvar
10603
10604 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10605 val="$define"
10606 else
10607 val="$undef"
10608 fi
10609 set d_pwchange
10610 eval $setvar
10611
10612 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10613 val="$define"
10614 else
10615 val="$undef"
10616 fi
10617 set d_pwclass
10618 eval $setvar
10619
10620 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10621 val="$define"
10622 else
10623 val="$undef"
10624 fi
10625 set d_pwexpire
10626 eval $setvar
10627
10628 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10629 val="$define"
10630 else
10631 val="$undef"
10632 fi
10633 set d_pwcomment
10634 eval $setvar
10635
10636 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10637 val="$define"
10638 else
10639 val="$undef"
10640 fi
10641 set d_pwgecos
10642 eval $setvar
10643
10644 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10645 val="$define"
10646 else
10647 val="$undef"
10648 fi
10649 set d_pwpasswd
10650 eval $setvar
10651
10652 $rm -f $$.h
10653 ;;
10654*)
10655 val="$undef";
10656 set d_pwquota; eval $setvar
10657 set d_pwage; eval $setvar
10658 set d_pwchange; eval $setvar
10659 set d_pwclass; eval $setvar
10660 set d_pwexpire; eval $setvar
10661 set d_pwcomment; eval $setvar
10662 set d_pwgecos; eval $setvar
10663 set d_pwpasswd; eval $setvar
10664 ;;
10665esac
10666
10667: see if readdir and friends exist
10668set readdir d_readdir
10669eval $inlibc
10670set seekdir d_seekdir
10671eval $inlibc
10672set telldir d_telldir
10673eval $inlibc
10674set rewinddir d_rewinddir
10675eval $inlibc
10676
10677: see if readlink exists
10678set readlink d_readlink
10679eval $inlibc
10680
10681: see if rename exists
10682set rename d_rename
10683eval $inlibc
10684
10685: see if rmdir exists
10686set rmdir d_rmdir
10687eval $inlibc
10688
10689: see if memory.h is available.
10690val=''
10691set memory.h val
10692eval $inhdr
10693
10694: See if it conflicts with string.h
10695case "$val" in
10696$define)
10697 case "$strings" in
10698 '') ;;
10699 *)
10700 $cppstdin $cppflags $cppminus < $strings > mem.h
10701 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10702 echo " "
10703 echo "We won't be including <memory.h>."
10704 val="$undef"
10705 fi
10706 $rm -f mem.h
10707 ;;
10708 esac
10709esac
10710set i_memory
10711eval $setvar
10712
10713: can bcopy handle overlapping blocks?
10714val="$undef"
10715case "$d_bcopy" in
10716"$define")
10717 echo " "
10718 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10719 $cat >try.c <<EOCP
10720#$i_memory I_MEMORY
10721#$i_stdlib I_STDLIB
10722#$i_string I_STRING
10723#$i_unistd I_UNISTD
10724EOCP
10725 $cat >>try.c <<'EOCP'
10726#include <stdio.h>
10727#ifdef I_MEMORY
10728# include <memory.h>
10729#endif
10730#ifdef I_STDLIB
10731# include <stdlib.h>
10732#endif
10733#ifdef I_STRING
10734# include <string.h>
10735#else
10736# include <strings.h>
10737#endif
10738#ifdef I_UNISTD
10739# include <unistd.h> /* Needed for NetBSD */
10740#endif
10741int main()
10742{
10743char buf[128], abc[128];
10744char *b;
10745int len;
10746int off;
10747int align;
10748
10749bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10750
10751for (align = 7; align >= 0; align--) {
10752 for (len = 36; len; len--) {
10753 b = buf+align;
10754 bcopy(abc, b, len);
10755 for (off = 1; off <= len; off++) {
10756 bcopy(b, b+off, len);
10757 bcopy(b+off, b, len);
10758 if (bcmp(b, abc, len))
10759 exit(1);
10760 }
10761 }
10762}
10763exit(0);
10764}
10765EOCP
10766 set try
10767 if eval $compile_ok; then
10768 if ./try 2>/dev/null; then
10769 echo "Yes, it can."
10770 val="$define"
10771 else
10772 echo "It can't, sorry."
10773 case "$d_memmove" in
10774 "$define") echo "But that's Ok since you have memmove()." ;;
10775 esac
10776 fi
10777 else
10778 echo "(I can't compile the test program, so we'll assume not...)"
10779 case "$d_memmove" in
10780 "$define") echo "But that's Ok since you have memmove()." ;;
10781 esac
10782 fi
10783 ;;
10784esac
10785$rm -f try.* try core
10786set d_safebcpy
10787eval $setvar
10788
10789: can memcpy handle overlapping blocks?
10790val="$undef"
10791case "$d_memcpy" in
10792"$define")
10793 echo " "
10794 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10795 $cat >try.c <<EOCP
10796#$i_memory I_MEMORY
10797#$i_stdlib I_STDLIB
10798#$i_string I_STRING
10799#$i_unistd I_UNISTD
10800EOCP
10801 $cat >>try.c <<'EOCP'
10802#include <stdio.h>
10803#ifdef I_MEMORY
10804# include <memory.h>
10805#endif
10806#ifdef I_STDLIB
10807# include <stdlib.h>
10808#endif
10809#ifdef I_STRING
10810# include <string.h>
10811#else
10812# include <strings.h>
10813#endif
10814#ifdef I_UNISTD
10815# include <unistd.h> /* Needed for NetBSD */
10816#endif
10817int main()
10818{
10819char buf[128], abc[128];
10820char *b;
10821int len;
10822int off;
10823int align;
10824
10825/* Copy "abcde..." string to char abc[] so that gcc doesn't
10826 try to store the string in read-only memory. */
10827memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10828
10829for (align = 7; align >= 0; align--) {
10830 for (len = 36; len; len--) {
10831 b = buf+align;
10832 memcpy(b, abc, len);
10833 for (off = 1; off <= len; off++) {
10834 memcpy(b+off, b, len);
10835 memcpy(b, b+off, len);
10836 if (memcmp(b, abc, len))
10837 exit(1);
10838 }
10839 }
10840}
10841exit(0);
10842}
10843EOCP
10844 set try
10845 if eval $compile_ok; then
10846 if ./try 2>/dev/null; then
10847 echo "Yes, it can."
10848 val="$define"
10849 else
10850 echo "It can't, sorry."
10851 case "$d_memmove" in
10852 "$define") echo "But that's Ok since you have memmove()." ;;
10853 esac
10854 fi
10855 else
10856 echo "(I can't compile the test program, so we'll assume not...)"
10857 case "$d_memmove" in
10858 "$define") echo "But that's Ok since you have memmove()." ;;
10859 esac
10860 fi
10861 ;;
10862esac
10863$rm -f try.* try core
10864set d_safemcpy
10865eval $setvar
10866
10867: can memcmp be trusted to compare relative magnitude?
10868val="$undef"
10869case "$d_memcmp" in
10870"$define")
10871 echo " "
10872 echo "Checking if your memcmp() can compare relative magnitude..." >&4
10873 $cat >try.c <<EOCP
10874#$i_memory I_MEMORY
10875#$i_stdlib I_STDLIB
10876#$i_string I_STRING
10877#$i_unistd I_UNISTD
10878EOCP
10879 $cat >>try.c <<'EOCP'
10880#include <stdio.h>
10881#ifdef I_MEMORY
10882# include <memory.h>
10883#endif
10884#ifdef I_STDLIB
10885# include <stdlib.h>
10886#endif
10887#ifdef I_STRING
10888# include <string.h>
10889#else
10890# include <strings.h>
10891#endif
10892#ifdef I_UNISTD
10893# include <unistd.h> /* Needed for NetBSD */
10894#endif
10895int main()
10896{
10897char a = -1;
10898char b = 0;
10899if ((a < b) && memcmp(&a, &b, 1) < 0)
10900 exit(1);
10901exit(0);
10902}
10903EOCP
10904 set try
10905 if eval $compile_ok; then
10906 if ./try 2>/dev/null; then
10907 echo "Yes, it can."
10908 val="$define"
10909 else
10910 echo "No, it can't (it uses signed chars)."
10911 fi
10912 else
10913 echo "(I can't compile the test program, so we'll assume not...)"
10914 fi
10915 ;;
10916esac
10917$rm -f try.* try core
10918set d_sanemcmp
10919eval $setvar
10920
ef9f17be
JH
10921: see if prototype for sbrk is available
10922echo " "
10923set d_sbrkproto sbrk $i_unistd unistd.h
10924eval $hasproto
10925
b4eb6b3d
JH
10926: see if select exists
10927set select d_select
10928eval $inlibc
10929
10930: see if semctl exists
10931set semctl d_semctl
10932eval $inlibc
10933
10934: see if semget exists
10935set semget d_semget
10936eval $inlibc
10937
10938: see if semop exists
10939set semop d_semop
10940eval $inlibc
10941
10942: see how much of the 'sem*(2)' library is present.
10943h_sem=true
10944echo " "
10945case "$d_semctl$d_semget$d_semop" in
10946*"$undef"*) h_sem=false;;
10947esac
10948case "$osname" in
10949freebsd)
10950 case "`ipcs 2>&1`" in
10951 "SVID messages"*"not configured"*)
10952 echo "Your $osname does not have the sem*(2) configured." >&4
10953 h_sem=false
10954 val="$undef"
10955 set semctl d_semctl
10956 eval $setvar
10957 set semget d_semget
10958 eval $setvar
10959 set semop d_semop
10960 eval $setvar
10961 ;;
10962 esac
10963 ;;
10964esac
10965: we could also check for sys/ipc.h ...
10966if $h_sem && $test `./findhdr sys/sem.h`; then
10967 echo "You have the full sem*(2) library." >&4
10968 val="$define"
10969else
10970 echo "You don't have the full sem*(2) library." >&4
10971 val="$undef"
10972fi
10973set d_sem
10974eval $setvar
10975
10976: see whether sys/sem.h defines union semun
10977echo " "
10978$cat > try.c <<'END'
10979#include <sys/types.h>
10980#include <sys/ipc.h>
10981#include <sys/sem.h>
10982int main () { union semun semun; semun.buf = 0; }
10983END
10984set try
10985if eval $compile; then
10986 echo "You have union semun in <sys/sem.h>." >&4
10987 val="$define"
10988else
10989 echo "You do not have union semun in <sys/sem.h>." >&4
10990 val="$undef"
10991fi
10992$rm -f try try.c try.h
10993set d_union_semun
10994eval $setvar
10995
10996: see how to do semctl IPC_STAT
10997case "$d_sem" in
10998$define)
10999 : see whether semctl IPC_STAT can use union semun
11000 echo " "
11001 $cat > try.h <<END
11002#ifndef S_IRUSR
11003# ifdef S_IREAD
11004# define S_IRUSR S_IREAD
11005# define S_IWUSR S_IWRITE
11006# define S_IXUSR S_IEXEC
11007# else
11008# define S_IRUSR 0400
11009# define S_IWUSR 0200
11010# define S_IXUSR 0100
11011# endif
11012# define S_IRGRP (S_IRUSR>>3)
11013# define S_IWGRP (S_IWUSR>>3)
11014# define S_IXGRP (S_IXUSR>>3)
11015# define S_IROTH (S_IRUSR>>6)
11016# define S_IWOTH (S_IWUSR>>6)
11017# define S_IXOTH (S_IXUSR>>6)
11018#endif
11019#ifndef S_IRWXU
11020# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11021# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11022# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11023#endif
11024END
11025
11026 $cat > try.c <<END
11027#include <sys/types.h>
11028#include <sys/ipc.h>
11029#include <sys/sem.h>
11030#include <sys/stat.h>
11031#include <stdio.h>
11032#include <errno.h>
11033#include "try.h"
11034#ifndef errno
11035extern int errno;
11036#endif
11037#$d_union_semun HAS_UNION_SEMUN
11038int main() {
11039 union semun
11040#ifndef HAS_UNION_SEMUN
11041 {
11042 int val;
11043 struct semid_ds *buf;
11044 unsigned short *array;
11045 }
11046#endif
11047 arg;
11048 int sem, st;
11049
11050#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11051 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11052 if (sem > -1) {
11053 struct semid_ds argbuf;
11054 arg.buf = &argbuf;
11055# ifdef IPC_STAT
11056 st = semctl(sem, 0, IPC_STAT, arg);
11057 if (st == 0)
11058 printf("semun\n");
11059 else
11060# endif /* IPC_STAT */
11061 printf("semctl IPC_STAT failed: errno = %d\n", errno);
11062# ifdef IPC_RMID
11063 if (semctl(sem, 0, IPC_RMID, arg) != 0)
11064# endif /* IPC_RMID */
11065 printf("semctl IPC_RMID failed: errno = %d\n", errno);
11066 } else
11067#endif /* IPC_PRIVATE && ... */
11068 printf("semget failed: errno = %d\n", errno);
11069 return 0;
11070}
11071END
11072 val="$undef"
11073 set try
11074 if eval $compile; then
11075 xxx=`./try`
11076 case "$xxx" in
11077 semun) val="$define" ;;
11078 esac
11079 fi
11080 $rm -f try try.c
11081 set d_semctl_semun
11082 eval $setvar
11083 case "$d_semctl_semun" in
11084 $define)
11085 echo "You can use union semun for semctl IPC_STAT." >&4
11086 also='also'
11087 ;;
11088 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
11089 also=''
11090 ;;
11091 esac
11092
11093 : see whether semctl IPC_STAT can use struct semid_ds pointer
11094 $cat > try.c <<'END'
11095#include <sys/types.h>
11096#include <sys/ipc.h>
11097#include <sys/sem.h>
11098#include <sys/stat.h>
11099#include "try.h"
11100#include <stdio.h>
11101#include <errno.h>
11102#ifndef errno
11103extern int errno;
11104#endif
11105int main() {
11106 struct semid_ds arg;
11107 int sem, st;
11108
11109#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11110 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11111 if (sem > -1) {
11112# ifdef IPC_STAT
11113 st = semctl(sem, 0, IPC_STAT, &arg);
11114 if (st == 0)
11115 printf("semid_ds\n");
11116 else
11117# endif /* IPC_STAT */
11118 printf("semctl IPC_STAT failed: errno = %d\n", errno);
11119# ifdef IPC_RMID
11120 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11121# endif /* IPC_RMID */
11122 printf("semctl IPC_RMID failed: errno = %d\n", errno);
11123 } else
11124#endif /* IPC_PRIVATE && ... */
11125 printf("semget failed: errno = %d\n", errno);
11126
11127 return 0;
11128}
11129END
11130 val="$undef"
11131 set try
11132 if eval $compile; then
11133 xxx=`./try`
11134 case "$xxx" in
11135 semid_ds) val="$define" ;;
11136 esac
11137 fi
11138 $rm -f try try.c
11139 set d_semctl_semid_ds
11140 eval $setvar
11141 case "$d_semctl_semid_ds" in
11142 $define)
11143 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11144 ;;
11145 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11146 ;;
11147 esac
11148 $rm -f try.h
11149 ;;
11150*) val="$undef"
11151
11152 # We do not have the full sem*(2) library, so assume we can not
11153 # use either.
11154
11155 set d_semctl_semun
11156 eval $setvar
11157
11158 set d_semctl_semid_ds
11159 eval $setvar
11160 ;;
11161esac
11162
11163: see if setegid exists
11164set setegid d_setegid
11165eval $inlibc
11166
11167: see if seteuid exists
11168set seteuid d_seteuid
11169eval $inlibc
11170
11171: see if setgrent exists
11172set setgrent d_setgrent
11173eval $inlibc
11174
11175: see if sethostent exists
11176set sethostent d_sethent
11177eval $inlibc
11178
11179: see if setlinebuf exists
11180set setlinebuf d_setlinebuf
11181eval $inlibc
11182
11183: see if setlocale exists
11184set setlocale d_setlocale
11185eval $inlibc
11186
11187: see if setnetent exists
11188set setnetent d_setnent
11189eval $inlibc
11190
11191: see if setprotoent exists
11192set setprotoent d_setpent
11193eval $inlibc
11194
11195: see if setpgid exists
11196set setpgid d_setpgid
11197eval $inlibc
11198
11199: see if setpgrp2 exists
11200set setpgrp2 d_setpgrp2
11201eval $inlibc
11202
11203: see if setpriority exists
11204set setpriority d_setprior
11205eval $inlibc
11206
11207: see if setproctitle exists
11208set setproctitle d_setproctitle
11209eval $inlibc
11210
11211: see if setpwent exists
11212set setpwent d_setpwent
11213eval $inlibc
11214
11215: see if setregid exists
11216set setregid d_setregid
11217eval $inlibc
11218set setresgid d_setresgid
11219eval $inlibc
11220
11221: see if setreuid exists
11222set setreuid d_setreuid
11223eval $inlibc
11224set setresuid d_setresuid
11225eval $inlibc
11226
11227: see if setrgid exists
11228set setrgid d_setrgid
11229eval $inlibc
11230
11231: see if setruid exists
11232set setruid d_setruid
11233eval $inlibc
11234
11235: see if setservent exists
11236set setservent d_setsent
11237eval $inlibc
11238
11239: see if setsid exists
11240set setsid d_setsid
11241eval $inlibc
11242
11243: see if setvbuf exists
11244set setvbuf d_setvbuf
11245eval $inlibc
11246
11247: see if sfio.h is available
11248set sfio.h i_sfio
11249eval $inhdr
11250
11251
11252: see if sfio library is available
11253case "$i_sfio" in
11254$define)
11255 val=''
11256 set sfreserve val
11257 eval $inlibc
11258 ;;
11259*)
11260 val="$undef"
11261 ;;
11262esac
11263: Ok, but do we want to use it.
11264case "$val" in
11265$define)
11266 case "$usesfio" in
11267 true|$define|[yY]*) dflt='y';;
11268 *) dflt='n';;
11269 esac
11270 echo "$package can use the sfio library, but it is experimental."
11271 case "$useperlio" in
11272 "$undef")
11273 echo "For sfio also the PerlIO abstraction layer is needed."
11274 echo "Earlier you said you wouldn't want that."
11275 ;;
11276 esac
11277 rp="You seem to have sfio available, do you want to try using it?"
11278 . ./myread
11279 case "$ans" in
11280 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
11281 useperlio="$define"
11282 val="$define"
11283 ;;
11284 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
11285 val="$undef"
11286 : Remove sfio from list of libraries to use
11287 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11288 shift
11289 libs="$*"
11290 echo "libs = $libs" >&4
11291 ;;
11292 esac
11293 ;;
11294*) case "$usesfio" in
11295 true|$define|[yY]*)
11296 echo "Sorry, cannot find sfio on this machine." >&4
11297 echo "Ignoring your setting of usesfio=$usesfio." >&4
11298 val="$undef"
11299 ;;
11300 esac
11301 ;;
11302esac
11303set d_sfio
11304eval $setvar
11305case "$d_sfio" in
11306$define) usesfio='true';;
11307*) usesfio='false';;
11308esac
11309
11310: see if shmctl exists
11311set shmctl d_shmctl
11312eval $inlibc
11313
11314: see if shmget exists
11315set shmget d_shmget
11316eval $inlibc
11317
11318: see if shmat exists
11319set shmat d_shmat
11320eval $inlibc
11321: see what shmat returns
11322case "$d_shmat" in
11323"$define")
11324 $cat >shmat.c <<'END'
11325#include <sys/shm.h>
11326void *shmat();
11327END
11328 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11329 shmattype='void *'
11330 else
11331 shmattype='char *'
11332 fi
11333 echo "and it returns ($shmattype)." >&4
11334 : see if a prototype for shmat is available
11335 xxx=`./findhdr sys/shm.h`
11336 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11337 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11338 val="$define"
11339 else
11340 val="$undef"
11341 fi
11342 $rm -f shmat.[co]
11343 ;;
11344*)
11345 val="$undef"
11346 ;;
11347esac
11348set d_shmatprototype
11349eval $setvar
11350
11351: see if shmdt exists
11352set shmdt d_shmdt
11353eval $inlibc
11354
11355: see how much of the 'shm*(2)' library is present.
11356h_shm=true
11357echo " "
11358case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11359*"$undef"*) h_shm=false;;
11360esac
11361case "$osname" in
11362freebsd)
11363 case "`ipcs 2>&1`" in
11364 "SVID shared memory"*"not configured"*)
11365 echo "Your $osname does not have the shm*(2) configured." >&4
11366 h_shm=false
11367 val="$undef"
11368 set shmctl d_shmctl
11369 evat $setvar
11370 set shmget d_shmget
11371 evat $setvar
11372 set shmat d_shmat
11373 evat $setvar
11374 set shmdt d_shmdt
11375 evat $setvar
11376 ;;
11377 esac
11378 ;;
11379esac
11380: we could also check for sys/ipc.h ...
11381if $h_shm && $test `./findhdr sys/shm.h`; then
11382 echo "You have the full shm*(2) library." >&4
11383 val="$define"
11384else
11385 echo "You don't have the full shm*(2) library." >&4
11386 val="$undef"
11387fi
11388set d_shm
11389eval $setvar
11390
11391echo " "
11392: see if we have sigaction
11393if set sigaction val -f d_sigaction; eval $csym; $val; then
11394 echo 'sigaction() found.' >&4
11395 $cat > try.c <<'EOP'
11396#include <stdio.h>
11397#include <sys/types.h>
11398#include <signal.h>
11399int main()
11400{
11401 struct sigaction act, oact;
11402 act.sa_flags = 0;
11403 oact.sa_handler = 0;
11404 /* so that act and oact are used */
11405 exit(act.sa_flags == 0 && oact.sa_handler == 0);
11406}
11407EOP
11408 set try
11409 if eval $compile_ok; then
11410 val="$define"
11411 else
11412 echo "But you don't seem to have a useable struct sigaction." >&4
11413 val="$undef"
11414 fi
11415else
11416 echo 'sigaction NOT found.' >&4
11417 val="$undef"
11418fi
11419set d_sigaction; eval $setvar
11420$rm -f try try$_o try.c
11421
11422: see if sigsetjmp exists
11423echo " "
11424case "$d_sigsetjmp" in
11425'')
11426 $cat >try.c <<'EOP'
11427#include <setjmp.h>
11428sigjmp_buf env;
11429int set = 1;
11430int main()
11431{
11432 if (sigsetjmp(env,1))
11433 exit(set);
11434 set = 0;
11435 siglongjmp(env, 1);
11436 exit(1);
11437}
11438EOP
11439 set try
11440 if eval $compile; then
11441 if ./try >/dev/null 2>&1; then
11442 echo "POSIX sigsetjmp found." >&4
11443 val="$define"
11444 else
11445 $cat >&4 <<EOM
11446Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11447I'll ignore them.
11448EOM
11449 val="$undef"
11450 fi
11451 else
11452 echo "sigsetjmp not found." >&4
11453 val="$undef"
11454 fi
11455 ;;
11456*) val="$d_sigsetjmp"
11457 case "$d_sigsetjmp" in
11458 $define) echo "POSIX sigsetjmp found." >&4;;
11459 $undef) echo "sigsetjmp not found." >&4;;
11460 esac
11461 ;;
11462esac
11463set d_sigsetjmp
11464eval $setvar
11465$rm -f try.c try
11466
11467: see if socks5_init exists
11468set socks5_init d_socks5_init
11469eval $inlibc
11470
11471: see if sys/stat.h is available
11472set sys/stat.h i_sysstat
11473eval $inhdr
11474
11475
11476: see if stat knows about block sizes
11477echo " "
11478echo "Checking to see if your struct stat has st_blocks field..." >&4
11479set d_statblks stat st_blocks $i_sysstat sys/stat.h
11480eval $hasfield
11481
11482
11483: see if this is a sys/vfs.h system
11484set sys/vfs.h i_sysvfs
11485eval $inhdr
11486
11487
11488: see if this is a sys/statfs.h system
11489set sys/statfs.h i_sysstatfs
11490eval $inhdr
11491
11492
11493echo " "
11494echo "Checking to see if your system supports struct statfs..." >&4
11495set 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
11496eval $hasstruct
11497case "$d_statfs_s" in
11498"$define") echo "Yes, it does." ;;
11499*) echo "No, it doesn't." ;;
11500esac
11501
11502
11503
11504: see if struct statfs knows about f_flags
11505case "$d_statfs_s" in
11506define)
11507 echo " "
11508 echo "Checking to see if your struct statfs has f_flags field..." >&4
11509 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
11510 eval $hasfield
11511 ;;
11512*) val="$undef"
11513 set d_statfs_f_flags
11514 eval $setvar
11515 ;;
11516esac
11517case "$d_statfs_f_flags" in
11518"$define") echo "Yes, it does." ;;
11519*) echo "No, it doesn't." ;;
11520esac
11521
11522: see if _ptr and _cnt from stdio act std
11523echo " "
80f36755
NC
11524
11525if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11526 echo "(Looks like you have stdio.h from BSD.)"
11527 case "$stdio_ptr" in
11528 '') stdio_ptr='((fp)->_p)'
11529 ptr_lval=$define
11530 ;;
11531 *) ptr_lval=$d_stdio_ptr_lval;;
11532 esac
11533 case "$stdio_cnt" in
11534 '') stdio_cnt='((fp)->_r)'
11535 cnt_lval=$define
11536 ;;
11537 *) cnt_lval=$d_stdio_cnt_lval;;
11538 esac
11539 case "$stdio_base" in
11540 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11541 esac
11542 case "$stdio_bufsiz" in
11543 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11544 esac
11545elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
b4eb6b3d
JH
11546 echo "(Looks like you have stdio.h from Linux.)"
11547 case "$stdio_ptr" in
11548 '') stdio_ptr='((fp)->_IO_read_ptr)'
11549 ptr_lval=$define
11550 ;;
11551 *) ptr_lval=$d_stdio_ptr_lval;;
11552 esac
11553 case "$stdio_cnt" in
11554 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11555 cnt_lval=$undef
11556 ;;
11557 *) cnt_lval=$d_stdio_cnt_lval;;
11558 esac
11559 case "$stdio_base" in
11560 '') stdio_base='((fp)->_IO_read_base)';;
11561 esac
11562 case "$stdio_bufsiz" in
11563 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11564 esac
11565else
11566 case "$stdio_ptr" in
11567 '') stdio_ptr='((fp)->_ptr)'
11568 ptr_lval=$define
11569 ;;
11570 *) ptr_lval=$d_stdio_ptr_lval;;
11571 esac
11572 case "$stdio_cnt" in
11573 '') stdio_cnt='((fp)->_cnt)'
11574 cnt_lval=$define
11575 ;;
11576 *) cnt_lval=$d_stdio_cnt_lval;;
11577 esac
11578 case "$stdio_base" in
11579 '') stdio_base='((fp)->_base)';;
11580 esac
11581 case "$stdio_bufsiz" in
11582 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11583 esac
11584fi
80f36755 11585
b4eb6b3d
JH
11586: test whether _ptr and _cnt really work
11587echo "Checking how std your stdio is..." >&4
11588$cat >try.c <<EOP
11589#include <stdio.h>
11590#define FILE_ptr(fp) $stdio_ptr
11591#define FILE_cnt(fp) $stdio_cnt
11592int main() {
11593 FILE *fp = fopen("try.c", "r");
11594 char c = getc(fp);
11595 if (
11596 18 <= FILE_cnt(fp) &&
11597 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11598 )
11599 exit(0);
11600 exit(1);
11601}
11602EOP
11603val="$undef"
11604set try
11605if eval $compile; then
11606 if ./try; then
11607 echo "Your stdio acts pretty std."
11608 val="$define"
11609 else
11610 echo "Your stdio isn't very std."
11611 fi
11612else
11613 echo "Your stdio doesn't appear very std."
11614fi
11615$rm -f try.c try
11616set d_stdstdio
11617eval $setvar
11618
11619: Can _ptr be used as an lvalue?
11620case "$d_stdstdio$ptr_lval" in
11621$define$define) val=$define ;;
11622*) val=$undef ;;
11623esac
11624set d_stdio_ptr_lval
11625eval $setvar
11626
11627: Can _cnt be used as an lvalue?
11628case "$d_stdstdio$cnt_lval" in
11629$define$define) val=$define ;;
11630*) val=$undef ;;
11631esac
11632set d_stdio_cnt_lval
11633eval $setvar
11634
a7ffa9b9
NC
11635
11636: test whether setting _ptr sets _cnt as a side effect
11637d_stdio_ptr_lval_sets_cnt="$undef"
11638d_stdio_ptr_lval_nochange_cnt="$undef"
11639case "$d_stdio_ptr_lval$d_stdstdio" in
11640$define$define)
11641 echo "Checking to see what happens if we set the stdio ptr..." >&4
11642$cat >try.c <<EOP
11643#include <stdio.h>
11644/* Can we scream? */
11645/* Eat dust sed :-) */
c1d9e6fa 11646/* In the buffer space, no one can hear you scream. */
0bbfc344
JH
11647#define FILE_ptr(fp) $stdio_ptr
11648#define FILE_cnt(fp) $stdio_cnt
c1d9e6fa 11649#include <sys/types.h>
a7ffa9b9
NC
11650int main() {
11651 FILE *fp = fopen("try.c", "r");
c1d9e6fa 11652 int c;
a7ffa9b9
NC
11653 char *ptr;
11654 size_t cnt;
c1d9e6fa
JH
11655 if (!fp) {
11656 puts("Fail even to read");
11657 exit(1);
11658 }
11659 c = getc(fp); /* Read away the first # */
11660 if (c == EOF) {
11661 puts("Fail even to read");
11662 exit(1);
11663 }
a7ffa9b9
NC
11664 if (!(
11665 18 <= FILE_cnt(fp) &&
11666 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11667 )) {
11668 puts("Fail even to read");
11669 exit (1);
11670 }
c1d9e6fa
JH
11671 ptr = (char*) FILE_ptr(fp);
11672 cnt = (size_t)FILE_cnt(fp);
a7ffa9b9 11673
c1d9e6fa 11674 FILE_ptr(fp) += 42;
a7ffa9b9 11675
c1d9e6fa 11676 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
a7ffa9b9
NC
11677 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11678 exit (1);
11679 }
11680 if (FILE_cnt(fp) <= 20) {
11681 printf ("Fail (<20 chars to test)");
11682 exit (1);
11683 }
11684 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11685 puts("Fail compare");
11686 exit (1);
11687 }
11688 if (cnt == FILE_cnt(fp)) {
11689 puts("Pass_unchanged");
11690 exit (0);
11691 }
11692 if (FILE_cnt(fp) == (cnt - 42)) {
11693 puts("Pass_changed");
11694 exit (0);
11695 }
11696 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11697 return 1;
11698
11699}
11700EOP
11701 set try
11702 if eval $compile; then
11703 case `./try$exe_ext` in
11704 Pass_changed)
2e32dcfe 11705 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
a7ffa9b9
NC
11706 d_stdio_ptr_lval_sets_cnt="$define" ;;
11707 Pass_unchanged)
11708 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
11709 d_stdio_ptr_lval_nochange_cnt="$define" ;;
11710 Fail*)
11711 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
11712 *)
11713 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11714 esac
11715 else
11716 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
11717 fi
11718 $rm -f try.c try
11719 ;;
11720esac
11721
b4eb6b3d
JH
11722: see if _base is also standard
11723val="$undef"
11724case "$d_stdstdio" in
11725$define)
11726 $cat >try.c <<EOP
11727#include <stdio.h>
11728#define FILE_base(fp) $stdio_base
11729#define FILE_bufsiz(fp) $stdio_bufsiz
11730int main() {
11731 FILE *fp = fopen("try.c", "r");
11732 char c = getc(fp);
11733 if (
11734 19 <= FILE_bufsiz(fp) &&
11735 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11736 )
11737 exit(0);
11738 exit(1);
11739}
11740EOP
11741 set try
11742 if eval $compile; then
11743 if ./try; then
11744 echo "And its _base field acts std."
11745 val="$define"
11746 else
11747 echo "But its _base field isn't std."
11748 fi
11749 else
11750 echo "However, it seems to be lacking the _base field."
11751 fi
11752 $rm -f try.c try
11753 ;;
11754esac
11755set d_stdiobase
11756eval $setvar
11757
11758$cat >&4 <<EOM
11759Checking how to access stdio streams by file descriptor number...
11760EOM
11761case "$stdio_stream_array" in
11762'') $cat >try.c <<EOCP
11763#include <stdio.h>
11764int main() {
11765 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11766 printf("yes\n");
11767}
11768EOCP
11769 for s in _iob __iob __sF
11770 do
11771 set try -DSTDIO_STREAM_ARRAY=$s
11772 if eval $compile; then
11773 case "`./try$exe_ext`" in
11774 yes) stdio_stream_array=$s; break ;;
11775 esac
11776 fi
11777 done
11778 $rm -f try.* try$exe_ext
11779esac
11780case "$stdio_stream_array" in
11781'') $cat >&4 <<EOM
11782I can't figure out how to access stdio streams by file descriptor number.
11783EOM
11784 d_stdio_stream_array="$undef"
11785 ;;
11786*) $cat >&4 <<EOM
11787You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11788EOM
11789 d_stdio_stream_array="$define"
11790 ;;
11791esac
11792
11793: see if strcoll exists
11794set strcoll d_strcoll
11795eval $inlibc
11796
11797: check for structure copying
11798echo " "
11799echo "Checking to see if your C compiler can copy structs..." >&4
11800$cat >try.c <<'EOCP'
11801int main()
11802{
11803 struct blurfl {
11804 int dyick;
11805 } foo, bar;
11806
11807 foo = bar;
11808}
11809EOCP
11810if $cc -c try.c >/dev/null 2>&1 ; then
11811 val="$define"
11812 echo "Yup, it can."
11813else
11814 val="$undef"
11815 echo "Nope, it can't."
11816fi
11817set d_strctcpy
11818eval $setvar
11819$rm -f try.*
11820
11821: see if strerror and/or sys_errlist[] exist
11822echo " "
11823if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11824 if set strerror val -f d_strerror; eval $csym; $val; then
11825 echo 'strerror() found.' >&4
11826 d_strerror="$define"
11827 d_strerrm='strerror(e)'
11828 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11829 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
11830 d_syserrlst="$define"
11831 else
11832 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11833 d_syserrlst="$undef"
11834 fi
11835 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11836 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11837 echo 'strerror() found in string header.' >&4
11838 d_strerror="$define"
11839 d_strerrm='strerror(e)'
11840 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11841 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11842 d_syserrlst="$define"
11843 else
11844 echo "(You don't appear to have any sys_errlist[], how can this be?)"
11845 d_syserrlst="$undef"
11846 fi
11847 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11848 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11849 d_strerror="$undef"
11850 d_syserrlst="$define"
11851 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11852 else
11853 echo 'strerror() and sys_errlist[] NOT found.' >&4
11854 d_strerror="$undef"
11855 d_syserrlst="$undef"
11856 d_strerrm='"unknown"'
11857 fi
11858fi
11859
11860: see if strtod exists
11861set strtod d_strtod
11862eval $inlibc
11863
11864: see if strtol exists
11865set strtol d_strtol
11866eval $inlibc
11867
11868: see if strtold exists
11869set strtold d_strtold
11870eval $inlibc
11871
11872: see if strtoll exists
11873set strtoll d_strtoll
11874eval $inlibc
11875
11876case "$d_longlong-$d_strtoll" in
11877"$define-$define")
11878 $cat <<EOM
11879Checking whether your strtoll() works okay...
11880EOM
11881 $cat >try.c <<'EOCP'
11882#include <errno.h>
11883#ifdef __hpux
11884#define strtoll __strtoll
11885#endif
e75931a7
YST
11886#ifdef __EMX__
11887#define strtoll _strtoll
11888#endif
b4eb6b3d
JH
11889#include <stdio.h>
11890extern long long int strtoll(char *s, char **, int);
11891static int bad = 0;
11892int check(char *s, long long ell, int een) {
11893 long long gll;
11894 errno = 0;
11895 gll = strtoll(s, 0, 10);
11896 if (!((gll == ell) && (errno == een)))
11897 bad++;
11898}
11899int main() {
11900 check(" 1", 1LL, 0);
11901 check(" 0", 0LL, 0);
11902 check("-1", -1LL, 0);
11903 check("-9223372036854775808", -9223372036854775808LL, 0);
11904 check("-9223372036854775808", -9223372036854775808LL, 0);
11905 check(" 9223372036854775807", 9223372036854775807LL, 0);
11906 check("-9223372036854775808", -9223372036854775808LL, 0);
11907 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
11908 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11909 if (!bad)
11910 printf("ok\n");
11911}
11912EOCP
11913 set try
11914 if eval $compile; then
e75931a7
YST
11915 yyy=`./try`
11916 case "$yyy" in
b4eb6b3d
JH
11917 ok) echo "Your strtoll() seems to be working okay." ;;
11918 *) cat <<EOM >&4
11919Your strtoll() doesn't seem to be working okay.
11920EOM
11921 d_strtoll="$undef"
11922 ;;
69eadf66 11923 esac
e75931a7
YST
11924 else
11925 echo "(I can't seem to compile the test program--assuming it doesn't)"
11926 d_strtoll="$undef"
b4eb6b3d
JH
11927 fi
11928 ;;
11929esac
11930
d0e6d399
NC
11931: see if strtoq exists
11932set strtoq d_strtoq
11933eval $inlibc
11934
b4eb6b3d
JH
11935: see if strtoul exists
11936set strtoul d_strtoul
11937eval $inlibc
11938
d0e6d399
NC
11939case "$d_strtoul" in
11940"$define")
11941 $cat <<EOM
11942Checking whether your strtoul() works okay...
11943EOM
11944 $cat >try.c <<'EOCP'
11945#include <errno.h>
11946#include <stdio.h>
11947extern unsigned long int strtoul(char *s, char **, int);
11948static int bad = 0;
11949void check(char *s, unsigned long eul, int een) {
11950 unsigned long gul;
11951 errno = 0;
11952 gul = strtoul(s, 0, 10);
11953 if (!((gul == eul) && (errno == een)))
11954 bad++;
11955}
11956int main() {
11957 check(" 1", 1L, 0);
11958 check(" 0", 0L, 0);
11959EOCP
11960 case "$longsize" in
11961 8)
11962 $cat >>try.c <<'EOCP'
11963 check("18446744073709551615", 18446744073709551615ULL, 0);
11964 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11965 check("-1", 18446744073709551615ULL, 0);
11966 check("-18446744073709551614", 2, 0);
11967 check("-18446744073709551615", 1, 0);
11968 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
11969 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
11970EOCP
11971 ;;
11972 4)
11973 $cat >>try.c <<'EOCP'
11974 check("4294967295", 4294967295UL, 0);
11975 check("4294967296", 4294967295UL, ERANGE);
11976 check("-1", 4294967295UL, 0);
11977 check("-4294967294", 2, 0);
11978 check("-4294967295", 1, 0);
11979 check("-4294967296", 4294967295UL, ERANGE);
11980 check("-4294967297", 4294967295UL, ERANGE);
11981EOCP
11982 ;;
11983 *)
11984: Should we write these tests to be more portable by sprintf-ing
11985: ~0 and then manipulating that char string as input for strtol?
11986 ;;
11987 esac
11988 $cat >>try.c <<'EOCP'
11989 if (!bad)
11990 printf("ok\n");
11991 return 0;
11992}
11993EOCP
11994 set try
11995 if eval $compile; then
11996 case "`./try`" in
11997 ok) echo "Your strtoul() seems to be working okay." ;;
11998 *) cat <<EOM >&4
11999Your strtoul() doesn't seem to be working okay.
12000EOM
12001 d_strtoul="$undef"
12002 ;;
12003 esac
12004 fi
12005 ;;
12006esac
12007
b4eb6b3d
JH
12008: see if strtoull exists
12009set strtoull d_strtoull
12010eval $inlibc
12011
12012case "$d_longlong-$d_strtoull" in
12013"$define-$define")
12014 $cat <<EOM
12015Checking whether your strtoull() works okay...
12016EOM
12017 $cat >try.c <<'EOCP'
12018#include <errno.h>
12019#ifdef __hpux
12020#define strtoull __strtoull
12021#endif
12022#include <stdio.h>
12023extern unsigned long long int strtoull(char *s, char **, int);
12024static int bad = 0;
12025int check(char *s, long long eull, int een) {
12026 long long gull;
12027 errno = 0;
12028 gull = strtoull(s, 0, 10);
12029 if (!((gull == eull) && (errno == een)))
12030 bad++;
12031}
12032int main() {
d0e6d399
NC
12033 check(" 1", 1LL, 0);
12034 check(" 0", 0LL, 0);
12035 check("18446744073709551615", 18446744073709551615ULL, 0);
12036 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
12037 check("-1", 18446744073709551615ULL, 0);
12038 check("-18446744073709551614", 2LL, 0);
12039 check("-18446744073709551615", 1LL, 0);
12040 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12041 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
b4eb6b3d
JH
12042 if (!bad)
12043 printf("ok\n");
12044}
12045EOCP
12046 set try
12047 if eval $compile; then
12048 case "`./try`" in
12049 ok) echo "Your strtoull() seems to be working okay." ;;
12050 *) cat <<EOM >&4
12051Your strtoull() doesn't seem to be working okay.
12052EOM
12053 d_strtoull="$undef"
12054 ;;
12055 esac
12056 fi
12057 ;;
12058esac
12059
12060: see if strtouq exists
12061set strtouq d_strtouq
12062eval $inlibc
12063
d0e6d399
NC
12064case "$d_strtouq" in
12065"$define")
12066 $cat <<EOM
12067Checking whether your strtouq() works okay...
12068EOM
12069 $cat >try.c <<'EOCP'
12070#include <errno.h>
12071#include <stdio.h>
12072extern unsigned long long int strtouq(char *s, char **, int);
12073static int bad = 0;
12074void check(char *s, unsigned long long eull, int een) {
12075 unsigned long long gull;
12076 errno = 0;
12077 gull = strtouq(s, 0, 10);
12078 if (!((gull == eull) && (errno == een)))
12079 bad++;
12080}
12081int main() {
12082 check(" 1", 1LL, 0);
12083 check(" 0", 0LL, 0);
12084 check("18446744073709551615", 18446744073709551615ULL, 0);
12085 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
12086 check("-1", 18446744073709551615ULL, 0);
12087 check("-18446744073709551614", 2LL, 0);
12088 check("-18446744073709551615", 1LL, 0);
12089 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12090 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12091 if (!bad)
12092 printf("ok\n");
12093 return 0;
12094}
12095EOCP
12096 set try
12097 if eval $compile; then
12098 case "`./try`" in
12099 ok) echo "Your strtouq() seems to be working okay." ;;
12100 *) cat <<EOM >&4
12101Your strtouq() doesn't seem to be working okay.
12102EOM
12103 d_strtouq="$undef"
12104 ;;
12105 esac
12106 fi
12107 ;;
12108esac
12109
b4eb6b3d
JH
12110: see if strxfrm exists
12111set strxfrm d_strxfrm
12112eval $inlibc
12113
12114: see if symlink exists
12115set symlink d_symlink
12116eval $inlibc
12117
12118: see if syscall exists
12119set syscall d_syscall
12120eval $inlibc
12121
12122: see if sysconf exists
12123set sysconf d_sysconf
12124eval $inlibc
12125
12126: see if system exists
12127set system d_system
12128eval $inlibc
12129
12130: see if tcgetpgrp exists
12131set tcgetpgrp d_tcgetpgrp
12132eval $inlibc
12133
12134: see if tcsetpgrp exists
12135set tcsetpgrp d_tcsetpgrp
12136eval $inlibc
12137
12138: see if prototype for telldir is available
12139echo " "
12140set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12141eval $hasproto
12142
12143: see if this is a sys/times.h system
12144set sys/times.h i_systimes
12145eval $inhdr
12146
12147: see if times exists
12148echo " "
12149if set times val -f d_times; eval $csym; $val; then
12150 echo 'times() found.' >&4
12151 d_times="$define"
12152 inc=''
12153 case "$i_systimes" in
12154 "$define") inc='sys/times.h';;
12155 esac
12156 rp="What is the type returned by times() on this system?"
12157 set clock_t clocktype long stdio.h sys/types.h $inc
12158 eval $typedef_ask
12159else
12160 echo 'times() NOT found, hope that will do.' >&4
12161 d_times="$undef"
12162 clocktype='int'
12163fi
12164
12165: see if truncate exists
12166set truncate d_truncate
12167eval $inlibc
12168
12169: see if tzname[] exists
12170echo " "
12171if set tzname val -a d_tzname; eval $csym; $val; then
12172 val="$define"
12173 echo 'tzname[] found.' >&4
12174else
12175 val="$undef"
12176 echo 'tzname[] NOT found.' >&4
12177fi
12178set d_tzname
12179eval $setvar
12180
12181: see if umask exists
12182set umask d_umask
12183eval $inlibc
12184
12185: see if ustat exists
12186set ustat d_ustat
12187eval $inlibc
12188
12189: backward compatibility for d_hvfork
12190if test X$d_hvfork != X; then
12191 d_vfork="$d_hvfork"
12192 d_hvfork=''
12193fi
12194: see if there is a vfork
12195val=''
12196set vfork val
12197eval $inlibc
12198
12199: Ok, but do we want to use it. vfork is reportedly unreliable in
12200: perl on Solaris 2.x, and probably elsewhere.
12201case "$val" in
12202$define)
12203 echo " "
12204 case "$usevfork" in
12205 false) dflt='n';;
12206 *) dflt='y';;
12207 esac
12208 cat <<'EOM'
12209
12210Perl can only use a vfork() that doesn't suffer from strict
12211restrictions on calling functions or modifying global data in
12212the child. For example, glibc-2.1 contains such a vfork()
12213that is unsuitable. If your system provides a proper fork()
12214call, chances are that you do NOT want perl to use vfork().
12215
12216EOM
12217 rp="Do you still want to use vfork()?"
12218 . ./myread
12219 case "$ans" in
12220 y|Y) ;;
12221 *)
12222 echo "Ok, we won't use vfork()."
12223 val="$undef"
12224 ;;
12225 esac
12226 ;;
12227esac
12228set d_vfork
12229eval $setvar
12230case "$d_vfork" in
12231$define) usevfork='true';;
12232*) usevfork='false';;
12233esac
12234
12235: see if this is an sysdir system
12236set sys/dir.h i_sysdir
12237eval $inhdr
12238
12239: see if this is an sysndir system
12240set sys/ndir.h i_sysndir
12241eval $inhdr
12242
12243: see if closedir exists
12244set closedir d_closedir
12245eval $inlibc
12246
12247case "$d_closedir" in
12248"$define")
12249 echo " "
12250 echo "Checking whether closedir() returns a status..." >&4
12251 cat > closedir.c <<EOM
12252#$i_dirent I_DIRENT /**/
12253#$i_sysdir I_SYS_DIR /**/
12254#$i_sysndir I_SYS_NDIR /**/
12255#$i_systypes I_SYS_TYPES /**/
12256
12257#if defined(I_SYS_TYPES)
12258#include <sys/types.h>
12259#endif
12260#if defined(I_DIRENT)
12261#include <dirent.h>
12262#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12263#include <sys/dir.h>
12264#endif
12265#else
12266#ifdef I_SYS_NDIR
12267#include <sys/ndir.h>
12268#else
12269#ifdef I_SYS_DIR
12270#ifdef hp9000s500
12271#include <ndir.h> /* may be wrong in the future */
12272#else
12273#include <sys/dir.h>
12274#endif
12275#endif
12276#endif
12277#endif
12278int main() { return closedir(opendir(".")); }
12279EOM
12280 set closedir
12281 if eval $compile_ok; then
12282 if ./closedir > /dev/null 2>&1 ; then
12283 echo "Yes, it does."
12284 val="$undef"
12285 else
12286 echo "No, it doesn't."
12287 val="$define"
12288 fi
12289 else
12290 echo "(I can't seem to compile the test program--assuming it doesn't)"
12291 val="$define"
12292 fi
12293 ;;
12294*)
12295 val="$undef";
12296 ;;
12297esac
12298set d_void_closedir
12299eval $setvar
12300$rm -f closedir*
b4eb6b3d
JH
12301: see if there is a wait4
12302set wait4 d_wait4
12303eval $inlibc
12304
12305: see if waitpid exists
12306set waitpid d_waitpid
12307eval $inlibc
12308
12309: see if wcstombs exists
12310set wcstombs d_wcstombs
12311eval $inlibc
12312
12313: see if wctomb exists
12314set wctomb d_wctomb
12315eval $inlibc
12316
12317: preserve RCS keywords in files with variable substitution, grrr
12318Date='$Date'
12319Id='$Id'
12320Log='$Log'
12321RCSfile='$RCSfile'
12322Revision='$Revision'
12323
12324case "$crosscompile" in
12325''|[nN]*) crosscompile="$undef" ;;
12326esac
12327
12328case "$osname" in
12329next|rhapsody|darwin) multiarch="$define" ;;
12330esac
12331case "$multiarch" in
12332''|[nN]*) multiarch="$undef" ;;
12333esac
12334
12335: check for alignment requirements
12336echo " "
12337case "$crosscompile$multiarch" in
12338*$define*)
12339 $cat <<EOM
12340You seem to be either cross-compiling or doing a multiarchitecture build,
12341skipping the memory alignment check.
12342
12343EOM
12344 case "$alignbytes" in
12345 '') alignbytes=8 ;;
12346 esac
12347 ;;
12348*)
12349 case "$alignbytes" in
12350 '') echo "Checking alignment constraints..." >&4
12351 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12352 $cat >try.c <<'EOCP'
12353typedef long double NV;
12354EOCP
12355 else
12356 $cat >try.c <<'EOCP'
12357typedef double NV;
12358EOCP
12359 fi
12360 $cat >>try.c <<'EOCP'
12361#include <stdio.h>
12362struct foobar {
12363 char foo;
12364 NV bar;
12365} try_algn;
12366int main()
12367{
12368 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12369 return(0);
12370}
12371EOCP
12372 set try
12373 if eval $compile_ok; then
12374 dflt=`./try`
12375 else
12376 dflt='8'
12377 echo "(I can't seem to compile the test program...)"
12378 fi
12379 ;;
12380 *) dflt="$alignbytes"
12381 ;;
12382 esac
12383 rp="Doubles must be aligned on a how-many-byte boundary?"
12384 . ./myread
12385 alignbytes="$ans"
12386 $rm -f try.c try
12387 ;;
12388esac
12389
12390
12391: set the base revision
12392baserev=5.0
12393
12394: check for ordering of bytes in a long
12395echo " "
12396case "$crosscompile$multiarch" in
12397*$define*)
12398 $cat <<EOM
12399You seem to be either cross-compiling or doing a multiarchitecture build,
12400skipping the byteorder check.
12401
12402EOM
12403 byteorder='0xffff'
12404 ;;
12405*)
12406 case "$byteorder" in
12407 '')
12408 $cat <<'EOM'
12409In the following, larger digits indicate more significance. A big-endian
12410machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12411little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12412machines may have weird orders like 3412. A Cray will report 87654321,
12413an Alpha will report 12345678. If the test program works the default is
12414probably right.
12415I'm now running the test program...
12416EOM
12417 $cat >try.c <<'EOCP'
12418#include <stdio.h>
12419int main()
12420{
12421 int i;
12422 union {
12423 unsigned long l;
12424 char c[sizeof(long)];
12425 } u;
12426
12427 if (sizeof(long) > 4)
12428 u.l = (0x08070605L << 32) | 0x04030201L;
12429 else
12430 u.l = 0x04030201L;
12431 for (i = 0; i < sizeof(long); i++)
12432 printf("%c", u.c[i]+'0');
12433 printf("\n");
12434 exit(0);
12435}
12436EOCP
12437 xxx_prompt=y
12438 set try
12439 if eval $compile && ./try > /dev/null; then
12440 dflt=`./try`
12441 case "$dflt" in
12442 [1-4][1-4][1-4][1-4]|12345678|87654321)
12443 echo "(The test program ran ok.)"
12444 echo "byteorder=$dflt"
12445 xxx_prompt=n
12446 ;;
12447 ????|????????) echo "(The test program ran ok.)" ;;
12448 *) echo "(The test program didn't run right for some reason.)" ;;
12449 esac
12450 else
12451 dflt='4321'
12452 cat <<'EOM'
12453(I can't seem to compile the test program. Guessing big-endian...)
12454EOM
12455 fi
12456 case "$xxx_prompt" in
12457 y)
12458 rp="What is the order of bytes in a long?"
12459 . ./myread
12460 byteorder="$ans"
12461 ;;
12462 *) byteorder=$dflt
12463 ;;
12464 esac
12465 ;;
12466 esac
12467 $rm -f try.c try
12468 ;;
12469esac
12470
12471
12472: how do we catenate cpp tokens here?
12473echo " "
12474echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12475$cat >cpp_stuff.c <<'EOCP'
12476#define RCAT(a,b)a/**/b
12477#define ACAT(a,b)a ## b
12478RCAT(Rei,ser)
12479ACAT(Cir,cus)
12480EOCP
12481$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12482if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12483 echo "Oh! Smells like ANSI's been here." >&4
12484 echo "We can catify or stringify, separately or together!"
12485 cpp_stuff=42
12486elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12487 echo "Ah, yes! The good old days!" >&4
12488 echo "However, in the good old days we don't know how to stringify and"
12489 echo "catify at the same time."
12490 cpp_stuff=1
12491else
12492 $cat >&4 <<EOM
12493Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
12494to have to edit the values of CAT[2-5] in config.h...
12495EOM
12496 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12497fi
12498$rm -f cpp_stuff.*
12499
12500: see if this is a db.h system
12501set db.h i_db
12502eval $inhdr
12503
12504case "$i_db" in
12505$define)
12506 : Check db version.
12507 echo " "
12508 echo "Checking Berkeley DB version ..." >&4
12509 $cat >try.c <<EOCP
12510#$d_const HASCONST
12511#ifndef HASCONST
12512#define const
12513#endif
12514#include <sys/types.h>
12515#include <stdio.h>
12516#include <db.h>
12517int main()
12518{
12519#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12520 int Major, Minor, Patch ;
12521 unsigned long Version ;
12522 (void)db_version(&Major, &Minor, &Patch) ;
12523 printf("You have Berkeley DB Version 2 or greater\n");
12524
12525 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12526 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12527 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12528 Major, Minor, Patch) ;
12529
12530 /* check that db.h & libdb are compatible */
12531 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12532 printf("db.h and libdb are incompatible\n") ;
12533 exit(3);
12534 }
12535
12536 printf("db.h and libdb are compatible\n") ;
12537
12538 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12539 + DB_VERSION_PATCH ;
12540
12541 /* needs to be >= 2.3.4 */
12542 if (Version < 2003004) {
12543 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12544 printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12545 exit(2);
12546 }
12547
12548 exit(0);
12549#else
12550#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12551 printf("You have Berkeley DB Version 1\n");
12552 exit(0); /* DB version < 2: the coast is clear. */
12553#else
12554 exit(1); /* <db.h> not Berkeley DB? */
12555#endif
12556#endif
12557}
12558EOCP
12559 set try
12560 if eval $compile_ok && ./try; then
12561 echo 'Looks OK.' >&4
12562 else
12563 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
12564 i_db=$undef
12565 case " $libs " in
12566 *"-ldb "*)
12567 : Remove db from list of libraries to use
12568 echo "Removing unusable -ldb from library list" >&4
12569 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12570 shift
12571 libs="$*"
12572 echo "libs = $libs" >&4
12573 ;;
12574 esac
12575 fi
12576 $rm -f try.*
12577 ;;
12578esac
12579
12580case "$i_db" in
12581define)
12582 : Check the return type needed for hash
12583 echo " "
12584 echo "Checking return type needed for hash for Berkeley DB ..." >&4
12585 $cat >try.c <<EOCP
12586#$d_const HASCONST
12587#ifndef HASCONST
12588#define const
12589#endif
12590#include <sys/types.h>
12591#include <db.h>
12592
12593#ifndef DB_VERSION_MAJOR
12594u_int32_t hash_cb (ptr, size)
12595const void *ptr;
12596size_t size;
12597{
12598}
12599HASHINFO info;
12600int main()
12601{
12602 info.hash = hash_cb;
12603}
12604#endif
12605EOCP
12606 if $cc $ccflags -c try.c >try.out 2>&1 ; then
12607 if $contains warning try.out >>/dev/null 2>&1 ; then
12608 db_hashtype='int'
12609 else
12610 db_hashtype='u_int32_t'
12611 fi
12612 else
12613 : XXX Maybe we should just give up here.
12614 db_hashtype=u_int32_t
12615 $cat try.out >&4
12616 echo "Help: I can't seem to compile the db test program." >&4
12617 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12618 fi
12619 $rm -f try.*
12620 echo "Your version of Berkeley DB uses $db_hashtype for hash."
12621 ;;
12622*) db_hashtype=u_int32_t
12623 ;;
12624esac
12625case "$i_db" in
12626define)
12627 : Check the return type needed for prefix
12628 echo " "
12629 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12630 cat >try.c <<EOCP
12631#$d_const HASCONST
12632#ifndef HASCONST
12633#define const
12634#endif
12635#include <sys/types.h>
12636#include <db.h>
12637
12638#ifndef DB_VERSION_MAJOR
12639size_t prefix_cb (key1, key2)
12640const DBT *key1;
12641const DBT *key2;
12642{
12643}
12644BTREEINFO info;
12645int main()
12646{
12647 info.prefix = prefix_cb;
12648}
12649#endif
12650EOCP
12651 if $cc $ccflags -c try.c >try.out 2>&1 ; then
12652 if $contains warning try.out >>/dev/null 2>&1 ; then
12653 db_prefixtype='int'
12654 else
12655 db_prefixtype='size_t'
12656 fi
12657 else
12658 db_prefixtype='size_t'
12659 : XXX Maybe we should just give up here.
12660 $cat try.out >&4
12661 echo "Help: I can't seem to compile the db test program." >&4
12662 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12663 fi
12664 $rm -f try.*
12665 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12666 ;;
12667*) db_prefixtype='size_t'
12668 ;;
12669esac
12670
12671: check for void type
12672echo " "
12673echo "Checking to see how well your C compiler groks the void type..." >&4
12674case "$voidflags" in
12675'')
12676 $cat >try.c <<'EOCP'
12677#if TRY & 1
12678void sub() {
12679#else
12680sub() {
12681#endif
12682 extern void moo(); /* function returning void */
12683 void (*goo)(); /* ptr to func returning void */
12684#if TRY & 8
12685 void *hue; /* generic ptr */
12686#endif
12687#if TRY & 2
12688 void (*foo[10])();
12689#endif
12690
12691#if TRY & 4
12692 if(goo == moo) {
12693 exit(0);
12694 }
12695#endif
12696 exit(0);
12697}
12698int main() { sub(); }
12699EOCP
12700 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12701 voidflags=$defvoidused
12702 echo "Good. It appears to support void to the level $package wants.">&4
12703 if $contains warning .out >/dev/null 2>&1; then
12704 echo "However, you might get some warnings that look like this:"
12705 $cat .out
12706 fi
12707 else
12708echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12709 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12710 echo "It supports 1..."
12711 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12712 echo "It also supports 2..."
12713 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12714 voidflags=7
12715 echo "And it supports 4 but not 8 definitely."
12716 else
12717 echo "It doesn't support 4..."
12718 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12719 voidflags=11
12720 echo "But it supports 8."
12721 else
12722 voidflags=3
12723 echo "Neither does it support 8."
12724 fi
12725 fi
12726 else
12727 echo "It does not support 2..."
12728 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12729 voidflags=13
12730 echo "But it supports 4 and 8."
12731 else
12732 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12733 voidflags=5
12734 echo "And it supports 4 but has not heard about 8."
12735 else
12736 echo "However it supports 8 but not 4."
12737 fi
12738 fi
12739 fi
12740 else
12741 echo "There is no support at all for void."
12742 voidflags=0
12743 fi
12744 fi
12745esac
12746case "$voidflags" in
12747"$defvoidused") ;;
12748*) $cat >&4 <<'EOM'
12749 Support flag bits are:
12750 1: basic void declarations.
12751 2: arrays of pointers to functions returning void.
12752 4: operations between pointers to and addresses of void functions.
12753 8: generic void pointers.
12754EOM
12755 dflt="$voidflags";
12756 rp="Your void support flags add up to what?"
12757 . ./myread
12758 voidflags="$ans"
12759 ;;
12760esac
12761$rm -f try.* .out
12762
12763
12764: How can we generate normalized random numbers ?
12765echo " "
12766echo "Looking for a random number function..." >&4
12767case "$randfunc" in
12768'')
12769 if set drand48 val -f; eval $csym; $val; then
12770 dflt="drand48"
12771 echo "Good, found drand48()." >&4
12772 elif set random val -f; eval $csym; $val; then
12773 dflt="random"
12774 echo "OK, found random()." >&4
12775 else
12776 dflt="rand"
12777 echo "Yick, looks like I have to use rand()." >&4
12778 fi
12779 echo " "
12780 ;;
12781*)
12782 dflt="$randfunc"
12783 ;;
12784esac
12785cont=true
12786
12787case "$ccflags" in
12788*-Dmy_rand=*|*-Dmy_srand=*)
12789 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12790 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12791 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12792 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12793 ;;
12794esac
12795
12796while $test "$cont"; do
12797 rp="Use which function to generate random numbers?"
12798 . ./myread
12799 if $test "$ans" = "$dflt"; then
12800 : null
12801 else
12802 randbits=''
12803 fi
12804 randfunc="$ans"
12805 if set $ans val -f; eval $csym; $val; then
12806 cont=''
12807 else
12808 dflt=y
12809 rp="I cannot find function $ans. Use that name anyway?"
12810 . ./myread
12811 dflt=rand
12812 case "$ans" in
12813 [yY]*) cont='';;
12814 esac
12815 fi
12816 case "$cont" in
12817 '')
12818 case "$randfunc" in
12819 drand48)
12820 drand01="drand48()"
12821 seedfunc="srand48"
12822 randbits=48
12823 randseedtype=long
12824 ;;
12825 rand|random)
12826 case "$randbits" in
12827 '')
12828echo "Checking to see how many bits your $randfunc() function produces..." >&4
12829 $cat >try.c <<EOCP
12830#$i_unistd I_UNISTD
12831#$i_stdlib I_STDLIB
12832#include <stdio.h>
12833#ifdef I_UNISTD
12834# include <unistd.h>
12835#endif
12836#ifdef I_STDLIB
12837# include <stdlib.h>
12838#endif
12839int main()
12840{
12841 register int i;
12842 register unsigned long tmp;
12843 register unsigned long max = 0L;
12844
12845 for (i = 1000; i; i--) {
12846 tmp = (unsigned long) $randfunc();
12847 if (tmp > max) max = tmp;
12848 }
12849 for (i = 0; max; i++)
12850 max /= 2;
12851 printf("%d\n",i);
12852}
12853EOCP
12854 set try
12855 if eval $compile_ok; then
12856 dflt=`try`
12857 else
12858 dflt='?'
12859 echo "(I can't seem to compile the test program...)"
12860 fi
12861 ;;
12862 *)
12863 dflt="$randbits"
12864 ;;
12865 esac
12866 rp="How many bits does your $randfunc() function produce?"
12867 . ./myread
12868 randbits="$ans"
12869 $rm -f try.c try
12870 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12871 seedfunc="s$randfunc"
12872 randseedtype=unsigned
12873 ;;
12874 *)
12875 dflt="31"
12876 rp="How many bits does your $randfunc() function produce?"
12877 . ./myread
12878 randbits="$ans"
12879 seedfunc="s$randfunc"
12880 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12881 if set $seedfunc val -f; eval $csym; $val; then
12882 echo "(Using $seedfunc() to seed random generator)"
12883 else
12884 echo "(Warning: no $seedfunc() to seed random generator)"
12885 seedfunc=rand
12886 fi
12887 randseedtype=unsigned
12888 ;;
12889 esac
12890 ;;
12891 esac
12892done
12893
12894echo " "
12895echo "Determining whether or not we are on an EBCDIC system..." >&4
12896$cat >tebcdic.c <<'EOM'
12897int main()
12898{
12899 if ('M'==0xd4) return 0;
12900 return 1;
12901}
12902EOM
12903
12904val=$undef
12905set tebcdic
12906if eval $compile_ok; then
12907 if ./tebcdic; then
12908 echo "You seem to speak EBCDIC." >&4
12909 val="$define"
12910 else
12911 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
12912 fi
12913else
12914 echo "I'm unable to compile the test program." >&4
12915 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
12916fi
12917$rm -f tebcdic.c tebcdic
12918set ebcdic
12919eval $setvar
12920
12921echo " "
12922$cat >&4 <<EOM
12923Checking how to flush all pending stdio output...
12924EOM
12925# I only know how to find the first 32 possibly open files on SunOS.
12926# See also hints/sunos_4_1.sh and util.c --AD
12927case "$osname" in
12928sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12929esac
12930$cat >>try.c <<EOCP
12931#include <stdio.h>
12932#$i_unistd I_UNISTD
12933#ifdef I_UNISTD
12934# include <unistd.h>
12935#endif
12936#$d_sysconf HAS_SYSCONF
12937#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12938#ifdef HAS_STDIO_STREAM_ARRAY
12939# define STDIO_STREAM_ARRAY $stdio_stream_array
12940#endif
12941int main() {
12942 FILE* p = fopen("try.out", "w");
12943#ifdef TRY_FPUTC
12944 fputc('x', p);
12945#else
12946# ifdef TRY_FPRINTF
12947 fprintf(p, "x");
12948# endif
12949#endif
12950#ifdef TRY_FFLUSH_NULL
12951 fflush(NULL);
12952#endif
12953#ifdef TRY_FFLUSH_ALL
12954 {
12955 long open_max = -1;
12956# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12957 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12958# else
12959# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12960 open_max = sysconf(_SC_OPEN_MAX);
12961# else
12962# ifdef FOPEN_MAX
12963 open_max = FOPEN_MAX;
12964# else
12965# ifdef OPEN_MAX
12966 open_max = OPEN_MAX;
12967# else
12968# ifdef _NFILE
12969 open_max = _NFILE;
12970# endif
12971# endif
12972# endif
12973# endif
12974# endif
12975# ifdef HAS_STDIO_STREAM_ARRAY
12976 if (open_max > 0) {
12977 long i;
12978 for (i = 0; i < open_max; i++)
12979 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12980 STDIO_STREAM_ARRAY[i]._file < open_max &&
12981 STDIO_STREAM_ARRAY[i]._flag)
12982 fflush(&STDIO_STREAM_ARRAY[i]);
12983 }
12984 }
12985# endif
12986#endif
12987 _exit(42);
12988}
12989EOCP
12990: first we have to find out how _not_ to flush
12991if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12992 output=''
12993 set try -DTRY_FPUTC
12994 if eval $compile; then
12995 $rm -f try.out
12996 ./try$exe_ext 2>/dev/null
12997 if $test ! -s try.out -a "X$?" = X42; then
12998 output=-DTRY_FPUTC
12999 fi
13000 fi
13001 case "$output" in
13002 '')
13003 set try -DTRY_FPRINTF
13004 $rm -f try.out
13005 if eval $compile; then
13006 $rm -f try.out
13007 ./try$exe_ext 2>/dev/null
13008 if $test ! -s try.out -a "X$?" = X42; then
13009 output=-DTRY_FPRINTF
13010 fi
13011 fi
13012 ;;
13013 esac
13014fi
13015: check for fflush NULL behaviour
13016case "$fflushNULL" in
13017'') set try -DTRY_FFLUSH_NULL $output
13018 if eval $compile; then
13019 $rm -f try.out
13020 ./try$exe_ext 2>/dev/null
13021 code="$?"
13022 if $test -s try.out -a "X$code" = X42; then
13023 fflushNULL="`$cat try.out`"
13024 else
13025 if $test "X$code" != X42; then
13026 $cat >&4 <<EOM
13027(If this test failed, don't worry, we'll try another method shortly.)
13028EOM
13029 fi
13030 fi
13031 fi
13032 $rm -f core try.core core.try.*
13033 case "$fflushNULL" in
13034 x) $cat >&4 <<EOM
13035Your fflush(NULL) works okay for output streams.
13036Let's see if it clobbers input pipes...
13037EOM
13038# As of mid-March 2000 all versions of Solaris appear to have a stdio
13039# bug that improperly flushes the input end of pipes. So we avoid the
13040# autoflush on fork/system/exec support for now. :-(
13041$cat >tryp.c <<EOCP
13042#include <stdio.h>
13043int
13044main(int argc, char **argv)
13045{
13046 char buf[1024];
13047 int i;
13048 char *bp = buf;
13049 while (1) {
13050 while ((i = getc(stdin)) != -1
13051 && (*bp++ = i) != '\n'
13052 && bp < &buf[1024])
13053 /* DO NOTHING */ ;
13054 *bp = '\0';
13055 fprintf(stdout, "%s", buf);
13056 fflush(NULL);
13057 if (i == -1)
13058 return 0;
13059 bp = buf;
13060 }
13061}
13062EOCP
13063 fflushNULL="$define"
13064 set tryp
13065 if eval $compile; then
13066 $rm -f tryp.out
13067 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13068 if cmp tryp.c tryp.out >/dev/null 2>&1; then
13069 $cat >&4 <<EOM
13070fflush(NULL) seems to behave okay with input streams.
13071EOM
13072 fflushNULL="$define"
13073 else
13074 $cat >&4 <<EOM
13075Ouch, fflush(NULL) clobbers input pipes! We will not use it.
13076EOM
13077 fflushNULL="$undef"
13078 fi
13079 fi
13080 $rm -f core tryp.c tryp.core core.tryp.*
13081 ;;
13082 '') $cat >&4 <<EOM
13083Your fflush(NULL) isn't working (contrary to ANSI C).
13084EOM
13085 fflushNULL="$undef"
13086 ;;
13087 *) $cat >&4 <<EOM
13088Cannot figure out whether your fflush(NULL) works or not.
13089I'm assuming it doesn't (contrary to ANSI C).
13090EOM
13091 fflushNULL="$undef"
13092 ;;
13093 esac
13094 ;;
13095$define|true|[yY]*)
13096 fflushNULL="$define"
13097 ;;
13098*)
13099 fflushNULL="$undef"
13100 ;;
13101esac
13102: check explicit looping only if NULL did not work, and if the pipe
13103: bug does not show up on an explicit flush too
13104case "$fflushNULL" in
13105"$undef")
13106 $cat >tryp.c <<EOCP
13107#include <stdio.h>
13108int
13109main(int argc, char **argv)
13110{
13111 char buf[1024];
13112 int i;
13113 char *bp = buf;
13114 while (1) {
13115 while ((i = getc(stdin)) != -1
13116 && (*bp++ = i) != '\n'
13117 && bp < &buf[1024])
13118 /* DO NOTHING */ ;
13119 *bp = '\0';
13120 fprintf(stdout, "%s", buf);
13121 fflush(stdin);
13122 if (i == -1)
13123 return 0;
13124 bp = buf;
13125 }
13126}
13127EOCP
13128 set tryp
13129 if eval $compile; then
13130 $rm -f tryp.out
13131 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13132 if cmp tryp.c tryp.out >/dev/null 2>&1; then
13133 $cat >&4 <<EOM
13134Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13135EOM
13136 : now check for fflushall behaviour
13137 case "$fflushall" in
13138 '') set try -DTRY_FFLUSH_ALL $output
13139 if eval $compile; then
13140 $cat >&4 <<EOM
13141(Now testing the other method--but note that this also may fail.)
13142EOM
13143 $rm -f try.out
13144 ./try$exe_ext 2>/dev/null
13145 if $test -s try.out -a "X$?" = X42; then
13146 fflushall="`$cat try.out`"
13147 fi
13148 fi
13149 $rm -f core try.core core.try.*
13150 case "$fflushall" in
13151 x) $cat >&4 <<EOM
13152Whew. Flushing explicitly all the stdio streams works.
13153EOM
13154 fflushall="$define"
13155 ;;
13156 '') $cat >&4 <<EOM
13157Sigh. Flushing explicitly all the stdio streams doesn't work.
13158EOM
13159 fflushall="$undef"
13160 ;;
13161 *) $cat >&4 <<EOM
13162Cannot figure out whether flushing stdio streams explicitly works or not.
13163I'm assuming it doesn't.
13164EOM
13165 fflushall="$undef"
13166 ;;
13167 esac
13168 ;;
13169 "$define"|true|[yY]*)
13170 fflushall="$define"
13171 ;;
13172 *)
13173 fflushall="$undef"
13174 ;;
13175 esac
13176 else
13177 $cat >&4 <<EOM
13178All is futile. Even fflush(stdin) clobbers input pipes!
13179EOM
13180 fflushall="$undef"
13181 fi
13182 else
13183 fflushall="$undef"
13184 fi
13185 $rm -f core tryp.c tryp.core core.tryp.*
13186 ;;
13187*) fflushall="$undef"
13188 ;;
13189esac
13190
13191case "$fflushNULL$fflushall" in
13192undefundef)
13193 $cat <<EOM
13194OK, I give up. I cannot figure out how to flush pending stdio output.
13195We won't be flushing handles at all before fork/exec/popen.
13196EOM
13197 ;;
13198esac
13199$rm -f try.* try$exe_ext
13200
13201: Store the full pathname to the ar program for use in the C program
13202: Respect a hint or command line value for full_ar.
13203case "$full_ar" in
13204'') full_ar=$ar ;;
13205esac
13206
13207: Store the full pathname to the sed program for use in the C program
13208full_sed=$sed
13209
13210: see what type gids are declared as in the kernel
13211echo " "
13212echo "Looking for the type for group ids returned by getgid()."
13213set gid_t gidtype xxx stdio.h sys/types.h
13214eval $typedef
13215case "$gidtype" in
13216xxx)
13217 xxx=`./findhdr sys/user.h`
13218 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13219 case $1 in
13220 unsigned) dflt="$1 $2" ;;
13221 *) dflt="$1" ;;
13222 esac
13223 ;;
13224*) dflt="$gidtype";;
13225esac
13226case "$gidtype" in
13227gid_t) echo "gid_t found." ;;
13228*) rp="What is the type for group ids returned by getgid()?"
13229 . ./myread
13230 gidtype="$ans"
13231 ;;
13232esac
13233
13234echo " "
13235case "$gidtype" in
13236*_t) zzz="$gidtype" ;;
13237*) zzz="gid" ;;
13238esac
13239echo "Checking the size of $zzz..." >&4
13240cat > try.c <<EOCP
13241#include <sys/types.h>
13242#include <stdio.h>
13243int main() {
13244 printf("%d\n", (int)sizeof($gidtype));
13245 exit(0);
13246}
13247EOCP
13248set try
13249if eval $compile_ok; then
13250 yyy=`./try`
13251 case "$yyy" in
13252 '') gidsize=4
13253 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13254 ;;
13255 *) gidsize=$yyy
13256 echo "Your $zzz is $gidsize bytes long."
13257 ;;
13258 esac
13259else
13260 gidsize=4
13261 echo "(I can't compile the test program--guessing $gidsize.)" >&4
13262fi
13263
13264
13265echo " "
13266case "$gidtype" in
13267*_t) zzz="$gidtype" ;;
13268*) zzz="gid" ;;
13269esac
13270echo "Checking the sign of $zzz..." >&4
13271cat > try.c <<EOCP
13272#include <sys/types.h>
13273#include <stdio.h>
13274int main() {
13275 $gidtype foo = -1;
13276 if (foo < 0)
13277 printf("-1\n");
13278 else
13279 printf("1\n");
13280}
13281EOCP
13282set try
13283if eval $compile; then
13284 yyy=`./try`
13285 case "$yyy" in
13286 '') gidsign=1
13287 echo "(I can't execute the test program--guessing unsigned.)" >&4
13288 ;;
13289 *) gidsign=$yyy
13290 case "$gidsign" in
13291 1) echo "Your $zzz is unsigned." ;;
13292 -1) echo "Your $zzz is signed." ;;
13293 esac
13294 ;;
13295 esac
13296else
13297 gidsign=1
13298 echo "(I can't compile the test program--guessing unsigned.)" >&4
13299fi
13300
13301
13302echo " "
13303
13304if $test X"$quadtype" != X; then
13305
13306echo "Checking how to print 64-bit integers..." >&4
13307
13308if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13309 $cat >try.c <<'EOCP'
13310#include <sys/types.h>
13311#include <stdio.h>
13312int main() {
13313 int q = 12345678901;
13314 printf("%ld\n", q);
13315}
13316EOCP
13317 set try
13318 if eval $compile; then
13319 yyy=`./try$exe_ext`
13320 case "$yyy" in
13321 12345678901)
13322 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13323 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13324 echo "We will use %d."
13325 ;;
13326 esac
13327 fi
13328fi
13329
13330if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13331 $cat >try.c <<'EOCP'
13332#include <sys/types.h>
13333#include <stdio.h>
13334int main() {
13335 long q = 12345678901;
13336 printf("%ld\n", q);
13337}
13338EOCP
13339 set try
13340 if eval $compile; then
13341 yyy=`./try$exe_ext`
13342 case "$yyy" in
13343 12345678901)
13344 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13345 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13346 echo "We will use %ld."
13347 ;;
13348 esac
13349 fi
13350fi
13351
13352if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13353 $cat >try.c <<'EOCP'
13354#include <sys/types.h>
13355#include <inttypes.h>
13356#include <stdio.h>
13357int main() {
13358 int64_t q = 12345678901;
13359 printf("%" PRId64 "\n", q);
13360}
13361EOCP
13362 set try
13363 if eval $compile; then
13364 yyy=`./try$exe_ext`
13365 case "$yyy" in
13366 12345678901)
13367 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13368 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13369 echo "We will use the C9X style."
13370 ;;
13371 esac
13372 fi
13373fi
13374
13375if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13376 $cat >try.c <<'EOCP'
13377#include <sys/types.h>
13378#include <stdio.h>
13379int main() {
13380 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13381 printf("%lld\n", q);
13382}
13383EOCP
13384 set try
13385 if eval $compile; then
13386 yyy=`./try$exe_ext`
13387 case "$yyy" in
13388 12345678901)
13389 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13390 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13391 echo "We will use the %lld style."
13392 ;;
13393 esac
13394 fi
13395fi
13396
13397if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13398 $cat >try.c <<EOCP
13399#include <sys/types.h>
13400#include <stdio.h>
13401int main() {
13402 $quadtype q = 12345678901;
13403 printf("%Ld\n", q);
13404}
13405EOCP
13406 set try
13407 if eval $compile; then
13408 yyy=`./try$exe_ext`
13409 case "$yyy" in
13410 12345678901)
13411 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13412 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13413 echo "We will use %Ld."
13414 ;;
13415 esac
13416 fi
13417fi
13418
13419if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13420 $cat >try.c <<EOCP
13421#include <sys/types.h>
13422#include <stdio.h>
13423int main() {
13424 $quadtype q = 12345678901;
13425 printf("%qd\n", q);
13426}
13427EOCP
13428 set try
13429 if eval $compile; then
13430 yyy=`./try$exe_ext`
13431 case "$yyy" in
13432 12345678901)
13433 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13434 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13435 echo "We will use %qd."
13436 ;;
13437 esac
13438 fi
13439fi
13440
13441if $test X"$sPRId64" = X; then
13442 echo "Cannot figure out how to print 64-bit integers." >&4
13443fi
13444
13445$rm -f try try.*
13446
13447fi
13448
13449case "$sPRId64" in
13450'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
13451 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
13452 ;;
13453*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
13454 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
13455 ;;
13456esac
13457
13458
13459echo " "
13460$echo "Checking the format strings to be used for Perl's internal types..." >&4
13461
13462if $test X"$ivsize" = X8; then
13463 ivdformat="$sPRId64"
13464 uvuformat="$sPRIu64"
13465 uvoformat="$sPRIo64"
13466 uvxformat="$sPRIx64"
13467 uvXUformat="$sPRIXU64"
13468else
13469 if $test X"$ivsize" = X"$longsize"; then
13470 ivdformat='"ld"'
13471 uvuformat='"lu"'
13472 uvoformat='"lo"'
13473 uvxformat='"lx"'
13474 uvXUformat='"lX"'
13475 else
13476 if $test X"$ivsize" = X"$intsize"; then
13477 ivdformat='"d"'
13478 uvuformat='"u"'
13479 uvoformat='"o"'
13480 uvxformat='"x"'
13481 uvXUformat='"X"'
13482 else
13483 : far out
13484 if $test X"$ivsize" = X"$shortsize"; then
13485 ivdformat='"hd"'
13486 uvuformat='"hu"'
13487 uvoformat='"ho"'
13488 uvxformat='"hx"'
13489 uvXUformat='"hX"'
13490 fi
13491 fi
13492 fi
13493fi
13494
13495if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13496 nveformat="$sPRIeldbl"
13497 nvfformat="$sPRIfldbl"
13498 nvgformat="$sPRIgldbl"
13499 nvEUformat="$sPRIEUldbl"
13500 nvFUformat="$sPRIFUldbl"
13501 nvGUformat="$sPRIGUldbl"
13502else
13503 nveformat='"e"'
13504 nvfformat='"f"'
13505 nvgformat='"g"'
13506 nvEUformat='"E"'
13507 nvFUformat='"F"'
13508 nvGUformat='"G"'
13509fi
13510
13511case "$ivdformat" in
13512'') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13513 exit 1
13514 ;;
13515esac
13516
13517
13518echo " "
13519$echo "Checking the format string to be used for gids..." >&4
13520
13521case "$gidsign" in
13522-1) if $test X"$gidsize" = X"$ivsize"; then
13523 gidformat="$ivdformat"
13524 else
13525 if $test X"$gidsize" = X"$longsize"; then
13526 gidformat='"ld"'
13527 else
13528 if $test X"$gidsize" = X"$intsize"; then
13529 gidformat='"d"'
13530 else
13531 if $test X"$gidsize" = X"$shortsize"; then
13532 gidformat='"hd"'
13533 fi
13534 fi
13535 fi
13536 fi
13537 ;;
13538*) if $test X"$gidsize" = X"$uvsize"; then
13539 gidformat="$uvuformat"
13540 else
13541 if $test X"$gidsize" = X"$longsize"; then
13542 gidformat='"lu"'
13543 else
13544 if $test X"$gidsize" = X"$intsize"; then
13545 gidformat='"u"'
13546 else
13547 if $test X"$gidsize" = X"$shortsize"; then
13548 gidformat='"hu"'
13549 fi
13550 fi
13551 fi
13552 fi
13553 ;;
13554esac
13555
13556: see if getgroups exists
13557set getgroups d_getgrps
13558eval $inlibc
13559
13560: see if setgroups exists
13561set setgroups d_setgrps
13562eval $inlibc
13563
13564
13565: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13566echo " "
13567case "$d_getgrps$d_setgrps" in
13568*define*)
13569 case "$groupstype" in
13570 '') dflt="$gidtype" ;;
13571 *) dflt="$groupstype" ;;
13572 esac
13573 $cat <<EOM
13574What type of pointer is the second argument to getgroups() and setgroups()?
13575Usually this is the same as group ids, $gidtype, but not always.
13576
13577EOM
13578 rp='What type pointer is the second argument to getgroups() and setgroups()?'
13579 . ./myread
13580 groupstype="$ans"
13581 ;;
13582*) groupstype="$gidtype";;
13583esac
13584
13585echo " "
13586echo "Checking if your $make program sets \$(MAKE)..." >&4
13587case "$make_set_make" in
13588'')
13589 $sed 's/^X //' > testmake.mak << 'EOF'
13590Xall:
13591X @echo 'maketemp="$(MAKE)"'
13592EOF
13593 case "`$make -f testmake.mak 2>/dev/null`" in
13594 *maketemp=*) make_set_make='#' ;;
13595 *) make_set_make="MAKE=$make" ;;
13596 esac
13597 $rm -f testmake.mak
13598 ;;
13599esac
13600case "$make_set_make" in
13601'#') echo "Yup, it does.";;
13602*) echo "Nope, it doesn't.";;
13603esac
13604
13605: see what type is used for mode_t
13606rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13607set mode_t modetype int stdio.h sys/types.h
13608eval $typedef_ask
13609
2cc61e15
DD
13610: see if stdarg is available
13611echo " "
13612if $test `./findhdr stdarg.h`; then
13613 echo "<stdarg.h> found." >&4
13614 valstd="$define"
13615else
13616 echo "<stdarg.h> NOT found." >&4
13617 valstd="$undef"
13618fi
13619
13620: see if varags is available
13621echo " "
13622if $test `./findhdr varargs.h`; then
13623 echo "<varargs.h> found." >&4
13624else
13625 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13626fi
13627
13628: set up the varargs testing programs
13629$cat > varargs.c <<EOP
13630#ifdef I_STDARG
13631#include <stdarg.h>
13632#endif
13633#ifdef I_VARARGS
13634#include <varargs.h>
13635#endif
13636
13637#ifdef I_STDARG
13638int f(char *p, ...)
13639#else
13640int f(va_alist)
13641va_dcl
13642#endif
13643{
13644 va_list ap;
13645#ifndef I_STDARG
13646 char *p;
13647#endif
13648#ifdef I_STDARG
13649 va_start(ap,p);
13650#else
13651 va_start(ap);
13652 p = va_arg(ap, char *);
13653#endif
13654 va_end(ap);
13655}
13656EOP
13657$cat > varargs <<EOP
13658$startsh
13659if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13660 echo "true"
13661else
13662 echo "false"
13663fi
13664$rm -f varargs$_o
13665EOP
13666chmod +x varargs
13667
13668: now check which varargs header should be included
13669echo " "
13670i_varhdr=''
13671case "$valstd" in
13672"$define")
13673 if `./varargs I_STDARG`; then
13674 val='stdarg.h'
13675 elif `./varargs I_VARARGS`; then
13676 val='varargs.h'
13677 fi
13678 ;;
13679*)
13680 if `./varargs I_VARARGS`; then
13681 val='varargs.h'
13682 fi
13683 ;;
13684esac
13685case "$val" in
13686'')
13687echo "I could not find the definition for va_dcl... You have problems..." >&4
13688 val="$undef"; set i_stdarg; eval $setvar
13689 val="$undef"; set i_varargs; eval $setvar
13690 ;;
13691*)
13692 set i_varhdr
13693 eval $setvar
13694 case "$i_varhdr" in
13695 stdarg.h)
13696 val="$define"; set i_stdarg; eval $setvar
13697 val="$undef"; set i_varargs; eval $setvar
13698 ;;
13699 varargs.h)
13700 val="$undef"; set i_stdarg; eval $setvar
13701 val="$define"; set i_varargs; eval $setvar
13702 ;;
13703 esac
13704 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13705esac
13706$rm -f varargs*
13707
13708: see if we need va_copy
13709echo " "
13710case "$i_stdarg" in
13711"$define")
13712 $cat >try.c <<EOCP
13713#include <stdarg.h>
13714#include <stdio.h>
85c8a686
DD
13715#$i_stdlib I_STDLIB
13716#ifdef I_STDLIB
13717#include <stdlib.h>
13718#endif
13719#include <signal.h>
2cc61e15
DD
13720
13721int
13722ivfprintf(FILE *f, const char *fmt, va_list *valp)
13723{
13724 return vfprintf(f, fmt, *valp);
13725}
13726
13727int
13728myvfprintf(FILE *f, const char *fmt, va_list val)
13729{
13730 return ivfprintf(f, fmt, &val);
13731}
13732
13733int
13734myprintf(char *fmt, ...)
13735{
13736 va_list val;
13737 va_start(val, fmt);
13738 return myvfprintf(stdout, fmt, val);
13739}
13740
13741int
13742main(int ac, char **av)
13743{
85c8a686
DD
13744 signal(SIGSEGV, exit);
13745
2cc61e15
DD
13746 myprintf("%s%cs all right, then\n", "that", '\'');
13747 exit(0);
13748}
13749EOCP
13750 set try
d50de4df 13751 if eval $compile && ./try 2>&1 >/dev/null; then
2cc61e15
DD
13752 case "`./try`" in
13753 "that's all right, then")
13754 okay=yes
13755 ;;
13756 esac
13757 fi
13758 case "$okay" in
13759 yes) echo "It seems that you don't need va_copy()." >&4
13760 need_va_copy="$undef"
13761 ;;
13762 *) echo "It seems that va_copy() or similar will be needed." >&4
13763 need_va_copy="$define"
13764 ;;
13765 esac
13766 $rm -f try.* core core.* *.core *.core.*
13767 ;;
13768*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
13769 ;;
13770esac
13771
b4eb6b3d
JH
13772: define a fucntion to check prototypes
13773$cat > protochk <<EOSH
13774$startsh
13775cc="$cc"
13776optimize="$optimize"
13777ccflags="$ccflags"
13778prototype="$prototype"
13779define="$define"
13780rm=$rm
13781EOSH
13782
13783$cat >> protochk <<'EOSH'
13784
13785$rm -f try.c
13786foo="$1"
13787shift
13788while test $# -ge 2; do
13789 case "$1" in
13790 $define) echo "#include <$2>" >> try.c ;;
13791 literal) echo "$2" >> try.c ;;
13792 esac
13793 shift 2
13794done
13795test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
13796cat >> try.c <<'EOCP'
13797#ifdef CAN_PROTOTYPE
13798#define _(args) args
13799#else
13800#define _(args) ()
13801#endif
13802EOCP
13803echo "$foo" >> try.c
13804echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13805$cc $optimize $ccflags -c try.c > /dev/null 2>&1
13806status=$?
13807$rm -f try.[co]
13808exit $status
13809EOSH
13810chmod +x protochk
13811$eunicefix protochk
13812
13813: see what type is used for size_t
13814rp="What is the type used for the length parameter for string functions?"
13815set size_t sizetype 'unsigned int' stdio.h sys/types.h
13816eval $typedef_ask
13817
13818: check for type of arguments to gethostbyaddr.
13819if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13820 case "$d_gethbyaddr" in
13821 $define)
13822 $cat <<EOM
13823
13824Checking to see what type of arguments are accepted by gethostbyaddr().
13825EOM
13826 hdrs="$define sys/types.h
13827 $d_socket sys/socket.h
13828 $i_niin netinet/in.h
13829 $i_netdb netdb.h
13830 $i_unistd unistd.h"
13831 : The first arg can 'char *' or 'void *'
13832 : The second arg is some of integral type
13833 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13834 for yyy in size_t long int; do
13835 case "$netdb_host_type" in
13836 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13837 if ./protochk "$try" $hdrs; then
13838 echo "Your system accepts $xxx for the first arg."
13839 echo "...and $yyy for the second arg."
13840 netdb_host_type="$xxx"
13841 netdb_hlen_type="$yyy"
13842 fi
13843 ;;
13844 esac
13845 done
13846 done
13847 : In case none of those worked, prompt the user.
13848 case "$netdb_host_type" in
13849 '') rp='What is the type for the 1st argument to gethostbyaddr?'
13850 dflt='char *'
13851 . ./myread
13852 netdb_host_type=$ans
13853 rp='What is the type for the 2nd argument to gethostbyaddr?'
13854 dflt="$sizetype"
13855 . ./myread
13856 netdb_hlen_type=$ans
13857 ;;
13858 esac
13859 ;;
13860 *) : no gethostbyaddr, so pick harmless defaults
13861 netdb_host_type='char *'
13862 netdb_hlen_type="$sizetype"
13863 ;;
13864 esac
13865 # Remove the "const" if needed. -- but then we'll have a
13866 # prototype clash!
13867 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13868fi
13869
13870: check for type of argument to gethostbyname.
13871if test "X$netdb_name_type" = X ; then
13872 case "$d_gethbyname" in
13873 $define)
13874 $cat <<EOM
13875
13876Checking to see what type of argument is accepted by gethostbyname().
13877EOM
13878 hdrs="$define sys/types.h
13879 $d_socket sys/socket.h
13880 $i_niin netinet/in.h
13881 $i_netdb netdb.h
13882 $i_unistd unistd.h"
13883 for xxx in "const char *" "char *"; do
13884 case "$netdb_name_type" in
13885 '') try="extern struct hostent *gethostbyname($xxx);"
13886 if ./protochk "$try" $hdrs; then
13887 echo "Your system accepts $xxx."
13888 netdb_name_type="$xxx"
13889 fi
13890 ;;
13891 esac
13892 done
13893 : In case none of those worked, prompt the user.
13894 case "$netdb_name_type" in
13895 '') rp='What is the type for the 1st argument to gethostbyname?'
13896 dflt='char *'
13897 . ./myread
13898 netdb_name_type=$ans
13899 ;;
13900 esac
13901 ;;
13902 *) : no gethostbyname, so pick harmless default
13903 netdb_name_type='char *'
13904 ;;
13905 esac
13906fi
13907
13908: check for type of 1st argument to getnetbyaddr.
13909if test "X$netdb_net_type" = X ; then
13910 case "$d_getnbyaddr" in
13911 $define)
13912 $cat <<EOM
13913
13914Checking to see what type of 1st argument is accepted by getnetbyaddr().
13915EOM
13916 hdrs="$define sys/types.h
13917 $d_socket sys/socket.h
13918 $i_niin netinet/in.h
13919 $i_netdb netdb.h
13920 $i_unistd unistd.h"
13921 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13922 case "$netdb_net_type" in
13923 '') try="extern struct netent *getnetbyaddr($xxx, int);"
13924 if ./protochk "$try" $hdrs; then
13925 echo "Your system accepts $xxx."
13926 netdb_net_type="$xxx"
13927 fi
13928 ;;
13929 esac
13930 done
13931 : In case none of those worked, prompt the user.
13932 case "$netdb_net_type" in
13933 '') rp='What is the type for the 1st argument to getnetbyaddr?'
13934 dflt='long'
13935 . ./myread
13936 netdb_net_type=$ans
13937 ;;
13938 esac
13939 ;;
13940 *) : no getnetbyaddr, so pick harmless default
13941 netdb_net_type='long'
13942 ;;
13943 esac
13944fi
13945: locate the preferred pager for this system
13946case "$pager" in
13947'')
13948 dflt=''
13949 case "$pg" in
13950 /*) dflt=$pg;;
13951 [a-zA-Z]:/*) dflt=$pg;;
13952 esac
13953 case "$more" in
13954 /*) dflt=$more;;
13955 [a-zA-Z]:/*) dflt=$more;;
13956 esac
13957 case "$less" in
13958 /*) dflt=$less;;
13959 [a-zA-Z]:/*) dflt=$less;;
13960 esac
13961 case "$dflt" in
13962 '') dflt=/usr/ucb/more;;
13963 esac
13964 ;;
13965*) dflt="$pager";;
13966esac
13967echo " "
13968fn=f/
13969rp='What pager is used on your system?'
13970. ./getfile
13971pager="$ans"
13972
13973: see what type pids are declared as in the kernel
13974rp="What is the type of process ids on this system?"
13975set pid_t pidtype int stdio.h sys/types.h
13976eval $typedef_ask
13977
13978: Find earliest binary compatible site_perl subdirectory perl can use.
13979case "$bincompat5005" in
13980"$define") xs_apiversion='5.005' ;;
13981*) xs_apiversion=$version ;; # The current site_perl version.
13982esac
13983: Find earliest pure perl site_perl subdirectory perl can use.
13984: The versioned directories started at 5.005.
13985pm_apiversion='5.005'
13986
13987: check for length of pointer
13988echo " "
13989case "$ptrsize" in
13990'')
13991 echo "Checking to see how big your pointers are..." >&4
13992 if test "$voidflags" -gt 7; then
13993 echo '#define VOID_PTR char *' > try.c
13994 else
13995 echo '#define VOID_PTR void *' > try.c
13996 fi
13997 $cat >>try.c <<'EOCP'
13998#include <stdio.h>
13999int main()
14000{
14001 printf("%d\n", (int)sizeof(VOID_PTR));
14002 exit(0);
14003}
14004EOCP
14005 set try
14006 if eval $compile_ok; then
14007 ptrsize=`./try`
14008 echo "Your pointers are $ptrsize bytes long."
14009 else
14010 dflt='4'
14011 echo "(I can't seem to compile the test program. Guessing...)" >&4
14012 rp="What is the size of a pointer (in bytes)?"
14013 . ./myread
14014 ptrsize="$ans"
14015 fi
14016 ;;
14017esac
14018$rm -f try.c try
14019
14020: see if ar generates random libraries by itself
14021echo " "
14022echo "Checking how to generate random libraries on your machine..." >&4
14023echo 'int bar1() { return bar2(); }' > bar1.c
14024echo 'int bar2() { return 2; }' > bar2.c
14025$cat > foo.c <<'EOP'
14026int main() { printf("%d\n", bar1()); exit(0); }
14027EOP
14028$cc $ccflags -c bar1.c >/dev/null 2>&1
14029$cc $ccflags -c bar2.c >/dev/null 2>&1
14030$cc $ccflags -c foo.c >/dev/null 2>&1
14031$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 14032if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
b4eb6b3d
JH
14033 ./foobar >/dev/null 2>&1; then
14034 echo "$ar appears to generate random libraries itself."
14035 orderlib=false
14036 ranlib=":"
14037elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 14038 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
b4eb6b3d
JH
14039 ./foobar >/dev/null 2>&1; then
14040 echo "a table of contents needs to be added with '$ar ts'."
14041 orderlib=false
14042 ranlib="$ar ts"
14043else
14044 case "$ranlib" in
14045 :) ranlib='';;
14046 '')
14047 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14048 $test -f $ranlib || ranlib=''
14049 ;;
14050 esac
14051 if $test -n "$ranlib"; then
14052 echo "your system has '$ranlib'; we'll use that."
14053 orderlib=false
14054 else
14055 echo "your system doesn't seem to support random libraries"
14056 echo "so we'll use lorder and tsort to order the libraries."
14057 orderlib=true
14058 ranlib=":"
14059 fi
14060fi
14061$rm -f foo* bar*
14062
14063: check for type of arguments to select.
14064case "$selecttype" in
14065'') case "$d_select" in
14066 $define)
14067 echo " "
14068 $cat <<EOM
14069Checking to see what type of arguments are accepted by select().
14070EOM
14071 hdrs="$define sys/types.h
14072 $i_systime sys/time.h
14073 $i_sysselct sys/select.h
14074 $d_socket sys/socket.h"
14075 : The first arg can be int, unsigned, or size_t
14076 : The last arg may or may not be 'const'
14077 val=''
14078 : void pointer has been seen but using that
14079 : breaks the selectminbits test
14080 for xxx in 'fd_set *' 'int *'; do
14081 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14082 for tmo in 'struct timeval *' 'const struct timeval *'; do
14083 case "$val" in
14084 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14085 if ./protochk "$try" $hdrs; then
14086 echo "Your system accepts $xxx."
14087 val="$xxx"
14088 fi
14089 ;;
14090 esac
14091 done
14092 done
14093 done
14094 case "$val" in
14095 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14096 case "$d_fd_set" in
14097 $define) dflt="fd_set *" ;;
14098 *) dflt="int *" ;;
14099 esac
14100 . ./myread
14101 val=$ans
14102 ;;
14103 esac
14104 selecttype="$val"
14105 ;;
14106 *) : no select, so pick a harmless default
14107 selecttype='int *'
14108 ;;
14109 esac
14110 ;;
14111esac
14112
14113: check for the select 'width'
14114case "$selectminbits" in
14115'') case "$d_select" in
14116 $define)
14117 $cat <<EOM
14118
14119Checking to see on how many bits at a time your select() operates...
14120EOM
14121 $cat >try.c <<EOCP
14122#include <sys/types.h>
14123#$i_time I_TIME
14124#$i_systime I_SYS_TIME
14125#$i_systimek I_SYS_TIME_KERNEL
14126#ifdef I_TIME
14127# include <time.h>
14128#endif
14129#ifdef I_SYS_TIME
14130# ifdef I_SYS_TIME_KERNEL
14131# define KERNEL
14132# endif
14133# include <sys/time.h>
14134# ifdef I_SYS_TIME_KERNEL
14135# undef KERNEL
14136# endif
14137#endif
14138#$i_sysselct I_SYS_SELECT
14139#ifdef I_SYS_SELECT
14140#include <sys/select.h>
14141#endif
14142#$d_socket HAS_SOCKET
14143#ifdef HAS_SOCKET
14144# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14145#endif
14146#include <stdio.h>
14147$selecttype b;
14148#define S sizeof(*(b))
14149#define MINBITS 64
14150#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14151#define NBITS (NBYTES * 8)
14152int main() {
14153 char s[NBYTES];
14154 struct timeval t;
14155 int i;
14156 FILE* fp;
14157 int fd;
14158
14159 fclose(stdin);
14160 fp = fopen("try.c", "r");
14161 if (fp == 0)
14162 exit(1);
14163 fd = fileno(fp);
14164 if (fd < 0)
14165 exit(2);
14166 b = ($selecttype)s;
14167 for (i = 0; i < NBITS; i++)
14168 FD_SET(i, b);
14169 t.tv_sec = 0;
14170 t.tv_usec = 0;
14171 select(fd + 1, b, 0, 0, &t);
14172 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14173 printf("%d\n", i + 1);
14174 return 0;
14175}
14176EOCP
14177 set try
14178 if eval $compile_ok; then
14179 selectminbits=`./try`
14180 case "$selectminbits" in
14181 '') cat >&4 <<EOM
14182Cannot figure out on how many bits at a time your select() operates.
14183I'll play safe and guess it is 32 bits.
14184EOM
14185 selectminbits=32
14186 bits="32 bits"
14187 ;;
14188 1) bits="1 bit" ;;
14189 *) bits="$selectminbits bits" ;;
14190 esac
14191 echo "Your select() operates on $bits at a time." >&4
14192 else
14193 rp='What is the minimum number of bits your select() operates on?'
14194 case "$byteorder" in
14195 1234|12345678) dflt=32 ;;
14196 *) dflt=1 ;;
14197 esac
14198 . ./myread
14199 val=$ans
14200 selectminbits="$val"
14201 fi
14202 $rm -f try.* try
14203 ;;
14204 *) : no select, so pick a harmless default
14205 selectminbits='32'
14206 ;;
14207 esac
14208 ;;
14209esac
14210
14211: Trace out the files included by signal.h, then look for SIGxxx names.
14212: Remove SIGARRAYSIZE used by HPUX.
14213: Remove SIGSTKSIZE used by Linux.
14214: Remove SIGSTKSZ used by Posix.
14215: Remove SIGTYP void lines used by OS2.
14216: Some cpps, like os390, dont give the file name anywhere
14217if [ "X$fieldn" = X ]; then
14218 : Just make some guesses. We check them later.
14219 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14220else
14221 xxx=`echo '#include <signal.h>' |
14222 $cppstdin $cppminus $cppflags 2>/dev/null |
14223 $grep '^[ ]*#.*include' |
14224 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
14225fi
14226: Check this list of files to be sure we have parsed the cpp output ok.
14227: This will also avoid potentially non-existent files, such
14228: as ../foo/bar.h
14229xxxfiles=''
14230for xx in $xxx /dev/null ; do
14231 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14232done
14233: If we have found no files, at least try signal.h
14234case "$xxxfiles" in
14235'') xxxfiles=`./findhdr signal.h` ;;
14236esac
14237xxx=`awk '
14238$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14239 print substr($2, 4, 20)
14240}
14241$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14242 print substr($3, 4, 20)
14243}' $xxxfiles`
14244: Append some common names just in case the awk scan failed.
14245xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14246xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14247xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14248xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14249xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14250
14251: generate a few handy files for later
14252$cat > signal.c <<'EOCP'
14253#include <sys/types.h>
14254#include <signal.h>
14255#include <stdio.h>
14256int main() {
14257
14258/* Strange style to avoid deeply-nested #if/#else/#endif */
14259#ifndef NSIG
14260# ifdef _NSIG
14261# define NSIG (_NSIG)
14262# endif
14263#endif
14264
14265#ifndef NSIG
14266# ifdef SIGMAX
14267# define NSIG (SIGMAX+1)
14268# endif
14269#endif
14270
14271#ifndef NSIG
14272# ifdef SIG_MAX
14273# define NSIG (SIG_MAX+1)
14274# endif
14275#endif
14276
14277#ifndef NSIG
14278# ifdef MAXSIG
14279# define NSIG (MAXSIG+1)
14280# endif
14281#endif
14282
14283#ifndef NSIG
14284# ifdef MAX_SIG
14285# define NSIG (MAX_SIG+1)
14286# endif
14287#endif
14288
14289#ifndef NSIG
14290# ifdef SIGARRAYSIZE
14291# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14292# endif
14293#endif
14294
14295#ifndef NSIG
14296# ifdef _sys_nsig
14297# define NSIG (_sys_nsig) /* Solaris 2.5 */
14298# endif
14299#endif
14300
14301/* Default to some arbitrary number that's big enough to get most
14302 of the common signals.
14303*/
14304#ifndef NSIG
14305# define NSIG 50
14306#endif
14307
14308printf("NSIG %d\n", NSIG);
14309
14310#ifndef JUST_NSIG
14311
14312EOCP
14313
14314echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14315{
14316 printf "#ifdef SIG"; printf $1; printf "\n"
14317 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14318 printf $1; printf ");\n"
14319 printf "#endif\n"
14320}
14321END {
14322 printf "#endif /* JUST_NSIG */\n";
14323 printf "exit(0);\n}\n";
14324}
14325' >>signal.c
14326$cat >signal.awk <<'EOP'
14327BEGIN { ndups = 0 }
14328$1 ~ /^NSIG$/ { nsig = $2 }
14329($1 !~ /^NSIG$/) && (NF == 2) {
14330 if ($2 > maxsig) { maxsig = $2 }
14331 if (sig_name[$2]) {
14332 dup_name[ndups] = $1
14333 dup_num[ndups] = $2
14334 ndups++
14335 }
14336 else {
14337 sig_name[$2] = $1
14338 sig_num[$2] = $2
14339 }
14340}
14341END {
14342 if (nsig == 0) {
14343 nsig = maxsig + 1
14344 }
14345 printf("NSIG %d\n", nsig);
14346 for (n = 1; n < nsig; n++) {
14347 if (sig_name[n]) {
14348 printf("%s %d\n", sig_name[n], sig_num[n])
14349 }
14350 else {
14351 printf("NUM%d %d\n", n, n)
14352 }
14353 }
14354 for (n = 0; n < ndups; n++) {
14355 printf("%s %d\n", dup_name[n], dup_num[n])
14356 }
14357}
14358EOP
14359$cat >signal_cmd <<EOS
14360$startsh
14361if $test -s signal.lst; then
14362 echo "Using your existing signal.lst file"
14363 exit 0
14364fi
14365xxx="$xxx"
14366EOS
14367$cat >>signal_cmd <<'EOS'
14368
14369set signal
14370if eval $compile_ok; then
14371 ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14372else
14373 echo "(I can't seem be able to compile the whole test program)" >&4
14374 echo "(I'll try it in little pieces.)" >&4
14375 set signal -DJUST_NSIG
14376 if eval $compile_ok; then
14377 ./signal$_exe > signal.nsg
14378 $cat signal.nsg
14379 else
14380 echo "I can't seem to figure out how many signals you have." >&4
14381 echo "Guessing 50." >&4
14382 echo 'NSIG 50' > signal.nsg
14383 fi
14384 : Now look at all the signal names, one at a time.
14385 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14386 $cat > signal.c <<EOCP
14387#include <sys/types.h>
14388#include <signal.h>
14389#include <stdio.h>
14390int main() {
14391printf("$xx %d\n", SIG${xx});
14392return 0;
14393}
14394EOCP
14395 set signal
14396 if eval $compile; then
14397 echo "SIG${xx} found."
14398 ./signal$_exe >> signal.ls1
14399 else
14400 echo "SIG${xx} NOT found."
14401 fi
14402 done
14403 if $test -s signal.ls1; then
14404 $cat signal.nsg signal.ls1 |
14405 $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14406 fi
14407
14408fi
14409if $test -s signal.lst; then
14410 :
14411else
14412 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14413 echo 'kill -l' >signal
14414 set X `csh -f <signal`
14415 $rm -f signal
14416 shift
14417 case $# in
14418 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14419 esac
14420 echo $@ | $tr ' ' $trnl | \
14421 $awk '{ printf "%s %d\n", $1, ++s; }
14422 END { printf "NSIG %d\n", ++s }' >signal.lst
14423fi
14424$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14425EOS
14426chmod a+x signal_cmd
14427$eunicefix signal_cmd
14428
14429: generate list of signal names
14430echo " "
14431case "$sig_name_init" in
14432'') doinit=yes ;;
14433*) case "$sig_num_init" in
14434 ''|*,*) doinit=yes ;;
14435 esac ;;
14436esac
14437case "$doinit" in
14438yes)
14439 echo "Generating a list of signal names and numbers..." >&4
14440 . ./signal_cmd
14441 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14442 sig_name=`$awk 'BEGIN { printf "ZERO " }
14443 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14444 sig_num=`$awk 'BEGIN { printf "0 " }
14445 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14446 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
14447 !/^NSIG/ { printf "\"%s\", ", $1 }
14448 END { printf "0\n" }' signal.lst`
14449 sig_num_init=`$awk 'BEGIN { printf "0, " }
14450 !/^NSIG/ { printf "%d, ", $2}
14451 END { printf "0\n"}' signal.lst`
14452 ;;
14453esac
14454echo "The following $sig_count signals are available:"
14455echo " "
14456echo $sig_name | $awk \
14457'BEGIN { linelen = 0 }
14458{
14459 for (i = 1; i <= NF; i++) {
14460 name = "SIG" $i " "
14461 linelen = linelen + length(name)
14462 if (linelen > 70) {
14463 printf "\n"
14464 linelen = length(name)
14465 }
14466 printf "%s", name
14467 }
14468 printf "\n"
14469}'
14470$rm -f signal signal.c signal.awk signal.lst signal_cmd
14471
14472echo " "
14473case "$sizetype" in
14474*_t) zzz="$sizetype" ;;
14475*) zzz="filesize" ;;
14476esac
14477echo "Checking the size of $zzz..." >&4
14478cat > try.c <<EOCP
14479#include <sys/types.h>
14480#include <stdio.h>
14481int main() {
14482 printf("%d\n", (int)sizeof($sizetype));
14483 exit(0);
14484}
14485EOCP
14486set try
14487if eval $compile_ok; then
14488 yyy=`./try`
14489 case "$yyy" in
14490 '') sizesize=4
14491 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14492 ;;
14493 *) sizesize=$yyy
14494 echo "Your $zzz size is $sizesize bytes."
14495 ;;
14496 esac
14497else
14498 sizesize=4
14499 echo "(I can't compile the test program--guessing $sizesize.)" >&4
14500fi
14501
14502
14503: check for socklen_t
14504echo " "
14505echo "Checking to see if you have socklen_t..." >&4
14506$cat >try.c <<EOCP
14507#include <sys/types.h>
14508#$d_socket HAS_SOCKET
14509#ifdef HAS_SOCKET
14510#include <sys/socket.h>
14511#endif
14512int main() { socklen_t x = 16; }
14513EOCP
14514set try
14515if eval $compile; then
14516 val="$define"
14517 echo "You have socklen_t."
14518else
14519 val="$undef"
14520 echo "You do not have socklen_t."
14521 case "$sizetype" in
14522 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14523 esac
14524fi
14525$rm -f try try.*
14526set d_socklen_t
14527eval $setvar
14528
a7710f8d
JH
14529: see if this is a socks.h system
14530set socks.h i_socks
14531eval $inhdr
14532
b4eb6b3d
JH
14533: check for type of the size argument to socket calls
14534case "$d_socket" in
14535"$define")
14536 $cat <<EOM
14537
14538Checking to see what type is the last argument of accept().
14539EOM
b4eb6b3d
JH
14540 yyy=''
14541 case "$d_socklen_t" in
14542 "$define") yyy="$yyy socklen_t"
14543 esac
14544 yyy="$yyy $sizetype int long unsigned"
14545 for xxx in $yyy; do
14546 case "$socksizetype" in
14547 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
14548 case "$usesocks" in
14549 "$define")
14550 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14551 echo "Your system accepts '$xxx *' for the last argument of accept()."
14552 socksizetype="$xxx"
14553 fi
14554 ;;
14555 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
14556 echo "Your system accepts '$xxx *' for the last argument of accept()."
14557 socksizetype="$xxx"
14558 fi
14559 ;;
14560 esac
b4eb6b3d
JH
14561 ;;
14562 esac
14563 done
14564: In case none of those worked, prompt the user.
14565 case "$socksizetype" in
14566 '') rp='What is the type for socket address structure sizes?'
14567 dflt='int'
14568 . ./myread
14569 socksizetype=$ans
14570 ;;
14571 esac
14572 ;;
14573*) : no sockets, so pick relatively harmless default
14574 socksizetype='int'
14575 ;;
14576esac
14577
14578: see what type is used for signed size_t
14579set ssize_t ssizetype int stdio.h sys/types.h
14580eval $typedef
14581dflt="$ssizetype"
14582$cat > ssize.c <<EOM
14583#include <stdio.h>
14584#include <sys/types.h>
14585#define Size_t $sizetype
14586#define SSize_t $dflt
14587int main()
14588{
14589 if (sizeof(Size_t) == sizeof(SSize_t))
14590 printf("$dflt\n");
14591 else if (sizeof(Size_t) == sizeof(int))
14592 printf("int\n");
14593 else
14594 printf("long\n");
14595 exit(0);
14596}
14597EOM
14598echo " "
14599set ssize
14600if eval $compile_ok && ./ssize > /dev/null; then
14601 ssizetype=`./ssize`
14602 echo "I'll be using $ssizetype for functions returning a byte count." >&4
14603else
14604 $cat >&4 <<EOM
14605Help! I can't compile and run the ssize_t test program: please enlighten me!
14606(This is probably a misconfiguration in your system or libraries, and
14607you really ought to fix it. Still, I'll try anyway.)
14608
14609I need a type that is the same size as $sizetype, but is guaranteed to
14610be signed. Common values are ssize_t, int and long.
14611
14612EOM
14613 rp="What signed type is the same size as $sizetype?"
14614 . ./myread
14615 ssizetype="$ans"
14616fi
14617$rm -f ssize ssize.*
14618
14619: see what type of char stdio uses.
14620echo " "
aa517f50
JH
14621echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
14622if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
14623 echo "Your stdio uses unsigned chars." >&4
14624 stdchar="unsigned char"
14625else
aa517f50
JH
14626 echo "Your stdio uses signed chars." >&4
14627 stdchar="char"
b4eb6b3d 14628fi
aa517f50
JH
14629$rm -f stdioh
14630
14631
b4eb6b3d
JH
14632
14633: see if time exists
14634echo " "
14635if test "X$d_time" = X -o X"$timetype" = X; then
14636 if set time val -f d_time; eval $csym; $val; then
14637 echo 'time() found.' >&4
14638 val="$define"
14639 rp="What is the type returned by time() on this system?"
14640 set time_t timetype long stdio.h sys/types.h
14641 eval $typedef_ask
14642 else
14643 echo 'time() not found, hope that will do.' >&4
14644 val="$undef"
14645 timetype='int';
14646 fi
14647 set d_time
14648 eval $setvar
14649fi
14650
14651: see what type uids are declared as in the kernel
14652echo " "
14653echo "Looking for the type for user ids returned by getuid()."
14654set uid_t uidtype xxx stdio.h sys/types.h
14655eval $typedef
14656case "$uidtype" in
14657xxx)
14658 xxx=`./findhdr sys/user.h`
14659 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14660 case $1 in
14661 unsigned) dflt="$1 $2" ;;
14662 *) dflt="$1" ;;
14663 esac
14664 ;;
14665*) dflt="$uidtype";;
14666esac
14667case "$uidtype" in
14668uid_t) echo "uid_t found." ;;
14669*) rp="What is the type for user ids returned by getuid()?"
14670 . ./myread
14671 uidtype="$ans"
14672 ;;
14673esac
14674
14675echo " "
14676case "$uidtype" in
14677*_t) zzz="$uidtype" ;;
14678*) zzz="uid" ;;
14679esac
14680echo "Checking the size of $zzz..." >&4
14681cat > try.c <<EOCP
14682#include <sys/types.h>
14683#include <stdio.h>
14684int main() {
14685 printf("%d\n", (int)sizeof($uidtype));
14686 exit(0);
14687}
14688EOCP
14689set try
14690if eval $compile_ok; then
14691 yyy=`./try`
14692 case "$yyy" in
14693 '') uidsize=4
14694 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14695 ;;
14696 *) uidsize=$yyy
14697 echo "Your $zzz is $uidsize bytes long."
14698 ;;
14699 esac
14700else
14701 uidsize=4
14702 echo "(I can't compile the test program--guessing $uidsize.)" >&4
14703fi
14704
14705echo " "
14706case "$uidtype" in
14707*_t) zzz="$uidtype" ;;
14708*) zzz="uid" ;;
14709esac
14710echo "Checking the sign of $zzz..." >&4
14711cat > try.c <<EOCP
14712#include <sys/types.h>
14713#include <stdio.h>
14714int main() {
14715 $uidtype foo = -1;
14716 if (foo < 0)
14717 printf("-1\n");
14718 else
14719 printf("1\n");
14720}
14721EOCP
14722set try
14723if eval $compile; then
14724 yyy=`./try`
14725 case "$yyy" in
14726 '') uidsign=1
14727 echo "(I can't execute the test program--guessing unsigned.)" >&4
14728 ;;
14729 *) uidsign=$yyy
14730 case "$uidsign" in
14731 1) echo "Your $zzz is unsigned." ;;
14732 -1) echo "Your $zzz is signed." ;;
14733 esac
14734 ;;
14735 esac
14736else
14737 uidsign=1
14738 echo "(I can't compile the test program--guessing unsigned.)" >&4
14739fi
14740
14741
14742
14743echo " "
14744$echo "Checking the format string to be used for uids..." >&4
14745
14746case "$uidsign" in
14747-1) if $test X"$uidsize" = X"$ivsize"; then
14748 uidformat="$ivdformat"
14749 else
14750 if $test X"$uidsize" = X"$longsize"; then
14751 uidformat='"ld"'
14752 else
14753 if $test X"$uidsize" = X"$intsize"; then
14754 uidformat='"d"'
14755 else
14756 if $test X"$uidsize" = X"$shortsize"; then
14757 uidformat='"hd"'
14758 fi
14759 fi
14760 fi
14761 fi
14762 ;;
14763*) if $test X"$uidsize" = X"$uvsize"; then
14764 uidformat="$uvuformat"
14765 else
14766 if $test X"$uidsize" = X"$longsize"; then
14767 uidformat='"lu"'
14768 else
14769 if $test X"$uidsize" = X"$intsize"; then
14770 uidformat='"u"'
14771 else
14772 if $test X"$uidsize" = X"$shortsize"; then
14773 uidformat='"hu"'
14774 fi
14775 fi
14776 fi
14777 fi
14778 ;;
14779esac
14780
14781: see if dbm.h is available
14782: see if dbmclose exists
14783set dbmclose d_dbmclose
14784eval $inlibc
14785
14786case "$d_dbmclose" in
14787$define)
14788 set dbm.h i_dbm
14789 eval $inhdr
14790 case "$i_dbm" in
14791 $define)
14792 val="$undef"
14793 set i_rpcsvcdbm
14794 eval $setvar
14795 ;;
14796 *) set rpcsvc/dbm.h i_rpcsvcdbm
14797 eval $inhdr
14798 ;;
14799 esac
14800 ;;
14801*) echo "We won't be including <dbm.h>"
14802 val="$undef"
14803 set i_dbm
14804 eval $setvar
14805 val="$undef"
14806 set i_rpcsvcdbm
14807 eval $setvar
14808 ;;
14809esac
14810
14811: see if this is a sys/file.h system
14812val=''
14813set sys/file.h val
14814eval $inhdr
14815
14816: do we need to include sys/file.h ?
14817case "$val" in
14818"$define")
14819 echo " "
14820 if $h_sysfile; then
14821 val="$define"
14822 echo "We'll be including <sys/file.h>." >&4
14823 else
14824 val="$undef"
14825 echo "We won't be including <sys/file.h>." >&4
14826 fi
14827 ;;
14828*)
14829 h_sysfile=false
14830 ;;
14831esac
14832set i_sysfile
14833eval $setvar
14834
14835: see if fcntl.h is there
14836val=''
14837set fcntl.h val
14838eval $inhdr
14839
14840: see if we can include fcntl.h
14841case "$val" in
14842"$define")
14843 echo " "
14844 if $h_fcntl; then
14845 val="$define"
14846 echo "We'll be including <fcntl.h>." >&4
14847 else
14848 val="$undef"
14849 if $h_sysfile; then
14850 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14851 else
14852 echo "We won't be including <fcntl.h>." >&4
14853 fi
14854 fi
14855 ;;
14856*)
14857 h_fcntl=false
14858 val="$undef"
14859 ;;
14860esac
14861set i_fcntl
14862eval $setvar
14863
14864: see if this is a iconv.h system
14865set iconv.h i_iconv
14866eval $inhdr
14867
14868: see if this is a ieeefp.h system
14869set ieeefp.h i_ieeefp
14870eval $inhdr
14871
14872: see if this is a libutil.h system
14873set libutil.h i_libutil
14874eval $inhdr
14875
14876: see if locale.h is available
14877set locale.h i_locale
14878eval $inhdr
14879
14880: see if mach cthreads are available
14881if test "X$usethreads" = "X$define"; then
14882 set mach/cthreads.h i_machcthr
14883 eval $inhdr
14884else
14885 i_machcthr="$undef"
14886fi
14887
14888
14889
14890: see if this is a math.h system
14891set math.h i_math
14892eval $inhdr
14893
14894: see if this is a mntent.h system
14895set mntent.h i_mntent
14896eval $inhdr
14897
14898: see if ndbm.h is available
14899set ndbm.h t_ndbm
14900eval $inhdr
14901case "$t_ndbm" in
14902$define)
14903 : see if dbm_open exists
14904 set dbm_open d_dbm_open
14905 eval $inlibc
14906 case "$d_dbm_open" in
14907 $undef)
14908 t_ndbm="$undef"
14909 echo "We won't be including <ndbm.h>"
14910 ;;
14911 esac
14912 ;;
14913esac
14914val="$t_ndbm"
14915set i_ndbm
14916eval $setvar
14917
14918: see if net/errno.h is available
14919val=''
14920set net/errno.h val
14921eval $inhdr
14922
14923: Unfortunately, it causes problems on some systems. Arrgh.
14924case "$val" in
14925$define)
14926 cat > try.c <<'EOM'
14927#include <stdio.h>
14928#include <errno.h>
14929#include <net/errno.h>
14930int func()
14931{
14932 return ENOTSOCK;
14933}
14934EOM
14935 if $cc $ccflags -c try.c >/dev/null 2>&1; then
14936 echo "We'll be including <net/errno.h>." >&4
14937 else
14938 echo "We won't be including <net/errno.h>." >&4
14939 val="$undef"
14940 fi
14941 $rm -f try.* try
14942 ;;
14943esac
14944set i_neterrno
14945eval $setvar
14946
14947: see if netinet/tcp.h is available
14948set netinet/tcp.h i_netinettcp
14949eval $inhdr
14950
14951: see if this is a poll.h system
14952set poll.h i_poll
14953eval $inhdr
14954
14955: see if this is a prot.h system
14956set prot.h i_prot
14957eval $inhdr
14958
14959echo " "
14960$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
14961$cat <<'EOSH' > Cppsym.know
14962a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14963AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14964alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14965ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14966BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14967BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14968bull c cadmus clipper CMU COFF COMPILER_VERSION
14969concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14970CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14971Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14972FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14973GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14974H3050R H3050RX hbullx20 hcx host_mips
14975hp200 hp300 hp700 HP700 hp800 hp9000
14976hp9000s200 hp9000s300 hp9000s400 hp9000s500
14977hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14978i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14979iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14980INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14981LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14982LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14983Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14984LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14985M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14986M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14987M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14988MATH_HAS_NO_SIDE_EFFECTS
14989mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14990mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14991mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14992MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14993mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14994NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 14995news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
14996ns32016 ns32332 ns32k nsc32000
14997OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14998pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14999pc532 pdp11 PGC PIC plexus PORTAR posix
15000POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15001POSIX_C_SOURCE POSIX_SOURCE POWER
15002PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15003riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
15004SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15005sony sony_news sonyrisc sparc sparclite spectrum
15006stardent stdc STDC_EXT stratos sun sun3 sun386
15007Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15008SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15009SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15010sysV68 sysV88 Tek4132 Tek4300 titan
15011tower tower32 tower32_200 tower32_600 tower32_700
15012tower32_800 tower32_850 tss
15013u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15014ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15015unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15016Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15017XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15018XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15019z8000
15020EOSH
15021# Maybe put other stuff here too.
15022cat <<EOSH >>Cppsym.know
15023$osname
15024EOSH
15025./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15026./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15027$cat Cppsym.know > Cppsym.c
381aa1ff 15028$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
15029$rm -f Cppsym.a Cppsym.b Cppsym.c
15030cat <<EOSH > Cppsym
15031$startsh
15032if $test \$# -gt 0; then
15033 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15034 if $test -s Cppsym.got; then
15035 $rm -f Cppsym.got
15036 exit 0
15037 fi
15038 $rm -f Cppsym.got
15039 exit 1
15040else
15041 $tr " " "$trnl" | ./Cppsym.try
15042 exit 0
15043fi
15044EOSH
15045chmod +x Cppsym
15046$eunicefix Cppsym
15047cat <<EOSH > Cppsym.try
15048$startsh
15049cat <<'EOCP' > try.c
15050#include <stdio.h>
15051int main() {
15052EOCP
15053$awk \\
15054EOSH
15055cat <<'EOSH' >> Cppsym.try
15056'length($1) > 0 {
15057 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
15058 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
15059 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
15060 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
15061}' >> try.c
15062echo '}' >> try.c
15063EOSH
15064cat <<EOSH >> Cppsym.try
15065ccflags="$ccflags"
15066case "$osname-$gccversion" in
15067irix-) ccflags="\$ccflags -woff 1178" ;;
15068os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15069esac
7a282f6d 15070$cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
b4eb6b3d
JH
15071EOSH
15072chmod +x Cppsym.try
15073$eunicefix Cppsym.try
15074./Cppsym < Cppsym.know > Cppsym.true
15075: now check the C compiler for additional symbols
15076postprocess_cc_v=''
15077case "$osname" in
15078aix) postprocess_cc_v="|$tr , ' '" ;;
15079esac
15080$cat >ccsym <<EOS
15081$startsh
15082$cat >tmp.c <<EOF
15083extern int foo;
15084EOF
15085for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15086do
15087 case "\$i" in
15088 -D*) echo "\$i" | $sed 's/^-D//';;
15089 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15090 esac
15091done
15092$rm -f try.c
15093EOS
15094postprocess_cc_v=''
15095chmod +x ccsym
15096$eunicefix ccsym
15097./ccsym > ccsym1.raw
15098if $test -s ccsym1.raw; then
15099 $sort ccsym1.raw | $uniq >ccsym.raw
15100else
15101 mv ccsym1.raw ccsym.raw
15102fi
15103
15104$awk '/\=/ { print $0; next }
15105 { print $0"=1" }' ccsym.raw >ccsym.list
15106$awk '/\=/ { print $0; next }
15107 { print $0"=1" }' Cppsym.true >ccsym.true
15108$comm -13 ccsym.true ccsym.list >ccsym.own
15109$comm -12 ccsym.true ccsym.list >ccsym.com
15110$comm -23 ccsym.true ccsym.list >ccsym.cpp
15111also=''
15112if $test -z ccsym.raw; then
15113 echo "Your C compiler doesn't seem to define any symbols!" >&4
15114 echo " "
15115 echo "However, your C preprocessor defines the following symbols:"
15116 $cat Cppsym.true
15117 ccsymbols=''
15118 cppsymbols=`$cat Cppsym.true`
15119 cppsymbols=`echo $cppsymbols`
15120 cppccsymbols="$cppsymbols"
15121else
15122 if $test -s ccsym.com; then
15123 echo "Your C compiler and pre-processor define these symbols:"
15124 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15125 also='also '
15126 symbols='ones'
15127 cppccsymbols=`$cat ccsym.com`
15128 cppccsymbols=`echo $cppccsymbols`
15129 $test "$silent" || sleep 1
15130 fi
15131 if $test -s ccsym.cpp; then
15132 $test "$also" && echo " "
15133 echo "Your C pre-processor ${also}defines the following symbols:"
15134 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15135 also='further '
15136 cppsymbols=`$cat ccsym.cpp`
15137 cppsymbols=`echo $cppsymbols`
15138 $test "$silent" || sleep 1
15139 fi
15140 if $test -s ccsym.own; then
15141 $test "$also" && echo " "
15142 echo "Your C compiler ${also}defines the following cpp symbols:"
15143 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15144 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15145 ccsymbols=`$cat ccsym.own`
15146 ccsymbols=`echo $ccsymbols`
15147 $test "$silent" || sleep 1
15148 fi
15149fi
15150$rm -f ccsym* Cppsym.*
15151
15152: see if this is a termio system
15153val="$undef"
15154val2="$undef"
15155val3="$undef"
15156if $test `./findhdr termios.h`; then
15157 set tcsetattr i_termios
15158 eval $inlibc
15159 val3="$i_termios"
15160fi
15161echo " "
15162case "$val3" in
15163"$define") echo "You have POSIX termios.h... good!" >&4;;
15164*) if ./Cppsym pyr; then
15165 case "`/bin/universe`" in
15166 ucb) if $test `./findhdr sgtty.h`; then
15167 val2="$define"
15168 echo "<sgtty.h> found." >&4
15169 else
15170 echo "System is pyramid with BSD universe."
15171 echo "<sgtty.h> not found--you could have problems." >&4
15172 fi;;
15173 *) if $test `./findhdr termio.h`; then
15174 val="$define"
15175 echo "<termio.h> found." >&4
15176 else
15177 echo "System is pyramid with USG universe."
15178 echo "<termio.h> not found--you could have problems." >&4
15179 fi;;
15180 esac
15181 elif ./usg; then
15182 if $test `./findhdr termio.h`; then
15183 echo "<termio.h> found." >&4
15184 val="$define"
15185 elif $test `./findhdr sgtty.h`; then
15186 echo "<sgtty.h> found." >&4
15187 val2="$define"
15188 else
15189echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15190 fi
15191 else
15192 if $test `./findhdr sgtty.h`; then
15193 echo "<sgtty.h> found." >&4
15194 val2="$define"
15195 elif $test `./findhdr termio.h`; then
15196 echo "<termio.h> found." >&4
15197 val="$define"
15198 else
15199echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15200 fi
15201 fi;;
15202esac
15203set i_termio; eval $setvar
15204val=$val2; set i_sgtty; eval $setvar
15205val=$val3; set i_termios; eval $setvar
15206
15207: see if this is a shadow.h system
15208set shadow.h i_shadow
15209eval $inhdr
15210
b4eb6b3d
JH
15211: see if stddef is available
15212set stddef.h i_stddef
15213eval $inhdr
923fc586 15214
b4eb6b3d
JH
15215: see if this is a sunmath.h system
15216set sunmath.h i_sunmath
15217eval $inhdr
5f80c64f 15218
b4eb6b3d
JH
15219: see if sys/access.h is available
15220set sys/access.h i_sysaccess
15221eval $inhdr
15222
15223: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15224set sys/filio.h i_sysfilio
15225eval $inhdr
15226echo " "
15227if $test `./findhdr sys/ioctl.h`; then
15228 val="$define"
15229 echo '<sys/ioctl.h> found.' >&4
15230else
15231 val="$undef"
15232 if $test $i_sysfilio = "$define"; then
15233 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 15234 else
b4eb6b3d
JH
15235 $test $i_sgtty = "$define" && xxx="sgtty.h"
15236 $test $i_termio = "$define" && xxx="termio.h"
15237 $test $i_termios = "$define" && xxx="termios.h"
15238echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15239 fi
15240fi
15241set i_sysioctl
15242eval $setvar
15243
15244
15245: see if this is a syslog.h system
15246set syslog.h i_syslog
15247eval $inhdr
15248
15249
15250: see if this is a sys/mode.h system
15251set sys/mode.h i_sysmode
15252eval $inhdr
15253
15254: see if sys/resource.h has to be included
15255set sys/resource.h i_sysresrc
15256eval $inhdr
15257
15258: see if sys/security.h is available
15259set sys/security.h i_syssecrt
15260eval $inhdr
15261
15262: see if this is a sys/statvfs.h system
15263set sys/statvfs.h i_sysstatvfs
15264eval $inhdr
15265
15266: see if this is a sys/uio.h system
15267set sys/uio.h i_sysuio
15268eval $inhdr
15269
15270: see if this is a sys/un.h system
15271set sys/un.h i_sysun
15272eval $inhdr
15273
15274
15275: see if this is a sys/utsname.h system
15276set sys/utsname.h i_sysutsname
15277eval $inhdr
15278
15279: see if this is a syswait system
15280set sys/wait.h i_syswait
15281eval $inhdr
15282
15283: see if this is a ustat.h system
15284set ustat.h i_ustat
15285eval $inhdr
15286
15287: see if this is an utime system
15288set utime.h i_utime
15289eval $inhdr
15290
15291: see if this is a values.h system
15292set values.h i_values
15293eval $inhdr
15294
15295: see if this is a vfork system
15296case "$d_vfork" in
15297"$define")
15298 set vfork.h i_vfork
15299 eval $inhdr
15300 ;;
15301*)
15302 i_vfork="$undef"
15303 ;;
15304esac
15305
15306: see if gdbm.h is available
15307set gdbm.h t_gdbm
15308eval $inhdr
15309case "$t_gdbm" in
15310$define)
15311 : see if gdbm_open exists
15312 set gdbm_open d_gdbm_open
15313 eval $inlibc
15314 case "$d_gdbm_open" in
15315 $undef)
15316 t_gdbm="$undef"
15317 echo "We won't be including <gdbm.h>"
5f80c64f 15318 ;;
b4eb6b3d
JH
15319 esac
15320 ;;
15321esac
15322val="$t_gdbm"
15323set i_gdbm
15324eval $setvar
15325
15326echo " "
15327echo "Looking for extensions..." >&4
15328: If we are using the old config.sh, known_extensions may contain
15329: old or inaccurate or duplicate values.
15330known_extensions=''
15331nonxs_extensions=''
15332: We do not use find because it might not be available.
15333: We do not just use MANIFEST because the user may have dropped
15334: some additional extensions into the source tree and expect them
15335: to be built.
15336
15337: Function to recursively find available extensions, ignoring DynaLoader
15338: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15339find_extensions='
15340 for xxx in *; do
15341 case "$xxx" in
15342 DynaLoader|dynaload) ;;
15343 *)
15344 if $test -f $xxx/$xxx.xs; then
15345 known_extensions="$known_extensions $1$xxx";
15346 elif $test -f $xxx/Makefile.PL; then
15347 nonxs_extensions="$nonxs_extensions $1$xxx";
15348 else
15349 if $test -d $xxx -a $# -lt 10; then
15350 set $1$xxx/ $*;
15351 cd $xxx;
15352 eval $find_extensions;
15353 cd ..;
15354 shift;
15355 fi;
15356 fi
15357 ;;
15358 esac;
15359 done'
15360tdir=`pwd`
15361cd $rsrc/ext
15362set X
15363shift
15364eval $find_extensions
15365set X $nonxs_extensions
15366shift
15367nonxs_extensions="$*"
15368set X $known_extensions
15369shift
15370known_extensions="$*"
15371cd $tdir
15372
15373: Now see which are supported on this system.
15374avail_ext=''
15375for xxx in $known_extensions ; do
15376 case "$xxx" in
15377 DB_File|db_file)
15378 case "$i_db" in
15379 $define) avail_ext="$avail_ext $xxx" ;;
15380 esac
15381 ;;
15382 GDBM_File|gdbm_fil)
15383 case "$i_gdbm" in
15384 $define) avail_ext="$avail_ext $xxx" ;;
15385 esac
15386 ;;
15387 NDBM_File|ndbm_fil)
15388 case "$i_ndbm" in
15389 $define)
15390 case "$osname-$use64bitint" in
15391 hpux-define)
15392 case "$libs" in
15393 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15394 esac
15395 ;;
15396 *) avail_ext="$avail_ext $xxx" ;;
15397 esac
15398 ;;
15399 esac
15400 ;;
15401 ODBM_File|odbm_fil)
15402 case "${i_dbm}${i_rpcsvcdbm}" in
15403 *"${define}"*)
15404 case "$osname-$use64bitint" in
15405 hpux-define)
15406 case "$libs" in
15407 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15408 esac
15409 ;;
15410 *) avail_ext="$avail_ext $xxx" ;;
15411 esac
15412 ;;
15413 esac
15414 ;;
15415 POSIX|posix)
15416 case "$useposix" in
15417 true|define|y) avail_ext="$avail_ext $xxx" ;;
15418 esac
15419 ;;
15420 Opcode|opcode)
15421 case "$useopcode" in
15422 true|define|y) avail_ext="$avail_ext $xxx" ;;
15423 esac
15424 ;;
15425 Socket|socket)
15426 case "$d_socket" in
15427 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15428 esac
15429 ;;
15430 Sys/Syslog|sys/syslog)
15431 : XXX syslog requires socket
15432 case "$d_socket" in
15433 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15434 esac
15435 ;;
15436 Thread|thread)
15437 case "$usethreads" in
15438 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15439 esac
15440 ;;
15441 IPC/SysV|ipc/sysv)
15442 : XXX Do we need a useipcsysv variable here
15443 case "${d_msg}${d_sem}${d_shm}" in
15444 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15445 esac
15446 ;;
15447 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
15448 ;;
15449 esac
b4eb6b3d 15450done
5f80c64f 15451
b4eb6b3d
JH
15452set X $avail_ext
15453shift
15454avail_ext="$*"
5f80c64f 15455
b4eb6b3d
JH
15456: Now see which nonxs extensions are supported on this system.
15457: For now assume all are.
15458nonxs_ext=''
15459for xxx in $nonxs_extensions ; do
15460 case "$xxx" in
15461 *) nonxs_ext="$nonxs_ext $xxx"
15462 ;;
15463 esac
15464done
5f80c64f 15465
b4eb6b3d
JH
15466set X $nonxs_ext
15467shift
15468nonxs_ext="$*"
15469
15470case $usedl in
15471$define)
15472 $cat <<EOM
15473A number of extensions are supplied with $package. You may choose to
15474compile these extensions for dynamic loading (the default), compile
15475them into the $package executable (static loading), or not include
15476them at all. Answer "none" to include no extensions.
15477Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
15478
15479EOM
b4eb6b3d
JH
15480 case "$dynamic_ext" in
15481 '') dflt="$avail_ext" ;;
15482 *) dflt="$dynamic_ext"
15483 # Perhaps we are reusing an old out-of-date config.sh.
15484 case "$hint" in
15485 previous)
15486 if test X"$dynamic_ext" != X"$avail_ext"; then
15487 $cat <<EOM
15488NOTICE: Your previous config.sh list may be incorrect.
15489The extensions now available to you are
15490 ${avail_ext}
15491but the default list from your previous config.sh is
15492 ${dynamic_ext}
9c839522 15493
b4eb6b3d
JH
15494EOM
15495 fi
9c839522
PM
15496 ;;
15497 esac
b4eb6b3d
JH
15498 ;;
15499 esac
5f80c64f 15500 case "$dflt" in
b4eb6b3d
JH
15501 '') dflt=none;;
15502 esac
15503 rp="What extensions do you wish to load dynamically?"
15504 . ./myread
15505 case "$ans" in
15506 none) dynamic_ext=' ' ;;
15507 *) dynamic_ext="$ans" ;;
5f80c64f 15508 esac
5f80c64f 15509
b4eb6b3d
JH
15510 case "$static_ext" in
15511 '')
15512 : Exclude those already listed in dynamic linking
15513 dflt=''
15514 for xxx in $avail_ext; do
15515 case " $dynamic_ext " in
15516 *" $xxx "*) ;;
15517 *) dflt="$dflt $xxx" ;;
15518 esac
15519 done
15520 set X $dflt
15521 shift
15522 dflt="$*"
15523 ;;
15524 *) dflt="$static_ext"
15525 ;;
15526 esac
9c839522 15527
b4eb6b3d
JH
15528 case "$dflt" in
15529 '') dflt=none;;
15530 esac
15531 rp="What extensions do you wish to load statically?"
15532 . ./myread
15533 case "$ans" in
15534 none) static_ext=' ' ;;
15535 *) static_ext="$ans" ;;
15536 esac
15537 ;;
15538*)
15539 $cat <<EOM
15540A number of extensions are supplied with $package. Answer "none"
15541to include no extensions.
15542Note that DynaLoader is always built and need not be mentioned here.
9c839522 15543
b4eb6b3d
JH
15544EOM
15545 case "$static_ext" in
15546 '') dflt="$avail_ext" ;;
15547 *) dflt="$static_ext"
15548 # Perhaps we are reusing an old out-of-date config.sh.
15549 case "$hint" in
15550 previous)
15551 if test X"$static_ext" != X"$avail_ext"; then
15552 $cat <<EOM
15553NOTICE: Your previous config.sh list may be incorrect.
15554The extensions now available to you are
15555 ${avail_ext}
15556but the default list from your previous config.sh is
15557 ${static_ext}
5f80c64f
JH
15558
15559EOM
b4eb6b3d
JH
15560 fi
15561 ;;
15562 esac
15563 ;;
15564 esac
15565 : Exclude those that are not xs extensions
15566 case "$dflt" in
15567 '') dflt=none;;
15568 esac
15569 rp="What extensions do you wish to include?"
15570 . ./myread
15571 case "$ans" in
15572 none) static_ext=' ' ;;
15573 *) static_ext="$ans" ;;
15574 esac
15575 ;;
5f80c64f
JH
15576esac
15577
b4eb6b3d
JH
15578set X $dynamic_ext $static_ext $nonxs_ext
15579shift
15580extensions="$*"
15581
9c839522
PM
15582: Remove libraries needed only for extensions
15583: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
15584: The exception is SunOS 4.x, which needs them.
15585case "${osname}X${osvers}" in
15586sunos*X4*)
15587 perllibs="$libs"
15588 ;;
15589*) case "$usedl" in
15590 $define|true|[yY]*)
15591 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
15592 shift
15593 perllibs="$*"
15594 ;;
15595 *) perllibs="$libs"
15596 ;;
15597 esac
15598 ;;
9c839522 15599esac
5f80c64f
JH
15600
15601: Remove build directory name from cppstdin so it can be used from
15602: either the present location or the final installed location.
15603echo " "
15604: Get out of the UU directory to get correct path name.
15605cd ..
15606case "$cppstdin" in
15607`pwd`/cppstdin)
15608 echo "Stripping down cppstdin path name"
15609 cppstdin=cppstdin
15610 ;;
15611esac
15612cd UU
15613
15614: end of configuration questions
15615echo " "
15616echo "End of configuration questions."
15617echo " "
15618
15619: back to where it started
15620if test -d ../UU; then
15621 cd ..
15622fi
15623
15624: configuration may be patched via a 'config.over' file
15625if $test -f config.over; then
15626 echo " "
15627 dflt=y
15628 rp='I see a config.over file. Do you wish to load it?'
15629 . UU/myread
15630 case "$ans" in
15631 n*) echo "OK, I'll ignore it.";;
15632 *) . ./config.over
15633 echo "Configuration override changes have been loaded."
15634 ;;
15635 esac
15636fi
15637
15638: in case they want portability, strip down executable paths
15639case "$d_portable" in
15640"$define")
15641 echo " "
15642 echo "Stripping down executable paths..." >&4
15643 for file in $loclist $trylist; do
534ac15a
JH
15644 eval temp=\$$file
15645 eval $file=`basename $temp`
5f80c64f
JH
15646 done
15647 ;;
15648esac
15649
15650: create config.sh file
15651echo " "
15652echo "Creating config.sh..." >&4
15653$spitshell <<EOT >config.sh
15654$startsh
15655#
15656# This file was produced by running the Configure script. It holds all the
15657# definitions figured out by Configure. Should you modify one of these values,
15658# do not forget to propagate your changes by running "Configure -der". You may
15659# instead choose to run each of the .SH files by yourself, or "Configure -S".
15660#
15661
15662# Package name : $package
15663# Source directory : $src
15664# Configuration time: $cf_time
15665# Configured by : $cf_by
15666# Target system : $myuname
15667
15668Author='$Author'
15669Date='$Date'
15670Header='$Header'
15671Id='$Id'
15672Locker='$Locker'
15673Log='$Log'
15674Mcc='$Mcc'
15675RCSfile='$RCSfile'
15676Revision='$Revision'
15677Source='$Source'
15678State='$State'
15679_a='$_a'
15680_exe='$_exe'
15681_o='$_o'
b4eb6b3d
JH
15682afs='$afs'
15683alignbytes='$alignbytes'
15684ansi2knr='$ansi2knr'
15685aphostname='$aphostname'
15686api_revision='$api_revision'
15687api_subversion='$api_subversion'
15688api_version='$api_version'
15689api_versionstring='$api_versionstring'
5f80c64f 15690ar='$ar'
b4eb6b3d
JH
15691archlib='$archlib'
15692archlibexp='$archlibexp'
15693archname64='$archname64'
15694archname='$archname'
5f80c64f
JH
15695archobjs='$archobjs'
15696awk='$awk'
b4eb6b3d 15697baserev='$baserev'
5f80c64f 15698bash='$bash'
b4eb6b3d
JH
15699bin='$bin'
15700bincompat5005='$bincompat5005'
15701binexp='$binexp'
5f80c64f
JH
15702bison='$bison'
15703byacc='$byacc'
b4eb6b3d 15704byteorder='$byteorder'
5f80c64f 15705c='$c'
b4eb6b3d 15706castflags='$castflags'
5f80c64f
JH
15707cat='$cat'
15708cc='$cc'
15709cccdlflags='$cccdlflags'
15710ccdlflags='$ccdlflags'
15711ccflags='$ccflags'
b4eb6b3d 15712ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 15713ccname='$ccname'
b4eb6b3d 15714ccsymbols='$ccsymbols'
6b356c8e 15715ccversion='$ccversion'
5f80c64f 15716cf_by='$cf_by'
b4eb6b3d 15717cf_email='$cf_email'
5f80c64f 15718cf_time='$cf_time'
b4eb6b3d 15719charsize='$charsize'
5f80c64f
JH
15720chgrp='$chgrp'
15721chmod='$chmod'
15722chown='$chown'
b4eb6b3d 15723clocktype='$clocktype'
5f80c64f
JH
15724comm='$comm'
15725compress='$compress'
15726contains='$contains'
15727cp='$cp'
15728cpio='$cpio'
15729cpp='$cpp'
b4eb6b3d
JH
15730cpp_stuff='$cpp_stuff'
15731cppccsymbols='$cppccsymbols'
5f80c64f
JH
15732cppflags='$cppflags'
15733cpplast='$cpplast'
15734cppminus='$cppminus'
15735cpprun='$cpprun'
15736cppstdin='$cppstdin'
b4eb6b3d
JH
15737cppsymbols='$cppsymbols'
15738crosscompile='$crosscompile'
15739cryptlib='$cryptlib'
5f80c64f 15740csh='$csh'
b4eb6b3d
JH
15741d_Gconvert='$d_Gconvert'
15742d_PRIEUldbl='$d_PRIEUldbl'
15743d_PRIFUldbl='$d_PRIFUldbl'
15744d_PRIGUldbl='$d_PRIGUldbl'
15745d_PRIXU64='$d_PRIXU64'
15746d_PRId64='$d_PRId64'
15747d_PRIeldbl='$d_PRIeldbl'
15748d_PRIfldbl='$d_PRIfldbl'
15749d_PRIgldbl='$d_PRIgldbl'
15750d_PRIi64='$d_PRIi64'
15751d_PRIo64='$d_PRIo64'
15752d_PRIu64='$d_PRIu64'
15753d_PRIx64='$d_PRIx64'
15754d_SCNfldbl='$d_SCNfldbl'
74cac757 15755d__fwalk='$d__fwalk'
b4eb6b3d
JH
15756d_access='$d_access'
15757d_accessx='$d_accessx'
15758d_alarm='$d_alarm'
15759d_archlib='$d_archlib'
15760d_atolf='$d_atolf'
15761d_atoll='$d_atoll'
15762d_attribut='$d_attribut'
15763d_bcmp='$d_bcmp'
15764d_bcopy='$d_bcopy'
15765d_bincompat5005='$d_bincompat5005'
5f80c64f 15766d_bsd='$d_bsd'
b4eb6b3d
JH
15767d_bsdgetpgrp='$d_bsdgetpgrp'
15768d_bsdsetpgrp='$d_bsdsetpgrp'
15769d_bzero='$d_bzero'
15770d_casti32='$d_casti32'
15771d_castneg='$d_castneg'
15772d_charvspr='$d_charvspr'
15773d_chown='$d_chown'
15774d_chroot='$d_chroot'
15775d_chsize='$d_chsize'
15776d_closedir='$d_closedir'
15777d_const='$d_const'
15778d_crypt='$d_crypt'
15779d_csh='$d_csh'
15780d_cuserid='$d_cuserid'
15781d_dbl_dig='$d_dbl_dig'
15782d_difftime='$d_difftime'
15783d_dirnamlen='$d_dirnamlen'
15784d_dlerror='$d_dlerror'
5f80c64f 15785d_dlopen='$d_dlopen'
b4eb6b3d
JH
15786d_dlsymun='$d_dlsymun'
15787d_dosuid='$d_dosuid'
15788d_drand48proto='$d_drand48proto'
15789d_dup2='$d_dup2'
15790d_eaccess='$d_eaccess'
15791d_endgrent='$d_endgrent'
15792d_endhent='$d_endhent'
15793d_endnent='$d_endnent'
15794d_endpent='$d_endpent'
15795d_endpwent='$d_endpwent'
15796d_endsent='$d_endsent'
15797d_eofnblk='$d_eofnblk'
5f80c64f 15798d_eunice='$d_eunice'
b4eb6b3d
JH
15799d_fchmod='$d_fchmod'
15800d_fchown='$d_fchown'
15801d_fcntl='$d_fcntl'
9d9004a9 15802d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
15803d_fd_macros='$d_fd_macros'
15804d_fd_set='$d_fd_set'
15805d_fds_bits='$d_fds_bits'
15806d_fgetpos='$d_fgetpos'
15807d_flexfnam='$d_flexfnam'
15808d_flock='$d_flock'
15809d_fork='$d_fork'
15810d_fpathconf='$d_fpathconf'
15811d_fpos64_t='$d_fpos64_t'
15812d_frexpl='$d_frexpl'
15813d_fs_data_s='$d_fs_data_s'
15814d_fseeko='$d_fseeko'
15815d_fsetpos='$d_fsetpos'
15816d_fstatfs='$d_fstatfs'
15817d_fstatvfs='$d_fstatvfs'
411ab01c 15818d_fsync='$d_fsync'
b4eb6b3d
JH
15819d_ftello='$d_ftello'
15820d_ftime='$d_ftime'
15821d_getcwd='$d_getcwd'
15822d_getespwnam='$d_getespwnam'
15823d_getfsstat='$d_getfsstat'
15824d_getgrent='$d_getgrent'
15825d_getgrps='$d_getgrps'
15826d_gethbyaddr='$d_gethbyaddr'
15827d_gethbyname='$d_gethbyname'
15828d_gethent='$d_gethent'
15829d_gethname='$d_gethname'
15830d_gethostprotos='$d_gethostprotos'
15831d_getlogin='$d_getlogin'
15832d_getmnt='$d_getmnt'
15833d_getmntent='$d_getmntent'
15834d_getnbyaddr='$d_getnbyaddr'
15835d_getnbyname='$d_getnbyname'
15836d_getnent='$d_getnent'
15837d_getnetprotos='$d_getnetprotos'
0c0643d0 15838d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
15839d_getpbyname='$d_getpbyname'
15840d_getpbynumber='$d_getpbynumber'
15841d_getpent='$d_getpent'
15842d_getpgid='$d_getpgid'
15843d_getpgrp2='$d_getpgrp2'
15844d_getpgrp='$d_getpgrp'
15845d_getppid='$d_getppid'
15846d_getprior='$d_getprior'
15847d_getprotoprotos='$d_getprotoprotos'
15848d_getprpwnam='$d_getprpwnam'
15849d_getpwent='$d_getpwent'
15850d_getsbyname='$d_getsbyname'
15851d_getsbyport='$d_getsbyport'
15852d_getsent='$d_getsent'
15853d_getservprotos='$d_getservprotos'
15854d_getspnam='$d_getspnam'
15855d_gettimeod='$d_gettimeod'
5f80c64f 15856d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
15857d_grpasswd='$d_grpasswd'
15858d_hasmntopt='$d_hasmntopt'
15859d_htonl='$d_htonl'
15860d_iconv='$d_iconv'
15861d_index='$d_index'
15862d_inetaton='$d_inetaton'
15863d_int64_t='$d_int64_t'
15864d_isascii='$d_isascii'
15865d_isnan='$d_isnan'
15866d_isnanl='$d_isnanl'
15867d_killpg='$d_killpg'
15868d_lchown='$d_lchown'
15869d_ldbl_dig='$d_ldbl_dig'
15870d_link='$d_link'
15871d_locconv='$d_locconv'
15872d_lockf='$d_lockf'
15873d_longdbl='$d_longdbl'
15874d_longlong='$d_longlong'
15875d_lseekproto='$d_lseekproto'
15876d_lstat='$d_lstat'
15877d_madvise='$d_madvise'
15878d_mblen='$d_mblen'
15879d_mbstowcs='$d_mbstowcs'
15880d_mbtowc='$d_mbtowc'
15881d_memchr='$d_memchr'
15882d_memcmp='$d_memcmp'
15883d_memcpy='$d_memcpy'
15884d_memmove='$d_memmove'
15885d_memset='$d_memset'
15886d_mkdir='$d_mkdir'
15887d_mkdtemp='$d_mkdtemp'
15888d_mkfifo='$d_mkfifo'
15889d_mkstemp='$d_mkstemp'
15890d_mkstemps='$d_mkstemps'
15891d_mktime='$d_mktime'
15892d_mmap='$d_mmap'
15893d_modfl='$d_modfl'
15894d_mprotect='$d_mprotect'
15895d_msg='$d_msg'
15896d_msg_ctrunc='$d_msg_ctrunc'
15897d_msg_dontroute='$d_msg_dontroute'
15898d_msg_oob='$d_msg_oob'
15899d_msg_peek='$d_msg_peek'
15900d_msg_proxy='$d_msg_proxy'
15901d_msgctl='$d_msgctl'
15902d_msgget='$d_msgget'
15903d_msgrcv='$d_msgrcv'
15904d_msgsnd='$d_msgsnd'
15905d_msync='$d_msync'
15906d_munmap='$d_munmap'
15907d_mymalloc='$d_mymalloc'
15908d_nice='$d_nice'
15909d_nv_preserves_uv='$d_nv_preserves_uv'
15910d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15911d_off64_t='$d_off64_t'
15912d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15913d_oldpthreads='$d_oldpthreads'
15914d_oldsock='$d_oldsock'
15915d_open3='$d_open3'
15916d_pathconf='$d_pathconf'
15917d_pause='$d_pause'
15918d_perl_otherlibdirs='$d_perl_otherlibdirs'
15919d_phostname='$d_phostname'
15920d_pipe='$d_pipe'
15921d_poll='$d_poll'
5f80c64f 15922d_portable='$d_portable'
b4eb6b3d
JH
15923d_pthread_yield='$d_pthread_yield'
15924d_pwage='$d_pwage'
15925d_pwchange='$d_pwchange'
15926d_pwclass='$d_pwclass'
15927d_pwcomment='$d_pwcomment'
15928d_pwexpire='$d_pwexpire'
15929d_pwgecos='$d_pwgecos'
15930d_pwpasswd='$d_pwpasswd'
15931d_pwquota='$d_pwquota'
15932d_qgcvt='$d_qgcvt'
15933d_quad='$d_quad'
15934d_readdir='$d_readdir'
15935d_readlink='$d_readlink'
15936d_rename='$d_rename'
15937d_rewinddir='$d_rewinddir'
15938d_rmdir='$d_rmdir'
15939d_safebcpy='$d_safebcpy'
15940d_safemcpy='$d_safemcpy'
15941d_sanemcmp='$d_sanemcmp'
ef9f17be 15942d_sbrkproto='$d_sbrkproto'
b4eb6b3d
JH
15943d_sched_yield='$d_sched_yield'
15944d_scm_rights='$d_scm_rights'
15945d_seekdir='$d_seekdir'
15946d_select='$d_select'
15947d_sem='$d_sem'
15948d_semctl='$d_semctl'
15949d_semctl_semid_ds='$d_semctl_semid_ds'
15950d_semctl_semun='$d_semctl_semun'
15951d_semget='$d_semget'
15952d_semop='$d_semop'
15953d_setegid='$d_setegid'
15954d_seteuid='$d_seteuid'
15955d_setgrent='$d_setgrent'
15956d_setgrps='$d_setgrps'
15957d_sethent='$d_sethent'
15958d_setlinebuf='$d_setlinebuf'
15959d_setlocale='$d_setlocale'
15960d_setnent='$d_setnent'
15961d_setpent='$d_setpent'
15962d_setpgid='$d_setpgid'
15963d_setpgrp2='$d_setpgrp2'
15964d_setpgrp='$d_setpgrp'
15965d_setprior='$d_setprior'
15966d_setproctitle='$d_setproctitle'
15967d_setpwent='$d_setpwent'
15968d_setregid='$d_setregid'
15969d_setresgid='$d_setresgid'
15970d_setresuid='$d_setresuid'
15971d_setreuid='$d_setreuid'
15972d_setrgid='$d_setrgid'
15973d_setruid='$d_setruid'
15974d_setsent='$d_setsent'
15975d_setsid='$d_setsid'
15976d_setvbuf='$d_setvbuf'
15977d_sfio='$d_sfio'
15978d_shm='$d_shm'
15979d_shmat='$d_shmat'
15980d_shmatprototype='$d_shmatprototype'
15981d_shmctl='$d_shmctl'
15982d_shmdt='$d_shmdt'
15983d_shmget='$d_shmget'
15984d_sigaction='$d_sigaction'
15985d_sigsetjmp='$d_sigsetjmp'
15986d_socket='$d_socket'
15987d_socklen_t='$d_socklen_t'
15988d_sockpair='$d_sockpair'
15989d_socks5_init='$d_socks5_init'
15990d_sqrtl='$d_sqrtl'
15991d_statblks='$d_statblks'
15992d_statfs_f_flags='$d_statfs_f_flags'
15993d_statfs_s='$d_statfs_s'
15994d_statvfs='$d_statvfs'
15995d_stdio_cnt_lval='$d_stdio_cnt_lval'
15996d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
15997d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
15998d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
15999d_stdio_stream_array='$d_stdio_stream_array'
16000d_stdiobase='$d_stdiobase'
16001d_stdstdio='$d_stdstdio'
16002d_strchr='$d_strchr'
16003d_strcoll='$d_strcoll'
16004d_strctcpy='$d_strctcpy'
16005d_strerrm='$d_strerrm'
16006d_strerror='$d_strerror'
16007d_strtod='$d_strtod'
16008d_strtol='$d_strtol'
16009d_strtold='$d_strtold'
16010d_strtoll='$d_strtoll'
d0e6d399 16011d_strtoq='$d_strtoq'
b4eb6b3d
JH
16012d_strtoul='$d_strtoul'
16013d_strtoull='$d_strtoull'
16014d_strtouq='$d_strtouq'
16015d_strxfrm='$d_strxfrm'
16016d_suidsafe='$d_suidsafe'
16017d_symlink='$d_symlink'
16018d_syscall='$d_syscall'
16019d_sysconf='$d_sysconf'
16020d_sysernlst='$d_sysernlst'
16021d_syserrlst='$d_syserrlst'
16022d_system='$d_system'
16023d_tcgetpgrp='$d_tcgetpgrp'
16024d_tcsetpgrp='$d_tcsetpgrp'
16025d_telldir='$d_telldir'
16026d_telldirproto='$d_telldirproto'
16027d_time='$d_time'
16028d_times='$d_times'
16029d_truncate='$d_truncate'
16030d_tzname='$d_tzname'
16031d_umask='$d_umask'
16032d_uname='$d_uname'
16033d_union_semun='$d_union_semun'
16034d_ustat='$d_ustat'
16035d_vendorarch='$d_vendorarch'
16036d_vendorbin='$d_vendorbin'
16037d_vendorlib='$d_vendorlib'
16038d_vfork='$d_vfork'
16039d_void_closedir='$d_void_closedir'
16040d_voidsig='$d_voidsig'
16041d_voidtty='$d_voidtty'
16042d_volatile='$d_volatile'
16043d_vprintf='$d_vprintf'
16044d_wait4='$d_wait4'
16045d_waitpid='$d_waitpid'
16046d_wcstombs='$d_wcstombs'
16047d_wctomb='$d_wctomb'
5f80c64f
JH
16048d_xenix='$d_xenix'
16049date='$date'
b4eb6b3d
JH
16050db_hashtype='$db_hashtype'
16051db_prefixtype='$db_prefixtype'
16052defvoidused='$defvoidused'
16053direntrytype='$direntrytype'
16054dlext='$dlext'
5f80c64f 16055dlsrc='$dlsrc'
b4eb6b3d
JH
16056doublesize='$doublesize'
16057drand01='$drand01'
16058dynamic_ext='$dynamic_ext'
16059eagain='$eagain'
16060ebcdic='$ebcdic'
5f80c64f
JH
16061echo='$echo'
16062egrep='$egrep'
16063emacs='$emacs'
16064eunicefix='$eunicefix'
16065exe_ext='$exe_ext'
16066expr='$expr'
b4eb6b3d
JH
16067extensions='$extensions'
16068fflushNULL='$fflushNULL'
16069fflushall='$fflushall'
5f80c64f
JH
16070find='$find'
16071firstmakefile='$firstmakefile'
16072flex='$flex'
b4eb6b3d
JH
16073fpossize='$fpossize'
16074fpostype='$fpostype'
16075freetype='$freetype'
16076full_ar='$full_ar'
16077full_csh='$full_csh'
16078full_sed='$full_sed'
5b463ca7 16079gccosandvers='$gccosandvers'
5f80c64f 16080gccversion='$gccversion'
b4eb6b3d
JH
16081gidformat='$gidformat'
16082gidsign='$gidsign'
16083gidsize='$gidsize'
16084gidtype='$gidtype'
5f80c64f
JH
16085glibpth='$glibpth'
16086grep='$grep'
b4eb6b3d
JH
16087groupcat='$groupcat'
16088groupstype='$groupstype'
5f80c64f 16089gzip='$gzip'
b4eb6b3d
JH
16090h_fcntl='$h_fcntl'
16091h_sysfile='$h_sysfile'
5f80c64f 16092hint='$hint'
b4eb6b3d
JH
16093hostcat='$hostcat'
16094i16size='$i16size'
16095i16type='$i16type'
16096i32size='$i32size'
16097i32type='$i32type'
16098i64size='$i64size'
16099i64type='$i64type'
16100i8size='$i8size'
16101i8type='$i8type'
16102i_arpainet='$i_arpainet'
16103i_bsdioctl='$i_bsdioctl'
16104i_db='$i_db'
16105i_dbm='$i_dbm'
16106i_dirent='$i_dirent'
5f80c64f 16107i_dld='$i_dld'
b4eb6b3d
JH
16108i_dlfcn='$i_dlfcn'
16109i_fcntl='$i_fcntl'
16110i_float='$i_float'
16111i_gdbm='$i_gdbm'
16112i_grp='$i_grp'
16113i_iconv='$i_iconv'
16114i_ieeefp='$i_ieeefp'
16115i_inttypes='$i_inttypes'
16116i_libutil='$i_libutil'
16117i_limits='$i_limits'
16118i_locale='$i_locale'
16119i_machcthr='$i_machcthr'
16120i_malloc='$i_malloc'
16121i_math='$i_math'
16122i_memory='$i_memory'
16123i_mntent='$i_mntent'
16124i_ndbm='$i_ndbm'
16125i_netdb='$i_netdb'
16126i_neterrno='$i_neterrno'
16127i_netinettcp='$i_netinettcp'
16128i_niin='$i_niin'
16129i_poll='$i_poll'
16130i_prot='$i_prot'
16131i_pthread='$i_pthread'
16132i_pwd='$i_pwd'
16133i_rpcsvcdbm='$i_rpcsvcdbm'
16134i_sfio='$i_sfio'
16135i_sgtty='$i_sgtty'
16136i_shadow='$i_shadow'
16137i_socks='$i_socks'
16138i_stdarg='$i_stdarg'
16139i_stddef='$i_stddef'
16140i_stdlib='$i_stdlib'
16141i_string='$i_string'
16142i_sunmath='$i_sunmath'
16143i_sysaccess='$i_sysaccess'
16144i_sysdir='$i_sysdir'
16145i_sysfile='$i_sysfile'
16146i_sysfilio='$i_sysfilio'
16147i_sysin='$i_sysin'
16148i_sysioctl='$i_sysioctl'
16149i_syslog='$i_syslog'
16150i_sysmman='$i_sysmman'
16151i_sysmode='$i_sysmode'
16152i_sysmount='$i_sysmount'
16153i_sysndir='$i_sysndir'
16154i_sysparam='$i_sysparam'
16155i_sysresrc='$i_sysresrc'
16156i_syssecrt='$i_syssecrt'
16157i_sysselct='$i_sysselct'
16158i_syssockio='$i_syssockio'
16159i_sysstat='$i_sysstat'
16160i_sysstatfs='$i_sysstatfs'
16161i_sysstatvfs='$i_sysstatvfs'
16162i_systime='$i_systime'
16163i_systimek='$i_systimek'
16164i_systimes='$i_systimes'
16165i_systypes='$i_systypes'
16166i_sysuio='$i_sysuio'
16167i_sysun='$i_sysun'
16168i_sysutsname='$i_sysutsname'
16169i_sysvfs='$i_sysvfs'
16170i_syswait='$i_syswait'
16171i_termio='$i_termio'
16172i_termios='$i_termios'
16173i_time='$i_time'
16174i_unistd='$i_unistd'
16175i_ustat='$i_ustat'
16176i_utime='$i_utime'
16177i_values='$i_values'
16178i_varargs='$i_varargs'
16179i_varhdr='$i_varhdr'
16180i_vfork='$i_vfork'
5f80c64f 16181ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
16182inc_version_list='$inc_version_list'
16183inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
16184incpath='$incpath'
16185inews='$inews'
b4eb6b3d
JH
16186installarchlib='$installarchlib'
16187installbin='$installbin'
16188installman1dir='$installman1dir'
16189installman3dir='$installman3dir'
16190installprefix='$installprefix'
16191installprefixexp='$installprefixexp'
16192installprivlib='$installprivlib'
16193installscript='$installscript'
16194installsitearch='$installsitearch'
16195installsitebin='$installsitebin'
16196installsitelib='$installsitelib'
16197installstyle='$installstyle'
16198installusrbinperl='$installusrbinperl'
16199installvendorarch='$installvendorarch'
16200installvendorbin='$installvendorbin'
16201installvendorlib='$installvendorlib'
16202intsize='$intsize'
16203ivdformat='$ivdformat'
16204ivsize='$ivsize'
16205ivtype='$ivtype'
16206known_extensions='$known_extensions'
5f80c64f 16207ksh='$ksh'
5f80c64f
JH
16208ld='$ld'
16209lddlflags='$lddlflags'
16210ldflags='$ldflags'
b4eb6b3d
JH
16211ldflags_uselargefiles='$ldflags_uselargefiles'
16212ldlibpthname='$ldlibpthname'
5f80c64f
JH
16213less='$less'
16214lib_ext='$lib_ext'
16215libc='$libc'
b4eb6b3d 16216libperl='$libperl'
5f80c64f
JH
16217libpth='$libpth'
16218libs='$libs'
43999f95
JH
16219libsdirs='$libsdirs'
16220libsfiles='$libsfiles'
16221libsfound='$libsfound'
13b3f787 16222libspath='$libspath'
5f80c64f 16223libswanted='$libswanted'
b4eb6b3d 16224libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
16225line='$line'
16226lint='$lint'
16227lkflags='$lkflags'
16228ln='$ln'
16229lns='$lns'
16230locincpth='$locincpth'
16231loclibpth='$loclibpth'
b4eb6b3d
JH
16232longdblsize='$longdblsize'
16233longlongsize='$longlongsize'
16234longsize='$longsize'
5f80c64f
JH
16235lp='$lp'
16236lpr='$lpr'
16237ls='$ls'
b4eb6b3d
JH
16238lseeksize='$lseeksize'
16239lseektype='$lseektype'
5f80c64f
JH
16240mail='$mail'
16241mailx='$mailx'
16242make='$make'
16243make_set_make='$make_set_make'
b4eb6b3d
JH
16244mallocobj='$mallocobj'
16245mallocsrc='$mallocsrc'
16246malloctype='$malloctype'
16247man1dir='$man1dir'
16248man1direxp='$man1direxp'
16249man1ext='$man1ext'
16250man3dir='$man3dir'
16251man3direxp='$man3direxp'
16252man3ext='$man3ext'
5f80c64f
JH
16253mips_type='$mips_type'
16254mkdir='$mkdir'
b4eb6b3d
JH
16255mmaptype='$mmaptype'
16256modetype='$modetype'
5f80c64f 16257more='$more'
b4eb6b3d 16258multiarch='$multiarch'
5f80c64f 16259mv='$mv'
b4eb6b3d
JH
16260myarchname='$myarchname'
16261mydomain='$mydomain'
16262myhostname='$myhostname'
5f80c64f
JH
16263myuname='$myuname'
16264n='$n'
2cc61e15 16265need_va_copy='$need_va_copy'
b4eb6b3d
JH
16266netdb_hlen_type='$netdb_hlen_type'
16267netdb_host_type='$netdb_host_type'
16268netdb_name_type='$netdb_name_type'
16269netdb_net_type='$netdb_net_type'
5f80c64f
JH
16270nm='$nm'
16271nm_opt='$nm_opt'
16272nm_so_opt='$nm_so_opt'
b4eb6b3d 16273nonxs_ext='$nonxs_ext'
5f80c64f 16274nroff='$nroff'
b4eb6b3d
JH
16275nvEUformat='$nvEUformat'
16276nvFUformat='$nvFUformat'
16277nvGUformat='$nvGUformat'
16278nveformat='$nveformat'
16279nvfformat='$nvfformat'
16280nvgformat='$nvgformat'
16281nvsize='$nvsize'
16282nvtype='$nvtype'
16283o_nonblock='$o_nonblock'
5f80c64f 16284obj_ext='$obj_ext'
b4eb6b3d 16285old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 16286optimize='$optimize'
b4eb6b3d 16287orderlib='$orderlib'
5f80c64f
JH
16288osname='$osname'
16289osvers='$osvers'
b4eb6b3d 16290otherlibdirs='$otherlibdirs'
5f80c64f 16291package='$package'
b4eb6b3d
JH
16292pager='$pager'
16293passcat='$passcat'
16294patchlevel='$patchlevel'
5f80c64f 16295path_sep='$path_sep'
b4eb6b3d 16296perl5='$perl5'
5f80c64f 16297perl='$perl'
b4eb6b3d 16298perladmin='$perladmin'
9c839522 16299perllibs='$perllibs'
b4eb6b3d 16300perlpath='$perlpath'
5f80c64f 16301pg='$pg'
b4eb6b3d
JH
16302phostname='$phostname'
16303pidtype='$pidtype'
5f80c64f 16304plibpth='$plibpth'
b4eb6b3d 16305pm_apiversion='$pm_apiversion'
5f80c64f
JH
16306pmake='$pmake'
16307pr='$pr'
b4eb6b3d
JH
16308prefix='$prefix'
16309prefixexp='$prefixexp'
16310privlib='$privlib'
16311privlibexp='$privlibexp'
16312prototype='$prototype'
16313ptrsize='$ptrsize'
16314quadkind='$quadkind'
16315quadtype='$quadtype'
16316randbits='$randbits'
16317randfunc='$randfunc'
16318randseedtype='$randseedtype'
16319ranlib='$ranlib'
16320rd_nodata='$rd_nodata'
16321revision='$revision'
5f80c64f
JH
16322rm='$rm'
16323rmail='$rmail'
16324runnm='$runnm'
b4eb6b3d
JH
16325sPRIEUldbl='$sPRIEUldbl'
16326sPRIFUldbl='$sPRIFUldbl'
16327sPRIGUldbl='$sPRIGUldbl'
16328sPRIXU64='$sPRIXU64'
16329sPRId64='$sPRId64'
16330sPRIeldbl='$sPRIeldbl'
16331sPRIfldbl='$sPRIfldbl'
16332sPRIgldbl='$sPRIgldbl'
16333sPRIi64='$sPRIi64'
16334sPRIo64='$sPRIo64'
16335sPRIu64='$sPRIu64'
16336sPRIx64='$sPRIx64'
16337sSCNfldbl='$sSCNfldbl'
16338sched_yield='$sched_yield'
16339scriptdir='$scriptdir'
16340scriptdirexp='$scriptdirexp'
5f80c64f 16341sed='$sed'
b4eb6b3d
JH
16342seedfunc='$seedfunc'
16343selectminbits='$selectminbits'
16344selecttype='$selecttype'
5f80c64f
JH
16345sendmail='$sendmail'
16346sh='$sh'
16347shar='$shar'
16348sharpbang='$sharpbang'
b4eb6b3d
JH
16349shmattype='$shmattype'
16350shortsize='$shortsize'
16351shrpenv='$shrpenv'
5f80c64f 16352shsharp='$shsharp'
b4eb6b3d
JH
16353sig_count='$sig_count'
16354sig_name='$sig_name'
16355sig_name_init='$sig_name_init'
16356sig_num='$sig_num'
16357sig_num_init='$sig_num_init'
16358signal_t='$signal_t'
16359sitearch='$sitearch'
16360sitearchexp='$sitearchexp'
16361sitebin='$sitebin'
16362sitebinexp='$sitebinexp'
16363sitelib='$sitelib'
16364sitelib_stem='$sitelib_stem'
16365sitelibexp='$sitelibexp'
16366siteprefix='$siteprefix'
16367siteprefixexp='$siteprefixexp'
16368sizesize='$sizesize'
16369sizetype='$sizetype'
5f80c64f
JH
16370sleep='$sleep'
16371smail='$smail'
5f80c64f 16372so='$so'
b4eb6b3d
JH
16373sockethdr='$sockethdr'
16374socketlib='$socketlib'
16375socksizetype='$socksizetype'
5f80c64f
JH
16376sort='$sort'
16377spackage='$spackage'
16378spitshell='$spitshell'
5f80c64f 16379src='$src'
b4eb6b3d
JH
16380ssizetype='$ssizetype'
16381startperl='$startperl'
5f80c64f 16382startsh='$startsh'
b4eb6b3d
JH
16383static_ext='$static_ext'
16384stdchar='$stdchar'
16385stdio_base='$stdio_base'
16386stdio_bufsiz='$stdio_bufsiz'
16387stdio_cnt='$stdio_cnt'
16388stdio_filbuf='$stdio_filbuf'
16389stdio_ptr='$stdio_ptr'
16390stdio_stream_array='$stdio_stream_array'
16391strings='$strings'
5f80c64f 16392submit='$submit'
b4eb6b3d
JH
16393subversion='$subversion'
16394sysman='$sysman'
5f80c64f
JH
16395tail='$tail'
16396tar='$tar'
16397tbl='$tbl'
16398tee='$tee'
16399test='$test'
b4eb6b3d
JH
16400timeincl='$timeincl'
16401timetype='$timetype'
5f80c64f
JH
16402touch='$touch'
16403tr='$tr'
16404trnl='$trnl'
16405troff='$troff'
b4eb6b3d
JH
16406u16size='$u16size'
16407u16type='$u16type'
16408u32size='$u32size'
16409u32type='$u32type'
16410u64size='$u64size'
16411u64type='$u64type'
16412u8size='$u8size'
16413u8type='$u8type'
16414uidformat='$uidformat'
16415uidsign='$uidsign'
16416uidsize='$uidsize'
16417uidtype='$uidtype'
5f80c64f
JH
16418uname='$uname'
16419uniq='$uniq'
b4eb6b3d
JH
16420uquadtype='$uquadtype'
16421use5005threads='$use5005threads'
16422use64bitall='$use64bitall'
16423use64bitint='$use64bitint'
5f80c64f 16424usedl='$usedl'
b4eb6b3d
JH
16425useithreads='$useithreads'
16426uselargefiles='$uselargefiles'
16427uselongdouble='$uselongdouble'
16428usemorebits='$usemorebits'
16429usemultiplicity='$usemultiplicity'
16430usemymalloc='$usemymalloc'
5f80c64f 16431usenm='$usenm'
b4eb6b3d
JH
16432useopcode='$useopcode'
16433useperlio='$useperlio'
16434useposix='$useposix'
16435usesfio='$usesfio'
16436useshrplib='$useshrplib'
29209bc5 16437usesocks='$usesocks'
b4eb6b3d
JH
16438usethreads='$usethreads'
16439usevendorprefix='$usevendorprefix'
16440usevfork='$usevfork'
5f80c64f
JH
16441usrinc='$usrinc'
16442uuname='$uuname'
b4eb6b3d
JH
16443uvXUformat='$uvXUformat'
16444uvoformat='$uvoformat'
16445uvsize='$uvsize'
16446uvtype='$uvtype'
16447uvuformat='$uvuformat'
16448uvxformat='$uvxformat'
16449vendorarch='$vendorarch'
16450vendorarchexp='$vendorarchexp'
16451vendorbin='$vendorbin'
16452vendorbinexp='$vendorbinexp'
16453vendorlib='$vendorlib'
16454vendorlib_stem='$vendorlib_stem'
16455vendorlibexp='$vendorlibexp'
16456vendorprefix='$vendorprefix'
16457vendorprefixexp='$vendorprefixexp'
16458version='$version'
d56c5707 16459versiononly='$versiononly'
5f80c64f 16460vi='$vi'
b4eb6b3d 16461voidflags='$voidflags'
5f80c64f 16462xlibpth='$xlibpth'
b4eb6b3d 16463xs_apiversion='$xs_apiversion'
5f80c64f
JH
16464zcat='$zcat'
16465zip='$zip'
16466EOT
16467
16468: Add in command line options if available
16469$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16470
16471: add special variables
16472$test -f $src/patchlevel.h && \
d00b958f 16473awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
2000072c 16474echo "CONFIGDOTSH=true" >>config.sh
5f80c64f
JH
16475
16476: propagate old symbols
16477if $test -f UU/config.sh; then
381aa1ff 16478 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 16479 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 16480 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
16481 set X `cat UU/oldsyms`
16482 shift
16483 case $# in
16484 0) ;;
16485 *)
16486 cat <<EOM
16487Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16488EOM
16489 echo "# Variables propagated from previous config.sh file." >>config.sh
16490 for sym in `cat UU/oldsyms`; do
16491 echo " Propagating $hint variable "'$'"$sym..."
16492 eval 'tmp="$'"${sym}"'"'
16493 echo "$tmp" | \
16494 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16495 done
16496 ;;
16497 esac
16498fi
16499
16500: Finish up by extracting the .SH files
16501case "$alldone" in
16502exit)
16503 $rm -rf UU
16504 echo "Done."
16505 exit 0
16506 ;;
16507cont)
16508 ;;
16509'')
16510 dflt=''
16511 nostick=true
16512 $cat <<EOM
16513
16514If you'd like to make any changes to the config.sh file before I begin
16515to configure things, do it as a shell escape now (e.g. !vi config.sh).
16516
16517EOM
16518 rp="Press return or use a shell escape to edit config.sh:"
16519 . UU/myread
16520 nostick=''
16521 case "$ans" in
16522 '') ;;
16523 *) : in case they cannot read
16524 sh 1>&4 -c "$ans";;
16525 esac
16526 ;;
16527esac
16528
16529: if this fails, just run all the .SH files by hand
16530. ./config.sh
16531
16532echo " "
16533exec 1>&4
16534. ./UU/extract
16535
16536if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16537 dflt=y
16538 case "$silent" in
16539 true) ;;
16540 *)
16541 $cat <<EOM
16542
16543Now you need to generate make dependencies by running "$make depend".
16544You might prefer to run it in background: "$make depend > makedepend.out &"
16545It can take a while, so you might not want to run it right now.
16546
16547EOM
16548 ;;
16549 esac
16550 rp="Run $make depend now?"
16551 . UU/myread
16552 case "$ans" in
16553 y*)
3d5d58b1 16554 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
16555 ;;
16556 *)
16557 echo "You must run '$make depend' then '$make'."
16558 ;;
16559 esac
16560elif test -f [Mm]akefile; then
16561 echo " "
16562 echo "Now you must run a $make."
16563else
16564 echo "Done."
16565fi
16566
16567if $test -f Policy.sh; then
16568 $cat <<EOM
16569
16570If you compile $package on a different machine or from a different object
16571directory, copy the Policy.sh file from this object directory to the
16572new one before you run Configure -- this will help you with most of
16573the policy defaults.
16574
16575EOM
16576fi
16577if $test -f config.msg; then
16578 echo "Hmm. I also noted the following information while running:"
16579 echo " "
16580 $cat config.msg >&4
16581 $rm -f config.msg
16582fi
16583$rm -f kit*isdone ark*isdone
16584$rm -rf UU
16585
16586: End of Configure
16587