This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
faster and 64 bit preserving arithmetic
[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#
283fdd21 23# Generated on Wed Dec 13 17:45:13 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=''
565d_strtoul=''
566d_strtoull=''
567d_strtouq=''
568d_strxfrm=''
569d_symlink=''
570d_syscall=''
571d_sysconf=''
572d_system=''
573d_tcgetpgrp=''
574d_tcsetpgrp=''
575d_telldirproto=''
576d_time=''
577timetype=''
578clocktype=''
579d_times=''
580d_truncate=''
581d_tzname=''
582d_umask=''
583d_semctl_semid_ds=''
584d_semctl_semun=''
585d_union_semun=''
586d_ustat=''
587d_vfork=''
588usevfork=''
589d_voidsig=''
590signal_t=''
591d_volatile=''
592d_charvspr=''
593d_vprintf=''
594d_wait4=''
595d_waitpid=''
596d_wcstombs=''
597d_wctomb=''
598dlext=''
85e6fe83
LW
599cccdlflags=''
600ccdlflags=''
2304df62 601dlsrc=''
232e078e 602ld=''
85e6fe83 603lddlflags=''
2304df62 604usedl=''
b4eb6b3d
JH
605doublesize=''
606ebcdic=''
607fflushNULL=''
608fflushall=''
609fpossize=''
610fpostype=''
5b463ca7 611gccosandvers=''
8a27cf78 612gccversion=''
b4eb6b3d
JH
613gidformat=''
614gidsign=''
615gidsize=''
616gidtype=''
617groupstype=''
618h_fcntl=''
619h_sysfile=''
620i_arpainet=''
621db_hashtype=''
622db_prefixtype=''
623i_db=''
624i_dbm=''
625i_rpcsvcdbm=''
626d_dirnamlen=''
627direntrytype=''
628i_dirent=''
a0d0e21e 629i_dld=''
b4eb6b3d
JH
630i_dlfcn=''
631i_fcntl=''
632i_float=''
633i_gdbm=''
634d_grpasswd=''
635i_grp=''
636i_iconv=''
637i_ieeefp=''
638i_inttypes=''
639i_libutil=''
640i_limits=''
641i_locale=''
642i_machcthr=''
643i_malloc=''
644i_math=''
645i_memory=''
646i_mntent=''
647i_ndbm=''
648i_netdb=''
649i_neterrno=''
650i_netinettcp=''
651i_niin=''
652i_sysin=''
653i_poll=''
654i_prot=''
655i_pthread=''
656d_pwage=''
657d_pwchange=''
658d_pwclass=''
659d_pwcomment=''
660d_pwexpire=''
661d_pwgecos=''
662d_pwpasswd=''
663d_pwquota=''
664i_pwd=''
665i_sfio=''
666i_shadow=''
667i_socks=''
668i_stddef=''
669i_stdlib=''
670i_string=''
671strings=''
672i_sunmath=''
673i_sysaccess=''
674i_sysdir=''
675i_sysfile=''
676d_voidtty=''
677i_bsdioctl=''
678i_sysfilio=''
679i_sysioctl=''
680i_syssockio=''
681i_syslog=''
682i_sysmman=''
683i_sysmode=''
684i_sysmount=''
685i_sysndir=''
686i_sysparam=''
687i_sysresrc=''
688i_syssecrt=''
689i_sysselct=''
690i_sysstat=''
691i_sysstatfs=''
692i_sysstatvfs=''
693i_systimes=''
694i_systypes=''
695i_sysuio=''
696i_sysun=''
697i_sysutsname=''
698i_sysvfs=''
699i_syswait=''
700i_sgtty=''
701i_termio=''
702i_termios=''
703i_systime=''
704i_systimek=''
705i_time=''
706timeincl=''
707i_unistd=''
708i_ustat=''
709i_utime=''
710i_values=''
711i_stdarg=''
712i_varargs=''
713i_varhdr=''
714i_vfork=''
715inc_version_list=''
716inc_version_list_init=''
717installprefix=''
718installprefixexp=''
719installstyle=''
720installusrbinperl=''
721intsize=''
722longsize=''
723shortsize=''
2304df62 724libc=''
b4eb6b3d
JH
725ldlibpthname=''
726libperl=''
727shrpenv=''
728useshrplib=''
a0d0e21e 729glibpth=''
2304df62 730libpth=''
8e07c86e 731loclibpth=''
2304df62
AD
732plibpth=''
733xlibpth=''
1cfa4ec7 734ignore_versioned_solibs=''
2304df62 735libs=''
43999f95
JH
736libsdirs=''
737libsfiles=''
738libsfound=''
13b3f787 739libspath=''
85e6fe83 740lns=''
b4eb6b3d
JH
741d_PRIEUldbl=''
742d_PRIFUldbl=''
743d_PRIGUldbl=''
744d_PRIeldbl=''
745d_PRIfldbl=''
746d_PRIgldbl=''
747d_SCNfldbl=''
748sPRIEUldbl=''
749sPRIFUldbl=''
750sPRIGUldbl=''
751sPRIeldbl=''
752sPRIfldbl=''
753sPRIgldbl=''
754sSCNfldbl=''
755lseeksize=''
756lseektype=''
8ff267be 757make_set_make=''
b4eb6b3d
JH
758d_mymalloc=''
759freetype=''
760mallocobj=''
761mallocsrc=''
762malloctype=''
763usemymalloc=''
764installman1dir=''
765man1dir=''
766man1direxp=''
767man1ext=''
768installman3dir=''
769man3dir=''
770man3direxp=''
771man3ext=''
772modetype=''
773multiarch=''
774mydomain=''
775myhostname=''
776phostname=''
2304df62
AD
777c=''
778n=''
b4eb6b3d
JH
779d_eofnblk=''
780eagain=''
781o_nonblock=''
782rd_nodata=''
2cc61e15 783need_va_copy=''
b4eb6b3d
JH
784netdb_hlen_type=''
785netdb_host_type=''
786netdb_name_type=''
787netdb_net_type=''
788groupcat=''
789hostcat=''
790passcat=''
791orderlib=''
792ranlib=''
793d_perl_otherlibdirs=''
794otherlibdirs=''
2304df62
AD
795package=''
796spackage=''
b4eb6b3d
JH
797pager=''
798api_revision=''
799api_subversion=''
800api_version=''
801api_versionstring=''
802patchlevel=''
803revision=''
804subversion=''
805version=''
806perl5=''
807perladmin=''
808perlpath=''
809d_nv_preserves_uv=''
810d_nv_preserves_uv_bits=''
811i16size=''
812i16type=''
813i32size=''
814i32type=''
815i64size=''
816i64type=''
817i8size=''
818i8type=''
819ivsize=''
820ivtype=''
821nvsize=''
822nvtype=''
823u16size=''
824u16type=''
825u32size=''
826u32type=''
827u64size=''
828u64type=''
829u8size=''
830u8type=''
831uvsize=''
832uvtype=''
833ivdformat=''
834nvEUformat=''
835nvFUformat=''
836nvGUformat=''
837nveformat=''
838nvfformat=''
839nvgformat=''
840uvXUformat=''
841uvoformat=''
842uvuformat=''
843uvxformat=''
844pidtype=''
845prefix=''
846prefixexp=''
847installprivlib=''
848privlib=''
849privlibexp=''
850prototype=''
851ptrsize=''
852d_PRIXU64=''
853d_PRId64=''
854d_PRIi64=''
855d_PRIo64=''
856d_PRIu64=''
857d_PRIx64=''
858sPRIXU64=''
859sPRId64=''
860sPRIi64=''
861sPRIo64=''
862sPRIu64=''
863sPRIx64=''
864d_quad=''
865quadkind=''
866quadtype=''
867uquadtype=''
868drand01=''
869randbits=''
870randfunc=''
871randseedtype=''
872seedfunc=''
873installscript=''
874scriptdir=''
875scriptdirexp=''
876selectminbits=''
877selecttype=''
8ff267be 878sh=''
b4eb6b3d
JH
879sig_count=''
880sig_name=''
881sig_name_init=''
882sig_num=''
883sig_num_init=''
884installsitearch=''
885sitearch=''
886sitearchexp=''
887installsitebin=''
888sitebin=''
889sitebinexp=''
890installsitelib=''
891sitelib=''
892sitelib_stem=''
893sitelibexp=''
894siteprefix=''
895siteprefixexp=''
896sizesize=''
897sizetype=''
a0d0e21e 898so=''
b4eb6b3d 899socksizetype=''
2304df62
AD
900sharpbang=''
901shsharp=''
902spitshell=''
dfe9444c 903src=''
b4eb6b3d
JH
904ssizetype=''
905startperl=''
2304df62 906startsh=''
b4eb6b3d
JH
907stdchar=''
908d_stdio_stream_array=''
909stdio_stream_array=''
910sysman=''
5ff3f7a4 911trnl=''
b4eb6b3d
JH
912uidformat=''
913uidsign=''
914uidsize=''
915uidtype=''
916archname64=''
917use64bitall=''
918use64bitint=''
919ccflags_uselargefiles=''
920ldflags_uselargefiles=''
921libswanted_uselargefiles=''
922uselargefiles=''
923uselongdouble=''
924usemorebits=''
925usemultiplicity=''
2304df62 926nm_opt=''
40a7a20a 927nm_so_opt=''
2304df62
AD
928runnm=''
929usenm=''
b4eb6b3d 930useperlio=''
29209bc5 931usesocks=''
b4eb6b3d
JH
932d_oldpthreads=''
933use5005threads=''
934useithreads=''
935usethreads=''
2304df62 936incpath=''
2304df62
AD
937mips_type=''
938usrinc=''
b4eb6b3d
JH
939d_vendorarch=''
940installvendorarch=''
941vendorarch=''
942vendorarchexp=''
943d_vendorbin=''
944installvendorbin=''
945vendorbin=''
946vendorbinexp=''
947d_vendorlib=''
948installvendorlib=''
949vendorlib=''
950vendorlib_stem=''
951vendorlibexp=''
952usevendorprefix=''
953vendorprefix=''
954vendorprefixexp=''
d56c5707 955versiononly=''
b4eb6b3d
JH
956defvoidused=''
957voidflags=''
958pm_apiversion=''
959xs_apiversion=''
2304df62
AD
960CONFIG=''
961
ecfc5424
AD
962define='define'
963undef='undef'
964smallmach='pdp11 i8086 z8000 i80286 iAPX286'
965rmlist=''
966
967: We must find out about Eunice early
968eunicefix=':'
969if test -f /etc/unixtovms; then
970 eunicefix=/etc/unixtovms
971fi
972if test -f /etc/unixtovms.exe; then
973 eunicefix=/etc/unixtovms.exe
974fi
975
b4eb6b3d 976i_whoami=''
6b356c8e
JH
977ccname=''
978ccversion=''
9c839522 979perllibs=''
b4eb6b3d
JH
980: set useposix=false in your hint file to disable the POSIX extension.
981useposix=true
982: set useopcode=false in your hint file to disable the Opcode extension.
983useopcode=true
dfe9444c 984: Trailing extension. Override this in a hint file, if needed.
4e2a5f63 985_exe=''
dfe9444c
AD
986: Extra object files, if any, needed on this platform.
987archobjs=''
b4eb6b3d 988archname=''
ff935051
JH
989: Possible local include directories to search.
990: Set locincpth to "" in a hint file to defeat local include searches.
991locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
992locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
993:
994: no include file wanted by default
995inclwanted=''
996
b4eb6b3d 997groupstype=''
732c9516
JH
998: change the next line if compiling for Xenix/286 on Xenix/386
999xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1000: Possible local library directories to search.
1001loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1002loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1003
1004: general looking path for locating libraries
5869b1f1 1005glibpth="/lib /usr/lib $xlibpth"
732c9516 1006glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1007test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1008test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1009
1010: Private path used by Configure to find libraries. Its value
1011: is prepended to libpth. This variable takes care of special
1012: machines, like the mips. Usually, it should be empty.
1013plibpth=''
1014
1cfa4ec7
GS
1015: default library list
1016libswanted=''
921b2963 1017: some systems want to use only the non-versioned libso:s
1cfa4ec7 1018ignore_versioned_solibs=''
b4eb6b3d
JH
1019archname64=''
1020ccflags_uselargefiles=''
1021ldflags_uselargefiles=''
1022libswanted_uselargefiles=''
1023: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1024: set usesocks on the Configure command line to enable socks.
b4eb6b3d
JH
1025: set usethreads on the Configure command line to enable threads.
1026: full support for void wanted by default
1027defvoidused=15
1028
ecfc5424 1029: List of libraries we want.
693762b4 1030: If anyone needs -lnet, put it in a hint file.
997d70a2 1031libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
69e84d1d 1032libswanted="$libswanted dld ld sun m c cposix posix"
f1066039 1033libswanted="$libswanted ndir dir crypt sec"
0c9177ab 1034libswanted="$libswanted ucb bsd BSD PW x iconv util"
1aef975c 1035: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1036: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1037glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1038glibpth="/usr/shlib $glibpth"
1039: Do not use vfork unless overridden by a hint file.
1040usevfork=false
1041
8ff267be 1042: Find the basic shell for Bourne shell scripts
1043case "$sh" in
1044'')
8ff267be 1045 case "$SYSTYPE" in
1046 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1047 *) xxx='/bin/sh';;
1048 esac
1049 if test -f "$xxx"; then
1050 sh="$xxx"
1051 else
1052 : Build up a list and do a single loop so we can 'break' out.
1053 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1054 for xxx in sh bash ksh pdksh ash; do
1055 for p in $pth; do
1056 try="$try ${p}/${xxx}"
1057 done
1058 done
1059 for xxx in $try; do
1060 if test -f "$xxx"; then
1061 sh="$xxx";
8ff267be 1062 break
1063 elif test -f "$xxx.exe"; then
1064 sh="$xxx";
8ff267be 1065 break
1066 fi
1067 done
1068 fi
1069 ;;
1070esac
1071
1072case "$sh" in
1073'') cat <<EOM >&2
1074$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1075
8ff267be 1076Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1077Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1078we'll try to straighten this all out.
8ff267be 1079EOM
1080 exit 1
1081 ;;
1082esac
1083
760ac839 1084: see if sh knows # comments
8ff267be 1085if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1086 shsharp=true
1087 spitshell=cat
760ac839
LW
1088 xcat=/bin/cat
1089 test -f $xcat || xcat=/usr/bin/cat
1090 echo "#!$xcat" >try
1091 $eunicefix try
1092 chmod +x try
1093 ./try > today
1094 if test -s today; then
760ac839
LW
1095 sharpbang='#!'
1096 else
1097 echo "#! $xcat" > try
1098 $eunicefix try
1099 chmod +x try
1100 ./try > today
1101 if test -s today; then
760ac839
LW
1102 sharpbang='#! '
1103 else
760ac839
LW
1104 sharpbang=': use '
1105 fi
1106 fi
1107else
dfe9444c 1108 echo " "
8ff267be 1109 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1110 shsharp=false
1111 cd ..
1112 echo "exec grep -v '^[ ]*#'" >spitshell
1113 chmod +x spitshell
1114 $eunicefix spitshell
1115 spitshell=`pwd`/spitshell
1116 cd UU
1117 echo "I presume that if # doesn't work, #! won't work either!"
1118 sharpbang=': use '
1119fi
1120rm -f try today
1121
1122: figure out how to guarantee sh startup
8ff267be 1123case "$startsh" in
1124'') startsh=${sharpbang}${sh} ;;
1125*)
760ac839 1126esac
760ac839
LW
1127cat >try <<EOSS
1128$startsh
1129set abc
1130test "$?abc" != 1
1131EOSS
1132
1133chmod +x try
1134$eunicefix try
1135if ./try; then
8ff267be 1136 : echo "Yup, it does."
760ac839 1137else
dfe9444c
AD
1138 echo "Hmm... '$startsh' does not guarantee sh startup..."
1139 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839
LW
1140fi
1141rm -f try
1142
aebf16e7
AD
1143
1144: Save command line options in file UU/cmdline.opt for later use in
1145: generating config.sh.
1146cat > cmdline.opt <<EOSH
1147# Configure command line arguments.
1148config_arg0='$0'
1149config_args='$*'
1150config_argc=$#
1151EOSH
1152argn=1
1153for arg in "$@"; do
1154 cat >>cmdline.opt <<EOSH
1155config_arg$argn='$arg'
1156EOSH
1157 argn=`expr $argn + 1`
1158done
1159
2304df62
AD
1160: produce awk script to parse command line options
1161cat >options.awk <<'EOF'
1162BEGIN {
02e93a22 1163 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1164
1165 len = length(optstr);
1166 for (i = 1; i <= len; i++) {
1167 c = substr(optstr, i, 1);
1168 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1169 if (a == ":") {
1170 arg[c] = 1;
1171 i++;
1172 }
1173 opt[c] = 1;
1174 }
1175}
1176{
1177 expect = 0;
1178 str = $0;
1179 if (substr(str, 1, 1) != "-") {
1180 printf("'%s'\n", str);
1181 next;
1182 }
1183 len = length($0);
1184 for (i = 2; i <= len; i++) {
1185 c = substr(str, i, 1);
1186 if (!opt[c]) {
1187 printf("-%s\n", substr(str, i));
1188 next;
1189 }
1190 printf("-%s\n", c);
1191 if (arg[c]) {
1192 if (i < len)
1193 printf("'%s'\n", substr(str, i + 1));
1194 else
1195 expect = 1;
1196 next;
1197 }
1198 }
1199}
1200END {
1201 if (expect)
1202 print "?";
1203}
1204EOF
1205
1206: process the command line options
4633a7c4
LW
1207set X `for arg in "$@"; do echo "X$arg"; done |
1208 sed -e s/X// | awk -f options.awk`
2304df62
AD
1209eval "set $*"
1210shift
1211rm -f options.awk
1212
1213: set up default values
1214fastread=''
1215reuseval=false
1216config_sh=''
1217alldone=''
1218error=''
1219silent=''
1220extractsh=''
ecfc5424 1221override=''
16d20bd9 1222knowitall=''
02e93a22 1223rm -f optdef.sh posthint.sh
28757baa 1224cat >optdef.sh <<EOS
1225$startsh
1226EOS
2304df62 1227
dfe9444c 1228
2304df62
AD
1229: option parsing
1230while test $# -gt 0; do
1231 case "$1" in
1232 -d) shift; fastread=yes;;
1233 -e) shift; alldone=cont;;
1234 -f)
1235 shift
1236 cd ..
1237 if test -r "$1"; then
1238 config_sh="$1"
1239 else
a0d0e21e 1240 echo "$me: cannot read config file $1." >&2
2304df62
AD
1241 error=true
1242 fi
1243 cd UU
1244 shift;;
1245 -h) shift; error=true;;
1246 -r) shift; reuseval=true;;
dfe9444c 1247 -s) shift; silent=true; realsilent=true;;
2304df62 1248 -E) shift; alldone=exit;;
16d20bd9 1249 -K) shift; knowitall=true;;
ecfc5424 1250 -O) shift; override=true;;
dfe9444c 1251 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1252 -D)
1253 shift
1254 case "$1" in
1255 *=)
1256 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1257 echo "$me: ignoring -D $1" >&2
1258 ;;
ecfc5424 1259 *=*) echo "$1" | \
1aef975c
AD
1260 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1261 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1262 esac
1263 shift
1264 ;;
1265 -U)
1266 shift
1267 case "$1" in
1aef975c 1268 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1269 *=*)
1270 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1271 echo "$me: ignoring -U $1" >&2
1272 ;;
1aef975c 1273 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1274 esac
1275 shift
1276 ;;
02e93a22
JH
1277 -A)
1278 shift
1279 xxx=''
1280 yyy="$1"
02e93a22 1281 zzz=''
5f83a3e9 1282 uuu=undef
02e93a22 1283 case "$yyy" in
5f83a3e9
JH
1284 *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1285 case "$zzz" in
1286 *:*) zzz='' ;;
1287 *) xxx=append
1288 zzz=" "`echo $yyy|sed 's!^[^=]*=!!'`
1289 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1290 esac
1291 ;;
1292 esac
1293 case "$xxx" in
1294 '') case "$yyy" in
1295 *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1296 yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1297 zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1298 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1299 *) xxx=`echo $yyy|sed 's!:.*!!'`
1300 yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1301 esac
1302 ;;
1303 esac
02e93a22
JH
1304 case "$xxx" in
1305 append)
5f83a3e9 1306 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1307 clear)
5f83a3e9 1308 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1309 define)
1310 case "$zzz" in
1311 '') zzz=define ;;
1312 esac
5f83a3e9 1313 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1314 eval)
5f83a3e9 1315 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1316 prepend)
5f83a3e9 1317 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1318 undef)
1319 case "$zzz" in
1320 '') zzz="$uuu" ;;
1321 esac
5f83a3e9
JH
1322 echo "$yyy=$zzz" >> posthint.sh ;;
1323 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1324 esac
bde6b06b 1325 shift
02e93a22 1326 ;;
dfe9444c 1327 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1328 exit 0;;
2304df62 1329 --) break;;
a0d0e21e 1330 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1331 *) break;;
1332 esac
1333done
1334
1335case "$error" in
1336true)
1337 cat >&2 <<EOM
2afac517 1338Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1339 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1340 -d : use defaults for all answers.
1341 -e : go on without questioning past the production of config.sh.
1342 -f : specify an alternate default configuration file.
1343 -h : print this help message and exit (with an error status).
1344 -r : reuse C symbols value if possible (skips costly nm extraction).
1345 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1346 -D : define symbol to have some value:
1347 -D symbol symbol gets the value 'define'
1348 -D symbol=value symbol gets the value 'value'
2304df62 1349 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1350 -K : do not use unless you know what you are doing.
ecfc5424 1351 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1352 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1353 -U : undefine symbol:
1354 -U symbol symbol gets the value 'undef'
1355 -U symbol= symbol gets completely empty
02e93a22 1356 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1357 -A symbol=value append " "value to symbol
02e93a22
JH
1358 -A append:symbol=value append value to symbol
1359 -A define:symbol=value define symbol to have value
02e93a22
JH
1360 -A clear:symbol define symbol to be ''
1361 -A define:symbol define symbol to be 'define'
1362 -A eval:symbol=value define symbol to be eval of value
1363 -A prepend:symbol=value prepend value to symbol
1364 -A undef:symbol define symbol to be 'undef'
1365 -A undef:symbol= define symbol to be ''
2304df62
AD
1366 -V : print version number and exit (with a zero status).
1367EOM
1368 exit 1
1369 ;;
1370esac
1371
dfe9444c
AD
1372: Sanity checks
1373case "$fastread$alldone" in
1374yescont|yesexit) ;;
1375*)
aaeb8e51
GS
1376 case "$extractsh" in
1377 true) ;;
1378 *)
1379 if test ! -t 0; then
1380 echo "Say 'sh Configure', not 'sh <Configure'"
1381 exit 1
1382 fi
1383 ;;
1384 esac
dfe9444c
AD
1385 ;;
1386esac
1387
2304df62
AD
1388exec 4>&1
1389case "$silent" in
1390true) exec 1>/dev/null;;
1391esac
1392
ecfc5424 1393: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1394touch optdef.sh
1395. ./optdef.sh
02e93a22
JH
1396: create the posthint manipulation script and leave the file out there...
1397touch posthint.sh
a0d0e21e 1398
2304df62 1399: set package name
85e6fe83 1400package=perl5
b4eb6b3d
JH
1401first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1402last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1403case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1404ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1405*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1406esac
2304df62 1407
2304df62
AD
1408: Some greps do not return status, grrr.
1409echo "grimblepritz" >grimble
1410if grep blurfldyick grimble >/dev/null 2>&1 ; then
1411 contains=contains
1412elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1413 contains=grep
1414else
1415 contains=contains
1416fi
1417rm -f grimble
1418: the following should work in any shell
1419case "$contains" in
1420contains*)
1421 echo " "
1422 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1423 cat >contains <<'EOSS'
1424grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1425EOSS
1426chmod +x contains
1427esac
1428
dfe9444c
AD
1429: Find the path to the source tree
1430case "$src" in
1431'') case "$0" in
b233458b
JH
1432 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1433 case "$src" in
1434 /*) ;;
1435 *) src=`cd ../$src && pwd` ;;
1436 esac
1437 ;;
dfe9444c
AD
1438 *) src='.';;
1439 esac;;
1440esac
1441case "$src" in
1442'') src=/
1443 rsrc=/
1444 ;;
1445/*) rsrc="$src";;
1446*) rsrc="../$src";;
1447esac
1448if test -f $rsrc/Configure && \
1449 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1450then
1451 : found it, so we are ok.
1452else
1453 rsrc=''
1454 for src in . .. ../.. ../../.. ../../../..; do
1455 if test -f ../$src/Configure && \
1456 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1457 then
1458 rsrc=../$src
1459 break
1460 fi
1461 done
1462fi
1463case "$rsrc" in
1464'')
1465 cat <<EOM >&4
1466
1467Sorry, I can't seem to locate the source dir for $package. Please start
1468Configure with an explicit path -- i.e. /some/path/Configure.
1469
1470EOM
1471 exit 1
1472 ;;
1473../.) rsrc='..';;
1474*)
1475 echo " "
1476 echo "Sources for $package found in \"$src\"." >&4
1477 ;;
1478esac
1479
1480: script used to extract .SH files with variable substitutions
1481cat >extract <<'EOS'
2000072c 1482CONFIGDOTSH=true
dfe9444c
AD
1483echo "Doing variable substitutions on .SH files..."
1484if test -f $src/MANIFEST; then
f7ab18e9 1485 set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
dfe9444c
AD
1486else
1487 echo "(Looking for .SH files under the source directory.)"
1488 set x `(cd $src; find . -name "*.SH" -print)`
1489fi
1490shift
1491case $# in
14920) set x `(cd $src; echo *.SH)`; shift;;
1493esac
1494if test ! -f $src/$1; then
1495 shift
1496fi
1497mkdir_p='
1498name=$1;
1499create="";
1500while test $name; do
1501 if test ! -d "$name"; then
1502 create="$name $create";
1503 name=`echo $name | sed -e "s|^[^/]*$||"`;
1504 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1505 else
1506 name="";
1507 fi;
1508done;
1509for file in $create; do
1510 mkdir $file;
1511done
1512'
1513for file in $*; do
1514 case "$src" in
1515 ".")
1516 case "$file" in
1517 */*)
1518 dir=`expr X$file : 'X\(.*\)/'`
1519 file=`expr X$file : 'X.*/\(.*\)'`
1520 (cd $dir && . ./$file)
1521 ;;
1522 *)
1523 . ./$file
1524 ;;
1525 esac
1526 ;;
1527 *)
1528 case "$file" in
1529 */*)
1530 dir=`expr X$file : 'X\(.*\)/'`
1531 file=`expr X$file : 'X.*/\(.*\)'`
1532 (set x $dir; shift; eval $mkdir_p)
1533 sh <$src/$dir/$file
1534 ;;
1535 *)
1536 sh <$src/$file
1537 ;;
1538 esac
1539 ;;
1540 esac
1541done
1542if test -f $src/config_h.SH; then
1543 if test ! -f config.h; then
1544 : oops, they left it out of MANIFEST, probably, so do it anyway.
1545 . $src/config_h.SH
1546 fi
1547fi
1548EOS
1549
1550: extract files and exit if asked to do so
1551case "$extractsh" in
1552true)
1553 case "$realsilent" in
1554 true) ;;
1555 *) exec 1>&4;;
1556 esac
1557 case "$config_sh" in
1558 '') config_sh='config.sh';;
1559 esac
1560 echo " "
1561 echo "Fetching answers from $config_sh..."
1562 cd ..
1563 . $config_sh
1564 test "$override" && . ./optdef.sh
1565 echo " "
1566 . UU/extract
1567 rm -rf UU
1568 echo "Done."
1569 exit 0
1570 ;;
1571esac
1572
1573: Eunice requires " " instead of "", can you believe it
1574echo " "
1575: Here we go...
1576echo "Beginning of configuration questions for $package."
1577
1578trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1579
2304df62
AD
1580: first determine how to suppress newline on echo command
1581echo " "
1582echo "Checking echo to see how to suppress newlines..."
1583(echo "hi there\c" ; echo " ") >.echotmp
1584if $contains c .echotmp >/dev/null 2>&1 ; then
1585 echo "...using -n."
1586 n='-n'
1587 c=''
1588else
1589 cat <<'EOM'
1590...using \c
1591EOM
1592 n=''
1593 c='\c'
1594fi
1595echo $n "The star should be here-->$c"
1596echo '*'
1597rm -f .echotmp
1598
1599: Now test for existence of everything in MANIFEST
1600echo " "
dfe9444c 1601if test -f $rsrc/MANIFEST; then
2304df62 1602 echo "First let's make sure your kit is complete. Checking..." >&4
dfe9444c 1603 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
2304df62 1604 rm -f missing
dfe9444c 1605 tmppwd=`pwd`
2304df62 1606 for filelist in x??; do
dfe9444c 1607 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
2304df62
AD
1608 done
1609 if test -s missing; then
1610 cat missing >&4
1611 cat >&4 <<'EOM'
1612
1613THIS PACKAGE SEEMS TO BE INCOMPLETE.
1614
1615You have the option of continuing the configuration process, despite the
1616distinct possibility that your kit is damaged, by typing 'y'es. If you
1617do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1618and contact the author (perlbug@perl.org).
2304df62
AD
1619
1620EOM
1621 echo $n "Continue? [n] $c" >&4
1622 read ans
1623 case "$ans" in
1624 y*)
1625 echo "Continuing..." >&4
1626 rm -f missing
1627 ;;
1628 *)
1629 echo "ABORTING..." >&4
1630 kill $$
1631 ;;
1632 esac
1633 else
dfe9444c 1634 echo "Looks good..."
2304df62
AD
1635 fi
1636else
1637 echo "There is no MANIFEST file. I hope your kit is complete !"
1638fi
1639rm -f missing x??
1640
5ff3f7a4
GS
1641echo " "
1642: Find the appropriate value for a newline for tr
1643if test -n "$DJGPP"; then
1644 trnl='\012'
1645fi
1646if test X"$trnl" = X; then
1647 case "`echo foo|tr '\n' x 2>/dev/null`" in
1648 foox) trnl='\n' ;;
1649 esac
1650fi
1651if test X"$trnl" = X; then
1652 case "`echo foo|tr '\012' x 2>/dev/null`" in
1653 foox) trnl='\012' ;;
1654 esac
1655fi
1656if test X"$trnl" = X; then
1657 cat <<EOM >&2
1658
1659$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1660
1661EOM
1662 exit 1
1663fi
1664
2304df62
AD
1665: compute the number of columns on the terminal for proper question formatting
1666case "$COLUMNS" in
1667'') COLUMNS='80';;
1668esac
1669
1670: set up the echo used in my read
1671myecho="case \"\$xxxm\" in
1672'') echo $n \"\$rp $c\" >&4;;
1673*) case \"\$rp\" in
1674 '') echo $n \"[\$xxxm] $c\";;
1675 *)
1676 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1677 echo \"\$rp\" >&4
1678 echo $n \"[\$xxxm] $c\" >&4
1679 else
1680 echo $n \"\$rp [\$xxxm] $c\" >&4
1681 fi
1682 ;;
1683 esac;;
1684esac"
1685
1686: now set up to do reads with possible shell escape and default assignment
1687cat <<EOSC >myread
28757baa 1688$startsh
2304df62
AD
1689xxxm=\$dflt
1690$myecho
1691ans='!'
1692case "\$fastread" in
1693yes) case "\$dflt" in
1694 '') ;;
1695 *) ans='';
1696 case "\$silent-\$rp" in
1697 true-) ;;
1698 *) echo " " >&4;;
1699 esac;;
1700 esac;;
1701*) case "\$silent" in
1702 true) case "\$rp" in
1703 '') ans='';;
1704 esac;;
1705 esac;;
1706esac
1707while expr "X\$ans" : "X!" >/dev/null; do
1708 read answ
1709 set x \$xxxm
1710 shift
dfe9444c 1711 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1712 case "\$answ" in
dfe9444c
AD
1713 "!")
1714 sh 1>&4
1715 echo " "
1716 $myecho
1717 ;;
1718 !*)
1719 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1720 shift
1721 sh 1>&4 -c "\$*"
1722 echo " "
1723 $myecho
1724 ;;
2304df62
AD
1725 "\$ans")
1726 case "\$ans" in
ecfc5424
AD
1727 \\&*)
1728 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1729 shift
1730 case "\$1" in
1731 -d)
1732 fastread=yes
40a7a20a 1733 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1734 ;;
1735 -*)
40a7a20a 1736 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1737 ;;
1738 esac
1739 $myecho
1740 ans=!
1741 ;;
2304df62
AD
1742 esac;;
1743 *)
1744 case "\$aok" in
1745 y)
1746 echo "*** Substitution done -- please confirm."
1747 xxxm="\$ans"
c9795ab7 1748 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1749 xxxm="\$ans"
1750 ans=!
1751 ;;
1752 *)
1753 echo "*** Error -- try again."
1754 ans=!
1755 ;;
1756 esac
1757 $myecho
1758 ;;
1759 esac
1760 case "\$ans\$xxxm\$nostick" in
1761 '')
1762 ans=!
1763 $myecho
1764 ;;
1765 esac
1766done
1767case "\$ans" in
1768'') ans="\$xxxm";;
1769esac
1770EOSC
1771
1772: create .config dir to save info across Configure sessions
1773test -d ../.config || mkdir ../.config
1774cat >../.config/README <<EOF
1775This directory created by Configure to save information that should
dfe9444c 1776persist across sessions for $package.
2304df62
AD
1777
1778You may safely delete it if you wish.
1779EOF
1780
9507cadf 1781xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 1782case "$usedevel" in
0107c034 1783$define|true|[yY]*) ;;
9507cadf 1784*) case "$xversion" in
0107c034
JH
1785 *[13579])
1786 cat >&4 <<EOH
1787*** WHOA THERE!!! ***
1788
1789 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
1790 The version of this $package distribution is $xversion, that is, odd,
1791 (as opposed to even) and that signifies a development release.
3d5d58b1 1792 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
1793
1794 Do ***NOT*** install this into production use.
1795 Data corruption and crashes are possible.
1796
1797 It is most seriously suggested that you do not continue any further
1798 unless you want to help in developing and debugging Perl.
1799
1800EOH
1801 rp='Do you really want to continue?'
1802 dflt='n'
1803 . ./myread
1804 case "$ans" in
1805 [yY]) echo >&4 "Okay, continuing." ;;
1806 *) echo >&4 "Okay, bye."
1807 exit 1
1808 ;;
1809 esac
1810 ;;
1811 esac
1812 ;;
1813esac
1814
2304df62
AD
1815: general instructions
1816needman=true
1817firsttime=true
760ac839 1818user=`(logname) 2>/dev/null`
dfe9444c
AD
1819case "$user" in
1820'') user=`whoami 2>&1`;;
760ac839 1821esac
2304df62
AD
1822if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1823 firsttime=false
1824 echo " "
1825 rp='Would you like to see the instructions?'
1826 dflt=n
1827 . ./myread
1828 case "$ans" in
1829 [yY]*) ;;
1830 *) needman=false;;
1831 esac
1832fi
1833if $needman; then
1834 cat <<EOH
4e2a5f63 1835
2304df62 1836This installation shell script will examine your system and ask you questions
a0d0e21e 1837to determine how the perl5 package should be installed. If you get
2304df62
AD
1838stuck on a question, you may use a ! shell escape to start a subshell or
1839execute a command. Many of the questions will have default answers in square
1840brackets; typing carriage return will give you the default.
1841
1842On some of the questions which ask for file or directory names you are allowed
1843to use the ~name construct to specify the login directory belonging to "name",
1844even if you don't have a shell which knows about that. Questions where this is
1845allowed will be marked "(~name ok)".
1846
1847EOH
1848 rp=''
1849 dflt='Type carriage return to continue'
1850 . ./myread
1851 cat <<'EOH'
1852
1853The prompter used in this script allows you to use shell variables and
1854backticks in your answers. You may use $1, $2, etc... to refer to the words
1855in the default answer, as if the default line was a set of arguments given to a
1856script shell. This means you may also use $* to repeat the whole default line,
1857so you do not have to re-type everything to add something to the default.
1858
1859Everytime there is a substitution, you will have to confirm. If there is an
1860error (e.g. an unmatched backtick), the default answer will remain unchanged
1861and you will be prompted again.
1862
1863If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1864the questions and use the computed defaults (or the previous answers if there
1865was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1866You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1867on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1868
1869EOH
1870 . ./myread
1871 cat <<EOH
1872
1873Much effort has been expended to ensure that this shell script will run on any
1874Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1875Configure and run it again. If you can't run Configure for some reason,
1876you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 1877have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
1878
1879This installation script affects things in two ways:
1880
18811) it may do direct variable substitutions on some of the files included
1882 in this kit.
18832) it builds a config.h file for inclusion in C programs. You may edit
1884 any of these files as the need arises after running this script.
1885
1886If you make a mistake on a question, there is no easy way to back up to it
1887currently. The easiest thing to do is to edit config.sh and rerun all the SH
1888files. Configure will offer to let you do this before it runs the SH files.
1889
1890EOH
1891 dflt='Type carriage return to continue'
1892 . ./myread
1893 case "$firsttime" in
1894 true) echo $user >>../.config/instruct;;
1895 esac
1896fi
1897
2304df62
AD
1898: find out where common programs are
1899echo " "
1900echo "Locating common programs..." >&4
1901cat <<EOSC >loc
1902$startsh
1903case \$# in
19040) exit 1;;
1905esac
1906thing=\$1
1907shift
1908dflt=\$1
1909shift
1910for dir in \$*; do
1911 case "\$thing" in
1912 .)
1913 if test -d \$dir/\$thing; then
1914 echo \$dir
1915 exit 0
1916 fi
1917 ;;
1918 *)
a0d0e21e 1919 for thisthing in \$dir/\$thing; do
ecfc5424 1920 : just loop through to pick last item
a0d0e21e 1921 done
25f94b33 1922 if test -f \$thisthing; then
a0d0e21e 1923 echo \$thisthing
2304df62
AD
1924 exit 0
1925 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
1926 if test -n "$DJGPP"; then
1927 echo \$dir/\$thing.exe
1928 else
1929 : on Eunice apparently
1930 echo \$dir/\$thing
1931 fi
2304df62
AD
1932 exit 0
1933 fi
1934 ;;
1935 esac
1936done
1937echo \$dflt
1938exit 1
1939EOSC
1940chmod +x loc
1941$eunicefix loc
1942loclist="
1943awk
1944cat
b4eb6b3d
JH
1945comm
1946cp
2304df62
AD
1947echo
1948expr
1949grep
a0d0e21e 1950ls
dfe9444c 1951make
b4eb6b3d 1952mkdir
2304df62
AD
1953rm
1954sed
b4eb6b3d 1955sort
85e6fe83 1956touch
2304df62 1957tr
b4eb6b3d 1958uniq
2304df62
AD
1959"
1960trylist="
1961Mcc
dfe9444c 1962ar
b4eb6b3d 1963byacc
2304df62 1964cpp
b4eb6b3d 1965csh
2304df62
AD
1966date
1967egrep
8ff267be 1968gzip
b4eb6b3d 1969less
8ff267be 1970ln
b4eb6b3d 1971more
693762b4 1972nm
b4eb6b3d
JH
1973nroff
1974pg
2304df62
AD
1975test
1976uname
8ff267be 1977zip
2304df62 1978"
8e07c86e 1979pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
1980pth="$pth /lib /usr/lib"
1981for file in $loclist; do
dfe9444c
AD
1982 eval xxx=\$$file
1983 case "$xxx" in
1984 /*|?:[\\/]*)
1985 if test -f "$xxx"; then
1986 : ok
1987 else
1988 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1989 xxx=`./loc $file $file $pth`
1990 fi
1991 ;;
1992 '') xxx=`./loc $file $file $pth`;;
1993 *) xxx=`./loc $xxx $xxx $pth`;;
1994 esac
2304df62
AD
1995 eval $file=$xxx
1996 eval _$file=$xxx
1997 case "$xxx" in
1998 /*)
1999 echo $file is in $xxx.
2000 ;;
8e07c86e
AD
2001 ?:[\\/]*)
2002 echo $file is in $xxx.
2003 ;;
2304df62 2004 *)
25f94b33
AD
2005 echo "I don't know where '$file' is, and my life depends on it." >&4
2006 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2007 exit 1
2304df62
AD
2008 ;;
2009 esac
2010done
2011echo " "
2012echo "Don't worry if any of the following aren't found..."
2013say=offhand
2014for file in $trylist; do
dfe9444c
AD
2015 eval xxx=\$$file
2016 case "$xxx" in
2017 /*|?:[\\/]*)
2018 if test -f "$xxx"; then
2019 : ok
2020 else
2021 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2022 xxx=`./loc $file $file $pth`
2023 fi
2024 ;;
2025 '') xxx=`./loc $file $file $pth`;;
2026 *) xxx=`./loc $xxx $xxx $pth`;;
2027 esac
2304df62
AD
2028 eval $file=$xxx
2029 eval _$file=$xxx
2030 case "$xxx" in
2031 /*)
2032 echo $file is in $xxx.
2033 ;;
8e07c86e
AD
2034 ?:[\\/]*)
2035 echo $file is in $xxx.
2036 ;;
2304df62
AD
2037 *)
2038 echo "I don't see $file out there, $say."
2039 say=either
2040 ;;
2041 esac
2042done
2043case "$egrep" in
2044egrep)
2045 echo "Substituting grep for egrep."
2046 egrep=$grep
2047 ;;
2048esac
8ff267be 2049case "$ln" in
2050ln)
2051 echo "Substituting cp for ln."
2052 ln=$cp
2053 ;;
2054esac
2304df62
AD
2055case "$test" in
2056test)
2057 echo "Hopefully test is built into your sh."
2058 ;;
2059*)
ecfc5424 2060 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2304df62
AD
2061 echo "Using the test built into your sh."
2062 test=test
2063 _test=test
2064 fi
2065 ;;
2066esac
2067case "$echo" in
2068echo)
2069 echo "Hopefully echo is built into your sh."
2070 ;;
2071'') ;;
2072*)
2073 echo " "
2074echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2075 $echo $n "hi there$c" >foo1
2076 echo $n "hi there$c" >foo2
2077 if cmp foo1 foo2 >/dev/null 2>&1; then
2078 echo "They are compatible. In fact, they may be identical."
2079 else
2080 case "$n" in
2081 '-n') n='' c='\c';;
2082 *) n='-n' c='';;
2083 esac
2084 cat <<FOO
2085They are not compatible! You are probably running ksh on a non-USG system.
2086I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2087have echo built in and we may have to run some Bourne shell scripts. That
2088means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2089
2090FOO
2091 $echo $n "The star should be here-->$c"
2092 $echo "*"
2093 fi
2094 $rm -f foo1 foo2
2095 ;;
2096esac
2097
2573c5f9
JH
2098cat <<EOS >checkcc
2099$startsh
2100EOS
2101cat <<'EOSC' >>checkcc
2102case "$cc" in
2103'') ;;
2104*) $rm -f try try.*
2105 $cat >try.c <<EOM
2106int main(int argc, char *argv[]) {
2107 return 0;
2108}
2109EOM
7a282f6d 2110 if $cc -o try $ccflags try.c; then
2573c5f9
JH
2111 :
2112 else
2113 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2114 despair=yes
2115 trygcc=yes
2116 case "$cc" in
2117 *gcc*) trygcc=no ;;
2118 esac
2119 case "`$cc -v -c try.c 2>&1`" in
2120 *gcc*) trygcc=no ;;
2121 esac
2122 if $test X"$trygcc" = Xyes; then
2123 if gcc -o try -c try.c; then
2124 echo " "
2125 echo "You seem to have a working gcc, though." >&4
2126 rp="Would you like to use it?"
2127 dflt=y
2128 if $test -f myread; then
2129 . ./myread
2130 else
2131 if $test -f UU/myread; then
2132 . ./UU/myread
2133 else
2134 echo "Cannot find myread, sorry. Aborting." >&2
2135 exit 1
2136 fi
2137 fi
2138 case "$ans" in
e723fc21 2139 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2573c5f9
JH
2140 esac
2141 fi
2142 fi
2143 if $test X"$despair" = Xyes; then
5dd4fbdf
MB
2144 $cat >&4 <<EOM
2145You need to find a working C compiler.
2146Either (purchase and) install the C compiler supplied by your OS vendor,
2147or for a free C compiler try http://gcc.gnu.org/
2148I cannot continue any further, aborting.
2149EOM
2573c5f9
JH
2150 exit 1
2151 fi
2152 fi
2153 $rm -f try try.*
2154 ;;
2155esac
2156EOSC
2157
a0d0e21e
LW
2158: determine whether symbolic links are supported
2159echo " "
2160$touch blurfl
2161if $ln -s blurfl sym > /dev/null 2>&1 ; then
2162 echo "Symbolic links are supported." >&4
2163 lns="$ln -s"
2164else
2165 echo "Symbolic links are NOT supported." >&4
2166 lns="$ln"
2167fi
2168$rm -f blurfl sym
2169
ecfc5424
AD
2170: see whether [:lower:] and [:upper:] are supported character classes
2171echo " "
ecfc5424
AD
2172case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2173ABYZ)
2174 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2175 up='[:upper:]'
2176 low='[:lower:]'
2177 ;;
28e8609d
JH
2178*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2179 # (0xc9 and 0xd1), therefore that is a nice testing point.
2180 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2181 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2182 ij) up='[A-Z]'
2183 low='[a-z]'
2184 ;;
2185 esac
2186 fi
2187 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2188 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2189 ij) up='A-Z'
2190 low='a-z'
2191 ;;
2192 esac
2193 fi
2194 if test "X$up" = X -o "X$low" = X; then
2195 case "`echo IJ | od -x 2>/dev/null`" in
2196 *C9D1*|*c9d1*)
2197 echo "Hey, this might be EBCDIC." >&4
2198 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2199 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2200 ij) up='[A-IJ-RS-Z]'
2201 low='[a-ij-rs-z]'
2202 ;;
2203 esac
2204 fi
2205 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2206 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2207 ij) up='A-IJ-RS-Z'
2208 low='a-ij-rs-z'
2209 ;;
2210 esac
2211 fi
2212 ;;
2213 esac
2214 fi
2215esac
3eaeeeae 2216case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2217ij)
2218 echo "Using $up and $low to convert case." >&4
2219 ;;
ecfc5424 2220*)
28e8609d
JH
2221 echo "I don't know how to translate letters from upper to lower case." >&4
2222 echo "Your tr is not acting any way I know of." >&4
2223 exit 1
2224 ;;
ecfc5424
AD
2225esac
2226: set up the translation script tr, must be called with ./tr of course
2227cat >tr <<EOSC
2228$startsh
2229case "\$1\$2" in
2230'[A-Z][a-z]') exec $tr '$up' '$low';;
2231'[a-z][A-Z]') exec $tr '$low' '$up';;
2232esac
2233exec $tr "\$@"
2234EOSC
2235chmod +x tr
2236$eunicefix tr
2237
2304df62
AD
2238: Try to determine whether config.sh was made on this system
2239case "$config_sh" in
2240'')
43999f95
JH
2241myuname=`$uname -a 2>/dev/null`
2242$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2243# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2244# because the A-Z/a-z are not consecutive.
a0d0e21e 2245myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2246 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2247newmyuname="$myuname"
2304df62 2248dflt=n
16d20bd9
AD
2249case "$knowitall" in
2250'')
2251 if test -f ../config.sh; then
2252 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2253 eval "`grep myuname= ../config.sh`"
2254 fi
2255 if test "X$myuname" = "X$newmyuname"; then
2256 dflt=y
2257 fi
2304df62 2258 fi
16d20bd9
AD
2259 ;;
2260*) dflt=y;;
2261esac
2304df62
AD
2262
2263: Get old answers from old config file if Configure was run on the
2264: same system, otherwise use the hints.
2265hint=default
2266cd ..
2267if test -f config.sh; then
16d20bd9
AD
2268 echo " "
2269 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2270 . UU/myread
2271 case "$ans" in
f83701cd
AD
2272 n*|N*) echo "OK, I'll ignore it."
2273 mv config.sh config.sh.old
2274 myuname="$newmyuname"
2275 ;;
2304df62 2276 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2277 tmp_n="$n"
2278 tmp_c="$c"
85cad39c 2279 tmp_sh="$sh"
2304df62
AD
2280 . ./config.sh
2281 cp config.sh UU
ecfc5424
AD
2282 n="$tmp_n"
2283 c="$tmp_c"
85cad39c 2284 : Older versions did not always set $sh. Catch re-use of such
2285 : an old config.sh.
2286 case "$sh" in
2287 '') sh="$tmp_sh" ;;
2288 esac
2304df62
AD
2289 hint=previous
2290 ;;
2291 esac
2292fi
2573c5f9 2293. ./UU/checkcc
2304df62
AD
2294if test ! -f config.sh; then
2295 $cat <<EOM
2296
4e2a5f63
AD
2297First time through, eh? I have some defaults handy for some systems
2298that need some extra help getting the Configure answers right:
2304df62
AD
2299
2300EOM
dfe9444c 2301 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2302 dflt=''
2303 : Half the following guesses are probably wrong... If you have better
7f2de2d2 2304 : tests or hints, please send them to perlbug@perl.org
2304df62 2305 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2306 $test -f /irix && osname=irix
85e6fe83
LW
2307 $test -f /xenix && osname=sco_xenix
2308 $test -f /dynix && osname=dynix
2309 $test -f /dnix && osname=dnix
5f05dabc 2310 $test -f /lynx.os && osname=lynxos
2311 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2312 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2313 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2314 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2315 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2316 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2317 $test -d /usr/apollo/bin && osname=apollo
2318 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2319 $test -d /usr/include/minix && osname=minix
e060872b 2320 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2321 osname=machten
4633a7c4 2322 if $test -x /sbin/version; then
dfe9444c 2323 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2324 $sed -e 's/[A-Za-z]$//'`
2325 elif $test -x /usr/etc/version; then
dfe9444c 2326 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2327 $sed -e 's/[A-Za-z]$//'`
2328 else
2329 osvers="$2.$3"
2330 fi
2331 fi
aaacdc8b
GS
2332
2333 $test -f /sys/posix.dll &&
2334 $test -f /usr/bin/what &&
2335 set X `/usr/bin/what /sys/posix.dll` &&
2336 $test "$3" = UWIN &&
2337 osname=uwin &&
2338 osvers="$5"
2339
2304df62
AD
2340 if $test -f $uname; then
2341 set X $myuname
2342 shift
2343
2304df62 2344 case "$5" in
85e6fe83 2345 fps*) osname=fps ;;
2304df62
AD
2346 mips*)
2347 case "$4" in
85e6fe83
LW
2348 umips) osname=umips ;;
2349 *) osname=mips ;;
2304df62 2350 esac;;
85e6fe83
LW
2351 [23]100) osname=mips ;;
2352 next*) osname=next ;;
ecfc5424 2353 i386*)
c6912327
JH
2354 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2355 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2356 osname='sco'
2357 osvers=$tmp
2358 elif $test -f /etc/kconfig; then
ecfc5424 2359 osname=isc
bd628c73 2360 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2361 osvers=4
2362 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2363 osvers=3
2304df62 2364 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2365 osvers=2
ecfc5424
AD
2366 fi
2367 fi
2000072c 2368 tmp=''
ecfc5424 2369 ;;
c4f23d77
AD
2370 pc*)
2371 if test -n "$DJGPP"; then
2372 osname=dos
2373 osvers=djgpp
2374 fi
2375 ;;
2304df62
AD
2376 esac
2377
2378 case "$1" in
a0d0e21e
LW
2379 aix) osname=aix
2380 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2381 case "$tmp" in
1aef975c 2382 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2383 '<3240'|'<>3240') osvers=3.2.0 ;;
2384 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2385 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2386 *) osvers=$tmp;;
a0d0e21e
LW
2387 esac
2388 ;;
aaacdc8b
GS
2389 bsd386) osname=bsd386
2390 osvers=`$uname -r`
2391 ;;
2392 cygwin*) osname=cygwin
2393 osvers="$3"
2394 ;;
23f87696
SZ
2395 *dc.osx) osname=dcosx
2396 osvers="$3"
2397 ;;
a0d0e21e
LW
2398 dnix) osname=dnix
2399 osvers="$3"
2400 ;;
2401 domainos) osname=apollo
2402 osvers="$3"
2403 ;;
2404 dgux) osname=dgux
2405 osvers="$3"
2406 ;;
760ac839 2407 dynixptx*) osname=dynixptx
e58e581d 2408 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2409 ;;
a0d0e21e
LW
2410 freebsd) osname=freebsd
2411 osvers="$3" ;;
2412 genix) osname=genix ;;
2413 hp*) osname=hpux
bfb7748a 2414 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2415 ;;
a78b0d02 2416 irix*) osname=irix
a0d0e21e
LW
2417 case "$3" in
2418 4*) osvers=4 ;;
2419 5*) osvers=5 ;;
ecfc5424 2420 *) osvers="$3" ;;
a0d0e21e
LW
2421 esac
2422 ;;
2423 linux) osname=linux
2424 case "$3" in
a0d0e21e
LW
2425 *) osvers="$3" ;;
2426 esac
2427 ;;
28e8609d
JH
2428 MiNT) osname=mint
2429 ;;
2430 netbsd*) osname=netbsd
ecfc5424
AD
2431 osvers="$3"
2432 ;;
4e81affe
MM
2433 news-os) osvers="$3"
2434 case "$3" in
2435 4*) osname=newsos4 ;;
2436 *) osname=newsos ;;
2437 esac
2438 ;;
aaacdc8b 2439 next*) osname=next ;;
28bb1e2c 2440 nonstop-ux) osname=nonstopux ;;
aaacdc8b
GS
2441 POSIX-BC | posix-bc ) osname=posix-bc
2442 osvers="$3"
a0d0e21e 2443 ;;
ae3afa4e
TH
2444 powerux | power_ux | powermax_os | powermaxos | \
2445 powerunix | power_unix) osname=powerux
2446 osvers="$3"
2447 ;;
aaacdc8b
GS
2448 qnx) osname=qnx
2449 osvers="$4"
2450 ;;
a0d0e21e
LW
2451 solaris) osname=solaris
2452 case "$3" in
2453 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2454 *) osvers="$3" ;;
a0d0e21e
LW
2455 esac
2456 ;;
85e6fe83
LW
2457 sunos) osname=sunos
2458 case "$3" in
85e6fe83
LW
2459 5*) osname=solaris
2460 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2461 *) osvers="$3" ;;
2304df62
AD
2462 esac
2463 ;;
a0d0e21e 2464 titanos) osname=titanos
85e6fe83 2465 case "$3" in
a0d0e21e
LW
2466 1*) osvers=1 ;;
2467 2*) osvers=2 ;;
2468 3*) osvers=3 ;;
2469 4*) osvers=4 ;;
ecfc5424 2470 *) osvers="$3" ;;
2304df62
AD
2471 esac
2472 ;;
85e6fe83 2473 ultrix) osname=ultrix
ecfc5424 2474 osvers="$3"
2304df62 2475 ;;
28757baa 2476 osf1|mls+) case "$5" in
fed7345c
AD
2477 alpha)
2478 osname=dec_osf
2aa76180
JH
2479 osvers=`sizer -v | awk '{print $3}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2480 case "$osvers" in
2481 [1-9].[0-9]*) ;;
2482 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2483 esac
ecfc5424
AD
2484 ;;
2485 hp*) osname=hp_osf1 ;;
2486 mips) osname=mips_osf1 ;;
85e6fe83
LW
2487 esac
2488 ;;
0337d152
BG
2489 unixware) osname=svr5
2490 osvers="$4"
2491 ;;
2492 uts) osname=uts
a0d0e21e
LW
2493 osvers="$3"
2494 ;;
85e6fe83 2495 $2) case "$osname" in
2304df62 2496 *isc*) ;;
a0d0e21e 2497 *freebsd*) ;;
5f05dabc 2498 svr*)
a0d0e21e
LW
2499 : svr4.x or possibly later
2500 case "svr$3" in
2501 ${osname}*)
2502 osname=svr$3
2503 osvers=$4
2504 ;;
2505 esac
2506 case "$osname" in
2507 svr4.0)
2508 : Check for ESIX
2509 if test -f /stand/boot ; then
2510 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2511 if test -n "$INITPROG" -a -f "$INITPROG"; then
2512 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2513 if test -n "$isesix"; then
a0d0e21e
LW
2514 osname=esix4
2515 fi
2516 fi
2517 fi
2518 ;;
2519 esac
2520 ;;
2304df62 2521 *) if test -f /etc/systemid; then
a0d0e21e
LW
2522 osname=sco
2523 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2524 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2525 osvers=$1.$2.$3
c4f23d77 2526 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2527 osvers=$1.$2
c4f23d77 2528 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2529 osvers=$1
2304df62 2530 fi
a0d0e21e
LW
2531 else
2532 case "$osname" in
2533 '') : Still unknown. Probably a generic Sys V.
2534 osname="sysv"
2535 osvers="$3"
2536 ;;
2537 esac
2304df62
AD
2538 fi
2539 ;;
2540 esac
2541 ;;
a0d0e21e
LW
2542 *) case "$osname" in
2543 '') : Still unknown. Probably a generic BSD.
2544 osname="$1"
2545 osvers="$3"
2546 ;;
2547 esac
2548 ;;
2304df62
AD
2549 esac
2550 else
dfe9444c
AD
2551 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2552 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2553 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2554 osname=news_os
2304df62 2555 fi
dfe9444c 2556 $rm -f UU/kernel.what
8e07c86e
AD
2557 elif test -d c:/.; then
2558 set X $myuname
2559 osname=os2
2560 osvers="$5"
2304df62
AD
2561 fi
2562 fi
85e6fe83 2563
a0d0e21e
LW
2564 : Now look for a hint file osname_osvers, unless one has been
2565 : specified already.
2566 case "$hintfile" in
2567 ''|' ')
1e127011 2568 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 2569 : Also try without trailing minor version numbers.
1e127011
DD
2570 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2571 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2572 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2573 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
2574 case "$file" in
2575 '') dflt=none ;;
2576 *) case "$osvers" in
2577 '') dflt=$file
2578 ;;
dfe9444c 2579 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 2580 dflt=$file
dfe9444c 2581 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 2582 dflt=$xfile
dfe9444c 2583 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 2584 dflt=$xxfile
dfe9444c 2585 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 2586 dflt=$xxxfile
dfe9444c 2587 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 2588 dflt=$xxxxfile
dfe9444c 2589 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
2590 dflt="${osname}"
2591 else
2592 dflt=none
2593 fi
2594 ;;
2595 esac
85e6fe83
LW
2596 ;;
2597 esac
4e2a5f63
AD
2598 if $test -f Policy.sh ; then
2599 case "$dflt" in
2600 *Policy*) ;;
2601 none) dflt="Policy" ;;
2602 *) dflt="Policy $dflt" ;;
2603 esac
2604 fi
85e6fe83 2605 ;;
a0d0e21e 2606 *)
ecfc5424 2607 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 2608 ;;
2304df62 2609 esac
1aef975c 2610
4e2a5f63
AD
2611 if $test -f Policy.sh ; then
2612 $cat <<EOM
2613
2614There's also a Policy hint file available, which should make the
2615site-specific (policy) questions easier to answer.
2616EOM
2617
2618 fi
2619
2304df62
AD
2620 $cat <<EOM
2621
2622You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 2623A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 2624is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
2625
2626EOM
4e2a5f63 2627
2304df62 2628 rp="Which of these apply, if any?"
dfe9444c 2629 . UU/myread
85e6fe83
LW
2630 tans=$ans
2631 for file in $tans; do
4e2a5f63
AD
2632 if $test X$file = XPolicy -a -f Policy.sh; then
2633 . Policy.sh
2634 $cat Policy.sh >> UU/config.sh
2635 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
2636 . $src/hints/$file.sh
2637 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83 2638 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
2639 : nothing
2640 else
85e6fe83
LW
2641 : Give one chance to correct a possible typo.
2642 echo "$file.sh does not exist"
2643 dflt=$file
2644 rp="hint to use instead?"
dfe9444c 2645 . UU/myread
85e6fe83 2646 for file in $ans; do
dfe9444c
AD
2647 if $test -f "$src/hints/$file.sh"; then
2648 . $src/hints/$file.sh
2649 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
2650 elif $test X$ans = X -o X$ans = Xnone ; then
2651 : nothing
2652 else
2653 echo "$file.sh does not exist -- ignored."
2654 fi
2655 done
2304df62
AD
2656 fi
2657 done
85e6fe83 2658
2304df62 2659 hint=recommended
85e6fe83 2660 : Remember our hint file for later.
dfe9444c 2661 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 2662 hintfile="$file"
85e6fe83 2663 else
a0d0e21e 2664 hintfile=''
85e6fe83 2665 fi
2304df62
AD
2666fi
2667cd UU
2668;;
2669*)
2670 echo " "
2671 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
2672 tmp_n="$n"
2673 tmp_c="$c"
2304df62
AD
2674 cd ..
2675 cp $config_sh config.sh 2>/dev/null
a78b0d02 2676 chmod +w config.sh
2304df62
AD
2677 . ./config.sh
2678 cd UU
2679 cp ../config.sh .
ecfc5424
AD
2680 n="$tmp_n"
2681 c="$tmp_c"
2304df62
AD
2682 hint=previous
2683 ;;
2684esac
1aef975c 2685test "$override" && . ./optdef.sh
2304df62
AD
2686
2687: Restore computed paths
2688for file in $loclist $trylist; do
2689 eval $file="\$_$file"
2690done
2691
85e6fe83 2692cat << EOM
a0d0e21e 2693
85e6fe83 2694Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
2695The default value is probably right if the name rings a bell. Otherwise,
2696since spelling matters for me, either accept the default or answer "none"
2697to leave it blank.
a0d0e21e 2698
85e6fe83 2699EOM
85e6fe83 2700case "$osname" in
a0d0e21e 2701 ''|' ')
85e6fe83 2702 case "$hintfile" in
a0d0e21e 2703 ''|' '|none) dflt=none ;;
ecfc5424 2704 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
2705 esac
2706 ;;
2707 *) dflt="$osname" ;;
2708esac
2709rp="Operating system name?"
2710. ./myread
2711case "$ans" in
ecfc5424
AD
2712none) osname='' ;;
2713*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 2714esac
8ff267be 2715echo " "
2716case "$osvers" in
2717 ''|' ')
2718 case "$hintfile" in
2719 ''|' '|none) dflt=none ;;
2720 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2721 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2722 case "$dflt" in
2723 ''|' ') dflt=none ;;
2724 esac
2725 ;;
2726 esac
2727 ;;
2728 *) dflt="$osvers" ;;
2729esac
2730rp="Operating system version?"
2731. ./myread
2732case "$ans" in
2733none) osvers='' ;;
2734*) osvers="$ans" ;;
2735esac
2736
02e93a22
JH
2737
2738. ./posthint.sh
2739
2304df62 2740: who configured the system
59b83a6f 2741cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 2742cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
2743case "$cf_by" in
2744"")
8ff267be 2745 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
2746 case "$cf_by" in
2747 "") cf_by=unknown ;;
8ff267be 2748 esac ;;
2749esac
2304df62 2750
b4eb6b3d
JH
2751: set up the script used to warn in case of inconsistency
2752cat <<EOS >whoa
2753$startsh
2754EOS
2755cat <<'EOSC' >>whoa
2756dflt=y
2757echo " "
2758echo "*** WHOA THERE!!! ***" >&4
2759echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2760rp=" Keep the $hint value?"
2761. ./myread
2762case "$ans" in
2763y) td=$was; tu=$was;;
2764esac
2765EOSC
2766
2767: function used to set $1 to $val
2768setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2769case "$val$was" in
2770$define$undef) . ./whoa; eval "$var=\$td";;
2771$undef$define) . ./whoa; eval "$var=\$tu";;
2772*) eval "$var=$val";;
2773esac'
2774
2775case "$usethreads" in
2776$define|true|[yY]*) dflt='y';;
2777*) dflt='n';;
2778esac
2779cat <<EOM
2780
2781Perl can be built to take advantage of threads on some systems.
2782To do so, Configure can be run with -Dusethreads.
2783
2784Note that threading is a highly experimental feature, and
2785some known race conditions still remain. If you choose to try
2786it, be very sure to not actually deploy it for production
2787purposes. README.threads has more details, and is required
2788reading if you enable threads.
2789
2790If this doesn't make any sense to you, just accept the default '$dflt'.
2791EOM
2792rp='Build a threading Perl?'
2793. ./myread
2794case "$ans" in
2795y|Y) val="$define" ;;
2796*) val="$undef" ;;
2797esac
2798set usethreads
2799eval $setvar
2800
2801case "$usethreads" in
2802$define)
2803 $cat <<EOM
2804
2805As of 5.5.640, Perl has two different internal threading implementations,
2806the 5.005 version (5005threads) and an interpreter-based version
2807(ithreads) that has one interpreter per thread. Both are very
2808experimental. This arrangement exists to help developers work out
2809which one is better.
2810
2811If you're a casual user, you probably don't want interpreter-threads
2812at this time. There doesn't yet exist a way to create threads from
2813within Perl in this model, i.e., "use Thread;" will NOT work.
2814EOM
2815 : Default to ithreads unless overridden on command line or with
2816 : old config.sh
2817 dflt='y'
2818 case "$use5005threads" in
2819 $define|true|[yY]*) dflt='n';;
2820 esac
2821 case "$useithreads" in
2822 $undef|false|[nN]*) dflt='n';;
2823 esac
2824 rp='Use interpreter-based ithreads?'
2825 . ./myread
2826 case "$ans" in
2827 y|Y) val="$define" ;;
2828 *) val="$undef" ;;
2829 esac
2830 set useithreads
2831 eval $setvar
2832 : Now set use5005threads to the opposite value.
2833 case "$useithreads" in
2834 $define) val="$undef" ;;
2835 *) val="$define" ;;
2836 esac
2837 set use5005threads
2838 eval $setvar
2839 ;;
2840*)
2841 useithreads="$undef"
2842 use5005threads="$undef"
2843 ;;
2844esac
2845
2846case "$d_oldpthreads" in
2847'') : Configure tests would be welcome here. For now, assume undef.
2848 val="$undef" ;;
2849*) val="$d_oldpthreads" ;;
2850esac
2851set d_oldpthreads
2852eval $setvar
2853
2854
2855case "$usethreads" in
2856"$define"|true|[yY]*)
2857: Look for a hint-file generated 'call-back-unit'. If the
2858: user has specified that a threading perl is to be built,
2859: we may need to set or change some other defaults.
2860 if $test -f usethreads.cbu; then
2861 echo "Your platform has some specific hints for threaded builds, using them..."
2862 . ./usethreads.cbu
2863 else
2864 $cat <<EOM
2865(Your platform doesn't have any specific hints for threaded builds.
2866 Assuming POSIX threads, then.)
2867EOM
2868 fi
2869 ;;
2870esac
2871
2872cat <<EOM
2873
2874Perl can be built so that multiple Perl interpreters can coexist
2875within the same Perl executable.
2876EOM
2877
2878case "$useithreads" in
2879$define)
2880 cat <<EOM
2881This multiple interpreter support is required for interpreter-based threads.
2882EOM
2883 val="$define"
2884 ;;
2885*) case "$usemultiplicity" in
2886 $define|true|[yY]*) dflt='y';;
2887 *) dflt='n';;
2888 esac
2889 echo " "
2890 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2891 rp='Build Perl for multiplicity?'
2892 . ./myread
2893 case "$ans" in
2894 y|Y) val="$define" ;;
2895 *) val="$undef" ;;
2896 esac
2897 ;;
2898esac
2899set usemultiplicity
2900eval $setvar
2901
e5e20432
JH
2902: make some quick guesses about what we are up against
2903echo " "
2904$echo $n "Hmm... $c"
2905echo exit 1 >bsd
2906echo exit 1 >usg
2907echo exit 1 >v7
2908echo exit 1 >osf1
2909echo exit 1 >eunice
2910echo exit 1 >xenix
2911echo exit 1 >venix
2912echo exit 1 >os2
2913d_bsd="$undef"
2914$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2915if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2916then
2917 echo "Looks kind of like an OSF/1 system, but we'll see..."
2918 echo exit 0 >osf1
381aa1ff 2919elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
2920 xxx=`./loc addbib blurfl $pth`
2921 if $test -f $xxx; then
2922 echo "Looks kind of like a USG system with BSD features, but we'll see..."
2923 echo exit 0 >bsd
2924 echo exit 0 >usg
2925 else
2926 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2927 echo "Looks kind of like an extended USG system, but we'll see..."
2928 else
2929 echo "Looks kind of like a USG system, but we'll see..."
2930 fi
2931 echo exit 0 >usg
2932 fi
2933elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2934 echo "Looks kind of like a BSD system, but we'll see..."
2935 d_bsd="$define"
2936 echo exit 0 >bsd
2937else
2938 echo "Looks kind of like a Version 7 system, but we'll see..."
2939 echo exit 0 >v7
2940fi
2941case "$eunicefix" in
2942*unixtovms*)
2943 $cat <<'EOI'
2944There is, however, a strange, musty smell in the air that reminds me of
2945something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2946EOI
2947 echo exit 0 >eunice
2948 d_eunice="$define"
2949: it so happens the Eunice I know will not run shell scripts in Unix format
2950 ;;
2951*)
2952 echo " "
2953 echo "Congratulations. You aren't running Eunice."
2954 d_eunice="$undef"
2955 ;;
2956esac
2957: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
2958: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
2959: semicolon as a patch separator
e5e20432
JH
2960case "$p_" in
2961:) ;;
2962*)
2963 $cat <<'EOI'
2964I have the feeling something is not exactly right, however...don't tell me...
2965lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 2966(Or you may be running DOS with DJGPP.)
e5e20432
JH
2967EOI
2968 echo exit 0 >os2
2969 ;;
2970esac
2971if test -f /xenix; then
2972 echo "Actually, this looks more like a XENIX system..."
2973 echo exit 0 >xenix
2974 d_xenix="$define"
2975else
2976 echo " "
2977 echo "It's not Xenix..."
2978 d_xenix="$undef"
2979fi
2980chmod +x xenix
2981$eunicefix xenix
2982if test -f /venix; then
2983 echo "Actually, this looks more like a VENIX system..."
2984 echo exit 0 >venix
2985else
2986 echo " "
2987 if ./xenix; then
2988 : null
2989 else
2990 echo "Nor is it Venix..."
2991 fi
2992fi
2993chmod +x bsd usg v7 osf1 eunice xenix venix os2
2994$eunicefix bsd usg v7 osf1 eunice xenix venix os2
2995$rm -f foo
2996
5869b1f1
JH
2997case "$cc" in
2998'') dflt=cc;;
2999*) dflt="$cc";;
3000esac
3001rp="Use which C compiler?"
3002. ./myread
3003cc="$ans"
e5e20432
JH
3004: Look for a hint-file generated 'call-back-unit'. Now that the
3005: user has specified the compiler, we may need to set or change some
3006: other defaults.
3007if $test -f cc.cbu; then
3008 . ./cc.cbu
3009fi
2573c5f9 3010. ./checkcc
8a27cf78 3011
e5e20432
JH
3012echo " "
3013echo "Checking for GNU cc in disguise and/or its version number..." >&4
3014$cat >gccvers.c <<EOM
3015#include <stdio.h>
3016int main() {
3017#ifdef __GNUC__
3018#ifdef __VERSION__
3019 printf("%s\n", __VERSION__);
3020#else
3021 printf("%s\n", "1");
3022#endif
3023#endif
3024 exit(0);
3025}
3026EOM
7a282f6d 3027if $cc -o gccvers $ldflags gccvers.c; then
e5e20432
JH
3028 gccversion=`./gccvers`
3029 case "$gccversion" in
3030 '') echo "You are not using GNU cc." ;;
fc68435e 3031 *) echo "You are using GNU cc $gccversion."
e723fc21 3032 ccname=gcc
fc68435e 3033 ;;
e5e20432
JH
3034 esac
3035else
3036 echo " "
3037 echo "*** WHOA THERE!!! ***" >&4
3038 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3039 case "$knowitall" in
3040 '')
3041 echo " You'd better start hunting for one and let me know about it." >&4
3042 exit 1
3043 ;;
3044 esac
3045fi
3046$rm -f gccvers*
3047case "$gccversion" in
30481*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3049esac
5b463ca7
KS
3050case "$gccversion" in
3051'') gccosandvers='' ;;
10b4ebb5
JH
3052*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3053 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3054 gccshortvers=''
5b463ca7 3055 case "$gccosandvers" in
02903077
JH
3056 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3057 $osname$osvers) ;; # looking good
5b463ca7
KS
3058 $osname*) cat <<EOM >&4
3059
3060*** WHOA THERE!!! ***
3061
3062 Your gcc has not been compiled for the exact release of
3063 your operating system ($gccosandvers versus $osname$osvers).
3064
3065 In general it is a good idea to keep gcc synchronized with
3066 the operating system because otherwise serious problems
3067 may ensue when trying to compile software, like Perl.
3068
3069 I'm trying to be optimistic here, though, and will continue.
3070 If later during the configuration and build icky compilation
02903077
JH
3071 problems appear (headerfile conflicts being the most common
3072 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3073 your operating system release.
3074
3075EOM
3076 ;;
81575342 3077 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3078 esac
3079 ;;
3080esac
e723fc21
JH
3081case "$ccname" in
3082'') ccname="$cc" ;;
3083esac
e5e20432 3084
8a27cf78
JH
3085: see how we invoke the C preprocessor
3086echo " "
3087echo "Now, how can we feed standard input to your C preprocessor..." >&4
3088cat <<'EOT' >testcpp.c
3089#define ABC abc
3090#define XYZ xyz
3091ABC.XYZ
3092EOT
3093cd ..
3094if test ! -f cppstdin; then
3095 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3096 # AIX cc -E doesn't show the absolute headerfile
3097 # locations but we'll cheat by using the -M flag.
3098 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
3099 else
3100 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3101 fi
3102else
3103 echo "Keeping your $hint cppstdin wrapper."
3104fi
3105chmod 755 cppstdin
3106wrapper=`pwd`/cppstdin
3107ok='false'
3108cd UU
3109
3110if $test "X$cppstdin" != "X" && \
3111 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3112 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3113then
3114 echo "You used to use $cppstdin $cppminus so we'll use that again."
3115 case "$cpprun" in
3116 '') echo "But let's see if we can live without a wrapper..." ;;
3117 *)
3118 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3119 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3120 then
3121 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3122 ok='true'
3123 else
3124 echo "(However, $cpprun $cpplast does not work, let's see...)"
3125 fi
3126 ;;
3127 esac
3128else
3129 case "$cppstdin" in
3130 '') ;;
3131 *)
3132 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3133 ;;
3134 esac
3135fi
3136
3137if $ok; then
3138 : nothing
3139elif echo 'Maybe "'"$cc"' -E" will work...'; \
3140 $cc -E <testcpp.c >testcpp.out 2>&1; \
3141 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3142 echo "Yup, it does."
3143 x_cpp="$cc -E"
3144 x_minus='';
3145elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3146 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3147 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3148 echo "Yup, it does."
3149 x_cpp="$cc -E"
3150 x_minus='-';
3151elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3152 $cc -P <testcpp.c >testcpp.out 2>&1; \
3153 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3154 echo "Yipee, that works!"
3155 x_cpp="$cc -P"
3156 x_minus='';
3157elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3158 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3159 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3160 echo "At long last!"
3161 x_cpp="$cc -P"
3162 x_minus='-';
3163elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3164 $cpp <testcpp.c >testcpp.out 2>&1; \
3165 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3166 echo "It works!"
3167 x_cpp="$cpp"
3168 x_minus='';
3169elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3170 $cpp - <testcpp.c >testcpp.out 2>&1; \
3171 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3172 echo "Hooray, it works! I was beginning to wonder."
3173 x_cpp="$cpp"
3174 x_minus='-';
3175elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3176 $wrapper <testcpp.c >testcpp.out 2>&1; \
3177 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3178 x_cpp="$wrapper"
3179 x_minus=''
3180 echo "Eureka!"
3181else
3182 dflt=''
3183 rp="No dice. I can't find a C preprocessor. Name one:"
3184 . ./myread
3185 x_cpp="$ans"
3186 x_minus=''
3187 $x_cpp <testcpp.c >testcpp.out 2>&1
3188 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3189 echo "OK, that will do." >&4
3190 else
3191echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3192 exit 1
3193 fi
3194fi
3195
3196case "$ok" in
3197false)
3198 cppstdin="$x_cpp"
3199 cppminus="$x_minus"
3200 cpprun="$x_cpp"
3201 cpplast="$x_minus"
3202 set X $x_cpp
3203 shift
3204 case "$1" in
3205 "$cpp")
3206 echo "Perhaps can we force $cc -E using a wrapper..."
3207 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3208 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3209 then
3210 echo "Yup, we can."
3211 cppstdin="$wrapper"
3212 cppminus='';
3213 else
3214 echo "Nope, we'll have to live without it..."
3215 fi
3216 ;;
3217 esac
3218 case "$cpprun" in
3219 "$wrapper")
3220 cpprun=''
3221 cpplast=''
3222 ;;
3223 esac
3224 ;;
3225esac
3226
3227case "$cppstdin" in
3228"$wrapper"|'cppstdin') ;;
3229*) $rm -f $wrapper;;
3230esac
3231$rm -f testcpp.c testcpp.out
3232
bd9b35c9
JH
3233: decide how portable to be. Allow command line overrides.
3234case "$d_portable" in
3235"$undef") ;;
3236*) d_portable="$define" ;;
104d25b7 3237esac
85ab1d1d 3238
bd9b35c9
JH
3239: set up shell script to do ~ expansion
3240cat >filexp <<EOSS
3241$startsh
3242: expand filename
3243case "\$1" in
3244 ~/*|~)
3245 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3246 ;;
3247 ~*)
3248 if $test -f /bin/csh; then
3249 /bin/csh -f -c "glob \$1"
3250 failed=\$?
3251 echo ""
3252 exit \$failed
e5e20432 3253 else
bd9b35c9
JH
3254 name=\`$expr x\$1 : '..\([^/]*\)'\`
3255 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3256 if $test ! -d "\$dir"; then
3257 me=\`basename \$0\`
3258 echo "\$me: can't locate home directory for: \$name" >&2
3259 exit 1
3260 fi
3261 case "\$1" in
3262 */*)
3263 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3264 ;;
3265 *)
3266 echo \$dir
e5e20432
JH
3267 ;;
3268 esac
3269 fi
b691c02f 3270 ;;
4633a7c4 3271*)
bd9b35c9 3272 echo \$1
2304df62
AD
3273 ;;
3274esac
4633a7c4
LW
3275EOSS
3276chmod +x filexp
3277$eunicefix filexp
2304df62
AD
3278
3279: now set up to get a file name
28757baa 3280cat <<EOS >getfile
3281$startsh
3282EOS
3283cat <<'EOSC' >>getfile
2304df62
AD
3284tilde=''
3285fullpath=''
3286already=''
3287skip=''
3288none_ok=''
3289exp_file=''
a0d0e21e 3290nopath_ok=''
2304df62
AD
3291orig_rp="$rp"
3292orig_dflt="$dflt"
b233458b
JH
3293case "$gfpth" in
3294'') gfpth='.' ;;
3295esac
2304df62
AD
3296
3297case "$fn" in
ecfc5424 3298*\(*)
381aa1ff 3299 expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
3300 fn=`echo $fn | sed 's/(.*)//'`
3301 ;;
3302esac
3303
3304case "$fn" in
a0d0e21e
LW
3305*:*)
3306 loc_file=`expr $fn : '.*:\(.*\)'`
3307 fn=`expr $fn : '\(.*\):.*'`
3308 ;;
3309esac
3310
3311case "$fn" in
2304df62
AD
3312*~*) tilde=true;;
3313esac
3314case "$fn" in
3315*/*) fullpath=true;;
3316esac
3317case "$fn" in
3318*+*) skip=true;;
3319esac
3320case "$fn" in
3321*n*) none_ok=true;;
3322esac
3323case "$fn" in
3324*e*) exp_file=true;;
3325esac
a0d0e21e
LW
3326case "$fn" in
3327*p*) nopath_ok=true;;
3328esac
2304df62
AD
3329
3330case "$fn" in
3331*f*) type='File';;
3332*d*) type='Directory';;
a0d0e21e 3333*l*) type='Locate';;
2304df62
AD
3334esac
3335
3336what="$type"
3337case "$what" in
3338Locate) what='File';;
3339esac
3340
3341case "$exp_file" in
3342'')
3343 case "$d_portable" in
3344 "$define") ;;
3345 *) exp_file=true;;
3346 esac
3347 ;;
3348esac
3349
3350cd ..
3351while test "$type"; do
3352 redo=''
3353 rp="$orig_rp"
3354 dflt="$orig_dflt"
3355 case "$tilde" in
3356 true) rp="$rp (~name ok)";;
3357 esac
3358 . UU/myread
ecfc5424
AD
3359 if test -f UU/getfile.ok && \
3360 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3361 then
3362 value="$ans"
3363 ansexp="$ans"
3364 break
3365 fi
2304df62
AD
3366 case "$ans" in
3367 none)
3368 value=''
3369 ansexp=''
3370 case "$none_ok" in
3371 true) type='';;
3372 esac
3373 ;;
3374 *)
3375 case "$tilde" in
3376 '') value="$ans"
3377 ansexp="$ans";;
3378 *)
3379 value=`UU/filexp $ans`
3380 case $? in
3381 0)
3382 if test "$ans" != "$value"; then
ecfc5424 3383 echo "(That expands to $value on this system.)"
2304df62
AD
3384 fi
3385 ;;
3386 *) value="$ans";;
3387 esac
3388 ansexp="$value"
3389 case "$exp_file" in
3390 '') value="$ans";;
3391 esac
3392 ;;
3393 esac
3394 case "$fullpath" in
3395 true)
3396 case "$ansexp" in
3397 /*) value="$ansexp" ;;
23da6c43 3398 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
3399 *)
3400 redo=true
3401 case "$already" in
3402 true)
3403 echo "I shall only accept a full path name, as in /bin/ls." >&4
3404 echo "Use a ! shell escape if you wish to check pathnames." >&4
3405 ;;
3406 *)
3407 echo "Please give a full path name, starting with slash." >&4
3408 case "$tilde" in
3409 true)
3410 echo "Note that using ~name is ok provided it expands well." >&4
3411 already=true
3412 ;;
3413 esac
3414 esac
3415 ;;
3416 esac
3417 ;;
3418 esac
3419 case "$redo" in
3420 '')
3421 case "$type" in
3422 File)
b233458b
JH
3423 for fp in $gfpth; do
3424 if test "X$fp" = X.; then
3425 pf="$ansexp"
3426 else
3427 pf="$fp/$ansexp"
3428 fi
3429 if test -f "$pf"; then
3430 type=''
3431 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3432 then
3433 echo "($value is not a plain file, but that's ok.)"
3434 type=''
3435 fi
3436 if test X"$type" = X; then
3437 value="$pf"
3438 break
3439 fi
3440 done
2304df62
AD
3441 ;;
3442 Directory)
b233458b
JH
3443 for fp in $gfpth; do
3444 if test "X$fp" = X.; then
f78bfc9c
JH
3445 dir="$ans"
3446 direxp="$ansexp"
b233458b 3447 else
dd858076 3448 dir="$fp/$ansexp"
f78bfc9c 3449 direxp="$fp/$ansexp"
b233458b 3450 fi
f78bfc9c 3451 if test -d "$direxp"; then
b233458b 3452 type=''
f78bfc9c 3453 value="$dir"
b233458b
JH
3454 break
3455 fi
3456 done
2304df62
AD
3457 ;;
3458 Locate)
40000a8c 3459 if test -d "$ansexp"; then
a0d0e21e
LW
3460 echo "(Looking for $loc_file in directory $value.)"
3461 value="$value/$loc_file"
40000a8c 3462 ansexp="$ansexp/$loc_file"
2304df62 3463 fi
40000a8c 3464 if test -f "$ansexp"; then
2304df62
AD
3465 type=''
3466 fi
a0d0e21e
LW
3467 case "$nopath_ok" in
3468 true) case "$value" in
3469 */*) ;;
3470 *) echo "Assuming $value will be in people's path."
3471 type=''
3472 ;;
3473 esac
3474 ;;
3475 esac
2304df62
AD
3476 ;;
3477 esac
3478
3479 case "$skip" in
3480 true) type='';
3481 esac
3482
3483 case "$type" in
3484 '') ;;
3485 *)
3486 if test "$fastread" = yes; then
3487 dflt=y
3488 else
3489 dflt=n
3490 fi
3491 rp="$what $value doesn't exist. Use that name anyway?"
3492 . UU/myread
3493 dflt=''
3494 case "$ans" in
3495 y*) type='';;
3496 *) echo " ";;
3497 esac
3498 ;;
3499 esac
3500 ;;
3501 esac
3502 ;;
3503 esac
3504done
3505cd UU
3506ans="$value"
3507rp="$orig_rp"
3508dflt="$orig_dflt"
ecfc5424 3509rm -f getfile.ok
b233458b 3510test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3511EOSC
3512
bd9b35c9
JH
3513: What should the include directory be ?
3514echo " "
3515$echo $n "Hmm... $c"
3516dflt='/usr/include'
3517incpath=''
3518mips_type=''
3519if $test -f /bin/mips && /bin/mips; then
3520 echo "Looks like a MIPS system..."
3521 $cat >usr.c <<'EOCP'
3522#ifdef SYSTYPE_BSD43
3523/bsd43
3524#endif
3525EOCP
8a27cf78 3526 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
3527 dflt='/bsd43/usr/include'
3528 incpath='/bsd43'
3529 mips_type='BSD 4.3'
3530 else
3531 mips_type='System V'
3532 fi
3533 $rm -f usr.c usr.out
3534 echo "and you're compiling with the $mips_type compiler and libraries."
3535 xxx_prompt=y
3536 echo "exit 0" >mips
3537else
3538 echo "Doesn't look like a MIPS system."
3539 xxx_prompt=n
3540 echo "exit 1" >mips
3541fi
3542chmod +x mips
3543$eunicefix mips
3544case "$usrinc" in
3545'') ;;
3546*) dflt="$usrinc";;
3547esac
3548case "$xxx_prompt" in
3549y) fn=d/
3550 echo " "
3551 rp='Where are the include files you want to use?'
3552 . ./getfile
3553 usrinc="$ans"
8e07c86e 3554 ;;
bd9b35c9 3555*) usrinc="$dflt"
8e07c86e
AD
3556 ;;
3557esac
2304df62 3558
bd9b35c9
JH
3559: Set private lib path
3560case "$plibpth" in
3561'') if ./mips; then
3562 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3563 fi;;
3564esac
3565case "$libpth" in
3566' ') dlist='';;
3567'') dlist="$loclibpth $plibpth $glibpth";;
3568*) dlist="$libpth";;
3569esac
3570
3571: Now check and see which directories actually exist, avoiding duplicates
3572libpth=''
3573for xxx in $dlist
3574do
3575 if $test -d $xxx; then
3576 case " $libpth " in
3577 *" $xxx "*) ;;
3578 *) libpth="$libpth $xxx";;
3579 esac
3580 fi
3581done
3582$cat <<'EOM'
3583
3584Some systems have incompatible or broken versions of libraries. Among
3585the directories listed in the question below, please remove any you
3586know not to be holding relevant libraries, and add any that are needed.
3587Say "none" for none.
8e07c86e
AD
3588
3589EOM
bd9b35c9
JH
3590case "$libpth" in
3591'') dflt='none';;
8e07c86e 3592*)
bd9b35c9
JH
3593 set X $libpth
3594 shift
3595 dflt=${1+"$@"}
8e07c86e 3596 ;;
a0d0e21e 3597esac
bd9b35c9
JH
3598rp="Directories to use for library searches?"
3599. ./myread
3600case "$ans" in
3601none) libpth=' ';;
3602*) libpth="$ans";;
3603esac
a0d0e21e 3604
bd9b35c9
JH
3605: compute shared library extension
3606case "$so" in
3607'')
3608 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3609 dflt='sl'
dd4e71fd 3610 else
bd9b35c9 3611 dflt='so'
dd4e71fd
JH
3612 fi
3613 ;;
bd9b35c9 3614*) dflt="$so";;
dd4e71fd 3615esac
dd4e71fd
JH
3616$cat <<EOM
3617
bd9b35c9 3618On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 3619you want to suppress searching of shared libraries for the remainder
bd9b35c9 3620of this configuration.
dd4e71fd
JH
3621
3622EOM
bd9b35c9
JH
3623rp='What is the file extension used for shared libraries?'
3624. ./myread
3625so="$ans"
dd4e71fd 3626
bd9b35c9
JH
3627: Define several unixisms.
3628: Hints files or command line option can be used to override them.
3629: The convoluted testing is in case hints files set either the old
3630: or the new name.
3631case "$_exe" in
3632'') case "$exe_ext" in
3633 '') ;;
3634 *) _exe="$exe_ext" ;;
dd4e71fd 3635 esac
bd9b35c9 3636 ;;
bfb7748a 3637esac
bd9b35c9
JH
3638case "$_a" in
3639'') case "$lib_ext" in
3640 '') _a='.a';;
3641 *) _a="$lib_ext" ;;
dd4e71fd
JH
3642 esac
3643 ;;
dd4e71fd 3644esac
bd9b35c9
JH
3645case "$_o" in
3646'') case "$obj_ext" in
3647 '') _o='.o';;
3648 *) _o="$obj_ext";;
3649 esac
3650 ;;
3651esac
3652case "$p_" in
3653'') case "$path_sep" in
3654 '') p_=':';;
3655 *) p_="$path_sep";;
3656 esac
3657 ;;
3658esac
3659exe_ext=$_exe
3660lib_ext=$_a
3661obj_ext=$_o
3662path_sep=$p_
dd4e71fd 3663
b4eb6b3d
JH
3664: Which makefile gets called first. This is used by make depend.
3665case "$firstmakefile" in
3666'') firstmakefile='makefile';;
4633a7c4 3667esac
4633a7c4 3668
0f0995ae
JH
3669case "$usesocks" in
3670$define|true|[yY]*) dflt='y';;
3671*) dflt='n';;
3672esac
bd9b35c9 3673cat <<EOM
4633a7c4 3674
bd9b35c9 3675Perl can be built to use the SOCKS proxy protocol library. To do so,
cf829ab0
JH
3676Configure must be run with -Dusesocks. If you use SOCKS you also need
3677to use the PerlIO abstraction layer, this will be implicitly selected.
4633a7c4 3678
0f0995ae 3679If this doesn't make any sense to you, just accept the default '$dflt'.
bd9b35c9 3680EOM
bd9b35c9
JH
3681rp='Build Perl for SOCKS?'
3682. ./myread
3683case "$ans" in
3684y|Y) val="$define" ;;
3685*) val="$undef" ;;
3686esac
3687set usesocks
3688eval $setvar
3689
cf829ab0
JH
3690case "$usesocks" in
3691$define|true|[yY]*) useperlio="$define";;
3692esac
3693
bd9b35c9
JH
3694: Looking for optional libraries
3695echo " "
3696echo "Checking for optional libraries..." >&4
3697case "$libs" in
3698' '|'') dflt='';;
3699*) dflt="$libs";;
3700esac
3701case "$libswanted" in
3702'') libswanted='c_s';;
3703esac
3704case "$usesocks" in
923fc586 3705"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 3706esac
68435ea7
JH
3707libsfound=''
3708libsfiles=''
3709libsdirs=''
13b3f787
JH
3710libspath=''
3711for thisdir in $libpth $xlibpth; do
3712 test -d $thisdir && libspath="$libspath $thisdir"
3713done
bd9b35c9 3714for thislib in $libswanted; do
13b3f787 3715 for thisdir in $libspath; do
f7dd4e7f
JH
3716 xxx=''
3717 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3718 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3719 $test -f "$xxx" && eval $libscheck
3720 $test -f "$xxx" && libstyle=shared
3721 fi
3722 if test ! -f "$xxx"; then
3723 xxx=$thisdir/lib$thislib.$so
3724 $test -f "$xxx" && eval $libscheck
3725 $test -f "$xxx" && libstyle=shared
3726 fi
3727 if test ! -f "$xxx"; then
3728 xxx=$thisdir/lib$thislib$_a
3729 $test -f "$xxx" && eval $libscheck
3730 $test -f "$xxx" && libstyle=static
3731 fi
3732 if test ! -f "$xxx"; then
3733 xxx=$thisdir/$thislib$_a
3734 $test -f "$xxx" && eval $libscheck
3735 $test -f "$xxx" && libstyle=static
3736 fi
3737 if test ! -f "$xxx"; then
3738 xxx=$thisdir/lib${thislib}_s$_a
3739 $test -f "$xxx" && eval $libscheck
3740 $test -f "$xxx" && libstyle=static
09ea5ba9 3741 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
3742 fi
3743 if test ! -f "$xxx"; then
3744 xxx=$thisdir/Slib$thislib$_a
3745 $test -f "$xxx" && eval $libscheck
3746 $test -f "$xxx" && libstyle=static
3747 fi
3748 if $test -f "$xxx"; then
43999f95 3749 case "$libstyle" in
f7dd4e7f
JH
3750 shared) echo "Found -l$thislib (shared)." ;;
3751 static) echo "Found -l$thislib." ;;
3752 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 3753 esac
bd9b35c9
JH
3754 case " $dflt " in
3755 *"-l$thislib "*);;
f7dd4e7f 3756 *) dflt="$dflt -l$thislib"
43999f95
JH
3757 libsfound="$libsfound $xxx"
3758 yyy=`basename $xxx`
3759 libsfiles="$libsfiles $yyy"
1e127011 3760 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
3761 case " $libsdirs " in
3762 *" $yyy "*) ;;
3763 *) libsdirs="$libsdirs $yyy" ;;
3764 esac
3765 ;;
bd9b35c9 3766 esac
f7dd4e7f
JH
3767 break
3768 fi
3769 done
3770 if $test ! -f "$xxx"; then
3771 echo "No -l$thislib."
bd9b35c9
JH
3772 fi
3773done
3774set X $dflt
3775shift
3776dflt="$*"
3777case "$libs" in
3778'') dflt="$dflt";;
3779*) dflt="$libs";;
3780esac
3781case "$dflt" in
3782' '|'') dflt='none';;
3783esac
4633a7c4 3784
bd9b35c9 3785$cat <<EOM
4633a7c4 3786
bd9b35c9
JH
3787In order to compile $package on your machine, a number of libraries
3788are usually needed. Include any other special libraries here as well.
3789Say "none" for none. The default list is almost always right.
8e07c86e 3790EOM
8e07c86e 3791
bd9b35c9
JH
3792echo " "
3793rp="What libraries to use?"
3794. ./myread
3795case "$ans" in
3796none) libs=' ';;
3797*) libs="$ans";;
3798esac
d71b2b6b 3799
bd9b35c9
JH
3800: determine optimization, if desired, or use for debug flag also
3801case "$optimize" in
3802' '|$undef) dflt='none';;
3803'') dflt='-O';;
3804*) dflt="$optimize";;
3805esac
3806$cat <<EOH
d71b2b6b 3807
bd9b35c9
JH
3808By default, $package compiles with the -O flag to use the optimizer.
3809Alternately, you might want to use the symbolic debugger, which uses
3810the -g flag (on traditional Unix systems). Either flag can be
3811specified here. To use neither flag, specify the word "none".
d71b2b6b 3812
bd9b35c9
JH
3813EOH
3814rp="What optimizer/debugger flag should be used?"
3815. ./myread
3816optimize="$ans"
3817case "$optimize" in
3818'none') optimize=" ";;
3819esac
3820
3821dflt=''
3822: We will not override a previous value, but we might want to
3823: augment a hint file
3824case "$hint" in
3825default|recommended)
3826 case "$gccversion" in
3827 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 3828 esac
bd9b35c9
JH
3829 case "$optimize" in
3830 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 3831 esac
bd9b35c9
JH
3832 case "$gccversion" in
3833 2*) if test -d /etc/conf/kconfig.d &&
3834 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3835 then
3836 dflt="$dflt -posix"
3837 fi
f0d04425 3838 ;;
bd9b35c9
JH
3839 esac
3840 case "$gccversion" in
3841 1*) ;;
3842 2.[0-8]*) ;;
3843 ?*) echo " "
3844 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3845 echo 'int main(void) { return 0; }' > gcctest.c
3846 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3847 echo "Yes, it does." 2>&1
3848 case "$ccflags" in
3849 *strict-aliasing*)
3850 echo "Leaving current flags $ccflags alone." 2>&1
3851 ;;
3852 *) dflt="$dflt -fno-strict-aliasing" ;;
3853 esac
3854 else
3855 echo "Nope, it doesn't, but that's ok." 2>&1
3856 fi
f0d04425 3857 ;;
e5e20432
JH
3858 esac
3859 ;;
3860esac
3861
bd9b35c9
JH
3862case "$mips_type" in
3863*BSD*|'') inclwanted="$locincpth $usrinc";;
3864*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3865esac
3866for thisincl in $inclwanted; do
3867 if $test -d $thisincl; then
3868 if $test x$thisincl != x$usrinc; then
3869 case "$dflt" in
422af00a
LC
3870 *" -I$thisincl "*);;
3871 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
3872 esac
3873 fi
3874 fi
3875done
40a7a20a 3876
bd9b35c9
JH
3877inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3878 xxx=true;
3879elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3880 xxx=true;
3881else
3882 xxx=false;
3883fi;
3884if $xxx; then
3885 case "$dflt" in
3886 *$2*);;
3887 *) dflt="$dflt -D$2";;
3888 esac;
3889fi'
40a7a20a 3890
bd9b35c9 3891set signal.h LANGUAGE_C; eval $inctest
40a7a20a 3892
bd9b35c9
JH
3893case "$usesocks" in
3894$define)
3895 ccflags="$ccflags -DSOCKS"
3896 ;;
3897esac
40a7a20a 3898
bd9b35c9
JH
3899case "$hint" in
3900default|recommended) dflt="$ccflags $dflt" ;;
3901*) dflt="$ccflags";;
3902esac
40a7a20a 3903
bd9b35c9
JH
3904case "$dflt" in
3905''|' ') dflt=none;;
3906esac
422af00a 3907
bd9b35c9 3908$cat <<EOH
40a7a20a 3909
bd9b35c9
JH
3910Your C compiler may want other flags. For this question you should include
3911-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3912but you should NOT include libraries or ld flags like -lwhatever. If you
3913want $package to honor its debug switch, you should include -DDEBUGGING here.
3914Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 3915
bd9b35c9 3916To use no flags, specify the word "none".
40a7a20a 3917
bd9b35c9
JH
3918EOH
3919set X $dflt
3920shift
3921dflt=${1+"$@"}
3922rp="Any additional cc flags?"
3923. ./myread
3924case "$ans" in
3925none) ccflags='';;
3926*) ccflags="$ans";;
3927esac
8e07c86e 3928
bd9b35c9
JH
3929: the following weeds options from ccflags that are of no interest to cpp
3930cppflags="$ccflags"
3931case "$gccversion" in
39321*) cppflags="$cppflags -D__GNUC__"
4633a7c4 3933esac
bd9b35c9
JH
3934case "$mips_type" in
3935'');;
3936*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3937esac
3938case "$cppflags" in
3939'');;
3940*)
3941 echo " "
3942 echo "Let me guess what the preprocessor flags are..." >&4
3943 set X $cppflags
3944 shift
3945 cppflags=''
3946 $cat >cpp.c <<'EOM'
3947#define BLURFL foo
8e07c86e 3948
bd9b35c9
JH
3949BLURFL xx LFRULB
3950EOM
3951 previous=''
3952 for flag in $*
3953 do
3954 case "$flag" in
3955 -*) ftry="$flag";;
3956 *) ftry="$previous $flag";;
3957 esac
3958 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3959 >cpp1.out 2>/dev/null && \
3960 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3961 >cpp2.out 2>/dev/null && \
3962 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3963 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3964 then
3965 cppflags="$cppflags $ftry"
3966 previous=''
3967 else
3968 previous="$flag"
3969 fi
3970 done
3971 set X $cppflags
3972 shift
3973 cppflags=${1+"$@"}
3974 case "$cppflags" in
3975 *-*) echo "They appear to be: $cppflags";;
3976 esac
3977 $rm -f cpp.c cpp?.out
2afac517 3978 ;;
3979esac
8e07c86e 3980
bd9b35c9
JH
3981: flags used in final linking phase
3982case "$ldflags" in
3983'') if ./venix; then
3984 dflt='-i -z'
10a23457 3985 else
bd9b35c9 3986 dflt=''
10a23457 3987 fi
bd9b35c9
JH
3988 case "$ccflags" in
3989 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 3990 esac
bd9b35c9
JH
3991 ;;
3992*) dflt="$ldflags";;
3993esac
3994
3995: Try to guess additional flags to pick up local libraries.
3996for thislibdir in $libpth; do
3997 case " $loclibpth " in
3998 *" $thislibdir "*)
3999 case "$dflt " in
4000 *"-L$thislibdir "*) ;;
4001 *) dflt="$dflt -L$thislibdir" ;;
4002 esac
c4f23d77
AD
4003 ;;
4004 esac
bd9b35c9 4005done
c4f23d77 4006
bd9b35c9
JH
4007case "$dflt" in
4008'') dflt='none' ;;
4009esac
c4f23d77 4010
bd9b35c9
JH
4011$cat <<EOH
4012
4013Your C linker may need flags. For this question you should
4014include -L/whatever and any other flags used by the C linker, but you
4015should NOT include libraries like -lwhatever.
4016
4017Make sure you include the appropriate -L/path flags if your C linker
4018does not normally search all of the directories you specified above,
4019namely
4020 $libpth
4021To use no flags, specify the word "none".
4022
4023EOH
4024
4025rp="Any additional ld flags (NOT including libraries)?"
4026. ./myread
4027case "$ans" in
4028none) ldflags='';;
4029*) ldflags="$ans";;
4030esac
4031rmlist="$rmlist pdp11"
4032
4033: coherency check
4034echo " "
4035echo "Checking your choice of C compiler and flags for coherency..." >&4
4036$cat > try.c <<'EOF'
4037#include <stdio.h>
4038int main() { printf("Ok\n"); exit(0); }
4039EOF
7a282f6d 4040set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
4041shift
4042$cat >try.msg <<'EOM'
4043I've tried to compile and run the following simple program:
4044
4045EOM
4046$cat try.c >> try.msg
4047
4048$cat >> try.msg <<EOM
4049
4050I used the command:
4051
4052 $*
4053 ./try
4054
4055and I got the following output:
4056
4057EOM
4058dflt=y
7a282f6d 4059if sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
bd9b35c9
JH
4060 if sh -c './try' >>try.msg 2>&1; then
4061 xxx=`./try`
4062 case "$xxx" in
4063 "Ok") dflt=n ;;
4064 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4065 case " $libs " in
4066 *" -lsfio "*)
4067 cat >> try.msg <<'EOQS'
4068If $libs contains -lsfio, and sfio is mis-configured, then it
4069sometimes (apparently) runs and exits with a 0 status, but with no
4070output! It may have to do with sfio's use of _exit vs. exit.
4071
4072EOQS
4073 rp="You have a big problem. Shall I abort Configure"
4074 dflt=y
4075 ;;
4076 esac
4077 ;;
4078 esac
4079 else
4080 echo "The program compiled OK, but exited with status $?." >>try.msg
4081 rp="You have a problem. Shall I abort Configure"
4082 dflt=y
4083 fi
4084else
4085 echo "I can't compile the test program." >>try.msg
4086 rp="You have a BIG problem. Shall I abort Configure"
4087 dflt=y
4088fi
4089case "$dflt" in
4090y)
4091 $cat try.msg >&4
4092 case "$knowitall" in
4093 '')
4094 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 4095 ;;
bd9b35c9 4096 *) dflt=n;;
c4f23d77 4097 esac
bd9b35c9
JH
4098 echo " "
4099 . ./myread
4100 case "$ans" in
4101 n*|N*) ;;
4102 *) echo "Ok. Stopping Configure." >&4
4103 exit 1
c4f23d77
AD
4104 ;;
4105 esac
4106 ;;
bd9b35c9 4107n) echo "OK, that should do.";;
c4f23d77 4108esac
bd9b35c9 4109$rm -f try try.* core
c4f23d77 4110
b4eb6b3d
JH
4111: define an is-a-typedef? function
4112typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4113case "$inclist" in
4114"") inclist="sys/types.h";;
4115esac;
4116eval "varval=\$$var";
4117case "$varval" in
4118"")
4119 $rm -f temp.c;
4120 for inc in $inclist; do
4121 echo "#include <$inc>" >>temp.c;
4122 done;
4123 echo "#ifdef $type" >> temp.c;
4124 echo "printf(\"We have $type\");" >> temp.c;
4125 echo "#endif" >> temp.c;
4126 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4127 if $contains $type temp.E >/dev/null 2>&1; then
4128 eval "$var=\$type";
4129 else
4130 eval "$var=\$def";
4131 fi;
4132 $rm -f temp.?;;
4133*) eval "$var=\$varval";;
4134esac'
4135
4136: define an is-a-typedef? function that prompts if the type is not available.
4137typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4138case "$inclist" in
4139"") inclist="sys/types.h";;
4140esac;
4141eval "varval=\$$var";
4142case "$varval" in
4143"")
4144 $rm -f temp.c;
4145 for inc in $inclist; do
4146 echo "#include <$inc>" >>temp.c;
4147 done;
4148 echo "#ifdef $type" >> temp.c;
4149 echo "printf(\"We have $type\");" >> temp.c;
4150 echo "#endif" >> temp.c;
4151 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4152 echo " " ;
4153 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4154 if $contains $type temp.E >/dev/null 2>&1; then
4155 echo "$type found." >&4;
4156 eval "$var=\$type";
4157 else
4158 echo "$type NOT found." >&4;
4159 dflt="$def";
4160 . ./myread ;
4161 eval "$var=\$ans";
4162 fi;
4163 $rm -f temp.?;;
4164*) eval "$var=\$varval";;
4165esac'
4166
bd9b35c9
JH
4167: define a shorthand compile call
4168compile='
4169mc_file=$1;
4170shift;
08413ebc 4171$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
4172: define a shorthand compile call for compilations that should be ok.
4173compile_ok='
4174mc_file=$1;
4175shift;
7a282f6d 4176$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 4177
b4eb6b3d 4178: check for lengths of integral types
bd9b35c9 4179echo " "
b4eb6b3d
JH
4180case "$intsize" in
4181'')
4182 echo "Checking to see how big your integers are..." >&4
4183 $cat >intsize.c <<'EOCP'
bd9b35c9
JH
4184#include <stdio.h>
4185int main()
4186{
b4eb6b3d
JH
4187 printf("intsize=%d;\n", (int)sizeof(int));
4188 printf("longsize=%d;\n", (int)sizeof(long));
4189 printf("shortsize=%d;\n", (int)sizeof(short));
4190 exit(0);
bd9b35c9 4191}
b4eb6b3d
JH
4192EOCP
4193 set intsize
4194 if eval $compile_ok && ./intsize > /dev/null; then
4195 eval `./intsize`
4196 echo "Your integers are $intsize bytes long."
4197 echo "Your long integers are $longsize bytes long."
4198 echo "Your short integers are $shortsize bytes long."
4199 else
4200 $cat >&4 <<EOM
4201!
4202Help! I can't compile and run the intsize test program: please enlighten me!
4203(This is probably a misconfiguration in your system or libraries, and
4204you really ought to fix it. Still, I'll try anyway.)
4205!
bd9b35c9 4206EOM
b4eb6b3d
JH
4207 dflt=4
4208 rp="What is the size of an integer (in bytes)?"
4209 . ./myread
4210 intsize="$ans"
4211 dflt=$intsize
4212 rp="What is the size of a long integer (in bytes)?"
4213 . ./myread
4214 longsize="$ans"
4215 dflt=2
4216 rp="What is the size of a short integer (in bytes)?"
4217 . ./myread
4218 shortsize="$ans"
4219 fi
4220 ;;
4221esac
4222$rm -f intsize intsize.*
c1a7f87b 4223
b4eb6b3d
JH
4224: see what type lseek is declared as in the kernel
4225rp="What is the type used for lseek's offset on this system?"
4226set off_t lseektype long stdio.h sys/types.h
4227eval $typedef_ask
4228
4229echo " "
4230echo "Checking to see how big your file offsets are..." >&4
4231$cat >try.c <<EOCP
4232#include <sys/types.h>
4233#include <stdio.h>
4234int main()
4235{
4236 printf("%d\n", (int)sizeof($lseektype));
4237 return(0);
4238}
4239EOCP
4240set try
4241if eval $compile_ok; then
4242 lseeksize=`./try`
4243 echo "Your file offsets are $lseeksize bytes long."
4244else
4245 dflt=$longsize
4246 echo " "
4247 echo "(I can't seem to compile the test program. Guessing...)"
4248 rp="What is the size of your file offsets (in bytes)?"
4249 . ./myread
4250 lseeksize="$ans"
4251fi
4252$rm -f try.c try
4253
4254: see what type file positions are declared as in the library
4255rp="What is the type for file position used by fsetpos()?"
4256set fpos_t fpostype long stdio.h sys/types.h
4257eval $typedef_ask
4258
4259echo " "
4260case "$fpostype" in
4261*_t) zzz="$fpostype" ;;
4262*) zzz="fpos_t" ;;
4263esac
4264echo "Checking the size of $zzz..." >&4
4265cat > try.c <<EOCP
4266#include <sys/types.h>
4267#include <stdio.h>
4268int main() {
4269 printf("%d\n", (int)sizeof($fpostype));
4270 exit(0);
4271}
4272EOCP
4273set try
4274if eval $compile_ok; then
4275 yyy=`./try`
4276 case "$yyy" in
4277 '') fpossize=4
4278 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4279 ;;
4280 *) fpossize=$yyy
4281 echo "Your $zzz is $fpossize bytes long."
4282 ;;
4283 esac
4284else
4285 dflt="$longsize"
4286 echo " " >&4
4287 echo "(I can't compile the test program. Guessing...)" >&4
4288 rp="What is the size of your file positions (in bytes)?"
4289 . ./myread
4290 fpossize="$ans"
4291fi
4292
4293
4294
4295# Backward compatibility (uselfs is deprecated).
4296case "$uselfs" in
4297"$define"|true|[yY]*)
4298 cat <<EOM >&4
4299
4300*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4301EOM
4302 uselargefiles="$define"
4303 ;;
4304esac
4305
4306case "$lseeksize:$fpossize" in
43078:8) cat <<EOM
4308
4309You can have files larger than 2 gigabytes.
4310EOM
4311 val="$define" ;;
4312*) case "$uselargefiles" in
4313 "$undef"|false|[nN]*) dflt='n' ;;
4314 *) dflt='y' ;;
4315 esac
4316 cat <<EOM
4317
4318Perl can be built to understand large files (files larger than 2 gigabytes)
4319on some systems. To do so, Configure can be run with -Duselargefiles.
4320
4321If this doesn't make any sense to you, just accept the default '$dflt'.
4322EOM
4323 rp='Try to understand large files, if available?'
4324 . ./myread
4325 case "$ans" in
4326 y|Y) val="$define" ;;
4327 *) val="$undef" ;;
4328 esac
4329 ;;
4330esac
4331set uselargefiles
4332eval $setvar
4333case "$uselargefiles" in
4334"$define")
4335: Look for a hint-file generated 'call-back-unit'. If the
4336: user has specified that a large files perl is to be built,
4337: we may need to set or change some other defaults.
4338 if $test -f uselargefiles.cbu; then
4339 echo "Your platform has some specific hints for large file builds, using them..."
4340 . ./uselargefiles.cbu
4341 echo " "
4342 echo "Rechecking to see how big your file offsets are..." >&4
4343 $cat >try.c <<EOCP
4344#include <sys/types.h>
4345#include <stdio.h>
4346int main()
4347{
4348 printf("%d\n", (int)sizeof($lseektype));
4349 return(0);
4350}
4351EOCP
4352 set try
4353 if eval $compile_ok; then
4354 lseeksize=`./try`
4355 $echo "Your file offsets are now $lseeksize bytes long."
4356 else
4357 dflt="$lseeksize"
4358 echo " "
4359 echo "(I can't seem to compile the test program. Guessing...)"
4360 rp="What is the size of your file offsets (in bytes)?"
4361 . ./myread
4362 lseeksize="$ans"
4363 fi
4364 case "$fpostype" in
4365 *_t) zzz="$fpostype" ;;
4366 *) zzz="fpos_t" ;;
4367 esac
4368 $echo $n "Rechecking the size of $zzz...$c" >&4
4369 $cat > try.c <<EOCP
4370#include <sys/types.h>
4371#include <stdio.h>
4372int main() {
4373 printf("%d\n", (int)sizeof($fpostype));
4374 exit(0);
4375}
4376EOCP
4377 set try
4378 if eval $compile_ok; then
4379 yyy=`./try`
4380 dflt="$lseeksize"
4381 case "$yyy" in
4382 '') echo " "
4383 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4384 ;;
4385 *) fpossize=$yyy
4386 echo " $fpossize bytes." >&4
4387 ;;
4388 esac
4389 else
4390 dflt="$fpossize"
4391 echo " "
4392 echo "(I can't compile the test program. Guessing...)" >&4
4393 rp="What is the size of your file positions (in bytes)?"
4394 . ./myread
4395 fpossize="$ans"
4396 fi
4397 $rm -f try.c try
4398 fi
4399 ;;
4400esac
4401
4402
4403case "$usemorebits" in
4404"$define"|true|[yY]*)
4405 use64bitint="$define"
4406 uselongdouble="$define"
4407 usemorebits="$define"
4408 ;;
4409*) usemorebits="$undef"
4410 ;;
4411esac
4412
4413
4414case "$uselonglong" in
4415"$define"|true|[yY]*)
4416 cat <<EOM >&4
4417
4418*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4419EOM
4420 use64bitint="$define"
4421 ;;
4422esac
4423case "$use64bits" in
4424"$define"|true|[yY]*)
4425 cat <<EOM >&4
4426
4427*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4428EOM
4429 use64bitint="$define"
4430 ;;
4431esac
4432case "$use64bitints" in
4433"$define"|true|[yY]*)
4434 cat <<EOM >&4
4435
4436*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4437EOM
4438 use64bitint="$define"
4439 ;;
4440esac
4441case "$use64bitsint" in
4442"$define"|true|[yY]*)
4443 cat <<EOM >&4
4444
4445*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4446EOM
4447 use64bitint="$define"
4448 ;;
4449esac
4450case "$uselonglongs" in
4451"$define"|true|[yY]*)
4452 cat <<EOM >&4
4453
4454*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4455EOM
4456 use64bitint="$define"
4457 ;;
4458esac
4459case "$use64bitsall" in
4460"$define"|true|[yY]*)
4461 cat <<EOM >&4
4462
4463*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4464EOM
4465 use64bitall="$define"
4466 ;;
4467esac
4468
4469case "$ccflags" in
4470*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4471esac
4472case "$use64bitall" in
4473"$define"|true|[yY]*) use64bitint="$define" ;;
4474esac
4475
4476case "$longsize" in
44778) cat <<EOM
4478
4479You have natively 64-bit long integers.
4480EOM
4481 val="$define"
4482 ;;
4483*) case "$use64bitint" in
4484 "$define"|true|[yY]*) dflt='y';;
4485 *) dflt='n';;
4486 esac
4487 cat <<EOM
4488
4489Perl can be built to take advantage of 64-bit integer types
4490on some systems. To do so, Configure can be run with -Duse64bitint.
4491Choosing this option will most probably introduce binary incompatibilities.
4492
4493If this doesn't make any sense to you, just accept the default '$dflt'.
4494EOM
4495 rp='Try to use 64-bit integers, if available?'
4496 . ./myread
4497 case "$ans" in
4498 [yY]*) val="$define" ;;
4499 *) val="$undef" ;;
4500 esac
4501 ;;
4502esac
4503set use64bitint
4504eval $setvar
4505
4506case "$use64bitall" in
4507"$define"|true|[yY]*) dflt='y' ;;
4508*) case "$longsize" in
4509 8) dflt='y' ;;
4510 *) dflt='n' ;;
4511 esac
4512 ;;
4513esac
4514cat <<EOM
4515
4516You may also choose to try maximal 64-bitness. It means using as much
451764-bitness as possible on the platform. This in turn means even more
4518binary incompatibilities. On the other hand, your platform may not
4519have any more 64-bitness available than what you already have chosen.
4520
4521If this doesn't make any sense to you, just accept the default '$dflt'.
4522EOM
4523rp='Try to use maximal 64-bit support, if available?'
4524. ./myread
4525case "$ans" in
4526[yY]*) val="$define" ;;
4527*) val="$undef" ;;
4528esac
4529set use64bitall
4530eval $setvar
4531case "$use64bitall" in
4532"$define")
4533 case "$use64bitint" in
4534 "$undef")
4535 cat <<EOM
4536
4537Since you have chosen a maximally 64-bit build, I'm also turning on
4538the use of 64-bit integers.
4539EOM
4540 use64bitint="$define" ;;
4541 esac
4542 ;;
4543esac
4544
4545case "$use64bitint" in
4546"$define"|true|[yY]*)
4547: Look for a hint-file generated 'call-back-unit'. If the
4548: user has specified that a 64-bit perl is to be built,
4549: we may need to set or change some other defaults.
4550 if $test -f use64bitint.cbu; then
4551 echo "Your platform has some specific hints for 64-bit integers, using them..."
4552 . ./use64bitint.cbu
4553 fi
4554 case "$longsize" in
4555 4) case "$archname64" in
4556 '') archname64=64int ;;
4557 esac
4558 ;;
4559 esac
4560 ;;
4561esac
4562
4563case "$use64bitall" in
4564"$define"|true|[yY]*)
4565: Look for a hint-file generated 'call-back-unit'. If the
4566: user has specified that a maximally 64-bit perl is to be built,
4567: we may need to set or change some other defaults.
4568 if $test -f use64bitall.cbu; then
4569 echo "Your platform has some specific hints for 64-bit builds, using them..."
4570 . ./use64bitall.cbu
4571 fi
4572 case "$longsize" in
4573 4) case "$archname64" in
4574 ''|64int) archname64=64all ;;
4575 esac
4576 ;;
4577 esac
4578 ;;
4579esac
4580
4581echo " "
4582echo "Checking for GNU C Library..." >&4
4583cat >gnulibc.c <<EOM
4584#include <stdio.h>
4585int main()
4586{
4587#ifdef __GLIBC__
4588 exit(0);
4589#else
4590 exit(1);
4591#endif
4592}
4593EOM
4594set gnulibc
4595if eval $compile_ok && ./gnulibc; then
4596 val="$define"
4597 echo "You are using the GNU C Library"
4598else
4599 val="$undef"
4600 echo "You are not using the GNU C Library"
4601fi
4602$rm -f gnulibc*
4603set d_gnulibc
4604eval $setvar
4605
4606: see if nm is to be used to determine whether a symbol is defined or not
4607case "$usenm" in
4608'')
4609 dflt=''
c1a7f87b
JH
4610 case "$d_gnulibc" in
4611 "$define")
4612 echo " "
4613 echo "nm probably won't work on the GNU C Library." >&4
4614 dflt=n
bd9b35c9 4615 ;;
c1a7f87b
JH
4616 esac
4617 case "$dflt" in
4618 '')
4619 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4620 echo " "
4621 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
4622 echo "'nm' won't be sufficient on this sytem." >&4
4623 dflt=n
4624 fi
4625 ;;
4626 esac
4627 case "$dflt" in
4628 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4629 if $test $dflt -gt 20; then
4630 dflt=y
4631 else
4632 dflt=n
4633 fi
bd9b35c9
JH
4634 ;;
4635 esac
bd9b35c9
JH
4636 ;;
4637*)
c1a7f87b
JH
4638 case "$usenm" in
4639 true|$define) dflt=y;;
4640 *) dflt=n;;
4641 esac
bd9b35c9
JH
4642 ;;
4643esac
4644$cat <<EOM
4645
c1a7f87b
JH
4646I can use $nm to extract the symbols from your C libraries. This
4647is a time consuming task which may generate huge output on the disk (up
4648to 3 megabytes) but that should make the symbols extraction faster. The
4649alternative is to skip the 'nm' extraction part and to compile a small
4650test program instead to determine whether each symbol is present. If
4651you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4652this may be the best solution.
4653
4654You probably shouldn't let me use 'nm' if you are using the GNU C Library.
bd9b35c9
JH
4655
4656EOM
c1a7f87b
JH
4657rp="Shall I use $nm to extract C symbols from the libraries?"
4658. ./myread
4659case "$ans" in
4660[Nn]*) usenm=false;;
4661*) usenm=true;;
bd9b35c9 4662esac
bd9b35c9 4663
c1a7f87b
JH
4664runnm=$usenm
4665case "$reuseval" in
4666true) runnm=false;;
8e07c86e 4667esac
29209bc5 4668
c1a7f87b
JH
4669: nm options which may be necessary
4670case "$nm_opt" in
4671'') if $test -f /mach_boot; then
4672 nm_opt='' # Mach
4673 elif $test -d /usr/ccs/lib; then
4674 nm_opt='-p' # Solaris (and SunOS?)
4675 elif $test -f /dgux; then
4676 nm_opt='-p' # DG-UX
4677 elif $test -f /lib64/rld; then
4678 nm_opt='-p' # 64-bit Irix
4679 else
4680 nm_opt=''
4681 fi;;
4682esac
bd9b35c9 4683
c1a7f87b
JH
4684: nm options which may be necessary for shared libraries but illegal
4685: for archive libraries. Thank you, Linux.
4686case "$nm_so_opt" in
4687'') case "$myuname" in
4688 *linux*)
4689 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4690 nm_so_opt='--dynamic'
4691 fi
4692 ;;
bd9b35c9 4693 esac
c1a7f87b
JH
4694 ;;
4695esac
8e07c86e 4696
c1a7f87b
JH
4697case "$runnm" in
4698true)
4699: get list of predefined functions in a handy place
4700echo " "
4701case "$libc" in
4702'') libc=unknown
4703 case "$libs" in
4704 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
bd9b35c9 4705 esac
ff935051
JH
4706 ;;
4707esac
c1a7f87b
JH
4708libnames='';
4709case "$libs" in
4710'') ;;
4711*) for thislib in $libs; do
4712 case "$thislib" in
4713 -lc|-lc_s)
4714 : Handle C library specially below.
4715 ;;
4716 -l*)
4717 thislib=`echo $thislib | $sed -e 's/^-l//'`
4718 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4719 :
4720 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4721 :
4722 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4723 :
4724 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4725 :
4726 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4727 :
4728 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4729 :
4730 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4731 :
4732 else
4733 try=''
4734 fi
4735 libnames="$libnames $try"
4736 ;;
4737 *) libnames="$libnames $thislib" ;;
34d1710f 4738 esac
c1a7f87b 4739 done
4633a7c4
LW
4740 ;;
4741esac
c1a7f87b
JH
4742xxx=normal
4743case "$libc" in
4744unknown)
4745 set /lib/libc.$so
4746 for xxx in $libpth; do
4747 $test -r $1 || set $xxx/libc.$so
4748 : The messy sed command sorts on library version numbers.
4749 $test -r $1 || \
4750 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4751 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4752 h
4753 s/[0-9][0-9]*/0000&/g
4754 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4755 G
4756 s/\n/ /' | \
381aa1ff 4757 $sort | $sed -e 's/^.* //'`
c1a7f87b
JH
4758 eval set \$$#
4759 done
4760 $test -r $1 || set /usr/ccs/lib/libc.$so
4761 $test -r $1 || set /lib/libsys_s$_a
4762 ;;
4763*)
4764 set blurfl
4765 ;;
a4f3eea9 4766esac
c1a7f87b
JH
4767if $test -r "$1"; then
4768 echo "Your (shared) C library seems to be in $1."
4769 libc="$1"
4770elif $test -r /lib/libc && $test -r /lib/clib; then
4771 echo "Your C library seems to be in both /lib/clib and /lib/libc."
4772 xxx=apollo
4773 libc='/lib/clib /lib/libc'
4774 if $test -r /lib/syslib; then
4775 echo "(Your math library is in /lib/syslib.)"
4776 libc="$libc /lib/syslib"
4777 fi
4778elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4779 echo "Your C library seems to be in $libc, as you said before."
4780elif $test -r $incpath/usr/lib/libc$_a; then
4781 libc=$incpath/usr/lib/libc$_a;
4782 echo "Your C library seems to be in $libc. That's fine."
4783elif $test -r /lib/libc$_a; then
4784 libc=/lib/libc$_a;
4785 echo "Your C library seems to be in $libc. You're normal."
4786else
4787 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4788 :
4789 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4790 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4791 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4792 :
4793 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4794 :
4795 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4796 :
4797 else
4798 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4799 fi
4800 if $test -r "$tans"; then
4801 echo "Your C library seems to be in $tans, of all places."
4802 libc=$tans
4803 else
4804 libc='blurfl'
4805 fi
4806fi
4807if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4808 dflt="$libc"
4809 cat <<EOM
a4f3eea9 4810
c1a7f87b
JH
4811If the guess above is wrong (which it might be if you're using a strange
4812compiler, or your machine supports multiple models), you can override it here.
bd9b35c9
JH
4813
4814EOM
a4f3eea9 4815else
c1a7f87b 4816 dflt=''
381aa1ff 4817 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
c1a7f87b
JH
4818 cat >&4 <<EOM
4819I can't seem to find your C library. I've looked in the following places:
a4f3eea9 4820
c1a7f87b
JH
4821EOM
4822 $sed 's/^/ /' libpath
4823 cat <<EOM
29209bc5 4824
c1a7f87b 4825None of these seems to contain your C library. I need to get its name...
a4f3eea9 4826
bd9b35c9 4827EOM
bd9b35c9 4828fi
c1a7f87b
JH
4829fn=f
4830rp='Where is your C library?'
4831. ./getfile
4832libc="$ans"
a4f3eea9 4833
c1a7f87b 4834echo " "
381aa1ff 4835echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
c1a7f87b
JH
4836set X `cat libnames`
4837shift
4838xxx=files
4839case $# in 1) xxx=file; esac
4840echo "Extracting names from the following $xxx for later perusal:" >&4
4841echo " "
4842$sed 's/^/ /' libnames >&4
4843echo " "
4844$echo $n "This may take a while...$c" >&4
a4f3eea9 4845
c1a7f87b
JH
4846for file in $*; do
4847 case $file in
4848 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4849 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 4850 esac
c1a7f87b 4851done >libc.tmp
a4f3eea9 4852
c1a7f87b
JH
4853$echo $n ".$c"
4854$grep fprintf libc.tmp > libc.ptf
4855xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4856xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4857xxx='[ADTSIW]'
4858if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
4859 eval $xscan;\
4860 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4861 eval $xrun
4862elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4863 eval $xscan;\
4864 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4865 eval $xrun
4866elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4867 eval $xscan;\
4868 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4869 eval $xrun
4870elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4871 eval $xscan;\
4872 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4873 eval $xrun
4874elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4875 eval $xscan;\
4876 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4877 eval $xrun
4878elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4879 eval $xscan;\
4880 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4881 eval $xrun
4882elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4883 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
4884 eval $xscan;\
4885 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4886 eval $xrun
4887elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4888 eval $xscan;\
4889 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4890 eval $xrun
4891elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4892 eval $xscan;\
4893 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4894 eval $xrun
4895elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4896 eval $xscan;\
4897 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4898 eval $xrun
4899elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4900 eval $xscan;\
4901 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4902 eval $xrun
4903elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4904 eval $xscan;\
4905 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4906 eval $xrun
4907elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4908 eval $xscan;\
4909 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4910 eval $xrun
4911elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
4912 eval $xscan;\
4913 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4914 eval $xrun
4915else
4916 $nm -p $* 2>/dev/null >libc.tmp
4917 $grep fprintf libc.tmp > libc.ptf
4918 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4919 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4920 then
4921 nm_opt='-p'
4922 eval $xrun
bd9b35c9 4923 else
c1a7f87b
JH
4924 echo " "
4925 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
4926 com=''
4927 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
4928 for thisname in $libnames $libc; do
4929 $ar t $thisname >>libc.tmp
4930 done
4931 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
4932 echo "Ok." >&4
4933 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
4934 # Repeat libc to extract forwarders to DLL entries too
4935 for thisname in $libnames $libc; do
4936 $ar tv $thisname >>libc.tmp
4937 # Revision 50 of EMX has bug in $ar.
4938 # it will not extract forwarders to DLL entries
4939 # Use emximp which will extract exactly them.
4940 emximp -o tmp.imp $thisname \
4941 2>/dev/null && \
4942 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
4943 < tmp.imp >>libc.tmp
4944 $rm tmp.imp
4945 done
4946 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
4947 echo "Ok." >&4
4948 else
4949 echo "$ar didn't seem to work right." >&4
4950 echo "Maybe this is a Cray...trying bld instead..." >&4
4951 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
4952 then
4953 for thisname in $libnames; do
4954 bld t $libnames | \
4955 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
4956 $ar t $thisname >>libc.tmp
4957 done
4958 echo "Ok." >&4
bd9b35c9 4959 else
c1a7f87b
JH
4960 echo "That didn't work either. Giving up." >&4
4961 exit 1
bd9b35c9 4962 fi
c1a7f87b 4963 fi
a4f3eea9 4964 fi
a4f3eea9 4965fi
c1a7f87b
JH
4966nm_extract="$com"
4967if $test -f /lib/syscalls.exp; then
4968 echo " "
4969 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4970 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
4971fi
4972;;
4973esac
4974$rm -f libnames libpath
bd9b35c9 4975
c1a7f87b
JH
4976: is a C symbol defined?
4977csym='tlook=$1;
4978case "$3" in
4979-v) tf=libc.tmp; tc=""; tdc="";;
4980-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
4981*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4982esac;
4983tx=yes;
4984case "$reuseval-$4" in
4985true-) ;;
4986true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4987esac;
4988case "$tx" in
4989yes)
4990 case "$runnm" in
4991 true)
4992 if $contains $tlook $tf >/dev/null 2>&1;
4993 then tval=true;
4994 else tval=false;
4995 fi;;
4996 *)
4997 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
7a282f6d 4998 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
c1a7f87b
JH
4999 then tval=true;
5000 else tval=false;
5001 fi;
5002 $rm -f t t.c;;
5003 esac;;
5004*)
5005 case "$tval" in
5006 $define) tval=true;;
5007 *) tval=false;;
5008 esac;;
5009esac;
5010eval "$2=$tval"'
bd9b35c9 5011
c1a7f87b
JH
5012: define an is-in-libc? function
5013inlibc='echo " "; td=$define; tu=$undef;
5014sym=$1; var=$2; eval "was=\$$2";
5015tx=yes;
5016case "$reuseval$was" in
5017true) ;;
5018true*) tx=no;;
5019esac;
5020case "$tx" in
5021yes)
5022 set $sym tres -f;
5023 eval $csym;
5024 case "$tres" in
5025 true)
5026 echo "$sym() found." >&4;
5027 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5028 *)
5029 echo "$sym() NOT found." >&4;
5030 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5031 esac;;
bd9b35c9 5032*)
c1a7f87b
JH
5033 case "$was" in
5034 $define) echo "$sym() found." >&4;;
5035 *) echo "$sym() NOT found." >&4;;
5036 esac;;
5037esac'
5038
b4eb6b3d
JH
5039: see if sqrtl exists
5040set sqrtl d_sqrtl
c1a7f87b
JH
5041eval $inlibc
5042
b4eb6b3d
JH
5043case "$ccflags" in
5044*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
c1a7f87b 5045esac
b4eb6b3d
JH
5046
5047case "$uselongdouble" in
5048$define|true|[yY]*) dflt='y';;
5049*) dflt='n';;
5050esac
5051cat <<EOM
5052
5053Perl can be built to take advantage of long doubles which
5054(if available) may give more accuracy and range for floating point numbers.
5055
5056If this doesn't make any sense to you, just accept the default '$dflt'.
5057EOM
5058rp='Try to use long doubles if available?'
c1a7f87b
JH
5059. ./myread
5060case "$ans" in
b4eb6b3d
JH
5061y|Y) val="$define" ;;
5062*) val="$undef" ;;
5063esac
5064set uselongdouble
5065eval $setvar
bfb7748a 5066
b4eb6b3d
JH
5067case "$uselongdouble" in
5068true|[yY]*) uselongdouble="$define" ;;
5069esac
bfb7748a 5070
b4eb6b3d
JH
5071case "$uselongdouble" in
5072$define)
5073: Look for a hint-file generated 'call-back-unit'. If the
5074: user has specified that long doubles should be used,
5075: we may need to set or change some other defaults.
5076 if $test -f uselongdouble.cbu; then
5077 echo "Your platform has some specific hints for long doubles, using them..."
5078 . ./uselongdouble.cbu
5079 else
5080 $cat <<EOM
5081(Your platform doesn't have any specific hints for long doubles.)
c1a7f87b 5082EOM
b4eb6b3d
JH
5083 fi
5084 ;;
5085esac
5086
5087case "$uselongdouble:$d_sqrtl" in
5088$define:$undef)
5089 $cat <<EOM >&4
5090
5091*** You requested the use of long doubles but you do not seem to have
5092*** the mathematic functions for long doubles. I'm disabling the use
5093*** of long doubles.
5094
5095EOM
5096 uselongdouble=$undef
5097 ;;
5098esac
5099
5100: check for length of double
5101echo " "
5102case "$doublesize" in
5103'')
5104 echo "Checking to see how big your double precision numbers are..." >&4
5105 $cat >try.c <<'EOCP'
5106#include <stdio.h>
5107int main()
5108{
5109 printf("%d\n", (int)sizeof(double));
5110 exit(0);
5111}
5112EOCP
5113 set try
5114 if eval $compile_ok; then
5115 doublesize=`./try`
5116 echo "Your double is $doublesize bytes long."
5117 else
5118 dflt='8'
5119 echo "(I can't seem to compile the test program. Guessing...)"
5120 rp="What is the size of a double precision number (in bytes)?"
5121 . ./myread
5122 doublesize="$ans"
5123 fi
5124 ;;
5125esac
5126$rm -f try.c try
5127
5128: check for long doubles
5129echo " "
5130echo "Checking to see if you have long double..." >&4
5131echo 'int main() { long double x = 7.0; }' > try.c
5132set try
5133if eval $compile; then
5134 val="$define"
5135 echo "You have long double."
5136else
5137 val="$undef"
5138 echo "You do not have long double."
5139fi
5140$rm try.*
5141set d_longdbl
5142eval $setvar
5143
5144: check for length of long double
5145case "${d_longdbl}${longdblsize}" in
5146$define)
5147 echo " "
5148 echo "Checking to see how big your long doubles are..." >&4
5149 $cat >try.c <<'EOCP'
5150#include <stdio.h>
5151int main()
5152{
5153 printf("%d\n", sizeof(long double));
5154}
5155EOCP
5156 set try
5157 set try
5158 if eval $compile; then
5159 longdblsize=`./try$exe_ext`
5160 echo "Your long doubles are $longdblsize bytes long."
5161 else
5162 dflt='8'
5163 echo " "
5164 echo "(I can't seem to compile the test program. Guessing...)" >&4
5165 rp="What is the size of a long double (in bytes)?"
5166 . ./myread
5167 longdblsize="$ans"
5168 fi
5169 if $test "X$doublesize" = "X$longdblsize"; then
5170 echo "(That isn't any different from an ordinary double.)"
5171 fi
5172 ;;
5173esac
5174$rm -f try.* try
5175
5176: determine the architecture name
5177echo " "
5178if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5179 tarch=`arch`"-$osname"
5180elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5181 if uname -m > tmparch 2>&1 ; then
5182 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5183 -e 's/$/'"-$osname/" tmparch`
5184 else
5185 tarch="$osname"
5186 fi
5187 $rm -f tmparch
5188else
5189 tarch="$osname"
5190fi
5191case "$myarchname" in
5192''|"$tarch") ;;
5193*)
5194 echo "(Your architecture name used to be $myarchname.)"
5195 archname=''
5196 ;;
5197esac
5198myarchname="$tarch"
5199case "$archname" in
5200'') dflt="$tarch";;
5201*) dflt="$archname";;
5202esac
5203rp='What is your architecture name'
5204. ./myread
5205archname="$ans"
5206case "$usethreads" in
5207$define)
5208 echo "Threads selected." >&4
5209 case "$archname" in
5210 *-thread*) echo "...and architecture name already has -thread." >&4
5211 ;;
5212 *) archname="$archname-thread"
5213 echo "...setting architecture name to $archname." >&4
5214 ;;
5215 esac
5216 ;;
5217esac
5218case "$usemultiplicity" in
5219$define)
5220 echo "Multiplicity selected." >&4
5221 case "$archname" in
5222 *-multi*) echo "...and architecture name already has -multi." >&4
5223 ;;
5224 *) archname="$archname-multi"
5225 echo "...setting architecture name to $archname." >&4
5226 ;;
5227 esac
5228 ;;
5229esac
5230case "$use64bitint$use64bitall" in
5231*"$define"*)
5232 case "$archname64" in
5233 '')
5234 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5235 ;;
5236 *)
5237 case "$use64bitint" in
5238 "$define") echo "64 bit integers selected." >&4 ;;
5239 esac
5240 case "$use64bitall" in
5241 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5242 esac
5243 case "$archname" in
5244 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5245 ;;
5246 *) archname="$archname-$archname64"
5247 echo "...setting architecture name to $archname." >&4
5248 ;;
5249 esac
5250 ;;
5251 esac
5252esac
5253case "$uselongdouble" in
5254$define)
5255 echo "Long doubles selected." >&4
5256 case "$longdblsize" in
5257 $doublesize)
5258 "...but long doubles are equal to doubles, not changing architecture name." >&4
5259 ;;
5260 *)
5261 case "$archname" in
5262 *-ld*) echo "...and architecture name already has -ld." >&4
5263 ;;
5264 *) archname="$archname-ld"
5265 echo "...setting architecture name to $archname." >&4
5266 ;;
5267 esac
5268 ;;
5269 esac
5270 ;;
5271esac
5272
5273: determine root of directory hierarchy where package will be installed.
5274case "$prefix" in
5275'')
5276 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5277 ;;
5278*)
5279 dflt="$prefix"
5280 ;;
5281esac
5282$cat <<EOM
5283
5284By default, $package will be installed in $dflt/bin, manual pages
5285under $dflt/man, etc..., i.e. with $dflt as prefix for all
5286installation directories. Typically this is something like /usr/local.
5287If you wish to have binaries under /usr/bin but other parts of the
5288installation under /usr/local, that's ok: you will be prompted
5289separately for each of the installation directories, the prefix being
5290only used to set the defaults.
5291
5292EOM
5293fn=d~
5294rp='Installation prefix to use?'
5295. ./getfile
5296oldprefix=''
5297case "$prefix" in
5298'') ;;
5299*)
5300 case "$ans" in
5301 "$prefix") ;;
5302 *) oldprefix="$prefix";;
5303 esac
5304 ;;
5305esac
5306prefix="$ans"
5307prefixexp="$ansexp"
5308
5309: is AFS running?
5310echo " "
5311case "$afs" in
5312$define|true) afs=true ;;
5313$undef|false) afs=false ;;
5314*) if test -d /afs; then
5315 afs=true
5316 else
5317 afs=false
5318 fi
5319 ;;
5320esac
5321if $afs; then
5322 echo "AFS may be running... I'll be extra cautious then..." >&4
5323else
5324 echo "AFS does not seem to be running..." >&4
5325fi
5326
5327: determine installation prefix for where package is to be installed.
5328if $afs; then
5329$cat <<EOM
5330
5331Since you are running AFS, I need to distinguish the directory in which
5332files will reside from the directory in which they are installed (and from
5333which they are presumably copied to the former directory by occult means).
5334
5335EOM
5336 case "$installprefix" in
5337 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5338 *) dflt="$installprefix";;
5339 esac
5340else
5341$cat <<EOM
5342
5343In some special cases, particularly when building $package for distribution,
5344it is convenient to distinguish between the directory in which files should
5345be installed from the directory ($prefix) in which they
5346will eventually reside. For most users, these two directories are the same.
5347
5348EOM
5349 case "$installprefix" in
5350 '') dflt=$prefix ;;
5351 *) dflt=$installprefix;;
5352 esac
5353fi
5354fn=d~
5355rp='What installation prefix should I use for installing files?'
5356. ./getfile
5357installprefix="$ans"
5358installprefixexp="$ansexp"
5359
5360: set the prefixit variable, to compute a suitable default value
5361prefixit='case "$3" in
5362""|none)
5363 case "$oldprefix" in
5364 "") eval "$1=\"\$$2\"";;
5365 *)
5366 case "$3" in
5367 "") eval "$1=";;
5368 none)
5369 eval "tp=\"\$$2\"";
5370 case "$tp" in
5371 ""|" ") eval "$1=\"\$$2\"";;
5372 *) eval "$1=";;
5373 esac;;
5374 esac;;
5375 esac;;
5376*)
5377 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5378 case "$tp" in
5379 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5380 /*-$oldprefix/*|\~*-$oldprefix/*)
5381 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5382 *) eval "$1=\"\$$2\"";;
5383 esac;;
5384esac'
5385
5386
5387: get the patchlevel
5388echo " "
5389echo "Getting the current patchlevel..." >&4
5390if $test -r $rsrc/patchlevel.h;then
5391 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5392 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5393 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5394 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5395 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5396 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5397else
5398 revision=0
5399 patchlevel=0
5400 subversion=0
5401 api_revision=0
5402 api_version=0
5403 api_subversion=0
5404fi
5405$echo "(You have $package version $patchlevel subversion $subversion.)"
5406case "$osname" in
5407dos|vms)
5408 : XXX Should be a Configure test for double-dots in filenames.
5409 version=`echo $revision $patchlevel $subversion | \
5410 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5411 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5412 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5413 ;;
5414*)
5415 version=`echo $revision $patchlevel $subversion | \
5416 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5417 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5418 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5419 ;;
5420esac
5421: Special case the 5.005_xx maintenance series, which used 5.005
5422: without any subversion label as a subdirectory in $sitelib
5423if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5424 api_versionstring='5.005'
5425fi
5426
5427: determine installation style
5428: For now, try to deduce it from prefix unless it is already set.
5429: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5430case "$installstyle" in
5431'') case "$prefix" in
5432 *perl*) dflt='lib';;
5433 *) dflt='lib/perl5' ;;
5434 esac
5435 ;;
5436*) dflt="$installstyle" ;;
5437esac
5438: Probably not worth prompting for this since we prompt for all
5439: the directories individually, and the prompt would be too long and
5440: confusing anyway.
5441installstyle=$dflt
5442
5443: determine where private library files go
5444: Usual default is /usr/local/lib/perl5/$version.
5445: Also allow things like /opt/perl/lib/$version, since
5446: /opt/perl/lib/perl5... would be redundant.
5447: The default "style" setting is made in installstyle.U
5448case "$installstyle" in
5449*lib/perl5*) set dflt privlib lib/$package/$version ;;
5450*) set dflt privlib lib/$version ;;
5451esac
5452eval $prefixit
5453$cat <<EOM
5454
5455There are some auxiliary files for $package that need to be put into a
5456private library directory that is accessible by everyone.
5457
5458EOM
5459fn=d~+
5460rp='Pathname where the private library files will reside?'
5461. ./getfile
5462privlib="$ans"
5463privlibexp="$ansexp"
5464: Change installation prefix, if necessary.
5465if $test X"$prefix" != X"$installprefix"; then
5466 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5467else
5468 installprivlib="$privlibexp"
5469fi
5470
5471: set the prefixup variable, to restore leading tilda escape
5472prefixup='case "$prefixexp" in
5473"$prefix") ;;
5474*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5475esac'
5476
5477: determine where public architecture dependent libraries go
5478set archlib archlib
5479eval $prefixit
5480: privlib default is /usr/local/lib/$package/$version
5481: archlib default is /usr/local/lib/$package/$version/$archname
5482: privlib may have an optional trailing /share.
5483tdflt=`echo $privlib | $sed 's,/share$,,'`
5484tdflt=$tdflt/$archname
5485case "$archlib" in
5486'') dflt=$tdflt
5487 ;;
5488*) dflt="$archlib"
5489 ;;
5490esac
5491$cat <<EOM
5492
5493$spackage contains architecture-dependent library files. If you are
5494sharing libraries in a heterogeneous environment, you might store
5495these files in a separate location. Otherwise, you can just include
5496them with the rest of the public library files.
5497
5498EOM
5499fn=d+~
5500rp='Where do you want to put the public architecture-dependent libraries?'
5501. ./getfile
5502archlib="$ans"
5503archlibexp="$ansexp"
5504if $test X"$archlib" = X"$privlib"; then
5505 d_archlib="$undef"
5506else
5507 d_archlib="$define"
5508fi
5509: Change installation prefix, if necessary.
5510if $test X"$prefix" != X"$installprefix"; then
5511 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5512else
5513 installarchlib="$archlibexp"
5514fi
5515
5516
5517: Binary compatibility with 5.005 is not possible for builds
5518: with advanced features
5519case "$usethreads$usemultiplicity" in
5520*define*)
5521 bincompat5005="$undef"
5522 d_bincompat5005="$undef"
5523 ;;
5524*) $cat <<EOM
5525
5526This version of Perl can be compiled for binary compatibility with 5.005.
5527If you decide to do so, you will be able to continue using most of the
5528extensions that were compiled for Perl 5.005.
5529
5530EOM
5531 case "$bincompat5005$d_bincompat5005" in
5532 *"$undef"*) dflt=n ;;
5533 *) dflt=y ;;
5534 esac
5535 rp='Binary compatibility with Perl 5.005?'
5536 . ./myread
5537 case "$ans" in
5538 y*) val="$define" ;;
5539 *) val="$undef" ;;
5540 esac
5541 set d_bincompat5005
5542 eval $setvar
5543 case "$d_bincompat5005" in
5544 "$define")
5545 bincompat5005="$define"
5546 ;;
5547 *) bincompat5005="$undef"
5548 d_bincompat5005="$undef"
5549 ;;
5550 esac
5551 ;;
5552esac
5553
5554
5555: see if setuid scripts can be secure
5556$cat <<EOM
5557
5558Some kernels have a bug that prevents setuid #! scripts from being
5559secure. Some sites have disabled setuid #! scripts because of this.
5560
5561First let's decide if your kernel supports secure setuid #! scripts.
5562(If setuid #! scripts would be secure but have been disabled anyway,
5563don't say that they are secure if asked.)
5564
5565EOM
5566
5567val="$undef"
5568if $test -d /dev/fd; then
5569 echo "#!$ls" >reflect
5570 chmod +x,u+s reflect
5571 ./reflect >flect 2>&1
5572 if $contains "/dev/fd" flect >/dev/null; then
5573 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5574 val="$define"
5575 else
5576 $cat <<EOM
5577If you are not sure if they are secure, I can check but I'll need a
5578username and password different from the one you are using right now.
5579If you don't have such a username or don't want me to test, simply
5580enter 'none'.
5581
5582EOM
5583 rp='Other username to test security of setuid scripts with?'
5584 dflt='none'
5585 . ./myread
5586 case "$ans" in
5587 n|none)
5588 case "$d_suidsafe" in
5589 '') echo "I'll assume setuid scripts are *not* secure." >&4
5590 dflt=n;;
5591 "$undef")
5592 echo "Well, the $hint value is *not* secure." >&4
5593 dflt=n;;
5594 *) echo "Well, the $hint value *is* secure." >&4
5595 dflt=y;;
5596 esac
c1a7f87b 5597 ;;
b4eb6b3d
JH
5598 *)
5599 $rm -f reflect flect
5600 echo "#!$ls" >reflect
5601 chmod +x,u+s reflect
5602 echo >flect
5603 chmod a+w flect
5604 echo '"su" will (probably) prompt you for '"$ans's password."
5605 su $ans -c './reflect >flect'
5606 if $contains "/dev/fd" flect >/dev/null; then
5607 echo "Okay, it looks like setuid scripts are secure." >&4
5608 dflt=y
5609 else
5610 echo "I don't think setuid scripts are secure." >&4
5611 dflt=n
5612 fi
5613 ;;
5614 esac
5615 rp='Does your kernel have *secure* setuid scripts?'
5616 . ./myread
5617 case "$ans" in
5618 [yY]*) val="$define";;
5619 *) val="$undef";;
5620 esac
5621 fi
5622else
5623 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5624 echo "(That's for file descriptors, not floppy disks.)"
5625 val="$undef"
5626fi
5627set d_suidsafe
5628eval $setvar
5629
5630$rm -f reflect flect
5631
5632: now see if they want to do setuid emulation
5633echo " "
5634val="$undef"
5635case "$d_suidsafe" in
5636"$define")
5637 val="$undef"
5638 echo "No need to emulate SUID scripts since they are secure here." >& 4
5639 ;;
5640*)
5641 $cat <<EOM
5642Some systems have disabled setuid scripts, especially systems where
5643setuid scripts cannot be secure. On systems where setuid scripts have
5644been disabled, the setuid/setgid bits on scripts are currently
5645useless. It is possible for $package to detect those bits and emulate
5646setuid/setgid in a secure fashion. This emulation will only work if
5647setuid scripts have been disabled in your kernel.
5648
5649EOM
5650 case "$d_dosuid" in
5651 "$define") dflt=y ;;
5652 *) dflt=n ;;
5653 esac
5654 rp="Do you want to do setuid/setgid emulation?"
5655 . ./myread
5656 case "$ans" in
5657 [yY]*) val="$define";;
5658 *) val="$undef";;
5659 esac
5660 ;;
5661esac
5662set d_dosuid
5663eval $setvar
5664
5665: determine filename position in cpp output
5666echo " "
5667echo "Computing filename position in cpp output for #include directives..." >&4
5668echo '#include <stdio.h>' > foo.c
5669$cat >fieldn <<EOF
5670$startsh
5671$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5672$grep '^[ ]*#.*stdio\.h' | \
5673while read cline; do
5674 pos=1
5675 set \$cline
5676 while $test \$# -gt 0; do
5677 if $test -r \`echo \$1 | $tr -d '"'\`; then
5678 echo "\$pos"
5679 exit 0
5680 fi
5681 shift
5682 pos=\`expr \$pos + 1\`
5683 done
5684done
5685EOF
5686chmod +x fieldn
5687fieldn=`./fieldn`
5688$rm -f foo.c fieldn
5689case $fieldn in
5690'') pos='???';;
56911) pos=first;;
56922) pos=second;;
56933) pos=third;;
5694*) pos="${fieldn}th";;
5695esac
5696echo "Your cpp writes the filename in the $pos field of the line."
5697
5698: locate header file
5699$cat >findhdr <<EOF
5700$startsh
5701wanted=\$1
5702name=''
5703for usrincdir in $usrinc
5704do
5705 if test -f \$usrincdir/\$wanted; then
5706 echo "\$usrincdir/\$wanted"
5707 exit 0
5708 fi
5709done
5710awkprg='{ print \$$fieldn }'
5711echo "#include <\$wanted>" > foo\$\$.c
5712$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5713$grep "^[ ]*#.*\$wanted" | \
5714while read cline; do
5715 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5716 case "\$name" in
5717 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5718 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5719 *) exit 2;;
5720 esac;
5721done;
5722#
5723# status = 0: grep returned 0 lines, case statement not executed
5724# status = 1: headerfile found
5725# status = 2: while loop executed, no headerfile found
5726#
5727status=\$?
5728$rm -f foo\$\$.c;
5729if test \$status -eq 1; then
5730 exit 0;
5731fi
5732exit 1
5733EOF
5734chmod +x findhdr
5735
5736: define an alternate in-header-list? function
5737inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5738cont=true; xxf="echo \"<\$1> found.\" >&4";
5739case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5740*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5741esac;
5742case $# in 4) instead=instead;; *) instead="at last";; esac;
5743while $test "$cont"; do
5744 xxx=`./findhdr $1`
5745 var=$2; eval "was=\$$2";
5746 if $test "$xxx" && $test -r "$xxx";
5747 then eval $xxf;
5748 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5749 cont="";
5750 else eval $xxnf;
5751 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5752 set $yyy; shift; shift; yyy=$@;
5753 case $# in 0) cont="";;
5754 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5755 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5756 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5757 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5758 esac;
5759done;
5760while $test "$yyy";
5761do set $yyy; var=$2; eval "was=\$$2";
5762 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5763 set $yyy; shift; shift; yyy=$@;
5764done'
5765
5766: see if this is a malloc.h system
5767set malloc.h i_malloc
5768eval $inhdr
5769
5770: see if stdlib is available
5771set stdlib.h i_stdlib
5772eval $inhdr
5773
5774: determine which malloc to compile in
5775echo " "
5776case "$usemymalloc" in
5777''|[yY]*|true|$define) dflt='y' ;;
5778*) dflt='n' ;;
5779esac
5780rp="Do you wish to attempt to use the malloc that comes with $package?"
5781. ./myread
5782usemymalloc="$ans"
5783case "$ans" in
5784y*|true)
5785 usemymalloc='y'
5786 mallocsrc='malloc.c'
5787 mallocobj="malloc$_o"
5788 d_mymalloc="$define"
5789 case "$libs" in
5790 *-lmalloc*)
5791 : Remove malloc from list of libraries to use
5792 echo "Removing unneeded -lmalloc from library list" >&4
5793 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5794 shift
5795 libs="$*"
5796 echo "libs = $libs" >&4
5797 ;;
5798 esac
5799 ;;
5800*)
5801 usemymalloc='n'
5802 mallocsrc=''
5803 mallocobj=''
5804 d_mymalloc="$undef"
5805 ;;
5806esac
5807
5808: compute the return types of malloc and free
5809echo " "
5810$cat >malloc.c <<END
5811#$i_malloc I_MALLOC
5812#$i_stdlib I_STDLIB
5813#include <stdio.h>
5814#include <sys/types.h>
5815#ifdef I_MALLOC
5816#include <malloc.h>
5817#endif
5818#ifdef I_STDLIB
5819#include <stdlib.h>
5820#endif
5821#ifdef TRY_MALLOC
5822void *malloc();
5823#endif
5824#ifdef TRY_FREE
5825void free();
5826#endif
5827END
5828case "$malloctype" in
5829'')
5830 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5831 malloctype='void *'
5832 else
5833 malloctype='char *'
5834 fi
5835 ;;
5836esac
5837echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5838
5839case "$freetype" in
5840'')
5841 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5842 freetype='void'
5843 else
5844 freetype='int'
5845 fi
5846 ;;
5847esac
5848echo "Your system uses $freetype free(), it would seem." >&4
5849$rm -f malloc.[co]
5850$cat <<EOM
5851
5852After $package is installed, you may wish to install various
5853add-on modules and utilities. Typically, these add-ons will
5854be installed under $prefix with the rest
5855of this package. However, you may wish to install such add-ons
5856elsewhere under a different prefix.
5857
5858If you do not wish to put everything under a single prefix, that's
5859ok. You will be prompted for the individual locations; this siteprefix
5860is only used to suggest the defaults.
5861
5862The default should be fine for most people.
5863
5864EOM
5865fn=d~+
5866rp='Installation prefix to use for add-on modules and utilities?'
5867: XXX Here might be another good place for an installstyle setting.
5868case "$siteprefix" in
5869'') dflt=$prefix ;;
5870*) dflt=$siteprefix ;;
5871esac
5872. ./getfile
5873: XXX Prefixit unit does not yet support siteprefix and vendorprefix
5874oldsiteprefix=''
5875case "$siteprefix" in
5876'') ;;
5877*) case "$ans" in
5878 "$prefix") ;;
5879 *) oldsiteprefix="$prefix";;
5880 esac
5881 ;;
5882esac
5883siteprefix="$ans"
5884siteprefixexp="$ansexp"
5885
5886: determine where site specific libraries go.
5887: Usual default is /usr/local/lib/perl5/site_perl/$version
5888: The default "style" setting is made in installstyle.U
5889: XXX No longer works with Prefixit stuff.
5890prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5891case "$sitelib" in
5892'') case "$installstyle" in
5893 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5894 *) dflt=$siteprefix/lib/site_$prog/$version ;;
5895 esac
5896 ;;
5897*) dflt="$sitelib"
5898 ;;
5899esac
5900$cat <<EOM
5901
5902The installation process will create a directory for
5903site-specific extensions and modules. Most users find it convenient
5904to place all site-specific files in this directory rather than in the
5905main distribution directory.
5906
5907EOM
5908fn=d~+
5909rp='Pathname for the site-specific library files?'
5910. ./getfile
5911sitelib="$ans"
5912sitelibexp="$ansexp"
5913sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5914: Change installation prefix, if necessary.
5915if $test X"$prefix" != X"$installprefix"; then
5916 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5917else
5918 installsitelib="$sitelibexp"
5919fi
5920
5921: determine where site specific architecture-dependent libraries go.
5922: sitelib default is /usr/local/lib/perl5/site_perl/$version
5923: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5924: sitelib may have an optional trailing /share.
5925case "$sitearch" in
5926'') dflt=`echo $sitelib | $sed 's,/share$,,'`
5927 dflt="$dflt/$archname"
5928 ;;
5929*) dflt="$sitearch"
5930 ;;
5931esac
5932set sitearch sitearch none
5933eval $prefixit
5934$cat <<EOM
5935
5936The installation process will also create a directory for
5937architecture-dependent site-specific extensions and modules.
5938
5939EOM
5940fn=d~+
5941rp='Pathname for the site-specific architecture-dependent library files?'
5942. ./getfile
5943sitearch="$ans"
5944sitearchexp="$ansexp"
5945: Change installation prefix, if necessary.
5946if $test X"$prefix" != X"$installprefix"; then
5947 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5948else
5949 installsitearch="$sitearchexp"
5950fi
5951
5952$cat <<EOM
5953
5954The installation process will also create a directory for
5955vendor-supplied add-ons. Vendors who supply perl with their system
5956may find it convenient to place all vendor-supplied files in this
5957directory rather than in the main distribution directory. This will
5958ease upgrades between binary-compatible maintenance versions of perl.
5959
5960Of course you may also use these directories in whatever way you see
5961fit. For example, you might use them to access modules shared over a
5962company-wide network.
5963
5964The default answer should be fine for most people.
5965This causes further questions about vendor add-ons to be skipped
5966and no vendor-specific directories will be configured for perl.
5967
5968EOM
5969rp='Do you want to configure vendor-specific add-on directories?'
5970case "$usevendorprefix" in
5971define|true|[yY]*) dflt=y ;;
5972*) : User may have set vendorprefix directly on Configure command line.
5973 case "$vendorprefix" in
5974 ''|' ') dflt=n ;;
5975 *) dflt=y ;;
5976 esac
5977 ;;
5978esac
5979. ./myread
5980case "$ans" in
5981[yY]*) fn=d~+
5982 rp='Installation prefix to use for vendor-supplied add-ons?'
5983 case "$vendorprefix" in
5984 '') dflt='' ;;
5985 *) dflt=$vendorprefix ;;
5986 esac
5987 . ./getfile
5988 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5989 oldvendorprefix=''
5990 case "$vendorprefix" in
5991 '') ;;
5992 *) case "$ans" in
5993 "$prefix") ;;
5994 *) oldvendorprefix="$prefix";;
5995 esac
5996 ;;
5997 esac
5998 usevendorprefix="$define"
5999 vendorprefix="$ans"
6000 vendorprefixexp="$ansexp"
6001 ;;
6002*) usevendorprefix="$undef"
6003 vendorprefix=''
6004 vendorprefixexp=''
6005 ;;
6006esac
6007
6008case "$vendorprefix" in
6009'') d_vendorlib="$undef"
6010 vendorlib=''
6011 vendorlibexp=''
6012 ;;
6013*) d_vendorlib="$define"
6014 : determine where vendor-supplied modules go.
6015 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6016 case "$vendorlib" in
6017 '')
6018 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6019 case "$installstyle" in
6020 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6021 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6022 esac
6023 ;;
6024 *) dflt="$vendorlib"
6025 ;;
6026 esac
6027 fn=d~+
6028 rp='Pathname for the vendor-supplied library files?'
6029 . ./getfile
6030 vendorlib="$ans"
6031 vendorlibexp="$ansexp"
6032 ;;
6033esac
6034vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6035: Change installation prefix, if necessary.
6036if $test X"$prefix" != X"$installprefix"; then
6037 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6038else
6039 installvendorlib="$vendorlibexp"
6040fi
6041
6042case "$vendorprefix" in
6043'') d_vendorarch="$undef"
6044 vendorarch=''
6045 vendorarchexp=''
6046 ;;
6047*) d_vendorarch="$define"
6048 : determine where vendor-supplied architecture-dependent libraries go.
6049 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6050 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6051 : vendorlib may have an optional trailing /share.
6052 case "$vendorarch" in
6053 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6054 dflt="$dflt/$archname"
6055 ;;
6056 *) dflt="$vendorarch" ;;
6057 esac
6058 fn=d~+
6059 rp='Pathname for vendor-supplied architecture-dependent files?'
6060 . ./getfile
6061 vendorarch="$ans"
6062 vendorarchexp="$ansexp"
6063 ;;
6064esac
6065: Change installation prefix, if necessary.
6066if $test X"$prefix" != X"$installprefix"; then
6067 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6068else
6069 installvendorarch="$vendorarchexp"
6070fi
6071
6072: Final catch-all directories to search
6073$cat <<EOM
6074
6075Lastly, you can have perl look in other directories for extensions and
6076modules in addition to those already specified.
6077These directories will be searched after
6078 $sitearch
6079 $sitelib
6080EOM
6081test X"$vendorlib" != "X" && echo ' ' $vendorlib
6082test X"$vendorarch" != "X" && echo ' ' $vendorarch
6083echo ' '
6084case "$otherlibdirs" in
6085''|' ') dflt='none' ;;
6086*) dflt="$otherlibdirs" ;;
6087esac
6088$cat <<EOM
6089Enter a colon-separated set of extra paths to include in perl's @INC
6090search path, or enter 'none' for no extra paths.
6091
6092EOM
6093
6094rp='Colon-separated list of additional directories for perl to search?'
6095. ./myread
6096case "$ans" in
6097' '|''|none) otherlibdirs=' ' ;;
6098*) otherlibdirs="$ans" ;;
6099esac
6100case "$otherlibdirs" in
6101' ') val=$undef ;;
6102*) val=$define ;;
6103esac
6104set d_perl_otherlibdirs
6105eval $setvar
6106
6107: Cruising for prototypes
6108echo " "
6109echo "Checking out function prototypes..." >&4
6110$cat >prototype.c <<'EOCP'
6111int main(int argc, char *argv[]) {
6112 exit(0);}
6113EOCP
6114if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6115 echo "Your C compiler appears to support function prototypes."
6116 val="$define"
6117else
6118 echo "Your C compiler doesn't seem to understand function prototypes."
6119 val="$undef"
6120fi
6121set prototype
6122eval $setvar
6123$rm -f prototype*
6124
6125case "$prototype" in
6126"$define") ;;
6127*) ansi2knr='ansi2knr'
6128 echo " "
6129 cat <<EOM >&4
6130
6131$me: FATAL ERROR:
6132This version of $package can only be compiled by a compiler that
6133understands function prototypes. Unfortunately, your C compiler
6134 $cc $ccflags
6135doesn't seem to understand them. Sorry about that.
6136
6137If GNU cc is available for your system, perhaps you could try that instead.
6138
6139Eventually, we hope to support building Perl with pre-ANSI compilers.
6140If you would like to help in that effort, please contact <perlbug@perl.org>.
6141
6142Aborting Configure now.
6143EOM
6144 exit 2
6145 ;;
6146esac
6147
6148: determine where public executables go
6149echo " "
6150set dflt bin bin
6151eval $prefixit
6152fn=d~
6153rp='Pathname where the public executables will reside?'
6154. ./getfile
6155if $test "X$ansexp" != "X$binexp"; then
6156 installbin=''
6157fi
6158bin="$ans"
6159binexp="$ansexp"
6160: Change installation prefix, if necessary.
6161: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6162if $test X"$prefix" != X"$installprefix"; then
6163 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6164else
6165 installbin="$binexp"
6166fi
6167
6168: Find perl5.005 or later.
6169echo "Looking for a previously installed perl5.005 or later... "
6170case "$perl5" in
6171'') for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6172 : Check if this perl is recent and can load a simple module
6173 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6174 perl5=$tdir/perl
6175 break;
6176 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6177 perl5=$tdir/perl
6178 break;
6179 fi
6180 done
6181 ;;
6182*) perl5="$perl5"
6183 ;;
6184esac
6185case "$perl5" in
6186'') echo "None found. That's ok.";;
6187*) echo "Using $perl5." ;;
6188esac
6189
6190: Determine list of previous versions to include in @INC
6191$cat > getverlist <<EOPL
6192#!$perl5 -w
6193use File::Basename;
6194\$api_versionstring = "$api_versionstring";
6195\$version = "$version";
6196\$stem = "$sitelib_stem";
6197\$archname = "$archname";
6198EOPL
6199 $cat >> getverlist <<'EOPL'
6200# Can't have leading @ because metaconfig interprets it as a command!
6201;@inc_version_list=();
6202# XXX Redo to do opendir/readdir?
6203if (-d $stem) {
6204 chdir($stem);
6205 ;@candidates = glob("5.*");
6206}
6207else {
6208 ;@candidates = ();
6209}
6210
6211# XXX ToDo: These comparisons must be reworked when two-digit
6212# subversions come along, so that 5.7.10 compares as greater than
6213# 5.7.3! By that time, hope that 5.6.x is sufficiently
6214# widespread that we can use the built-in version vectors rather
6215# than reinventing them here. For 5.6.0, however, we must
6216# assume this script will likely be run by 5.005_0x. --AD 1/2000.
6217foreach $d (@candidates) {
6218 if ($d lt $version) {
6219 if ($d ge $api_versionstring) {
6220 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6221 }
6222 elsif ($d ge "5.005") {
6223 unshift(@inc_version_list, grep { -d } $d);
6224 }
6225 }
6226 else {
6227 # Skip newer version. I.e. don't look in
6228 # 5.7.0 if we're installing 5.6.1.
6229 }
6230}
6231
6232if (@inc_version_list) {
6233 print join(' ', @inc_version_list);
6234}
6235else {
6236 # Blank space to preserve value for next Configure run.
6237 print " ";
6238}
6239EOPL
6240chmod +x getverlist
6241case "$inc_version_list" in
6242'') if test -x "$perl5"; then
6243 dflt=`$perl5 getverlist`
6244 else
6245 dflt='none'
6246 fi
6247 ;;
6248$undef) dflt='none' ;;
6249*) dflt="$inc_version_list" ;;
6250esac
6251case "$dflt" in
6252''|' ') dflt=none ;;
6253esac
6254case "$dflt" in
62555.005) case "$bincompat5005" in
6256 $define|true|[yY]*) ;;
6257 *) dflt=none ;;
6258 esac
6259 ;;
6260esac
6261$cat <<'EOM'
6262
6263In order to ease the process of upgrading, this version of perl
6264can be configured to use modules built and installed with earlier
6265versions of perl that were installed under $prefix. Specify here
6266the list of earlier versions that this version of perl should check.
6267If Configure detected no earlier versions of perl installed under
6268$prefix, then the list will be empty. Answer 'none' to tell perl
6269to not search earlier versions.
6270
6271The default should almost always be sensible, so if you're not sure,
6272just accept the default.
6273EOM
6274
6275rp='List of earlier versions to include in @INC?'
6276. ./myread
6277case "$ans" in
6278[Nn]one|''|' ') inc_version_list=' ' ;;
6279*) inc_version_list="$ans" ;;
6280esac
6281case "$inc_version_list" in
6282''|' ')
6283 inc_version_list_init='0';;
6284*) inc_version_list_init=`echo $inc_version_list |
6285 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6286 ;;
6287esac
6288$rm -f getverlist
6289
6290: determine whether to install perl also as /usr/bin/perl
6291
6292echo " "
6293if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6294 $cat <<EOM
6295Many scripts expect perl to be installed as /usr/bin/perl.
6296I can install the perl you are about to compile also as /usr/bin/perl
6297(in addition to $installbin/perl).
6298EOM
6299 case "$installusrbinperl" in
6300 "$undef"|[nN]*) dflt='n';;
6301 *) dflt='y';;
6302 esac
6303 rp="Do you want to install perl as /usr/bin/perl?"
6304 . ./myread
6305 case "$ans" in
6306 [yY]*) val="$define";;
6307 *) val="$undef" ;;
6308 esac
6309else
6310 val="$undef"
6311fi
6312set installusrbinperl
6313eval $setvar
6314
6315: see if dld is available
6316set dld.h i_dld
6317eval $inhdr
6318
6319: see if dlopen exists
6320xxx_runnm="$runnm"
6321runnm=false
6322set dlopen d_dlopen
6323eval $inlibc
6324runnm="$xxx_runnm"
6325
6326: determine which dynamic loading, if any, to compile in
6327echo " "
6328dldir="ext/DynaLoader"
6329case "$usedl" in
6330$define|y|true)
6331 dflt='y'
6332 usedl="$define"
6333 ;;
6334$undef|n|false)
6335 dflt='n'
6336 usedl="$undef"
6337 ;;
6338*)
6339 dflt='n'
6340 case "$d_dlopen" in
6341 $define) dflt='y' ;;
6342 esac
6343 case "$i_dld" in
6344 $define) dflt='y' ;;
6345 esac
6346 : Does a dl_xxx.xs file exist for this operating system
6347 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6348 ;;
6349esac
6350rp="Do you wish to use dynamic loading?"
6351. ./myread
6352usedl="$ans"
6353case "$ans" in
6354y*) usedl="$define"
6355 case "$dlsrc" in
6356 '')
6357 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6358 dflt="$dldir/dl_${osname}.xs"
6359 elif $test "$d_dlopen" = "$define" ; then
6360 dflt="$dldir/dl_dlopen.xs"
6361 elif $test "$i_dld" = "$define" ; then
6362 dflt="$dldir/dl_dld.xs"
6363 else
6364 dflt=''
6365 fi
6366 ;;
6367 *) dflt="$dldir/$dlsrc"
6368 ;;
6369 esac
6370 echo "The following dynamic loading files are available:"
6371 : Can not go over to $dldir because getfile has path hard-coded in.
6372 tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6373 rp="Source file to use for dynamic loading"
6374 fn="fne"
6375 gfpth="$src"
6376 . ./getfile
6377 usedl="$define"
6378 : emulate basename
6379 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6380
6381 $cat << EOM
6382
6383Some systems may require passing special flags to $cc -c to
6384compile modules that will be used to create a shared library.
6385To use no flags, say "none".
6386
6387EOM
6388 case "$cccdlflags" in
6389 '') case "$gccversion" in
6390 '') case "$osname" in
6391 hpux) dflt='+z' ;;
6392 next) dflt='none' ;;
6393 irix*) dflt='-KPIC' ;;
48bcfe03 6394 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
6395 sunos) dflt='-pic' ;;
6396 *) dflt='none' ;;
6397 esac
6398 ;;
6399 *) case "$osname" in
48bcfe03 6400 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
6401 *) dflt='-fpic' ;;
6402 esac ;;
6403 esac ;;
6404 ' ') dflt='none' ;;
6405 *) dflt="$cccdlflags" ;;
6406 esac
6407 rp="Any special flags to pass to $cc -c to compile shared library modules?"
6408 . ./myread
6409 case "$ans" in
6410 none) cccdlflags=' ' ;;
6411 *) cccdlflags="$ans" ;;
6412 esac
6413
6414 cat << EOM
6415
6416Some systems use ld to create libraries that can be dynamically loaded,
6417while other systems (such as those using ELF) use $cc.
6418
6419EOM
6420 case "$ld" in
6421 '') $cat >try.c <<'EOM'
6422/* Test for whether ELF binaries are produced */
6423#include <fcntl.h>
6424#include <stdlib.h>
6425int main() {
6426 char b[4];
6427 int i = open("a.out",O_RDONLY);
6428 if(i == -1)
6429 exit(1); /* fail */
6430 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6431 exit(0); /* succeed (yes, it's ELF) */
6432 else
6433 exit(1); /* fail */
6434}
6435EOM
6436 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6437 cat <<EOM
6438You appear to have ELF support. I'll use $cc to build dynamic libraries.
6439EOM
6440 dflt="$cc"
6441 else
6442 echo "I'll use ld to build dynamic libraries."
6443 dflt='ld'
6444 fi
6445 rm -f try.c a.out
6446 ;;
6447 *) dflt="$ld"
6448 ;;
6449 esac
6450
6451 rp="What command should be used to create dynamic libraries?"
6452 . ./myread
6453 ld="$ans"
6454
6455 cat << EOM
6456
6457Some systems may require passing special flags to $ld to create a
6458library that can be dynamically loaded. If your ld flags include
6459-L/other/path options to locate libraries outside your loader's normal
6460search path, you may need to specify those -L options here as well. To
6461use no flags, say "none".
6462
6463EOM
6464 case "$lddlflags" in
6465 '') case "$osname" in
6466 beos) dflt='-nostart' ;;
6467 hpux) dflt='-b';
6468 case "$gccversion" in
6469 '') dflt="$dflt +vnocompatwarnings" ;;
6470 esac
6471 ;;
6472 linux|irix*) dflt='-shared' ;;
6473 next) dflt='none' ;;
6474 solaris) dflt='-G' ;;
6475 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 6476 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
6477 *) dflt='none' ;;
6478 esac
6479 ;;
6480 *) dflt="$lddlflags" ;;
6481 esac
6482
6483 : Try to guess additional flags to pick up local libraries.
6484 : Be careful not to append to a plain 'none'
6485 case "$dflt" in
6486 none) dflt='' ;;
6487 esac
6488 for thisflag in $ldflags; do
6489 case "$thisflag" in
6490 -L*|-R*)
6491 case " $dflt " in
6492 *" $thisflag "*) ;;
6493 *) dflt="$dflt $thisflag" ;;
6494 esac
6495 ;;
6496 esac
6497 done
6498
6499 case "$dflt" in
6500 ''|' ') dflt='none' ;;
6501 esac
6502
6503 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6504 . ./myread
6505 case "$ans" in
6506 none) lddlflags=' ' ;;
6507 *) lddlflags="$ans" ;;
6508 esac
6509
6510 cat <<EOM
6511
6512Some systems may require passing special flags to $cc to indicate that
6513the resulting executable will use dynamic linking. To use no flags,
6514say "none".
6515
6516EOM
6517 case "$ccdlflags" in
6518 '') case "$osname" in
6519 hpux) dflt='-Wl,-E' ;;
6520 linux) dflt='-rdynamic' ;;
6521 next) dflt='none' ;;
6522 sunos) dflt='none' ;;
6523 *) dflt='none' ;;
6524 esac ;;
6525 ' ') dflt='none' ;;
6526 *) dflt="$ccdlflags" ;;
6527 esac
6528 rp="Any special flags to pass to $cc to use dynamic linking?"
6529 . ./myread
6530 case "$ans" in
6531 none) ccdlflags=' ' ;;
6532 *) ccdlflags="$ans" ;;
6533 esac
6534 ;;
6535*) usedl="$undef"
6536 ld='ld'
6537 dlsrc='dl_none.xs'
6538 lddlflags=''
6539 ccdlflags=''
6540 ;;
6541esac
6542
6543also=''
6544case "$usedl" in
6545$undef)
6546 # No dynamic loading being used, so don't bother even to prompt.
6547 useshrplib='false'
6548 ;;
6549*) case "$useshrplib" in
6550 '') case "$osname" in
48bcfe03 6551 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
6552 dflt=y
6553 also='Building a shared libperl is required for dynamic loading to work on your system.'
6554 ;;
6555 next*)
6556 case "$osvers" in
6557 4*) dflt=y
6558 also='Building a shared libperl is needed for MAB support.'
6559 ;;
6560 *) dflt=n
6561 ;;
6562 esac
6563 ;;
6564 *) dflt=n
6565 ;;
6566 esac
6567 ;;
6568 $define|true|[Yy]*)
6569 dflt=y
6570 ;;
6571 *) dflt=n
6572 ;;
6573 esac
6574 $cat << EOM
6575
6576The perl executable is normally obtained by linking perlmain.c with
6577libperl${_a}, any static extensions (usually just DynaLoader), and
6578any other libraries needed on this system (such as -lm, etc.). Since
6579your system supports dynamic loading, it is probably possible to build
6580a shared libperl.$so. If you will have more than one executable linked
6581to libperl.$so, this will significantly reduce the size of each
6582executable, but it may have a noticeable affect on performance. The
6583default is probably sensible for your system.
6584$also
6585
6586EOM
6587 rp="Build a shared libperl.$so (y/n)"
6588 . ./myread
6589 case "$ans" in
6590 true|$define|[Yy]*)
6591 useshrplib='true' ;;
6592 *) useshrplib='false' ;;
6593 esac
6594 ;;
6595esac
6596
6597case "$useshrplib" in
6598true)
6599 case "$libperl" in
6600 '')
6601 # Figure out a good name for libperl.so. Since it gets stored in
6602 # a version-specific architecture-dependent library, the version
6603 # number isn't really that important, except for making cc/ld happy.
6604 #
6605 # A name such as libperl.so.3.1
6606 majmin="libperl.$so.$patchlevel.$subversion"
6607 # A name such as libperl.so.301
6608 majonly=`echo $patchlevel $subversion |
6609 $awk '{printf "%d%02d", $1, $2}'`
6610 majonly=libperl.$so.$majonly
6611 # I'd prefer to keep the os-specific stuff here to a minimum, and
6612 # rely on figuring it out from the naming of libc.
6613 case "${osname}${osvers}" in
6614 next4*)
6615 dflt=libperl.5.$so
6616 # XXX How handle the --version stuff for MAB?
6617 ;;
6618 linux*) # ld won't link with a bare -lperl otherwise.
6619 dflt=libperl.$so
6620 ;;
6621 cygwin*) # include version
6622 dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6623 ;;
6624 *) # Try to guess based on whether libc has major.minor.
6625 case "$libc" in
6626 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6627 *libc.$so.[0-9]*) dflt=$majonly ;;
6628 *) dflt=libperl.$so ;;
6629 esac
6630 ;;
6631 esac
6632 ;;
6633 *) dflt=$libperl
6634 ;;
6635 esac
6636 cat << EOM
6637
6638I need to select a good name for the shared libperl. If your system uses
6639library names with major and minor numbers, then you might want something
6640like $majmin. Alternatively, if your system uses a single version
6641number for shared libraries, then you might want to use $majonly.
6642Or, your system might be quite happy with a simple libperl.$so.
6643
6644Since the shared libperl will get installed into a version-specific
6645architecture-dependent directory, the version number of the shared perl
6646library probably isn't important, so the default should be o.k.
6647
6648EOM
6649 rp='What name do you want to give to the shared libperl?'
6650 . ./myread
6651 libperl=$ans
6652 echo "Ok, I'll use $libperl"
6653 ;;
6654*)
6655 libperl="libperl${_a}"
6656 ;;
6657esac
6658
6659# Detect old use of shrpdir via undocumented Configure -Dshrpdir
6660case "$shrpdir" in
6661'') ;;
6662*) $cat >&4 <<EOM
6663WARNING: Use of the shrpdir variable for the installation location of
6664the shared $libperl is not supported. It was never documented and
6665will not work in this version. Let me (perlbug@perl.org)
6666know of any problems this may cause.
6667
6668EOM
6669 case "$shrpdir" in
6670 "$archlibexp/CORE")
6671 $cat >&4 <<EOM
6672But your current setting of $shrpdir is
6673the default anyway, so it's harmless.
6674EOM
6675 ;;
6676 *)
6677 $cat >&4 <<EOM
6678Further, your current attempted setting of $shrpdir
6679conflicts with the value of $archlibexp/CORE
6680that installperl will use.
6681EOM
6682 ;;
6683 esac
6684 ;;
6685esac
6686
6687# How will the perl executable find the installed shared $libperl?
6688# Add $xxx to ccdlflags.
6689# If we can't figure out a command-line option, use $shrpenv to
6690# set env LD_RUN_PATH. The main perl makefile uses this.
6691shrpdir=$archlibexp/CORE
6692xxx=''
6693tmp_shrpenv=''
6694if "$useshrplib"; then
6695 case "$osname" in
6696 aix)
6697 # We'll set it in Makefile.SH...
6698 ;;
6699 solaris|netbsd)
6700 xxx="-R $shrpdir"
6701 ;;
6702 freebsd)
6703 xxx="-Wl,-R$shrpdir"
6704 ;;
6705 linux|irix*|dec_osf)
6706 xxx="-Wl,-rpath,$shrpdir"
6707 ;;
6708 next)
6709 # next doesn't like the default...
6710 ;;
6711 beos)
6712 # beos doesn't like the default, either.
6713 ;;
6714 hpux*)
6715 # hpux doesn't like the default, either.
6716 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6717 ;;
6718 *)
6719 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6720 ;;
6721 esac
6722 case "$xxx" in
6723 '') ;;
6724 *)
6725 # Only add $xxx if it isn't already in ccdlflags.
6726 case " $ccdlflags " in
6727 *" $xxx "*) ;;
6728 *) ccdlflags="$ccdlflags $xxx"
6729 cat <<EOM >&4
6730
6731Adding $xxx to the flags
6732passed to $ld so that the perl executable will find the
6733installed shared $libperl.
6734
6735EOM
6736 ;;
6737 esac
6738 ;;
6739 esac
6740fi
6741# Fix ccdlflags in AIX for building external extensions.
6742# (For building Perl itself bare -bE:perl.exp is needed,
6743# Makefile.SH takes care of this.)
6744case "$osname" in
6745aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6746esac
6747# Respect a hint or command-line value.
6748case "$shrpenv" in
6749'') shrpenv="$tmp_shrpenv" ;;
6750esac
6751case "$ldlibpthname" in
6752'') ldlibpthname=LD_LIBRARY_PATH ;;
6753none) ldlibpthname='' ;;
6754esac
6755
6756: determine where manual pages are on this system
6757echo " "
6758case "$sysman" in
6759'')
6760 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
6761 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
6762 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
6763 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6764 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
6765 sysman=`./loc . /usr/man/man1 $syspath`
6766 ;;
6767esac
6768if $test -d "$sysman"; then
6769 echo "System manual is in $sysman." >&4
6770else
6771 echo "Could not find manual pages in source form." >&4
6772fi
6773
6774: determine where manual pages go
6775set man1dir man1dir none
6776eval $prefixit
6777$cat <<EOM
6778
6779$spackage has manual pages available in source form.
6780EOM
6781case "$nroff" in
6782nroff)
6783 echo "However, you don't have nroff, so they're probably useless to you."
6784 case "$man1dir" in
6785 '') man1dir="none";;
6786 esac;;
6787esac
6788echo "If you don't want the manual sources installed, answer 'none'."
6789case "$man1dir" in
6790' ') dflt=none
6791 ;;
6792'')
6793 lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6794 lookpath="$lookpath $prefixexp/man/p_man/man1"
6795 lookpath="$lookpath $prefixexp/man/u_man/man1"
6796 lookpath="$lookpath $prefixexp/man/man.1"
6797 case "$sysman" in
6798 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6799 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6800 esac
6801 set dflt
6802 eval $prefixup
6803 ;;
6804*) dflt="$man1dir"
6805 ;;
6806esac
6807echo " "
6808fn=dn+~
6809rp="Where do the main $spackage manual pages (source) go?"
6810. ./getfile
6811if $test "X$man1direxp" != "X$ansexp"; then
6812 installman1dir=''
6813fi
6814man1dir="$ans"
6815man1direxp="$ansexp"
6816case "$man1dir" in
6817'') man1dir=' '
6818 installman1dir='';;
6819esac
6820
6821: Change installation prefix, if necessary.
6822if $test X"$prefix" != X"$installprefix"; then
6823 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6824else
6825 installman1dir="$man1direxp"
6826fi
6827
6828: What suffix to use on installed man pages
6829
6830case "$man1dir" in
6831' ')
6832 man1ext='0'
6833 ;;
6834*)
6835 rp="What suffix should be used for the main $spackage man pages?"
6836 case "$man1ext" in
6837 '') case "$man1dir" in
6838 *1) dflt=1 ;;
6839 *1p) dflt=1p ;;
6840 *1pm) dflt=1pm ;;
6841 *l) dflt=l;;
6842 *n) dflt=n;;
6843 *o) dflt=o;;
6844 *p) dflt=p;;
6845 *C) dflt=C;;
6846 *L) dflt=L;;
6847 *L1) dflt=L1;;
6848 *) dflt=1;;
6849 esac
6850 ;;
6851 *) dflt="$man1ext";;
6852 esac
6853 . ./myread
6854 man1ext="$ans"
6855 ;;
6856esac
6857
6858: see if we can have long filenames
6859echo " "
6860first=123456789abcdef
6861$rm -f $first
6862if (echo hi >$first) 2>/dev/null; then
6863 if $test -f 123456789abcde; then
6864 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
6865 val="$undef"
6866 else
6867 echo 'You can have filenames longer than 14 characters.'>&4
6868 val="$define"
6869 fi
6870else
6871 $cat <<'EOM'
6872You can't have filenames longer than 14 chars.
6873You can't even think about them!
6874EOM
6875 val="$undef"
6876fi
6877set d_flexfnam
6878eval $setvar
6879$rm -rf 123456789abcde*
6880
6881: determine where library module manual pages go
6882set man3dir man3dir none
6883eval $prefixit
6884$cat <<EOM
6885
6886$spackage has manual pages for many of the library modules.
6887EOM
6888
6889case "$nroff" in
6890nroff)
6891 $cat <<'EOM'
6892However, you don't have nroff, so they're probably useless to you.
6893EOM
6894 case "$man3dir" in
6895 '') man3dir="none";;
6896 esac;;
6897esac
6898
6899case "$d_flexfnam" in
6900undef)
6901 $cat <<'EOM'
6902However, your system can't handle the long file names like File::Basename.3.
6903EOM
6904 case "$man3dir" in
6905 '') man3dir="none";;
6906 esac;;
6907esac
6908
6909echo "If you don't want the manual sources installed, answer 'none'."
6910prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6911case "$man3dir" in
6912'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6913 if $test -d "$privlib/man/man3"; then
6914 cat <<EOM >&4
6915
6916WARNING: Previous versions of perl installed man3 pages into
6917$privlib/man/man3. This version will suggest a
6918new default of $dflt.
6919EOM
6920 tdflt=$dflt
6921 dflt='n'
6922 rp='Do you wish to preserve the old behavior?(y/n)'
6923 . ./myread
6924 case "$ans" in
6925 y*) dflt="$privlib/man/man3" ;;
6926 *) dflt=$tdflt ;;
6927 esac
6928 fi
6929 ;;
6930*) dflt="$man3dir" ;;
6931esac
6932case "$dflt" in
6933' ') dflt=none ;;
6934esac
6935echo " "
6936fn=dn+~
6937rp="Where do the $package library man pages (source) go?"
6938. ./getfile
6939man3dir="$ans"
6940man3direxp="$ansexp"
6941case "$man3dir" in
6942'') man3dir=' '
6943 installman3dir='';;
6944esac
6945
6946: Change installation prefix, if necessary.
6947if $test X"$prefix" != X"$installprefix"; then
6948 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6949else
6950 installman3dir="$man3direxp"
6951fi
6952
6953: What suffix to use on installed man pages
6954case "$man3dir" in
6955' ')
6956 man3ext='0'
6957 ;;
6958*)
6959 rp="What suffix should be used for the $package library man pages?"
6960 case "$man3ext" in
6961 '') case "$man3dir" in
6962 *3) dflt=3 ;;
6963 *3p) dflt=3p ;;
6964 *3pm) dflt=3pm ;;
6965 *l) dflt=l;;
6966 *n) dflt=n;;
6967 *o) dflt=o;;
6968 *p) dflt=p;;
6969 *C) dflt=C;;
6970 *L) dflt=L;;
6971 *L3) dflt=L3;;
6972 *) dflt=3;;
6973 esac
6974 ;;
6975 *) dflt="$man3ext";;
6976 esac
6977 . ./myread
6978 man3ext="$ans"
6979 ;;
6980esac
6981
6982: see if we have to deal with yellow pages, now NIS.
6983if $test -d /usr/etc/yp || $test -d /etc/yp; then
6984 if $test -f /usr/etc/nibindd; then
6985 echo " "
6986 echo "I'm fairly confident you're on a NeXT."
6987 echo " "
6988 rp='Do you get the hosts file via NetInfo?'
6989 dflt=y
6990 case "$hostcat" in
6991 nidump*) ;;
6992 '') ;;
6993 *) dflt=n;;
6994 esac
6995 . ./myread
6996 case "$ans" in
6997 y*) hostcat='nidump hosts .';;
6998 *) case "$hostcat" in
6999 nidump*) hostcat='';;
7000 esac
7001 ;;
7002 esac
7003 fi
7004 case "$hostcat" in
7005 nidump*) ;;
7006 *)
7007 case "$hostcat" in
7008 *ypcat*) dflt=y;;
7009 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7010 dflt=y
7011 else
7012 dflt=n
7013 fi;;
7014 *) dflt=n;;
7015 esac
7016 echo " "
7017 rp='Are you getting the hosts file via yellow pages?'
7018 . ./myread
7019 case "$ans" in
7020 y*) hostcat='ypcat hosts';;
7021 *) hostcat='cat /etc/hosts';;
7022 esac
7023 ;;
7024 esac
7025fi
7026case "$hostcat" in
7027'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7028esac
7029case "$groupcat" in
7030'') test -f /etc/group && groupcat='cat /etc/group';;
7031esac
7032case "$passcat" in
7033'') test -f /etc/passwd && passcat='cat /etc/passwd';;
7034esac
7035
7036: now get the host name
7037echo " "
7038echo "Figuring out host name..." >&4
7039case "$myhostname" in
7040'') cont=true
7041 echo 'Maybe "hostname" will work...'
7042 if tans=`sh -c hostname 2>&1` ; then
7043 myhostname=$tans
7044 phostname=hostname
7045 cont=''
7046 fi
7047 ;;
7048*) cont='';;
7049esac
7050if $test "$cont"; then
7051 if ./xenix; then
7052 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
7053 if tans=`cat /etc/systemid 2>&1` ; then
7054 myhostname=$tans
7055 phostname='cat /etc/systemid'
7056 echo "Whadyaknow. Xenix always was a bit strange..."
7057 cont=''
7058 fi
7059 elif $test -r /etc/systemid; then
7060 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7061 fi
7062fi
7063if $test "$cont"; then
7064 echo 'No, maybe "uuname -l" will work...'
7065 if tans=`sh -c 'uuname -l' 2>&1` ; then
7066 myhostname=$tans
7067 phostname='uuname -l'
7068 else
7069 echo 'Strange. Maybe "uname -n" will work...'
7070 if tans=`sh -c 'uname -n' 2>&1` ; then
7071 myhostname=$tans
7072 phostname='uname -n'
7073 else
7074 echo 'Oh well, maybe I can mine it out of whoami.h...'
7075 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7076 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7077 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7078 else
7079 case "$myhostname" in
7080 '') echo "Does this machine have an identity crisis or something?"
7081 phostname='';;
7082 *)
7083 echo "Well, you said $myhostname before..."
7084 phostname='echo $myhostname';;
7085 esac
7086 fi
7087 fi
7088 fi
7089fi
7090: you do not want to know about this
7091set $myhostname
7092myhostname=$1
7093
7094: verify guess
7095if $test "$myhostname" ; then
7096 dflt=y
7097 rp='Your host name appears to be "'$myhostname'".'" Right?"
7098 . ./myread
7099 case "$ans" in
7100 y*) ;;
7101 *) myhostname='';;
7102 esac
7103fi
7104
7105: bad guess or no guess
7106while $test "X$myhostname" = X ; do
7107 dflt=''
7108 rp="Please type the (one word) name of your host:"
7109 . ./myread
7110 myhostname="$ans"
7111done
7112
7113: translate upper to lower if necessary
7114case "$myhostname" in
7115*[A-Z]*)
7116 echo "(Normalizing case in your host name)"
7117 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7118 ;;
7119esac
7120
7121case "$myhostname" in
7122*.*)
7123 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7124 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7125 echo "(Trimming domain name from host name--host name is now $myhostname)"
7126 ;;
7127*) case "$mydomain" in
7128 '')
7129 {
7130 test "X$hostcat" = "Xypcat hosts" &&
7131 ypmatch "$myhostname" hosts 2>/dev/null |\
7132 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
7133 $test -s hosts
7134 } || {
7135 test "X$hostcat" != "X" &&
7136 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
7137 /[ ]$myhostname[ . ]/p" > hosts
7138 }
7139 tmp_re="[ . ]"
f08cbdd1
PP
7140 if $test -f hosts; then
7141 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 7142 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
7143 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7144 hosts | $sort | $uniq | \
7145 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7146 case `$echo X$dflt` in
7147 X*\ *) echo "(Several hosts in the database matched hostname)"
7148 dflt=.
7149 ;;
7150 X.) echo "(You do not have fully-qualified names in the hosts database)"
7151 ;;
7152 esac
7153 else
7154 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 7155 dflt=.
f08cbdd1 7156 fi
b4eb6b3d
JH
7157 case "$dflt" in
7158 .)
7159 tans=`./loc resolv.conf X /etc /usr/etc`
7160 if $test -f "$tans"; then
7161 echo "(Attempting domain name extraction from $tans)"
7162 dflt=.`$sed -n -e 's/ / /g' \
7163 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
7164 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7165 case "$dflt" in
7166 .) dflt=.`$sed -n -e 's/ / /g' \
7167 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
7168 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7169 ;;
7170 esac
7171 fi
7172 ;;
7173 esac
7174 case "$dflt" in
7175 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7176 dflt=.`sh -c domainname 2>/dev/null`
7177 case "$dflt" in
7178 '') dflt='.';;
7179 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7180 esac
7181 ;;
7182 esac
7183 case "$dflt" in
7184 .) echo "(Lost all hope -- silly guess then)"
7185 dflt='.uucp'
7186 ;;
7187 esac
7188 $rm -f hosts
7189 ;;
7190 *) dflt="$mydomain";;
7191 esac;;
7192esac
7193echo " "
7194rp="What is your domain name?"
7195. ./myread
7196tans="$ans"
7197case "$ans" in
7198'') ;;
7199.*) ;;
7200*) tans=".$tans";;
7201esac
7202mydomain="$tans"
7203
7204: translate upper to lower if necessary
7205case "$mydomain" in
7206*[A-Z]*)
7207 echo "(Normalizing case in your domain name)"
7208 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7209 ;;
7210esac
7211
7212: a little sanity check here
7213case "$phostname" in
7214'') ;;
7215*)
7216 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7217 $myhostname$mydomain|$myhostname) ;;
7218 *)
7219 case "$phostname" in
7220 sed*)
7221 echo "(That doesn't agree with your whoami.h file, by the way.)"
7222 ;;
7223 *)
7224 echo "(That doesn't agree with your $phostname command, by the way.)"
7225 ;;
7226 esac
7227 ;;
7228 esac
7229 ;;
7230esac
7231
7232$cat <<EOM
7233
7234I need to get your e-mail address in Internet format if possible, i.e.
7235something like user@host.domain. Please answer accurately since I have
7236no easy means to double check it. The default value provided below
7237is most probably close to reality but may not be valid from outside
7238your organization...
7239
7240EOM
7241cont=x
7242while test "$cont"; do
7243 case "$cf_email" in
7244 '') dflt="$cf_by@$myhostname$mydomain";;
7245 *) dflt="$cf_email";;
7246 esac
7247 rp='What is your e-mail address?'
7248 . ./myread
7249 cf_email="$ans"
7250 case "$cf_email" in
7251 *@*.*) cont='' ;;
7252 *)
7253 rp='Address does not look like an Internet one. Use it anyway?'
7254 case "$fastread" in
7255 yes) dflt=y ;;
7256 *) dflt=n ;;
7257 esac
7258 . ./myread
7259 case "$ans" in
7260 y*) cont='' ;;
7261 *) echo " " ;;
7262 esac
7263 ;;
7264 esac
7265done
7266
7267$cat <<EOM
7268
7269If you or somebody else will be maintaining perl at your site, please
7270fill in the correct e-mail address here so that they may be contacted
7271if necessary. Currently, the "perlbug" program included with perl
7272will send mail to this address in addition to perlbug@perl.org. You may
7273enter "none" for no administrator.
7274
7275EOM
7276case "$perladmin" in
7277'') dflt="$cf_email";;
7278*) dflt="$perladmin";;
7279esac
7280rp='Perl administrator e-mail address'
7281. ./myread
7282perladmin="$ans"
7283
674912d7
RB
7284: determine whether to only install version-specific parts.
7285echo " "
7286$cat <<EOM
7287Do you want to install only the version-specific parts of the perl
7288distribution? Usually you do *not* want to do this.
7289EOM
7290case "$versiononly" in
7291"$define"|[Yy]*|true) dflt='y' ;;
7292*) dflt='n';
7293esac
7294rp="Do you want to install only the version-specific parts of perl?"
7295. ./myread
7296case "$ans" in
7297[yY]*) val="$define";;
7298*) val="$undef" ;;
7299esac
7300set versiononly
7301eval $setvar
7302
b4eb6b3d
JH
7303: figure out how to guarantee perl startup
7304case "$startperl" in
7305'')
7306 case "$sharpbang" in
7307 *!)
7308 $cat <<EOH
7309
7310I can use the #! construct to start perl on your system. This will
7311make startup of perl scripts faster, but may cause problems if you
7312want to share those scripts and perl is not in a standard place
7313($binexp/perl) on all your platforms. The alternative is to force
7314a shell by starting the script with a single ':' character.
7315
7316EOH
674912d7
RB
7317 case "$versiononly" in
7318 "$define") dflt="$binexp/perl$version";;
7319 *) dflt="$binexp/perl";;
7320 esac
b4eb6b3d
JH
7321 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7322 . ./myread
7323 case "$ans" in
7324 none) startperl=": # use perl";;
7325 *) startperl="#!$ans"
7326 if $test 30 -lt `echo "$ans" | wc -c`; then
7327 $cat >&4 <<EOM
7328
7329WARNING: Some systems limit the #! command to 32 characters.
7330If you experience difficulty running Perl scripts with #!, try
7331installing Perl in a directory with a shorter pathname.
7332
7333EOM
7334 fi ;;
7335 esac
7336 ;;
7337 *) startperl=": # use perl"
7338 ;;
7339 esac
7340 ;;
7341esac
7342echo "I'll use $startperl to start perl scripts."
7343
7344: figure best path for perl in scripts
7345case "$perlpath" in
7346'')
7347 perlpath="$binexp/perl"
7348 case "$startperl" in
7349 *!*) ;;
7350 *)
7351 $cat <<EOH
7352
7353I will use the "eval 'exec'" idiom to start Perl on your system.
7354I can use the full path of your Perl binary for this purpose, but
7355doing so may cause problems if you want to share those scripts and
7356Perl is not always in a standard place ($binexp/perl).
7357
7358EOH
7359 dflt="$binexp/perl"
7360 rp="What path shall I use in \"eval 'exec'\"?"
7361 . ./myread
7362 perlpath="$ans"
7363 ;;
7364 esac
7365 ;;
7366esac
7367case "$startperl" in
7368*!*) ;;
7369*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7370esac
7371
7372: determine where public executable scripts go
7373set scriptdir scriptdir
7374eval $prefixit
7375case "$scriptdir" in
7376'')
7377 dflt="$bin"
7378 : guess some guesses
7379 $test -d /usr/share/scripts && dflt=/usr/share/scripts
7380 $test -d /usr/share/bin && dflt=/usr/share/bin
7381 $test -d /usr/local/script && dflt=/usr/local/script
7382 $test -d /usr/local/scripts && dflt=/usr/local/scripts
7383 $test -d $prefixexp/script && dflt=$prefixexp/script
7384 set dflt
7385 eval $prefixup
7386 ;;
7387*) dflt="$scriptdir"
7388 ;;
7389esac
7390$cat <<EOM
7391
7392Some installations have a separate directory just for executable scripts so
7393that they can mount it across multiple architectures but keep the scripts in
7394one spot. You might, for example, have a subdirectory of /usr/share for this.
7395Or you might just lump your scripts in with all your other executables.
7396
7397EOM
7398fn=d~
7399rp='Where do you keep publicly executable scripts?'
7400. ./getfile
7401if $test "X$ansexp" != "X$scriptdirexp"; then
7402 installscript=''
7403fi
7404scriptdir="$ans"
7405scriptdirexp="$ansexp"
7406: Change installation prefix, if necessary.
7407if $test X"$prefix" != X"$installprefix"; then
7408 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7409else
7410 installscript="$scriptdirexp"
7411fi
7412
7413: determine where add-on public executables go
7414case "$sitebin" in
7415'') dflt=$siteprefix/bin ;;
7416*) dflt=$sitebin ;;
7417esac
7418fn=d~
7419rp='Pathname where the add-on public executables should be installed?'
7420. ./getfile
7421sitebin="$ans"
7422sitebinexp="$ansexp"
7423: Change installation prefix, if necessary.
7424if $test X"$prefix" != X"$installprefix"; then
7425 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7426else
7427 installsitebin="$sitebinexp"
7428fi
7429
7430case "$useperlio" in
7431$define|true|[yY]*) dflt='y';;
7432*) dflt='n';;
7433esac
7434cat <<EOM
7435
cf829ab0
JH
7436Previous version of $package used the standard IO mechanisms as
7437defined in <stdio.h>. Versions 5.003_02 and later of perl allow
7438alternate IO mechanisms via the PerlIO abstraction layer, but the
7439stdio mechanism is still the default. This abstraction layer can
7440use AT&T's sfio (if you already have sfio installed) or regular stdio.
7441Using PerlIO with sfio may cause problems with some extension modules.
b4eb6b3d
JH
7442
7443If this doesn't make any sense to you, just accept the default '$dflt'.
7444EOM
7445rp='Use the experimental PerlIO abstraction layer?'
7446. ./myread
7447case "$ans" in
7448y|Y)
7449 val="$define"
7450 ;;
7451*)
cf829ab0 7452 echo "Ok, doing things the stdio way."
b4eb6b3d
JH
7453 val="$undef"
7454 ;;
7455esac
7456set useperlio
7457eval $setvar
7458
cf829ab0
JH
7459case "$usesocks" in
7460$define|true|[yY]*)
7461 case "$useperlio" in
7462 $define|true|[yY]*) ;;
7463 *) cat >&4 <<EOM
7464
7465You are using the SOCKS proxy protocol library which means that you
7466should also use the PerlIO layer. You may be headed for trouble.
7467
7468EOM
7469 ;;
7470 esac
7471 ;;
7472esac
7473
7474
b4eb6b3d
JH
7475case "$vendorprefix" in
7476'') d_vendorbin="$undef"
7477 vendorbin=''
7478 vendorbinexp=''
7479 ;;
7480*) d_vendorbin="$define"
7481 : determine where vendor-supplied executables go.
7482 case "$vendorbin" in
7483 '') dflt=$vendorprefix/bin ;;
7484 *) dflt="$vendorbin" ;;
7485 esac
7486 fn=d~+
7487 rp='Pathname for the vendor-supplied executables directory?'
7488 . ./getfile
7489 vendorbin="$ans"
7490 vendorbinexp="$ansexp"
7491 ;;
7492esac
7493: Change installation prefix, if necessary.
7494if $test X"$prefix" != X"$installprefix"; then
7495 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7496else
7497 installvendorbin="$vendorbinexp"
7498fi
7499
7500: see if qgcvt exists
7501set qgcvt d_qgcvt
7502eval $inlibc
7503
7504echo " "
7505
7506if $test X"$d_longdbl" = X"$define"; then
7507
7508echo "Checking how to print long doubles..." >&4
7509
7510if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7511 $cat >try.c <<'EOCP'
7512#include <sys/types.h>
7513#include <stdio.h>
7514int main() {
7515 double d = 123.456;
7516 printf("%.3f\n", d);
7517}
7518EOCP
7519 set try
7520 if eval $compile; then
7521 yyy=`./try$exe_ext`
7522 case "$yyy" in
7523 123.456)
7524 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7525 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7526 echo "We will use %f."
7527 ;;
7528 esac
7529 fi
7530fi
7531
7532if $test X"$sPRIfldbl" = X; then
7533 $cat >try.c <<'EOCP'
7534#include <sys/types.h>
7535#include <stdio.h>
7536int main() {
7537 long double d = 123.456;
7538 printf("%.3llf\n", d);
7539}
7540EOCP
7541 set try
7542 if eval $compile; then
7543 yyy=`./try$exe_ext`
7544 case "$yyy" in
7545 123.456)
7546 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7547 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7548 echo "We will use %llf."
7549 ;;
7550 esac
7551 fi
7552fi
7553
7554if $test X"$sPRIfldbl" = X; then
7555 $cat >try.c <<'EOCP'
7556#include <sys/types.h>
7557#include <stdio.h>
7558int main() {
7559 long double d = 123.456;
7560 printf("%.3Lf\n", d);
7561}
7562EOCP
7563 set try
7564 if eval $compile; then
7565 yyy=`./try$exe_ext`
7566 case "$yyy" in
7567 123.456)
7568 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7569 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7570 echo "We will use %Lf."
7571 ;;
7572 esac
7573 fi
7574fi
7575
7576if $test X"$sPRIfldbl" = X; then
7577 $cat >try.c <<'EOCP'
7578#include <sys/types.h>
7579#include <stdio.h>
7580int main() {
7581 long double d = 123.456;
7582 printf("%.3lf\n", d);
7583}
7584EOCP
7585 set try
7586 if eval $compile; then
7587 yyy=`./try$exe_ext`
7588 case "$yyy" in
7589 123.456)
7590 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7591 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7592 echo "We will use %lf."
7593 ;;
7594 esac
7595 fi
7596fi
7597
7598if $test X"$sPRIfldbl" = X; then
7599 echo "Cannot figure out how to print long doubles." >&4
7600else
7601 sSCNfldbl=$sPRIfldbl # expect consistency
7602fi
7603
7604$rm -f try try.*
7605
7606fi # d_longdbl
7607
7608case "$sPRIfldbl" in
7609'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
7610 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
7611 d_SCNfldbl="$undef";
7612 ;;
7613*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
7614 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
7615 d_SCNfldbl="$define";
7616 ;;
7617esac
7618
7619: Check how to convert floats to strings.
7620echo " "
7621echo "Checking for an efficient way to convert floats to strings."
7622echo " " > try.c
7623case "$uselongdouble" in
7624"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7625esac
7626case "$d_longdbl" in
7627"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7628esac
7629case "$d_PRIgldbl" in
7630"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
7631esac
7632$cat >>try.c <<EOP
7633#ifdef TRY_gconvert
7634#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7635char *myname = "gconvert";
7636#endif
7637#ifdef TRY_gcvt
7638#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7639char *myname = "gcvt";
7640#endif
7641#ifdef TRY_qgcvt
7642#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7643char *myname = "qgcvt";
7644#define DOUBLETYPE long double
7645#endif
7646#ifdef TRY_sprintf
7647#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7648#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7649#else
7650#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7651#endif
7652char *myname = "sprintf";
7653#endif
7654
7655#ifndef DOUBLETYPE
7656#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7657#define DOUBLETYPE long double
7658#else
7659#define DOUBLETYPE double
7660#endif
7661#endif
7662
7663#include <stdio.h>
7664
7665#define I_STDLIB $i_stdlib
7666#ifdef I_STDLIB
7667#include <stdlib.h>
7668#endif
7669
7670int
7671checkit(expect, got)
7672char *expect;
7673char *got;
7674{
7675 if (strcmp(expect, got)) {
7676 printf("%s oddity: Expected %s, got %s\n",
7677 myname, expect, got);
7678 exit(1);
7679 }
7680}
7681
7682int main()
7683{
7684 char buf[64];
7685 buf[63] = '\0';
7686
7687 /* This must be 1st test on (which?) platform */
7688 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7689 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7690 checkit("0.1", buf);
7691
7692 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
7693 checkit("1", buf);
7694
7695 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
7696 checkit("1.1", buf);
7697
7698 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
7699 checkit("1.01", buf);
7700
7701 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
7702 checkit("1.001", buf);
7703
7704 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
7705 checkit("1.0001", buf);
7706
7707 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
7708 checkit("1.00001", buf);
7709
7710 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
7711 checkit("1.000001", buf);
7712
7713 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
7714 checkit("0", buf);
7715
7716 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
7717 checkit("-1", buf);
7718
7719 /* Some Linux gcvt's give 1.e+5 here. */
7720 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
7721 checkit("100000", buf);
7722
7723 /* Some Linux gcvt's give -1.e+5 here. */
7724 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
7725 checkit("-100000", buf);
7726
7727 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
7728 checkit("123.456", buf);
7729
7730 exit(0);
7731}
7732EOP
7733case "$d_Gconvert" in
7734gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7735gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7736sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7737*) xxx_list='gconvert gcvt sprintf' ;;
7738esac
7739
7740case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7741"$define$define$define")
7742 # for long doubles prefer first qgcvt, then sprintf
7743 xxx_list="`echo $xxx_list|sed s/sprintf//`"
7744 xxx_list="sprintf $xxx_list"
7745 case "$d_qgcvt" in
7746 "$define") xxx_list="qgcvt $xxx_list" ;;
7747 esac
7748 ;;
7749esac
7750
7751for xxx_convert in $xxx_list; do
7752 echo "Trying $xxx_convert..."
7753 $rm -f try try$_o
7754 set try -DTRY_$xxx_convert
7755 if eval $compile; then
7756 echo "$xxx_convert() found." >&4
7757 if ./try; then
7758 echo "I'll use $xxx_convert to convert floats into a string." >&4
7759 break;
7760 else
7761 echo "...But $xxx_convert didn't work as I expected."
7762 fi
7763 else
7764 echo "$xxx_convert NOT found." >&4
7765 fi
7766done
7767
7768case "$xxx_convert" in
7769gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7770gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7771qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7772*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7773 "$define$define$define")
7774 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7775 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7776 esac
7777 ;;
7778esac
7779
74cac757
JH
7780: see if _fwalk exists
7781set fwalk d__fwalk
7782eval $inlibc
7783
b4eb6b3d
JH
7784: Initialize h_fcntl
7785h_fcntl=false
7786
7787: Initialize h_sysfile
7788h_sysfile=false
7789
7790: access call always available on UNIX
7791set access d_access
7792eval $inlibc
7793
7794: locate the flags for 'access()'
7795case "$d_access" in
7796"$define")
7797 echo " "
7798 $cat >access.c <<'EOCP'
7799#include <sys/types.h>
7800#ifdef I_FCNTL
7801#include <fcntl.h>
7802#endif
7803#ifdef I_SYS_FILE
7804#include <sys/file.h>
7805#endif
7806#ifdef I_UNISTD
7807#include <unistd.h>
7808#endif
7809int main() {
7810 exit(R_OK);
7811}
7812EOCP
7813 : check sys/file.h first, no particular reason here
7814 if $test `./findhdr sys/file.h` && \
7a282f6d 7815 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
7816 h_sysfile=true;
7817 echo "<sys/file.h> defines the *_OK access constants." >&4
7818 elif $test `./findhdr fcntl.h` && \
7a282f6d 7819 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
7820 h_fcntl=true;
7821 echo "<fcntl.h> defines the *_OK access constants." >&4
7822 elif $test `./findhdr unistd.h` && \
7a282f6d 7823 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
7824 echo "<unistd.h> defines the *_OK access constants." >&4
7825 else
7826 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7827 fi
7828 ;;
7829esac
7830$rm -f access*
7831
7832: see if accessx exists
7833set accessx d_accessx
7834eval $inlibc
7835
7836: see if alarm exists
7837set alarm d_alarm
7838eval $inlibc
7839
7840: see if atolf exists
7841set atolf d_atolf
7842eval $inlibc
7843
7844: see if atoll exists
7845set atoll d_atoll
7846eval $inlibc
7847
7848: Look for GNU-cc style attribute checking
7849echo " "
7850echo "Checking whether your compiler can handle __attribute__ ..." >&4
7851$cat >attrib.c <<'EOCP'
7852#include <stdio.h>
7853void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7854EOCP
7855if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7856 if $contains 'warning' attrib.out >/dev/null 2>&1; then
7857 echo "Your C compiler doesn't fully support __attribute__."
7858 val="$undef"
7859 else
7860 echo "Your C compiler supports __attribute__."
7861 val="$define"
7862 fi
7863else
7864 echo "Your C compiler doesn't seem to understand __attribute__ at all."
7865 val="$undef"
7866fi
7867set d_attribut
7868eval $setvar
7869$rm -f attrib*
7870
7871: see if bcmp exists
7872set bcmp d_bcmp
7873eval $inlibc
7874
7875: see if bcopy exists
7876set bcopy d_bcopy
7877eval $inlibc
7878
7879: see if this is a unistd.h system
7880set unistd.h i_unistd
7881eval $inhdr
7882
7883: see if getpgrp exists
7884set getpgrp d_getpgrp
7885eval $inlibc
7886
7887case "$d_getpgrp" in
7888"$define")
7889 echo " "
7890 echo "Checking to see which flavor of getpgrp is in use..."
7891 $cat >set.c <<EOP
7892#$i_unistd I_UNISTD
7893#include <sys/types.h>
7894#ifdef I_UNISTD
7895# include <unistd.h>
7896#endif
7897int main()
7898{
7899 if (getuid() == 0) {
7900 printf("(I see you are running Configure as super-user...)\n");
7901 setuid(1);
7902 }
7903#ifdef TRY_BSD_PGRP
7904 if (getpgrp(1) == 0)
7905 exit(0);
7906#else
7907 if (getpgrp() > 0)
7908 exit(0);
7909#endif
7910 exit(1);
7911}
7912EOP
7a282f6d 7913 if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
7914 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7915 val="$define"
7a282f6d 7916 elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
7917 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7918 val="$undef"
7919 else
7920 echo "I can't seem to compile and run the test program."
7921 if ./usg; then
7922 xxx="a USG one, i.e. you use getpgrp()."
7923 else
7924 # SVR4 systems can appear rather BSD-ish.
7925 case "$i_unistd" in
7926 $undef)
7927 xxx="a BSD one, i.e. you use getpgrp(pid)."
7928 val="$define"
7929 ;;
7930 $define)
7931 xxx="probably a USG one, i.e. you use getpgrp()."
7932 val="$undef"
7933 ;;
7934 esac
7935 fi
7936 echo "Assuming your getpgrp is $xxx" >&4
7937 fi
7938 ;;
7939*) val="$undef";;
7940esac
7941set d_bsdgetpgrp
7942eval $setvar
7943$rm -f set set.c
7944
7945: see if setpgrp exists
7946set setpgrp d_setpgrp
7947eval $inlibc
7948
7949case "$d_setpgrp" in
7950"$define")
7951 echo " "
7952 echo "Checking to see which flavor of setpgrp is in use..."
7953 $cat >set.c <<EOP
7954#$i_unistd I_UNISTD
7955#include <sys/types.h>
7956#ifdef I_UNISTD
7957# include <unistd.h>
7958#endif
7959int main()
7960{
7961 if (getuid() == 0) {
7962 printf("(I see you are running Configure as super-user...)\n");
7963 setuid(1);
7964 }
7965#ifdef TRY_BSD_PGRP
7966 if (-1 == setpgrp(1, 1))
7967 exit(0);
7968#else
7969 if (setpgrp() != -1)
7970 exit(0);
7971#endif
7972 exit(1);
7973}
7974EOP
7a282f6d 7975 if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
7976 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7977 val="$define"
7a282f6d 7978 elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
7979 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7980 val="$undef"
7981 else
7982 echo "(I can't seem to compile and run the test program.)"
7983 if ./usg; then
7984 xxx="a USG one, i.e. you use setpgrp()."
7985 else
7986 # SVR4 systems can appear rather BSD-ish.
7987 case "$i_unistd" in
7988 $undef)
7989 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7990 val="$define"
7991 ;;
7992 $define)
7993 xxx="probably a USG one, i.e. you use setpgrp()."
7994 val="$undef"
7995 ;;
7996 esac
7997 fi
7998 echo "Assuming your setpgrp is $xxx" >&4
7999 fi
8000 ;;
8001*) val="$undef";;
8002esac
8003set d_bsdsetpgrp
8004eval $setvar
8005$rm -f set set.c
8006: see if bzero exists
8007set bzero d_bzero
8008eval $inlibc
8009
8010: see if signal is declared as pointer to function returning int or void
8011echo " "
8012xxx=`./findhdr signal.h`
8013$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8014if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
8015 echo "You have int (*signal())() instead of void." >&4
8016 val="$undef"
8017elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
8018 echo "You have void (*signal())()." >&4
8019 val="$define"
8020elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8021 echo "You have int (*signal())() instead of void." >&4
8022 val="$undef"
8023elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8024 echo "You have void (*signal())()." >&4
8025 val="$define"
8026else
8027 case "$d_voidsig" in
8028 '')
8029 echo "I can't determine whether signal handler returns void or int..." >&4
8030 dflt=void
8031 rp="What type does your signal handler return?"
8032 . ./myread
8033 case "$ans" in
8034 v*) val="$define";;
8035 *) val="$undef";;
8036 esac;;
8037 "$define")
8038 echo "As you already told me, signal handler returns void." >&4
8039 val="$define"
8040 ;;
8041 *) echo "As you already told me, signal handler returns int." >&4
8042 val="$undef"
8043 ;;
8044 esac
8045fi
8046set d_voidsig
8047eval $setvar
8048case "$d_voidsig" in
8049"$define") signal_t="void";;
8050*) signal_t="int";;
8051esac
8052$rm -f $$.tmp
8053
8054: check for ability to cast large floats to 32-bit ints.
8055echo " "
8056echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8057if $test "$intsize" -ge 4; then
8058 xxx=int
8059else
8060 xxx=long
8061fi
8062$cat >try.c <<EOCP
8063#include <stdio.h>
8064#include <sys/types.h>
8065#include <signal.h>
8066$signal_t blech(s) int s; { exit(3); }
8067int main()
8068{
8069 $xxx i32;
8070 double f, g;
8071 int result = 0;
8072 char str[16];
8073 signal(SIGFPE, blech);
8074
8075 /* Don't let compiler optimize the test away. Store the number
8076 in a writable string for gcc to pass to sscanf under HP/UX.
8077 */
8078 sprintf(str, "2147483647");
8079 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8080 g = 10 * f;
8081 i32 = ($xxx) g;
8082
8083 /* x86 processors will probably give 0x8000 0000, which is a
8084 sign change. We don't want that. We want to mimic SPARC
8085 behavior here, which is to preserve the sign and give
8086 back 0x7fff ffff.
8087 */
8088 if (i32 != ($xxx) f)
8089 result |= 1;
8090 exit(result);
8091}
8092EOCP
8093set try
8094if eval $compile_ok; then
8095 ./try
8096 yyy=$?
8097else
8098 echo "(I can't seem to compile the test program--assuming it can't)"
8099 yyy=1
8100fi
8101case "$yyy" in
81020) val="$define"
8103 echo "Yup, it can."
8104 ;;
8105*) val="$undef"
8106 echo "Nope, it can't."
8107 ;;
8108esac
8109set d_casti32
8110eval $setvar
8111$rm -f try try.*
8112
8113: check for ability to cast negative floats to unsigned
8114echo " "
8115echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8116$cat >try.c <<EOCP
8117#include <stdio.h>
8118#include <sys/types.h>
8119#include <signal.h>
8120$signal_t blech(s) int s; { exit(7); }
8121$signal_t blech_in_list(s) int s; { exit(4); }
8122unsigned long dummy_long(p) unsigned long p; { return p; }
8123unsigned int dummy_int(p) unsigned int p; { return p; }
8124unsigned short dummy_short(p) unsigned short p; { return p; }
8125int main()
8126{
8127 double f;
8128 unsigned long along;
8129 unsigned int aint;
8130 unsigned short ashort;
8131 int result = 0;
8132 char str[16];
8133
8134 /* Frustrate gcc-2.7.2's optimizer which failed this test with
8135 a direct f = -123. assignment. gcc-2.8.0 reportedly
8136 optimized the whole file away
8137 */
8138 /* Store the number in a writable string for gcc to pass to
8139 sscanf under HP/UX.
8140 */
8141 sprintf(str, "-123");
8142 sscanf(str, "%lf", &f); /* f = -123.; */
8143
8144 signal(SIGFPE, blech);
8145 along = (unsigned long)f;
8146 aint = (unsigned int)f;
8147 ashort = (unsigned short)f;
8148 if (along != (unsigned long)-123)
8149 result |= 1;
8150 if (aint != (unsigned int)-123)
8151 result |= 1;
8152 if (ashort != (unsigned short)-123)
8153 result |= 1;
8154 sprintf(str, "1073741824.");
8155 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8156 f = f + f;
8157 along = 0;
8158 along = (unsigned long)f;
8159 if (along != 0x80000000)
8160 result |= 2;
8161 f -= 1.;
8162 along = 0;
8163 along = (unsigned long)f;
8164 if (along != 0x7fffffff)
8165 result |= 1;
8166 f += 2.;
8167 along = 0;
8168 along = (unsigned long)f;
8169 if (along != 0x80000001)
8170 result |= 2;
8171 if (result)
8172 exit(result);
8173 signal(SIGFPE, blech_in_list);
8174 sprintf(str, "123.");
8175 sscanf(str, "%lf", &f); /* f = 123.; */
8176 along = dummy_long((unsigned long)f);
8177 aint = dummy_int((unsigned int)f);
8178 ashort = dummy_short((unsigned short)f);
8179 if (along != (unsigned long)123)
8180 result |= 4;
8181 if (aint != (unsigned int)123)
8182 result |= 4;
8183 if (ashort != (unsigned short)123)
8184 result |= 4;
8185 exit(result);
8186
8187}
8188EOCP
8189set try
8190if eval $compile_ok; then
8191 ./try
8192 castflags=$?
8193else
8194 echo "(I can't seem to compile the test program--assuming it can't)"
8195 castflags=7
8196fi
8197case "$castflags" in
81980) val="$define"
8199 echo "Yup, it can."
8200 ;;
8201*) val="$undef"
8202 echo "Nope, it can't."
8203 ;;
8204esac
8205set d_castneg
8206eval $setvar
8207$rm -f try.*
8208
8209: see if vprintf exists
8210echo " "
8211if set vprintf val -f d_vprintf; eval $csym; $val; then
8212 echo 'vprintf() found.' >&4
8213 val="$define"
8214 $cat >vprintf.c <<'EOF'
8215#include <varargs.h>
8216
8217int main() { xxx("foo"); }
8218
8219xxx(va_alist)
8220va_dcl
8221{
8222 va_list args;
8223 char buf[10];
8224
8225 va_start(args);
8226 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8227}
8228EOF
8229 set vprintf
8230 if eval $compile && ./vprintf; then
8231 echo "Your vsprintf() returns (int)." >&4
8232 val2="$undef"
8233 else
8234 echo "Your vsprintf() returns (char*)." >&4
8235 val2="$define"
8236 fi
8237else
8238 echo 'vprintf() NOT found.' >&4
8239 val="$undef"
8240 val2="$undef"
8241fi
8242set d_vprintf
8243eval $setvar
8244val=$val2
8245set d_charvspr
8246eval $setvar
8247
8248: see if chown exists
8249set chown d_chown
8250eval $inlibc
8251
8252: see if chroot exists
8253set chroot d_chroot
8254eval $inlibc
8255
8256: see if chsize exists
8257set chsize d_chsize
8258eval $inlibc
8259
8260: check for const keyword
8261echo " "
8262echo 'Checking to see if your C compiler knows about "const"...' >&4
8263$cat >const.c <<'EOCP'
8264typedef struct spug { int drokk; } spug;
8265int main()
8266{
8267 const char *foo;
8268 const spug y;
8269}
8270EOCP
8271if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8272 val="$define"
8273 echo "Yup, it does."
8274else
8275 val="$undef"
8276 echo "Nope, it doesn't."
8277fi
8278set d_const
8279eval $setvar
8280
8281: see if crypt exists
8282echo " "
8283if set crypt val -f d_crypt; eval $csym; $val; then
8284 echo 'crypt() found.' >&4
8285 val="$define"
8286 cryptlib=''
8287else
8288 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8289 if $test -z "$cryptlib"; then
8290 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8291 else
8292 cryptlib=-lcrypt
8293 fi
8294 if $test -z "$cryptlib"; then
8295 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8296 else
8297 cryptlib=-lcrypt
8298 fi
8299 if $test -z "$cryptlib"; then
8300 cryptlib=`./loc libcrypt$_a "" $libpth`
8301 else
8302 cryptlib=-lcrypt
8303 fi
8304 if $test -z "$cryptlib"; then
8305 echo 'crypt() NOT found.' >&4
8306 val="$undef"
8307 else
8308 val="$define"
8309 fi
8310fi
8311set d_crypt
8312eval $setvar
8313
8314: get csh whereabouts
8315case "$csh" in
8316'csh') val="$undef" ;;
8317*) val="$define" ;;
8318esac
8319set d_csh
8320eval $setvar
8321: Respect a hint or command line value for full_csh.
8322case "$full_csh" in
8323'') full_csh=$csh ;;
8324esac
8325
8326: see if cuserid exists
8327set cuserid d_cuserid
8328eval $inlibc
8329
8330: see if this is a limits.h system
8331set limits.h i_limits
8332eval $inhdr
8333
8334: see if this is a float.h system
8335set float.h i_float
8336eval $inhdr
8337
8338: See if number of significant digits in a double precision number is known
8339echo " "
8340$cat >dbl_dig.c <<EOM
8341#$i_limits I_LIMITS
8342#$i_float I_FLOAT
8343#ifdef I_LIMITS
8344#include <limits.h>
8345#endif
8346#ifdef I_FLOAT
8347#include <float.h>
8348#endif
8349#ifdef DBL_DIG
8350printf("Contains DBL_DIG");
8351#endif
8352EOM
8353$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8354if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8355 echo "DBL_DIG found." >&4
8356 val="$define"
8357else
8358 echo "DBL_DIG NOT found." >&4
8359 val="$undef"
8360fi
8361$rm -f dbl_dig.?
8362set d_dbl_dig
8363eval $setvar
8364
8365: see if difftime exists
8366set difftime d_difftime
8367eval $inlibc
8368
8369: see if this is a dirent system
8370echo " "
8371if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8372 val="$define"
8373 echo "<dirent.h> found." >&4
8374else
8375 val="$undef"
8376 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8377 echo "<sys/dir.h> found." >&4
8378 echo " "
8379 else
8380 xinc=`./findhdr sys/ndir.h`
8381 fi
8382 echo "<dirent.h> NOT found." >&4
8383fi
8384set i_dirent
8385eval $setvar
8386
8387: Look for type of directory structure.
8388echo " "
8389$cppstdin $cppflags $cppminus < "$xinc" > try.c
8390
8391case "$direntrytype" in
8392''|' ')
8393 case "$i_dirent" in
8394 $define) guess1='struct dirent' ;;
8395 *) guess1='struct direct' ;;
8396 esac
8397 ;;
8398*) guess1="$direntrytype"
8399 ;;
8400esac
8401
8402case "$guess1" in
8403'struct dirent') guess2='struct direct' ;;
8404*) guess2='struct dirent' ;;
8405esac
8406
8407if $contains "$guess1" try.c >/dev/null 2>&1; then
8408 direntrytype="$guess1"
8409 echo "Your directory entries are $direntrytype." >&4
8410elif $contains "$guess2" try.c >/dev/null 2>&1; then
8411 direntrytype="$guess2"
8412 echo "Your directory entries seem to be $direntrytype." >&4
8413else
8414 echo "I don't recognize your system's directory entries." >&4
8415 rp="What type is used for directory entries on this system?"
8416 dflt="$guess1"
8417 . ./myread
8418 direntrytype="$ans"
8419fi
8420$rm -f try.c
8421
8422
8423: see if the directory entry stores field length
8424echo " "
8425$cppstdin $cppflags $cppminus < "$xinc" > try.c
8426if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8427 echo "Good, your directory entry keeps length information in d_namlen." >&4
8428 val="$define"
8429else
8430 echo "Your directory entry does not know about the d_namlen field." >&4
8431 val="$undef"
8432fi
8433set d_dirnamlen
8434eval $setvar
8435$rm -f try.c
8436
8437: see if dlerror exists
8438xxx_runnm="$runnm"
8439runnm=false
8440set dlerror d_dlerror
8441eval $inlibc
8442runnm="$xxx_runnm"
8443
8444: see if dlfcn is available
8445set dlfcn.h i_dlfcn
8446eval $inhdr
8447
8448case "$usedl" in
8449$define|y|true)
8450 $cat << EOM
8451
8452On a few systems, the dynamically loaded modules that perl generates and uses
8453will need a different extension than shared libs. The default will probably
8454be appropriate.
8455
8456EOM
8457 case "$dlext" in
8458 '') dflt="$so" ;;
8459 *) dflt="$dlext" ;;
8460 esac
8461 rp='What is the extension of dynamically loaded modules'
8462 . ./myread
8463 dlext="$ans"
8464 ;;
8465*)
8466 dlext="none"
8467 ;;
8468esac
8469
8470: Check if dlsym need a leading underscore
8471echo " "
8472val="$undef"
8473
8474case "$dlsrc" in
8475dl_dlopen.xs)
8476 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8477 $cat >dyna.c <<'EOM'
8478fred () { }
8479EOM
8480
8481$cat >fred.c<<EOM
8482
8483#include <stdio.h>
8484#$i_dlfcn I_DLFCN
8485#ifdef I_DLFCN
8486#include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
8487#else
8488#include <sys/types.h>
8489#include <nlist.h>
8490#include <link.h>
8491#endif
8492
8493extern int fred() ;
8494
8495int main()
8496{
8497 void * handle ;
8498 void * symbol ;
8499#ifndef RTLD_LAZY
8500 int mode = 1 ;
8501#else
8502 int mode = RTLD_LAZY ;
8503#endif
8504 handle = dlopen("./dyna.$dlext", mode) ;
8505 if (handle == NULL) {
8506 printf ("1\n") ;
8507 fflush (stdout) ;
8508 exit(0);
8509 }
8510 symbol = dlsym(handle, "fred") ;
8511 if (symbol == NULL) {
8512 /* try putting a leading underscore */
8513 symbol = dlsym(handle, "_fred") ;
8514 if (symbol == NULL) {
8515 printf ("2\n") ;
8516 fflush (stdout) ;
8517 exit(0);
8518 }
8519 printf ("3\n") ;
8520 }
8521 else
8522 printf ("4\n") ;
8523 fflush (stdout) ;
8524 exit(0);
8525}
8526EOM
8527 : Call the object file tmp-dyna.o in case dlext=o.
8528 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
8529 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
7a282f6d
JH
8530 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
8531 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
b4eb6b3d
JH
8532 xxx=`./fred`
8533 case $xxx in
8534 1) echo "Test program failed using dlopen." >&4
8535 echo "Perhaps you should not use dynamic loading." >&4;;
8536 2) echo "Test program failed using dlsym." >&4
8537 echo "Perhaps you should not use dynamic loading." >&4;;
8538 3) echo "dlsym needs a leading underscore" >&4
8539 val="$define" ;;
8540 4) echo "dlsym doesn't need a leading underscore." >&4;;
8541 esac
8542 else
8543 echo "I can't compile and run the test program." >&4
8544 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8545 fi
8546 ;;
8547esac
8548
8549$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8550
8551set d_dlsymun
8552eval $setvar
8553
8554hasproto='varname=$1; func=$2; shift; shift;
8555while $test $# -ge 2; do
8556 case "$1" in
8557 $define) echo "#include <$2>";;
8558 esac ;
8559 shift 2;
8560done > try.c;
8561$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8562if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8563 echo "$func() prototype found.";
8564 val="$define";
8565else
8566 echo "$func() prototype NOT found.";
8567 val="$undef";
8568fi;
8569set $varname;
8570eval $setvar;
8571$rm -f try.c tryout.c'
8572
8573: see if prototype for drand48 is available
8574echo " "
8575set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8576eval $hasproto
8577
8578: see if dup2 exists
8579set dup2 d_dup2
8580eval $inlibc
8581
8582: see if eaccess exists
8583set eaccess d_eaccess
8584eval $inlibc
8585
8586: see if endgrent exists
8587set endgrent d_endgrent
8588eval $inlibc
8589
8590: see if endhostent exists
8591set endhostent d_endhent
8592eval $inlibc
8593
8594: see if endnetent exists
8595set endnetent d_endnent
8596eval $inlibc
8597
8598: see if endprotoent exists
8599set endprotoent d_endpent
8600eval $inlibc
8601
8602: see if endpwent exists
8603set endpwent d_endpwent
8604eval $inlibc
8605
8606: see if endservent exists
8607set endservent d_endsent
8608eval $inlibc
8609
8610: Locate the flags for 'open()'
8611echo " "
8612$cat >open3.c <<'EOCP'
8613#include <sys/types.h>
8614#ifdef I_FCNTL
8615#include <fcntl.h>
8616#endif
8617#ifdef I_SYS_FILE
8618#include <sys/file.h>
8619#endif
8620int main() {
8621 if(O_RDONLY);
8622#ifdef O_TRUNC
8623 exit(0);
8624#else
8625 exit(1);
8626#endif
8627}
8628EOCP
8629: check sys/file.h first to get FREAD on Sun
8630if $test `./findhdr sys/file.h` && \
8631 set open3 -DI_SYS_FILE && eval $compile; then
8632 h_sysfile=true;
8633 echo "<sys/file.h> defines the O_* constants..." >&4
8634 if ./open3; then
8635 echo "and you have the 3 argument form of open()." >&4
8636 val="$define"
8637 else
8638 echo "but not the 3 argument form of open(). Oh, well." >&4
8639 val="$undef"
8640 fi
8641elif $test `./findhdr fcntl.h` && \
8642 set open3 -DI_FCNTL && eval $compile; then
8643 h_fcntl=true;
8644 echo "<fcntl.h> defines the O_* constants..." >&4
8645 if ./open3; then
8646 echo "and you have the 3 argument form of open()." >&4
8647 val="$define"
8648 else
8649 echo "but not the 3 argument form of open(). Oh, well." >&4
8650 val="$undef"
8651 fi
8652else
8653 val="$undef"
8654 echo "I can't find the O_* constant definitions! You got problems." >&4
8655fi
8656set d_open3
8657eval $setvar
8658$rm -f open3*
8659
8660: see which of string.h or strings.h is needed
8661echo " "
8662strings=`./findhdr string.h`
8663if $test "$strings" && $test -r "$strings"; then
8664 echo "Using <string.h> instead of <strings.h>." >&4
8665 val="$define"
8666else
8667 val="$undef"
8668 strings=`./findhdr strings.h`
8669 if $test "$strings" && $test -r "$strings"; then
8670 echo "Using <strings.h> instead of <string.h>." >&4
8671 else
8672 echo "No string header found -- You'll surely have problems." >&4
8673 fi
8674fi
8675set i_string
8676eval $setvar
8677case "$i_string" in
8678"$undef") strings=`./findhdr strings.h`;;
8679*) strings=`./findhdr string.h`;;
8680esac
8681
8682: check for non-blocking I/O stuff
8683case "$h_sysfile" in
8684true) echo "#include <sys/file.h>" > head.c;;
8685*)
8686 case "$h_fcntl" in
8687 true) echo "#include <fcntl.h>" > head.c;;
8688 *) echo "#include <sys/fcntl.h>" > head.c;;
8689 esac
8690 ;;
8691esac
8692echo " "
8693echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8694case "$o_nonblock" in
8695'')
8696 $cat head.c > try.c
8697 $cat >>try.c <<'EOCP'
8698#include <stdio.h>
8699int main() {
8700#ifdef O_NONBLOCK
8701 printf("O_NONBLOCK\n");
8702 exit(0);
8703#endif
8704#ifdef O_NDELAY
8705 printf("O_NDELAY\n");
8706 exit(0);
8707#endif
8708#ifdef FNDELAY
8709 printf("FNDELAY\n");
8710 exit(0);
8711#endif
8712 exit(0);
8713}
8714EOCP
8715 set try
8716 if eval $compile_ok; then
8717 o_nonblock=`./try`
8718 case "$o_nonblock" in
8719 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8720 *) echo "Seems like we can use $o_nonblock.";;
8721 esac
8722 else
8723 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8724 fi
8725 ;;
8726*) echo "Using $hint value $o_nonblock.";;
8727esac
8728$rm -f try try.* .out core
8729
8730echo " "
8731echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8732case "$eagain" in
8733'')
8734 $cat head.c > try.c
8735 $cat >>try.c <<EOCP
8736#include <errno.h>
8737#include <sys/types.h>
8738#include <signal.h>
8739#include <stdio.h>
8740#define MY_O_NONBLOCK $o_nonblock
8741#ifndef errno /* XXX need better Configure test */
8742extern int errno;
8743#endif
8744#$i_unistd I_UNISTD
8745#ifdef I_UNISTD
8746#include <unistd.h>
8747#endif
8748#$i_string I_STRING
8749#ifdef I_STRING
8750#include <string.h>
8751#else
8752#include <strings.h>
8753#endif
8754$signal_t blech(x) int x; { exit(3); }
8755EOCP
8756 $cat >> try.c <<'EOCP'
8757int main()
8758{
8759 int pd[2];
8760 int pu[2];
8761 char buf[1];
8762 char string[100];
8763
8764 pipe(pd); /* Down: child -> parent */
8765 pipe(pu); /* Up: parent -> child */
8766 if (0 != fork()) {
8767 int ret;
8768 close(pd[1]); /* Parent reads from pd[0] */
8769 close(pu[0]); /* Parent writes (blocking) to pu[1] */
8770 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8771 exit(1);
8772 signal(SIGALRM, blech);
8773 alarm(5);
8774 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
8775 exit(2);
8776 sprintf(string, "%d\n", ret);
8777 write(2, string, strlen(string));
8778 alarm(0);
8779#ifdef EAGAIN
8780 if (errno == EAGAIN) {
8781 printf("EAGAIN\n");
8782 goto ok;
8783 }
8784#endif
8785#ifdef EWOULDBLOCK
8786 if (errno == EWOULDBLOCK)
8787 printf("EWOULDBLOCK\n");
8788#endif
8789 ok:
8790 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
8791 sleep(2); /* Give it time to close our pipe */
8792 alarm(5);
8793 ret = read(pd[0], buf, 1); /* Should read EOF */
8794 alarm(0);
8795 sprintf(string, "%d\n", ret);
8796 write(3, string, strlen(string));
8797 exit(0);
8798 }
8799
8800 close(pd[0]); /* We write to pd[1] */
8801 close(pu[1]); /* We read from pu[0] */
8802 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
8803 close(pd[1]); /* Pipe pd is now fully closed! */
8804 exit(0); /* Bye bye, thank you for playing! */
8805}
8806EOCP
8807 set try
8808 if eval $compile_ok; then
8809 echo "$startsh" >mtry
8810 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8811 chmod +x mtry
8812 ./mtry >/dev/null 2>&1
8813 case $? in
8814 0) eagain=`$cat try.out`;;
8815 1) echo "Could not perform non-blocking setting!";;
8816 2) echo "I did a successful read() for something that was not there!";;
8817 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8818 *) echo "Something terribly wrong happened during testing.";;
8819 esac
8820 rd_nodata=`$cat try.ret`
8821 echo "A read() system call with no data present returns $rd_nodata."
8822 case "$rd_nodata" in
8823 0|-1) ;;
8824 *)
8825 echo "(That's peculiar, fixing that to be -1.)"
8826 rd_nodata=-1
8827 ;;
8828 esac
8829 case "$eagain" in
8830 '')
8831 echo "Forcing errno EAGAIN on read() with no data available."
8832 eagain=EAGAIN
8833 ;;
8834 *)
8835 echo "Your read() sets errno to $eagain when no data is available."
8836 ;;
8837 esac
8838 status=`$cat try.err`
8839 case "$status" in
8840 0) echo "And it correctly returns 0 to signal EOF.";;
8841 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8842 *) echo "However, your read() returns '$status' on EOF??";;
8843 esac
8844 val="$define"
8845 if test "$status" = "$rd_nodata"; then
8846 echo "WARNING: you can't distinguish between EOF and no data!"
8847 val="$undef"
8848 fi
8849 else
8850 echo "I can't compile the test program--assuming errno EAGAIN will do."
8851 eagain=EAGAIN
8852 fi
8853 set d_eofnblk
8854 eval $setvar
8855 ;;
8856*)
8857 echo "Using $hint value $eagain."
8858 echo "Your read() returns $rd_nodata when no data is present."
8859 case "$d_eofnblk" in
8860 "$define") echo "And you can see EOF because read() returns 0.";;
8861 "$undef") echo "But you can't see EOF status from read() returned value.";;
8862 *)
8863 echo "(Assuming you can't see EOF status from read anyway.)"
8864 d_eofnblk=$undef
8865 ;;
8866 esac
8867 ;;
8868esac
8869$rm -f try try.* .out core head.c mtry
8870
8871: see if fchmod exists
8872set fchmod d_fchmod
8873eval $inlibc
8874
8875: see if fchown exists
8876set fchown d_fchown
8877eval $inlibc
8878
8879: see if this is an fcntl system
8880set fcntl d_fcntl
8881eval $inlibc
8882
9d9004a9
AD
8883echo " "
8884: See if fcntl-based locking works.
8885$cat >try.c <<'EOCP'
8886#include <stdlib.h>
8887#include <unistd.h>
8888#include <fcntl.h>
8889int main() {
8890#if defined(F_SETLK) && defined(F_SETLKW)
8891 struct flock flock;
8892 int retval, fd;
8893 fd = open("try.c", O_RDONLY);
8894 flock.l_type = F_RDLCK;
8895 flock.l_whence = SEEK_SET;
8896 flock.l_start = flock.l_len = 0;
8897 retval = fcntl(fd, F_SETLK, &flock);
8898 close(fd);
8899 (retval < 0 ? exit(2) : exit(0));
8900#else
8901 exit(2);
8902#endif
8903}
8904EOCP
8905echo "Checking if fcntl-based file locking works... "
8906case "$d_fcntl" in
8907"$define")
8908 set try
8909 if eval $compile_ok; then
8910 if ./try; then
8911 echo "Yes, it seems to work."
8912 val="$define"
8913 else
8914 echo "Nope, it didn't work."
8915 val="$undef"
8916 fi
8917 else
8918 echo "I'm unable to compile the test program, so I'll assume not."
8919 val="$undef"
8920 fi
8921 ;;
8922*) val="$undef";
8923 echo "Nope, since you don't even have fcntl()."
8924 ;;
8925esac
8926set d_fcntl_can_lock
8927eval $setvar
8928$rm -f try*
8929
8930
b4eb6b3d
JH
8931hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8932while $test $# -ge 2; do
8933 case "$1" in
8934 $define) echo "#include <$2>";;
8935 esac ;
8936 shift 2;
8937done > try.c;
8938echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8939set try;
8940if eval $compile; then
8941 val="$define";
8942else
8943 val="$undef";
8944fi;
8945set $varname;
8946eval $setvar;
8947$rm -f try.c try.o'
8948
8949socketlib=''
8950sockethdr=''
8951: see whether socket exists
8952echo " "
8953$echo $n "Hmm... $c" >&4
8954if set socket val -f d_socket; eval $csym; $val; then
8955 echo "Looks like you have Berkeley networking support." >&4
8956 d_socket="$define"
8957 if set setsockopt val -f; eval $csym; $val; then
8958 d_oldsock="$undef"
8959 else
8960 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8961 d_oldsock="$define"
8962 fi
8963else
8964 if $contains socklib libc.list >/dev/null 2>&1; then
8965 echo "Looks like you have Berkeley networking support." >&4
8966 d_socket="$define"
8967 : we will have to assume that it supports the 4.2 BSD interface
8968 d_oldsock="$undef"
8969 else
8970 echo "You don't have Berkeley networking in libc$_a..." >&4
8971 if test "X$d_socket" = "X$define"; then
8972 echo "...but you seem to believe that you have sockets." >&4
8973 else
8974 for net in net socket
8975 do
8976 if test -f /usr/lib/lib$net$_a; then
8977 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
8978 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8979 if $contains socket libc.list >/dev/null 2>&1; then
8980 d_socket="$define"
8981 socketlib="-l$net"
8982 case "$net" in
8983 net)
8984 echo "...but the Wollongong group seems to have hacked it in." >&4
8985 sockethdr="-I/usr/netinclude"
8986 ;;
8987 esac
8988 echo "Found Berkeley sockets interface in lib$net." >& 4
8989 if $contains setsockopt libc.list >/dev/null 2>&1; then
8990 d_oldsock="$undef"
8991 else
8992 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8993 d_oldsock="$define"
8994 fi
8995 break
8996 fi
8997 fi
8998 done
8999 if test "X$d_socket" != "X$define"; then
9000 echo "or anywhere else I see." >&4
9001 d_socket="$undef"
9002 d_oldsock="$undef"
9003 fi
9004 fi
9005 fi
9006fi
9007
9008: see if socketpair exists
9009set socketpair d_sockpair
9010eval $inlibc
9011
9012
9013echo " "
9014echo "Checking the availability of certain socket constants..." >& 4
9015for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9016 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9017 $cat >try.c <<EOF
9018#include <sys/types.h>
9019#include <sys/socket.h>
9020int main() {
9021 int i = $ENUM;
9022}
9023EOF
9024 val="$undef"
9025 set try; if eval $compile; then
9026 val="$define"
9027 fi
9028 set d_${enum}; eval $setvar
9029 $rm -f try.c try
9030done
9031
9032: see if sys/select.h has to be included
9033set sys/select.h i_sysselct
9034eval $inhdr
9035
9036: see if we should include time.h, sys/time.h, or both
9037echo " "
9038if test "X$timeincl" = X; then
9039 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9040 $echo $n "I'm now running the test program...$c"
9041 $cat >try.c <<'EOCP'
9042#include <sys/types.h>
9043#ifdef I_TIME
9044#include <time.h>
9045#endif
9046#ifdef I_SYSTIME
9047#ifdef SYSTIMEKERNEL
9048#define KERNEL
9049#endif
9050#include <sys/time.h>
9051#endif
9052#ifdef I_SYSSELECT
9053#include <sys/select.h>
9054#endif
9055int main()
9056{
9057 struct tm foo;
9058#ifdef S_TIMEVAL
9059 struct timeval bar;
9060#endif
9061#ifdef S_TIMEZONE
9062 struct timezone tzp;
9063#endif
9064 if (foo.tm_sec == foo.tm_sec)
9065 exit(0);
9066#ifdef S_TIMEVAL
9067 if (bar.tv_sec == bar.tv_sec)
9068 exit(0);
9069#endif
9070 exit(1);
9071}
9072EOCP
9073 flags=''
9074 for s_timezone in '-DS_TIMEZONE' ''; do
9075 sysselect=''
9076 for s_timeval in '-DS_TIMEVAL' ''; do
9077 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9078 for i_time in '' '-DI_TIME'; do
9079 for i_systime in '-DI_SYSTIME' ''; do
9080 case "$flags" in
9081 '') $echo $n ".$c"
9082 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9083 if eval $compile; then
9084 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9085 shift
9086 flags="$*"
9087 echo " "
9088 $echo $n "Succeeded with $flags$c"
9089 fi
9090 ;;
9091 esac
9092 done
9093 done
9094 done
9095 done
9096 done
9097 timeincl=''
9098 echo " "
9099 case "$flags" in
9100 *SYSTIMEKERNEL*) i_systimek="$define"
9101 timeincl=`./findhdr sys/time.h`
9102 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9103 *) i_systimek="$undef";;
9104 esac
9105 case "$flags" in
9106 *I_TIME*) i_time="$define"
9107 timeincl=`./findhdr time.h`" $timeincl"
9108 echo "We'll include <time.h>." >&4;;
9109 *) i_time="$undef";;
9110 esac
9111 case "$flags" in
9112 *I_SYSTIME*) i_systime="$define"
9113 timeincl=`./findhdr sys/time.h`" $timeincl"
9114 echo "We'll include <sys/time.h>." >&4;;
9115 *) i_systime="$undef";;
9116 esac
9117 $rm -f try.c try
9118fi
9119
9120: check for fd_set items
9121$cat <<EOM
9122
9123Checking to see how well your C compiler handles fd_set and friends ...
9124EOM
9125$cat >fd_set.c <<EOCP
9126#$i_systime I_SYS_TIME
9127#$i_sysselct I_SYS_SELECT
9128#$d_socket HAS_SOCKET
9129#include <sys/types.h>
9130#ifdef HAS_SOCKET
9131#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9132#endif
9133#ifdef I_SYS_TIME
9134#include <sys/time.h>
9135#endif
9136#ifdef I_SYS_SELECT
9137#include <sys/select.h>
9138#endif
9139int main() {
9140 fd_set fds;
9141
9142#ifdef TRYBITS
9143 if(fds.fds_bits);
9144#endif
9145
9146#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9147 exit(0);
9148#else
9149 exit(1);
9150#endif
9151}
9152EOCP
9153set fd_set -DTRYBITS
9154if eval $compile; then
9155 d_fds_bits="$define"
9156 d_fd_set="$define"
9157 echo "Well, your system knows about the normal fd_set typedef..." >&4
9158 if ./fd_set; then
9159 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9160 d_fd_macros="$define"
9161 else
9162 $cat >&4 <<'EOM'
9163but not the normal fd_set macros! Gaaack! I'll have to cover for you.
9164EOM
9165 d_fd_macros="$undef"
9166 fi
9167else
9168 $cat <<'EOM'
9169Hmm, your compiler has some difficulty with fd_set. Checking further...
9170EOM
9171 set fd_set
9172 if eval $compile; then
9173 d_fds_bits="$undef"
9174 d_fd_set="$define"
9175 echo "Well, your system has some sort of fd_set available..." >&4
9176 if ./fd_set; then
9177 echo "and you have the normal fd_set macros." >&4
9178 d_fd_macros="$define"
9179 else
9180 $cat <<'EOM'
9181but not the normal fd_set macros! Gross! More work for me...
9182EOM
9183 d_fd_macros="$undef"
9184 fi
9185 else
9186 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
9187 d_fd_set="$undef"
9188 d_fds_bits="$undef"
9189 d_fd_macros="$undef"
9190 fi
9191fi
9192$rm -f fd_set*
9193
9194: see if fgetpos exists
9195set fgetpos d_fgetpos
9196eval $inlibc
9197
9198: see if flock exists
9199set flock d_flock
9200eval $inlibc
9201
9202: see if fork exists
9203set fork d_fork
9204eval $inlibc
9205
9206: see if pathconf exists
9207set pathconf d_pathconf
9208eval $inlibc
9209
9210: see if fpathconf exists
9211set fpathconf d_fpathconf
9212eval $inlibc
9213
9214
9215: check for fpos64_t
9216echo " "
9217echo "Checking to see if you have fpos64_t..." >&4
9218$cat >try.c <<EOCP
9219#include <stdio.h>
9220int main() { fpos64_t x = 7; }
9221EOCP
9222set try
9223if eval $compile; then
9224 val="$define"
9225 echo "You have fpos64_t."
9226else
9227 val="$undef"
9228 echo "You do not have fpos64_t."
9229 case "$fpossize" in
9230 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9231 esac
9232fi
9233$rm -f try.* try
9234set d_fpos64_t
9235eval $setvar
9236
9237: see if frexpl exists
9238set frexpl d_frexpl
9239eval $inlibc
9240
9241hasstruct='varname=$1; struct=$2; shift; shift;
9242while $test $# -ge 2; do
9243 case "$1" in
9244 $define) echo "#include <$2>";;
9245 esac ;
9246 shift 2;
9247done > try.c;
9248echo "int main () { struct $struct foo; }" >> try.c;
9249set try;
9250if eval $compile; then
9251 val="$define";
9252else
9253 val="$undef";
9254fi;
9255set $varname;
9256eval $setvar;
9257$rm -f try.c try.o'
9258
9259: see if this is a sys/param system
9260set sys/param.h i_sysparam
9261eval $inhdr
9262
9263: see if this is a sys/mount.h system
9264set sys/mount.h i_sysmount
9265eval $inhdr
9266
9267: see if sys/types.h has to be included
9268set sys/types.h i_systypes
9269eval $inhdr
9270
9271
9272echo " "
9273echo "Checking to see if your system supports struct fs_data..." >&4
9274set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9275eval $hasstruct
9276case "$d_fs_data_s" in
9277"$define") echo "Yes, it does." ;;
9278*) echo "No, it doesn't." ;;
9279esac
9280
9281: see if fseeko exists
9282set fseeko d_fseeko
9283eval $inlibc
9284case "$longsize" in
92858) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9286esac
9287
9288: see if fsetpos exists
9289set fsetpos d_fsetpos
9290eval $inlibc
9291
9292
9293: see if fstatfs exists
9294set fstatfs d_fstatfs
9295eval $inlibc
9296
9297
9298: see if statvfs exists
9299set statvfs d_statvfs
9300eval $inlibc
9301
9302: see if fstatvfs exists
9303set fstatvfs d_fstatvfs
9304eval $inlibc
9305
9306
411ab01c
JH
9307: see if fsync exists
9308set fsync d_fsync
9309eval $inlibc
9310
b4eb6b3d
JH
9311: see if ftello exists
9312set ftello d_ftello
9313eval $inlibc
9314case "$longsize" in
93158) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9316esac
9317
9318: see if getcwd exists
9319set getcwd d_getcwd
9320eval $inlibc
9321
9322: see if getespwnam exists
9323set getespwnam d_getespwnam
9324eval $inlibc
9325
9326
9327: see if getfsstat exists
9328set getfsstat d_getfsstat
9329eval $inlibc
9330
9331: see if getgrent exists
9332set getgrent d_getgrent
9333eval $inlibc
9334
9335: see if gethostbyaddr exists
9336set gethostbyaddr d_gethbyaddr
9337eval $inlibc
9338
9339: see if gethostbyname exists
9340set gethostbyname d_gethbyname
9341eval $inlibc
9342
9343: see if gethostent exists
9344set gethostent d_gethent
9345eval $inlibc
9346
9347: see how we will look up host name
9348echo " "
9349call=''
9350if set gethostname val -f d_gethname; eval $csym; $val; then
9351 echo 'gethostname() found.' >&4
9352 d_gethname="$define"
9353 call=gethostname
9354fi
9355if set uname val -f d_uname; eval $csym; $val; then
9356 if ./xenix; then
9357 $cat <<'EOM'
9358uname() was found, but you're running xenix, and older versions of xenix
9359have a broken uname(). If you don't really know whether your xenix is old
9360enough to have a broken system call, use the default answer.
9361
9362EOM
9363 dflt=y
9364 case "$d_uname" in
9365 "$define") dflt=n;;
9366 esac
9367 rp='Is your uname() broken?'
9368 . ./myread
9369 case "$ans" in
9370 n*) d_uname="$define"; call=uname;;
9371 esac
9372 else
9373 echo 'uname() found.' >&4
9374 d_uname="$define"
9375 case "$call" in
9376 '') call=uname ;;
9377 esac
9378 fi
9379fi
9380case "$d_gethname" in
9381'') d_gethname="$undef";;
9382esac
9383case "$d_uname" in
9384'') d_uname="$undef";;
9385esac
9386case "$d_uname$d_gethname" in
9387*define*)
9388 dflt=n
9389 cat <<EOM
9390
9391Every now and then someone has a $call() that lies about the hostname
9392but can't be fixed for political or economic reasons. If you wish, I can
9393pretend $call() isn't there and maybe compute hostname at run-time
9394thanks to the '$phostname' command.
9395
9396EOM
9397 rp="Shall I ignore $call() from now on?"
9398 . ./myread
9399 case "$ans" in
9400 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9401 esac;;
9402esac
9403case "$phostname" in
9404'') aphostname='';;
9405*) case "$aphostname" in
9406 /*) ;;
9407 *) set X $phostname
9408 shift
9409 file=$1
9410 shift
9411 file=`./loc $file $file $pth`
9412 aphostname=`echo $file $*`
9413 ;;
9414 esac
9415 ;;
9416esac
9417case "$d_uname$d_gethname" in
9418*define*) ;;
9419*)
9420 case "$phostname" in
9421 '')
9422 echo "There will be no way for $package to get your hostname." >&4;;
9423 *)
9424 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9425 ;;
9426 esac;;
9427esac
9428case "$d_phostname" in
9429'') d_phostname="$undef";;
9430esac
9431
9432: see if this is a netdb.h system
9433set netdb.h i_netdb
9434eval $inhdr
9435
9436: see if prototypes for various gethostxxx netdb.h functions are available
9437echo " "
9438set d_gethostprotos gethostent $i_netdb netdb.h
9439eval $hasproto
9440
9441: see if getlogin exists
9442set getlogin d_getlogin
9443eval $inlibc
9444
9445: see if getmnt exists
9446set getmnt d_getmnt
9447eval $inlibc
9448
9449: see if getmntent exists
9450set getmntent d_getmntent
9451eval $inlibc
9452
9453: see if getnetbyaddr exists
9454set getnetbyaddr d_getnbyaddr
9455eval $inlibc
9456
9457: see if getnetbyname exists
9458set getnetbyname d_getnbyname
9459eval $inlibc
9460
9461: see if getnetent exists
9462set getnetent d_getnent
9463eval $inlibc
9464
9465: see if prototypes for various getnetxxx netdb.h functions are available
9466echo " "
9467set d_getnetprotos getnetent $i_netdb netdb.h
9468eval $hasproto
9469
0c0643d0
JH
9470: see if getpagesize exists
9471set getpagesize d_getpagsz
9472eval $inlibc
9473
b4eb6b3d
JH
9474
9475: see if getprotobyname exists
9476set getprotobyname d_getpbyname
9477eval $inlibc
9478
9479: see if getprotobynumber exists
9480set getprotobynumber d_getpbynumber
9481eval $inlibc
9482
9483: see if getprotoent exists
9484set getprotoent d_getpent
9485eval $inlibc
9486
9487: see if getpgid exists
9488set getpgid d_getpgid
9489eval $inlibc
9490
9491: see if getpgrp2 exists
9492set getpgrp2 d_getpgrp2
9493eval $inlibc
9494
9495: see if getppid exists
9496set getppid d_getppid
9497eval $inlibc
9498
9499: see if getpriority exists
9500set getpriority d_getprior
9501eval $inlibc
9502
9503: see if prototypes for various getprotoxxx netdb.h functions are available
9504echo " "
9505set d_getprotoprotos getprotoent $i_netdb netdb.h
9506eval $hasproto
9507
9508: see if getprpwnam exists
9509set getprpwnam d_getprpwnam
9510eval $inlibc
9511
9512: see if getpwent exists
9513set getpwent d_getpwent
9514eval $inlibc
9515
9516
9517: see if getservbyname exists
9518set getservbyname d_getsbyname
9519eval $inlibc
9520
9521: see if getservbyport exists
9522set getservbyport d_getsbyport
9523eval $inlibc
9524
9525: see if getservent exists
9526set getservent d_getsent
9527eval $inlibc
9528
9529: see if prototypes for various getservxxx netdb.h functions are available
9530echo " "
9531set d_getservprotos getservent $i_netdb netdb.h
9532eval $hasproto
9533
9534: see if getspnam exists
9535set getspnam d_getspnam
9536eval $inlibc
9537
9538: see if gettimeofday or ftime exists
9539set gettimeofday d_gettimeod
9540eval $inlibc
9541case "$d_gettimeod" in
9542"$undef")
9543 set ftime d_ftime
9544 eval $inlibc
9545 ;;
9546*)
9547 val="$undef"; set d_ftime; eval $setvar
9548 ;;
9549esac
9550case "$d_gettimeod$d_ftime" in
9551"$undef$undef")
9552 echo " "
9553 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9554 ;;
9555esac
9556
9557: see if this is an grp system
9558set grp.h i_grp
9559eval $inhdr
9560
9561case "$i_grp" in
9562$define)
9563 xxx=`./findhdr grp.h`
9564 $cppstdin $cppflags $cppminus < $xxx >$$.h
9565
9566 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9567 val="$define"
9568 else
9569 val="$undef"
9570 fi
9571 set d_grpasswd
9572 eval $setvar
9573
9574 $rm -f $$.h
9575 ;;
9576*)
9577 val="$undef";
9578 set d_grpasswd; eval $setvar
9579 ;;
9580esac
9581
9582: see if hasmntopt exists
9583set hasmntopt d_hasmntopt
9584eval $inlibc
9585
9586: see if this is a netinet/in.h or sys/in.h system
9587set netinet/in.h i_niin sys/in.h i_sysin
9588eval $inhdr
9589
9590: see if arpa/inet.h has to be included
9591set arpa/inet.h i_arpainet
9592eval $inhdr
9593
9594: see if htonl --and friends-- exists
9595val=''
9596set htonl val
9597eval $inlibc
9598
9599: Maybe they are macros.
9600case "$val" in
9601$undef)
9602 $cat >htonl.c <<EOM
9603#include <stdio.h>
9604#include <sys/types.h>
9605#$i_niin I_NETINET_IN
9606#$i_sysin I_SYS_IN
9607#$i_arpainet I_ARPA_INET
9608#ifdef I_NETINET_IN
9609#include <netinet/in.h>
9610#endif
9611#ifdef I_SYS_IN
9612#include <sys/in.h>
9613#endif
9614#ifdef I_ARPA_INET
9615#include <arpa/inet.h>
9616#endif
9617#ifdef htonl
9618printf("Defined as a macro.");
9619#endif
9620EOM
9621 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9622 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9623 val="$define"
9624 echo "But it seems to be defined as a macro." >&4
9625 fi
9626 $rm -f htonl.?
9627 ;;
9628esac
9629set d_htonl
9630eval $setvar
9631
9632: see if iconv exists
9633set iconv d_iconv
9634eval $inlibc
9635
9636: index or strchr
9637echo " "
9638if set index val -f; eval $csym; $val; then
9639 if set strchr val -f d_strchr; eval $csym; $val; then
9640 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9641 val="$define"
9642 vali="$undef"
9643 echo "strchr() found." >&4
9644 else
9645 val="$undef"
9646 vali="$define"
9647 echo "index() found." >&4
9648 fi
9649 else
9650 val="$undef"
9651 vali="$define"
9652 echo "index() found." >&4
9653 fi
9654else
9655 if set strchr val -f d_strchr; eval $csym; $val; then
9656 val="$define"
9657 vali="$undef"
9658 echo "strchr() found." >&4
9659 else
9660 echo "No index() or strchr() found!" >&4
9661 val="$undef"
9662 vali="$undef"
9663 fi
9664fi
9665set d_strchr; eval $setvar
9666val="$vali"
9667set d_index; eval $setvar
9668
9669: check whether inet_aton exists
9670set inet_aton d_inetaton
9671eval $inlibc
9672
9673: see if inttypes.h is available
9674: we want a real compile instead of Inhdr because some systems
9675: have an inttypes.h which includes non-existent headers
9676echo " "
9677$cat >try.c <<EOCP
9678#include <inttypes.h>
9679int main() {
9680 static int32_t foo32 = 0x12345678;
9681}
9682EOCP
9683set try
9684if eval $compile; then
9685 echo "<inttypes.h> found." >&4
9686 val="$define"
9687else
9688 echo "<inttypes.h> NOT found." >&4
9689 val="$undef"
9690fi
9691$rm -f try.c try
9692set i_inttypes
9693eval $setvar
9694
9695: check for int64_t
9696echo " "
9697echo "Checking to see if you have int64_t..." >&4
9698$cat >try.c <<EOCP
9699#include <sys/types.h>
9700#$i_inttypes I_INTTYPES
9701#ifdef I_INTTYPES
9702#include <inttypes.h>
9703#endif
9704int main() { int64_t x = 7; }
9705EOCP
9706set try
9707if eval $compile; then
9708 val="$define"
9709 echo "You have int64_t."
9710else
9711 val="$undef"
9712 echo "You do not have int64_t."
9713fi
9714$rm -f try try.*
9715set d_int64_t
9716eval $setvar
9717
9718: Look for isascii
9719echo " "
9720$cat >isascii.c <<'EOCP'
9721#include <stdio.h>
9722#include <ctype.h>
9723int main() {
9724 int c = 'A';
9725 if (isascii(c))
9726 exit(0);
9727 else
9728 exit(1);
9729}
9730EOCP
9731set isascii
9732if eval $compile; then
9733 echo "isascii() found." >&4
9734 val="$define"
9735else
9736 echo "isascii() NOT found." >&4
9737 val="$undef"
9738fi
9739set d_isascii
9740eval $setvar
9741$rm -f isascii*
9742
9743: see if isnan exists
9744set isnan d_isnan
9745eval $inlibc
9746
9747: see if isnanl exists
9748set isnanl d_isnanl
9749eval $inlibc
9750
9751: see if killpg exists
9752set killpg d_killpg
9753eval $inlibc
9754
9755: see if lchown exists
9756echo " "
9757$cat > try.c <<'EOCP'
9758/* System header to define __stub macros and hopefully few prototypes,
9759 which can conflict with char lchown(); below. */
9760#include <assert.h>
9761/* Override any gcc2 internal prototype to avoid an error. */
9762/* We use char because int might match the return type of a gcc2
9763 builtin and then its argument prototype would still apply. */
9764char lchown();
9765int main() {
9766 /* The GNU C library defines this for functions which it implements
9767 to always fail with ENOSYS. Some functions are actually named
9768 something starting with __ and the normal name is an alias. */
9769#if defined (__stub_lchown) || defined (__stub___lchown)
9770choke me
9771#else
9772lchown();
9773#endif
9774; return 0; }
9775EOCP
9776set try
9777if eval $compile; then
9778 $echo "lchown() found." >&4
9779 val="$define"
9780else
9781 $echo "lchown() NOT found." >&4
9782 val="$undef"
9783fi
9784set d_lchown
9785eval $setvar
9786
9787: See if number of significant digits in a double precision number is known
9788echo " "
9789$cat >ldbl_dig.c <<EOM
9790#$i_limits I_LIMITS
9791#$i_float I_FLOAT
9792#ifdef I_LIMITS
9793#include <limits.h>
9794#endif
9795#ifdef I_FLOAT
9796#include <float.h>
9797#endif
9798#ifdef LDBL_DIG
9799printf("Contains LDBL_DIG");
9800#endif
9801EOM
9802$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9803if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9804 echo "LDBL_DIG found." >&4
9805 val="$define"
9806else
9807 echo "LDBL_DIG NOT found." >&4
9808 val="$undef"
9809fi
9810$rm -f ldbl_dig.?
9811set d_ldbl_dig
9812eval $setvar
9813
9814: see if link exists
9815set link d_link
9816eval $inlibc
9817
9818: see if localeconv exists
9819set localeconv d_locconv
9820eval $inlibc
9821
9822: see if lockf exists
9823set lockf d_lockf
9824eval $inlibc
9825
9826: check for long long
9827echo " "
9828echo "Checking to see if you have long long..." >&4
9829echo 'int main() { long long x = 7; return 0; }' > try.c
9830set try
9831if eval $compile; then
9832 val="$define"
9833 echo "You have long long."
9834else
9835 val="$undef"
9836 echo "You do not have long long."
9837fi
9838$rm try.*
9839set d_longlong
9840eval $setvar
9841
9842: check for length of long long
9843case "${d_longlong}${longlongsize}" in
9844$define)
9845 echo " "
9846 echo "Checking to see how big your long longs are..." >&4
9847 $cat >try.c <<'EOCP'
9848#include <stdio.h>
9849int main()
9850{
9851 printf("%d\n", (int)sizeof(long long));
9852 return(0);
9853}
9854EOCP
9855 set try
9856 if eval $compile_ok; then
9857 longlongsize=`./try$exe_ext`
9858 echo "Your long longs are $longlongsize bytes long."
9859 else
9860 dflt='8'
9861 echo " "
9862 echo "(I can't seem to compile the test program. Guessing...)"
9863 rp="What is the size of a long long (in bytes)?"
9864 . ./myread
9865 longlongsize="$ans"
9866 fi
9867 if $test "X$longsize" = "X$longlongsize"; then
9868 echo "(That isn't any different from an ordinary long.)"
9869 fi
9870 ;;
9871esac
9872$rm -f try.* try
9873
9874: see if prototype for lseek is available
9875echo " "
9876set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9877eval $hasproto
9878
9879: see if lstat exists
9880set lstat d_lstat
9881eval $inlibc
9882
9883: see if madvise exists
9884set madvise d_madvise
9885eval $inlibc
9886
9887: see if mblen exists
9888set mblen d_mblen
9889eval $inlibc
9890
9891: see if mbstowcs exists
9892set mbstowcs d_mbstowcs
9893eval $inlibc
9894
9895: see if mbtowc exists
9896set mbtowc d_mbtowc
9897eval $inlibc
9898
9899: see if memchr exists
9900set memchr d_memchr
9901eval $inlibc
9902
9903: see if memcmp exists
9904set memcmp d_memcmp
9905eval $inlibc
9906
9907: see if memcpy exists
9908set memcpy d_memcpy
9909eval $inlibc
9910
9911: see if memmove exists
9912set memmove d_memmove
9913eval $inlibc
9914
9915: see if memset exists
9916set memset d_memset
9917eval $inlibc
9918
9919: see if mkdir exists
9920set mkdir d_mkdir
9921eval $inlibc
9922
9923: see if mkdtemp exists
9924set mkdtemp d_mkdtemp
9925eval $inlibc
9926
9927: see if mkfifo exists
9928set mkfifo d_mkfifo
9929eval $inlibc
9930
9931: see if mkstemp exists
9932set mkstemp d_mkstemp
9933eval $inlibc
9934
9935: see if mkstemps exists
9936set mkstemps d_mkstemps
9937eval $inlibc
9938
9939: see if mktime exists
9940set mktime d_mktime
9941eval $inlibc
9942
9943: see if this is a sys/mman.h system
9944set sys/mman.h i_sysmman
9945eval $inhdr
9946
9947: see if mmap exists
9948set mmap d_mmap
9949eval $inlibc
9950: see what shmat returns
9951: default to something harmless
9952mmaptype='void *'
9953case "$i_sysmman$d_mmap" in
9954"$define$define")
9955 $cat >mmap.c <<'END'
9956#include <sys/mman.h>
9957void *mmap();
9958END
9959 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9960 mmaptype='void *'
9961 else
9962 mmaptype='caddr_t'
9963 fi
9964 echo "and it returns ($mmaptype)." >&4
9965 ;;
9966esac
9967
9968
9969
9970: see if modfl exists
9971set modfl d_modfl
9972eval $inlibc
9973
9974: see if mprotect exists
9975set mprotect d_mprotect
9976eval $inlibc
9977
9978: see if msgctl exists
9979set msgctl d_msgctl
9980eval $inlibc
9981
9982: see if msgget exists
9983set msgget d_msgget
9984eval $inlibc
9985
9986: see if msgsnd exists
9987set msgsnd d_msgsnd
9988eval $inlibc
9989
9990: see if msgrcv exists
9991set msgrcv d_msgrcv
9992eval $inlibc
9993
9994: see how much of the 'msg*(2)' library is present.
9995h_msg=true
9996echo " "
9997case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9998*"$undef"*) h_msg=false;;
9999esac
10000case "$osname" in
10001freebsd)
10002 case "`ipcs 2>&1`" in
10003 "SVID messages"*"not configured"*)
10004 echo "Your $osname does not have the msg*(2) configured." >&4
10005 h_msg=false
10006 val="$undef"
10007 set msgctl d_msgctl
10008 eval $setvar
10009 set msgget d_msgget
10010 eval $setvar
10011 set msgsnd d_msgsnd
10012 eval $setvar
10013 set msgrcv d_msgrcv
10014 eval $setvar
10015 ;;
10016 esac
10017 ;;
10018esac
10019: we could also check for sys/ipc.h ...
10020if $h_msg && $test `./findhdr sys/msg.h`; then
10021 echo "You have the full msg*(2) library." >&4
10022 val="$define"
10023else
10024 echo "You don't have the full msg*(2) library." >&4
10025 val="$undef"
10026fi
10027set d_msg
10028eval $setvar
10029
10030: see if msync exists
10031set msync d_msync
10032eval $inlibc
10033
10034: see if munmap exists
10035set munmap d_munmap
10036eval $inlibc
10037
10038: see if nice exists
10039set nice d_nice
10040eval $inlibc
10041
10042
10043echo " "
10044echo "Checking which 64-bit integer type we could use..." >&4
10045
10046case "$intsize" in
100478) val=int
10048 set quadtype
10049 eval $setvar
10050 val='"unsigned int"'
10051 set uquadtype
10052 eval $setvar
10053 quadkind=1
10054 ;;
10055*) case "$longsize" in
10056 8) val=long
10057 set quadtype
10058 eval $setvar
10059 val='"unsigned long"'
10060 set uquadtype
10061 eval $setvar
10062 quadkind=2
10063 ;;
10064 *) case "$d_longlong:$longlongsize" in
10065 define:8)
10066 val='"long long"'
10067 set quadtype
10068 eval $setvar
10069 val='"unsigned long long"'
10070 set uquadtype
10071 eval $setvar
10072 quadkind=3
10073 ;;
10074 *) case "$d_int64_t" in
10075 define)
10076 val=int64_t
10077 set quadtype
10078 eval $setvar
10079 val=uint64_t
10080 set uquadtype
10081 eval $setvar
10082 quadkind=4
10083 ;;
10084 esac
10085 ;;
10086 esac
10087 ;;
10088 esac
10089 ;;
10090esac
10091
10092case "$quadtype" in
10093'') echo "Alas, no 64-bit integer types in sight." >&4
10094 d_quad="$undef"
10095 ;;
10096*) if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10097 verb="will"
10098 else
10099 verb="could"
10100 fi
10101 echo "We $verb use '$quadtype' for 64-bit integers." >&4
10102 d_quad="$define"
10103 ;;
10104esac
10105
10106: check for length of character
10107echo " "
10108case "$charsize" in
10109'')
10110 echo "Checking to see how big your characters are (hey, you never know)..." >&4
10111 $cat >try.c <<'EOCP'
10112#include <stdio.h>
10113int main()
10114{
10115 printf("%d\n", (int)sizeof(char));
10116 exit(0);
10117}
10118EOCP
10119 set try
10120 if eval $compile_ok; then
10121 dflt=`./try`
10122 else
10123 dflt='1'
10124 echo "(I can't seem to compile the test program. Guessing...)"
10125 fi
10126 ;;
10127*)
10128 dflt="$charsize"
10129 ;;
10130esac
10131rp="What is the size of a character (in bytes)?"
10132. ./myread
10133charsize="$ans"
10134$rm -f try.c try
10135
1d1be0dc
NC
10136: check for volatile keyword
10137echo " "
10138echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10139$cat >try.c <<'EOCP'
10140int main()
10141{
10142 typedef struct _goo_struct goo_struct;
10143 goo_struct * volatile goo = ((goo_struct *)0);
10144 struct _goo_struct {
10145 long long_int;
10146 int reg_int;
10147 char char_var;
10148 };
10149 typedef unsigned short foo_t;
10150 char *volatile foo;
10151 volatile int bar;
10152 volatile foo_t blech;
10153 foo = foo;
10154}
10155EOCP
10156if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10157 val="$define"
10158 echo "Yup, it does."
10159else
10160 val="$undef"
10161 echo "Nope, it doesn't."
10162fi
10163set d_volatile
10164eval $setvar
10165$rm -f try.*
10166
b4eb6b3d
JH
10167
10168echo " "
10169$echo "Choosing the C types to be used for Perl's internal types..." >&4
10170
10171case "$use64bitint:$d_quad:$quadtype" in
10172define:define:?*)
10173 ivtype="$quadtype"
10174 uvtype="$uquadtype"
10175 ivsize=8
10176 uvsize=8
10177 ;;
10178*) ivtype="long"
10179 uvtype="unsigned long"
10180 ivsize=$longsize
10181 uvsize=$longsize
10182 ;;
10183esac
10184
10185case "$uselongdouble:$d_longdbl" in
10186define:define)
10187 nvtype="long double"
10188 nvsize=$longdblsize
10189 ;;
10190*) nvtype=double
10191 nvsize=$doublesize
10192 ;;
10193esac
10194
10195$echo "(IV will be "$ivtype", $ivsize bytes)"
10196$echo "(UV will be "$uvtype", $uvsize bytes)"
10197$echo "(NV will be "$nvtype", $nvsize bytes)"
10198
10199$cat >try.c <<EOCP
10200#$i_inttypes I_INTTYPES
10201#ifdef I_INTTYPES
10202#include <inttypes.h>
10203#endif
10204#include <stdio.h>
10205int main() {
10206#ifdef INT8
10207 int8_t i = INT8_MAX;
10208 uint8_t u = UINT8_MAX;
10209 printf("int8_t\n");
10210#endif
10211#ifdef INT16
10212 int16_t i = INT16_MAX;
10213 uint16_t i = UINT16_MAX;
10214 printf("int16_t\n");
10215#endif
10216#ifdef INT32
10217 int32_t i = INT32_MAX;
10218 uint32_t u = UINT32_MAX;
10219 printf("int32_t\n");
10220#endif
10221}
10222EOCP
10223
10224case "$i8type" in
10225'') case "$charsize" in
10226 1) i8type=char
10227 u8type="unsigned char"
10228 i8size=$charsize
10229 u8size=$charsize
10230 ;;
10231 esac
10232 ;;
10233esac
10234case "$i8type" in
10235'') set try -DINT8
10236 if eval $compile; then
10237 case "`./try$exe_ext`" in
10238 int8_t) i8type=int8_t
10239 u8type=uint8_t
10240 i8size=1
10241 u8size=1
10242 ;;
10243 esac
10244 fi
10245 ;;
10246esac
10247case "$i8type" in
10248'') if $test $charsize -ge 1; then
10249 i8type=char
10250 u8type="unsigned char"
10251 i8size=$charsize
10252 u8size=$charsize
10253 fi
10254 ;;
10255esac
10256
10257case "$i16type" in
10258'') case "$shortsize" in
10259 2) i16type=short
10260 u16type="unsigned short"
10261 i16size=$shortsize
10262 u16size=$shortsize
10263 ;;
10264 esac
10265 ;;
10266esac
10267case "$i16type" in
10268'') set try -DINT16
10269 if eval $compile; then
10270 case "`./try$exe_ext`" in
10271 int16_t)
10272 i16type=int16_t
10273 u16type=uint16_t
10274 i16size=2
10275 u16size=2
10276 ;;
10277 esac
10278 fi
10279 ;;
10280esac
10281case "$i16type" in
10282'') if $test $shortsize -ge 2; then
10283 i16type=short
10284 u16type="unsigned short"
10285 i16size=$shortsize
10286 u16size=$shortsize
10287 fi
10288 ;;
10289esac
10290
10291case "$i32type" in
10292'') case "$longsize" in
10293 4) i32type=long
10294 u32type="unsigned long"
10295 i32size=$longsize
10296 u32size=$longsize
10297 ;;
10298 *) case "$intsize" in
10299 4) i32type=int
10300 u32type="unsigned int"
10301 i32size=$intsize
10302 u32size=$intsize
10303 ;;
10304 esac
10305 ;;
10306 esac
10307 ;;
10308esac
10309case "$i32type" in
10310'') set try -DINT32
10311 if eval $compile; then
10312 case "`./try$exe_ext`" in
10313 int32_t)
10314 i32type=int32_t
10315 u32type=uint32_t
10316 i32size=4
10317 u32size=4
10318 ;;
10319 esac
10320 fi
10321 ;;
10322esac
10323case "$i32type" in
10324'') if $test $intsize -ge 4; then
10325 i32type=int
10326 u32type="unsigned int"
10327 i32size=$intsize
10328 u32size=$intsize
10329 fi
10330 ;;
10331esac
10332
10333case "$i64type" in
10334'') case "$d_quad:$quadtype" in
10335 define:?*)
10336 i64type="$quadtype"
10337 u64type="$uquadtype"
10338 i64size=8
10339 u64size=8
10340 ;;
10341 esac
10342 ;;
10343esac
10344
1d1be0dc
NC
10345$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10346: volatile so that the compiler has to store it out to memory.
10347if test X"$d_volatile" = X"$define"; then
10348 volatile=volatile
10349fi
b4eb6b3d
JH
10350$cat <<EOP >try.c
10351#include <stdio.h>
1d1be0dc
NC
10352#include <sys/types.h>
10353#include <signal.h>
10354#ifdef SIGFPE
10355$volatile int bletched = 0;
10356$signal_t blech(s) int s; { bletched = 1; }
10357#endif
b4eb6b3d
JH
10358int main() {
10359 $uvtype u = 0;
1d1be0dc 10360 $nvtype d;
b4eb6b3d
JH
10361 int n = 8 * $uvsize;
10362 int i;
1d1be0dc
NC
10363#ifdef SIGFPE
10364 signal(SIGFPE, blech);
10365#endif
10366
b4eb6b3d
JH
10367 for (i = 0; i < n; i++) {
10368 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
10369 d = ($nvtype)u;
10370 if (($uvtype)d != u)
b4eb6b3d 10371 break;
1d1be0dc
NC
10372 if (d <= 0)
10373 break;
10374 d = ($nvtype)(u - 1);
10375 if (($uvtype)d != (u - 1))
10376 break;
10377#ifdef SIGFPE
10378 if (bletched) {
10379 break;
10380#endif
10381 }
b4eb6b3d 10382 }
efd1522b 10383 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
10384 exit(0);
10385}
10386EOP
1d1be0dc
NC
10387set try
10388
10389d_nv_preserves_uv="$undef"
10390if eval $compile; then
10391 d_nv_preserves_uv_bits="`./try$exe_ext`"
10392fi
10393case "$d_nv_preserves_uv_bits" in
10394\-[1-9]*)
10395 d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10396 $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs." 2>&1
10397 d_nv_preserves_uv="$define"
b4eb6b3d 10398 ;;
1d1be0dc
NC
10399[1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs." 2>&1
10400 d_nv_preserves_uv="$undef" ;;
10401*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
10402 d_nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
10403esac
10404
1d1be0dc
NC
10405$rm -f try.* try
10406
b4eb6b3d
JH
10407
10408: check for off64_t
10409echo " "
10410echo "Checking to see if you have off64_t..." >&4
10411$cat >try.c <<EOCP
10412#include <sys/types.h>
10413#include <unistd.h>
10414int main() { off64_t x = 7; }
10415EOCP
10416set try
10417if eval $compile; then
10418 val="$define"
10419 echo "You have off64_t."
10420else
10421 val="$undef"
10422 echo "You do not have off64_t."
10423 case "$lseeksize" in
10424 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10425 esac
10426fi
10427$rm -f try.* try
10428set d_off64_t
10429eval $setvar
10430
10431: see if POSIX threads are available
10432set pthread.h i_pthread
10433eval $inhdr
10434
10435
10436
10437
10438: how to create joinable pthreads
10439if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10440 echo " "
10441 echo "Checking what constant to use for creating joinable pthreads..." >&4
10442 $cat >try.c <<'EOCP'
10443#include <pthread.h>
10444int main() {
10445 int detachstate = JOINABLE;
10446}
10447EOCP
10448 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10449 if eval $compile; then
10450 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10451 val="$undef" # Yes, undef.
10452 set d_old_pthread_create_joinable
10453 eval $setvar
10454 val=""
10455 set old_pthread_create_joinable
10456 eval $setvar
10457 else
10458 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10459 if eval $compile; then
10460 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10461 val="$define"
10462 set d_old_pthread_create_joinable
10463 eval $setvar
10464 val=PTHREAD_CREATE_UNDETACHED
10465 set old_pthread_create_joinable
10466 eval $setvar
10467 else
10468 set try -DJOINABLE=__UNDETACHED
10469 if eval $compile; then
10470 echo "You seem to use __UNDETACHED." >&4
10471 val="$define"
10472 set d_old_pthread_create_joinable
10473 eval $setvar
10474 val=__UNDETACHED
10475 set old_pthread_create_joinable
10476 eval $setvar
10477 else
10478 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
10479 val="$define"
10480 set d_old_pthread_create_joinable
10481 eval $setvar
10482 val=0
10483 set old_pthread_create_joinable
10484 eval $setvar
10485 fi
10486 fi
10487 fi
10488 $rm -f try try.*
10489else
10490 d_old_pthread_create_joinable="$undef"
10491 old_pthread_create_joinable=""
10492fi
10493
10494: see if pause exists
10495set pause d_pause
10496eval $inlibc
10497
10498: see if pipe exists
10499set pipe d_pipe
10500eval $inlibc
10501
10502: see if poll exists
10503set poll d_poll
10504eval $inlibc
10505
10506
10507: see whether the various POSIXish _yields exist
10508$cat >try.c <<EOP
10509#include <pthread.h>
10510#include <stdio.h>
10511int main() {
10512#ifdef SCHED_YIELD
10513 sched_yield();
10514#else
10515#ifdef PTHREAD_YIELD
10516 pthread_yield();
10517#else
10518#ifdef PTHREAD_YIELD_NULL
10519 pthread_yield(NULL);
10520#endif
10521#endif
10522#endif
10523}
10524EOP
10525: see if sched_yield exists
10526set try -DSCHED_YIELD
10527if eval $compile; then
10528 val="$define"
10529 sched_yield='sched_yield()'
10530else
10531 val="$undef"
10532fi
10533case "$usethreads" in
10534$define)
10535 case "$val" in
10536 $define) echo 'sched_yield() found.' >&4 ;;
10537 *) echo 'sched_yield() NOT found.' >&4 ;;
10538 esac
10539esac
10540set d_sched_yield
10541eval $setvar
10542
10543: see if pthread_yield exists
10544set try -DPTHREAD_YIELD
10545if eval $compile; then
10546 val="$define"
10547 case "$sched_yield" in
10548 '') sched_yield='pthread_yield()' ;;
10549 esac
10550else
10551 set try -DPTHREAD_YIELD_NULL
10552 if eval $compile; then
10553 val="$define"
10554 case "$sched_yield" in
10555 '') sched_yield='pthread_yield(NULL)' ;;
10556 esac
10557 else
10558 val="$undef"
10559 fi
10560fi
10561case "$usethreads" in
10562$define)
10563 case "$val" in
10564 $define) echo 'pthread_yield() found.' >&4 ;;
10565 *) echo 'pthread_yield() NOT found.' >&4 ;;
10566 esac
10567 ;;
10568esac
10569set d_pthread_yield
10570eval $setvar
10571
10572case "$sched_yield" in
10573'') sched_yield=undef ;;
10574esac
10575
10576$rm -f try try.*
10577
10578: see if this is a pwd.h system
10579set pwd.h i_pwd
10580eval $inhdr
10581
10582case "$i_pwd" in
10583$define)
10584 xxx=`./findhdr pwd.h`
10585 $cppstdin $cppflags $cppminus < $xxx >$$.h
10586
10587 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10588 val="$define"
10589 else
10590 val="$undef"
10591 fi
10592 set d_pwquota
10593 eval $setvar
10594
10595 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10596 val="$define"
10597 else
10598 val="$undef"
10599 fi
10600 set d_pwage
10601 eval $setvar
10602
10603 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10604 val="$define"
10605 else
10606 val="$undef"
10607 fi
10608 set d_pwchange
10609 eval $setvar
10610
10611 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10612 val="$define"
10613 else
10614 val="$undef"
10615 fi
10616 set d_pwclass
10617 eval $setvar
10618
10619 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10620 val="$define"
10621 else
10622 val="$undef"
10623 fi
10624 set d_pwexpire
10625 eval $setvar
10626
10627 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10628 val="$define"
10629 else
10630 val="$undef"
10631 fi
10632 set d_pwcomment
10633 eval $setvar
10634
10635 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10636 val="$define"
10637 else
10638 val="$undef"
10639 fi
10640 set d_pwgecos
10641 eval $setvar
10642
10643 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10644 val="$define"
10645 else
10646 val="$undef"
10647 fi
10648 set d_pwpasswd
10649 eval $setvar
10650
10651 $rm -f $$.h
10652 ;;
10653*)
10654 val="$undef";
10655 set d_pwquota; eval $setvar
10656 set d_pwage; eval $setvar
10657 set d_pwchange; eval $setvar
10658 set d_pwclass; eval $setvar
10659 set d_pwexpire; eval $setvar
10660 set d_pwcomment; eval $setvar
10661 set d_pwgecos; eval $setvar
10662 set d_pwpasswd; eval $setvar
10663 ;;
10664esac
10665
10666: see if readdir and friends exist
10667set readdir d_readdir
10668eval $inlibc
10669set seekdir d_seekdir
10670eval $inlibc
10671set telldir d_telldir
10672eval $inlibc
10673set rewinddir d_rewinddir
10674eval $inlibc
10675
10676: see if readlink exists
10677set readlink d_readlink
10678eval $inlibc
10679
10680: see if rename exists
10681set rename d_rename
10682eval $inlibc
10683
10684: see if rmdir exists
10685set rmdir d_rmdir
10686eval $inlibc
10687
10688: see if memory.h is available.
10689val=''
10690set memory.h val
10691eval $inhdr
10692
10693: See if it conflicts with string.h
10694case "$val" in
10695$define)
10696 case "$strings" in
10697 '') ;;
10698 *)
10699 $cppstdin $cppflags $cppminus < $strings > mem.h
10700 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10701 echo " "
10702 echo "We won't be including <memory.h>."
10703 val="$undef"
10704 fi
10705 $rm -f mem.h
10706 ;;
10707 esac
10708esac
10709set i_memory
10710eval $setvar
10711
10712: can bcopy handle overlapping blocks?
10713val="$undef"
10714case "$d_bcopy" in
10715"$define")
10716 echo " "
10717 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10718 $cat >try.c <<EOCP
10719#$i_memory I_MEMORY
10720#$i_stdlib I_STDLIB
10721#$i_string I_STRING
10722#$i_unistd I_UNISTD
10723EOCP
10724 $cat >>try.c <<'EOCP'
10725#include <stdio.h>
10726#ifdef I_MEMORY
10727# include <memory.h>
10728#endif
10729#ifdef I_STDLIB
10730# include <stdlib.h>
10731#endif
10732#ifdef I_STRING
10733# include <string.h>
10734#else
10735# include <strings.h>
10736#endif
10737#ifdef I_UNISTD
10738# include <unistd.h> /* Needed for NetBSD */
10739#endif
10740int main()
10741{
10742char buf[128], abc[128];
10743char *b;
10744int len;
10745int off;
10746int align;
10747
10748bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10749
10750for (align = 7; align >= 0; align--) {
10751 for (len = 36; len; len--) {
10752 b = buf+align;
10753 bcopy(abc, b, len);
10754 for (off = 1; off <= len; off++) {
10755 bcopy(b, b+off, len);
10756 bcopy(b+off, b, len);
10757 if (bcmp(b, abc, len))
10758 exit(1);
10759 }
10760 }
10761}
10762exit(0);
10763}
10764EOCP
10765 set try
10766 if eval $compile_ok; then
10767 if ./try 2>/dev/null; then
10768 echo "Yes, it can."
10769 val="$define"
10770 else
10771 echo "It can't, sorry."
10772 case "$d_memmove" in
10773 "$define") echo "But that's Ok since you have memmove()." ;;
10774 esac
10775 fi
10776 else
10777 echo "(I can't compile the test program, so we'll assume not...)"
10778 case "$d_memmove" in
10779 "$define") echo "But that's Ok since you have memmove()." ;;
10780 esac
10781 fi
10782 ;;
10783esac
10784$rm -f try.* try core
10785set d_safebcpy
10786eval $setvar
10787
10788: can memcpy handle overlapping blocks?
10789val="$undef"
10790case "$d_memcpy" in
10791"$define")
10792 echo " "
10793 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10794 $cat >try.c <<EOCP
10795#$i_memory I_MEMORY
10796#$i_stdlib I_STDLIB
10797#$i_string I_STRING
10798#$i_unistd I_UNISTD
10799EOCP
10800 $cat >>try.c <<'EOCP'
10801#include <stdio.h>
10802#ifdef I_MEMORY
10803# include <memory.h>
10804#endif
10805#ifdef I_STDLIB
10806# include <stdlib.h>
10807#endif
10808#ifdef I_STRING
10809# include <string.h>
10810#else
10811# include <strings.h>
10812#endif
10813#ifdef I_UNISTD
10814# include <unistd.h> /* Needed for NetBSD */
10815#endif
10816int main()
10817{
10818char buf[128], abc[128];
10819char *b;
10820int len;
10821int off;
10822int align;
10823
10824/* Copy "abcde..." string to char abc[] so that gcc doesn't
10825 try to store the string in read-only memory. */
10826memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10827
10828for (align = 7; align >= 0; align--) {
10829 for (len = 36; len; len--) {
10830 b = buf+align;
10831 memcpy(b, abc, len);
10832 for (off = 1; off <= len; off++) {
10833 memcpy(b+off, b, len);
10834 memcpy(b, b+off, len);
10835 if (memcmp(b, abc, len))
10836 exit(1);
10837 }
10838 }
10839}
10840exit(0);
10841}
10842EOCP
10843 set try
10844 if eval $compile_ok; then
10845 if ./try 2>/dev/null; then
10846 echo "Yes, it can."
10847 val="$define"
10848 else
10849 echo "It can't, sorry."
10850 case "$d_memmove" in
10851 "$define") echo "But that's Ok since you have memmove()." ;;
10852 esac
10853 fi
10854 else
10855 echo "(I can't compile the test program, so we'll assume not...)"
10856 case "$d_memmove" in
10857 "$define") echo "But that's Ok since you have memmove()." ;;
10858 esac
10859 fi
10860 ;;
10861esac
10862$rm -f try.* try core
10863set d_safemcpy
10864eval $setvar
10865
10866: can memcmp be trusted to compare relative magnitude?
10867val="$undef"
10868case "$d_memcmp" in
10869"$define")
10870 echo " "
10871 echo "Checking if your memcmp() can compare relative magnitude..." >&4
10872 $cat >try.c <<EOCP
10873#$i_memory I_MEMORY
10874#$i_stdlib I_STDLIB
10875#$i_string I_STRING
10876#$i_unistd I_UNISTD
10877EOCP
10878 $cat >>try.c <<'EOCP'
10879#include <stdio.h>
10880#ifdef I_MEMORY
10881# include <memory.h>
10882#endif
10883#ifdef I_STDLIB
10884# include <stdlib.h>
10885#endif
10886#ifdef I_STRING
10887# include <string.h>
10888#else
10889# include <strings.h>
10890#endif
10891#ifdef I_UNISTD
10892# include <unistd.h> /* Needed for NetBSD */
10893#endif
10894int main()
10895{
10896char a = -1;
10897char b = 0;
10898if ((a < b) && memcmp(&a, &b, 1) < 0)
10899 exit(1);
10900exit(0);
10901}
10902EOCP
10903 set try
10904 if eval $compile_ok; then
10905 if ./try 2>/dev/null; then
10906 echo "Yes, it can."
10907 val="$define"
10908 else
10909 echo "No, it can't (it uses signed chars)."
10910 fi
10911 else
10912 echo "(I can't compile the test program, so we'll assume not...)"
10913 fi
10914 ;;
10915esac
10916$rm -f try.* try core
10917set d_sanemcmp
10918eval $setvar
10919
ef9f17be
JH
10920: see if prototype for sbrk is available
10921echo " "
10922set d_sbrkproto sbrk $i_unistd unistd.h
10923eval $hasproto
10924
b4eb6b3d
JH
10925: see if select exists
10926set select d_select
10927eval $inlibc
10928
10929: see if semctl exists
10930set semctl d_semctl
10931eval $inlibc
10932
10933: see if semget exists
10934set semget d_semget
10935eval $inlibc
10936
10937: see if semop exists
10938set semop d_semop
10939eval $inlibc
10940
10941: see how much of the 'sem*(2)' library is present.
10942h_sem=true
10943echo " "
10944case "$d_semctl$d_semget$d_semop" in
10945*"$undef"*) h_sem=false;;
10946esac
10947case "$osname" in
10948freebsd)
10949 case "`ipcs 2>&1`" in
10950 "SVID messages"*"not configured"*)
10951 echo "Your $osname does not have the sem*(2) configured." >&4
10952 h_sem=false
10953 val="$undef"
10954 set semctl d_semctl
10955 eval $setvar
10956 set semget d_semget
10957 eval $setvar
10958 set semop d_semop
10959 eval $setvar
10960 ;;
10961 esac
10962 ;;
10963esac
10964: we could also check for sys/ipc.h ...
10965if $h_sem && $test `./findhdr sys/sem.h`; then
10966 echo "You have the full sem*(2) library." >&4
10967 val="$define"
10968else
10969 echo "You don't have the full sem*(2) library." >&4
10970 val="$undef"
10971fi
10972set d_sem
10973eval $setvar
10974
10975: see whether sys/sem.h defines union semun
10976echo " "
10977$cat > try.c <<'END'
10978#include <sys/types.h>
10979#include <sys/ipc.h>
10980#include <sys/sem.h>
10981int main () { union semun semun; semun.buf = 0; }
10982END
10983set try
10984if eval $compile; then
10985 echo "You have union semun in <sys/sem.h>." >&4
10986 val="$define"
10987else
10988 echo "You do not have union semun in <sys/sem.h>." >&4
10989 val="$undef"
10990fi
10991$rm -f try try.c try.h
10992set d_union_semun
10993eval $setvar
10994
10995: see how to do semctl IPC_STAT
10996case "$d_sem" in
10997$define)
10998 : see whether semctl IPC_STAT can use union semun
10999 echo " "
11000 $cat > try.h <<END
11001#ifndef S_IRUSR
11002# ifdef S_IREAD
11003# define S_IRUSR S_IREAD
11004# define S_IWUSR S_IWRITE
11005# define S_IXUSR S_IEXEC
11006# else
11007# define S_IRUSR 0400
11008# define S_IWUSR 0200
11009# define S_IXUSR 0100
11010# endif
11011# define S_IRGRP (S_IRUSR>>3)
11012# define S_IWGRP (S_IWUSR>>3)
11013# define S_IXGRP (S_IXUSR>>3)
11014# define S_IROTH (S_IRUSR>>6)
11015# define S_IWOTH (S_IWUSR>>6)
11016# define S_IXOTH (S_IXUSR>>6)
11017#endif
11018#ifndef S_IRWXU
11019# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11020# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11021# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11022#endif
11023END
11024
11025 $cat > try.c <<END
11026#include <sys/types.h>
11027#include <sys/ipc.h>
11028#include <sys/sem.h>
11029#include <sys/stat.h>
11030#include <stdio.h>
11031#include <errno.h>
11032#include "try.h"
11033#ifndef errno
11034extern int errno;
11035#endif
11036#$d_union_semun HAS_UNION_SEMUN
11037int main() {
11038 union semun
11039#ifndef HAS_UNION_SEMUN
11040 {
11041 int val;
11042 struct semid_ds *buf;
11043 unsigned short *array;
11044 }
11045#endif
11046 arg;
11047 int sem, st;
11048
11049#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11050 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11051 if (sem > -1) {
11052 struct semid_ds argbuf;
11053 arg.buf = &argbuf;
11054# ifdef IPC_STAT
11055 st = semctl(sem, 0, IPC_STAT, arg);
11056 if (st == 0)
11057 printf("semun\n");
11058 else
11059# endif /* IPC_STAT */
11060 printf("semctl IPC_STAT failed: errno = %d\n", errno);
11061# ifdef IPC_RMID
11062 if (semctl(sem, 0, IPC_RMID, arg) != 0)
11063# endif /* IPC_RMID */
11064 printf("semctl IPC_RMID failed: errno = %d\n", errno);
11065 } else
11066#endif /* IPC_PRIVATE && ... */
11067 printf("semget failed: errno = %d\n", errno);
11068 return 0;
11069}
11070END
11071 val="$undef"
11072 set try
11073 if eval $compile; then
11074 xxx=`./try`
11075 case "$xxx" in
11076 semun) val="$define" ;;
11077 esac
11078 fi
11079 $rm -f try try.c
11080 set d_semctl_semun
11081 eval $setvar
11082 case "$d_semctl_semun" in
11083 $define)
11084 echo "You can use union semun for semctl IPC_STAT." >&4
11085 also='also'
11086 ;;
11087 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
11088 also=''
11089 ;;
11090 esac
11091
11092 : see whether semctl IPC_STAT can use struct semid_ds pointer
11093 $cat > try.c <<'END'
11094#include <sys/types.h>
11095#include <sys/ipc.h>
11096#include <sys/sem.h>
11097#include <sys/stat.h>
11098#include "try.h"
11099#include <stdio.h>
11100#include <errno.h>
11101#ifndef errno
11102extern int errno;
11103#endif
11104int main() {
11105 struct semid_ds arg;
11106 int sem, st;
11107
11108#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11109 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11110 if (sem > -1) {
11111# ifdef IPC_STAT
11112 st = semctl(sem, 0, IPC_STAT, &arg);
11113 if (st == 0)
11114 printf("semid_ds\n");
11115 else
11116# endif /* IPC_STAT */
11117 printf("semctl IPC_STAT failed: errno = %d\n", errno);
11118# ifdef IPC_RMID
11119 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11120# endif /* IPC_RMID */
11121 printf("semctl IPC_RMID failed: errno = %d\n", errno);
11122 } else
11123#endif /* IPC_PRIVATE && ... */
11124 printf("semget failed: errno = %d\n", errno);
11125
11126 return 0;
11127}
11128END
11129 val="$undef"
11130 set try
11131 if eval $compile; then
11132 xxx=`./try`
11133 case "$xxx" in
11134 semid_ds) val="$define" ;;
11135 esac
11136 fi
11137 $rm -f try try.c
11138 set d_semctl_semid_ds
11139 eval $setvar
11140 case "$d_semctl_semid_ds" in
11141 $define)
11142 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11143 ;;
11144 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11145 ;;
11146 esac
11147 $rm -f try.h
11148 ;;
11149*) val="$undef"
11150
11151 # We do not have the full sem*(2) library, so assume we can not
11152 # use either.
11153
11154 set d_semctl_semun
11155 eval $setvar
11156
11157 set d_semctl_semid_ds
11158 eval $setvar
11159 ;;
11160esac
11161
11162: see if setegid exists
11163set setegid d_setegid
11164eval $inlibc
11165
11166: see if seteuid exists
11167set seteuid d_seteuid
11168eval $inlibc
11169
11170: see if setgrent exists
11171set setgrent d_setgrent
11172eval $inlibc
11173
11174: see if sethostent exists
11175set sethostent d_sethent
11176eval $inlibc
11177
11178: see if setlinebuf exists
11179set setlinebuf d_setlinebuf
11180eval $inlibc
11181
11182: see if setlocale exists
11183set setlocale d_setlocale
11184eval $inlibc
11185
11186: see if setnetent exists
11187set setnetent d_setnent
11188eval $inlibc
11189
11190: see if setprotoent exists
11191set setprotoent d_setpent
11192eval $inlibc
11193
11194: see if setpgid exists
11195set setpgid d_setpgid
11196eval $inlibc
11197
11198: see if setpgrp2 exists
11199set setpgrp2 d_setpgrp2
11200eval $inlibc
11201
11202: see if setpriority exists
11203set setpriority d_setprior
11204eval $inlibc
11205
11206: see if setproctitle exists
11207set setproctitle d_setproctitle
11208eval $inlibc
11209
11210: see if setpwent exists
11211set setpwent d_setpwent
11212eval $inlibc
11213
11214: see if setregid exists
11215set setregid d_setregid
11216eval $inlibc
11217set setresgid d_setresgid
11218eval $inlibc
11219
11220: see if setreuid exists
11221set setreuid d_setreuid
11222eval $inlibc
11223set setresuid d_setresuid
11224eval $inlibc
11225
11226: see if setrgid exists
11227set setrgid d_setrgid
11228eval $inlibc
11229
11230: see if setruid exists
11231set setruid d_setruid
11232eval $inlibc
11233
11234: see if setservent exists
11235set setservent d_setsent
11236eval $inlibc
11237
11238: see if setsid exists
11239set setsid d_setsid
11240eval $inlibc
11241
11242: see if setvbuf exists
11243set setvbuf d_setvbuf
11244eval $inlibc
11245
11246: see if sfio.h is available
11247set sfio.h i_sfio
11248eval $inhdr
11249
11250
11251: see if sfio library is available
11252case "$i_sfio" in
11253$define)
11254 val=''
11255 set sfreserve val
11256 eval $inlibc
11257 ;;
11258*)
11259 val="$undef"
11260 ;;
11261esac
11262: Ok, but do we want to use it.
11263case "$val" in
11264$define)
11265 case "$usesfio" in
11266 true|$define|[yY]*) dflt='y';;
11267 *) dflt='n';;
11268 esac
11269 echo "$package can use the sfio library, but it is experimental."
11270 case "$useperlio" in
11271 "$undef")
11272 echo "For sfio also the PerlIO abstraction layer is needed."
11273 echo "Earlier you said you wouldn't want that."
11274 ;;
11275 esac
11276 rp="You seem to have sfio available, do you want to try using it?"
11277 . ./myread
11278 case "$ans" in
11279 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
11280 useperlio="$define"
11281 val="$define"
11282 ;;
11283 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
11284 val="$undef"
11285 : Remove sfio from list of libraries to use
11286 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11287 shift
11288 libs="$*"
11289 echo "libs = $libs" >&4
11290 ;;
11291 esac
11292 ;;
11293*) case "$usesfio" in
11294 true|$define|[yY]*)
11295 echo "Sorry, cannot find sfio on this machine." >&4
11296 echo "Ignoring your setting of usesfio=$usesfio." >&4
11297 val="$undef"
11298 ;;
11299 esac
11300 ;;
11301esac
11302set d_sfio
11303eval $setvar
11304case "$d_sfio" in
11305$define) usesfio='true';;
11306*) usesfio='false';;
11307esac
11308
11309: see if shmctl exists
11310set shmctl d_shmctl
11311eval $inlibc
11312
11313: see if shmget exists
11314set shmget d_shmget
11315eval $inlibc
11316
11317: see if shmat exists
11318set shmat d_shmat
11319eval $inlibc
11320: see what shmat returns
11321case "$d_shmat" in
11322"$define")
11323 $cat >shmat.c <<'END'
11324#include <sys/shm.h>
11325void *shmat();
11326END
11327 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11328 shmattype='void *'
11329 else
11330 shmattype='char *'
11331 fi
11332 echo "and it returns ($shmattype)." >&4
11333 : see if a prototype for shmat is available
11334 xxx=`./findhdr sys/shm.h`
11335 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11336 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11337 val="$define"
11338 else
11339 val="$undef"
11340 fi
11341 $rm -f shmat.[co]
11342 ;;
11343*)
11344 val="$undef"
11345 ;;
11346esac
11347set d_shmatprototype
11348eval $setvar
11349
11350: see if shmdt exists
11351set shmdt d_shmdt
11352eval $inlibc
11353
11354: see how much of the 'shm*(2)' library is present.
11355h_shm=true
11356echo " "
11357case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11358*"$undef"*) h_shm=false;;
11359esac
11360case "$osname" in
11361freebsd)
11362 case "`ipcs 2>&1`" in
11363 "SVID shared memory"*"not configured"*)
11364 echo "Your $osname does not have the shm*(2) configured." >&4
11365 h_shm=false
11366 val="$undef"
11367 set shmctl d_shmctl
11368 evat $setvar
11369 set shmget d_shmget
11370 evat $setvar
11371 set shmat d_shmat
11372 evat $setvar
11373 set shmdt d_shmdt
11374 evat $setvar
11375 ;;
11376 esac
11377 ;;
11378esac
11379: we could also check for sys/ipc.h ...
11380if $h_shm && $test `./findhdr sys/shm.h`; then
11381 echo "You have the full shm*(2) library." >&4
11382 val="$define"
11383else
11384 echo "You don't have the full shm*(2) library." >&4
11385 val="$undef"
11386fi
11387set d_shm
11388eval $setvar
11389
11390echo " "
11391: see if we have sigaction
11392if set sigaction val -f d_sigaction; eval $csym; $val; then
11393 echo 'sigaction() found.' >&4
11394 $cat > try.c <<'EOP'
11395#include <stdio.h>
11396#include <sys/types.h>
11397#include <signal.h>
11398int main()
11399{
11400 struct sigaction act, oact;
11401 act.sa_flags = 0;
11402 oact.sa_handler = 0;
11403 /* so that act and oact are used */
11404 exit(act.sa_flags == 0 && oact.sa_handler == 0);
11405}
11406EOP
11407 set try
11408 if eval $compile_ok; then
11409 val="$define"
11410 else
11411 echo "But you don't seem to have a useable struct sigaction." >&4
11412 val="$undef"
11413 fi
11414else
11415 echo 'sigaction NOT found.' >&4
11416 val="$undef"
11417fi
11418set d_sigaction; eval $setvar
11419$rm -f try try$_o try.c
11420
11421: see if sigsetjmp exists
11422echo " "
11423case "$d_sigsetjmp" in
11424'')
11425 $cat >try.c <<'EOP'
11426#include <setjmp.h>
11427sigjmp_buf env;
11428int set = 1;
11429int main()
11430{
11431 if (sigsetjmp(env,1))
11432 exit(set);
11433 set = 0;
11434 siglongjmp(env, 1);
11435 exit(1);
11436}
11437EOP
11438 set try
11439 if eval $compile; then
11440 if ./try >/dev/null 2>&1; then
11441 echo "POSIX sigsetjmp found." >&4
11442 val="$define"
11443 else
11444 $cat >&4 <<EOM
11445Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11446I'll ignore them.
11447EOM
11448 val="$undef"
11449 fi
11450 else
11451 echo "sigsetjmp not found." >&4
11452 val="$undef"
11453 fi
11454 ;;
11455*) val="$d_sigsetjmp"
11456 case "$d_sigsetjmp" in
11457 $define) echo "POSIX sigsetjmp found." >&4;;
11458 $undef) echo "sigsetjmp not found." >&4;;
11459 esac
11460 ;;
11461esac
11462set d_sigsetjmp
11463eval $setvar
11464$rm -f try.c try
11465
11466: see if socks5_init exists
11467set socks5_init d_socks5_init
11468eval $inlibc
11469
11470: see if sys/stat.h is available
11471set sys/stat.h i_sysstat
11472eval $inhdr
11473
11474
11475: see if stat knows about block sizes
11476echo " "
11477echo "Checking to see if your struct stat has st_blocks field..." >&4
11478set d_statblks stat st_blocks $i_sysstat sys/stat.h
11479eval $hasfield
11480
11481
11482: see if this is a sys/vfs.h system
11483set sys/vfs.h i_sysvfs
11484eval $inhdr
11485
11486
11487: see if this is a sys/statfs.h system
11488set sys/statfs.h i_sysstatfs
11489eval $inhdr
11490
11491
11492echo " "
11493echo "Checking to see if your system supports struct statfs..." >&4
11494set 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
11495eval $hasstruct
11496case "$d_statfs_s" in
11497"$define") echo "Yes, it does." ;;
11498*) echo "No, it doesn't." ;;
11499esac
11500
11501
11502
11503: see if struct statfs knows about f_flags
11504case "$d_statfs_s" in
11505define)
11506 echo " "
11507 echo "Checking to see if your struct statfs has f_flags field..." >&4
11508 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
11509 eval $hasfield
11510 ;;
11511*) val="$undef"
11512 set d_statfs_f_flags
11513 eval $setvar
11514 ;;
11515esac
11516case "$d_statfs_f_flags" in
11517"$define") echo "Yes, it does." ;;
11518*) echo "No, it doesn't." ;;
11519esac
11520
11521: see if _ptr and _cnt from stdio act std
11522echo " "
80f36755
NC
11523
11524if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11525 echo "(Looks like you have stdio.h from BSD.)"
11526 case "$stdio_ptr" in
11527 '') stdio_ptr='((fp)->_p)'
11528 ptr_lval=$define
11529 ;;
11530 *) ptr_lval=$d_stdio_ptr_lval;;
11531 esac
11532 case "$stdio_cnt" in
11533 '') stdio_cnt='((fp)->_r)'
11534 cnt_lval=$define
11535 ;;
11536 *) cnt_lval=$d_stdio_cnt_lval;;
11537 esac
11538 case "$stdio_base" in
11539 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11540 esac
11541 case "$stdio_bufsiz" in
11542 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11543 esac
11544elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
b4eb6b3d
JH
11545 echo "(Looks like you have stdio.h from Linux.)"
11546 case "$stdio_ptr" in
11547 '') stdio_ptr='((fp)->_IO_read_ptr)'
11548 ptr_lval=$define
11549 ;;
11550 *) ptr_lval=$d_stdio_ptr_lval;;
11551 esac
11552 case "$stdio_cnt" in
11553 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11554 cnt_lval=$undef
11555 ;;
11556 *) cnt_lval=$d_stdio_cnt_lval;;
11557 esac
11558 case "$stdio_base" in
11559 '') stdio_base='((fp)->_IO_read_base)';;
11560 esac
11561 case "$stdio_bufsiz" in
11562 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11563 esac
11564else
11565 case "$stdio_ptr" in
11566 '') stdio_ptr='((fp)->_ptr)'
11567 ptr_lval=$define
11568 ;;
11569 *) ptr_lval=$d_stdio_ptr_lval;;
11570 esac
11571 case "$stdio_cnt" in
11572 '') stdio_cnt='((fp)->_cnt)'
11573 cnt_lval=$define
11574 ;;
11575 *) cnt_lval=$d_stdio_cnt_lval;;
11576 esac
11577 case "$stdio_base" in
11578 '') stdio_base='((fp)->_base)';;
11579 esac
11580 case "$stdio_bufsiz" in
11581 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11582 esac
11583fi
80f36755 11584
b4eb6b3d
JH
11585: test whether _ptr and _cnt really work
11586echo "Checking how std your stdio is..." >&4
11587$cat >try.c <<EOP
11588#include <stdio.h>
11589#define FILE_ptr(fp) $stdio_ptr
11590#define FILE_cnt(fp) $stdio_cnt
11591int main() {
11592 FILE *fp = fopen("try.c", "r");
11593 char c = getc(fp);
11594 if (
11595 18 <= FILE_cnt(fp) &&
11596 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11597 )
11598 exit(0);
11599 exit(1);
11600}
11601EOP
11602val="$undef"
11603set try
11604if eval $compile; then
11605 if ./try; then
11606 echo "Your stdio acts pretty std."
11607 val="$define"
11608 else
11609 echo "Your stdio isn't very std."
11610 fi
11611else
11612 echo "Your stdio doesn't appear very std."
11613fi
11614$rm -f try.c try
11615set d_stdstdio
11616eval $setvar
11617
11618: Can _ptr be used as an lvalue?
11619case "$d_stdstdio$ptr_lval" in
11620$define$define) val=$define ;;
11621*) val=$undef ;;
11622esac
11623set d_stdio_ptr_lval
11624eval $setvar
11625
11626: Can _cnt be used as an lvalue?
11627case "$d_stdstdio$cnt_lval" in
11628$define$define) val=$define ;;
11629*) val=$undef ;;
11630esac
11631set d_stdio_cnt_lval
11632eval $setvar
11633
a7ffa9b9
NC
11634
11635: test whether setting _ptr sets _cnt as a side effect
11636d_stdio_ptr_lval_sets_cnt="$undef"
11637d_stdio_ptr_lval_nochange_cnt="$undef"
11638case "$d_stdio_ptr_lval$d_stdstdio" in
11639$define$define)
11640 echo "Checking to see what happens if we set the stdio ptr..." >&4
11641$cat >try.c <<EOP
11642#include <stdio.h>
11643/* Can we scream? */
11644/* Eat dust sed :-) */
c1d9e6fa 11645/* In the buffer space, no one can hear you scream. */
0bbfc344
JH
11646#define FILE_ptr(fp) $stdio_ptr
11647#define FILE_cnt(fp) $stdio_cnt
c1d9e6fa 11648#include <sys/types.h>
a7ffa9b9
NC
11649int main() {
11650 FILE *fp = fopen("try.c", "r");
c1d9e6fa 11651 int c;
a7ffa9b9
NC
11652 char *ptr;
11653 size_t cnt;
c1d9e6fa
JH
11654 if (!fp) {
11655 puts("Fail even to read");
11656 exit(1);
11657 }
11658 c = getc(fp); /* Read away the first # */
11659 if (c == EOF) {
11660 puts("Fail even to read");
11661 exit(1);
11662 }
a7ffa9b9
NC
11663 if (!(
11664 18 <= FILE_cnt(fp) &&
11665 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11666 )) {
11667 puts("Fail even to read");
11668 exit (1);
11669 }
c1d9e6fa
JH
11670 ptr = (char*) FILE_ptr(fp);
11671 cnt = (size_t)FILE_cnt(fp);
a7ffa9b9 11672
c1d9e6fa 11673 FILE_ptr(fp) += 42;
a7ffa9b9 11674
c1d9e6fa 11675 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
a7ffa9b9
NC
11676 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11677 exit (1);
11678 }
11679 if (FILE_cnt(fp) <= 20) {
11680 printf ("Fail (<20 chars to test)");
11681 exit (1);
11682 }
11683 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11684 puts("Fail compare");
11685 exit (1);
11686 }
11687 if (cnt == FILE_cnt(fp)) {
11688 puts("Pass_unchanged");
11689 exit (0);
11690 }
11691 if (FILE_cnt(fp) == (cnt - 42)) {
11692 puts("Pass_changed");
11693 exit (0);
11694 }
11695 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11696 return 1;
11697
11698}
11699EOP
11700 set try
11701 if eval $compile; then
11702 case `./try$exe_ext` in
11703 Pass_changed)
2e32dcfe 11704 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
a7ffa9b9
NC
11705 d_stdio_ptr_lval_sets_cnt="$define" ;;
11706 Pass_unchanged)
11707 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
11708 d_stdio_ptr_lval_nochange_cnt="$define" ;;
11709 Fail*)
11710 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
11711 *)
11712 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11713 esac
11714 else
11715 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
11716 fi
11717 $rm -f try.c try
11718 ;;
11719esac
11720
b4eb6b3d
JH
11721: see if _base is also standard
11722val="$undef"
11723case "$d_stdstdio" in
11724$define)
11725 $cat >try.c <<EOP
11726#include <stdio.h>
11727#define FILE_base(fp) $stdio_base
11728#define FILE_bufsiz(fp) $stdio_bufsiz
11729int main() {
11730 FILE *fp = fopen("try.c", "r");
11731 char c = getc(fp);
11732 if (
11733 19 <= FILE_bufsiz(fp) &&
11734 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11735 )
11736 exit(0);
11737 exit(1);
11738}
11739EOP
11740 set try
11741 if eval $compile; then
11742 if ./try; then
11743 echo "And its _base field acts std."
11744 val="$define"
11745 else
11746 echo "But its _base field isn't std."
11747 fi
11748 else
11749 echo "However, it seems to be lacking the _base field."
11750 fi
11751 $rm -f try.c try
11752 ;;
11753esac
11754set d_stdiobase
11755eval $setvar
11756
11757$cat >&4 <<EOM
11758Checking how to access stdio streams by file descriptor number...
11759EOM
11760case "$stdio_stream_array" in
11761'') $cat >try.c <<EOCP
11762#include <stdio.h>
11763int main() {
11764 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11765 printf("yes\n");
11766}
11767EOCP
11768 for s in _iob __iob __sF
11769 do
11770 set try -DSTDIO_STREAM_ARRAY=$s
11771 if eval $compile; then
11772 case "`./try$exe_ext`" in
11773 yes) stdio_stream_array=$s; break ;;
11774 esac
11775 fi
11776 done
11777 $rm -f try.* try$exe_ext
11778esac
11779case "$stdio_stream_array" in
11780'') $cat >&4 <<EOM
11781I can't figure out how to access stdio streams by file descriptor number.
11782EOM
11783 d_stdio_stream_array="$undef"
11784 ;;
11785*) $cat >&4 <<EOM
11786You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11787EOM
11788 d_stdio_stream_array="$define"
11789 ;;
11790esac
11791
11792: see if strcoll exists
11793set strcoll d_strcoll
11794eval $inlibc
11795
11796: check for structure copying
11797echo " "
11798echo "Checking to see if your C compiler can copy structs..." >&4
11799$cat >try.c <<'EOCP'
11800int main()
11801{
11802 struct blurfl {
11803 int dyick;
11804 } foo, bar;
11805
11806 foo = bar;
11807}
11808EOCP
11809if $cc -c try.c >/dev/null 2>&1 ; then
11810 val="$define"
11811 echo "Yup, it can."
11812else
11813 val="$undef"
11814 echo "Nope, it can't."
11815fi
11816set d_strctcpy
11817eval $setvar
11818$rm -f try.*
11819
11820: see if strerror and/or sys_errlist[] exist
11821echo " "
11822if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11823 if set strerror val -f d_strerror; eval $csym; $val; then
11824 echo 'strerror() found.' >&4
11825 d_strerror="$define"
11826 d_strerrm='strerror(e)'
11827 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11828 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
11829 d_syserrlst="$define"
11830 else
11831 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11832 d_syserrlst="$undef"
11833 fi
11834 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11835 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11836 echo 'strerror() found in string header.' >&4
11837 d_strerror="$define"
11838 d_strerrm='strerror(e)'
11839 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11840 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11841 d_syserrlst="$define"
11842 else
11843 echo "(You don't appear to have any sys_errlist[], how can this be?)"
11844 d_syserrlst="$undef"
11845 fi
11846 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11847 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11848 d_strerror="$undef"
11849 d_syserrlst="$define"
11850 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11851 else
11852 echo 'strerror() and sys_errlist[] NOT found.' >&4
11853 d_strerror="$undef"
11854 d_syserrlst="$undef"
11855 d_strerrm='"unknown"'
11856 fi
11857fi
11858
11859: see if strtod exists
11860set strtod d_strtod
11861eval $inlibc
11862
11863: see if strtol exists
11864set strtol d_strtol
11865eval $inlibc
11866
11867: see if strtold exists
11868set strtold d_strtold
11869eval $inlibc
11870
11871: see if strtoll exists
11872set strtoll d_strtoll
11873eval $inlibc
11874
11875case "$d_longlong-$d_strtoll" in
11876"$define-$define")
11877 $cat <<EOM
11878Checking whether your strtoll() works okay...
11879EOM
11880 $cat >try.c <<'EOCP'
11881#include <errno.h>
11882#ifdef __hpux
11883#define strtoll __strtoll
11884#endif
e75931a7
YST
11885#ifdef __EMX__
11886#define strtoll _strtoll
11887#endif
b4eb6b3d
JH
11888#include <stdio.h>
11889extern long long int strtoll(char *s, char **, int);
11890static int bad = 0;
11891int check(char *s, long long ell, int een) {
11892 long long gll;
11893 errno = 0;
11894 gll = strtoll(s, 0, 10);
11895 if (!((gll == ell) && (errno == een)))
11896 bad++;
11897}
11898int main() {
11899 check(" 1", 1LL, 0);
11900 check(" 0", 0LL, 0);
11901 check("-1", -1LL, 0);
11902 check("-9223372036854775808", -9223372036854775808LL, 0);
11903 check("-9223372036854775808", -9223372036854775808LL, 0);
11904 check(" 9223372036854775807", 9223372036854775807LL, 0);
11905 check("-9223372036854775808", -9223372036854775808LL, 0);
11906 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
11907 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11908 if (!bad)
11909 printf("ok\n");
11910}
11911EOCP
11912 set try
11913 if eval $compile; then
e75931a7
YST
11914 yyy=`./try`
11915 case "$yyy" in
b4eb6b3d
JH
11916 ok) echo "Your strtoll() seems to be working okay." ;;
11917 *) cat <<EOM >&4
11918Your strtoll() doesn't seem to be working okay.
11919EOM
11920 d_strtoll="$undef"
11921 ;;
69eadf66 11922 esac
e75931a7
YST
11923 else
11924 echo "(I can't seem to compile the test program--assuming it doesn't)"
11925 d_strtoll="$undef"
b4eb6b3d
JH
11926 fi
11927 ;;
11928esac
11929
11930: see if strtoul exists
11931set strtoul d_strtoul
11932eval $inlibc
11933
11934: see if strtoull exists
11935set strtoull d_strtoull
11936eval $inlibc
11937
11938case "$d_longlong-$d_strtoull" in
11939"$define-$define")
11940 $cat <<EOM
11941Checking whether your strtoull() works okay...
11942EOM
11943 $cat >try.c <<'EOCP'
11944#include <errno.h>
11945#ifdef __hpux
11946#define strtoull __strtoull
11947#endif
11948#include <stdio.h>
11949extern unsigned long long int strtoull(char *s, char **, int);
11950static int bad = 0;
11951int check(char *s, long long eull, int een) {
11952 long long gull;
11953 errno = 0;
11954 gull = strtoull(s, 0, 10);
11955 if (!((gull == eull) && (errno == een)))
11956 bad++;
11957}
11958int main() {
11959 check(" 1", 1LL, 0);
11960 check(" 0", 0LL, 0);
11961 check("18446744073709551615", 18446744073709551615ULL, 0);
11962 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11963 if (!bad)
11964 printf("ok\n");
11965}
11966EOCP
11967 set try
11968 if eval $compile; then
11969 case "`./try`" in
11970 ok) echo "Your strtoull() seems to be working okay." ;;
11971 *) cat <<EOM >&4
11972Your strtoull() doesn't seem to be working okay.
11973EOM
11974 d_strtoull="$undef"
11975 ;;
11976 esac
11977 fi
11978 ;;
11979esac
11980
11981: see if strtouq exists
11982set strtouq d_strtouq
11983eval $inlibc
11984
11985: see if strxfrm exists
11986set strxfrm d_strxfrm
11987eval $inlibc
11988
11989: see if symlink exists
11990set symlink d_symlink
11991eval $inlibc
11992
11993: see if syscall exists
11994set syscall d_syscall
11995eval $inlibc
11996
11997: see if sysconf exists
11998set sysconf d_sysconf
11999eval $inlibc
12000
12001: see if system exists
12002set system d_system
12003eval $inlibc
12004
12005: see if tcgetpgrp exists
12006set tcgetpgrp d_tcgetpgrp
12007eval $inlibc
12008
12009: see if tcsetpgrp exists
12010set tcsetpgrp d_tcsetpgrp
12011eval $inlibc
12012
12013: see if prototype for telldir is available
12014echo " "
12015set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12016eval $hasproto
12017
12018: see if this is a sys/times.h system
12019set sys/times.h i_systimes
12020eval $inhdr
12021
12022: see if times exists
12023echo " "
12024if set times val -f d_times; eval $csym; $val; then
12025 echo 'times() found.' >&4
12026 d_times="$define"
12027 inc=''
12028 case "$i_systimes" in
12029 "$define") inc='sys/times.h';;
12030 esac
12031 rp="What is the type returned by times() on this system?"
12032 set clock_t clocktype long stdio.h sys/types.h $inc
12033 eval $typedef_ask
12034else
12035 echo 'times() NOT found, hope that will do.' >&4
12036 d_times="$undef"
12037 clocktype='int'
12038fi
12039
12040: see if truncate exists
12041set truncate d_truncate
12042eval $inlibc
12043
12044: see if tzname[] exists
12045echo " "
12046if set tzname val -a d_tzname; eval $csym; $val; then
12047 val="$define"
12048 echo 'tzname[] found.' >&4
12049else
12050 val="$undef"
12051 echo 'tzname[] NOT found.' >&4
12052fi
12053set d_tzname
12054eval $setvar
12055
12056: see if umask exists
12057set umask d_umask
12058eval $inlibc
12059
12060: see if ustat exists
12061set ustat d_ustat
12062eval $inlibc
12063
12064: backward compatibility for d_hvfork
12065if test X$d_hvfork != X; then
12066 d_vfork="$d_hvfork"
12067 d_hvfork=''
12068fi
12069: see if there is a vfork
12070val=''
12071set vfork val
12072eval $inlibc
12073
12074: Ok, but do we want to use it. vfork is reportedly unreliable in
12075: perl on Solaris 2.x, and probably elsewhere.
12076case "$val" in
12077$define)
12078 echo " "
12079 case "$usevfork" in
12080 false) dflt='n';;
12081 *) dflt='y';;
12082 esac
12083 cat <<'EOM'
12084
12085Perl can only use a vfork() that doesn't suffer from strict
12086restrictions on calling functions or modifying global data in
12087the child. For example, glibc-2.1 contains such a vfork()
12088that is unsuitable. If your system provides a proper fork()
12089call, chances are that you do NOT want perl to use vfork().
12090
12091EOM
12092 rp="Do you still want to use vfork()?"
12093 . ./myread
12094 case "$ans" in
12095 y|Y) ;;
12096 *)
12097 echo "Ok, we won't use vfork()."
12098 val="$undef"
12099 ;;
12100 esac
12101 ;;
12102esac
12103set d_vfork
12104eval $setvar
12105case "$d_vfork" in
12106$define) usevfork='true';;
12107*) usevfork='false';;
12108esac
12109
12110: see if this is an sysdir system
12111set sys/dir.h i_sysdir
12112eval $inhdr
12113
12114: see if this is an sysndir system
12115set sys/ndir.h i_sysndir
12116eval $inhdr
12117
12118: see if closedir exists
12119set closedir d_closedir
12120eval $inlibc
12121
12122case "$d_closedir" in
12123"$define")
12124 echo " "
12125 echo "Checking whether closedir() returns a status..." >&4
12126 cat > closedir.c <<EOM
12127#$i_dirent I_DIRENT /**/
12128#$i_sysdir I_SYS_DIR /**/
12129#$i_sysndir I_SYS_NDIR /**/
12130#$i_systypes I_SYS_TYPES /**/
12131
12132#if defined(I_SYS_TYPES)
12133#include <sys/types.h>
12134#endif
12135#if defined(I_DIRENT)
12136#include <dirent.h>
12137#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12138#include <sys/dir.h>
12139#endif
12140#else
12141#ifdef I_SYS_NDIR
12142#include <sys/ndir.h>
12143#else
12144#ifdef I_SYS_DIR
12145#ifdef hp9000s500
12146#include <ndir.h> /* may be wrong in the future */
12147#else
12148#include <sys/dir.h>
12149#endif
12150#endif
12151#endif
12152#endif
12153int main() { return closedir(opendir(".")); }
12154EOM
12155 set closedir
12156 if eval $compile_ok; then
12157 if ./closedir > /dev/null 2>&1 ; then
12158 echo "Yes, it does."
12159 val="$undef"
12160 else
12161 echo "No, it doesn't."
12162 val="$define"
12163 fi
12164 else
12165 echo "(I can't seem to compile the test program--assuming it doesn't)"
12166 val="$define"
12167 fi
12168 ;;
12169*)
12170 val="$undef";
12171 ;;
12172esac
12173set d_void_closedir
12174eval $setvar
12175$rm -f closedir*
b4eb6b3d
JH
12176: see if there is a wait4
12177set wait4 d_wait4
12178eval $inlibc
12179
12180: see if waitpid exists
12181set waitpid d_waitpid
12182eval $inlibc
12183
12184: see if wcstombs exists
12185set wcstombs d_wcstombs
12186eval $inlibc
12187
12188: see if wctomb exists
12189set wctomb d_wctomb
12190eval $inlibc
12191
12192: preserve RCS keywords in files with variable substitution, grrr
12193Date='$Date'
12194Id='$Id'
12195Log='$Log'
12196RCSfile='$RCSfile'
12197Revision='$Revision'
12198
12199case "$crosscompile" in
12200''|[nN]*) crosscompile="$undef" ;;
12201esac
12202
12203case "$osname" in
12204next|rhapsody|darwin) multiarch="$define" ;;
12205esac
12206case "$multiarch" in
12207''|[nN]*) multiarch="$undef" ;;
12208esac
12209
12210: check for alignment requirements
12211echo " "
12212case "$crosscompile$multiarch" in
12213*$define*)
12214 $cat <<EOM
12215You seem to be either cross-compiling or doing a multiarchitecture build,
12216skipping the memory alignment check.
12217
12218EOM
12219 case "$alignbytes" in
12220 '') alignbytes=8 ;;
12221 esac
12222 ;;
12223*)
12224 case "$alignbytes" in
12225 '') echo "Checking alignment constraints..." >&4
12226 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12227 $cat >try.c <<'EOCP'
12228typedef long double NV;
12229EOCP
12230 else
12231 $cat >try.c <<'EOCP'
12232typedef double NV;
12233EOCP
12234 fi
12235 $cat >>try.c <<'EOCP'
12236#include <stdio.h>
12237struct foobar {
12238 char foo;
12239 NV bar;
12240} try_algn;
12241int main()
12242{
12243 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12244 return(0);
12245}
12246EOCP
12247 set try
12248 if eval $compile_ok; then
12249 dflt=`./try`
12250 else
12251 dflt='8'
12252 echo "(I can't seem to compile the test program...)"
12253 fi
12254 ;;
12255 *) dflt="$alignbytes"
12256 ;;
12257 esac
12258 rp="Doubles must be aligned on a how-many-byte boundary?"
12259 . ./myread
12260 alignbytes="$ans"
12261 $rm -f try.c try
12262 ;;
12263esac
12264
12265
12266: set the base revision
12267baserev=5.0
12268
12269: check for ordering of bytes in a long
12270echo " "
12271case "$crosscompile$multiarch" in
12272*$define*)
12273 $cat <<EOM
12274You seem to be either cross-compiling or doing a multiarchitecture build,
12275skipping the byteorder check.
12276
12277EOM
12278 byteorder='0xffff'
12279 ;;
12280*)
12281 case "$byteorder" in
12282 '')
12283 $cat <<'EOM'
12284In the following, larger digits indicate more significance. A big-endian
12285machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12286little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12287machines may have weird orders like 3412. A Cray will report 87654321,
12288an Alpha will report 12345678. If the test program works the default is
12289probably right.
12290I'm now running the test program...
12291EOM
12292 $cat >try.c <<'EOCP'
12293#include <stdio.h>
12294int main()
12295{
12296 int i;
12297 union {
12298 unsigned long l;
12299 char c[sizeof(long)];
12300 } u;
12301
12302 if (sizeof(long) > 4)
12303 u.l = (0x08070605L << 32) | 0x04030201L;
12304 else
12305 u.l = 0x04030201L;
12306 for (i = 0; i < sizeof(long); i++)
12307 printf("%c", u.c[i]+'0');
12308 printf("\n");
12309 exit(0);
12310}
12311EOCP
12312 xxx_prompt=y
12313 set try
12314 if eval $compile && ./try > /dev/null; then
12315 dflt=`./try`
12316 case "$dflt" in
12317 [1-4][1-4][1-4][1-4]|12345678|87654321)
12318 echo "(The test program ran ok.)"
12319 echo "byteorder=$dflt"
12320 xxx_prompt=n
12321 ;;
12322 ????|????????) echo "(The test program ran ok.)" ;;
12323 *) echo "(The test program didn't run right for some reason.)" ;;
12324 esac
12325 else
12326 dflt='4321'
12327 cat <<'EOM'
12328(I can't seem to compile the test program. Guessing big-endian...)
12329EOM
12330 fi
12331 case "$xxx_prompt" in
12332 y)
12333 rp="What is the order of bytes in a long?"
12334 . ./myread
12335 byteorder="$ans"
12336 ;;
12337 *) byteorder=$dflt
12338 ;;
12339 esac
12340 ;;
12341 esac
12342 $rm -f try.c try
12343 ;;
12344esac
12345
12346
12347: how do we catenate cpp tokens here?
12348echo " "
12349echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12350$cat >cpp_stuff.c <<'EOCP'
12351#define RCAT(a,b)a/**/b
12352#define ACAT(a,b)a ## b
12353RCAT(Rei,ser)
12354ACAT(Cir,cus)
12355EOCP
12356$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12357if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12358 echo "Oh! Smells like ANSI's been here." >&4
12359 echo "We can catify or stringify, separately or together!"
12360 cpp_stuff=42
12361elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12362 echo "Ah, yes! The good old days!" >&4
12363 echo "However, in the good old days we don't know how to stringify and"
12364 echo "catify at the same time."
12365 cpp_stuff=1
12366else
12367 $cat >&4 <<EOM
12368Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
12369to have to edit the values of CAT[2-5] in config.h...
12370EOM
12371 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12372fi
12373$rm -f cpp_stuff.*
12374
12375: see if this is a db.h system
12376set db.h i_db
12377eval $inhdr
12378
12379case "$i_db" in
12380$define)
12381 : Check db version.
12382 echo " "
12383 echo "Checking Berkeley DB version ..." >&4
12384 $cat >try.c <<EOCP
12385#$d_const HASCONST
12386#ifndef HASCONST
12387#define const
12388#endif
12389#include <sys/types.h>
12390#include <stdio.h>
12391#include <db.h>
12392int main()
12393{
12394#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12395 int Major, Minor, Patch ;
12396 unsigned long Version ;
12397 (void)db_version(&Major, &Minor, &Patch) ;
12398 printf("You have Berkeley DB Version 2 or greater\n");
12399
12400 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12401 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12402 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12403 Major, Minor, Patch) ;
12404
12405 /* check that db.h & libdb are compatible */
12406 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12407 printf("db.h and libdb are incompatible\n") ;
12408 exit(3);
12409 }
12410
12411 printf("db.h and libdb are compatible\n") ;
12412
12413 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12414 + DB_VERSION_PATCH ;
12415
12416 /* needs to be >= 2.3.4 */
12417 if (Version < 2003004) {
12418 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12419 printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12420 exit(2);
12421 }
12422
12423 exit(0);
12424#else
12425#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12426 printf("You have Berkeley DB Version 1\n");
12427 exit(0); /* DB version < 2: the coast is clear. */
12428#else
12429 exit(1); /* <db.h> not Berkeley DB? */
12430#endif
12431#endif
12432}
12433EOCP
12434 set try
12435 if eval $compile_ok && ./try; then
12436 echo 'Looks OK.' >&4
12437 else
12438 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
12439 i_db=$undef
12440 case " $libs " in
12441 *"-ldb "*)
12442 : Remove db from list of libraries to use
12443 echo "Removing unusable -ldb from library list" >&4
12444 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12445 shift
12446 libs="$*"
12447 echo "libs = $libs" >&4
12448 ;;
12449 esac
12450 fi
12451 $rm -f try.*
12452 ;;
12453esac
12454
12455case "$i_db" in
12456define)
12457 : Check the return type needed for hash
12458 echo " "
12459 echo "Checking return type needed for hash for Berkeley DB ..." >&4
12460 $cat >try.c <<EOCP
12461#$d_const HASCONST
12462#ifndef HASCONST
12463#define const
12464#endif
12465#include <sys/types.h>
12466#include <db.h>
12467
12468#ifndef DB_VERSION_MAJOR
12469u_int32_t hash_cb (ptr, size)
12470const void *ptr;
12471size_t size;
12472{
12473}
12474HASHINFO info;
12475int main()
12476{
12477 info.hash = hash_cb;
12478}
12479#endif
12480EOCP
12481 if $cc $ccflags -c try.c >try.out 2>&1 ; then
12482 if $contains warning try.out >>/dev/null 2>&1 ; then
12483 db_hashtype='int'
12484 else
12485 db_hashtype='u_int32_t'
12486 fi
12487 else
12488 : XXX Maybe we should just give up here.
12489 db_hashtype=u_int32_t
12490 $cat try.out >&4
12491 echo "Help: I can't seem to compile the db test program." >&4
12492 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12493 fi
12494 $rm -f try.*
12495 echo "Your version of Berkeley DB uses $db_hashtype for hash."
12496 ;;
12497*) db_hashtype=u_int32_t
12498 ;;
12499esac
12500case "$i_db" in
12501define)
12502 : Check the return type needed for prefix
12503 echo " "
12504 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12505 cat >try.c <<EOCP
12506#$d_const HASCONST
12507#ifndef HASCONST
12508#define const
12509#endif
12510#include <sys/types.h>
12511#include <db.h>
12512
12513#ifndef DB_VERSION_MAJOR
12514size_t prefix_cb (key1, key2)
12515const DBT *key1;
12516const DBT *key2;
12517{
12518}
12519BTREEINFO info;
12520int main()
12521{
12522 info.prefix = prefix_cb;
12523}
12524#endif
12525EOCP
12526 if $cc $ccflags -c try.c >try.out 2>&1 ; then
12527 if $contains warning try.out >>/dev/null 2>&1 ; then
12528 db_prefixtype='int'
12529 else
12530 db_prefixtype='size_t'
12531 fi
12532 else
12533 db_prefixtype='size_t'
12534 : XXX Maybe we should just give up here.
12535 $cat try.out >&4
12536 echo "Help: I can't seem to compile the db test program." >&4
12537 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12538 fi
12539 $rm -f try.*
12540 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12541 ;;
12542*) db_prefixtype='size_t'
12543 ;;
12544esac
12545
12546: check for void type
12547echo " "
12548echo "Checking to see how well your C compiler groks the void type..." >&4
12549case "$voidflags" in
12550'')
12551 $cat >try.c <<'EOCP'
12552#if TRY & 1
12553void sub() {
12554#else
12555sub() {
12556#endif
12557 extern void moo(); /* function returning void */
12558 void (*goo)(); /* ptr to func returning void */
12559#if TRY & 8
12560 void *hue; /* generic ptr */
12561#endif
12562#if TRY & 2
12563 void (*foo[10])();
12564#endif
12565
12566#if TRY & 4
12567 if(goo == moo) {
12568 exit(0);
12569 }
12570#endif
12571 exit(0);
12572}
12573int main() { sub(); }
12574EOCP
12575 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12576 voidflags=$defvoidused
12577 echo "Good. It appears to support void to the level $package wants.">&4
12578 if $contains warning .out >/dev/null 2>&1; then
12579 echo "However, you might get some warnings that look like this:"
12580 $cat .out
12581 fi
12582 else
12583echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12584 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12585 echo "It supports 1..."
12586 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12587 echo "It also supports 2..."
12588 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12589 voidflags=7
12590 echo "And it supports 4 but not 8 definitely."
12591 else
12592 echo "It doesn't support 4..."
12593 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12594 voidflags=11
12595 echo "But it supports 8."
12596 else
12597 voidflags=3
12598 echo "Neither does it support 8."
12599 fi
12600 fi
12601 else
12602 echo "It does not support 2..."
12603 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12604 voidflags=13
12605 echo "But it supports 4 and 8."
12606 else
12607 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12608 voidflags=5
12609 echo "And it supports 4 but has not heard about 8."
12610 else
12611 echo "However it supports 8 but not 4."
12612 fi
12613 fi
12614 fi
12615 else
12616 echo "There is no support at all for void."
12617 voidflags=0
12618 fi
12619 fi
12620esac
12621case "$voidflags" in
12622"$defvoidused") ;;
12623*) $cat >&4 <<'EOM'
12624 Support flag bits are:
12625 1: basic void declarations.
12626 2: arrays of pointers to functions returning void.
12627 4: operations between pointers to and addresses of void functions.
12628 8: generic void pointers.
12629EOM
12630 dflt="$voidflags";
12631 rp="Your void support flags add up to what?"
12632 . ./myread
12633 voidflags="$ans"
12634 ;;
12635esac
12636$rm -f try.* .out
12637
12638
12639: How can we generate normalized random numbers ?
12640echo " "
12641echo "Looking for a random number function..." >&4
12642case "$randfunc" in
12643'')
12644 if set drand48 val -f; eval $csym; $val; then
12645 dflt="drand48"
12646 echo "Good, found drand48()." >&4
12647 elif set random val -f; eval $csym; $val; then
12648 dflt="random"
12649 echo "OK, found random()." >&4
12650 else
12651 dflt="rand"
12652 echo "Yick, looks like I have to use rand()." >&4
12653 fi
12654 echo " "
12655 ;;
12656*)
12657 dflt="$randfunc"
12658 ;;
12659esac
12660cont=true
12661
12662case "$ccflags" in
12663*-Dmy_rand=*|*-Dmy_srand=*)
12664 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12665 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12666 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12667 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12668 ;;
12669esac
12670
12671while $test "$cont"; do
12672 rp="Use which function to generate random numbers?"
12673 . ./myread
12674 if $test "$ans" = "$dflt"; then
12675 : null
12676 else
12677 randbits=''
12678 fi
12679 randfunc="$ans"
12680 if set $ans val -f; eval $csym; $val; then
12681 cont=''
12682 else
12683 dflt=y
12684 rp="I cannot find function $ans. Use that name anyway?"
12685 . ./myread
12686 dflt=rand
12687 case "$ans" in
12688 [yY]*) cont='';;
12689 esac
12690 fi
12691 case "$cont" in
12692 '')
12693 case "$randfunc" in
12694 drand48)
12695 drand01="drand48()"
12696 seedfunc="srand48"
12697 randbits=48
12698 randseedtype=long
12699 ;;
12700 rand|random)
12701 case "$randbits" in
12702 '')
12703echo "Checking to see how many bits your $randfunc() function produces..." >&4
12704 $cat >try.c <<EOCP
12705#$i_unistd I_UNISTD
12706#$i_stdlib I_STDLIB
12707#include <stdio.h>
12708#ifdef I_UNISTD
12709# include <unistd.h>
12710#endif
12711#ifdef I_STDLIB
12712# include <stdlib.h>
12713#endif
12714int main()
12715{
12716 register int i;
12717 register unsigned long tmp;
12718 register unsigned long max = 0L;
12719
12720 for (i = 1000; i; i--) {
12721 tmp = (unsigned long) $randfunc();
12722 if (tmp > max) max = tmp;
12723 }
12724 for (i = 0; max; i++)
12725 max /= 2;
12726 printf("%d\n",i);
12727}
12728EOCP
12729 set try
12730 if eval $compile_ok; then
12731 dflt=`try`
12732 else
12733 dflt='?'
12734 echo "(I can't seem to compile the test program...)"
12735 fi
12736 ;;
12737 *)
12738 dflt="$randbits"
12739 ;;
12740 esac
12741 rp="How many bits does your $randfunc() function produce?"
12742 . ./myread
12743 randbits="$ans"
12744 $rm -f try.c try
12745 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12746 seedfunc="s$randfunc"
12747 randseedtype=unsigned
12748 ;;
12749 *)
12750 dflt="31"
12751 rp="How many bits does your $randfunc() function produce?"
12752 . ./myread
12753 randbits="$ans"
12754 seedfunc="s$randfunc"
12755 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12756 if set $seedfunc val -f; eval $csym; $val; then
12757 echo "(Using $seedfunc() to seed random generator)"
12758 else
12759 echo "(Warning: no $seedfunc() to seed random generator)"
12760 seedfunc=rand
12761 fi
12762 randseedtype=unsigned
12763 ;;
12764 esac
12765 ;;
12766 esac
12767done
12768
12769echo " "
12770echo "Determining whether or not we are on an EBCDIC system..." >&4
12771$cat >tebcdic.c <<'EOM'
12772int main()
12773{
12774 if ('M'==0xd4) return 0;
12775 return 1;
12776}
12777EOM
12778
12779val=$undef
12780set tebcdic
12781if eval $compile_ok; then
12782 if ./tebcdic; then
12783 echo "You seem to speak EBCDIC." >&4
12784 val="$define"
12785 else
12786 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
12787 fi
12788else
12789 echo "I'm unable to compile the test program." >&4
12790 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
12791fi
12792$rm -f tebcdic.c tebcdic
12793set ebcdic
12794eval $setvar
12795
12796echo " "
12797$cat >&4 <<EOM
12798Checking how to flush all pending stdio output...
12799EOM
12800# I only know how to find the first 32 possibly open files on SunOS.
12801# See also hints/sunos_4_1.sh and util.c --AD
12802case "$osname" in
12803sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12804esac
12805$cat >>try.c <<EOCP
12806#include <stdio.h>
12807#$i_unistd I_UNISTD
12808#ifdef I_UNISTD
12809# include <unistd.h>
12810#endif
12811#$d_sysconf HAS_SYSCONF
12812#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12813#ifdef HAS_STDIO_STREAM_ARRAY
12814# define STDIO_STREAM_ARRAY $stdio_stream_array
12815#endif
12816int main() {
12817 FILE* p = fopen("try.out", "w");
12818#ifdef TRY_FPUTC
12819 fputc('x', p);
12820#else
12821# ifdef TRY_FPRINTF
12822 fprintf(p, "x");
12823# endif
12824#endif
12825#ifdef TRY_FFLUSH_NULL
12826 fflush(NULL);
12827#endif
12828#ifdef TRY_FFLUSH_ALL
12829 {
12830 long open_max = -1;
12831# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12832 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12833# else
12834# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12835 open_max = sysconf(_SC_OPEN_MAX);
12836# else
12837# ifdef FOPEN_MAX
12838 open_max = FOPEN_MAX;
12839# else
12840# ifdef OPEN_MAX
12841 open_max = OPEN_MAX;
12842# else
12843# ifdef _NFILE
12844 open_max = _NFILE;
12845# endif
12846# endif
12847# endif
12848# endif
12849# endif
12850# ifdef HAS_STDIO_STREAM_ARRAY
12851 if (open_max > 0) {
12852 long i;
12853 for (i = 0; i < open_max; i++)
12854 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12855 STDIO_STREAM_ARRAY[i]._file < open_max &&
12856 STDIO_STREAM_ARRAY[i]._flag)
12857 fflush(&STDIO_STREAM_ARRAY[i]);
12858 }
12859 }
12860# endif
12861#endif
12862 _exit(42);
12863}
12864EOCP
12865: first we have to find out how _not_ to flush
12866if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12867 output=''
12868 set try -DTRY_FPUTC
12869 if eval $compile; then
12870 $rm -f try.out
12871 ./try$exe_ext 2>/dev/null
12872 if $test ! -s try.out -a "X$?" = X42; then
12873 output=-DTRY_FPUTC
12874 fi
12875 fi
12876 case "$output" in
12877 '')
12878 set try -DTRY_FPRINTF
12879 $rm -f try.out
12880 if eval $compile; then
12881 $rm -f try.out
12882 ./try$exe_ext 2>/dev/null
12883 if $test ! -s try.out -a "X$?" = X42; then
12884 output=-DTRY_FPRINTF
12885 fi
12886 fi
12887 ;;
12888 esac
12889fi
12890: check for fflush NULL behaviour
12891case "$fflushNULL" in
12892'') set try -DTRY_FFLUSH_NULL $output
12893 if eval $compile; then
12894 $rm -f try.out
12895 ./try$exe_ext 2>/dev/null
12896 code="$?"
12897 if $test -s try.out -a "X$code" = X42; then
12898 fflushNULL="`$cat try.out`"
12899 else
12900 if $test "X$code" != X42; then
12901 $cat >&4 <<EOM
12902(If this test failed, don't worry, we'll try another method shortly.)
12903EOM
12904 fi
12905 fi
12906 fi
12907 $rm -f core try.core core.try.*
12908 case "$fflushNULL" in
12909 x) $cat >&4 <<EOM
12910Your fflush(NULL) works okay for output streams.
12911Let's see if it clobbers input pipes...
12912EOM
12913# As of mid-March 2000 all versions of Solaris appear to have a stdio
12914# bug that improperly flushes the input end of pipes. So we avoid the
12915# autoflush on fork/system/exec support for now. :-(
12916$cat >tryp.c <<EOCP
12917#include <stdio.h>
12918int
12919main(int argc, char **argv)
12920{
12921 char buf[1024];
12922 int i;
12923 char *bp = buf;
12924 while (1) {
12925 while ((i = getc(stdin)) != -1
12926 && (*bp++ = i) != '\n'
12927 && bp < &buf[1024])
12928 /* DO NOTHING */ ;
12929 *bp = '\0';
12930 fprintf(stdout, "%s", buf);
12931 fflush(NULL);
12932 if (i == -1)
12933 return 0;
12934 bp = buf;
12935 }
12936}
12937EOCP
12938 fflushNULL="$define"
12939 set tryp
12940 if eval $compile; then
12941 $rm -f tryp.out
12942 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12943 if cmp tryp.c tryp.out >/dev/null 2>&1; then
12944 $cat >&4 <<EOM
12945fflush(NULL) seems to behave okay with input streams.
12946EOM
12947 fflushNULL="$define"
12948 else
12949 $cat >&4 <<EOM
12950Ouch, fflush(NULL) clobbers input pipes! We will not use it.
12951EOM
12952 fflushNULL="$undef"
12953 fi
12954 fi
12955 $rm -f core tryp.c tryp.core core.tryp.*
12956 ;;
12957 '') $cat >&4 <<EOM
12958Your fflush(NULL) isn't working (contrary to ANSI C).
12959EOM
12960 fflushNULL="$undef"
12961 ;;
12962 *) $cat >&4 <<EOM
12963Cannot figure out whether your fflush(NULL) works or not.
12964I'm assuming it doesn't (contrary to ANSI C).
12965EOM
12966 fflushNULL="$undef"
12967 ;;
12968 esac
12969 ;;
12970$define|true|[yY]*)
12971 fflushNULL="$define"
12972 ;;
12973*)
12974 fflushNULL="$undef"
12975 ;;
12976esac
12977: check explicit looping only if NULL did not work, and if the pipe
12978: bug does not show up on an explicit flush too
12979case "$fflushNULL" in
12980"$undef")
12981 $cat >tryp.c <<EOCP
12982#include <stdio.h>
12983int
12984main(int argc, char **argv)
12985{
12986 char buf[1024];
12987 int i;
12988 char *bp = buf;
12989 while (1) {
12990 while ((i = getc(stdin)) != -1
12991 && (*bp++ = i) != '\n'
12992 && bp < &buf[1024])
12993 /* DO NOTHING */ ;
12994 *bp = '\0';
12995 fprintf(stdout, "%s", buf);
12996 fflush(stdin);
12997 if (i == -1)
12998 return 0;
12999 bp = buf;
13000 }
13001}
13002EOCP
13003 set tryp
13004 if eval $compile; then
13005 $rm -f tryp.out
13006 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13007 if cmp tryp.c tryp.out >/dev/null 2>&1; then
13008 $cat >&4 <<EOM
13009Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13010EOM
13011 : now check for fflushall behaviour
13012 case "$fflushall" in
13013 '') set try -DTRY_FFLUSH_ALL $output
13014 if eval $compile; then
13015 $cat >&4 <<EOM
13016(Now testing the other method--but note that this also may fail.)
13017EOM
13018 $rm -f try.out
13019 ./try$exe_ext 2>/dev/null
13020 if $test -s try.out -a "X$?" = X42; then
13021 fflushall="`$cat try.out`"
13022 fi
13023 fi
13024 $rm -f core try.core core.try.*
13025 case "$fflushall" in
13026 x) $cat >&4 <<EOM
13027Whew. Flushing explicitly all the stdio streams works.
13028EOM
13029 fflushall="$define"
13030 ;;
13031 '') $cat >&4 <<EOM
13032Sigh. Flushing explicitly all the stdio streams doesn't work.
13033EOM
13034 fflushall="$undef"
13035 ;;
13036 *) $cat >&4 <<EOM
13037Cannot figure out whether flushing stdio streams explicitly works or not.
13038I'm assuming it doesn't.
13039EOM
13040 fflushall="$undef"
13041 ;;
13042 esac
13043 ;;
13044 "$define"|true|[yY]*)
13045 fflushall="$define"
13046 ;;
13047 *)
13048 fflushall="$undef"
13049 ;;
13050 esac
13051 else
13052 $cat >&4 <<EOM
13053All is futile. Even fflush(stdin) clobbers input pipes!
13054EOM
13055 fflushall="$undef"
13056 fi
13057 else
13058 fflushall="$undef"
13059 fi
13060 $rm -f core tryp.c tryp.core core.tryp.*
13061 ;;
13062*) fflushall="$undef"
13063 ;;
13064esac
13065
13066case "$fflushNULL$fflushall" in
13067undefundef)
13068 $cat <<EOM
13069OK, I give up. I cannot figure out how to flush pending stdio output.
13070We won't be flushing handles at all before fork/exec/popen.
13071EOM
13072 ;;
13073esac
13074$rm -f try.* try$exe_ext
13075
13076: Store the full pathname to the ar program for use in the C program
13077: Respect a hint or command line value for full_ar.
13078case "$full_ar" in
13079'') full_ar=$ar ;;
13080esac
13081
13082: Store the full pathname to the sed program for use in the C program
13083full_sed=$sed
13084
13085: see what type gids are declared as in the kernel
13086echo " "
13087echo "Looking for the type for group ids returned by getgid()."
13088set gid_t gidtype xxx stdio.h sys/types.h
13089eval $typedef
13090case "$gidtype" in
13091xxx)
13092 xxx=`./findhdr sys/user.h`
13093 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13094 case $1 in
13095 unsigned) dflt="$1 $2" ;;
13096 *) dflt="$1" ;;
13097 esac
13098 ;;
13099*) dflt="$gidtype";;
13100esac
13101case "$gidtype" in
13102gid_t) echo "gid_t found." ;;
13103*) rp="What is the type for group ids returned by getgid()?"
13104 . ./myread
13105 gidtype="$ans"
13106 ;;
13107esac
13108
13109echo " "
13110case "$gidtype" in
13111*_t) zzz="$gidtype" ;;
13112*) zzz="gid" ;;
13113esac
13114echo "Checking the size of $zzz..." >&4
13115cat > try.c <<EOCP
13116#include <sys/types.h>
13117#include <stdio.h>
13118int main() {
13119 printf("%d\n", (int)sizeof($gidtype));
13120 exit(0);
13121}
13122EOCP
13123set try
13124if eval $compile_ok; then
13125 yyy=`./try`
13126 case "$yyy" in
13127 '') gidsize=4
13128 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13129 ;;
13130 *) gidsize=$yyy
13131 echo "Your $zzz is $gidsize bytes long."
13132 ;;
13133 esac
13134else
13135 gidsize=4
13136 echo "(I can't compile the test program--guessing $gidsize.)" >&4
13137fi
13138
13139
13140echo " "
13141case "$gidtype" in
13142*_t) zzz="$gidtype" ;;
13143*) zzz="gid" ;;
13144esac
13145echo "Checking the sign of $zzz..." >&4
13146cat > try.c <<EOCP
13147#include <sys/types.h>
13148#include <stdio.h>
13149int main() {
13150 $gidtype foo = -1;
13151 if (foo < 0)
13152 printf("-1\n");
13153 else
13154 printf("1\n");
13155}
13156EOCP
13157set try
13158if eval $compile; then
13159 yyy=`./try`
13160 case "$yyy" in
13161 '') gidsign=1
13162 echo "(I can't execute the test program--guessing unsigned.)" >&4
13163 ;;
13164 *) gidsign=$yyy
13165 case "$gidsign" in
13166 1) echo "Your $zzz is unsigned." ;;
13167 -1) echo "Your $zzz is signed." ;;
13168 esac
13169 ;;
13170 esac
13171else
13172 gidsign=1
13173 echo "(I can't compile the test program--guessing unsigned.)" >&4
13174fi
13175
13176
13177echo " "
13178
13179if $test X"$quadtype" != X; then
13180
13181echo "Checking how to print 64-bit integers..." >&4
13182
13183if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13184 $cat >try.c <<'EOCP'
13185#include <sys/types.h>
13186#include <stdio.h>
13187int main() {
13188 int q = 12345678901;
13189 printf("%ld\n", q);
13190}
13191EOCP
13192 set try
13193 if eval $compile; then
13194 yyy=`./try$exe_ext`
13195 case "$yyy" in
13196 12345678901)
13197 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13198 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13199 echo "We will use %d."
13200 ;;
13201 esac
13202 fi
13203fi
13204
13205if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13206 $cat >try.c <<'EOCP'
13207#include <sys/types.h>
13208#include <stdio.h>
13209int main() {
13210 long q = 12345678901;
13211 printf("%ld\n", q);
13212}
13213EOCP
13214 set try
13215 if eval $compile; then
13216 yyy=`./try$exe_ext`
13217 case "$yyy" in
13218 12345678901)
13219 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13220 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13221 echo "We will use %ld."
13222 ;;
13223 esac
13224 fi
13225fi
13226
13227if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13228 $cat >try.c <<'EOCP'
13229#include <sys/types.h>
13230#include <inttypes.h>
13231#include <stdio.h>
13232int main() {
13233 int64_t q = 12345678901;
13234 printf("%" PRId64 "\n", q);
13235}
13236EOCP
13237 set try
13238 if eval $compile; then
13239 yyy=`./try$exe_ext`
13240 case "$yyy" in
13241 12345678901)
13242 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13243 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13244 echo "We will use the C9X style."
13245 ;;
13246 esac
13247 fi
13248fi
13249
13250if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13251 $cat >try.c <<'EOCP'
13252#include <sys/types.h>
13253#include <stdio.h>
13254int main() {
13255 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13256 printf("%lld\n", q);
13257}
13258EOCP
13259 set try
13260 if eval $compile; then
13261 yyy=`./try$exe_ext`
13262 case "$yyy" in
13263 12345678901)
13264 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13265 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13266 echo "We will use the %lld style."
13267 ;;
13268 esac
13269 fi
13270fi
13271
13272if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13273 $cat >try.c <<EOCP
13274#include <sys/types.h>
13275#include <stdio.h>
13276int main() {
13277 $quadtype q = 12345678901;
13278 printf("%Ld\n", q);
13279}
13280EOCP
13281 set try
13282 if eval $compile; then
13283 yyy=`./try$exe_ext`
13284 case "$yyy" in
13285 12345678901)
13286 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13287 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13288 echo "We will use %Ld."
13289 ;;
13290 esac
13291 fi
13292fi
13293
13294if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13295 $cat >try.c <<EOCP
13296#include <sys/types.h>
13297#include <stdio.h>
13298int main() {
13299 $quadtype q = 12345678901;
13300 printf("%qd\n", q);
13301}
13302EOCP
13303 set try
13304 if eval $compile; then
13305 yyy=`./try$exe_ext`
13306 case "$yyy" in
13307 12345678901)
13308 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13309 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13310 echo "We will use %qd."
13311 ;;
13312 esac
13313 fi
13314fi
13315
13316if $test X"$sPRId64" = X; then
13317 echo "Cannot figure out how to print 64-bit integers." >&4
13318fi
13319
13320$rm -f try try.*
13321
13322fi
13323
13324case "$sPRId64" in
13325'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
13326 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
13327 ;;
13328*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
13329 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
13330 ;;
13331esac
13332
13333
13334echo " "
13335$echo "Checking the format strings to be used for Perl's internal types..." >&4
13336
13337if $test X"$ivsize" = X8; then
13338 ivdformat="$sPRId64"
13339 uvuformat="$sPRIu64"
13340 uvoformat="$sPRIo64"
13341 uvxformat="$sPRIx64"
13342 uvXUformat="$sPRIXU64"
13343else
13344 if $test X"$ivsize" = X"$longsize"; then
13345 ivdformat='"ld"'
13346 uvuformat='"lu"'
13347 uvoformat='"lo"'
13348 uvxformat='"lx"'
13349 uvXUformat='"lX"'
13350 else
13351 if $test X"$ivsize" = X"$intsize"; then
13352 ivdformat='"d"'
13353 uvuformat='"u"'
13354 uvoformat='"o"'
13355 uvxformat='"x"'
13356 uvXUformat='"X"'
13357 else
13358 : far out
13359 if $test X"$ivsize" = X"$shortsize"; then
13360 ivdformat='"hd"'
13361 uvuformat='"hu"'
13362 uvoformat='"ho"'
13363 uvxformat='"hx"'
13364 uvXUformat='"hX"'
13365 fi
13366 fi
13367 fi
13368fi
13369
13370if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13371 nveformat="$sPRIeldbl"
13372 nvfformat="$sPRIfldbl"
13373 nvgformat="$sPRIgldbl"
13374 nvEUformat="$sPRIEUldbl"
13375 nvFUformat="$sPRIFUldbl"
13376 nvGUformat="$sPRIGUldbl"
13377else
13378 nveformat='"e"'
13379 nvfformat='"f"'
13380 nvgformat='"g"'
13381 nvEUformat='"E"'
13382 nvFUformat='"F"'
13383 nvGUformat='"G"'
13384fi
13385
13386case "$ivdformat" in
13387'') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13388 exit 1
13389 ;;
13390esac
13391
13392
13393echo " "
13394$echo "Checking the format string to be used for gids..." >&4
13395
13396case "$gidsign" in
13397-1) if $test X"$gidsize" = X"$ivsize"; then
13398 gidformat="$ivdformat"
13399 else
13400 if $test X"$gidsize" = X"$longsize"; then
13401 gidformat='"ld"'
13402 else
13403 if $test X"$gidsize" = X"$intsize"; then
13404 gidformat='"d"'
13405 else
13406 if $test X"$gidsize" = X"$shortsize"; then
13407 gidformat='"hd"'
13408 fi
13409 fi
13410 fi
13411 fi
13412 ;;
13413*) if $test X"$gidsize" = X"$uvsize"; then
13414 gidformat="$uvuformat"
13415 else
13416 if $test X"$gidsize" = X"$longsize"; then
13417 gidformat='"lu"'
13418 else
13419 if $test X"$gidsize" = X"$intsize"; then
13420 gidformat='"u"'
13421 else
13422 if $test X"$gidsize" = X"$shortsize"; then
13423 gidformat='"hu"'
13424 fi
13425 fi
13426 fi
13427 fi
13428 ;;
13429esac
13430
13431: see if getgroups exists
13432set getgroups d_getgrps
13433eval $inlibc
13434
13435: see if setgroups exists
13436set setgroups d_setgrps
13437eval $inlibc
13438
13439
13440: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13441echo " "
13442case "$d_getgrps$d_setgrps" in
13443*define*)
13444 case "$groupstype" in
13445 '') dflt="$gidtype" ;;
13446 *) dflt="$groupstype" ;;
13447 esac
13448 $cat <<EOM
13449What type of pointer is the second argument to getgroups() and setgroups()?
13450Usually this is the same as group ids, $gidtype, but not always.
13451
13452EOM
13453 rp='What type pointer is the second argument to getgroups() and setgroups()?'
13454 . ./myread
13455 groupstype="$ans"
13456 ;;
13457*) groupstype="$gidtype";;
13458esac
13459
13460echo " "
13461echo "Checking if your $make program sets \$(MAKE)..." >&4
13462case "$make_set_make" in
13463'')
13464 $sed 's/^X //' > testmake.mak << 'EOF'
13465Xall:
13466X @echo 'maketemp="$(MAKE)"'
13467EOF
13468 case "`$make -f testmake.mak 2>/dev/null`" in
13469 *maketemp=*) make_set_make='#' ;;
13470 *) make_set_make="MAKE=$make" ;;
13471 esac
13472 $rm -f testmake.mak
13473 ;;
13474esac
13475case "$make_set_make" in
13476'#') echo "Yup, it does.";;
13477*) echo "Nope, it doesn't.";;
13478esac
13479
13480: see what type is used for mode_t
13481rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13482set mode_t modetype int stdio.h sys/types.h
13483eval $typedef_ask
13484
2cc61e15
DD
13485: see if stdarg is available
13486echo " "
13487if $test `./findhdr stdarg.h`; then
13488 echo "<stdarg.h> found." >&4
13489 valstd="$define"
13490else
13491 echo "<stdarg.h> NOT found." >&4
13492 valstd="$undef"
13493fi
13494
13495: see if varags is available
13496echo " "
13497if $test `./findhdr varargs.h`; then
13498 echo "<varargs.h> found." >&4
13499else
13500 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13501fi
13502
13503: set up the varargs testing programs
13504$cat > varargs.c <<EOP
13505#ifdef I_STDARG
13506#include <stdarg.h>
13507#endif
13508#ifdef I_VARARGS
13509#include <varargs.h>
13510#endif
13511
13512#ifdef I_STDARG
13513int f(char *p, ...)
13514#else
13515int f(va_alist)
13516va_dcl
13517#endif
13518{
13519 va_list ap;
13520#ifndef I_STDARG
13521 char *p;
13522#endif
13523#ifdef I_STDARG
13524 va_start(ap,p);
13525#else
13526 va_start(ap);
13527 p = va_arg(ap, char *);
13528#endif
13529 va_end(ap);
13530}
13531EOP
13532$cat > varargs <<EOP
13533$startsh
13534if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13535 echo "true"
13536else
13537 echo "false"
13538fi
13539$rm -f varargs$_o
13540EOP
13541chmod +x varargs
13542
13543: now check which varargs header should be included
13544echo " "
13545i_varhdr=''
13546case "$valstd" in
13547"$define")
13548 if `./varargs I_STDARG`; then
13549 val='stdarg.h'
13550 elif `./varargs I_VARARGS`; then
13551 val='varargs.h'
13552 fi
13553 ;;
13554*)
13555 if `./varargs I_VARARGS`; then
13556 val='varargs.h'
13557 fi
13558 ;;
13559esac
13560case "$val" in
13561'')
13562echo "I could not find the definition for va_dcl... You have problems..." >&4
13563 val="$undef"; set i_stdarg; eval $setvar
13564 val="$undef"; set i_varargs; eval $setvar
13565 ;;
13566*)
13567 set i_varhdr
13568 eval $setvar
13569 case "$i_varhdr" in
13570 stdarg.h)
13571 val="$define"; set i_stdarg; eval $setvar
13572 val="$undef"; set i_varargs; eval $setvar
13573 ;;
13574 varargs.h)
13575 val="$undef"; set i_stdarg; eval $setvar
13576 val="$define"; set i_varargs; eval $setvar
13577 ;;
13578 esac
13579 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13580esac
13581$rm -f varargs*
13582
13583: see if we need va_copy
13584echo " "
13585case "$i_stdarg" in
13586"$define")
13587 $cat >try.c <<EOCP
13588#include <stdarg.h>
13589#include <stdio.h>
85c8a686
DD
13590#$i_stdlib I_STDLIB
13591#ifdef I_STDLIB
13592#include <stdlib.h>
13593#endif
13594#include <signal.h>
2cc61e15
DD
13595
13596int
13597ivfprintf(FILE *f, const char *fmt, va_list *valp)
13598{
13599 return vfprintf(f, fmt, *valp);
13600}
13601
13602int
13603myvfprintf(FILE *f, const char *fmt, va_list val)
13604{
13605 return ivfprintf(f, fmt, &val);
13606}
13607
13608int
13609myprintf(char *fmt, ...)
13610{
13611 va_list val;
13612 va_start(val, fmt);
13613 return myvfprintf(stdout, fmt, val);
13614}
13615
13616int
13617main(int ac, char **av)
13618{
85c8a686
DD
13619 signal(SIGSEGV, exit);
13620
2cc61e15
DD
13621 myprintf("%s%cs all right, then\n", "that", '\'');
13622 exit(0);
13623}
13624EOCP
13625 set try
d50de4df 13626 if eval $compile && ./try 2>&1 >/dev/null; then
2cc61e15
DD
13627 case "`./try`" in
13628 "that's all right, then")
13629 okay=yes
13630 ;;
13631 esac
13632 fi
13633 case "$okay" in
13634 yes) echo "It seems that you don't need va_copy()." >&4
13635 need_va_copy="$undef"
13636 ;;
13637 *) echo "It seems that va_copy() or similar will be needed." >&4
13638 need_va_copy="$define"
13639 ;;
13640 esac
13641 $rm -f try.* core core.* *.core *.core.*
13642 ;;
13643*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
13644 ;;
13645esac
13646
b4eb6b3d
JH
13647: define a fucntion to check prototypes
13648$cat > protochk <<EOSH
13649$startsh
13650cc="$cc"
13651optimize="$optimize"
13652ccflags="$ccflags"
13653prototype="$prototype"
13654define="$define"
13655rm=$rm
13656EOSH
13657
13658$cat >> protochk <<'EOSH'
13659
13660$rm -f try.c
13661foo="$1"
13662shift
13663while test $# -ge 2; do
13664 case "$1" in
13665 $define) echo "#include <$2>" >> try.c ;;
13666 literal) echo "$2" >> try.c ;;
13667 esac
13668 shift 2
13669done
13670test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
13671cat >> try.c <<'EOCP'
13672#ifdef CAN_PROTOTYPE
13673#define _(args) args
13674#else
13675#define _(args) ()
13676#endif
13677EOCP
13678echo "$foo" >> try.c
13679echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13680$cc $optimize $ccflags -c try.c > /dev/null 2>&1
13681status=$?
13682$rm -f try.[co]
13683exit $status
13684EOSH
13685chmod +x protochk
13686$eunicefix protochk
13687
13688: see what type is used for size_t
13689rp="What is the type used for the length parameter for string functions?"
13690set size_t sizetype 'unsigned int' stdio.h sys/types.h
13691eval $typedef_ask
13692
13693: check for type of arguments to gethostbyaddr.
13694if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13695 case "$d_gethbyaddr" in
13696 $define)
13697 $cat <<EOM
13698
13699Checking to see what type of arguments are accepted by gethostbyaddr().
13700EOM
13701 hdrs="$define sys/types.h
13702 $d_socket sys/socket.h
13703 $i_niin netinet/in.h
13704 $i_netdb netdb.h
13705 $i_unistd unistd.h"
13706 : The first arg can 'char *' or 'void *'
13707 : The second arg is some of integral type
13708 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13709 for yyy in size_t long int; do
13710 case "$netdb_host_type" in
13711 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13712 if ./protochk "$try" $hdrs; then
13713 echo "Your system accepts $xxx for the first arg."
13714 echo "...and $yyy for the second arg."
13715 netdb_host_type="$xxx"
13716 netdb_hlen_type="$yyy"
13717 fi
13718 ;;
13719 esac
13720 done
13721 done
13722 : In case none of those worked, prompt the user.
13723 case "$netdb_host_type" in
13724 '') rp='What is the type for the 1st argument to gethostbyaddr?'
13725 dflt='char *'
13726 . ./myread
13727 netdb_host_type=$ans
13728 rp='What is the type for the 2nd argument to gethostbyaddr?'
13729 dflt="$sizetype"
13730 . ./myread
13731 netdb_hlen_type=$ans
13732 ;;
13733 esac
13734 ;;
13735 *) : no gethostbyaddr, so pick harmless defaults
13736 netdb_host_type='char *'
13737 netdb_hlen_type="$sizetype"
13738 ;;
13739 esac
13740 # Remove the "const" if needed. -- but then we'll have a
13741 # prototype clash!
13742 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13743fi
13744
13745: check for type of argument to gethostbyname.
13746if test "X$netdb_name_type" = X ; then
13747 case "$d_gethbyname" in
13748 $define)
13749 $cat <<EOM
13750
13751Checking to see what type of argument is accepted by gethostbyname().
13752EOM
13753 hdrs="$define sys/types.h
13754 $d_socket sys/socket.h
13755 $i_niin netinet/in.h
13756 $i_netdb netdb.h
13757 $i_unistd unistd.h"
13758 for xxx in "const char *" "char *"; do
13759 case "$netdb_name_type" in
13760 '') try="extern struct hostent *gethostbyname($xxx);"
13761 if ./protochk "$try" $hdrs; then
13762 echo "Your system accepts $xxx."
13763 netdb_name_type="$xxx"
13764 fi
13765 ;;
13766 esac
13767 done
13768 : In case none of those worked, prompt the user.
13769 case "$netdb_name_type" in
13770 '') rp='What is the type for the 1st argument to gethostbyname?'
13771 dflt='char *'
13772 . ./myread
13773 netdb_name_type=$ans
13774 ;;
13775 esac
13776 ;;
13777 *) : no gethostbyname, so pick harmless default
13778 netdb_name_type='char *'
13779 ;;
13780 esac
13781fi
13782
13783: check for type of 1st argument to getnetbyaddr.
13784if test "X$netdb_net_type" = X ; then
13785 case "$d_getnbyaddr" in
13786 $define)
13787 $cat <<EOM
13788
13789Checking to see what type of 1st argument is accepted by getnetbyaddr().
13790EOM
13791 hdrs="$define sys/types.h
13792 $d_socket sys/socket.h
13793 $i_niin netinet/in.h
13794 $i_netdb netdb.h
13795 $i_unistd unistd.h"
13796 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13797 case "$netdb_net_type" in
13798 '') try="extern struct netent *getnetbyaddr($xxx, int);"
13799 if ./protochk "$try" $hdrs; then
13800 echo "Your system accepts $xxx."
13801 netdb_net_type="$xxx"
13802 fi
13803 ;;
13804 esac
13805 done
13806 : In case none of those worked, prompt the user.
13807 case "$netdb_net_type" in
13808 '') rp='What is the type for the 1st argument to getnetbyaddr?'
13809 dflt='long'
13810 . ./myread
13811 netdb_net_type=$ans
13812 ;;
13813 esac
13814 ;;
13815 *) : no getnetbyaddr, so pick harmless default
13816 netdb_net_type='long'
13817 ;;
13818 esac
13819fi
13820: locate the preferred pager for this system
13821case "$pager" in
13822'')
13823 dflt=''
13824 case "$pg" in
13825 /*) dflt=$pg;;
13826 [a-zA-Z]:/*) dflt=$pg;;
13827 esac
13828 case "$more" in
13829 /*) dflt=$more;;
13830 [a-zA-Z]:/*) dflt=$more;;
13831 esac
13832 case "$less" in
13833 /*) dflt=$less;;
13834 [a-zA-Z]:/*) dflt=$less;;
13835 esac
13836 case "$dflt" in
13837 '') dflt=/usr/ucb/more;;
13838 esac
13839 ;;
13840*) dflt="$pager";;
13841esac
13842echo " "
13843fn=f/
13844rp='What pager is used on your system?'
13845. ./getfile
13846pager="$ans"
13847
13848: see what type pids are declared as in the kernel
13849rp="What is the type of process ids on this system?"
13850set pid_t pidtype int stdio.h sys/types.h
13851eval $typedef_ask
13852
13853: Find earliest binary compatible site_perl subdirectory perl can use.
13854case "$bincompat5005" in
13855"$define") xs_apiversion='5.005' ;;
13856*) xs_apiversion=$version ;; # The current site_perl version.
13857esac
13858: Find earliest pure perl site_perl subdirectory perl can use.
13859: The versioned directories started at 5.005.
13860pm_apiversion='5.005'
13861
13862: check for length of pointer
13863echo " "
13864case "$ptrsize" in
13865'')
13866 echo "Checking to see how big your pointers are..." >&4
13867 if test "$voidflags" -gt 7; then
13868 echo '#define VOID_PTR char *' > try.c
13869 else
13870 echo '#define VOID_PTR void *' > try.c
13871 fi
13872 $cat >>try.c <<'EOCP'
13873#include <stdio.h>
13874int main()
13875{
13876 printf("%d\n", (int)sizeof(VOID_PTR));
13877 exit(0);
13878}
13879EOCP
13880 set try
13881 if eval $compile_ok; then
13882 ptrsize=`./try`
13883 echo "Your pointers are $ptrsize bytes long."
13884 else
13885 dflt='4'
13886 echo "(I can't seem to compile the test program. Guessing...)" >&4
13887 rp="What is the size of a pointer (in bytes)?"
13888 . ./myread
13889 ptrsize="$ans"
13890 fi
13891 ;;
13892esac
13893$rm -f try.c try
13894
13895: see if ar generates random libraries by itself
13896echo " "
13897echo "Checking how to generate random libraries on your machine..." >&4
13898echo 'int bar1() { return bar2(); }' > bar1.c
13899echo 'int bar2() { return 2; }' > bar2.c
13900$cat > foo.c <<'EOP'
13901int main() { printf("%d\n", bar1()); exit(0); }
13902EOP
13903$cc $ccflags -c bar1.c >/dev/null 2>&1
13904$cc $ccflags -c bar2.c >/dev/null 2>&1
13905$cc $ccflags -c foo.c >/dev/null 2>&1
13906$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 13907if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
b4eb6b3d
JH
13908 ./foobar >/dev/null 2>&1; then
13909 echo "$ar appears to generate random libraries itself."
13910 orderlib=false
13911 ranlib=":"
13912elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 13913 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
b4eb6b3d
JH
13914 ./foobar >/dev/null 2>&1; then
13915 echo "a table of contents needs to be added with '$ar ts'."
13916 orderlib=false
13917 ranlib="$ar ts"
13918else
13919 case "$ranlib" in
13920 :) ranlib='';;
13921 '')
13922 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13923 $test -f $ranlib || ranlib=''
13924 ;;
13925 esac
13926 if $test -n "$ranlib"; then
13927 echo "your system has '$ranlib'; we'll use that."
13928 orderlib=false
13929 else
13930 echo "your system doesn't seem to support random libraries"
13931 echo "so we'll use lorder and tsort to order the libraries."
13932 orderlib=true
13933 ranlib=":"
13934 fi
13935fi
13936$rm -f foo* bar*
13937
13938: check for type of arguments to select.
13939case "$selecttype" in
13940'') case "$d_select" in
13941 $define)
13942 echo " "
13943 $cat <<EOM
13944Checking to see what type of arguments are accepted by select().
13945EOM
13946 hdrs="$define sys/types.h
13947 $i_systime sys/time.h
13948 $i_sysselct sys/select.h
13949 $d_socket sys/socket.h"
13950 : The first arg can be int, unsigned, or size_t
13951 : The last arg may or may not be 'const'
13952 val=''
13953 : void pointer has been seen but using that
13954 : breaks the selectminbits test
13955 for xxx in 'fd_set *' 'int *'; do
13956 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13957 for tmo in 'struct timeval *' 'const struct timeval *'; do
13958 case "$val" in
13959 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13960 if ./protochk "$try" $hdrs; then
13961 echo "Your system accepts $xxx."
13962 val="$xxx"
13963 fi
13964 ;;
13965 esac
13966 done
13967 done
13968 done
13969 case "$val" in
13970 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13971 case "$d_fd_set" in
13972 $define) dflt="fd_set *" ;;
13973 *) dflt="int *" ;;
13974 esac
13975 . ./myread
13976 val=$ans
13977 ;;
13978 esac
13979 selecttype="$val"
13980 ;;
13981 *) : no select, so pick a harmless default
13982 selecttype='int *'
13983 ;;
13984 esac
13985 ;;
13986esac
13987
13988: check for the select 'width'
13989case "$selectminbits" in
13990'') case "$d_select" in
13991 $define)
13992 $cat <<EOM
13993
13994Checking to see on how many bits at a time your select() operates...
13995EOM
13996 $cat >try.c <<EOCP
13997#include <sys/types.h>
13998#$i_time I_TIME
13999#$i_systime I_SYS_TIME
14000#$i_systimek I_SYS_TIME_KERNEL
14001#ifdef I_TIME
14002# include <time.h>
14003#endif
14004#ifdef I_SYS_TIME
14005# ifdef I_SYS_TIME_KERNEL
14006# define KERNEL
14007# endif
14008# include <sys/time.h>
14009# ifdef I_SYS_TIME_KERNEL
14010# undef KERNEL
14011# endif
14012#endif
14013#$i_sysselct I_SYS_SELECT
14014#ifdef I_SYS_SELECT
14015#include <sys/select.h>
14016#endif
14017#$d_socket HAS_SOCKET
14018#ifdef HAS_SOCKET
14019# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14020#endif
14021#include <stdio.h>
14022$selecttype b;
14023#define S sizeof(*(b))
14024#define MINBITS 64
14025#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14026#define NBITS (NBYTES * 8)
14027int main() {
14028 char s[NBYTES];
14029 struct timeval t;
14030 int i;
14031 FILE* fp;
14032 int fd;
14033
14034 fclose(stdin);
14035 fp = fopen("try.c", "r");
14036 if (fp == 0)
14037 exit(1);
14038 fd = fileno(fp);
14039 if (fd < 0)
14040 exit(2);
14041 b = ($selecttype)s;
14042 for (i = 0; i < NBITS; i++)
14043 FD_SET(i, b);
14044 t.tv_sec = 0;
14045 t.tv_usec = 0;
14046 select(fd + 1, b, 0, 0, &t);
14047 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14048 printf("%d\n", i + 1);
14049 return 0;
14050}
14051EOCP
14052 set try
14053 if eval $compile_ok; then
14054 selectminbits=`./try`
14055 case "$selectminbits" in
14056 '') cat >&4 <<EOM
14057Cannot figure out on how many bits at a time your select() operates.
14058I'll play safe and guess it is 32 bits.
14059EOM
14060 selectminbits=32
14061 bits="32 bits"
14062 ;;
14063 1) bits="1 bit" ;;
14064 *) bits="$selectminbits bits" ;;
14065 esac
14066 echo "Your select() operates on $bits at a time." >&4
14067 else
14068 rp='What is the minimum number of bits your select() operates on?'
14069 case "$byteorder" in
14070 1234|12345678) dflt=32 ;;
14071 *) dflt=1 ;;
14072 esac
14073 . ./myread
14074 val=$ans
14075 selectminbits="$val"
14076 fi
14077 $rm -f try.* try
14078 ;;
14079 *) : no select, so pick a harmless default
14080 selectminbits='32'
14081 ;;
14082 esac
14083 ;;
14084esac
14085
14086: Trace out the files included by signal.h, then look for SIGxxx names.
14087: Remove SIGARRAYSIZE used by HPUX.
14088: Remove SIGSTKSIZE used by Linux.
14089: Remove SIGSTKSZ used by Posix.
14090: Remove SIGTYP void lines used by OS2.
14091: Some cpps, like os390, dont give the file name anywhere
14092if [ "X$fieldn" = X ]; then
14093 : Just make some guesses. We check them later.
14094 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14095else
14096 xxx=`echo '#include <signal.h>' |
14097 $cppstdin $cppminus $cppflags 2>/dev/null |
14098 $grep '^[ ]*#.*include' |
14099 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
14100fi
14101: Check this list of files to be sure we have parsed the cpp output ok.
14102: This will also avoid potentially non-existent files, such
14103: as ../foo/bar.h
14104xxxfiles=''
14105for xx in $xxx /dev/null ; do
14106 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14107done
14108: If we have found no files, at least try signal.h
14109case "$xxxfiles" in
14110'') xxxfiles=`./findhdr signal.h` ;;
14111esac
14112xxx=`awk '
14113$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14114 print substr($2, 4, 20)
14115}
14116$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14117 print substr($3, 4, 20)
14118}' $xxxfiles`
14119: Append some common names just in case the awk scan failed.
14120xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14121xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14122xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14123xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14124xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14125
14126: generate a few handy files for later
14127$cat > signal.c <<'EOCP'
14128#include <sys/types.h>
14129#include <signal.h>
14130#include <stdio.h>
14131int main() {
14132
14133/* Strange style to avoid deeply-nested #if/#else/#endif */
14134#ifndef NSIG
14135# ifdef _NSIG
14136# define NSIG (_NSIG)
14137# endif
14138#endif
14139
14140#ifndef NSIG
14141# ifdef SIGMAX
14142# define NSIG (SIGMAX+1)
14143# endif
14144#endif
14145
14146#ifndef NSIG
14147# ifdef SIG_MAX
14148# define NSIG (SIG_MAX+1)
14149# endif
14150#endif
14151
14152#ifndef NSIG
14153# ifdef MAXSIG
14154# define NSIG (MAXSIG+1)
14155# endif
14156#endif
14157
14158#ifndef NSIG
14159# ifdef MAX_SIG
14160# define NSIG (MAX_SIG+1)
14161# endif
14162#endif
14163
14164#ifndef NSIG
14165# ifdef SIGARRAYSIZE
14166# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14167# endif
14168#endif
14169
14170#ifndef NSIG
14171# ifdef _sys_nsig
14172# define NSIG (_sys_nsig) /* Solaris 2.5 */
14173# endif
14174#endif
14175
14176/* Default to some arbitrary number that's big enough to get most
14177 of the common signals.
14178*/
14179#ifndef NSIG
14180# define NSIG 50
14181#endif
14182
14183printf("NSIG %d\n", NSIG);
14184
14185#ifndef JUST_NSIG
14186
14187EOCP
14188
14189echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14190{
14191 printf "#ifdef SIG"; printf $1; printf "\n"
14192 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14193 printf $1; printf ");\n"
14194 printf "#endif\n"
14195}
14196END {
14197 printf "#endif /* JUST_NSIG */\n";
14198 printf "exit(0);\n}\n";
14199}
14200' >>signal.c
14201$cat >signal.awk <<'EOP'
14202BEGIN { ndups = 0 }
14203$1 ~ /^NSIG$/ { nsig = $2 }
14204($1 !~ /^NSIG$/) && (NF == 2) {
14205 if ($2 > maxsig) { maxsig = $2 }
14206 if (sig_name[$2]) {
14207 dup_name[ndups] = $1
14208 dup_num[ndups] = $2
14209 ndups++
14210 }
14211 else {
14212 sig_name[$2] = $1
14213 sig_num[$2] = $2
14214 }
14215}
14216END {
14217 if (nsig == 0) {
14218 nsig = maxsig + 1
14219 }
14220 printf("NSIG %d\n", nsig);
14221 for (n = 1; n < nsig; n++) {
14222 if (sig_name[n]) {
14223 printf("%s %d\n", sig_name[n], sig_num[n])
14224 }
14225 else {
14226 printf("NUM%d %d\n", n, n)
14227 }
14228 }
14229 for (n = 0; n < ndups; n++) {
14230 printf("%s %d\n", dup_name[n], dup_num[n])
14231 }
14232}
14233EOP
14234$cat >signal_cmd <<EOS
14235$startsh
14236if $test -s signal.lst; then
14237 echo "Using your existing signal.lst file"
14238 exit 0
14239fi
14240xxx="$xxx"
14241EOS
14242$cat >>signal_cmd <<'EOS'
14243
14244set signal
14245if eval $compile_ok; then
14246 ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14247else
14248 echo "(I can't seem be able to compile the whole test program)" >&4
14249 echo "(I'll try it in little pieces.)" >&4
14250 set signal -DJUST_NSIG
14251 if eval $compile_ok; then
14252 ./signal$_exe > signal.nsg
14253 $cat signal.nsg
14254 else
14255 echo "I can't seem to figure out how many signals you have." >&4
14256 echo "Guessing 50." >&4
14257 echo 'NSIG 50' > signal.nsg
14258 fi
14259 : Now look at all the signal names, one at a time.
14260 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14261 $cat > signal.c <<EOCP
14262#include <sys/types.h>
14263#include <signal.h>
14264#include <stdio.h>
14265int main() {
14266printf("$xx %d\n", SIG${xx});
14267return 0;
14268}
14269EOCP
14270 set signal
14271 if eval $compile; then
14272 echo "SIG${xx} found."
14273 ./signal$_exe >> signal.ls1
14274 else
14275 echo "SIG${xx} NOT found."
14276 fi
14277 done
14278 if $test -s signal.ls1; then
14279 $cat signal.nsg signal.ls1 |
14280 $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14281 fi
14282
14283fi
14284if $test -s signal.lst; then
14285 :
14286else
14287 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14288 echo 'kill -l' >signal
14289 set X `csh -f <signal`
14290 $rm -f signal
14291 shift
14292 case $# in
14293 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14294 esac
14295 echo $@ | $tr ' ' $trnl | \
14296 $awk '{ printf "%s %d\n", $1, ++s; }
14297 END { printf "NSIG %d\n", ++s }' >signal.lst
14298fi
14299$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14300EOS
14301chmod a+x signal_cmd
14302$eunicefix signal_cmd
14303
14304: generate list of signal names
14305echo " "
14306case "$sig_name_init" in
14307'') doinit=yes ;;
14308*) case "$sig_num_init" in
14309 ''|*,*) doinit=yes ;;
14310 esac ;;
14311esac
14312case "$doinit" in
14313yes)
14314 echo "Generating a list of signal names and numbers..." >&4
14315 . ./signal_cmd
14316 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14317 sig_name=`$awk 'BEGIN { printf "ZERO " }
14318 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14319 sig_num=`$awk 'BEGIN { printf "0 " }
14320 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14321 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
14322 !/^NSIG/ { printf "\"%s\", ", $1 }
14323 END { printf "0\n" }' signal.lst`
14324 sig_num_init=`$awk 'BEGIN { printf "0, " }
14325 !/^NSIG/ { printf "%d, ", $2}
14326 END { printf "0\n"}' signal.lst`
14327 ;;
14328esac
14329echo "The following $sig_count signals are available:"
14330echo " "
14331echo $sig_name | $awk \
14332'BEGIN { linelen = 0 }
14333{
14334 for (i = 1; i <= NF; i++) {
14335 name = "SIG" $i " "
14336 linelen = linelen + length(name)
14337 if (linelen > 70) {
14338 printf "\n"
14339 linelen = length(name)
14340 }
14341 printf "%s", name
14342 }
14343 printf "\n"
14344}'
14345$rm -f signal signal.c signal.awk signal.lst signal_cmd
14346
14347echo " "
14348case "$sizetype" in
14349*_t) zzz="$sizetype" ;;
14350*) zzz="filesize" ;;
14351esac
14352echo "Checking the size of $zzz..." >&4
14353cat > try.c <<EOCP
14354#include <sys/types.h>
14355#include <stdio.h>
14356int main() {
14357 printf("%d\n", (int)sizeof($sizetype));
14358 exit(0);
14359}
14360EOCP
14361set try
14362if eval $compile_ok; then
14363 yyy=`./try`
14364 case "$yyy" in
14365 '') sizesize=4
14366 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14367 ;;
14368 *) sizesize=$yyy
14369 echo "Your $zzz size is $sizesize bytes."
14370 ;;
14371 esac
14372else
14373 sizesize=4
14374 echo "(I can't compile the test program--guessing $sizesize.)" >&4
14375fi
14376
14377
14378: check for socklen_t
14379echo " "
14380echo "Checking to see if you have socklen_t..." >&4
14381$cat >try.c <<EOCP
14382#include <sys/types.h>
14383#$d_socket HAS_SOCKET
14384#ifdef HAS_SOCKET
14385#include <sys/socket.h>
14386#endif
14387int main() { socklen_t x = 16; }
14388EOCP
14389set try
14390if eval $compile; then
14391 val="$define"
14392 echo "You have socklen_t."
14393else
14394 val="$undef"
14395 echo "You do not have socklen_t."
14396 case "$sizetype" in
14397 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14398 esac
14399fi
14400$rm -f try try.*
14401set d_socklen_t
14402eval $setvar
14403
a7710f8d
JH
14404: see if this is a socks.h system
14405set socks.h i_socks
14406eval $inhdr
14407
b4eb6b3d
JH
14408: check for type of the size argument to socket calls
14409case "$d_socket" in
14410"$define")
14411 $cat <<EOM
14412
14413Checking to see what type is the last argument of accept().
14414EOM
b4eb6b3d
JH
14415 yyy=''
14416 case "$d_socklen_t" in
14417 "$define") yyy="$yyy socklen_t"
14418 esac
14419 yyy="$yyy $sizetype int long unsigned"
14420 for xxx in $yyy; do
14421 case "$socksizetype" in
14422 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
14423 case "$usesocks" in
14424 "$define")
14425 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14426 echo "Your system accepts '$xxx *' for the last argument of accept()."
14427 socksizetype="$xxx"
14428 fi
14429 ;;
14430 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
14431 echo "Your system accepts '$xxx *' for the last argument of accept()."
14432 socksizetype="$xxx"
14433 fi
14434 ;;
14435 esac
b4eb6b3d
JH
14436 ;;
14437 esac
14438 done
14439: In case none of those worked, prompt the user.
14440 case "$socksizetype" in
14441 '') rp='What is the type for socket address structure sizes?'
14442 dflt='int'
14443 . ./myread
14444 socksizetype=$ans
14445 ;;
14446 esac
14447 ;;
14448*) : no sockets, so pick relatively harmless default
14449 socksizetype='int'
14450 ;;
14451esac
14452
14453: see what type is used for signed size_t
14454set ssize_t ssizetype int stdio.h sys/types.h
14455eval $typedef
14456dflt="$ssizetype"
14457$cat > ssize.c <<EOM
14458#include <stdio.h>
14459#include <sys/types.h>
14460#define Size_t $sizetype
14461#define SSize_t $dflt
14462int main()
14463{
14464 if (sizeof(Size_t) == sizeof(SSize_t))
14465 printf("$dflt\n");
14466 else if (sizeof(Size_t) == sizeof(int))
14467 printf("int\n");
14468 else
14469 printf("long\n");
14470 exit(0);
14471}
14472EOM
14473echo " "
14474set ssize
14475if eval $compile_ok && ./ssize > /dev/null; then
14476 ssizetype=`./ssize`
14477 echo "I'll be using $ssizetype for functions returning a byte count." >&4
14478else
14479 $cat >&4 <<EOM
14480Help! I can't compile and run the ssize_t test program: please enlighten me!
14481(This is probably a misconfiguration in your system or libraries, and
14482you really ought to fix it. Still, I'll try anyway.)
14483
14484I need a type that is the same size as $sizetype, but is guaranteed to
14485be signed. Common values are ssize_t, int and long.
14486
14487EOM
14488 rp="What signed type is the same size as $sizetype?"
14489 . ./myread
14490 ssizetype="$ans"
14491fi
14492$rm -f ssize ssize.*
14493
14494: see what type of char stdio uses.
14495echo " "
aa517f50
JH
14496echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
14497if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
14498 echo "Your stdio uses unsigned chars." >&4
14499 stdchar="unsigned char"
14500else
aa517f50
JH
14501 echo "Your stdio uses signed chars." >&4
14502 stdchar="char"
b4eb6b3d 14503fi
aa517f50
JH
14504$rm -f stdioh
14505
14506
b4eb6b3d
JH
14507
14508: see if time exists
14509echo " "
14510if test "X$d_time" = X -o X"$timetype" = X; then
14511 if set time val -f d_time; eval $csym; $val; then
14512 echo 'time() found.' >&4
14513 val="$define"
14514 rp="What is the type returned by time() on this system?"
14515 set time_t timetype long stdio.h sys/types.h
14516 eval $typedef_ask
14517 else
14518 echo 'time() not found, hope that will do.' >&4
14519 val="$undef"
14520 timetype='int';
14521 fi
14522 set d_time
14523 eval $setvar
14524fi
14525
14526: see what type uids are declared as in the kernel
14527echo " "
14528echo "Looking for the type for user ids returned by getuid()."
14529set uid_t uidtype xxx stdio.h sys/types.h
14530eval $typedef
14531case "$uidtype" in
14532xxx)
14533 xxx=`./findhdr sys/user.h`
14534 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14535 case $1 in
14536 unsigned) dflt="$1 $2" ;;
14537 *) dflt="$1" ;;
14538 esac
14539 ;;
14540*) dflt="$uidtype";;
14541esac
14542case "$uidtype" in
14543uid_t) echo "uid_t found." ;;
14544*) rp="What is the type for user ids returned by getuid()?"
14545 . ./myread
14546 uidtype="$ans"
14547 ;;
14548esac
14549
14550echo " "
14551case "$uidtype" in
14552*_t) zzz="$uidtype" ;;
14553*) zzz="uid" ;;
14554esac
14555echo "Checking the size of $zzz..." >&4
14556cat > try.c <<EOCP
14557#include <sys/types.h>
14558#include <stdio.h>
14559int main() {
14560 printf("%d\n", (int)sizeof($uidtype));
14561 exit(0);
14562}
14563EOCP
14564set try
14565if eval $compile_ok; then
14566 yyy=`./try`
14567 case "$yyy" in
14568 '') uidsize=4
14569 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14570 ;;
14571 *) uidsize=$yyy
14572 echo "Your $zzz is $uidsize bytes long."
14573 ;;
14574 esac
14575else
14576 uidsize=4
14577 echo "(I can't compile the test program--guessing $uidsize.)" >&4
14578fi
14579
14580echo " "
14581case "$uidtype" in
14582*_t) zzz="$uidtype" ;;
14583*) zzz="uid" ;;
14584esac
14585echo "Checking the sign of $zzz..." >&4
14586cat > try.c <<EOCP
14587#include <sys/types.h>
14588#include <stdio.h>
14589int main() {
14590 $uidtype foo = -1;
14591 if (foo < 0)
14592 printf("-1\n");
14593 else
14594 printf("1\n");
14595}
14596EOCP
14597set try
14598if eval $compile; then
14599 yyy=`./try`
14600 case "$yyy" in
14601 '') uidsign=1
14602 echo "(I can't execute the test program--guessing unsigned.)" >&4
14603 ;;
14604 *) uidsign=$yyy
14605 case "$uidsign" in
14606 1) echo "Your $zzz is unsigned." ;;
14607 -1) echo "Your $zzz is signed." ;;
14608 esac
14609 ;;
14610 esac
14611else
14612 uidsign=1
14613 echo "(I can't compile the test program--guessing unsigned.)" >&4
14614fi
14615
14616
14617
14618echo " "
14619$echo "Checking the format string to be used for uids..." >&4
14620
14621case "$uidsign" in
14622-1) if $test X"$uidsize" = X"$ivsize"; then
14623 uidformat="$ivdformat"
14624 else
14625 if $test X"$uidsize" = X"$longsize"; then
14626 uidformat='"ld"'
14627 else
14628 if $test X"$uidsize" = X"$intsize"; then
14629 uidformat='"d"'
14630 else
14631 if $test X"$uidsize" = X"$shortsize"; then
14632 uidformat='"hd"'
14633 fi
14634 fi
14635 fi
14636 fi
14637 ;;
14638*) if $test X"$uidsize" = X"$uvsize"; then
14639 uidformat="$uvuformat"
14640 else
14641 if $test X"$uidsize" = X"$longsize"; then
14642 uidformat='"lu"'
14643 else
14644 if $test X"$uidsize" = X"$intsize"; then
14645 uidformat='"u"'
14646 else
14647 if $test X"$uidsize" = X"$shortsize"; then
14648 uidformat='"hu"'
14649 fi
14650 fi
14651 fi
14652 fi
14653 ;;
14654esac
14655
14656: see if dbm.h is available
14657: see if dbmclose exists
14658set dbmclose d_dbmclose
14659eval $inlibc
14660
14661case "$d_dbmclose" in
14662$define)
14663 set dbm.h i_dbm
14664 eval $inhdr
14665 case "$i_dbm" in
14666 $define)
14667 val="$undef"
14668 set i_rpcsvcdbm
14669 eval $setvar
14670 ;;
14671 *) set rpcsvc/dbm.h i_rpcsvcdbm
14672 eval $inhdr
14673 ;;
14674 esac
14675 ;;
14676*) echo "We won't be including <dbm.h>"
14677 val="$undef"
14678 set i_dbm
14679 eval $setvar
14680 val="$undef"
14681 set i_rpcsvcdbm
14682 eval $setvar
14683 ;;
14684esac
14685
14686: see if this is a sys/file.h system
14687val=''
14688set sys/file.h val
14689eval $inhdr
14690
14691: do we need to include sys/file.h ?
14692case "$val" in
14693"$define")
14694 echo " "
14695 if $h_sysfile; then
14696 val="$define"
14697 echo "We'll be including <sys/file.h>." >&4
14698 else
14699 val="$undef"
14700 echo "We won't be including <sys/file.h>." >&4
14701 fi
14702 ;;
14703*)
14704 h_sysfile=false
14705 ;;
14706esac
14707set i_sysfile
14708eval $setvar
14709
14710: see if fcntl.h is there
14711val=''
14712set fcntl.h val
14713eval $inhdr
14714
14715: see if we can include fcntl.h
14716case "$val" in
14717"$define")
14718 echo " "
14719 if $h_fcntl; then
14720 val="$define"
14721 echo "We'll be including <fcntl.h>." >&4
14722 else
14723 val="$undef"
14724 if $h_sysfile; then
14725 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14726 else
14727 echo "We won't be including <fcntl.h>." >&4
14728 fi
14729 fi
14730 ;;
14731*)
14732 h_fcntl=false
14733 val="$undef"
14734 ;;
14735esac
14736set i_fcntl
14737eval $setvar
14738
14739: see if this is a iconv.h system
14740set iconv.h i_iconv
14741eval $inhdr
14742
14743: see if this is a ieeefp.h system
14744set ieeefp.h i_ieeefp
14745eval $inhdr
14746
14747: see if this is a libutil.h system
14748set libutil.h i_libutil
14749eval $inhdr
14750
14751: see if locale.h is available
14752set locale.h i_locale
14753eval $inhdr
14754
14755: see if mach cthreads are available
14756if test "X$usethreads" = "X$define"; then
14757 set mach/cthreads.h i_machcthr
14758 eval $inhdr
14759else
14760 i_machcthr="$undef"
14761fi
14762
14763
14764
14765: see if this is a math.h system
14766set math.h i_math
14767eval $inhdr
14768
14769: see if this is a mntent.h system
14770set mntent.h i_mntent
14771eval $inhdr
14772
14773: see if ndbm.h is available
14774set ndbm.h t_ndbm
14775eval $inhdr
14776case "$t_ndbm" in
14777$define)
14778 : see if dbm_open exists
14779 set dbm_open d_dbm_open
14780 eval $inlibc
14781 case "$d_dbm_open" in
14782 $undef)
14783 t_ndbm="$undef"
14784 echo "We won't be including <ndbm.h>"
14785 ;;
14786 esac
14787 ;;
14788esac
14789val="$t_ndbm"
14790set i_ndbm
14791eval $setvar
14792
14793: see if net/errno.h is available
14794val=''
14795set net/errno.h val
14796eval $inhdr
14797
14798: Unfortunately, it causes problems on some systems. Arrgh.
14799case "$val" in
14800$define)
14801 cat > try.c <<'EOM'
14802#include <stdio.h>
14803#include <errno.h>
14804#include <net/errno.h>
14805int func()
14806{
14807 return ENOTSOCK;
14808}
14809EOM
14810 if $cc $ccflags -c try.c >/dev/null 2>&1; then
14811 echo "We'll be including <net/errno.h>." >&4
14812 else
14813 echo "We won't be including <net/errno.h>." >&4
14814 val="$undef"
14815 fi
14816 $rm -f try.* try
14817 ;;
14818esac
14819set i_neterrno
14820eval $setvar
14821
14822: see if netinet/tcp.h is available
14823set netinet/tcp.h i_netinettcp
14824eval $inhdr
14825
14826: see if this is a poll.h system
14827set poll.h i_poll
14828eval $inhdr
14829
14830: see if this is a prot.h system
14831set prot.h i_prot
14832eval $inhdr
14833
14834echo " "
14835$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
14836$cat <<'EOSH' > Cppsym.know
14837a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14838AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14839alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14840ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14841BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14842BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14843bull c cadmus clipper CMU COFF COMPILER_VERSION
14844concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14845CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14846Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14847FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14848GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14849H3050R H3050RX hbullx20 hcx host_mips
14850hp200 hp300 hp700 HP700 hp800 hp9000
14851hp9000s200 hp9000s300 hp9000s400 hp9000s500
14852hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14853i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14854iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14855INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14856LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14857LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14858Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14859LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14860M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14861M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14862M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14863MATH_HAS_NO_SIDE_EFFECTS
14864mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14865mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14866mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14867MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14868mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14869NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 14870news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
14871ns32016 ns32332 ns32k nsc32000
14872OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14873pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14874pc532 pdp11 PGC PIC plexus PORTAR posix
14875POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14876POSIX_C_SOURCE POSIX_SOURCE POWER
14877PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14878riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14879SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14880sony sony_news sonyrisc sparc sparclite spectrum
14881stardent stdc STDC_EXT stratos sun sun3 sun386
14882Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14883SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14884SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14885sysV68 sysV88 Tek4132 Tek4300 titan
14886tower tower32 tower32_200 tower32_600 tower32_700
14887tower32_800 tower32_850 tss
14888u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14889ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14890unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14891Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14892XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14893XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14894z8000
14895EOSH
14896# Maybe put other stuff here too.
14897cat <<EOSH >>Cppsym.know
14898$osname
14899EOSH
14900./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14901./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14902$cat Cppsym.know > Cppsym.c
381aa1ff 14903$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
14904$rm -f Cppsym.a Cppsym.b Cppsym.c
14905cat <<EOSH > Cppsym
14906$startsh
14907if $test \$# -gt 0; then
14908 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14909 if $test -s Cppsym.got; then
14910 $rm -f Cppsym.got
14911 exit 0
14912 fi
14913 $rm -f Cppsym.got
14914 exit 1
14915else
14916 $tr " " "$trnl" | ./Cppsym.try
14917 exit 0
14918fi
14919EOSH
14920chmod +x Cppsym
14921$eunicefix Cppsym
14922cat <<EOSH > Cppsym.try
14923$startsh
14924cat <<'EOCP' > try.c
14925#include <stdio.h>
14926int main() {
14927EOCP
14928$awk \\
14929EOSH
14930cat <<'EOSH' >> Cppsym.try
14931'length($1) > 0 {
14932 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
14933 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
14934 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
14935 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
14936}' >> try.c
14937echo '}' >> try.c
14938EOSH
14939cat <<EOSH >> Cppsym.try
14940ccflags="$ccflags"
14941case "$osname-$gccversion" in
14942irix-) ccflags="\$ccflags -woff 1178" ;;
14943os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
14944esac
7a282f6d 14945$cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
b4eb6b3d
JH
14946EOSH
14947chmod +x Cppsym.try
14948$eunicefix Cppsym.try
14949./Cppsym < Cppsym.know > Cppsym.true
14950: now check the C compiler for additional symbols
14951postprocess_cc_v=''
14952case "$osname" in
14953aix) postprocess_cc_v="|$tr , ' '" ;;
14954esac
14955$cat >ccsym <<EOS
14956$startsh
14957$cat >tmp.c <<EOF
14958extern int foo;
14959EOF
14960for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14961do
14962 case "\$i" in
14963 -D*) echo "\$i" | $sed 's/^-D//';;
14964 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14965 esac
14966done
14967$rm -f try.c
14968EOS
14969postprocess_cc_v=''
14970chmod +x ccsym
14971$eunicefix ccsym
14972./ccsym > ccsym1.raw
14973if $test -s ccsym1.raw; then
14974 $sort ccsym1.raw | $uniq >ccsym.raw
14975else
14976 mv ccsym1.raw ccsym.raw
14977fi
14978
14979$awk '/\=/ { print $0; next }
14980 { print $0"=1" }' ccsym.raw >ccsym.list
14981$awk '/\=/ { print $0; next }
14982 { print $0"=1" }' Cppsym.true >ccsym.true
14983$comm -13 ccsym.true ccsym.list >ccsym.own
14984$comm -12 ccsym.true ccsym.list >ccsym.com
14985$comm -23 ccsym.true ccsym.list >ccsym.cpp
14986also=''
14987if $test -z ccsym.raw; then
14988 echo "Your C compiler doesn't seem to define any symbols!" >&4
14989 echo " "
14990 echo "However, your C preprocessor defines the following symbols:"
14991 $cat Cppsym.true
14992 ccsymbols=''
14993 cppsymbols=`$cat Cppsym.true`
14994 cppsymbols=`echo $cppsymbols`
14995 cppccsymbols="$cppsymbols"
14996else
14997 if $test -s ccsym.com; then
14998 echo "Your C compiler and pre-processor define these symbols:"
14999 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15000 also='also '
15001 symbols='ones'
15002 cppccsymbols=`$cat ccsym.com`
15003 cppccsymbols=`echo $cppccsymbols`
15004 $test "$silent" || sleep 1
15005 fi
15006 if $test -s ccsym.cpp; then
15007 $test "$also" && echo " "
15008 echo "Your C pre-processor ${also}defines the following symbols:"
15009 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15010 also='further '
15011 cppsymbols=`$cat ccsym.cpp`
15012 cppsymbols=`echo $cppsymbols`
15013 $test "$silent" || sleep 1
15014 fi
15015 if $test -s ccsym.own; then
15016 $test "$also" && echo " "
15017 echo "Your C compiler ${also}defines the following cpp symbols:"
15018 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15019 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15020 ccsymbols=`$cat ccsym.own`
15021 ccsymbols=`echo $ccsymbols`
15022 $test "$silent" || sleep 1
15023 fi
15024fi
15025$rm -f ccsym* Cppsym.*
15026
15027: see if this is a termio system
15028val="$undef"
15029val2="$undef"
15030val3="$undef"
15031if $test `./findhdr termios.h`; then
15032 set tcsetattr i_termios
15033 eval $inlibc
15034 val3="$i_termios"
15035fi
15036echo " "
15037case "$val3" in
15038"$define") echo "You have POSIX termios.h... good!" >&4;;
15039*) if ./Cppsym pyr; then
15040 case "`/bin/universe`" in
15041 ucb) if $test `./findhdr sgtty.h`; then
15042 val2="$define"
15043 echo "<sgtty.h> found." >&4
15044 else
15045 echo "System is pyramid with BSD universe."
15046 echo "<sgtty.h> not found--you could have problems." >&4
15047 fi;;
15048 *) if $test `./findhdr termio.h`; then
15049 val="$define"
15050 echo "<termio.h> found." >&4
15051 else
15052 echo "System is pyramid with USG universe."
15053 echo "<termio.h> not found--you could have problems." >&4
15054 fi;;
15055 esac
15056 elif ./usg; then
15057 if $test `./findhdr termio.h`; then
15058 echo "<termio.h> found." >&4
15059 val="$define"
15060 elif $test `./findhdr sgtty.h`; then
15061 echo "<sgtty.h> found." >&4
15062 val2="$define"
15063 else
15064echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15065 fi
15066 else
15067 if $test `./findhdr sgtty.h`; then
15068 echo "<sgtty.h> found." >&4
15069 val2="$define"
15070 elif $test `./findhdr termio.h`; then
15071 echo "<termio.h> found." >&4
15072 val="$define"
15073 else
15074echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15075 fi
15076 fi;;
15077esac
15078set i_termio; eval $setvar
15079val=$val2; set i_sgtty; eval $setvar
15080val=$val3; set i_termios; eval $setvar
15081
15082: see if this is a shadow.h system
15083set shadow.h i_shadow
15084eval $inhdr
15085
b4eb6b3d
JH
15086: see if stddef is available
15087set stddef.h i_stddef
15088eval $inhdr
923fc586 15089
b4eb6b3d
JH
15090: see if this is a sunmath.h system
15091set sunmath.h i_sunmath
15092eval $inhdr
5f80c64f 15093
b4eb6b3d
JH
15094: see if sys/access.h is available
15095set sys/access.h i_sysaccess
15096eval $inhdr
15097
15098: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15099set sys/filio.h i_sysfilio
15100eval $inhdr
15101echo " "
15102if $test `./findhdr sys/ioctl.h`; then
15103 val="$define"
15104 echo '<sys/ioctl.h> found.' >&4
15105else
15106 val="$undef"
15107 if $test $i_sysfilio = "$define"; then
15108 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 15109 else
b4eb6b3d
JH
15110 $test $i_sgtty = "$define" && xxx="sgtty.h"
15111 $test $i_termio = "$define" && xxx="termio.h"
15112 $test $i_termios = "$define" && xxx="termios.h"
15113echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15114 fi
15115fi
15116set i_sysioctl
15117eval $setvar
15118
15119
15120: see if this is a syslog.h system
15121set syslog.h i_syslog
15122eval $inhdr
15123
15124
15125: see if this is a sys/mode.h system
15126set sys/mode.h i_sysmode
15127eval $inhdr
15128
15129: see if sys/resource.h has to be included
15130set sys/resource.h i_sysresrc
15131eval $inhdr
15132
15133: see if sys/security.h is available
15134set sys/security.h i_syssecrt
15135eval $inhdr
15136
15137: see if this is a sys/statvfs.h system
15138set sys/statvfs.h i_sysstatvfs
15139eval $inhdr
15140
15141: see if this is a sys/uio.h system
15142set sys/uio.h i_sysuio
15143eval $inhdr
15144
15145: see if this is a sys/un.h system
15146set sys/un.h i_sysun
15147eval $inhdr
15148
15149
15150: see if this is a sys/utsname.h system
15151set sys/utsname.h i_sysutsname
15152eval $inhdr
15153
15154: see if this is a syswait system
15155set sys/wait.h i_syswait
15156eval $inhdr
15157
15158: see if this is a ustat.h system
15159set ustat.h i_ustat
15160eval $inhdr
15161
15162: see if this is an utime system
15163set utime.h i_utime
15164eval $inhdr
15165
15166: see if this is a values.h system
15167set values.h i_values
15168eval $inhdr
15169
15170: see if this is a vfork system
15171case "$d_vfork" in
15172"$define")
15173 set vfork.h i_vfork
15174 eval $inhdr
15175 ;;
15176*)
15177 i_vfork="$undef"
15178 ;;
15179esac
15180
15181: see if gdbm.h is available
15182set gdbm.h t_gdbm
15183eval $inhdr
15184case "$t_gdbm" in
15185$define)
15186 : see if gdbm_open exists
15187 set gdbm_open d_gdbm_open
15188 eval $inlibc
15189 case "$d_gdbm_open" in
15190 $undef)
15191 t_gdbm="$undef"
15192 echo "We won't be including <gdbm.h>"
5f80c64f 15193 ;;
b4eb6b3d
JH
15194 esac
15195 ;;
15196esac
15197val="$t_gdbm"
15198set i_gdbm
15199eval $setvar
15200
15201echo " "
15202echo "Looking for extensions..." >&4
15203: If we are using the old config.sh, known_extensions may contain
15204: old or inaccurate or duplicate values.
15205known_extensions=''
15206nonxs_extensions=''
15207: We do not use find because it might not be available.
15208: We do not just use MANIFEST because the user may have dropped
15209: some additional extensions into the source tree and expect them
15210: to be built.
15211
15212: Function to recursively find available extensions, ignoring DynaLoader
15213: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15214find_extensions='
15215 for xxx in *; do
15216 case "$xxx" in
15217 DynaLoader|dynaload) ;;
15218 *)
15219 if $test -f $xxx/$xxx.xs; then
15220 known_extensions="$known_extensions $1$xxx";
15221 elif $test -f $xxx/Makefile.PL; then
15222 nonxs_extensions="$nonxs_extensions $1$xxx";
15223 else
15224 if $test -d $xxx -a $# -lt 10; then
15225 set $1$xxx/ $*;
15226 cd $xxx;
15227 eval $find_extensions;
15228 cd ..;
15229 shift;
15230 fi;
15231 fi
15232 ;;
15233 esac;
15234 done'
15235tdir=`pwd`
15236cd $rsrc/ext
15237set X
15238shift
15239eval $find_extensions
15240set X $nonxs_extensions
15241shift
15242nonxs_extensions="$*"
15243set X $known_extensions
15244shift
15245known_extensions="$*"
15246cd $tdir
15247
15248: Now see which are supported on this system.
15249avail_ext=''
15250for xxx in $known_extensions ; do
15251 case "$xxx" in
15252 DB_File|db_file)
15253 case "$i_db" in
15254 $define) avail_ext="$avail_ext $xxx" ;;
15255 esac
15256 ;;
15257 GDBM_File|gdbm_fil)
15258 case "$i_gdbm" in
15259 $define) avail_ext="$avail_ext $xxx" ;;
15260 esac
15261 ;;
15262 NDBM_File|ndbm_fil)
15263 case "$i_ndbm" in
15264 $define)
15265 case "$osname-$use64bitint" in
15266 hpux-define)
15267 case "$libs" in
15268 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15269 esac
15270 ;;
15271 *) avail_ext="$avail_ext $xxx" ;;
15272 esac
15273 ;;
15274 esac
15275 ;;
15276 ODBM_File|odbm_fil)
15277 case "${i_dbm}${i_rpcsvcdbm}" in
15278 *"${define}"*)
15279 case "$osname-$use64bitint" in
15280 hpux-define)
15281 case "$libs" in
15282 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15283 esac
15284 ;;
15285 *) avail_ext="$avail_ext $xxx" ;;
15286 esac
15287 ;;
15288 esac
15289 ;;
15290 POSIX|posix)
15291 case "$useposix" in
15292 true|define|y) avail_ext="$avail_ext $xxx" ;;
15293 esac
15294 ;;
15295 Opcode|opcode)
15296 case "$useopcode" in
15297 true|define|y) avail_ext="$avail_ext $xxx" ;;
15298 esac
15299 ;;
15300 Socket|socket)
15301 case "$d_socket" in
15302 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15303 esac
15304 ;;
15305 Sys/Syslog|sys/syslog)
15306 : XXX syslog requires socket
15307 case "$d_socket" in
15308 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15309 esac
15310 ;;
15311 Thread|thread)
15312 case "$usethreads" in
15313 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15314 esac
15315 ;;
15316 IPC/SysV|ipc/sysv)
15317 : XXX Do we need a useipcsysv variable here
15318 case "${d_msg}${d_sem}${d_shm}" in
15319 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15320 esac
15321 ;;
15322 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
15323 ;;
15324 esac
b4eb6b3d 15325done
5f80c64f 15326
b4eb6b3d
JH
15327set X $avail_ext
15328shift
15329avail_ext="$*"
5f80c64f 15330
b4eb6b3d
JH
15331: Now see which nonxs extensions are supported on this system.
15332: For now assume all are.
15333nonxs_ext=''
15334for xxx in $nonxs_extensions ; do
15335 case "$xxx" in
15336 *) nonxs_ext="$nonxs_ext $xxx"
15337 ;;
15338 esac
15339done
5f80c64f 15340
b4eb6b3d
JH
15341set X $nonxs_ext
15342shift
15343nonxs_ext="$*"
15344
15345case $usedl in
15346$define)
15347 $cat <<EOM
15348A number of extensions are supplied with $package. You may choose to
15349compile these extensions for dynamic loading (the default), compile
15350them into the $package executable (static loading), or not include
15351them at all. Answer "none" to include no extensions.
15352Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
15353
15354EOM
b4eb6b3d
JH
15355 case "$dynamic_ext" in
15356 '') dflt="$avail_ext" ;;
15357 *) dflt="$dynamic_ext"
15358 # Perhaps we are reusing an old out-of-date config.sh.
15359 case "$hint" in
15360 previous)
15361 if test X"$dynamic_ext" != X"$avail_ext"; then
15362 $cat <<EOM
15363NOTICE: Your previous config.sh list may be incorrect.
15364The extensions now available to you are
15365 ${avail_ext}
15366but the default list from your previous config.sh is
15367 ${dynamic_ext}
9c839522 15368
b4eb6b3d
JH
15369EOM
15370 fi
9c839522
PM
15371 ;;
15372 esac
b4eb6b3d
JH
15373 ;;
15374 esac
5f80c64f 15375 case "$dflt" in
b4eb6b3d
JH
15376 '') dflt=none;;
15377 esac
15378 rp="What extensions do you wish to load dynamically?"
15379 . ./myread
15380 case "$ans" in
15381 none) dynamic_ext=' ' ;;
15382 *) dynamic_ext="$ans" ;;
5f80c64f 15383 esac
5f80c64f 15384
b4eb6b3d
JH
15385 case "$static_ext" in
15386 '')
15387 : Exclude those already listed in dynamic linking
15388 dflt=''
15389 for xxx in $avail_ext; do
15390 case " $dynamic_ext " in
15391 *" $xxx "*) ;;
15392 *) dflt="$dflt $xxx" ;;
15393 esac
15394 done
15395 set X $dflt
15396 shift
15397 dflt="$*"
15398 ;;
15399 *) dflt="$static_ext"
15400 ;;
15401 esac
9c839522 15402
b4eb6b3d
JH
15403 case "$dflt" in
15404 '') dflt=none;;
15405 esac
15406 rp="What extensions do you wish to load statically?"
15407 . ./myread
15408 case "$ans" in
15409 none) static_ext=' ' ;;
15410 *) static_ext="$ans" ;;
15411 esac
15412 ;;
15413*)
15414 $cat <<EOM
15415A number of extensions are supplied with $package. Answer "none"
15416to include no extensions.
15417Note that DynaLoader is always built and need not be mentioned here.
9c839522 15418
b4eb6b3d
JH
15419EOM
15420 case "$static_ext" in
15421 '') dflt="$avail_ext" ;;
15422 *) dflt="$static_ext"
15423 # Perhaps we are reusing an old out-of-date config.sh.
15424 case "$hint" in
15425 previous)
15426 if test X"$static_ext" != X"$avail_ext"; then
15427 $cat <<EOM
15428NOTICE: Your previous config.sh list may be incorrect.
15429The extensions now available to you are
15430 ${avail_ext}
15431but the default list from your previous config.sh is
15432 ${static_ext}
5f80c64f
JH
15433
15434EOM
b4eb6b3d
JH
15435 fi
15436 ;;
15437 esac
15438 ;;
15439 esac
15440 : Exclude those that are not xs extensions
15441 case "$dflt" in
15442 '') dflt=none;;
15443 esac
15444 rp="What extensions do you wish to include?"
15445 . ./myread
15446 case "$ans" in
15447 none) static_ext=' ' ;;
15448 *) static_ext="$ans" ;;
15449 esac
15450 ;;
5f80c64f
JH
15451esac
15452
b4eb6b3d
JH
15453set X $dynamic_ext $static_ext $nonxs_ext
15454shift
15455extensions="$*"
15456
9c839522
PM
15457: Remove libraries needed only for extensions
15458: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
15459: The exception is SunOS 4.x, which needs them.
15460case "${osname}X${osvers}" in
15461sunos*X4*)
15462 perllibs="$libs"
15463 ;;
15464*) case "$usedl" in
15465 $define|true|[yY]*)
15466 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
15467 shift
15468 perllibs="$*"
15469 ;;
15470 *) perllibs="$libs"
15471 ;;
15472 esac
15473 ;;
9c839522 15474esac
5f80c64f
JH
15475
15476: Remove build directory name from cppstdin so it can be used from
15477: either the present location or the final installed location.
15478echo " "
15479: Get out of the UU directory to get correct path name.
15480cd ..
15481case "$cppstdin" in
15482`pwd`/cppstdin)
15483 echo "Stripping down cppstdin path name"
15484 cppstdin=cppstdin
15485 ;;
15486esac
15487cd UU
15488
15489: end of configuration questions
15490echo " "
15491echo "End of configuration questions."
15492echo " "
15493
15494: back to where it started
15495if test -d ../UU; then
15496 cd ..
15497fi
15498
15499: configuration may be patched via a 'config.over' file
15500if $test -f config.over; then
15501 echo " "
15502 dflt=y
15503 rp='I see a config.over file. Do you wish to load it?'
15504 . UU/myread
15505 case "$ans" in
15506 n*) echo "OK, I'll ignore it.";;
15507 *) . ./config.over
15508 echo "Configuration override changes have been loaded."
15509 ;;
15510 esac
15511fi
15512
15513: in case they want portability, strip down executable paths
15514case "$d_portable" in
15515"$define")
15516 echo " "
15517 echo "Stripping down executable paths..." >&4
15518 for file in $loclist $trylist; do
534ac15a
JH
15519 eval temp=\$$file
15520 eval $file=`basename $temp`
5f80c64f
JH
15521 done
15522 ;;
15523esac
15524
15525: create config.sh file
15526echo " "
15527echo "Creating config.sh..." >&4
15528$spitshell <<EOT >config.sh
15529$startsh
15530#
15531# This file was produced by running the Configure script. It holds all the
15532# definitions figured out by Configure. Should you modify one of these values,
15533# do not forget to propagate your changes by running "Configure -der". You may
15534# instead choose to run each of the .SH files by yourself, or "Configure -S".
15535#
15536
15537# Package name : $package
15538# Source directory : $src
15539# Configuration time: $cf_time
15540# Configured by : $cf_by
15541# Target system : $myuname
15542
15543Author='$Author'
15544Date='$Date'
15545Header='$Header'
15546Id='$Id'
15547Locker='$Locker'
15548Log='$Log'
15549Mcc='$Mcc'
15550RCSfile='$RCSfile'
15551Revision='$Revision'
15552Source='$Source'
15553State='$State'
15554_a='$_a'
15555_exe='$_exe'
15556_o='$_o'
b4eb6b3d
JH
15557afs='$afs'
15558alignbytes='$alignbytes'
15559ansi2knr='$ansi2knr'
15560aphostname='$aphostname'
15561api_revision='$api_revision'
15562api_subversion='$api_subversion'
15563api_version='$api_version'
15564api_versionstring='$api_versionstring'
5f80c64f 15565ar='$ar'
b4eb6b3d
JH
15566archlib='$archlib'
15567archlibexp='$archlibexp'
15568archname64='$archname64'
15569archname='$archname'
5f80c64f
JH
15570archobjs='$archobjs'
15571awk='$awk'
b4eb6b3d 15572baserev='$baserev'
5f80c64f 15573bash='$bash'
b4eb6b3d
JH
15574bin='$bin'
15575bincompat5005='$bincompat5005'
15576binexp='$binexp'
5f80c64f
JH
15577bison='$bison'
15578byacc='$byacc'
b4eb6b3d 15579byteorder='$byteorder'
5f80c64f 15580c='$c'
b4eb6b3d 15581castflags='$castflags'
5f80c64f
JH
15582cat='$cat'
15583cc='$cc'
15584cccdlflags='$cccdlflags'
15585ccdlflags='$ccdlflags'
15586ccflags='$ccflags'
b4eb6b3d 15587ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 15588ccname='$ccname'
b4eb6b3d 15589ccsymbols='$ccsymbols'
6b356c8e 15590ccversion='$ccversion'
5f80c64f 15591cf_by='$cf_by'
b4eb6b3d 15592cf_email='$cf_email'
5f80c64f 15593cf_time='$cf_time'
b4eb6b3d 15594charsize='$charsize'
5f80c64f
JH
15595chgrp='$chgrp'
15596chmod='$chmod'
15597chown='$chown'
b4eb6b3d 15598clocktype='$clocktype'
5f80c64f
JH
15599comm='$comm'
15600compress='$compress'
15601contains='$contains'
15602cp='$cp'
15603cpio='$cpio'
15604cpp='$cpp'
b4eb6b3d
JH
15605cpp_stuff='$cpp_stuff'
15606cppccsymbols='$cppccsymbols'
5f80c64f
JH
15607cppflags='$cppflags'
15608cpplast='$cpplast'
15609cppminus='$cppminus'
15610cpprun='$cpprun'
15611cppstdin='$cppstdin'
b4eb6b3d
JH
15612cppsymbols='$cppsymbols'
15613crosscompile='$crosscompile'
15614cryptlib='$cryptlib'
5f80c64f 15615csh='$csh'
b4eb6b3d
JH
15616d_Gconvert='$d_Gconvert'
15617d_PRIEUldbl='$d_PRIEUldbl'
15618d_PRIFUldbl='$d_PRIFUldbl'
15619d_PRIGUldbl='$d_PRIGUldbl'
15620d_PRIXU64='$d_PRIXU64'
15621d_PRId64='$d_PRId64'
15622d_PRIeldbl='$d_PRIeldbl'
15623d_PRIfldbl='$d_PRIfldbl'
15624d_PRIgldbl='$d_PRIgldbl'
15625d_PRIi64='$d_PRIi64'
15626d_PRIo64='$d_PRIo64'
15627d_PRIu64='$d_PRIu64'
15628d_PRIx64='$d_PRIx64'
15629d_SCNfldbl='$d_SCNfldbl'
74cac757 15630d__fwalk='$d__fwalk'
b4eb6b3d
JH
15631d_access='$d_access'
15632d_accessx='$d_accessx'
15633d_alarm='$d_alarm'
15634d_archlib='$d_archlib'
15635d_atolf='$d_atolf'
15636d_atoll='$d_atoll'
15637d_attribut='$d_attribut'
15638d_bcmp='$d_bcmp'
15639d_bcopy='$d_bcopy'
15640d_bincompat5005='$d_bincompat5005'
5f80c64f 15641d_bsd='$d_bsd'
b4eb6b3d
JH
15642d_bsdgetpgrp='$d_bsdgetpgrp'
15643d_bsdsetpgrp='$d_bsdsetpgrp'
15644d_bzero='$d_bzero'
15645d_casti32='$d_casti32'
15646d_castneg='$d_castneg'
15647d_charvspr='$d_charvspr'
15648d_chown='$d_chown'
15649d_chroot='$d_chroot'
15650d_chsize='$d_chsize'
15651d_closedir='$d_closedir'
15652d_const='$d_const'
15653d_crypt='$d_crypt'
15654d_csh='$d_csh'
15655d_cuserid='$d_cuserid'
15656d_dbl_dig='$d_dbl_dig'
15657d_difftime='$d_difftime'
15658d_dirnamlen='$d_dirnamlen'
15659d_dlerror='$d_dlerror'
5f80c64f 15660d_dlopen='$d_dlopen'
b4eb6b3d
JH
15661d_dlsymun='$d_dlsymun'
15662d_dosuid='$d_dosuid'
15663d_drand48proto='$d_drand48proto'
15664d_dup2='$d_dup2'
15665d_eaccess='$d_eaccess'
15666d_endgrent='$d_endgrent'
15667d_endhent='$d_endhent'
15668d_endnent='$d_endnent'
15669d_endpent='$d_endpent'
15670d_endpwent='$d_endpwent'
15671d_endsent='$d_endsent'
15672d_eofnblk='$d_eofnblk'
5f80c64f 15673d_eunice='$d_eunice'
b4eb6b3d
JH
15674d_fchmod='$d_fchmod'
15675d_fchown='$d_fchown'
15676d_fcntl='$d_fcntl'
9d9004a9 15677d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
15678d_fd_macros='$d_fd_macros'
15679d_fd_set='$d_fd_set'
15680d_fds_bits='$d_fds_bits'
15681d_fgetpos='$d_fgetpos'
15682d_flexfnam='$d_flexfnam'
15683d_flock='$d_flock'
15684d_fork='$d_fork'
15685d_fpathconf='$d_fpathconf'
15686d_fpos64_t='$d_fpos64_t'
15687d_frexpl='$d_frexpl'
15688d_fs_data_s='$d_fs_data_s'
15689d_fseeko='$d_fseeko'
15690d_fsetpos='$d_fsetpos'
15691d_fstatfs='$d_fstatfs'
15692d_fstatvfs='$d_fstatvfs'
411ab01c 15693d_fsync='$d_fsync'
b4eb6b3d
JH
15694d_ftello='$d_ftello'
15695d_ftime='$d_ftime'
15696d_getcwd='$d_getcwd'
15697d_getespwnam='$d_getespwnam'
15698d_getfsstat='$d_getfsstat'
15699d_getgrent='$d_getgrent'
15700d_getgrps='$d_getgrps'
15701d_gethbyaddr='$d_gethbyaddr'
15702d_gethbyname='$d_gethbyname'
15703d_gethent='$d_gethent'
15704d_gethname='$d_gethname'
15705d_gethostprotos='$d_gethostprotos'
15706d_getlogin='$d_getlogin'
15707d_getmnt='$d_getmnt'
15708d_getmntent='$d_getmntent'
15709d_getnbyaddr='$d_getnbyaddr'
15710d_getnbyname='$d_getnbyname'
15711d_getnent='$d_getnent'
15712d_getnetprotos='$d_getnetprotos'
0c0643d0 15713d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
15714d_getpbyname='$d_getpbyname'
15715d_getpbynumber='$d_getpbynumber'
15716d_getpent='$d_getpent'
15717d_getpgid='$d_getpgid'
15718d_getpgrp2='$d_getpgrp2'
15719d_getpgrp='$d_getpgrp'
15720d_getppid='$d_getppid'
15721d_getprior='$d_getprior'
15722d_getprotoprotos='$d_getprotoprotos'
15723d_getprpwnam='$d_getprpwnam'
15724d_getpwent='$d_getpwent'
15725d_getsbyname='$d_getsbyname'
15726d_getsbyport='$d_getsbyport'
15727d_getsent='$d_getsent'
15728d_getservprotos='$d_getservprotos'
15729d_getspnam='$d_getspnam'
15730d_gettimeod='$d_gettimeod'
5f80c64f 15731d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
15732d_grpasswd='$d_grpasswd'
15733d_hasmntopt='$d_hasmntopt'
15734d_htonl='$d_htonl'
15735d_iconv='$d_iconv'
15736d_index='$d_index'
15737d_inetaton='$d_inetaton'
15738d_int64_t='$d_int64_t'
15739d_isascii='$d_isascii'
15740d_isnan='$d_isnan'
15741d_isnanl='$d_isnanl'
15742d_killpg='$d_killpg'
15743d_lchown='$d_lchown'
15744d_ldbl_dig='$d_ldbl_dig'
15745d_link='$d_link'
15746d_locconv='$d_locconv'
15747d_lockf='$d_lockf'
15748d_longdbl='$d_longdbl'
15749d_longlong='$d_longlong'
15750d_lseekproto='$d_lseekproto'
15751d_lstat='$d_lstat'
15752d_madvise='$d_madvise'
15753d_mblen='$d_mblen'
15754d_mbstowcs='$d_mbstowcs'
15755d_mbtowc='$d_mbtowc'
15756d_memchr='$d_memchr'
15757d_memcmp='$d_memcmp'
15758d_memcpy='$d_memcpy'
15759d_memmove='$d_memmove'
15760d_memset='$d_memset'
15761d_mkdir='$d_mkdir'
15762d_mkdtemp='$d_mkdtemp'
15763d_mkfifo='$d_mkfifo'
15764d_mkstemp='$d_mkstemp'
15765d_mkstemps='$d_mkstemps'
15766d_mktime='$d_mktime'
15767d_mmap='$d_mmap'
15768d_modfl='$d_modfl'
15769d_mprotect='$d_mprotect'
15770d_msg='$d_msg'
15771d_msg_ctrunc='$d_msg_ctrunc'
15772d_msg_dontroute='$d_msg_dontroute'
15773d_msg_oob='$d_msg_oob'
15774d_msg_peek='$d_msg_peek'
15775d_msg_proxy='$d_msg_proxy'
15776d_msgctl='$d_msgctl'
15777d_msgget='$d_msgget'
15778d_msgrcv='$d_msgrcv'
15779d_msgsnd='$d_msgsnd'
15780d_msync='$d_msync'
15781d_munmap='$d_munmap'
15782d_mymalloc='$d_mymalloc'
15783d_nice='$d_nice'
15784d_nv_preserves_uv='$d_nv_preserves_uv'
15785d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15786d_off64_t='$d_off64_t'
15787d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15788d_oldpthreads='$d_oldpthreads'
15789d_oldsock='$d_oldsock'
15790d_open3='$d_open3'
15791d_pathconf='$d_pathconf'
15792d_pause='$d_pause'
15793d_perl_otherlibdirs='$d_perl_otherlibdirs'
15794d_phostname='$d_phostname'
15795d_pipe='$d_pipe'
15796d_poll='$d_poll'
5f80c64f 15797d_portable='$d_portable'
b4eb6b3d
JH
15798d_pthread_yield='$d_pthread_yield'
15799d_pwage='$d_pwage'
15800d_pwchange='$d_pwchange'
15801d_pwclass='$d_pwclass'
15802d_pwcomment='$d_pwcomment'
15803d_pwexpire='$d_pwexpire'
15804d_pwgecos='$d_pwgecos'
15805d_pwpasswd='$d_pwpasswd'
15806d_pwquota='$d_pwquota'
15807d_qgcvt='$d_qgcvt'
15808d_quad='$d_quad'
15809d_readdir='$d_readdir'
15810d_readlink='$d_readlink'
15811d_rename='$d_rename'
15812d_rewinddir='$d_rewinddir'
15813d_rmdir='$d_rmdir'
15814d_safebcpy='$d_safebcpy'
15815d_safemcpy='$d_safemcpy'
15816d_sanemcmp='$d_sanemcmp'
ef9f17be 15817d_sbrkproto='$d_sbrkproto'
b4eb6b3d
JH
15818d_sched_yield='$d_sched_yield'
15819d_scm_rights='$d_scm_rights'
15820d_seekdir='$d_seekdir'
15821d_select='$d_select'
15822d_sem='$d_sem'
15823d_semctl='$d_semctl'
15824d_semctl_semid_ds='$d_semctl_semid_ds'
15825d_semctl_semun='$d_semctl_semun'
15826d_semget='$d_semget'
15827d_semop='$d_semop'
15828d_setegid='$d_setegid'
15829d_seteuid='$d_seteuid'
15830d_setgrent='$d_setgrent'
15831d_setgrps='$d_setgrps'
15832d_sethent='$d_sethent'
15833d_setlinebuf='$d_setlinebuf'
15834d_setlocale='$d_setlocale'
15835d_setnent='$d_setnent'
15836d_setpent='$d_setpent'
15837d_setpgid='$d_setpgid'
15838d_setpgrp2='$d_setpgrp2'
15839d_setpgrp='$d_setpgrp'
15840d_setprior='$d_setprior'
15841d_setproctitle='$d_setproctitle'
15842d_setpwent='$d_setpwent'
15843d_setregid='$d_setregid'
15844d_setresgid='$d_setresgid'
15845d_setresuid='$d_setresuid'
15846d_setreuid='$d_setreuid'
15847d_setrgid='$d_setrgid'
15848d_setruid='$d_setruid'
15849d_setsent='$d_setsent'
15850d_setsid='$d_setsid'
15851d_setvbuf='$d_setvbuf'
15852d_sfio='$d_sfio'
15853d_shm='$d_shm'
15854d_shmat='$d_shmat'
15855d_shmatprototype='$d_shmatprototype'
15856d_shmctl='$d_shmctl'
15857d_shmdt='$d_shmdt'
15858d_shmget='$d_shmget'
15859d_sigaction='$d_sigaction'
15860d_sigsetjmp='$d_sigsetjmp'
15861d_socket='$d_socket'
15862d_socklen_t='$d_socklen_t'
15863d_sockpair='$d_sockpair'
15864d_socks5_init='$d_socks5_init'
15865d_sqrtl='$d_sqrtl'
15866d_statblks='$d_statblks'
15867d_statfs_f_flags='$d_statfs_f_flags'
15868d_statfs_s='$d_statfs_s'
15869d_statvfs='$d_statvfs'
15870d_stdio_cnt_lval='$d_stdio_cnt_lval'
15871d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
15872d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
15873d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
15874d_stdio_stream_array='$d_stdio_stream_array'
15875d_stdiobase='$d_stdiobase'
15876d_stdstdio='$d_stdstdio'
15877d_strchr='$d_strchr'
15878d_strcoll='$d_strcoll'
15879d_strctcpy='$d_strctcpy'
15880d_strerrm='$d_strerrm'
15881d_strerror='$d_strerror'
15882d_strtod='$d_strtod'
15883d_strtol='$d_strtol'
15884d_strtold='$d_strtold'
15885d_strtoll='$d_strtoll'
15886d_strtoul='$d_strtoul'
15887d_strtoull='$d_strtoull'
15888d_strtouq='$d_strtouq'
15889d_strxfrm='$d_strxfrm'
15890d_suidsafe='$d_suidsafe'
15891d_symlink='$d_symlink'
15892d_syscall='$d_syscall'
15893d_sysconf='$d_sysconf'
15894d_sysernlst='$d_sysernlst'
15895d_syserrlst='$d_syserrlst'
15896d_system='$d_system'
15897d_tcgetpgrp='$d_tcgetpgrp'
15898d_tcsetpgrp='$d_tcsetpgrp'
15899d_telldir='$d_telldir'
15900d_telldirproto='$d_telldirproto'
15901d_time='$d_time'
15902d_times='$d_times'
15903d_truncate='$d_truncate'
15904d_tzname='$d_tzname'
15905d_umask='$d_umask'
15906d_uname='$d_uname'
15907d_union_semun='$d_union_semun'
15908d_ustat='$d_ustat'
15909d_vendorarch='$d_vendorarch'
15910d_vendorbin='$d_vendorbin'
15911d_vendorlib='$d_vendorlib'
15912d_vfork='$d_vfork'
15913d_void_closedir='$d_void_closedir'
15914d_voidsig='$d_voidsig'
15915d_voidtty='$d_voidtty'
15916d_volatile='$d_volatile'
15917d_vprintf='$d_vprintf'
15918d_wait4='$d_wait4'
15919d_waitpid='$d_waitpid'
15920d_wcstombs='$d_wcstombs'
15921d_wctomb='$d_wctomb'
5f80c64f
JH
15922d_xenix='$d_xenix'
15923date='$date'
b4eb6b3d
JH
15924db_hashtype='$db_hashtype'
15925db_prefixtype='$db_prefixtype'
15926defvoidused='$defvoidused'
15927direntrytype='$direntrytype'
15928dlext='$dlext'
5f80c64f 15929dlsrc='$dlsrc'
b4eb6b3d
JH
15930doublesize='$doublesize'
15931drand01='$drand01'
15932dynamic_ext='$dynamic_ext'
15933eagain='$eagain'
15934ebcdic='$ebcdic'
5f80c64f
JH
15935echo='$echo'
15936egrep='$egrep'
15937emacs='$emacs'
15938eunicefix='$eunicefix'
15939exe_ext='$exe_ext'
15940expr='$expr'
b4eb6b3d
JH
15941extensions='$extensions'
15942fflushNULL='$fflushNULL'
15943fflushall='$fflushall'
5f80c64f
JH
15944find='$find'
15945firstmakefile='$firstmakefile'
15946flex='$flex'
b4eb6b3d
JH
15947fpossize='$fpossize'
15948fpostype='$fpostype'
15949freetype='$freetype'
15950full_ar='$full_ar'
15951full_csh='$full_csh'
15952full_sed='$full_sed'
5b463ca7 15953gccosandvers='$gccosandvers'
5f80c64f 15954gccversion='$gccversion'
b4eb6b3d
JH
15955gidformat='$gidformat'
15956gidsign='$gidsign'
15957gidsize='$gidsize'
15958gidtype='$gidtype'
5f80c64f
JH
15959glibpth='$glibpth'
15960grep='$grep'
b4eb6b3d
JH
15961groupcat='$groupcat'
15962groupstype='$groupstype'
5f80c64f 15963gzip='$gzip'
b4eb6b3d
JH
15964h_fcntl='$h_fcntl'
15965h_sysfile='$h_sysfile'
5f80c64f 15966hint='$hint'
b4eb6b3d
JH
15967hostcat='$hostcat'
15968i16size='$i16size'
15969i16type='$i16type'
15970i32size='$i32size'
15971i32type='$i32type'
15972i64size='$i64size'
15973i64type='$i64type'
15974i8size='$i8size'
15975i8type='$i8type'
15976i_arpainet='$i_arpainet'
15977i_bsdioctl='$i_bsdioctl'
15978i_db='$i_db'
15979i_dbm='$i_dbm'
15980i_dirent='$i_dirent'
5f80c64f 15981i_dld='$i_dld'
b4eb6b3d
JH
15982i_dlfcn='$i_dlfcn'
15983i_fcntl='$i_fcntl'
15984i_float='$i_float'
15985i_gdbm='$i_gdbm'
15986i_grp='$i_grp'
15987i_iconv='$i_iconv'
15988i_ieeefp='$i_ieeefp'
15989i_inttypes='$i_inttypes'
15990i_libutil='$i_libutil'
15991i_limits='$i_limits'
15992i_locale='$i_locale'
15993i_machcthr='$i_machcthr'
15994i_malloc='$i_malloc'
15995i_math='$i_math'
15996i_memory='$i_memory'
15997i_mntent='$i_mntent'
15998i_ndbm='$i_ndbm'
15999i_netdb='$i_netdb'
16000i_neterrno='$i_neterrno'
16001i_netinettcp='$i_netinettcp'
16002i_niin='$i_niin'
16003i_poll='$i_poll'
16004i_prot='$i_prot'
16005i_pthread='$i_pthread'
16006i_pwd='$i_pwd'
16007i_rpcsvcdbm='$i_rpcsvcdbm'
16008i_sfio='$i_sfio'
16009i_sgtty='$i_sgtty'
16010i_shadow='$i_shadow'
16011i_socks='$i_socks'
16012i_stdarg='$i_stdarg'
16013i_stddef='$i_stddef'
16014i_stdlib='$i_stdlib'
16015i_string='$i_string'
16016i_sunmath='$i_sunmath'
16017i_sysaccess='$i_sysaccess'
16018i_sysdir='$i_sysdir'
16019i_sysfile='$i_sysfile'
16020i_sysfilio='$i_sysfilio'
16021i_sysin='$i_sysin'
16022i_sysioctl='$i_sysioctl'
16023i_syslog='$i_syslog'
16024i_sysmman='$i_sysmman'
16025i_sysmode='$i_sysmode'
16026i_sysmount='$i_sysmount'
16027i_sysndir='$i_sysndir'
16028i_sysparam='$i_sysparam'
16029i_sysresrc='$i_sysresrc'
16030i_syssecrt='$i_syssecrt'
16031i_sysselct='$i_sysselct'
16032i_syssockio='$i_syssockio'
16033i_sysstat='$i_sysstat'
16034i_sysstatfs='$i_sysstatfs'
16035i_sysstatvfs='$i_sysstatvfs'
16036i_systime='$i_systime'
16037i_systimek='$i_systimek'
16038i_systimes='$i_systimes'
16039i_systypes='$i_systypes'
16040i_sysuio='$i_sysuio'
16041i_sysun='$i_sysun'
16042i_sysutsname='$i_sysutsname'
16043i_sysvfs='$i_sysvfs'
16044i_syswait='$i_syswait'
16045i_termio='$i_termio'
16046i_termios='$i_termios'
16047i_time='$i_time'
16048i_unistd='$i_unistd'
16049i_ustat='$i_ustat'
16050i_utime='$i_utime'
16051i_values='$i_values'
16052i_varargs='$i_varargs'
16053i_varhdr='$i_varhdr'
16054i_vfork='$i_vfork'
5f80c64f 16055ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
16056inc_version_list='$inc_version_list'
16057inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
16058incpath='$incpath'
16059inews='$inews'
b4eb6b3d
JH
16060installarchlib='$installarchlib'
16061installbin='$installbin'
16062installman1dir='$installman1dir'
16063installman3dir='$installman3dir'
16064installprefix='$installprefix'
16065installprefixexp='$installprefixexp'
16066installprivlib='$installprivlib'
16067installscript='$installscript'
16068installsitearch='$installsitearch'
16069installsitebin='$installsitebin'
16070installsitelib='$installsitelib'
16071installstyle='$installstyle'
16072installusrbinperl='$installusrbinperl'
16073installvendorarch='$installvendorarch'
16074installvendorbin='$installvendorbin'
16075installvendorlib='$installvendorlib'
16076intsize='$intsize'
16077ivdformat='$ivdformat'
16078ivsize='$ivsize'
16079ivtype='$ivtype'
16080known_extensions='$known_extensions'
5f80c64f 16081ksh='$ksh'
5f80c64f
JH
16082ld='$ld'
16083lddlflags='$lddlflags'
16084ldflags='$ldflags'
b4eb6b3d
JH
16085ldflags_uselargefiles='$ldflags_uselargefiles'
16086ldlibpthname='$ldlibpthname'
5f80c64f
JH
16087less='$less'
16088lib_ext='$lib_ext'
16089libc='$libc'
b4eb6b3d 16090libperl='$libperl'
5f80c64f
JH
16091libpth='$libpth'
16092libs='$libs'
43999f95
JH
16093libsdirs='$libsdirs'
16094libsfiles='$libsfiles'
16095libsfound='$libsfound'
13b3f787 16096libspath='$libspath'
5f80c64f 16097libswanted='$libswanted'
b4eb6b3d 16098libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
16099line='$line'
16100lint='$lint'
16101lkflags='$lkflags'
16102ln='$ln'
16103lns='$lns'
16104locincpth='$locincpth'
16105loclibpth='$loclibpth'
b4eb6b3d
JH
16106longdblsize='$longdblsize'
16107longlongsize='$longlongsize'
16108longsize='$longsize'
5f80c64f
JH
16109lp='$lp'
16110lpr='$lpr'
16111ls='$ls'
b4eb6b3d
JH
16112lseeksize='$lseeksize'
16113lseektype='$lseektype'
5f80c64f
JH
16114mail='$mail'
16115mailx='$mailx'
16116make='$make'
16117make_set_make='$make_set_make'
b4eb6b3d
JH
16118mallocobj='$mallocobj'
16119mallocsrc='$mallocsrc'
16120malloctype='$malloctype'
16121man1dir='$man1dir'
16122man1direxp='$man1direxp'
16123man1ext='$man1ext'
16124man3dir='$man3dir'
16125man3direxp='$man3direxp'
16126man3ext='$man3ext'
5f80c64f
JH
16127mips_type='$mips_type'
16128mkdir='$mkdir'
b4eb6b3d
JH
16129mmaptype='$mmaptype'
16130modetype='$modetype'
5f80c64f 16131more='$more'
b4eb6b3d 16132multiarch='$multiarch'
5f80c64f 16133mv='$mv'
b4eb6b3d
JH
16134myarchname='$myarchname'
16135mydomain='$mydomain'
16136myhostname='$myhostname'
5f80c64f
JH
16137myuname='$myuname'
16138n='$n'
2cc61e15 16139need_va_copy='$need_va_copy'
b4eb6b3d
JH
16140netdb_hlen_type='$netdb_hlen_type'
16141netdb_host_type='$netdb_host_type'
16142netdb_name_type='$netdb_name_type'
16143netdb_net_type='$netdb_net_type'
5f80c64f
JH
16144nm='$nm'
16145nm_opt='$nm_opt'
16146nm_so_opt='$nm_so_opt'
b4eb6b3d 16147nonxs_ext='$nonxs_ext'
5f80c64f 16148nroff='$nroff'
b4eb6b3d
JH
16149nvEUformat='$nvEUformat'
16150nvFUformat='$nvFUformat'
16151nvGUformat='$nvGUformat'
16152nveformat='$nveformat'
16153nvfformat='$nvfformat'
16154nvgformat='$nvgformat'
16155nvsize='$nvsize'
16156nvtype='$nvtype'
16157o_nonblock='$o_nonblock'
5f80c64f 16158obj_ext='$obj_ext'
b4eb6b3d 16159old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 16160optimize='$optimize'
b4eb6b3d 16161orderlib='$orderlib'
5f80c64f
JH
16162osname='$osname'
16163osvers='$osvers'
b4eb6b3d 16164otherlibdirs='$otherlibdirs'
5f80c64f 16165package='$package'
b4eb6b3d
JH
16166pager='$pager'
16167passcat='$passcat'
16168patchlevel='$patchlevel'
5f80c64f 16169path_sep='$path_sep'
b4eb6b3d 16170perl5='$perl5'
5f80c64f 16171perl='$perl'
b4eb6b3d 16172perladmin='$perladmin'
9c839522 16173perllibs='$perllibs'
b4eb6b3d 16174perlpath='$perlpath'
5f80c64f 16175pg='$pg'
b4eb6b3d
JH
16176phostname='$phostname'
16177pidtype='$pidtype'
5f80c64f 16178plibpth='$plibpth'
b4eb6b3d 16179pm_apiversion='$pm_apiversion'
5f80c64f
JH
16180pmake='$pmake'
16181pr='$pr'
b4eb6b3d
JH
16182prefix='$prefix'
16183prefixexp='$prefixexp'
16184privlib='$privlib'
16185privlibexp='$privlibexp'
16186prototype='$prototype'
16187ptrsize='$ptrsize'
16188quadkind='$quadkind'
16189quadtype='$quadtype'
16190randbits='$randbits'
16191randfunc='$randfunc'
16192randseedtype='$randseedtype'
16193ranlib='$ranlib'
16194rd_nodata='$rd_nodata'
16195revision='$revision'
5f80c64f
JH
16196rm='$rm'
16197rmail='$rmail'
16198runnm='$runnm'
b4eb6b3d
JH
16199sPRIEUldbl='$sPRIEUldbl'
16200sPRIFUldbl='$sPRIFUldbl'
16201sPRIGUldbl='$sPRIGUldbl'
16202sPRIXU64='$sPRIXU64'
16203sPRId64='$sPRId64'
16204sPRIeldbl='$sPRIeldbl'
16205sPRIfldbl='$sPRIfldbl'
16206sPRIgldbl='$sPRIgldbl'
16207sPRIi64='$sPRIi64'
16208sPRIo64='$sPRIo64'
16209sPRIu64='$sPRIu64'
16210sPRIx64='$sPRIx64'
16211sSCNfldbl='$sSCNfldbl'
16212sched_yield='$sched_yield'
16213scriptdir='$scriptdir'
16214scriptdirexp='$scriptdirexp'
5f80c64f 16215sed='$sed'
b4eb6b3d
JH
16216seedfunc='$seedfunc'
16217selectminbits='$selectminbits'
16218selecttype='$selecttype'
5f80c64f
JH
16219sendmail='$sendmail'
16220sh='$sh'
16221shar='$shar'
16222sharpbang='$sharpbang'
b4eb6b3d
JH
16223shmattype='$shmattype'
16224shortsize='$shortsize'
16225shrpenv='$shrpenv'
5f80c64f 16226shsharp='$shsharp'
b4eb6b3d
JH
16227sig_count='$sig_count'
16228sig_name='$sig_name'
16229sig_name_init='$sig_name_init'
16230sig_num='$sig_num'
16231sig_num_init='$sig_num_init'
16232signal_t='$signal_t'
16233sitearch='$sitearch'
16234sitearchexp='$sitearchexp'
16235sitebin='$sitebin'
16236sitebinexp='$sitebinexp'
16237sitelib='$sitelib'
16238sitelib_stem='$sitelib_stem'
16239sitelibexp='$sitelibexp'
16240siteprefix='$siteprefix'
16241siteprefixexp='$siteprefixexp'
16242sizesize='$sizesize'
16243sizetype='$sizetype'
5f80c64f
JH
16244sleep='$sleep'
16245smail='$smail'
5f80c64f 16246so='$so'
b4eb6b3d
JH
16247sockethdr='$sockethdr'
16248socketlib='$socketlib'
16249socksizetype='$socksizetype'
5f80c64f
JH
16250sort='$sort'
16251spackage='$spackage'
16252spitshell='$spitshell'
5f80c64f 16253src='$src'
b4eb6b3d
JH
16254ssizetype='$ssizetype'
16255startperl='$startperl'
5f80c64f 16256startsh='$startsh'
b4eb6b3d
JH
16257static_ext='$static_ext'
16258stdchar='$stdchar'
16259stdio_base='$stdio_base'
16260stdio_bufsiz='$stdio_bufsiz'
16261stdio_cnt='$stdio_cnt'
16262stdio_filbuf='$stdio_filbuf'
16263stdio_ptr='$stdio_ptr'
16264stdio_stream_array='$stdio_stream_array'
16265strings='$strings'
5f80c64f 16266submit='$submit'
b4eb6b3d
JH
16267subversion='$subversion'
16268sysman='$sysman'
5f80c64f
JH
16269tail='$tail'
16270tar='$tar'
16271tbl='$tbl'
16272tee='$tee'
16273test='$test'
b4eb6b3d
JH
16274timeincl='$timeincl'
16275timetype='$timetype'
5f80c64f
JH
16276touch='$touch'
16277tr='$tr'
16278trnl='$trnl'
16279troff='$troff'
b4eb6b3d
JH
16280u16size='$u16size'
16281u16type='$u16type'
16282u32size='$u32size'
16283u32type='$u32type'
16284u64size='$u64size'
16285u64type='$u64type'
16286u8size='$u8size'
16287u8type='$u8type'
16288uidformat='$uidformat'
16289uidsign='$uidsign'
16290uidsize='$uidsize'
16291uidtype='$uidtype'
5f80c64f
JH
16292uname='$uname'
16293uniq='$uniq'
b4eb6b3d
JH
16294uquadtype='$uquadtype'
16295use5005threads='$use5005threads'
16296use64bitall='$use64bitall'
16297use64bitint='$use64bitint'
5f80c64f 16298usedl='$usedl'
b4eb6b3d
JH
16299useithreads='$useithreads'
16300uselargefiles='$uselargefiles'
16301uselongdouble='$uselongdouble'
16302usemorebits='$usemorebits'
16303usemultiplicity='$usemultiplicity'
16304usemymalloc='$usemymalloc'
5f80c64f 16305usenm='$usenm'
b4eb6b3d
JH
16306useopcode='$useopcode'
16307useperlio='$useperlio'
16308useposix='$useposix'
16309usesfio='$usesfio'
16310useshrplib='$useshrplib'
29209bc5 16311usesocks='$usesocks'
b4eb6b3d
JH
16312usethreads='$usethreads'
16313usevendorprefix='$usevendorprefix'
16314usevfork='$usevfork'
5f80c64f
JH
16315usrinc='$usrinc'
16316uuname='$uuname'
b4eb6b3d
JH
16317uvXUformat='$uvXUformat'
16318uvoformat='$uvoformat'
16319uvsize='$uvsize'
16320uvtype='$uvtype'
16321uvuformat='$uvuformat'
16322uvxformat='$uvxformat'
16323vendorarch='$vendorarch'
16324vendorarchexp='$vendorarchexp'
16325vendorbin='$vendorbin'
16326vendorbinexp='$vendorbinexp'
16327vendorlib='$vendorlib'
16328vendorlib_stem='$vendorlib_stem'
16329vendorlibexp='$vendorlibexp'
16330vendorprefix='$vendorprefix'
16331vendorprefixexp='$vendorprefixexp'
16332version='$version'
d56c5707 16333versiononly='$versiononly'
5f80c64f 16334vi='$vi'
b4eb6b3d 16335voidflags='$voidflags'
5f80c64f 16336xlibpth='$xlibpth'
b4eb6b3d 16337xs_apiversion='$xs_apiversion'
5f80c64f
JH
16338zcat='$zcat'
16339zip='$zip'
16340EOT
16341
16342: Add in command line options if available
16343$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16344
16345: add special variables
16346$test -f $src/patchlevel.h && \
d00b958f 16347awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
2000072c 16348echo "CONFIGDOTSH=true" >>config.sh
5f80c64f
JH
16349
16350: propagate old symbols
16351if $test -f UU/config.sh; then
381aa1ff 16352 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 16353 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 16354 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
16355 set X `cat UU/oldsyms`
16356 shift
16357 case $# in
16358 0) ;;
16359 *)
16360 cat <<EOM
16361Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16362EOM
16363 echo "# Variables propagated from previous config.sh file." >>config.sh
16364 for sym in `cat UU/oldsyms`; do
16365 echo " Propagating $hint variable "'$'"$sym..."
16366 eval 'tmp="$'"${sym}"'"'
16367 echo "$tmp" | \
16368 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16369 done
16370 ;;
16371 esac
16372fi
16373
16374: Finish up by extracting the .SH files
16375case "$alldone" in
16376exit)
16377 $rm -rf UU
16378 echo "Done."
16379 exit 0
16380 ;;
16381cont)
16382 ;;
16383'')
16384 dflt=''
16385 nostick=true
16386 $cat <<EOM
16387
16388If you'd like to make any changes to the config.sh file before I begin
16389to configure things, do it as a shell escape now (e.g. !vi config.sh).
16390
16391EOM
16392 rp="Press return or use a shell escape to edit config.sh:"
16393 . UU/myread
16394 nostick=''
16395 case "$ans" in
16396 '') ;;
16397 *) : in case they cannot read
16398 sh 1>&4 -c "$ans";;
16399 esac
16400 ;;
16401esac
16402
16403: if this fails, just run all the .SH files by hand
16404. ./config.sh
16405
16406echo " "
16407exec 1>&4
16408. ./UU/extract
16409
16410if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16411 dflt=y
16412 case "$silent" in
16413 true) ;;
16414 *)
16415 $cat <<EOM
16416
16417Now you need to generate make dependencies by running "$make depend".
16418You might prefer to run it in background: "$make depend > makedepend.out &"
16419It can take a while, so you might not want to run it right now.
16420
16421EOM
16422 ;;
16423 esac
16424 rp="Run $make depend now?"
16425 . UU/myread
16426 case "$ans" in
16427 y*)
3d5d58b1 16428 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
16429 ;;
16430 *)
16431 echo "You must run '$make depend' then '$make'."
16432 ;;
16433 esac
16434elif test -f [Mm]akefile; then
16435 echo " "
16436 echo "Now you must run a $make."
16437else
16438 echo "Done."
16439fi
16440
16441if $test -f Policy.sh; then
16442 $cat <<EOM
16443
16444If you compile $package on a different machine or from a different object
16445directory, copy the Policy.sh file from this object directory to the
16446new one before you run Configure -- this will help you with most of
16447the policy defaults.
16448
16449EOM
16450fi
16451if $test -f config.msg; then
16452 echo "Hmm. I also noted the following information while running:"
16453 echo " "
16454 $cat config.msg >&4
16455 $rm -f config.msg
16456fi
16457$rm -f kit*isdone ark*isdone
16458$rm -rf UU
16459
16460: End of Configure
16461