This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Document %ENV = () portability issues.
[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#
f83701cd 23# Generated on Sun Nov 5 00:37:41 EET 2000 [metaconfig 3.0 PL70]
7f2de2d2 24# (with additional metaconfig patches by perlbug@perl.org)
2304df62
AD
25
26cat >/tmp/c1$$ <<EOF
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
37cat >/tmp/c2$$ <<EOF
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
43true || cat /tmp/c1$$ /tmp/c2$$
44true || exec sh $0 $argv:q
45
46(exit $?0) || cat /tmp/c2$$
47(exit $?0) || exec sh $0 $argv:q
48rm -f /tmp/c1$$ /tmp/c2$$
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
JH
310crosscompile=''
311d_access=''
312d_accessx=''
313d_alarm=''
314d_attribut=''
315d_bcmp=''
316d_bcopy=''
317d_bzero=''
318d_casti32=''
319castflags=''
320d_castneg=''
321d_chown=''
322d_chroot=''
323d_chsize=''
324d_closedir=''
325d_void_closedir=''
326d_const=''
327cryptlib=''
328d_crypt=''
329d_csh=''
330full_csh=''
331d_cuserid=''
332d_dbl_dig=''
333d_difftime=''
334d_dlerror=''
a0d0e21e 335d_dlopen=''
b4eb6b3d
JH
336d_dlsymun=''
337d_dosuid=''
338d_suidsafe=''
339d_drand48proto=''
340d_dup2=''
341d_eaccess=''
342d_endgrent=''
343d_endhent=''
344d_endnent=''
345d_endpent=''
346d_endpwent=''
347d_endsent=''
348d_fchmod=''
349d_fchown=''
350d_fcntl=''
9d9004a9 351d_fcntl_can_lock=''
b4eb6b3d
JH
352d_fd_macros=''
353d_fd_set=''
354d_fds_bits=''
355d_fgetpos=''
356d_flexfnam=''
357d_flock=''
358d_fork=''
359d_fpos64_t=''
360d_frexpl=''
361d_fs_data_s=''
362d_fseeko=''
363d_fsetpos=''
364d_fstatfs=''
365d_ftello=''
366d_ftime=''
367d_gettimeod=''
368d_Gconvert=''
369d_getcwd=''
370d_getespwnam=''
371d_getfsstat=''
372d_getgrent=''
373d_getgrps=''
374d_gethbyaddr=''
375d_gethbyname=''
376d_gethent=''
377aphostname=''
378d_gethname=''
379d_phostname=''
380d_uname=''
381d_gethostprotos=''
382d_getlogin=''
383d_getmnt=''
384d_getmntent=''
385d_getnbyaddr=''
386d_getnbyname=''
387d_getnent=''
388d_getnetprotos=''
389d_getpent=''
390d_getpgid=''
391d_getpgrp2=''
392d_bsdgetpgrp=''
393d_getpgrp=''
394d_getppid=''
395d_getprior=''
396d_getpbyname=''
397d_getpbynumber=''
398d_getprotoprotos=''
399d_getprpwnam=''
400d_getpwent=''
401d_getsent=''
402d_getservprotos=''
403d_getspnam=''
404d_getsbyname=''
405d_getsbyport=''
a4f3eea9 406d_gnulibc=''
b4eb6b3d
JH
407d_hasmntopt=''
408d_htonl=''
409d_iconv=''
410d_inetaton=''
411d_int64_t=''
412d_isascii=''
413d_isnan=''
414d_isnanl=''
415d_killpg=''
416d_lchown=''
417d_ldbl_dig=''
418d_link=''
419d_locconv=''
420d_lockf=''
421d_longdbl=''
422longdblsize=''
423d_longlong=''
424longlongsize=''
425d_lseekproto=''
426d_lstat=''
427d_madvise=''
428d_mblen=''
429d_mbstowcs=''
430d_mbtowc=''
431d_memchr=''
432d_memcmp=''
433d_memcpy=''
434d_memmove=''
435d_memset=''
436d_mkdir=''
437d_mkdtemp=''
438d_mkfifo=''
439d_mkstemp=''
440d_mkstemps=''
441d_mktime=''
442d_mmap=''
443mmaptype=''
444d_modfl=''
445d_mprotect=''
446d_msg=''
447d_msgctl=''
448d_msgget=''
449d_msgrcv=''
450d_msgsnd=''
451d_msync=''
452d_munmap=''
453d_nice=''
454d_off64_t=''
455d_open3=''
456d_fpathconf=''
457d_pathconf=''
458d_pause=''
459d_pipe=''
460d_poll=''
2304df62 461d_portable=''
b4eb6b3d
JH
462d_old_pthread_create_joinable=''
463old_pthread_create_joinable=''
464d_pthread_yield=''
465d_sched_yield=''
466sched_yield=''
467d_qgcvt=''
468d_readdir=''
469d_rewinddir=''
470d_seekdir=''
471d_telldir=''
472d_readlink=''
473d_rename=''
474d_rmdir=''
475d_safebcpy=''
476d_safemcpy=''
477d_sanemcmp=''
478d_select=''
479d_sem=''
480d_semctl=''
481d_semget=''
482d_semop=''
483d_setegid=''
484d_seteuid=''
485d_setgrent=''
486d_setgrps=''
487d_sethent=''
488d_setlinebuf=''
489d_setlocale=''
490d_setnent=''
491d_setpent=''
492d_setpgid=''
493d_setpgrp2=''
494d_bsdsetpgrp=''
495d_setpgrp=''
496d_setprior=''
497d_setproctitle=''
498d_setpwent=''
499d_setregid=''
500d_setresgid=''
501d_setresuid=''
502d_setreuid=''
503d_setrgid=''
504d_setruid=''
505d_setsent=''
506d_setsid=''
507d_setvbuf=''
508d_sfio=''
509usesfio=''
510d_shm=''
511d_shmat=''
512d_shmatprototype=''
513shmattype=''
514d_shmctl=''
515d_shmdt=''
516d_shmget=''
517d_sigaction=''
518d_sigsetjmp=''
519d_msg_ctrunc=''
520d_msg_dontroute=''
521d_msg_oob=''
522d_msg_peek=''
523d_msg_proxy=''
524d_oldsock=''
525d_scm_rights=''
526d_socket=''
527d_sockpair=''
528sockethdr=''
529socketlib=''
530d_socklen_t=''
531d_socks5_init=''
532d_sqrtl=''
533d_statblks=''
534d_statfs_f_flags=''
535d_statfs_s=''
536d_fstatvfs=''
537d_statvfs=''
538d_stdio_cnt_lval=''
539d_stdio_ptr_lval=''
a7ffa9b9
NC
540d_stdio_ptr_lval_nochange_cnt=''
541d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
542d_stdiobase=''
543d_stdstdio=''
544stdio_base=''
545stdio_bufsiz=''
546stdio_cnt=''
547stdio_filbuf=''
548stdio_ptr=''
549d_index=''
550d_strchr=''
551d_strcoll=''
552d_strctcpy=''
553d_strerrm=''
554d_strerror=''
555d_sysernlst=''
556d_syserrlst=''
557d_strtod=''
558d_strtol=''
559d_strtold=''
560d_strtoll=''
561d_strtoul=''
562d_strtoull=''
563d_strtouq=''
564d_strxfrm=''
565d_symlink=''
566d_syscall=''
567d_sysconf=''
568d_system=''
569d_tcgetpgrp=''
570d_tcsetpgrp=''
571d_telldirproto=''
572d_time=''
573timetype=''
574clocktype=''
575d_times=''
576d_truncate=''
577d_tzname=''
578d_umask=''
579d_semctl_semid_ds=''
580d_semctl_semun=''
581d_union_semun=''
582d_ustat=''
583d_vfork=''
584usevfork=''
585d_voidsig=''
586signal_t=''
587d_volatile=''
588d_charvspr=''
589d_vprintf=''
590d_wait4=''
591d_waitpid=''
592d_wcstombs=''
593d_wctomb=''
594dlext=''
85e6fe83
LW
595cccdlflags=''
596ccdlflags=''
2304df62 597dlsrc=''
232e078e 598ld=''
85e6fe83 599lddlflags=''
2304df62 600usedl=''
b4eb6b3d
JH
601doublesize=''
602ebcdic=''
603fflushNULL=''
604fflushall=''
605fpossize=''
606fpostype=''
5b463ca7 607gccosandvers=''
8a27cf78 608gccversion=''
b4eb6b3d
JH
609gidformat=''
610gidsign=''
611gidsize=''
612gidtype=''
613groupstype=''
614h_fcntl=''
615h_sysfile=''
616i_arpainet=''
617db_hashtype=''
618db_prefixtype=''
619i_db=''
620i_dbm=''
621i_rpcsvcdbm=''
622d_dirnamlen=''
623direntrytype=''
624i_dirent=''
a0d0e21e 625i_dld=''
b4eb6b3d
JH
626i_dlfcn=''
627i_fcntl=''
628i_float=''
629i_gdbm=''
630d_grpasswd=''
631i_grp=''
632i_iconv=''
633i_ieeefp=''
634i_inttypes=''
635i_libutil=''
636i_limits=''
637i_locale=''
638i_machcthr=''
639i_malloc=''
640i_math=''
641i_memory=''
642i_mntent=''
643i_ndbm=''
644i_netdb=''
645i_neterrno=''
646i_netinettcp=''
647i_niin=''
648i_sysin=''
649i_poll=''
650i_prot=''
651i_pthread=''
652d_pwage=''
653d_pwchange=''
654d_pwclass=''
655d_pwcomment=''
656d_pwexpire=''
657d_pwgecos=''
658d_pwpasswd=''
659d_pwquota=''
660i_pwd=''
661i_sfio=''
662i_shadow=''
663i_socks=''
664i_stddef=''
665i_stdlib=''
666i_string=''
667strings=''
668i_sunmath=''
669i_sysaccess=''
670i_sysdir=''
671i_sysfile=''
672d_voidtty=''
673i_bsdioctl=''
674i_sysfilio=''
675i_sysioctl=''
676i_syssockio=''
677i_syslog=''
678i_sysmman=''
679i_sysmode=''
680i_sysmount=''
681i_sysndir=''
682i_sysparam=''
683i_sysresrc=''
684i_syssecrt=''
685i_sysselct=''
686i_sysstat=''
687i_sysstatfs=''
688i_sysstatvfs=''
689i_systimes=''
690i_systypes=''
691i_sysuio=''
692i_sysun=''
693i_sysutsname=''
694i_sysvfs=''
695i_syswait=''
696i_sgtty=''
697i_termio=''
698i_termios=''
699i_systime=''
700i_systimek=''
701i_time=''
702timeincl=''
703i_unistd=''
704i_ustat=''
705i_utime=''
706i_values=''
707i_stdarg=''
708i_varargs=''
709i_varhdr=''
710i_vfork=''
711inc_version_list=''
712inc_version_list_init=''
713installprefix=''
714installprefixexp=''
715installstyle=''
716installusrbinperl=''
717intsize=''
718longsize=''
719shortsize=''
2304df62 720libc=''
b4eb6b3d
JH
721ldlibpthname=''
722libperl=''
723shrpenv=''
724useshrplib=''
a0d0e21e 725glibpth=''
2304df62 726libpth=''
8e07c86e 727loclibpth=''
2304df62
AD
728plibpth=''
729xlibpth=''
1cfa4ec7 730ignore_versioned_solibs=''
2304df62 731libs=''
43999f95
JH
732libsdirs=''
733libsfiles=''
734libsfound=''
13b3f787 735libspath=''
85e6fe83 736lns=''
b4eb6b3d
JH
737d_PRIEUldbl=''
738d_PRIFUldbl=''
739d_PRIGUldbl=''
740d_PRIeldbl=''
741d_PRIfldbl=''
742d_PRIgldbl=''
743d_SCNfldbl=''
744sPRIEUldbl=''
745sPRIFUldbl=''
746sPRIGUldbl=''
747sPRIeldbl=''
748sPRIfldbl=''
749sPRIgldbl=''
750sSCNfldbl=''
751lseeksize=''
752lseektype=''
8ff267be 753make_set_make=''
b4eb6b3d
JH
754d_mymalloc=''
755freetype=''
756mallocobj=''
757mallocsrc=''
758malloctype=''
759usemymalloc=''
760installman1dir=''
761man1dir=''
762man1direxp=''
763man1ext=''
764installman3dir=''
765man3dir=''
766man3direxp=''
767man3ext=''
768modetype=''
769multiarch=''
770mydomain=''
771myhostname=''
772phostname=''
2304df62
AD
773c=''
774n=''
b4eb6b3d
JH
775d_eofnblk=''
776eagain=''
777o_nonblock=''
778rd_nodata=''
779netdb_hlen_type=''
780netdb_host_type=''
781netdb_name_type=''
782netdb_net_type=''
783groupcat=''
784hostcat=''
785passcat=''
786orderlib=''
787ranlib=''
788d_perl_otherlibdirs=''
789otherlibdirs=''
2304df62
AD
790package=''
791spackage=''
b4eb6b3d
JH
792pager=''
793api_revision=''
794api_subversion=''
795api_version=''
796api_versionstring=''
797patchlevel=''
798revision=''
799subversion=''
800version=''
801perl5=''
802perladmin=''
803perlpath=''
804d_nv_preserves_uv=''
805d_nv_preserves_uv_bits=''
806i16size=''
807i16type=''
808i32size=''
809i32type=''
810i64size=''
811i64type=''
812i8size=''
813i8type=''
814ivsize=''
815ivtype=''
816nvsize=''
817nvtype=''
818u16size=''
819u16type=''
820u32size=''
821u32type=''
822u64size=''
823u64type=''
824u8size=''
825u8type=''
826uvsize=''
827uvtype=''
828ivdformat=''
829nvEUformat=''
830nvFUformat=''
831nvGUformat=''
832nveformat=''
833nvfformat=''
834nvgformat=''
835uvXUformat=''
836uvoformat=''
837uvuformat=''
838uvxformat=''
839pidtype=''
840prefix=''
841prefixexp=''
842installprivlib=''
843privlib=''
844privlibexp=''
845prototype=''
846ptrsize=''
847d_PRIXU64=''
848d_PRId64=''
849d_PRIi64=''
850d_PRIo64=''
851d_PRIu64=''
852d_PRIx64=''
853sPRIXU64=''
854sPRId64=''
855sPRIi64=''
856sPRIo64=''
857sPRIu64=''
858sPRIx64=''
859d_quad=''
860quadkind=''
861quadtype=''
862uquadtype=''
863drand01=''
864randbits=''
865randfunc=''
866randseedtype=''
867seedfunc=''
868installscript=''
869scriptdir=''
870scriptdirexp=''
871selectminbits=''
872selecttype=''
8ff267be 873sh=''
b4eb6b3d
JH
874sig_count=''
875sig_name=''
876sig_name_init=''
877sig_num=''
878sig_num_init=''
879installsitearch=''
880sitearch=''
881sitearchexp=''
882installsitebin=''
883sitebin=''
884sitebinexp=''
885installsitelib=''
886sitelib=''
887sitelib_stem=''
888sitelibexp=''
889siteprefix=''
890siteprefixexp=''
891sizesize=''
892sizetype=''
a0d0e21e 893so=''
b4eb6b3d 894socksizetype=''
2304df62
AD
895sharpbang=''
896shsharp=''
897spitshell=''
dfe9444c 898src=''
b4eb6b3d
JH
899ssizetype=''
900startperl=''
2304df62 901startsh=''
b4eb6b3d
JH
902stdchar=''
903d_stdio_stream_array=''
904stdio_stream_array=''
905sysman=''
5ff3f7a4 906trnl=''
b4eb6b3d
JH
907uidformat=''
908uidsign=''
909uidsize=''
910uidtype=''
911archname64=''
912use64bitall=''
913use64bitint=''
914ccflags_uselargefiles=''
915ldflags_uselargefiles=''
916libswanted_uselargefiles=''
917uselargefiles=''
918uselongdouble=''
919usemorebits=''
920usemultiplicity=''
2304df62 921nm_opt=''
40a7a20a 922nm_so_opt=''
2304df62
AD
923runnm=''
924usenm=''
b4eb6b3d 925useperlio=''
29209bc5 926usesocks=''
b4eb6b3d
JH
927d_oldpthreads=''
928use5005threads=''
929useithreads=''
930usethreads=''
2304df62 931incpath=''
2304df62
AD
932mips_type=''
933usrinc=''
b4eb6b3d
JH
934d_vendorarch=''
935installvendorarch=''
936vendorarch=''
937vendorarchexp=''
938d_vendorbin=''
939installvendorbin=''
940vendorbin=''
941vendorbinexp=''
942d_vendorlib=''
943installvendorlib=''
944vendorlib=''
945vendorlib_stem=''
946vendorlibexp=''
947usevendorprefix=''
948vendorprefix=''
949vendorprefixexp=''
d56c5707 950versiononly=''
b4eb6b3d
JH
951defvoidused=''
952voidflags=''
953pm_apiversion=''
954xs_apiversion=''
2304df62
AD
955CONFIG=''
956
ecfc5424
AD
957define='define'
958undef='undef'
959smallmach='pdp11 i8086 z8000 i80286 iAPX286'
960rmlist=''
961
962: We must find out about Eunice early
963eunicefix=':'
964if test -f /etc/unixtovms; then
965 eunicefix=/etc/unixtovms
966fi
967if test -f /etc/unixtovms.exe; then
968 eunicefix=/etc/unixtovms.exe
969fi
970
b4eb6b3d 971i_whoami=''
6b356c8e
JH
972ccname=''
973ccversion=''
9c839522 974perllibs=''
b4eb6b3d
JH
975: set useposix=false in your hint file to disable the POSIX extension.
976useposix=true
977: set useopcode=false in your hint file to disable the Opcode extension.
978useopcode=true
dfe9444c 979: Trailing extension. Override this in a hint file, if needed.
4e2a5f63 980_exe=''
dfe9444c
AD
981: Extra object files, if any, needed on this platform.
982archobjs=''
b4eb6b3d 983archname=''
ff935051
JH
984: Possible local include directories to search.
985: Set locincpth to "" in a hint file to defeat local include searches.
986locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
987locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
988:
989: no include file wanted by default
990inclwanted=''
991
b4eb6b3d 992groupstype=''
732c9516
JH
993: change the next line if compiling for Xenix/286 on Xenix/386
994xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
995: Possible local library directories to search.
996loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
997loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
998
999: general looking path for locating libraries
5869b1f1 1000glibpth="/lib /usr/lib $xlibpth"
732c9516 1001glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1002test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1003test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1004
1005: Private path used by Configure to find libraries. Its value
1006: is prepended to libpth. This variable takes care of special
1007: machines, like the mips. Usually, it should be empty.
1008plibpth=''
1009
1cfa4ec7
GS
1010: default library list
1011libswanted=''
921b2963 1012: some systems want to use only the non-versioned libso:s
1cfa4ec7 1013ignore_versioned_solibs=''
b4eb6b3d
JH
1014archname64=''
1015ccflags_uselargefiles=''
1016ldflags_uselargefiles=''
1017libswanted_uselargefiles=''
1018: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1019: set usesocks on the Configure command line to enable socks.
b4eb6b3d
JH
1020: set usethreads on the Configure command line to enable threads.
1021: full support for void wanted by default
1022defvoidused=15
1023
ecfc5424 1024: List of libraries we want.
693762b4 1025: If anyone needs -lnet, put it in a hint file.
997d70a2 1026libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
69e84d1d 1027libswanted="$libswanted dld ld sun m c cposix posix"
f1066039 1028libswanted="$libswanted ndir dir crypt sec"
0c9177ab 1029libswanted="$libswanted ucb bsd BSD PW x iconv util"
1aef975c 1030: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1031: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1032glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1033glibpth="/usr/shlib $glibpth"
1034: Do not use vfork unless overridden by a hint file.
1035usevfork=false
1036
8ff267be 1037: Find the basic shell for Bourne shell scripts
1038case "$sh" in
1039'')
8ff267be 1040 case "$SYSTYPE" in
1041 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1042 *) xxx='/bin/sh';;
1043 esac
1044 if test -f "$xxx"; then
1045 sh="$xxx"
1046 else
1047 : Build up a list and do a single loop so we can 'break' out.
1048 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1049 for xxx in sh bash ksh pdksh ash; do
1050 for p in $pth; do
1051 try="$try ${p}/${xxx}"
1052 done
1053 done
1054 for xxx in $try; do
1055 if test -f "$xxx"; then
1056 sh="$xxx";
8ff267be 1057 break
1058 elif test -f "$xxx.exe"; then
1059 sh="$xxx";
8ff267be 1060 break
1061 fi
1062 done
1063 fi
1064 ;;
1065esac
1066
1067case "$sh" in
1068'') cat <<EOM >&2
1069$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1070
8ff267be 1071Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1072Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1073we'll try to straighten this all out.
8ff267be 1074EOM
1075 exit 1
1076 ;;
1077esac
1078
760ac839 1079: see if sh knows # comments
8ff267be 1080if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1081 shsharp=true
1082 spitshell=cat
760ac839
LW
1083 xcat=/bin/cat
1084 test -f $xcat || xcat=/usr/bin/cat
1085 echo "#!$xcat" >try
1086 $eunicefix try
1087 chmod +x try
1088 ./try > today
1089 if test -s today; then
760ac839
LW
1090 sharpbang='#!'
1091 else
1092 echo "#! $xcat" > try
1093 $eunicefix try
1094 chmod +x try
1095 ./try > today
1096 if test -s today; then
760ac839
LW
1097 sharpbang='#! '
1098 else
760ac839
LW
1099 sharpbang=': use '
1100 fi
1101 fi
1102else
dfe9444c 1103 echo " "
8ff267be 1104 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1105 shsharp=false
1106 cd ..
1107 echo "exec grep -v '^[ ]*#'" >spitshell
1108 chmod +x spitshell
1109 $eunicefix spitshell
1110 spitshell=`pwd`/spitshell
1111 cd UU
1112 echo "I presume that if # doesn't work, #! won't work either!"
1113 sharpbang=': use '
1114fi
1115rm -f try today
1116
1117: figure out how to guarantee sh startup
8ff267be 1118case "$startsh" in
1119'') startsh=${sharpbang}${sh} ;;
1120*)
760ac839 1121esac
760ac839
LW
1122cat >try <<EOSS
1123$startsh
1124set abc
1125test "$?abc" != 1
1126EOSS
1127
1128chmod +x try
1129$eunicefix try
1130if ./try; then
8ff267be 1131 : echo "Yup, it does."
760ac839 1132else
dfe9444c
AD
1133 echo "Hmm... '$startsh' does not guarantee sh startup..."
1134 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839
LW
1135fi
1136rm -f try
1137
aebf16e7
AD
1138
1139: Save command line options in file UU/cmdline.opt for later use in
1140: generating config.sh.
1141cat > cmdline.opt <<EOSH
1142# Configure command line arguments.
1143config_arg0='$0'
1144config_args='$*'
1145config_argc=$#
1146EOSH
1147argn=1
1148for arg in "$@"; do
1149 cat >>cmdline.opt <<EOSH
1150config_arg$argn='$arg'
1151EOSH
1152 argn=`expr $argn + 1`
1153done
1154
2304df62
AD
1155: produce awk script to parse command line options
1156cat >options.awk <<'EOF'
1157BEGIN {
02e93a22 1158 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1159
1160 len = length(optstr);
1161 for (i = 1; i <= len; i++) {
1162 c = substr(optstr, i, 1);
1163 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1164 if (a == ":") {
1165 arg[c] = 1;
1166 i++;
1167 }
1168 opt[c] = 1;
1169 }
1170}
1171{
1172 expect = 0;
1173 str = $0;
1174 if (substr(str, 1, 1) != "-") {
1175 printf("'%s'\n", str);
1176 next;
1177 }
1178 len = length($0);
1179 for (i = 2; i <= len; i++) {
1180 c = substr(str, i, 1);
1181 if (!opt[c]) {
1182 printf("-%s\n", substr(str, i));
1183 next;
1184 }
1185 printf("-%s\n", c);
1186 if (arg[c]) {
1187 if (i < len)
1188 printf("'%s'\n", substr(str, i + 1));
1189 else
1190 expect = 1;
1191 next;
1192 }
1193 }
1194}
1195END {
1196 if (expect)
1197 print "?";
1198}
1199EOF
1200
1201: process the command line options
4633a7c4
LW
1202set X `for arg in "$@"; do echo "X$arg"; done |
1203 sed -e s/X// | awk -f options.awk`
2304df62
AD
1204eval "set $*"
1205shift
1206rm -f options.awk
1207
1208: set up default values
1209fastread=''
1210reuseval=false
1211config_sh=''
1212alldone=''
1213error=''
1214silent=''
1215extractsh=''
ecfc5424 1216override=''
16d20bd9 1217knowitall=''
02e93a22 1218rm -f optdef.sh posthint.sh
28757baa 1219cat >optdef.sh <<EOS
1220$startsh
1221EOS
2304df62 1222
dfe9444c 1223
2304df62
AD
1224: option parsing
1225while test $# -gt 0; do
1226 case "$1" in
1227 -d) shift; fastread=yes;;
1228 -e) shift; alldone=cont;;
1229 -f)
1230 shift
1231 cd ..
1232 if test -r "$1"; then
1233 config_sh="$1"
1234 else
a0d0e21e 1235 echo "$me: cannot read config file $1." >&2
2304df62
AD
1236 error=true
1237 fi
1238 cd UU
1239 shift;;
1240 -h) shift; error=true;;
1241 -r) shift; reuseval=true;;
dfe9444c 1242 -s) shift; silent=true; realsilent=true;;
2304df62 1243 -E) shift; alldone=exit;;
16d20bd9 1244 -K) shift; knowitall=true;;
ecfc5424 1245 -O) shift; override=true;;
dfe9444c 1246 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1247 -D)
1248 shift
1249 case "$1" in
1250 *=)
1251 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1252 echo "$me: ignoring -D $1" >&2
1253 ;;
ecfc5424 1254 *=*) echo "$1" | \
1aef975c
AD
1255 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1256 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1257 esac
1258 shift
1259 ;;
1260 -U)
1261 shift
1262 case "$1" in
1aef975c 1263 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1264 *=*)
1265 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1266 echo "$me: ignoring -U $1" >&2
1267 ;;
1aef975c 1268 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1269 esac
1270 shift
1271 ;;
02e93a22
JH
1272 -A)
1273 shift
1274 xxx=''
1275 yyy="$1"
02e93a22 1276 zzz=''
5f83a3e9 1277 uuu=undef
02e93a22 1278 case "$yyy" in
5f83a3e9
JH
1279 *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1280 case "$zzz" in
1281 *:*) zzz='' ;;
1282 *) xxx=append
1283 zzz=" "`echo $yyy|sed 's!^[^=]*=!!'`
1284 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1285 esac
1286 ;;
1287 esac
1288 case "$xxx" in
1289 '') case "$yyy" in
1290 *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1291 yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1292 zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1293 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1294 *) xxx=`echo $yyy|sed 's!:.*!!'`
1295 yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1296 esac
1297 ;;
1298 esac
02e93a22
JH
1299 case "$xxx" in
1300 append)
5f83a3e9 1301 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1302 clear)
5f83a3e9 1303 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1304 define)
1305 case "$zzz" in
1306 '') zzz=define ;;
1307 esac
5f83a3e9 1308 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1309 eval)
5f83a3e9 1310 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1311 prepend)
5f83a3e9 1312 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1313 undef)
1314 case "$zzz" in
1315 '') zzz="$uuu" ;;
1316 esac
5f83a3e9
JH
1317 echo "$yyy=$zzz" >> posthint.sh ;;
1318 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1319 esac
bde6b06b 1320 shift
02e93a22 1321 ;;
dfe9444c 1322 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1323 exit 0;;
2304df62 1324 --) break;;
a0d0e21e 1325 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1326 *) break;;
1327 esac
1328done
1329
1330case "$error" in
1331true)
1332 cat >&2 <<EOM
2afac517 1333Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1334 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1335 -d : use defaults for all answers.
1336 -e : go on without questioning past the production of config.sh.
1337 -f : specify an alternate default configuration file.
1338 -h : print this help message and exit (with an error status).
1339 -r : reuse C symbols value if possible (skips costly nm extraction).
1340 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1341 -D : define symbol to have some value:
1342 -D symbol symbol gets the value 'define'
1343 -D symbol=value symbol gets the value 'value'
2304df62 1344 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1345 -K : do not use unless you know what you are doing.
ecfc5424 1346 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1347 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1348 -U : undefine symbol:
1349 -U symbol symbol gets the value 'undef'
1350 -U symbol= symbol gets completely empty
02e93a22 1351 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1352 -A symbol=value append " "value to symbol
02e93a22
JH
1353 -A append:symbol=value append value to symbol
1354 -A define:symbol=value define symbol to have value
02e93a22
JH
1355 -A clear:symbol define symbol to be ''
1356 -A define:symbol define symbol to be 'define'
1357 -A eval:symbol=value define symbol to be eval of value
1358 -A prepend:symbol=value prepend value to symbol
1359 -A undef:symbol define symbol to be 'undef'
1360 -A undef:symbol= define symbol to be ''
2304df62
AD
1361 -V : print version number and exit (with a zero status).
1362EOM
1363 exit 1
1364 ;;
1365esac
1366
dfe9444c
AD
1367: Sanity checks
1368case "$fastread$alldone" in
1369yescont|yesexit) ;;
1370*)
aaeb8e51
GS
1371 case "$extractsh" in
1372 true) ;;
1373 *)
1374 if test ! -t 0; then
1375 echo "Say 'sh Configure', not 'sh <Configure'"
1376 exit 1
1377 fi
1378 ;;
1379 esac
dfe9444c
AD
1380 ;;
1381esac
1382
2304df62
AD
1383exec 4>&1
1384case "$silent" in
1385true) exec 1>/dev/null;;
1386esac
1387
ecfc5424 1388: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1389touch optdef.sh
1390. ./optdef.sh
02e93a22
JH
1391: create the posthint manipulation script and leave the file out there...
1392touch posthint.sh
a0d0e21e 1393
2304df62 1394: set package name
85e6fe83 1395package=perl5
b4eb6b3d
JH
1396first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1397last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1398case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1399ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1400*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1401esac
2304df62 1402
2304df62
AD
1403: Some greps do not return status, grrr.
1404echo "grimblepritz" >grimble
1405if grep blurfldyick grimble >/dev/null 2>&1 ; then
1406 contains=contains
1407elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1408 contains=grep
1409else
1410 contains=contains
1411fi
1412rm -f grimble
1413: the following should work in any shell
1414case "$contains" in
1415contains*)
1416 echo " "
1417 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1418 cat >contains <<'EOSS'
1419grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1420EOSS
1421chmod +x contains
1422esac
1423
dfe9444c
AD
1424: Find the path to the source tree
1425case "$src" in
1426'') case "$0" in
b233458b
JH
1427 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1428 case "$src" in
1429 /*) ;;
1430 *) src=`cd ../$src && pwd` ;;
1431 esac
1432 ;;
dfe9444c
AD
1433 *) src='.';;
1434 esac;;
1435esac
1436case "$src" in
1437'') src=/
1438 rsrc=/
1439 ;;
1440/*) rsrc="$src";;
1441*) rsrc="../$src";;
1442esac
1443if test -f $rsrc/Configure && \
1444 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1445then
1446 : found it, so we are ok.
1447else
1448 rsrc=''
1449 for src in . .. ../.. ../../.. ../../../..; do
1450 if test -f ../$src/Configure && \
1451 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1452 then
1453 rsrc=../$src
1454 break
1455 fi
1456 done
1457fi
1458case "$rsrc" in
1459'')
1460 cat <<EOM >&4
1461
1462Sorry, I can't seem to locate the source dir for $package. Please start
1463Configure with an explicit path -- i.e. /some/path/Configure.
1464
1465EOM
1466 exit 1
1467 ;;
1468../.) rsrc='..';;
1469*)
1470 echo " "
1471 echo "Sources for $package found in \"$src\"." >&4
1472 ;;
1473esac
1474
1475: script used to extract .SH files with variable substitutions
1476cat >extract <<'EOS'
2000072c 1477CONFIGDOTSH=true
dfe9444c
AD
1478echo "Doing variable substitutions on .SH files..."
1479if test -f $src/MANIFEST; then
f7ab18e9 1480 set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
dfe9444c
AD
1481else
1482 echo "(Looking for .SH files under the source directory.)"
1483 set x `(cd $src; find . -name "*.SH" -print)`
1484fi
1485shift
1486case $# in
14870) set x `(cd $src; echo *.SH)`; shift;;
1488esac
1489if test ! -f $src/$1; then
1490 shift
1491fi
1492mkdir_p='
1493name=$1;
1494create="";
1495while test $name; do
1496 if test ! -d "$name"; then
1497 create="$name $create";
1498 name=`echo $name | sed -e "s|^[^/]*$||"`;
1499 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1500 else
1501 name="";
1502 fi;
1503done;
1504for file in $create; do
1505 mkdir $file;
1506done
1507'
1508for file in $*; do
1509 case "$src" in
1510 ".")
1511 case "$file" in
1512 */*)
1513 dir=`expr X$file : 'X\(.*\)/'`
1514 file=`expr X$file : 'X.*/\(.*\)'`
1515 (cd $dir && . ./$file)
1516 ;;
1517 *)
1518 . ./$file
1519 ;;
1520 esac
1521 ;;
1522 *)
1523 case "$file" in
1524 */*)
1525 dir=`expr X$file : 'X\(.*\)/'`
1526 file=`expr X$file : 'X.*/\(.*\)'`
1527 (set x $dir; shift; eval $mkdir_p)
1528 sh <$src/$dir/$file
1529 ;;
1530 *)
1531 sh <$src/$file
1532 ;;
1533 esac
1534 ;;
1535 esac
1536done
1537if test -f $src/config_h.SH; then
1538 if test ! -f config.h; then
1539 : oops, they left it out of MANIFEST, probably, so do it anyway.
1540 . $src/config_h.SH
1541 fi
1542fi
1543EOS
1544
1545: extract files and exit if asked to do so
1546case "$extractsh" in
1547true)
1548 case "$realsilent" in
1549 true) ;;
1550 *) exec 1>&4;;
1551 esac
1552 case "$config_sh" in
1553 '') config_sh='config.sh';;
1554 esac
1555 echo " "
1556 echo "Fetching answers from $config_sh..."
1557 cd ..
1558 . $config_sh
1559 test "$override" && . ./optdef.sh
1560 echo " "
1561 . UU/extract
1562 rm -rf UU
1563 echo "Done."
1564 exit 0
1565 ;;
1566esac
1567
1568: Eunice requires " " instead of "", can you believe it
1569echo " "
1570: Here we go...
1571echo "Beginning of configuration questions for $package."
1572
1573trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1574
2304df62
AD
1575: first determine how to suppress newline on echo command
1576echo " "
1577echo "Checking echo to see how to suppress newlines..."
1578(echo "hi there\c" ; echo " ") >.echotmp
1579if $contains c .echotmp >/dev/null 2>&1 ; then
1580 echo "...using -n."
1581 n='-n'
1582 c=''
1583else
1584 cat <<'EOM'
1585...using \c
1586EOM
1587 n=''
1588 c='\c'
1589fi
1590echo $n "The star should be here-->$c"
1591echo '*'
1592rm -f .echotmp
1593
1594: Now test for existence of everything in MANIFEST
1595echo " "
dfe9444c 1596if test -f $rsrc/MANIFEST; then
2304df62 1597 echo "First let's make sure your kit is complete. Checking..." >&4
dfe9444c 1598 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
2304df62 1599 rm -f missing
dfe9444c 1600 tmppwd=`pwd`
2304df62 1601 for filelist in x??; do
dfe9444c 1602 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
2304df62
AD
1603 done
1604 if test -s missing; then
1605 cat missing >&4
1606 cat >&4 <<'EOM'
1607
1608THIS PACKAGE SEEMS TO BE INCOMPLETE.
1609
1610You have the option of continuing the configuration process, despite the
1611distinct possibility that your kit is damaged, by typing 'y'es. If you
1612do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1613and contact the author (perlbug@perl.org).
2304df62
AD
1614
1615EOM
1616 echo $n "Continue? [n] $c" >&4
1617 read ans
1618 case "$ans" in
1619 y*)
1620 echo "Continuing..." >&4
1621 rm -f missing
1622 ;;
1623 *)
1624 echo "ABORTING..." >&4
1625 kill $$
1626 ;;
1627 esac
1628 else
dfe9444c 1629 echo "Looks good..."
2304df62
AD
1630 fi
1631else
1632 echo "There is no MANIFEST file. I hope your kit is complete !"
1633fi
1634rm -f missing x??
1635
5ff3f7a4
GS
1636echo " "
1637: Find the appropriate value for a newline for tr
1638if test -n "$DJGPP"; then
1639 trnl='\012'
1640fi
1641if test X"$trnl" = X; then
1642 case "`echo foo|tr '\n' x 2>/dev/null`" in
1643 foox) trnl='\n' ;;
1644 esac
1645fi
1646if test X"$trnl" = X; then
1647 case "`echo foo|tr '\012' x 2>/dev/null`" in
1648 foox) trnl='\012' ;;
1649 esac
1650fi
1651if test X"$trnl" = X; then
1652 cat <<EOM >&2
1653
1654$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1655
1656EOM
1657 exit 1
1658fi
1659
2304df62
AD
1660: compute the number of columns on the terminal for proper question formatting
1661case "$COLUMNS" in
1662'') COLUMNS='80';;
1663esac
1664
1665: set up the echo used in my read
1666myecho="case \"\$xxxm\" in
1667'') echo $n \"\$rp $c\" >&4;;
1668*) case \"\$rp\" in
1669 '') echo $n \"[\$xxxm] $c\";;
1670 *)
1671 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1672 echo \"\$rp\" >&4
1673 echo $n \"[\$xxxm] $c\" >&4
1674 else
1675 echo $n \"\$rp [\$xxxm] $c\" >&4
1676 fi
1677 ;;
1678 esac;;
1679esac"
1680
1681: now set up to do reads with possible shell escape and default assignment
1682cat <<EOSC >myread
28757baa 1683$startsh
2304df62
AD
1684xxxm=\$dflt
1685$myecho
1686ans='!'
1687case "\$fastread" in
1688yes) case "\$dflt" in
1689 '') ;;
1690 *) ans='';
1691 case "\$silent-\$rp" in
1692 true-) ;;
1693 *) echo " " >&4;;
1694 esac;;
1695 esac;;
1696*) case "\$silent" in
1697 true) case "\$rp" in
1698 '') ans='';;
1699 esac;;
1700 esac;;
1701esac
1702while expr "X\$ans" : "X!" >/dev/null; do
1703 read answ
1704 set x \$xxxm
1705 shift
dfe9444c 1706 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1707 case "\$answ" in
dfe9444c
AD
1708 "!")
1709 sh 1>&4
1710 echo " "
1711 $myecho
1712 ;;
1713 !*)
1714 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1715 shift
1716 sh 1>&4 -c "\$*"
1717 echo " "
1718 $myecho
1719 ;;
2304df62
AD
1720 "\$ans")
1721 case "\$ans" in
ecfc5424
AD
1722 \\&*)
1723 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1724 shift
1725 case "\$1" in
1726 -d)
1727 fastread=yes
40a7a20a 1728 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1729 ;;
1730 -*)
40a7a20a 1731 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1732 ;;
1733 esac
1734 $myecho
1735 ans=!
1736 ;;
2304df62
AD
1737 esac;;
1738 *)
1739 case "\$aok" in
1740 y)
1741 echo "*** Substitution done -- please confirm."
1742 xxxm="\$ans"
c9795ab7 1743 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1744 xxxm="\$ans"
1745 ans=!
1746 ;;
1747 *)
1748 echo "*** Error -- try again."
1749 ans=!
1750 ;;
1751 esac
1752 $myecho
1753 ;;
1754 esac
1755 case "\$ans\$xxxm\$nostick" in
1756 '')
1757 ans=!
1758 $myecho
1759 ;;
1760 esac
1761done
1762case "\$ans" in
1763'') ans="\$xxxm";;
1764esac
1765EOSC
1766
1767: create .config dir to save info across Configure sessions
1768test -d ../.config || mkdir ../.config
1769cat >../.config/README <<EOF
1770This directory created by Configure to save information that should
dfe9444c 1771persist across sessions for $package.
2304df62
AD
1772
1773You may safely delete it if you wish.
1774EOF
1775
9507cadf 1776xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 1777case "$usedevel" in
0107c034 1778$define|true|[yY]*) ;;
9507cadf 1779*) case "$xversion" in
0107c034
JH
1780 *[13579])
1781 cat >&4 <<EOH
1782*** WHOA THERE!!! ***
1783
1784 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
1785 The version of this $package distribution is $xversion, that is, odd,
1786 (as opposed to even) and that signifies a development release.
3d5d58b1 1787 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
1788
1789 Do ***NOT*** install this into production use.
1790 Data corruption and crashes are possible.
1791
1792 It is most seriously suggested that you do not continue any further
1793 unless you want to help in developing and debugging Perl.
1794
1795EOH
1796 rp='Do you really want to continue?'
1797 dflt='n'
1798 . ./myread
1799 case "$ans" in
1800 [yY]) echo >&4 "Okay, continuing." ;;
1801 *) echo >&4 "Okay, bye."
1802 exit 1
1803 ;;
1804 esac
1805 ;;
1806 esac
1807 ;;
1808esac
1809
2304df62
AD
1810: general instructions
1811needman=true
1812firsttime=true
760ac839 1813user=`(logname) 2>/dev/null`
dfe9444c
AD
1814case "$user" in
1815'') user=`whoami 2>&1`;;
760ac839 1816esac
2304df62
AD
1817if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1818 firsttime=false
1819 echo " "
1820 rp='Would you like to see the instructions?'
1821 dflt=n
1822 . ./myread
1823 case "$ans" in
1824 [yY]*) ;;
1825 *) needman=false;;
1826 esac
1827fi
1828if $needman; then
1829 cat <<EOH
4e2a5f63 1830
2304df62 1831This installation shell script will examine your system and ask you questions
a0d0e21e 1832to determine how the perl5 package should be installed. If you get
2304df62
AD
1833stuck on a question, you may use a ! shell escape to start a subshell or
1834execute a command. Many of the questions will have default answers in square
1835brackets; typing carriage return will give you the default.
1836
1837On some of the questions which ask for file or directory names you are allowed
1838to use the ~name construct to specify the login directory belonging to "name",
1839even if you don't have a shell which knows about that. Questions where this is
1840allowed will be marked "(~name ok)".
1841
1842EOH
1843 rp=''
1844 dflt='Type carriage return to continue'
1845 . ./myread
1846 cat <<'EOH'
1847
1848The prompter used in this script allows you to use shell variables and
1849backticks in your answers. You may use $1, $2, etc... to refer to the words
1850in the default answer, as if the default line was a set of arguments given to a
1851script shell. This means you may also use $* to repeat the whole default line,
1852so you do not have to re-type everything to add something to the default.
1853
1854Everytime there is a substitution, you will have to confirm. If there is an
1855error (e.g. an unmatched backtick), the default answer will remain unchanged
1856and you will be prompted again.
1857
1858If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1859the questions and use the computed defaults (or the previous answers if there
1860was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1861You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1862on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1863
1864EOH
1865 . ./myread
1866 cat <<EOH
1867
1868Much effort has been expended to ensure that this shell script will run on any
1869Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1870Configure and run it again. If you can't run Configure for some reason,
1871you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 1872have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
1873
1874This installation script affects things in two ways:
1875
18761) it may do direct variable substitutions on some of the files included
1877 in this kit.
18782) it builds a config.h file for inclusion in C programs. You may edit
1879 any of these files as the need arises after running this script.
1880
1881If you make a mistake on a question, there is no easy way to back up to it
1882currently. The easiest thing to do is to edit config.sh and rerun all the SH
1883files. Configure will offer to let you do this before it runs the SH files.
1884
1885EOH
1886 dflt='Type carriage return to continue'
1887 . ./myread
1888 case "$firsttime" in
1889 true) echo $user >>../.config/instruct;;
1890 esac
1891fi
1892
2304df62
AD
1893: find out where common programs are
1894echo " "
1895echo "Locating common programs..." >&4
1896cat <<EOSC >loc
1897$startsh
1898case \$# in
18990) exit 1;;
1900esac
1901thing=\$1
1902shift
1903dflt=\$1
1904shift
1905for dir in \$*; do
1906 case "\$thing" in
1907 .)
1908 if test -d \$dir/\$thing; then
1909 echo \$dir
1910 exit 0
1911 fi
1912 ;;
1913 *)
a0d0e21e 1914 for thisthing in \$dir/\$thing; do
ecfc5424 1915 : just loop through to pick last item
a0d0e21e 1916 done
25f94b33 1917 if test -f \$thisthing; then
a0d0e21e 1918 echo \$thisthing
2304df62
AD
1919 exit 0
1920 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
1921 if test -n "$DJGPP"; then
1922 echo \$dir/\$thing.exe
1923 else
1924 : on Eunice apparently
1925 echo \$dir/\$thing
1926 fi
2304df62
AD
1927 exit 0
1928 fi
1929 ;;
1930 esac
1931done
1932echo \$dflt
1933exit 1
1934EOSC
1935chmod +x loc
1936$eunicefix loc
1937loclist="
1938awk
1939cat
b4eb6b3d
JH
1940comm
1941cp
2304df62
AD
1942echo
1943expr
1944grep
a0d0e21e 1945ls
dfe9444c 1946make
b4eb6b3d 1947mkdir
2304df62
AD
1948rm
1949sed
b4eb6b3d 1950sort
85e6fe83 1951touch
2304df62 1952tr
b4eb6b3d 1953uniq
2304df62
AD
1954"
1955trylist="
1956Mcc
dfe9444c 1957ar
b4eb6b3d 1958byacc
2304df62 1959cpp
b4eb6b3d 1960csh
2304df62
AD
1961date
1962egrep
8ff267be 1963gzip
b4eb6b3d 1964less
8ff267be 1965ln
b4eb6b3d 1966more
693762b4 1967nm
b4eb6b3d
JH
1968nroff
1969pg
2304df62
AD
1970test
1971uname
8ff267be 1972zip
2304df62 1973"
8e07c86e 1974pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
1975pth="$pth /lib /usr/lib"
1976for file in $loclist; do
dfe9444c
AD
1977 eval xxx=\$$file
1978 case "$xxx" in
1979 /*|?:[\\/]*)
1980 if test -f "$xxx"; then
1981 : ok
1982 else
1983 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1984 xxx=`./loc $file $file $pth`
1985 fi
1986 ;;
1987 '') xxx=`./loc $file $file $pth`;;
1988 *) xxx=`./loc $xxx $xxx $pth`;;
1989 esac
2304df62
AD
1990 eval $file=$xxx
1991 eval _$file=$xxx
1992 case "$xxx" in
1993 /*)
1994 echo $file is in $xxx.
1995 ;;
8e07c86e
AD
1996 ?:[\\/]*)
1997 echo $file is in $xxx.
1998 ;;
2304df62 1999 *)
25f94b33
AD
2000 echo "I don't know where '$file' is, and my life depends on it." >&4
2001 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2002 exit 1
2304df62
AD
2003 ;;
2004 esac
2005done
2006echo " "
2007echo "Don't worry if any of the following aren't found..."
2008say=offhand
2009for file in $trylist; do
dfe9444c
AD
2010 eval xxx=\$$file
2011 case "$xxx" in
2012 /*|?:[\\/]*)
2013 if test -f "$xxx"; then
2014 : ok
2015 else
2016 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2017 xxx=`./loc $file $file $pth`
2018 fi
2019 ;;
2020 '') xxx=`./loc $file $file $pth`;;
2021 *) xxx=`./loc $xxx $xxx $pth`;;
2022 esac
2304df62
AD
2023 eval $file=$xxx
2024 eval _$file=$xxx
2025 case "$xxx" in
2026 /*)
2027 echo $file is in $xxx.
2028 ;;
8e07c86e
AD
2029 ?:[\\/]*)
2030 echo $file is in $xxx.
2031 ;;
2304df62
AD
2032 *)
2033 echo "I don't see $file out there, $say."
2034 say=either
2035 ;;
2036 esac
2037done
2038case "$egrep" in
2039egrep)
2040 echo "Substituting grep for egrep."
2041 egrep=$grep
2042 ;;
2043esac
8ff267be 2044case "$ln" in
2045ln)
2046 echo "Substituting cp for ln."
2047 ln=$cp
2048 ;;
2049esac
2304df62
AD
2050case "$test" in
2051test)
2052 echo "Hopefully test is built into your sh."
2053 ;;
2054*)
ecfc5424 2055 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2304df62
AD
2056 echo "Using the test built into your sh."
2057 test=test
2058 _test=test
2059 fi
2060 ;;
2061esac
2062case "$echo" in
2063echo)
2064 echo "Hopefully echo is built into your sh."
2065 ;;
2066'') ;;
2067*)
2068 echo " "
2069echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2070 $echo $n "hi there$c" >foo1
2071 echo $n "hi there$c" >foo2
2072 if cmp foo1 foo2 >/dev/null 2>&1; then
2073 echo "They are compatible. In fact, they may be identical."
2074 else
2075 case "$n" in
2076 '-n') n='' c='\c';;
2077 *) n='-n' c='';;
2078 esac
2079 cat <<FOO
2080They are not compatible! You are probably running ksh on a non-USG system.
2081I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2082have echo built in and we may have to run some Bourne shell scripts. That
2083means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2084
2085FOO
2086 $echo $n "The star should be here-->$c"
2087 $echo "*"
2088 fi
2089 $rm -f foo1 foo2
2090 ;;
2091esac
2092
2573c5f9
JH
2093cat <<EOS >checkcc
2094$startsh
2095EOS
2096cat <<'EOSC' >>checkcc
2097case "$cc" in
2098'') ;;
2099*) $rm -f try try.*
2100 $cat >try.c <<EOM
2101int main(int argc, char *argv[]) {
2102 return 0;
2103}
2104EOM
7a282f6d 2105 if $cc -o try $ccflags try.c; then
2573c5f9
JH
2106 :
2107 else
2108 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2109 despair=yes
2110 trygcc=yes
2111 case "$cc" in
2112 *gcc*) trygcc=no ;;
2113 esac
2114 case "`$cc -v -c try.c 2>&1`" in
2115 *gcc*) trygcc=no ;;
2116 esac
2117 if $test X"$trygcc" = Xyes; then
2118 if gcc -o try -c try.c; then
2119 echo " "
2120 echo "You seem to have a working gcc, though." >&4
2121 rp="Would you like to use it?"
2122 dflt=y
2123 if $test -f myread; then
2124 . ./myread
2125 else
2126 if $test -f UU/myread; then
2127 . ./UU/myread
2128 else
2129 echo "Cannot find myread, sorry. Aborting." >&2
2130 exit 1
2131 fi
2132 fi
2133 case "$ans" in
e723fc21 2134 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2573c5f9
JH
2135 esac
2136 fi
2137 fi
2138 if $test X"$despair" = Xyes; then
5dd4fbdf
MB
2139 $cat >&4 <<EOM
2140You need to find a working C compiler.
2141Either (purchase and) install the C compiler supplied by your OS vendor,
2142or for a free C compiler try http://gcc.gnu.org/
2143I cannot continue any further, aborting.
2144EOM
2573c5f9
JH
2145 exit 1
2146 fi
2147 fi
2148 $rm -f try try.*
2149 ;;
2150esac
2151EOSC
2152
a0d0e21e
LW
2153: determine whether symbolic links are supported
2154echo " "
2155$touch blurfl
2156if $ln -s blurfl sym > /dev/null 2>&1 ; then
2157 echo "Symbolic links are supported." >&4
2158 lns="$ln -s"
2159else
2160 echo "Symbolic links are NOT supported." >&4
2161 lns="$ln"
2162fi
2163$rm -f blurfl sym
2164
ecfc5424
AD
2165: see whether [:lower:] and [:upper:] are supported character classes
2166echo " "
ecfc5424
AD
2167case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2168ABYZ)
2169 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2170 up='[:upper:]'
2171 low='[:lower:]'
2172 ;;
28e8609d
JH
2173*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2174 # (0xc9 and 0xd1), therefore that is a nice testing point.
2175 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2176 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2177 ij) up='[A-Z]'
2178 low='[a-z]'
2179 ;;
2180 esac
2181 fi
2182 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2183 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2184 ij) up='A-Z'
2185 low='a-z'
2186 ;;
2187 esac
2188 fi
2189 if test "X$up" = X -o "X$low" = X; then
2190 case "`echo IJ | od -x 2>/dev/null`" in
2191 *C9D1*|*c9d1*)
2192 echo "Hey, this might be EBCDIC." >&4
2193 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2194 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2195 ij) up='[A-IJ-RS-Z]'
2196 low='[a-ij-rs-z]'
2197 ;;
2198 esac
2199 fi
2200 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2201 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2202 ij) up='A-IJ-RS-Z'
2203 low='a-ij-rs-z'
2204 ;;
2205 esac
2206 fi
2207 ;;
2208 esac
2209 fi
2210esac
3eaeeeae 2211case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2212ij)
2213 echo "Using $up and $low to convert case." >&4
2214 ;;
ecfc5424 2215*)
28e8609d
JH
2216 echo "I don't know how to translate letters from upper to lower case." >&4
2217 echo "Your tr is not acting any way I know of." >&4
2218 exit 1
2219 ;;
ecfc5424
AD
2220esac
2221: set up the translation script tr, must be called with ./tr of course
2222cat >tr <<EOSC
2223$startsh
2224case "\$1\$2" in
2225'[A-Z][a-z]') exec $tr '$up' '$low';;
2226'[a-z][A-Z]') exec $tr '$low' '$up';;
2227esac
2228exec $tr "\$@"
2229EOSC
2230chmod +x tr
2231$eunicefix tr
2232
2304df62
AD
2233: Try to determine whether config.sh was made on this system
2234case "$config_sh" in
2235'')
43999f95
JH
2236myuname=`$uname -a 2>/dev/null`
2237$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2238# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2239# because the A-Z/a-z are not consecutive.
a0d0e21e 2240myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2241 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2242newmyuname="$myuname"
2304df62 2243dflt=n
16d20bd9
AD
2244case "$knowitall" in
2245'')
2246 if test -f ../config.sh; then
2247 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2248 eval "`grep myuname= ../config.sh`"
2249 fi
2250 if test "X$myuname" = "X$newmyuname"; then
2251 dflt=y
2252 fi
2304df62 2253 fi
16d20bd9
AD
2254 ;;
2255*) dflt=y;;
2256esac
2304df62
AD
2257
2258: Get old answers from old config file if Configure was run on the
2259: same system, otherwise use the hints.
2260hint=default
2261cd ..
2262if test -f config.sh; then
16d20bd9
AD
2263 echo " "
2264 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2265 . UU/myread
2266 case "$ans" in
f83701cd
AD
2267 n*|N*) echo "OK, I'll ignore it."
2268 mv config.sh config.sh.old
2269 myuname="$newmyuname"
2270 ;;
2304df62 2271 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2272 tmp_n="$n"
2273 tmp_c="$c"
85cad39c 2274 tmp_sh="$sh"
2304df62
AD
2275 . ./config.sh
2276 cp config.sh UU
ecfc5424
AD
2277 n="$tmp_n"
2278 c="$tmp_c"
85cad39c 2279 : Older versions did not always set $sh. Catch re-use of such
2280 : an old config.sh.
2281 case "$sh" in
2282 '') sh="$tmp_sh" ;;
2283 esac
2304df62
AD
2284 hint=previous
2285 ;;
2286 esac
2287fi
2573c5f9 2288. ./UU/checkcc
2304df62
AD
2289if test ! -f config.sh; then
2290 $cat <<EOM
2291
4e2a5f63
AD
2292First time through, eh? I have some defaults handy for some systems
2293that need some extra help getting the Configure answers right:
2304df62
AD
2294
2295EOM
dfe9444c 2296 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2297 dflt=''
2298 : Half the following guesses are probably wrong... If you have better
7f2de2d2 2299 : tests or hints, please send them to perlbug@perl.org
2304df62 2300 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2301 $test -f /irix && osname=irix
85e6fe83
LW
2302 $test -f /xenix && osname=sco_xenix
2303 $test -f /dynix && osname=dynix
2304 $test -f /dnix && osname=dnix
5f05dabc 2305 $test -f /lynx.os && osname=lynxos
2306 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2307 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2308 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2309 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2310 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2311 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2312 $test -d /usr/apollo/bin && osname=apollo
2313 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2314 $test -d /usr/include/minix && osname=minix
e060872b 2315 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2316 osname=machten
4633a7c4 2317 if $test -x /sbin/version; then
dfe9444c 2318 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2319 $sed -e 's/[A-Za-z]$//'`
2320 elif $test -x /usr/etc/version; then
dfe9444c 2321 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2322 $sed -e 's/[A-Za-z]$//'`
2323 else
2324 osvers="$2.$3"
2325 fi
2326 fi
aaacdc8b
GS
2327
2328 $test -f /sys/posix.dll &&
2329 $test -f /usr/bin/what &&
2330 set X `/usr/bin/what /sys/posix.dll` &&
2331 $test "$3" = UWIN &&
2332 osname=uwin &&
2333 osvers="$5"
2334
2304df62
AD
2335 if $test -f $uname; then
2336 set X $myuname
2337 shift
2338
2304df62 2339 case "$5" in
85e6fe83 2340 fps*) osname=fps ;;
2304df62
AD
2341 mips*)
2342 case "$4" in
85e6fe83
LW
2343 umips) osname=umips ;;
2344 *) osname=mips ;;
2304df62 2345 esac;;
85e6fe83
LW
2346 [23]100) osname=mips ;;
2347 next*) osname=next ;;
ecfc5424 2348 i386*)
c6912327
JH
2349 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2350 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2351 osname='sco'
2352 osvers=$tmp
2353 elif $test -f /etc/kconfig; then
ecfc5424 2354 osname=isc
bd628c73 2355 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2356 osvers=4
2357 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2358 osvers=3
2304df62 2359 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2360 osvers=2
ecfc5424
AD
2361 fi
2362 fi
2000072c 2363 tmp=''
ecfc5424 2364 ;;
c4f23d77
AD
2365 pc*)
2366 if test -n "$DJGPP"; then
2367 osname=dos
2368 osvers=djgpp
2369 fi
2370 ;;
2304df62
AD
2371 esac
2372
2373 case "$1" in
a0d0e21e
LW
2374 aix) osname=aix
2375 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2376 case "$tmp" in
1aef975c 2377 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2378 '<3240'|'<>3240') osvers=3.2.0 ;;
2379 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2380 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2381 *) osvers=$tmp;;
a0d0e21e
LW
2382 esac
2383 ;;
aaacdc8b
GS
2384 bsd386) osname=bsd386
2385 osvers=`$uname -r`
2386 ;;
2387 cygwin*) osname=cygwin
2388 osvers="$3"
2389 ;;
23f87696
SZ
2390 *dc.osx) osname=dcosx
2391 osvers="$3"
2392 ;;
a0d0e21e
LW
2393 dnix) osname=dnix
2394 osvers="$3"
2395 ;;
2396 domainos) osname=apollo
2397 osvers="$3"
2398 ;;
2399 dgux) osname=dgux
2400 osvers="$3"
2401 ;;
760ac839 2402 dynixptx*) osname=dynixptx
e58e581d 2403 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2404 ;;
a0d0e21e
LW
2405 freebsd) osname=freebsd
2406 osvers="$3" ;;
2407 genix) osname=genix ;;
2408 hp*) osname=hpux
bfb7748a 2409 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2410 ;;
a78b0d02 2411 irix*) osname=irix
a0d0e21e
LW
2412 case "$3" in
2413 4*) osvers=4 ;;
2414 5*) osvers=5 ;;
ecfc5424 2415 *) osvers="$3" ;;
a0d0e21e
LW
2416 esac
2417 ;;
2418 linux) osname=linux
2419 case "$3" in
a0d0e21e
LW
2420 *) osvers="$3" ;;
2421 esac
2422 ;;
28e8609d
JH
2423 MiNT) osname=mint
2424 ;;
2425 netbsd*) osname=netbsd
ecfc5424
AD
2426 osvers="$3"
2427 ;;
4e81affe
MM
2428 news-os) osvers="$3"
2429 case "$3" in
2430 4*) osname=newsos4 ;;
2431 *) osname=newsos ;;
2432 esac
2433 ;;
aaacdc8b 2434 next*) osname=next ;;
28bb1e2c 2435 nonstop-ux) osname=nonstopux ;;
aaacdc8b
GS
2436 POSIX-BC | posix-bc ) osname=posix-bc
2437 osvers="$3"
a0d0e21e 2438 ;;
ae3afa4e
TH
2439 powerux | power_ux | powermax_os | powermaxos | \
2440 powerunix | power_unix) osname=powerux
2441 osvers="$3"
2442 ;;
aaacdc8b
GS
2443 qnx) osname=qnx
2444 osvers="$4"
2445 ;;
a0d0e21e
LW
2446 solaris) osname=solaris
2447 case "$3" in
2448 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2449 *) osvers="$3" ;;
a0d0e21e
LW
2450 esac
2451 ;;
85e6fe83
LW
2452 sunos) osname=sunos
2453 case "$3" in
85e6fe83
LW
2454 5*) osname=solaris
2455 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2456 *) osvers="$3" ;;
2304df62
AD
2457 esac
2458 ;;
a0d0e21e 2459 titanos) osname=titanos
85e6fe83 2460 case "$3" in
a0d0e21e
LW
2461 1*) osvers=1 ;;
2462 2*) osvers=2 ;;
2463 3*) osvers=3 ;;
2464 4*) osvers=4 ;;
ecfc5424 2465 *) osvers="$3" ;;
2304df62
AD
2466 esac
2467 ;;
85e6fe83 2468 ultrix) osname=ultrix
ecfc5424 2469 osvers="$3"
2304df62 2470 ;;
28757baa 2471 osf1|mls+) case "$5" in
fed7345c
AD
2472 alpha)
2473 osname=dec_osf
2aa76180
JH
2474 osvers=`sizer -v | awk '{print $3}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2475 case "$osvers" in
2476 [1-9].[0-9]*) ;;
2477 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2478 esac
ecfc5424
AD
2479 ;;
2480 hp*) osname=hp_osf1 ;;
2481 mips) osname=mips_osf1 ;;
85e6fe83
LW
2482 esac
2483 ;;
0337d152
BG
2484 unixware) osname=svr5
2485 osvers="$4"
2486 ;;
2487 uts) osname=uts
a0d0e21e
LW
2488 osvers="$3"
2489 ;;
85e6fe83 2490 $2) case "$osname" in
2304df62 2491 *isc*) ;;
a0d0e21e 2492 *freebsd*) ;;
5f05dabc 2493 svr*)
a0d0e21e
LW
2494 : svr4.x or possibly later
2495 case "svr$3" in
2496 ${osname}*)
2497 osname=svr$3
2498 osvers=$4
2499 ;;
2500 esac
2501 case "$osname" in
2502 svr4.0)
2503 : Check for ESIX
2504 if test -f /stand/boot ; then
2505 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2506 if test -n "$INITPROG" -a -f "$INITPROG"; then
2507 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2508 if test -n "$isesix"; then
a0d0e21e
LW
2509 osname=esix4
2510 fi
2511 fi
2512 fi
2513 ;;
2514 esac
2515 ;;
2304df62 2516 *) if test -f /etc/systemid; then
a0d0e21e
LW
2517 osname=sco
2518 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2519 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2520 osvers=$1.$2.$3
c4f23d77 2521 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2522 osvers=$1.$2
c4f23d77 2523 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2524 osvers=$1
2304df62 2525 fi
a0d0e21e
LW
2526 else
2527 case "$osname" in
2528 '') : Still unknown. Probably a generic Sys V.
2529 osname="sysv"
2530 osvers="$3"
2531 ;;
2532 esac
2304df62
AD
2533 fi
2534 ;;
2535 esac
2536 ;;
a0d0e21e
LW
2537 *) case "$osname" in
2538 '') : Still unknown. Probably a generic BSD.
2539 osname="$1"
2540 osvers="$3"
2541 ;;
2542 esac
2543 ;;
2304df62
AD
2544 esac
2545 else
dfe9444c
AD
2546 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2547 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2548 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2549 osname=news_os
2304df62 2550 fi
dfe9444c 2551 $rm -f UU/kernel.what
8e07c86e
AD
2552 elif test -d c:/.; then
2553 set X $myuname
2554 osname=os2
2555 osvers="$5"
2304df62
AD
2556 fi
2557 fi
85e6fe83 2558
a0d0e21e
LW
2559 : Now look for a hint file osname_osvers, unless one has been
2560 : specified already.
2561 case "$hintfile" in
2562 ''|' ')
1e127011 2563 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 2564 : Also try without trailing minor version numbers.
1e127011
DD
2565 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2566 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2567 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2568 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
2569 case "$file" in
2570 '') dflt=none ;;
2571 *) case "$osvers" in
2572 '') dflt=$file
2573 ;;
dfe9444c 2574 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 2575 dflt=$file
dfe9444c 2576 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 2577 dflt=$xfile
dfe9444c 2578 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 2579 dflt=$xxfile
dfe9444c 2580 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 2581 dflt=$xxxfile
dfe9444c 2582 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 2583 dflt=$xxxxfile
dfe9444c 2584 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
2585 dflt="${osname}"
2586 else
2587 dflt=none
2588 fi
2589 ;;
2590 esac
85e6fe83
LW
2591 ;;
2592 esac
4e2a5f63
AD
2593 if $test -f Policy.sh ; then
2594 case "$dflt" in
2595 *Policy*) ;;
2596 none) dflt="Policy" ;;
2597 *) dflt="Policy $dflt" ;;
2598 esac
2599 fi
85e6fe83 2600 ;;
a0d0e21e 2601 *)
ecfc5424 2602 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 2603 ;;
2304df62 2604 esac
1aef975c 2605
4e2a5f63
AD
2606 if $test -f Policy.sh ; then
2607 $cat <<EOM
2608
2609There's also a Policy hint file available, which should make the
2610site-specific (policy) questions easier to answer.
2611EOM
2612
2613 fi
2614
2304df62
AD
2615 $cat <<EOM
2616
2617You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 2618A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 2619is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
2620
2621EOM
4e2a5f63 2622
2304df62 2623 rp="Which of these apply, if any?"
dfe9444c 2624 . UU/myread
85e6fe83
LW
2625 tans=$ans
2626 for file in $tans; do
4e2a5f63
AD
2627 if $test X$file = XPolicy -a -f Policy.sh; then
2628 . Policy.sh
2629 $cat Policy.sh >> UU/config.sh
2630 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
2631 . $src/hints/$file.sh
2632 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83 2633 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
2634 : nothing
2635 else
85e6fe83
LW
2636 : Give one chance to correct a possible typo.
2637 echo "$file.sh does not exist"
2638 dflt=$file
2639 rp="hint to use instead?"
dfe9444c 2640 . UU/myread
85e6fe83 2641 for file in $ans; do
dfe9444c
AD
2642 if $test -f "$src/hints/$file.sh"; then
2643 . $src/hints/$file.sh
2644 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
2645 elif $test X$ans = X -o X$ans = Xnone ; then
2646 : nothing
2647 else
2648 echo "$file.sh does not exist -- ignored."
2649 fi
2650 done
2304df62
AD
2651 fi
2652 done
85e6fe83 2653
2304df62 2654 hint=recommended
85e6fe83 2655 : Remember our hint file for later.
dfe9444c 2656 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 2657 hintfile="$file"
85e6fe83 2658 else
a0d0e21e 2659 hintfile=''
85e6fe83 2660 fi
2304df62
AD
2661fi
2662cd UU
2663;;
2664*)
2665 echo " "
2666 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
2667 tmp_n="$n"
2668 tmp_c="$c"
2304df62
AD
2669 cd ..
2670 cp $config_sh config.sh 2>/dev/null
a78b0d02 2671 chmod +w config.sh
2304df62
AD
2672 . ./config.sh
2673 cd UU
2674 cp ../config.sh .
ecfc5424
AD
2675 n="$tmp_n"
2676 c="$tmp_c"
2304df62
AD
2677 hint=previous
2678 ;;
2679esac
1aef975c 2680test "$override" && . ./optdef.sh
2304df62
AD
2681
2682: Restore computed paths
2683for file in $loclist $trylist; do
2684 eval $file="\$_$file"
2685done
2686
85e6fe83 2687cat << EOM
a0d0e21e 2688
85e6fe83 2689Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
2690The default value is probably right if the name rings a bell. Otherwise,
2691since spelling matters for me, either accept the default or answer "none"
2692to leave it blank.
a0d0e21e 2693
85e6fe83 2694EOM
85e6fe83 2695case "$osname" in
a0d0e21e 2696 ''|' ')
85e6fe83 2697 case "$hintfile" in
a0d0e21e 2698 ''|' '|none) dflt=none ;;
ecfc5424 2699 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
2700 esac
2701 ;;
2702 *) dflt="$osname" ;;
2703esac
2704rp="Operating system name?"
2705. ./myread
2706case "$ans" in
ecfc5424
AD
2707none) osname='' ;;
2708*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 2709esac
8ff267be 2710echo " "
2711case "$osvers" in
2712 ''|' ')
2713 case "$hintfile" in
2714 ''|' '|none) dflt=none ;;
2715 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2716 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2717 case "$dflt" in
2718 ''|' ') dflt=none ;;
2719 esac
2720 ;;
2721 esac
2722 ;;
2723 *) dflt="$osvers" ;;
2724esac
2725rp="Operating system version?"
2726. ./myread
2727case "$ans" in
2728none) osvers='' ;;
2729*) osvers="$ans" ;;
2730esac
2731
02e93a22
JH
2732
2733. ./posthint.sh
2734
2304df62 2735: who configured the system
59b83a6f 2736cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 2737cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
2738case "$cf_by" in
2739"")
8ff267be 2740 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
2741 case "$cf_by" in
2742 "") cf_by=unknown ;;
8ff267be 2743 esac ;;
2744esac
2304df62 2745
b4eb6b3d
JH
2746: set up the script used to warn in case of inconsistency
2747cat <<EOS >whoa
2748$startsh
2749EOS
2750cat <<'EOSC' >>whoa
2751dflt=y
2752echo " "
2753echo "*** WHOA THERE!!! ***" >&4
2754echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2755rp=" Keep the $hint value?"
2756. ./myread
2757case "$ans" in
2758y) td=$was; tu=$was;;
2759esac
2760EOSC
2761
2762: function used to set $1 to $val
2763setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2764case "$val$was" in
2765$define$undef) . ./whoa; eval "$var=\$td";;
2766$undef$define) . ./whoa; eval "$var=\$tu";;
2767*) eval "$var=$val";;
2768esac'
2769
2770case "$usethreads" in
2771$define|true|[yY]*) dflt='y';;
2772*) dflt='n';;
2773esac
2774cat <<EOM
2775
2776Perl can be built to take advantage of threads on some systems.
2777To do so, Configure can be run with -Dusethreads.
2778
2779Note that threading is a highly experimental feature, and
2780some known race conditions still remain. If you choose to try
2781it, be very sure to not actually deploy it for production
2782purposes. README.threads has more details, and is required
2783reading if you enable threads.
2784
2785If this doesn't make any sense to you, just accept the default '$dflt'.
2786EOM
2787rp='Build a threading Perl?'
2788. ./myread
2789case "$ans" in
2790y|Y) val="$define" ;;
2791*) val="$undef" ;;
2792esac
2793set usethreads
2794eval $setvar
2795
2796case "$usethreads" in
2797$define)
2798 $cat <<EOM
2799
2800As of 5.5.640, Perl has two different internal threading implementations,
2801the 5.005 version (5005threads) and an interpreter-based version
2802(ithreads) that has one interpreter per thread. Both are very
2803experimental. This arrangement exists to help developers work out
2804which one is better.
2805
2806If you're a casual user, you probably don't want interpreter-threads
2807at this time. There doesn't yet exist a way to create threads from
2808within Perl in this model, i.e., "use Thread;" will NOT work.
2809EOM
2810 : Default to ithreads unless overridden on command line or with
2811 : old config.sh
2812 dflt='y'
2813 case "$use5005threads" in
2814 $define|true|[yY]*) dflt='n';;
2815 esac
2816 case "$useithreads" in
2817 $undef|false|[nN]*) dflt='n';;
2818 esac
2819 rp='Use interpreter-based ithreads?'
2820 . ./myread
2821 case "$ans" in
2822 y|Y) val="$define" ;;
2823 *) val="$undef" ;;
2824 esac
2825 set useithreads
2826 eval $setvar
2827 : Now set use5005threads to the opposite value.
2828 case "$useithreads" in
2829 $define) val="$undef" ;;
2830 *) val="$define" ;;
2831 esac
2832 set use5005threads
2833 eval $setvar
2834 ;;
2835*)
2836 useithreads="$undef"
2837 use5005threads="$undef"
2838 ;;
2839esac
2840
2841case "$d_oldpthreads" in
2842'') : Configure tests would be welcome here. For now, assume undef.
2843 val="$undef" ;;
2844*) val="$d_oldpthreads" ;;
2845esac
2846set d_oldpthreads
2847eval $setvar
2848
2849
2850case "$usethreads" in
2851"$define"|true|[yY]*)
2852: Look for a hint-file generated 'call-back-unit'. If the
2853: user has specified that a threading perl is to be built,
2854: we may need to set or change some other defaults.
2855 if $test -f usethreads.cbu; then
2856 echo "Your platform has some specific hints for threaded builds, using them..."
2857 . ./usethreads.cbu
2858 else
2859 $cat <<EOM
2860(Your platform doesn't have any specific hints for threaded builds.
2861 Assuming POSIX threads, then.)
2862EOM
2863 fi
2864 ;;
2865esac
2866
2867cat <<EOM
2868
2869Perl can be built so that multiple Perl interpreters can coexist
2870within the same Perl executable.
2871EOM
2872
2873case "$useithreads" in
2874$define)
2875 cat <<EOM
2876This multiple interpreter support is required for interpreter-based threads.
2877EOM
2878 val="$define"
2879 ;;
2880*) case "$usemultiplicity" in
2881 $define|true|[yY]*) dflt='y';;
2882 *) dflt='n';;
2883 esac
2884 echo " "
2885 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2886 rp='Build Perl for multiplicity?'
2887 . ./myread
2888 case "$ans" in
2889 y|Y) val="$define" ;;
2890 *) val="$undef" ;;
2891 esac
2892 ;;
2893esac
2894set usemultiplicity
2895eval $setvar
2896
e5e20432
JH
2897: make some quick guesses about what we are up against
2898echo " "
2899$echo $n "Hmm... $c"
2900echo exit 1 >bsd
2901echo exit 1 >usg
2902echo exit 1 >v7
2903echo exit 1 >osf1
2904echo exit 1 >eunice
2905echo exit 1 >xenix
2906echo exit 1 >venix
2907echo exit 1 >os2
2908d_bsd="$undef"
2909$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2910if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2911then
2912 echo "Looks kind of like an OSF/1 system, but we'll see..."
2913 echo exit 0 >osf1
381aa1ff 2914elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
2915 xxx=`./loc addbib blurfl $pth`
2916 if $test -f $xxx; then
2917 echo "Looks kind of like a USG system with BSD features, but we'll see..."
2918 echo exit 0 >bsd
2919 echo exit 0 >usg
2920 else
2921 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2922 echo "Looks kind of like an extended USG system, but we'll see..."
2923 else
2924 echo "Looks kind of like a USG system, but we'll see..."
2925 fi
2926 echo exit 0 >usg
2927 fi
2928elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2929 echo "Looks kind of like a BSD system, but we'll see..."
2930 d_bsd="$define"
2931 echo exit 0 >bsd
2932else
2933 echo "Looks kind of like a Version 7 system, but we'll see..."
2934 echo exit 0 >v7
2935fi
2936case "$eunicefix" in
2937*unixtovms*)
2938 $cat <<'EOI'
2939There is, however, a strange, musty smell in the air that reminds me of
2940something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2941EOI
2942 echo exit 0 >eunice
2943 d_eunice="$define"
2944: it so happens the Eunice I know will not run shell scripts in Unix format
2945 ;;
2946*)
2947 echo " "
2948 echo "Congratulations. You aren't running Eunice."
2949 d_eunice="$undef"
2950 ;;
2951esac
2952: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
2953: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
2954: semicolon as a patch separator
e5e20432
JH
2955case "$p_" in
2956:) ;;
2957*)
2958 $cat <<'EOI'
2959I have the feeling something is not exactly right, however...don't tell me...
2960lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 2961(Or you may be running DOS with DJGPP.)
e5e20432
JH
2962EOI
2963 echo exit 0 >os2
2964 ;;
2965esac
2966if test -f /xenix; then
2967 echo "Actually, this looks more like a XENIX system..."
2968 echo exit 0 >xenix
2969 d_xenix="$define"
2970else
2971 echo " "
2972 echo "It's not Xenix..."
2973 d_xenix="$undef"
2974fi
2975chmod +x xenix
2976$eunicefix xenix
2977if test -f /venix; then
2978 echo "Actually, this looks more like a VENIX system..."
2979 echo exit 0 >venix
2980else
2981 echo " "
2982 if ./xenix; then
2983 : null
2984 else
2985 echo "Nor is it Venix..."
2986 fi
2987fi
2988chmod +x bsd usg v7 osf1 eunice xenix venix os2
2989$eunicefix bsd usg v7 osf1 eunice xenix venix os2
2990$rm -f foo
2991
5869b1f1
JH
2992case "$cc" in
2993'') dflt=cc;;
2994*) dflt="$cc";;
2995esac
2996rp="Use which C compiler?"
2997. ./myread
2998cc="$ans"
e5e20432
JH
2999: Look for a hint-file generated 'call-back-unit'. Now that the
3000: user has specified the compiler, we may need to set or change some
3001: other defaults.
3002if $test -f cc.cbu; then
3003 . ./cc.cbu
3004fi
2573c5f9 3005. ./checkcc
8a27cf78 3006
e5e20432
JH
3007echo " "
3008echo "Checking for GNU cc in disguise and/or its version number..." >&4
3009$cat >gccvers.c <<EOM
3010#include <stdio.h>
3011int main() {
3012#ifdef __GNUC__
3013#ifdef __VERSION__
3014 printf("%s\n", __VERSION__);
3015#else
3016 printf("%s\n", "1");
3017#endif
3018#endif
3019 exit(0);
3020}
3021EOM
7a282f6d 3022if $cc -o gccvers $ldflags gccvers.c; then
e5e20432
JH
3023 gccversion=`./gccvers`
3024 case "$gccversion" in
3025 '') echo "You are not using GNU cc." ;;
fc68435e 3026 *) echo "You are using GNU cc $gccversion."
e723fc21 3027 ccname=gcc
fc68435e 3028 ;;
e5e20432
JH
3029 esac
3030else
3031 echo " "
3032 echo "*** WHOA THERE!!! ***" >&4
3033 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3034 case "$knowitall" in
3035 '')
3036 echo " You'd better start hunting for one and let me know about it." >&4
3037 exit 1
3038 ;;
3039 esac
3040fi
3041$rm -f gccvers*
3042case "$gccversion" in
30431*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3044esac
5b463ca7
KS
3045case "$gccversion" in
3046'') gccosandvers='' ;;
10b4ebb5
JH
3047*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3048 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3049 gccshortvers=''
5b463ca7 3050 case "$gccosandvers" in
02903077
JH
3051 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3052 $osname$osvers) ;; # looking good
5b463ca7
KS
3053 $osname*) cat <<EOM >&4
3054
3055*** WHOA THERE!!! ***
3056
3057 Your gcc has not been compiled for the exact release of
3058 your operating system ($gccosandvers versus $osname$osvers).
3059
3060 In general it is a good idea to keep gcc synchronized with
3061 the operating system because otherwise serious problems
3062 may ensue when trying to compile software, like Perl.
3063
3064 I'm trying to be optimistic here, though, and will continue.
3065 If later during the configuration and build icky compilation
02903077
JH
3066 problems appear (headerfile conflicts being the most common
3067 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3068 your operating system release.
3069
3070EOM
3071 ;;
81575342 3072 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3073 esac
3074 ;;
3075esac
e723fc21
JH
3076case "$ccname" in
3077'') ccname="$cc" ;;
3078esac
e5e20432 3079
8a27cf78
JH
3080: see how we invoke the C preprocessor
3081echo " "
3082echo "Now, how can we feed standard input to your C preprocessor..." >&4
3083cat <<'EOT' >testcpp.c
3084#define ABC abc
3085#define XYZ xyz
3086ABC.XYZ
3087EOT
3088cd ..
3089if test ! -f cppstdin; then
3090 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3091 # AIX cc -E doesn't show the absolute headerfile
3092 # locations but we'll cheat by using the -M flag.
3093 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
3094 else
3095 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3096 fi
3097else
3098 echo "Keeping your $hint cppstdin wrapper."
3099fi
3100chmod 755 cppstdin
3101wrapper=`pwd`/cppstdin
3102ok='false'
3103cd UU
3104
3105if $test "X$cppstdin" != "X" && \
3106 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3107 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3108then
3109 echo "You used to use $cppstdin $cppminus so we'll use that again."
3110 case "$cpprun" in
3111 '') echo "But let's see if we can live without a wrapper..." ;;
3112 *)
3113 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3114 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3115 then
3116 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3117 ok='true'
3118 else
3119 echo "(However, $cpprun $cpplast does not work, let's see...)"
3120 fi
3121 ;;
3122 esac
3123else
3124 case "$cppstdin" in
3125 '') ;;
3126 *)
3127 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3128 ;;
3129 esac
3130fi
3131
3132if $ok; then
3133 : nothing
3134elif echo 'Maybe "'"$cc"' -E" will work...'; \
3135 $cc -E <testcpp.c >testcpp.out 2>&1; \
3136 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3137 echo "Yup, it does."
3138 x_cpp="$cc -E"
3139 x_minus='';
3140elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3141 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3142 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3143 echo "Yup, it does."
3144 x_cpp="$cc -E"
3145 x_minus='-';
3146elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3147 $cc -P <testcpp.c >testcpp.out 2>&1; \
3148 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3149 echo "Yipee, that works!"
3150 x_cpp="$cc -P"
3151 x_minus='';
3152elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3153 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3154 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3155 echo "At long last!"
3156 x_cpp="$cc -P"
3157 x_minus='-';
3158elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3159 $cpp <testcpp.c >testcpp.out 2>&1; \
3160 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3161 echo "It works!"
3162 x_cpp="$cpp"
3163 x_minus='';
3164elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3165 $cpp - <testcpp.c >testcpp.out 2>&1; \
3166 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3167 echo "Hooray, it works! I was beginning to wonder."
3168 x_cpp="$cpp"
3169 x_minus='-';
3170elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3171 $wrapper <testcpp.c >testcpp.out 2>&1; \
3172 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3173 x_cpp="$wrapper"
3174 x_minus=''
3175 echo "Eureka!"
3176else
3177 dflt=''
3178 rp="No dice. I can't find a C preprocessor. Name one:"
3179 . ./myread
3180 x_cpp="$ans"
3181 x_minus=''
3182 $x_cpp <testcpp.c >testcpp.out 2>&1
3183 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3184 echo "OK, that will do." >&4
3185 else
3186echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3187 exit 1
3188 fi
3189fi
3190
3191case "$ok" in
3192false)
3193 cppstdin="$x_cpp"
3194 cppminus="$x_minus"
3195 cpprun="$x_cpp"
3196 cpplast="$x_minus"
3197 set X $x_cpp
3198 shift
3199 case "$1" in
3200 "$cpp")
3201 echo "Perhaps can we force $cc -E using a wrapper..."
3202 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3203 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3204 then
3205 echo "Yup, we can."
3206 cppstdin="$wrapper"
3207 cppminus='';
3208 else
3209 echo "Nope, we'll have to live without it..."
3210 fi
3211 ;;
3212 esac
3213 case "$cpprun" in
3214 "$wrapper")
3215 cpprun=''
3216 cpplast=''
3217 ;;
3218 esac
3219 ;;
3220esac
3221
3222case "$cppstdin" in
3223"$wrapper"|'cppstdin') ;;
3224*) $rm -f $wrapper;;
3225esac
3226$rm -f testcpp.c testcpp.out
3227
bd9b35c9
JH
3228: decide how portable to be. Allow command line overrides.
3229case "$d_portable" in
3230"$undef") ;;
3231*) d_portable="$define" ;;
104d25b7 3232esac
85ab1d1d 3233
bd9b35c9
JH
3234: set up shell script to do ~ expansion
3235cat >filexp <<EOSS
3236$startsh
3237: expand filename
3238case "\$1" in
3239 ~/*|~)
3240 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3241 ;;
3242 ~*)
3243 if $test -f /bin/csh; then
3244 /bin/csh -f -c "glob \$1"
3245 failed=\$?
3246 echo ""
3247 exit \$failed
e5e20432 3248 else
bd9b35c9
JH
3249 name=\`$expr x\$1 : '..\([^/]*\)'\`
3250 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3251 if $test ! -d "\$dir"; then
3252 me=\`basename \$0\`
3253 echo "\$me: can't locate home directory for: \$name" >&2
3254 exit 1
3255 fi
3256 case "\$1" in
3257 */*)
3258 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3259 ;;
3260 *)
3261 echo \$dir
e5e20432
JH
3262 ;;
3263 esac
3264 fi
b691c02f 3265 ;;
4633a7c4 3266*)
bd9b35c9 3267 echo \$1
2304df62
AD
3268 ;;
3269esac
4633a7c4
LW
3270EOSS
3271chmod +x filexp
3272$eunicefix filexp
2304df62
AD
3273
3274: now set up to get a file name
28757baa 3275cat <<EOS >getfile
3276$startsh
3277EOS
3278cat <<'EOSC' >>getfile
2304df62
AD
3279tilde=''
3280fullpath=''
3281already=''
3282skip=''
3283none_ok=''
3284exp_file=''
a0d0e21e 3285nopath_ok=''
2304df62
AD
3286orig_rp="$rp"
3287orig_dflt="$dflt"
b233458b
JH
3288case "$gfpth" in
3289'') gfpth='.' ;;
3290esac
2304df62
AD
3291
3292case "$fn" in
ecfc5424 3293*\(*)
381aa1ff 3294 expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
3295 fn=`echo $fn | sed 's/(.*)//'`
3296 ;;
3297esac
3298
3299case "$fn" in
a0d0e21e
LW
3300*:*)
3301 loc_file=`expr $fn : '.*:\(.*\)'`
3302 fn=`expr $fn : '\(.*\):.*'`
3303 ;;
3304esac
3305
3306case "$fn" in
2304df62
AD
3307*~*) tilde=true;;
3308esac
3309case "$fn" in
3310*/*) fullpath=true;;
3311esac
3312case "$fn" in
3313*+*) skip=true;;
3314esac
3315case "$fn" in
3316*n*) none_ok=true;;
3317esac
3318case "$fn" in
3319*e*) exp_file=true;;
3320esac
a0d0e21e
LW
3321case "$fn" in
3322*p*) nopath_ok=true;;
3323esac
2304df62
AD
3324
3325case "$fn" in
3326*f*) type='File';;
3327*d*) type='Directory';;
a0d0e21e 3328*l*) type='Locate';;
2304df62
AD
3329esac
3330
3331what="$type"
3332case "$what" in
3333Locate) what='File';;
3334esac
3335
3336case "$exp_file" in
3337'')
3338 case "$d_portable" in
3339 "$define") ;;
3340 *) exp_file=true;;
3341 esac
3342 ;;
3343esac
3344
3345cd ..
3346while test "$type"; do
3347 redo=''
3348 rp="$orig_rp"
3349 dflt="$orig_dflt"
3350 case "$tilde" in
3351 true) rp="$rp (~name ok)";;
3352 esac
3353 . UU/myread
ecfc5424
AD
3354 if test -f UU/getfile.ok && \
3355 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3356 then
3357 value="$ans"
3358 ansexp="$ans"
3359 break
3360 fi
2304df62
AD
3361 case "$ans" in
3362 none)
3363 value=''
3364 ansexp=''
3365 case "$none_ok" in
3366 true) type='';;
3367 esac
3368 ;;
3369 *)
3370 case "$tilde" in
3371 '') value="$ans"
3372 ansexp="$ans";;
3373 *)
3374 value=`UU/filexp $ans`
3375 case $? in
3376 0)
3377 if test "$ans" != "$value"; then
ecfc5424 3378 echo "(That expands to $value on this system.)"
2304df62
AD
3379 fi
3380 ;;
3381 *) value="$ans";;
3382 esac
3383 ansexp="$value"
3384 case "$exp_file" in
3385 '') value="$ans";;
3386 esac
3387 ;;
3388 esac
3389 case "$fullpath" in
3390 true)
3391 case "$ansexp" in
3392 /*) value="$ansexp" ;;
23da6c43 3393 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
3394 *)
3395 redo=true
3396 case "$already" in
3397 true)
3398 echo "I shall only accept a full path name, as in /bin/ls." >&4
3399 echo "Use a ! shell escape if you wish to check pathnames." >&4
3400 ;;
3401 *)
3402 echo "Please give a full path name, starting with slash." >&4
3403 case "$tilde" in
3404 true)
3405 echo "Note that using ~name is ok provided it expands well." >&4
3406 already=true
3407 ;;
3408 esac
3409 esac
3410 ;;
3411 esac
3412 ;;
3413 esac
3414 case "$redo" in
3415 '')
3416 case "$type" in
3417 File)
b233458b
JH
3418 for fp in $gfpth; do
3419 if test "X$fp" = X.; then
3420 pf="$ansexp"
3421 else
3422 pf="$fp/$ansexp"
3423 fi
3424 if test -f "$pf"; then
3425 type=''
3426 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3427 then
3428 echo "($value is not a plain file, but that's ok.)"
3429 type=''
3430 fi
3431 if test X"$type" = X; then
3432 value="$pf"
3433 break
3434 fi
3435 done
2304df62
AD
3436 ;;
3437 Directory)
b233458b
JH
3438 for fp in $gfpth; do
3439 if test "X$fp" = X.; then
f78bfc9c
JH
3440 dir="$ans"
3441 direxp="$ansexp"
b233458b 3442 else
dd858076 3443 dir="$fp/$ansexp"
f78bfc9c 3444 direxp="$fp/$ansexp"
b233458b 3445 fi
f78bfc9c 3446 if test -d "$direxp"; then
b233458b 3447 type=''
f78bfc9c 3448 value="$dir"
b233458b
JH
3449 break
3450 fi
3451 done
2304df62
AD
3452 ;;
3453 Locate)
40000a8c 3454 if test -d "$ansexp"; then
a0d0e21e
LW
3455 echo "(Looking for $loc_file in directory $value.)"
3456 value="$value/$loc_file"
40000a8c 3457 ansexp="$ansexp/$loc_file"
2304df62 3458 fi
40000a8c 3459 if test -f "$ansexp"; then
2304df62
AD
3460 type=''
3461 fi
a0d0e21e
LW
3462 case "$nopath_ok" in
3463 true) case "$value" in
3464 */*) ;;
3465 *) echo "Assuming $value will be in people's path."
3466 type=''
3467 ;;
3468 esac
3469 ;;
3470 esac
2304df62
AD
3471 ;;
3472 esac
3473
3474 case "$skip" in
3475 true) type='';
3476 esac
3477
3478 case "$type" in
3479 '') ;;
3480 *)
3481 if test "$fastread" = yes; then
3482 dflt=y
3483 else
3484 dflt=n
3485 fi
3486 rp="$what $value doesn't exist. Use that name anyway?"
3487 . UU/myread
3488 dflt=''
3489 case "$ans" in
3490 y*) type='';;
3491 *) echo " ";;
3492 esac
3493 ;;
3494 esac
3495 ;;
3496 esac
3497 ;;
3498 esac
3499done
3500cd UU
3501ans="$value"
3502rp="$orig_rp"
3503dflt="$orig_dflt"
ecfc5424 3504rm -f getfile.ok
b233458b 3505test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3506EOSC
3507
bd9b35c9
JH
3508: What should the include directory be ?
3509echo " "
3510$echo $n "Hmm... $c"
3511dflt='/usr/include'
3512incpath=''
3513mips_type=''
3514if $test -f /bin/mips && /bin/mips; then
3515 echo "Looks like a MIPS system..."
3516 $cat >usr.c <<'EOCP'
3517#ifdef SYSTYPE_BSD43
3518/bsd43
3519#endif
3520EOCP
8a27cf78 3521 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
3522 dflt='/bsd43/usr/include'
3523 incpath='/bsd43'
3524 mips_type='BSD 4.3'
3525 else
3526 mips_type='System V'
3527 fi
3528 $rm -f usr.c usr.out
3529 echo "and you're compiling with the $mips_type compiler and libraries."
3530 xxx_prompt=y
3531 echo "exit 0" >mips
3532else
3533 echo "Doesn't look like a MIPS system."
3534 xxx_prompt=n
3535 echo "exit 1" >mips
3536fi
3537chmod +x mips
3538$eunicefix mips
3539case "$usrinc" in
3540'') ;;
3541*) dflt="$usrinc";;
3542esac
3543case "$xxx_prompt" in
3544y) fn=d/
3545 echo " "
3546 rp='Where are the include files you want to use?'
3547 . ./getfile
3548 usrinc="$ans"
8e07c86e 3549 ;;
bd9b35c9 3550*) usrinc="$dflt"
8e07c86e
AD
3551 ;;
3552esac
2304df62 3553
bd9b35c9
JH
3554: Set private lib path
3555case "$plibpth" in
3556'') if ./mips; then
3557 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3558 fi;;
3559esac
3560case "$libpth" in
3561' ') dlist='';;
3562'') dlist="$loclibpth $plibpth $glibpth";;
3563*) dlist="$libpth";;
3564esac
3565
3566: Now check and see which directories actually exist, avoiding duplicates
3567libpth=''
3568for xxx in $dlist
3569do
3570 if $test -d $xxx; then
3571 case " $libpth " in
3572 *" $xxx "*) ;;
3573 *) libpth="$libpth $xxx";;
3574 esac
3575 fi
3576done
3577$cat <<'EOM'
3578
3579Some systems have incompatible or broken versions of libraries. Among
3580the directories listed in the question below, please remove any you
3581know not to be holding relevant libraries, and add any that are needed.
3582Say "none" for none.
8e07c86e
AD
3583
3584EOM
bd9b35c9
JH
3585case "$libpth" in
3586'') dflt='none';;
8e07c86e 3587*)
bd9b35c9
JH
3588 set X $libpth
3589 shift
3590 dflt=${1+"$@"}
8e07c86e 3591 ;;
a0d0e21e 3592esac
bd9b35c9
JH
3593rp="Directories to use for library searches?"
3594. ./myread
3595case "$ans" in
3596none) libpth=' ';;
3597*) libpth="$ans";;
3598esac
a0d0e21e 3599
bd9b35c9
JH
3600: compute shared library extension
3601case "$so" in
3602'')
3603 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3604 dflt='sl'
dd4e71fd 3605 else
bd9b35c9 3606 dflt='so'
dd4e71fd
JH
3607 fi
3608 ;;
bd9b35c9 3609*) dflt="$so";;
dd4e71fd 3610esac
dd4e71fd
JH
3611$cat <<EOM
3612
bd9b35c9 3613On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 3614you want to suppress searching of shared libraries for the remainder
bd9b35c9 3615of this configuration.
dd4e71fd
JH
3616
3617EOM
bd9b35c9
JH
3618rp='What is the file extension used for shared libraries?'
3619. ./myread
3620so="$ans"
dd4e71fd 3621
bd9b35c9
JH
3622: Define several unixisms.
3623: Hints files or command line option can be used to override them.
3624: The convoluted testing is in case hints files set either the old
3625: or the new name.
3626case "$_exe" in
3627'') case "$exe_ext" in
3628 '') ;;
3629 *) _exe="$exe_ext" ;;
dd4e71fd 3630 esac
bd9b35c9 3631 ;;
bfb7748a 3632esac
bd9b35c9
JH
3633case "$_a" in
3634'') case "$lib_ext" in
3635 '') _a='.a';;
3636 *) _a="$lib_ext" ;;
dd4e71fd
JH
3637 esac
3638 ;;
dd4e71fd 3639esac
bd9b35c9
JH
3640case "$_o" in
3641'') case "$obj_ext" in
3642 '') _o='.o';;
3643 *) _o="$obj_ext";;
3644 esac
3645 ;;
3646esac
3647case "$p_" in
3648'') case "$path_sep" in
3649 '') p_=':';;
3650 *) p_="$path_sep";;
3651 esac
3652 ;;
3653esac
3654exe_ext=$_exe
3655lib_ext=$_a
3656obj_ext=$_o
3657path_sep=$p_
dd4e71fd 3658
b4eb6b3d
JH
3659: Which makefile gets called first. This is used by make depend.
3660case "$firstmakefile" in
3661'') firstmakefile='makefile';;
4633a7c4 3662esac
4633a7c4 3663
0f0995ae
JH
3664case "$usesocks" in
3665$define|true|[yY]*) dflt='y';;
3666*) dflt='n';;
3667esac
bd9b35c9 3668cat <<EOM
4633a7c4 3669
bd9b35c9
JH
3670Perl can be built to use the SOCKS proxy protocol library. To do so,
3671Configure must be run with -Dusesocks.
4633a7c4 3672
0f0995ae 3673If this doesn't make any sense to you, just accept the default '$dflt'.
bd9b35c9 3674EOM
bd9b35c9
JH
3675rp='Build Perl for SOCKS?'
3676. ./myread
3677case "$ans" in
3678y|Y) val="$define" ;;
3679*) val="$undef" ;;
3680esac
3681set usesocks
3682eval $setvar
3683
3684: Looking for optional libraries
3685echo " "
3686echo "Checking for optional libraries..." >&4
3687case "$libs" in
3688' '|'') dflt='';;
3689*) dflt="$libs";;
3690esac
3691case "$libswanted" in
3692'') libswanted='c_s';;
3693esac
3694case "$usesocks" in
923fc586 3695"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 3696esac
68435ea7
JH
3697libsfound=''
3698libsfiles=''
3699libsdirs=''
13b3f787
JH
3700libspath=''
3701for thisdir in $libpth $xlibpth; do
3702 test -d $thisdir && libspath="$libspath $thisdir"
3703done
bd9b35c9 3704for thislib in $libswanted; do
13b3f787 3705 for thisdir in $libspath; do
f7dd4e7f
JH
3706 xxx=''
3707 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3708 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3709 $test -f "$xxx" && eval $libscheck
3710 $test -f "$xxx" && libstyle=shared
3711 fi
3712 if test ! -f "$xxx"; then
3713 xxx=$thisdir/lib$thislib.$so
3714 $test -f "$xxx" && eval $libscheck
3715 $test -f "$xxx" && libstyle=shared
3716 fi
3717 if test ! -f "$xxx"; then
3718 xxx=$thisdir/lib$thislib$_a
3719 $test -f "$xxx" && eval $libscheck
3720 $test -f "$xxx" && libstyle=static
3721 fi
3722 if test ! -f "$xxx"; then
3723 xxx=$thisdir/$thislib$_a
3724 $test -f "$xxx" && eval $libscheck
3725 $test -f "$xxx" && libstyle=static
3726 fi
3727 if test ! -f "$xxx"; then
3728 xxx=$thisdir/lib${thislib}_s$_a
3729 $test -f "$xxx" && eval $libscheck
3730 $test -f "$xxx" && libstyle=static
09ea5ba9 3731 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
3732 fi
3733 if test ! -f "$xxx"; then
3734 xxx=$thisdir/Slib$thislib$_a
3735 $test -f "$xxx" && eval $libscheck
3736 $test -f "$xxx" && libstyle=static
3737 fi
3738 if $test -f "$xxx"; then
43999f95 3739 case "$libstyle" in
f7dd4e7f
JH
3740 shared) echo "Found -l$thislib (shared)." ;;
3741 static) echo "Found -l$thislib." ;;
3742 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 3743 esac
bd9b35c9
JH
3744 case " $dflt " in
3745 *"-l$thislib "*);;
f7dd4e7f 3746 *) dflt="$dflt -l$thislib"
43999f95
JH
3747 libsfound="$libsfound $xxx"
3748 yyy=`basename $xxx`
3749 libsfiles="$libsfiles $yyy"
1e127011 3750 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
3751 case " $libsdirs " in
3752 *" $yyy "*) ;;
3753 *) libsdirs="$libsdirs $yyy" ;;
3754 esac
3755 ;;
bd9b35c9 3756 esac
f7dd4e7f
JH
3757 break
3758 fi
3759 done
3760 if $test ! -f "$xxx"; then
3761 echo "No -l$thislib."
bd9b35c9
JH
3762 fi
3763done
3764set X $dflt
3765shift
3766dflt="$*"
3767case "$libs" in
3768'') dflt="$dflt";;
3769*) dflt="$libs";;
3770esac
3771case "$dflt" in
3772' '|'') dflt='none';;
3773esac
4633a7c4 3774
bd9b35c9 3775$cat <<EOM
4633a7c4 3776
bd9b35c9
JH
3777In order to compile $package on your machine, a number of libraries
3778are usually needed. Include any other special libraries here as well.
3779Say "none" for none. The default list is almost always right.
8e07c86e 3780EOM
8e07c86e 3781
bd9b35c9
JH
3782echo " "
3783rp="What libraries to use?"
3784. ./myread
3785case "$ans" in
3786none) libs=' ';;
3787*) libs="$ans";;
3788esac
d71b2b6b 3789
bd9b35c9
JH
3790: determine optimization, if desired, or use for debug flag also
3791case "$optimize" in
3792' '|$undef) dflt='none';;
3793'') dflt='-O';;
3794*) dflt="$optimize";;
3795esac
3796$cat <<EOH
d71b2b6b 3797
bd9b35c9
JH
3798By default, $package compiles with the -O flag to use the optimizer.
3799Alternately, you might want to use the symbolic debugger, which uses
3800the -g flag (on traditional Unix systems). Either flag can be
3801specified here. To use neither flag, specify the word "none".
d71b2b6b 3802
bd9b35c9
JH
3803EOH
3804rp="What optimizer/debugger flag should be used?"
3805. ./myread
3806optimize="$ans"
3807case "$optimize" in
3808'none') optimize=" ";;
3809esac
3810
3811dflt=''
3812: We will not override a previous value, but we might want to
3813: augment a hint file
3814case "$hint" in
3815default|recommended)
3816 case "$gccversion" in
3817 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 3818 esac
bd9b35c9
JH
3819 case "$optimize" in
3820 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 3821 esac
bd9b35c9
JH
3822 case "$gccversion" in
3823 2*) if test -d /etc/conf/kconfig.d &&
3824 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3825 then
3826 dflt="$dflt -posix"
3827 fi
f0d04425 3828 ;;
bd9b35c9
JH
3829 esac
3830 case "$gccversion" in
3831 1*) ;;
3832 2.[0-8]*) ;;
3833 ?*) echo " "
3834 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3835 echo 'int main(void) { return 0; }' > gcctest.c
3836 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3837 echo "Yes, it does." 2>&1
3838 case "$ccflags" in
3839 *strict-aliasing*)
3840 echo "Leaving current flags $ccflags alone." 2>&1
3841 ;;
3842 *) dflt="$dflt -fno-strict-aliasing" ;;
3843 esac
3844 else
3845 echo "Nope, it doesn't, but that's ok." 2>&1
3846 fi
f0d04425 3847 ;;
e5e20432
JH
3848 esac
3849 ;;
3850esac
3851
bd9b35c9
JH
3852case "$mips_type" in
3853*BSD*|'') inclwanted="$locincpth $usrinc";;
3854*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3855esac
3856for thisincl in $inclwanted; do
3857 if $test -d $thisincl; then
3858 if $test x$thisincl != x$usrinc; then
3859 case "$dflt" in
422af00a
LC
3860 *" -I$thisincl "*);;
3861 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
3862 esac
3863 fi
3864 fi
3865done
40a7a20a 3866
bd9b35c9
JH
3867inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3868 xxx=true;
3869elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3870 xxx=true;
3871else
3872 xxx=false;
3873fi;
3874if $xxx; then
3875 case "$dflt" in
3876 *$2*);;
3877 *) dflt="$dflt -D$2";;
3878 esac;
3879fi'
40a7a20a 3880
bd9b35c9 3881set signal.h LANGUAGE_C; eval $inctest
40a7a20a 3882
bd9b35c9
JH
3883case "$usesocks" in
3884$define)
3885 ccflags="$ccflags -DSOCKS"
3886 ;;
3887esac
40a7a20a 3888
bd9b35c9
JH
3889case "$hint" in
3890default|recommended) dflt="$ccflags $dflt" ;;
3891*) dflt="$ccflags";;
3892esac
40a7a20a 3893
bd9b35c9
JH
3894case "$dflt" in
3895''|' ') dflt=none;;
3896esac
422af00a 3897
bd9b35c9 3898$cat <<EOH
40a7a20a 3899
bd9b35c9
JH
3900Your C compiler may want other flags. For this question you should include
3901-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3902but you should NOT include libraries or ld flags like -lwhatever. If you
3903want $package to honor its debug switch, you should include -DDEBUGGING here.
3904Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 3905
bd9b35c9 3906To use no flags, specify the word "none".
40a7a20a 3907
bd9b35c9
JH
3908EOH
3909set X $dflt
3910shift
3911dflt=${1+"$@"}
3912rp="Any additional cc flags?"
3913. ./myread
3914case "$ans" in
3915none) ccflags='';;
3916*) ccflags="$ans";;
3917esac
8e07c86e 3918
bd9b35c9
JH
3919: the following weeds options from ccflags that are of no interest to cpp
3920cppflags="$ccflags"
3921case "$gccversion" in
39221*) cppflags="$cppflags -D__GNUC__"
4633a7c4 3923esac
bd9b35c9
JH
3924case "$mips_type" in
3925'');;
3926*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3927esac
3928case "$cppflags" in
3929'');;
3930*)
3931 echo " "
3932 echo "Let me guess what the preprocessor flags are..." >&4
3933 set X $cppflags
3934 shift
3935 cppflags=''
3936 $cat >cpp.c <<'EOM'
3937#define BLURFL foo
8e07c86e 3938
bd9b35c9
JH
3939BLURFL xx LFRULB
3940EOM
3941 previous=''
3942 for flag in $*
3943 do
3944 case "$flag" in
3945 -*) ftry="$flag";;
3946 *) ftry="$previous $flag";;
3947 esac
3948 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3949 >cpp1.out 2>/dev/null && \
3950 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3951 >cpp2.out 2>/dev/null && \
3952 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3953 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3954 then
3955 cppflags="$cppflags $ftry"
3956 previous=''
3957 else
3958 previous="$flag"
3959 fi
3960 done
3961 set X $cppflags
3962 shift
3963 cppflags=${1+"$@"}
3964 case "$cppflags" in
3965 *-*) echo "They appear to be: $cppflags";;
3966 esac
3967 $rm -f cpp.c cpp?.out
2afac517 3968 ;;
3969esac
8e07c86e 3970
bd9b35c9
JH
3971: flags used in final linking phase
3972case "$ldflags" in
3973'') if ./venix; then
3974 dflt='-i -z'
10a23457 3975 else
bd9b35c9 3976 dflt=''
10a23457 3977 fi
bd9b35c9
JH
3978 case "$ccflags" in
3979 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 3980 esac
bd9b35c9
JH
3981 ;;
3982*) dflt="$ldflags";;
3983esac
3984
3985: Try to guess additional flags to pick up local libraries.
3986for thislibdir in $libpth; do
3987 case " $loclibpth " in
3988 *" $thislibdir "*)
3989 case "$dflt " in
3990 *"-L$thislibdir "*) ;;
3991 *) dflt="$dflt -L$thislibdir" ;;
3992 esac
c4f23d77
AD
3993 ;;
3994 esac
bd9b35c9 3995done
c4f23d77 3996
bd9b35c9
JH
3997case "$dflt" in
3998'') dflt='none' ;;
3999esac
c4f23d77 4000
bd9b35c9
JH
4001$cat <<EOH
4002
4003Your C linker may need flags. For this question you should
4004include -L/whatever and any other flags used by the C linker, but you
4005should NOT include libraries like -lwhatever.
4006
4007Make sure you include the appropriate -L/path flags if your C linker
4008does not normally search all of the directories you specified above,
4009namely
4010 $libpth
4011To use no flags, specify the word "none".
4012
4013EOH
4014
4015rp="Any additional ld flags (NOT including libraries)?"
4016. ./myread
4017case "$ans" in
4018none) ldflags='';;
4019*) ldflags="$ans";;
4020esac
4021rmlist="$rmlist pdp11"
4022
4023: coherency check
4024echo " "
4025echo "Checking your choice of C compiler and flags for coherency..." >&4
4026$cat > try.c <<'EOF'
4027#include <stdio.h>
4028int main() { printf("Ok\n"); exit(0); }
4029EOF
7a282f6d 4030set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
4031shift
4032$cat >try.msg <<'EOM'
4033I've tried to compile and run the following simple program:
4034
4035EOM
4036$cat try.c >> try.msg
4037
4038$cat >> try.msg <<EOM
4039
4040I used the command:
4041
4042 $*
4043 ./try
4044
4045and I got the following output:
4046
4047EOM
4048dflt=y
7a282f6d 4049if sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
bd9b35c9
JH
4050 if sh -c './try' >>try.msg 2>&1; then
4051 xxx=`./try`
4052 case "$xxx" in
4053 "Ok") dflt=n ;;
4054 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4055 case " $libs " in
4056 *" -lsfio "*)
4057 cat >> try.msg <<'EOQS'
4058If $libs contains -lsfio, and sfio is mis-configured, then it
4059sometimes (apparently) runs and exits with a 0 status, but with no
4060output! It may have to do with sfio's use of _exit vs. exit.
4061
4062EOQS
4063 rp="You have a big problem. Shall I abort Configure"
4064 dflt=y
4065 ;;
4066 esac
4067 ;;
4068 esac
4069 else
4070 echo "The program compiled OK, but exited with status $?." >>try.msg
4071 rp="You have a problem. Shall I abort Configure"
4072 dflt=y
4073 fi
4074else
4075 echo "I can't compile the test program." >>try.msg
4076 rp="You have a BIG problem. Shall I abort Configure"
4077 dflt=y
4078fi
4079case "$dflt" in
4080y)
4081 $cat try.msg >&4
4082 case "$knowitall" in
4083 '')
4084 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 4085 ;;
bd9b35c9 4086 *) dflt=n;;
c4f23d77 4087 esac
bd9b35c9
JH
4088 echo " "
4089 . ./myread
4090 case "$ans" in
4091 n*|N*) ;;
4092 *) echo "Ok. Stopping Configure." >&4
4093 exit 1
c4f23d77
AD
4094 ;;
4095 esac
4096 ;;
bd9b35c9 4097n) echo "OK, that should do.";;
c4f23d77 4098esac
bd9b35c9 4099$rm -f try try.* core
c4f23d77 4100
b4eb6b3d
JH
4101: define an is-a-typedef? function
4102typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4103case "$inclist" in
4104"") inclist="sys/types.h";;
4105esac;
4106eval "varval=\$$var";
4107case "$varval" in
4108"")
4109 $rm -f temp.c;
4110 for inc in $inclist; do
4111 echo "#include <$inc>" >>temp.c;
4112 done;
4113 echo "#ifdef $type" >> temp.c;
4114 echo "printf(\"We have $type\");" >> temp.c;
4115 echo "#endif" >> temp.c;
4116 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4117 if $contains $type temp.E >/dev/null 2>&1; then
4118 eval "$var=\$type";
4119 else
4120 eval "$var=\$def";
4121 fi;
4122 $rm -f temp.?;;
4123*) eval "$var=\$varval";;
4124esac'
4125
4126: define an is-a-typedef? function that prompts if the type is not available.
4127typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4128case "$inclist" in
4129"") inclist="sys/types.h";;
4130esac;
4131eval "varval=\$$var";
4132case "$varval" in
4133"")
4134 $rm -f temp.c;
4135 for inc in $inclist; do
4136 echo "#include <$inc>" >>temp.c;
4137 done;
4138 echo "#ifdef $type" >> temp.c;
4139 echo "printf(\"We have $type\");" >> temp.c;
4140 echo "#endif" >> temp.c;
4141 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4142 echo " " ;
4143 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4144 if $contains $type temp.E >/dev/null 2>&1; then
4145 echo "$type found." >&4;
4146 eval "$var=\$type";
4147 else
4148 echo "$type NOT found." >&4;
4149 dflt="$def";
4150 . ./myread ;
4151 eval "$var=\$ans";
4152 fi;
4153 $rm -f temp.?;;
4154*) eval "$var=\$varval";;
4155esac'
4156
bd9b35c9
JH
4157: define a shorthand compile call
4158compile='
4159mc_file=$1;
4160shift;
08413ebc 4161$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
4162: define a shorthand compile call for compilations that should be ok.
4163compile_ok='
4164mc_file=$1;
4165shift;
7a282f6d 4166$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 4167
b4eb6b3d 4168: check for lengths of integral types
bd9b35c9 4169echo " "
b4eb6b3d
JH
4170case "$intsize" in
4171'')
4172 echo "Checking to see how big your integers are..." >&4
4173 $cat >intsize.c <<'EOCP'
bd9b35c9
JH
4174#include <stdio.h>
4175int main()
4176{
b4eb6b3d
JH
4177 printf("intsize=%d;\n", (int)sizeof(int));
4178 printf("longsize=%d;\n", (int)sizeof(long));
4179 printf("shortsize=%d;\n", (int)sizeof(short));
4180 exit(0);
bd9b35c9 4181}
b4eb6b3d
JH
4182EOCP
4183 set intsize
4184 if eval $compile_ok && ./intsize > /dev/null; then
4185 eval `./intsize`
4186 echo "Your integers are $intsize bytes long."
4187 echo "Your long integers are $longsize bytes long."
4188 echo "Your short integers are $shortsize bytes long."
4189 else
4190 $cat >&4 <<EOM
4191!
4192Help! I can't compile and run the intsize test program: please enlighten me!
4193(This is probably a misconfiguration in your system or libraries, and
4194you really ought to fix it. Still, I'll try anyway.)
4195!
bd9b35c9 4196EOM
b4eb6b3d
JH
4197 dflt=4
4198 rp="What is the size of an integer (in bytes)?"
4199 . ./myread
4200 intsize="$ans"
4201 dflt=$intsize
4202 rp="What is the size of a long integer (in bytes)?"
4203 . ./myread
4204 longsize="$ans"
4205 dflt=2
4206 rp="What is the size of a short integer (in bytes)?"
4207 . ./myread
4208 shortsize="$ans"
4209 fi
4210 ;;
4211esac
4212$rm -f intsize intsize.*
c1a7f87b 4213
b4eb6b3d
JH
4214: see what type lseek is declared as in the kernel
4215rp="What is the type used for lseek's offset on this system?"
4216set off_t lseektype long stdio.h sys/types.h
4217eval $typedef_ask
4218
4219echo " "
4220echo "Checking to see how big your file offsets are..." >&4
4221$cat >try.c <<EOCP
4222#include <sys/types.h>
4223#include <stdio.h>
4224int main()
4225{
4226 printf("%d\n", (int)sizeof($lseektype));
4227 return(0);
4228}
4229EOCP
4230set try
4231if eval $compile_ok; then
4232 lseeksize=`./try`
4233 echo "Your file offsets are $lseeksize bytes long."
4234else
4235 dflt=$longsize
4236 echo " "
4237 echo "(I can't seem to compile the test program. Guessing...)"
4238 rp="What is the size of your file offsets (in bytes)?"
4239 . ./myread
4240 lseeksize="$ans"
4241fi
4242$rm -f try.c try
4243
4244: see what type file positions are declared as in the library
4245rp="What is the type for file position used by fsetpos()?"
4246set fpos_t fpostype long stdio.h sys/types.h
4247eval $typedef_ask
4248
4249echo " "
4250case "$fpostype" in
4251*_t) zzz="$fpostype" ;;
4252*) zzz="fpos_t" ;;
4253esac
4254echo "Checking the size of $zzz..." >&4
4255cat > try.c <<EOCP
4256#include <sys/types.h>
4257#include <stdio.h>
4258int main() {
4259 printf("%d\n", (int)sizeof($fpostype));
4260 exit(0);
4261}
4262EOCP
4263set try
4264if eval $compile_ok; then
4265 yyy=`./try`
4266 case "$yyy" in
4267 '') fpossize=4
4268 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4269 ;;
4270 *) fpossize=$yyy
4271 echo "Your $zzz is $fpossize bytes long."
4272 ;;
4273 esac
4274else
4275 dflt="$longsize"
4276 echo " " >&4
4277 echo "(I can't compile the test program. Guessing...)" >&4
4278 rp="What is the size of your file positions (in bytes)?"
4279 . ./myread
4280 fpossize="$ans"
4281fi
4282
4283
4284
4285# Backward compatibility (uselfs is deprecated).
4286case "$uselfs" in
4287"$define"|true|[yY]*)
4288 cat <<EOM >&4
4289
4290*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4291EOM
4292 uselargefiles="$define"
4293 ;;
4294esac
4295
4296case "$lseeksize:$fpossize" in
42978:8) cat <<EOM
4298
4299You can have files larger than 2 gigabytes.
4300EOM
4301 val="$define" ;;
4302*) case "$uselargefiles" in
4303 "$undef"|false|[nN]*) dflt='n' ;;
4304 *) dflt='y' ;;
4305 esac
4306 cat <<EOM
4307
4308Perl can be built to understand large files (files larger than 2 gigabytes)
4309on some systems. To do so, Configure can be run with -Duselargefiles.
4310
4311If this doesn't make any sense to you, just accept the default '$dflt'.
4312EOM
4313 rp='Try to understand large files, if available?'
4314 . ./myread
4315 case "$ans" in
4316 y|Y) val="$define" ;;
4317 *) val="$undef" ;;
4318 esac
4319 ;;
4320esac
4321set uselargefiles
4322eval $setvar
4323case "$uselargefiles" in
4324"$define")
4325: Look for a hint-file generated 'call-back-unit'. If the
4326: user has specified that a large files perl is to be built,
4327: we may need to set or change some other defaults.
4328 if $test -f uselargefiles.cbu; then
4329 echo "Your platform has some specific hints for large file builds, using them..."
4330 . ./uselargefiles.cbu
4331 echo " "
4332 echo "Rechecking to see how big your file offsets are..." >&4
4333 $cat >try.c <<EOCP
4334#include <sys/types.h>
4335#include <stdio.h>
4336int main()
4337{
4338 printf("%d\n", (int)sizeof($lseektype));
4339 return(0);
4340}
4341EOCP
4342 set try
4343 if eval $compile_ok; then
4344 lseeksize=`./try`
4345 $echo "Your file offsets are now $lseeksize bytes long."
4346 else
4347 dflt="$lseeksize"
4348 echo " "
4349 echo "(I can't seem to compile the test program. Guessing...)"
4350 rp="What is the size of your file offsets (in bytes)?"
4351 . ./myread
4352 lseeksize="$ans"
4353 fi
4354 case "$fpostype" in
4355 *_t) zzz="$fpostype" ;;
4356 *) zzz="fpos_t" ;;
4357 esac
4358 $echo $n "Rechecking the size of $zzz...$c" >&4
4359 $cat > try.c <<EOCP
4360#include <sys/types.h>
4361#include <stdio.h>
4362int main() {
4363 printf("%d\n", (int)sizeof($fpostype));
4364 exit(0);
4365}
4366EOCP
4367 set try
4368 if eval $compile_ok; then
4369 yyy=`./try`
4370 dflt="$lseeksize"
4371 case "$yyy" in
4372 '') echo " "
4373 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4374 ;;
4375 *) fpossize=$yyy
4376 echo " $fpossize bytes." >&4
4377 ;;
4378 esac
4379 else
4380 dflt="$fpossize"
4381 echo " "
4382 echo "(I can't compile the test program. Guessing...)" >&4
4383 rp="What is the size of your file positions (in bytes)?"
4384 . ./myread
4385 fpossize="$ans"
4386 fi
4387 $rm -f try.c try
4388 fi
4389 ;;
4390esac
4391
4392
4393case "$usemorebits" in
4394"$define"|true|[yY]*)
4395 use64bitint="$define"
4396 uselongdouble="$define"
4397 usemorebits="$define"
4398 ;;
4399*) usemorebits="$undef"
4400 ;;
4401esac
4402
4403
4404case "$uselonglong" in
4405"$define"|true|[yY]*)
4406 cat <<EOM >&4
4407
4408*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4409EOM
4410 use64bitint="$define"
4411 ;;
4412esac
4413case "$use64bits" in
4414"$define"|true|[yY]*)
4415 cat <<EOM >&4
4416
4417*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4418EOM
4419 use64bitint="$define"
4420 ;;
4421esac
4422case "$use64bitints" in
4423"$define"|true|[yY]*)
4424 cat <<EOM >&4
4425
4426*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4427EOM
4428 use64bitint="$define"
4429 ;;
4430esac
4431case "$use64bitsint" in
4432"$define"|true|[yY]*)
4433 cat <<EOM >&4
4434
4435*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4436EOM
4437 use64bitint="$define"
4438 ;;
4439esac
4440case "$uselonglongs" in
4441"$define"|true|[yY]*)
4442 cat <<EOM >&4
4443
4444*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4445EOM
4446 use64bitint="$define"
4447 ;;
4448esac
4449case "$use64bitsall" in
4450"$define"|true|[yY]*)
4451 cat <<EOM >&4
4452
4453*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4454EOM
4455 use64bitall="$define"
4456 ;;
4457esac
4458
4459case "$ccflags" in
4460*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4461esac
4462case "$use64bitall" in
4463"$define"|true|[yY]*) use64bitint="$define" ;;
4464esac
4465
4466case "$longsize" in
44678) cat <<EOM
4468
4469You have natively 64-bit long integers.
4470EOM
4471 val="$define"
4472 ;;
4473*) case "$use64bitint" in
4474 "$define"|true|[yY]*) dflt='y';;
4475 *) dflt='n';;
4476 esac
4477 cat <<EOM
4478
4479Perl can be built to take advantage of 64-bit integer types
4480on some systems. To do so, Configure can be run with -Duse64bitint.
4481Choosing this option will most probably introduce binary incompatibilities.
4482
4483If this doesn't make any sense to you, just accept the default '$dflt'.
4484EOM
4485 rp='Try to use 64-bit integers, if available?'
4486 . ./myread
4487 case "$ans" in
4488 [yY]*) val="$define" ;;
4489 *) val="$undef" ;;
4490 esac
4491 ;;
4492esac
4493set use64bitint
4494eval $setvar
4495
4496case "$use64bitall" in
4497"$define"|true|[yY]*) dflt='y' ;;
4498*) case "$longsize" in
4499 8) dflt='y' ;;
4500 *) dflt='n' ;;
4501 esac
4502 ;;
4503esac
4504cat <<EOM
4505
4506You may also choose to try maximal 64-bitness. It means using as much
450764-bitness as possible on the platform. This in turn means even more
4508binary incompatibilities. On the other hand, your platform may not
4509have any more 64-bitness available than what you already have chosen.
4510
4511If this doesn't make any sense to you, just accept the default '$dflt'.
4512EOM
4513rp='Try to use maximal 64-bit support, if available?'
4514. ./myread
4515case "$ans" in
4516[yY]*) val="$define" ;;
4517*) val="$undef" ;;
4518esac
4519set use64bitall
4520eval $setvar
4521case "$use64bitall" in
4522"$define")
4523 case "$use64bitint" in
4524 "$undef")
4525 cat <<EOM
4526
4527Since you have chosen a maximally 64-bit build, I'm also turning on
4528the use of 64-bit integers.
4529EOM
4530 use64bitint="$define" ;;
4531 esac
4532 ;;
4533esac
4534
4535case "$use64bitint" in
4536"$define"|true|[yY]*)
4537: Look for a hint-file generated 'call-back-unit'. If the
4538: user has specified that a 64-bit perl is to be built,
4539: we may need to set or change some other defaults.
4540 if $test -f use64bitint.cbu; then
4541 echo "Your platform has some specific hints for 64-bit integers, using them..."
4542 . ./use64bitint.cbu
4543 fi
4544 case "$longsize" in
4545 4) case "$archname64" in
4546 '') archname64=64int ;;
4547 esac
4548 ;;
4549 esac
4550 ;;
4551esac
4552
4553case "$use64bitall" in
4554"$define"|true|[yY]*)
4555: Look for a hint-file generated 'call-back-unit'. If the
4556: user has specified that a maximally 64-bit perl is to be built,
4557: we may need to set or change some other defaults.
4558 if $test -f use64bitall.cbu; then
4559 echo "Your platform has some specific hints for 64-bit builds, using them..."
4560 . ./use64bitall.cbu
4561 fi
4562 case "$longsize" in
4563 4) case "$archname64" in
4564 ''|64int) archname64=64all ;;
4565 esac
4566 ;;
4567 esac
4568 ;;
4569esac
4570
4571echo " "
4572echo "Checking for GNU C Library..." >&4
4573cat >gnulibc.c <<EOM
4574#include <stdio.h>
4575int main()
4576{
4577#ifdef __GLIBC__
4578 exit(0);
4579#else
4580 exit(1);
4581#endif
4582}
4583EOM
4584set gnulibc
4585if eval $compile_ok && ./gnulibc; then
4586 val="$define"
4587 echo "You are using the GNU C Library"
4588else
4589 val="$undef"
4590 echo "You are not using the GNU C Library"
4591fi
4592$rm -f gnulibc*
4593set d_gnulibc
4594eval $setvar
4595
4596: see if nm is to be used to determine whether a symbol is defined or not
4597case "$usenm" in
4598'')
4599 dflt=''
c1a7f87b
JH
4600 case "$d_gnulibc" in
4601 "$define")
4602 echo " "
4603 echo "nm probably won't work on the GNU C Library." >&4
4604 dflt=n
bd9b35c9 4605 ;;
c1a7f87b
JH
4606 esac
4607 case "$dflt" in
4608 '')
4609 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4610 echo " "
4611 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
4612 echo "'nm' won't be sufficient on this sytem." >&4
4613 dflt=n
4614 fi
4615 ;;
4616 esac
4617 case "$dflt" in
4618 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4619 if $test $dflt -gt 20; then
4620 dflt=y
4621 else
4622 dflt=n
4623 fi
bd9b35c9
JH
4624 ;;
4625 esac
bd9b35c9
JH
4626 ;;
4627*)
c1a7f87b
JH
4628 case "$usenm" in
4629 true|$define) dflt=y;;
4630 *) dflt=n;;
4631 esac
bd9b35c9
JH
4632 ;;
4633esac
4634$cat <<EOM
4635
c1a7f87b
JH
4636I can use $nm to extract the symbols from your C libraries. This
4637is a time consuming task which may generate huge output on the disk (up
4638to 3 megabytes) but that should make the symbols extraction faster. The
4639alternative is to skip the 'nm' extraction part and to compile a small
4640test program instead to determine whether each symbol is present. If
4641you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4642this may be the best solution.
4643
4644You probably shouldn't let me use 'nm' if you are using the GNU C Library.
bd9b35c9
JH
4645
4646EOM
c1a7f87b
JH
4647rp="Shall I use $nm to extract C symbols from the libraries?"
4648. ./myread
4649case "$ans" in
4650[Nn]*) usenm=false;;
4651*) usenm=true;;
bd9b35c9 4652esac
bd9b35c9 4653
c1a7f87b
JH
4654runnm=$usenm
4655case "$reuseval" in
4656true) runnm=false;;
8e07c86e 4657esac
29209bc5 4658
c1a7f87b
JH
4659: nm options which may be necessary
4660case "$nm_opt" in
4661'') if $test -f /mach_boot; then
4662 nm_opt='' # Mach
4663 elif $test -d /usr/ccs/lib; then
4664 nm_opt='-p' # Solaris (and SunOS?)
4665 elif $test -f /dgux; then
4666 nm_opt='-p' # DG-UX
4667 elif $test -f /lib64/rld; then
4668 nm_opt='-p' # 64-bit Irix
4669 else
4670 nm_opt=''
4671 fi;;
4672esac
bd9b35c9 4673
c1a7f87b
JH
4674: nm options which may be necessary for shared libraries but illegal
4675: for archive libraries. Thank you, Linux.
4676case "$nm_so_opt" in
4677'') case "$myuname" in
4678 *linux*)
4679 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4680 nm_so_opt='--dynamic'
4681 fi
4682 ;;
bd9b35c9 4683 esac
c1a7f87b
JH
4684 ;;
4685esac
8e07c86e 4686
c1a7f87b
JH
4687case "$runnm" in
4688true)
4689: get list of predefined functions in a handy place
4690echo " "
4691case "$libc" in
4692'') libc=unknown
4693 case "$libs" in
4694 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
bd9b35c9 4695 esac
ff935051
JH
4696 ;;
4697esac
c1a7f87b
JH
4698libnames='';
4699case "$libs" in
4700'') ;;
4701*) for thislib in $libs; do
4702 case "$thislib" in
4703 -lc|-lc_s)
4704 : Handle C library specially below.
4705 ;;
4706 -l*)
4707 thislib=`echo $thislib | $sed -e 's/^-l//'`
4708 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4709 :
4710 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4711 :
4712 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4713 :
4714 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4715 :
4716 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4717 :
4718 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4719 :
4720 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4721 :
4722 else
4723 try=''
4724 fi
4725 libnames="$libnames $try"
4726 ;;
4727 *) libnames="$libnames $thislib" ;;
34d1710f 4728 esac
c1a7f87b 4729 done
4633a7c4
LW
4730 ;;
4731esac
c1a7f87b
JH
4732xxx=normal
4733case "$libc" in
4734unknown)
4735 set /lib/libc.$so
4736 for xxx in $libpth; do
4737 $test -r $1 || set $xxx/libc.$so
4738 : The messy sed command sorts on library version numbers.
4739 $test -r $1 || \
4740 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4741 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4742 h
4743 s/[0-9][0-9]*/0000&/g
4744 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4745 G
4746 s/\n/ /' | \
381aa1ff 4747 $sort | $sed -e 's/^.* //'`
c1a7f87b
JH
4748 eval set \$$#
4749 done
4750 $test -r $1 || set /usr/ccs/lib/libc.$so
4751 $test -r $1 || set /lib/libsys_s$_a
4752 ;;
4753*)
4754 set blurfl
4755 ;;
a4f3eea9 4756esac
c1a7f87b
JH
4757if $test -r "$1"; then
4758 echo "Your (shared) C library seems to be in $1."
4759 libc="$1"
4760elif $test -r /lib/libc && $test -r /lib/clib; then
4761 echo "Your C library seems to be in both /lib/clib and /lib/libc."
4762 xxx=apollo
4763 libc='/lib/clib /lib/libc'
4764 if $test -r /lib/syslib; then
4765 echo "(Your math library is in /lib/syslib.)"
4766 libc="$libc /lib/syslib"
4767 fi
4768elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4769 echo "Your C library seems to be in $libc, as you said before."
4770elif $test -r $incpath/usr/lib/libc$_a; then
4771 libc=$incpath/usr/lib/libc$_a;
4772 echo "Your C library seems to be in $libc. That's fine."
4773elif $test -r /lib/libc$_a; then
4774 libc=/lib/libc$_a;
4775 echo "Your C library seems to be in $libc. You're normal."
4776else
4777 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4778 :
4779 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4780 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4781 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4782 :
4783 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4784 :
4785 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4786 :
4787 else
4788 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4789 fi
4790 if $test -r "$tans"; then
4791 echo "Your C library seems to be in $tans, of all places."
4792 libc=$tans
4793 else
4794 libc='blurfl'
4795 fi
4796fi
4797if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4798 dflt="$libc"
4799 cat <<EOM
a4f3eea9 4800
c1a7f87b
JH
4801If the guess above is wrong (which it might be if you're using a strange
4802compiler, or your machine supports multiple models), you can override it here.
bd9b35c9
JH
4803
4804EOM
a4f3eea9 4805else
c1a7f87b 4806 dflt=''
381aa1ff 4807 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
c1a7f87b
JH
4808 cat >&4 <<EOM
4809I can't seem to find your C library. I've looked in the following places:
a4f3eea9 4810
c1a7f87b
JH
4811EOM
4812 $sed 's/^/ /' libpath
4813 cat <<EOM
29209bc5 4814
c1a7f87b 4815None of these seems to contain your C library. I need to get its name...
a4f3eea9 4816
bd9b35c9 4817EOM
bd9b35c9 4818fi
c1a7f87b
JH
4819fn=f
4820rp='Where is your C library?'
4821. ./getfile
4822libc="$ans"
a4f3eea9 4823
c1a7f87b 4824echo " "
381aa1ff 4825echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
c1a7f87b
JH
4826set X `cat libnames`
4827shift
4828xxx=files
4829case $# in 1) xxx=file; esac
4830echo "Extracting names from the following $xxx for later perusal:" >&4
4831echo " "
4832$sed 's/^/ /' libnames >&4
4833echo " "
4834$echo $n "This may take a while...$c" >&4
a4f3eea9 4835
c1a7f87b
JH
4836for file in $*; do
4837 case $file in
4838 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4839 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 4840 esac
c1a7f87b 4841done >libc.tmp
a4f3eea9 4842
c1a7f87b
JH
4843$echo $n ".$c"
4844$grep fprintf libc.tmp > libc.ptf
4845xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4846xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4847xxx='[ADTSIW]'
4848if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
4849 eval $xscan;\
4850 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4851 eval $xrun
4852elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4853 eval $xscan;\
4854 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4855 eval $xrun
4856elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4857 eval $xscan;\
4858 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4859 eval $xrun
4860elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4861 eval $xscan;\
4862 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4863 eval $xrun
4864elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4865 eval $xscan;\
4866 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4867 eval $xrun
4868elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4869 eval $xscan;\
4870 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4871 eval $xrun
4872elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4873 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
4874 eval $xscan;\
4875 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4876 eval $xrun
4877elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4878 eval $xscan;\
4879 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4880 eval $xrun
4881elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4882 eval $xscan;\
4883 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4884 eval $xrun
4885elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4886 eval $xscan;\
4887 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4888 eval $xrun
4889elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4890 eval $xscan;\
4891 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4892 eval $xrun
4893elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4894 eval $xscan;\
4895 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4896 eval $xrun
4897elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4898 eval $xscan;\
4899 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4900 eval $xrun
4901elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
4902 eval $xscan;\
4903 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4904 eval $xrun
4905else
4906 $nm -p $* 2>/dev/null >libc.tmp
4907 $grep fprintf libc.tmp > libc.ptf
4908 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4909 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4910 then
4911 nm_opt='-p'
4912 eval $xrun
bd9b35c9 4913 else
c1a7f87b
JH
4914 echo " "
4915 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
4916 com=''
4917 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
4918 for thisname in $libnames $libc; do
4919 $ar t $thisname >>libc.tmp
4920 done
4921 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
4922 echo "Ok." >&4
4923 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
4924 # Repeat libc to extract forwarders to DLL entries too
4925 for thisname in $libnames $libc; do
4926 $ar tv $thisname >>libc.tmp
4927 # Revision 50 of EMX has bug in $ar.
4928 # it will not extract forwarders to DLL entries
4929 # Use emximp which will extract exactly them.
4930 emximp -o tmp.imp $thisname \
4931 2>/dev/null && \
4932 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
4933 < tmp.imp >>libc.tmp
4934 $rm tmp.imp
4935 done
4936 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
4937 echo "Ok." >&4
4938 else
4939 echo "$ar didn't seem to work right." >&4
4940 echo "Maybe this is a Cray...trying bld instead..." >&4
4941 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
4942 then
4943 for thisname in $libnames; do
4944 bld t $libnames | \
4945 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
4946 $ar t $thisname >>libc.tmp
4947 done
4948 echo "Ok." >&4
bd9b35c9 4949 else
c1a7f87b
JH
4950 echo "That didn't work either. Giving up." >&4
4951 exit 1
bd9b35c9 4952 fi
c1a7f87b 4953 fi
a4f3eea9 4954 fi
a4f3eea9 4955fi
c1a7f87b
JH
4956nm_extract="$com"
4957if $test -f /lib/syscalls.exp; then
4958 echo " "
4959 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4960 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
4961fi
4962;;
4963esac
4964$rm -f libnames libpath
bd9b35c9 4965
c1a7f87b
JH
4966: is a C symbol defined?
4967csym='tlook=$1;
4968case "$3" in
4969-v) tf=libc.tmp; tc=""; tdc="";;
4970-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
4971*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4972esac;
4973tx=yes;
4974case "$reuseval-$4" in
4975true-) ;;
4976true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4977esac;
4978case "$tx" in
4979yes)
4980 case "$runnm" in
4981 true)
4982 if $contains $tlook $tf >/dev/null 2>&1;
4983 then tval=true;
4984 else tval=false;
4985 fi;;
4986 *)
4987 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
7a282f6d 4988 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
c1a7f87b
JH
4989 then tval=true;
4990 else tval=false;
4991 fi;
4992 $rm -f t t.c;;
4993 esac;;
4994*)
4995 case "$tval" in
4996 $define) tval=true;;
4997 *) tval=false;;
4998 esac;;
4999esac;
5000eval "$2=$tval"'
bd9b35c9 5001
c1a7f87b
JH
5002: define an is-in-libc? function
5003inlibc='echo " "; td=$define; tu=$undef;
5004sym=$1; var=$2; eval "was=\$$2";
5005tx=yes;
5006case "$reuseval$was" in
5007true) ;;
5008true*) tx=no;;
5009esac;
5010case "$tx" in
5011yes)
5012 set $sym tres -f;
5013 eval $csym;
5014 case "$tres" in
5015 true)
5016 echo "$sym() found." >&4;
5017 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5018 *)
5019 echo "$sym() NOT found." >&4;
5020 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5021 esac;;
bd9b35c9 5022*)
c1a7f87b
JH
5023 case "$was" in
5024 $define) echo "$sym() found." >&4;;
5025 *) echo "$sym() NOT found." >&4;;
5026 esac;;
5027esac'
5028
b4eb6b3d
JH
5029: see if sqrtl exists
5030set sqrtl d_sqrtl
c1a7f87b
JH
5031eval $inlibc
5032
b4eb6b3d
JH
5033case "$ccflags" in
5034*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
c1a7f87b 5035esac
b4eb6b3d
JH
5036
5037case "$uselongdouble" in
5038$define|true|[yY]*) dflt='y';;
5039*) dflt='n';;
5040esac
5041cat <<EOM
5042
5043Perl can be built to take advantage of long doubles which
5044(if available) may give more accuracy and range for floating point numbers.
5045
5046If this doesn't make any sense to you, just accept the default '$dflt'.
5047EOM
5048rp='Try to use long doubles if available?'
c1a7f87b
JH
5049. ./myread
5050case "$ans" in
b4eb6b3d
JH
5051y|Y) val="$define" ;;
5052*) val="$undef" ;;
5053esac
5054set uselongdouble
5055eval $setvar
bfb7748a 5056
b4eb6b3d
JH
5057case "$uselongdouble" in
5058true|[yY]*) uselongdouble="$define" ;;
5059esac
bfb7748a 5060
b4eb6b3d
JH
5061case "$uselongdouble" in
5062$define)
5063: Look for a hint-file generated 'call-back-unit'. If the
5064: user has specified that long doubles should be used,
5065: we may need to set or change some other defaults.
5066 if $test -f uselongdouble.cbu; then
5067 echo "Your platform has some specific hints for long doubles, using them..."
5068 . ./uselongdouble.cbu
5069 else
5070 $cat <<EOM
5071(Your platform doesn't have any specific hints for long doubles.)
c1a7f87b 5072EOM
b4eb6b3d
JH
5073 fi
5074 ;;
5075esac
5076
5077case "$uselongdouble:$d_sqrtl" in
5078$define:$undef)
5079 $cat <<EOM >&4
5080
5081*** You requested the use of long doubles but you do not seem to have
5082*** the mathematic functions for long doubles. I'm disabling the use
5083*** of long doubles.
5084
5085EOM
5086 uselongdouble=$undef
5087 ;;
5088esac
5089
5090: check for length of double
5091echo " "
5092case "$doublesize" in
5093'')
5094 echo "Checking to see how big your double precision numbers are..." >&4
5095 $cat >try.c <<'EOCP'
5096#include <stdio.h>
5097int main()
5098{
5099 printf("%d\n", (int)sizeof(double));
5100 exit(0);
5101}
5102EOCP
5103 set try
5104 if eval $compile_ok; then
5105 doublesize=`./try`
5106 echo "Your double is $doublesize bytes long."
5107 else
5108 dflt='8'
5109 echo "(I can't seem to compile the test program. Guessing...)"
5110 rp="What is the size of a double precision number (in bytes)?"
5111 . ./myread
5112 doublesize="$ans"
5113 fi
5114 ;;
5115esac
5116$rm -f try.c try
5117
5118: check for long doubles
5119echo " "
5120echo "Checking to see if you have long double..." >&4
5121echo 'int main() { long double x = 7.0; }' > try.c
5122set try
5123if eval $compile; then
5124 val="$define"
5125 echo "You have long double."
5126else
5127 val="$undef"
5128 echo "You do not have long double."
5129fi
5130$rm try.*
5131set d_longdbl
5132eval $setvar
5133
5134: check for length of long double
5135case "${d_longdbl}${longdblsize}" in
5136$define)
5137 echo " "
5138 echo "Checking to see how big your long doubles are..." >&4
5139 $cat >try.c <<'EOCP'
5140#include <stdio.h>
5141int main()
5142{
5143 printf("%d\n", sizeof(long double));
5144}
5145EOCP
5146 set try
5147 set try
5148 if eval $compile; then
5149 longdblsize=`./try$exe_ext`
5150 echo "Your long doubles are $longdblsize bytes long."
5151 else
5152 dflt='8'
5153 echo " "
5154 echo "(I can't seem to compile the test program. Guessing...)" >&4
5155 rp="What is the size of a long double (in bytes)?"
5156 . ./myread
5157 longdblsize="$ans"
5158 fi
5159 if $test "X$doublesize" = "X$longdblsize"; then
5160 echo "(That isn't any different from an ordinary double.)"
5161 fi
5162 ;;
5163esac
5164$rm -f try.* try
5165
5166: determine the architecture name
5167echo " "
5168if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5169 tarch=`arch`"-$osname"
5170elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5171 if uname -m > tmparch 2>&1 ; then
5172 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5173 -e 's/$/'"-$osname/" tmparch`
5174 else
5175 tarch="$osname"
5176 fi
5177 $rm -f tmparch
5178else
5179 tarch="$osname"
5180fi
5181case "$myarchname" in
5182''|"$tarch") ;;
5183*)
5184 echo "(Your architecture name used to be $myarchname.)"
5185 archname=''
5186 ;;
5187esac
5188myarchname="$tarch"
5189case "$archname" in
5190'') dflt="$tarch";;
5191*) dflt="$archname";;
5192esac
5193rp='What is your architecture name'
5194. ./myread
5195archname="$ans"
5196case "$usethreads" in
5197$define)
5198 echo "Threads selected." >&4
5199 case "$archname" in
5200 *-thread*) echo "...and architecture name already has -thread." >&4
5201 ;;
5202 *) archname="$archname-thread"
5203 echo "...setting architecture name to $archname." >&4
5204 ;;
5205 esac
5206 ;;
5207esac
5208case "$usemultiplicity" in
5209$define)
5210 echo "Multiplicity selected." >&4
5211 case "$archname" in
5212 *-multi*) echo "...and architecture name already has -multi." >&4
5213 ;;
5214 *) archname="$archname-multi"
5215 echo "...setting architecture name to $archname." >&4
5216 ;;
5217 esac
5218 ;;
5219esac
5220case "$use64bitint$use64bitall" in
5221*"$define"*)
5222 case "$archname64" in
5223 '')
5224 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5225 ;;
5226 *)
5227 case "$use64bitint" in
5228 "$define") echo "64 bit integers selected." >&4 ;;
5229 esac
5230 case "$use64bitall" in
5231 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5232 esac
5233 case "$archname" in
5234 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5235 ;;
5236 *) archname="$archname-$archname64"
5237 echo "...setting architecture name to $archname." >&4
5238 ;;
5239 esac
5240 ;;
5241 esac
5242esac
5243case "$uselongdouble" in
5244$define)
5245 echo "Long doubles selected." >&4
5246 case "$longdblsize" in
5247 $doublesize)
5248 "...but long doubles are equal to doubles, not changing architecture name." >&4
5249 ;;
5250 *)
5251 case "$archname" in
5252 *-ld*) echo "...and architecture name already has -ld." >&4
5253 ;;
5254 *) archname="$archname-ld"
5255 echo "...setting architecture name to $archname." >&4
5256 ;;
5257 esac
5258 ;;
5259 esac
5260 ;;
5261esac
5262
5263: determine root of directory hierarchy where package will be installed.
5264case "$prefix" in
5265'')
5266 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5267 ;;
5268*)
5269 dflt="$prefix"
5270 ;;
5271esac
5272$cat <<EOM
5273
5274By default, $package will be installed in $dflt/bin, manual pages
5275under $dflt/man, etc..., i.e. with $dflt as prefix for all
5276installation directories. Typically this is something like /usr/local.
5277If you wish to have binaries under /usr/bin but other parts of the
5278installation under /usr/local, that's ok: you will be prompted
5279separately for each of the installation directories, the prefix being
5280only used to set the defaults.
5281
5282EOM
5283fn=d~
5284rp='Installation prefix to use?'
5285. ./getfile
5286oldprefix=''
5287case "$prefix" in
5288'') ;;
5289*)
5290 case "$ans" in
5291 "$prefix") ;;
5292 *) oldprefix="$prefix";;
5293 esac
5294 ;;
5295esac
5296prefix="$ans"
5297prefixexp="$ansexp"
5298
5299: is AFS running?
5300echo " "
5301case "$afs" in
5302$define|true) afs=true ;;
5303$undef|false) afs=false ;;
5304*) if test -d /afs; then
5305 afs=true
5306 else
5307 afs=false
5308 fi
5309 ;;
5310esac
5311if $afs; then
5312 echo "AFS may be running... I'll be extra cautious then..." >&4
5313else
5314 echo "AFS does not seem to be running..." >&4
5315fi
5316
5317: determine installation prefix for where package is to be installed.
5318if $afs; then
5319$cat <<EOM
5320
5321Since you are running AFS, I need to distinguish the directory in which
5322files will reside from the directory in which they are installed (and from
5323which they are presumably copied to the former directory by occult means).
5324
5325EOM
5326 case "$installprefix" in
5327 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5328 *) dflt="$installprefix";;
5329 esac
5330else
5331$cat <<EOM
5332
5333In some special cases, particularly when building $package for distribution,
5334it is convenient to distinguish between the directory in which files should
5335be installed from the directory ($prefix) in which they
5336will eventually reside. For most users, these two directories are the same.
5337
5338EOM
5339 case "$installprefix" in
5340 '') dflt=$prefix ;;
5341 *) dflt=$installprefix;;
5342 esac
5343fi
5344fn=d~
5345rp='What installation prefix should I use for installing files?'
5346. ./getfile
5347installprefix="$ans"
5348installprefixexp="$ansexp"
5349
5350: set the prefixit variable, to compute a suitable default value
5351prefixit='case "$3" in
5352""|none)
5353 case "$oldprefix" in
5354 "") eval "$1=\"\$$2\"";;
5355 *)
5356 case "$3" in
5357 "") eval "$1=";;
5358 none)
5359 eval "tp=\"\$$2\"";
5360 case "$tp" in
5361 ""|" ") eval "$1=\"\$$2\"";;
5362 *) eval "$1=";;
5363 esac;;
5364 esac;;
5365 esac;;
5366*)
5367 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5368 case "$tp" in
5369 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5370 /*-$oldprefix/*|\~*-$oldprefix/*)
5371 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5372 *) eval "$1=\"\$$2\"";;
5373 esac;;
5374esac'
5375
5376
5377: get the patchlevel
5378echo " "
5379echo "Getting the current patchlevel..." >&4
5380if $test -r $rsrc/patchlevel.h;then
5381 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5382 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5383 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5384 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5385 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5386 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5387else
5388 revision=0
5389 patchlevel=0
5390 subversion=0
5391 api_revision=0
5392 api_version=0
5393 api_subversion=0
5394fi
5395$echo "(You have $package version $patchlevel subversion $subversion.)"
5396case "$osname" in
5397dos|vms)
5398 : XXX Should be a Configure test for double-dots in filenames.
5399 version=`echo $revision $patchlevel $subversion | \
5400 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5401 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5402 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5403 ;;
5404*)
5405 version=`echo $revision $patchlevel $subversion | \
5406 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5407 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5408 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5409 ;;
5410esac
5411: Special case the 5.005_xx maintenance series, which used 5.005
5412: without any subversion label as a subdirectory in $sitelib
5413if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5414 api_versionstring='5.005'
5415fi
5416
5417: determine installation style
5418: For now, try to deduce it from prefix unless it is already set.
5419: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5420case "$installstyle" in
5421'') case "$prefix" in
5422 *perl*) dflt='lib';;
5423 *) dflt='lib/perl5' ;;
5424 esac
5425 ;;
5426*) dflt="$installstyle" ;;
5427esac
5428: Probably not worth prompting for this since we prompt for all
5429: the directories individually, and the prompt would be too long and
5430: confusing anyway.
5431installstyle=$dflt
5432
5433: determine where private library files go
5434: Usual default is /usr/local/lib/perl5/$version.
5435: Also allow things like /opt/perl/lib/$version, since
5436: /opt/perl/lib/perl5... would be redundant.
5437: The default "style" setting is made in installstyle.U
5438case "$installstyle" in
5439*lib/perl5*) set dflt privlib lib/$package/$version ;;
5440*) set dflt privlib lib/$version ;;
5441esac
5442eval $prefixit
5443$cat <<EOM
5444
5445There are some auxiliary files for $package that need to be put into a
5446private library directory that is accessible by everyone.
5447
5448EOM
5449fn=d~+
5450rp='Pathname where the private library files will reside?'
5451. ./getfile
5452privlib="$ans"
5453privlibexp="$ansexp"
5454: Change installation prefix, if necessary.
5455if $test X"$prefix" != X"$installprefix"; then
5456 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5457else
5458 installprivlib="$privlibexp"
5459fi
5460
5461: set the prefixup variable, to restore leading tilda escape
5462prefixup='case "$prefixexp" in
5463"$prefix") ;;
5464*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5465esac'
5466
5467: determine where public architecture dependent libraries go
5468set archlib archlib
5469eval $prefixit
5470: privlib default is /usr/local/lib/$package/$version
5471: archlib default is /usr/local/lib/$package/$version/$archname
5472: privlib may have an optional trailing /share.
5473tdflt=`echo $privlib | $sed 's,/share$,,'`
5474tdflt=$tdflt/$archname
5475case "$archlib" in
5476'') dflt=$tdflt
5477 ;;
5478*) dflt="$archlib"
5479 ;;
5480esac
5481$cat <<EOM
5482
5483$spackage contains architecture-dependent library files. If you are
5484sharing libraries in a heterogeneous environment, you might store
5485these files in a separate location. Otherwise, you can just include
5486them with the rest of the public library files.
5487
5488EOM
5489fn=d+~
5490rp='Where do you want to put the public architecture-dependent libraries?'
5491. ./getfile
5492archlib="$ans"
5493archlibexp="$ansexp"
5494if $test X"$archlib" = X"$privlib"; then
5495 d_archlib="$undef"
5496else
5497 d_archlib="$define"
5498fi
5499: Change installation prefix, if necessary.
5500if $test X"$prefix" != X"$installprefix"; then
5501 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5502else
5503 installarchlib="$archlibexp"
5504fi
5505
5506
5507: Binary compatibility with 5.005 is not possible for builds
5508: with advanced features
5509case "$usethreads$usemultiplicity" in
5510*define*)
5511 bincompat5005="$undef"
5512 d_bincompat5005="$undef"
5513 ;;
5514*) $cat <<EOM
5515
5516This version of Perl can be compiled for binary compatibility with 5.005.
5517If you decide to do so, you will be able to continue using most of the
5518extensions that were compiled for Perl 5.005.
5519
5520EOM
5521 case "$bincompat5005$d_bincompat5005" in
5522 *"$undef"*) dflt=n ;;
5523 *) dflt=y ;;
5524 esac
5525 rp='Binary compatibility with Perl 5.005?'
5526 . ./myread
5527 case "$ans" in
5528 y*) val="$define" ;;
5529 *) val="$undef" ;;
5530 esac
5531 set d_bincompat5005
5532 eval $setvar
5533 case "$d_bincompat5005" in
5534 "$define")
5535 bincompat5005="$define"
5536 ;;
5537 *) bincompat5005="$undef"
5538 d_bincompat5005="$undef"
5539 ;;
5540 esac
5541 ;;
5542esac
5543
5544
5545: see if setuid scripts can be secure
5546$cat <<EOM
5547
5548Some kernels have a bug that prevents setuid #! scripts from being
5549secure. Some sites have disabled setuid #! scripts because of this.
5550
5551First let's decide if your kernel supports secure setuid #! scripts.
5552(If setuid #! scripts would be secure but have been disabled anyway,
5553don't say that they are secure if asked.)
5554
5555EOM
5556
5557val="$undef"
5558if $test -d /dev/fd; then
5559 echo "#!$ls" >reflect
5560 chmod +x,u+s reflect
5561 ./reflect >flect 2>&1
5562 if $contains "/dev/fd" flect >/dev/null; then
5563 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5564 val="$define"
5565 else
5566 $cat <<EOM
5567If you are not sure if they are secure, I can check but I'll need a
5568username and password different from the one you are using right now.
5569If you don't have such a username or don't want me to test, simply
5570enter 'none'.
5571
5572EOM
5573 rp='Other username to test security of setuid scripts with?'
5574 dflt='none'
5575 . ./myread
5576 case "$ans" in
5577 n|none)
5578 case "$d_suidsafe" in
5579 '') echo "I'll assume setuid scripts are *not* secure." >&4
5580 dflt=n;;
5581 "$undef")
5582 echo "Well, the $hint value is *not* secure." >&4
5583 dflt=n;;
5584 *) echo "Well, the $hint value *is* secure." >&4
5585 dflt=y;;
5586 esac
c1a7f87b 5587 ;;
b4eb6b3d
JH
5588 *)
5589 $rm -f reflect flect
5590 echo "#!$ls" >reflect
5591 chmod +x,u+s reflect
5592 echo >flect
5593 chmod a+w flect
5594 echo '"su" will (probably) prompt you for '"$ans's password."
5595 su $ans -c './reflect >flect'
5596 if $contains "/dev/fd" flect >/dev/null; then
5597 echo "Okay, it looks like setuid scripts are secure." >&4
5598 dflt=y
5599 else
5600 echo "I don't think setuid scripts are secure." >&4
5601 dflt=n
5602 fi
5603 ;;
5604 esac
5605 rp='Does your kernel have *secure* setuid scripts?'
5606 . ./myread
5607 case "$ans" in
5608 [yY]*) val="$define";;
5609 *) val="$undef";;
5610 esac
5611 fi
5612else
5613 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5614 echo "(That's for file descriptors, not floppy disks.)"
5615 val="$undef"
5616fi
5617set d_suidsafe
5618eval $setvar
5619
5620$rm -f reflect flect
5621
5622: now see if they want to do setuid emulation
5623echo " "
5624val="$undef"
5625case "$d_suidsafe" in
5626"$define")
5627 val="$undef"
5628 echo "No need to emulate SUID scripts since they are secure here." >& 4
5629 ;;
5630*)
5631 $cat <<EOM
5632Some systems have disabled setuid scripts, especially systems where
5633setuid scripts cannot be secure. On systems where setuid scripts have
5634been disabled, the setuid/setgid bits on scripts are currently
5635useless. It is possible for $package to detect those bits and emulate
5636setuid/setgid in a secure fashion. This emulation will only work if
5637setuid scripts have been disabled in your kernel.
5638
5639EOM
5640 case "$d_dosuid" in
5641 "$define") dflt=y ;;
5642 *) dflt=n ;;
5643 esac
5644 rp="Do you want to do setuid/setgid emulation?"
5645 . ./myread
5646 case "$ans" in
5647 [yY]*) val="$define";;
5648 *) val="$undef";;
5649 esac
5650 ;;
5651esac
5652set d_dosuid
5653eval $setvar
5654
5655: determine filename position in cpp output
5656echo " "
5657echo "Computing filename position in cpp output for #include directives..." >&4
5658echo '#include <stdio.h>' > foo.c
5659$cat >fieldn <<EOF
5660$startsh
5661$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5662$grep '^[ ]*#.*stdio\.h' | \
5663while read cline; do
5664 pos=1
5665 set \$cline
5666 while $test \$# -gt 0; do
5667 if $test -r \`echo \$1 | $tr -d '"'\`; then
5668 echo "\$pos"
5669 exit 0
5670 fi
5671 shift
5672 pos=\`expr \$pos + 1\`
5673 done
5674done
5675EOF
5676chmod +x fieldn
5677fieldn=`./fieldn`
5678$rm -f foo.c fieldn
5679case $fieldn in
5680'') pos='???';;
56811) pos=first;;
56822) pos=second;;
56833) pos=third;;
5684*) pos="${fieldn}th";;
5685esac
5686echo "Your cpp writes the filename in the $pos field of the line."
5687
5688: locate header file
5689$cat >findhdr <<EOF
5690$startsh
5691wanted=\$1
5692name=''
5693for usrincdir in $usrinc
5694do
5695 if test -f \$usrincdir/\$wanted; then
5696 echo "\$usrincdir/\$wanted"
5697 exit 0
5698 fi
5699done
5700awkprg='{ print \$$fieldn }'
5701echo "#include <\$wanted>" > foo\$\$.c
5702$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5703$grep "^[ ]*#.*\$wanted" | \
5704while read cline; do
5705 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5706 case "\$name" in
5707 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5708 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5709 *) exit 2;;
5710 esac;
5711done;
5712#
5713# status = 0: grep returned 0 lines, case statement not executed
5714# status = 1: headerfile found
5715# status = 2: while loop executed, no headerfile found
5716#
5717status=\$?
5718$rm -f foo\$\$.c;
5719if test \$status -eq 1; then
5720 exit 0;
5721fi
5722exit 1
5723EOF
5724chmod +x findhdr
5725
5726: define an alternate in-header-list? function
5727inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5728cont=true; xxf="echo \"<\$1> found.\" >&4";
5729case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5730*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5731esac;
5732case $# in 4) instead=instead;; *) instead="at last";; esac;
5733while $test "$cont"; do
5734 xxx=`./findhdr $1`
5735 var=$2; eval "was=\$$2";
5736 if $test "$xxx" && $test -r "$xxx";
5737 then eval $xxf;
5738 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5739 cont="";
5740 else eval $xxnf;
5741 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5742 set $yyy; shift; shift; yyy=$@;
5743 case $# in 0) cont="";;
5744 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5745 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5746 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5747 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5748 esac;
5749done;
5750while $test "$yyy";
5751do set $yyy; var=$2; eval "was=\$$2";
5752 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5753 set $yyy; shift; shift; yyy=$@;
5754done'
5755
5756: see if this is a malloc.h system
5757set malloc.h i_malloc
5758eval $inhdr
5759
5760: see if stdlib is available
5761set stdlib.h i_stdlib
5762eval $inhdr
5763
5764: determine which malloc to compile in
5765echo " "
5766case "$usemymalloc" in
5767''|[yY]*|true|$define) dflt='y' ;;
5768*) dflt='n' ;;
5769esac
5770rp="Do you wish to attempt to use the malloc that comes with $package?"
5771. ./myread
5772usemymalloc="$ans"
5773case "$ans" in
5774y*|true)
5775 usemymalloc='y'
5776 mallocsrc='malloc.c'
5777 mallocobj="malloc$_o"
5778 d_mymalloc="$define"
5779 case "$libs" in
5780 *-lmalloc*)
5781 : Remove malloc from list of libraries to use
5782 echo "Removing unneeded -lmalloc from library list" >&4
5783 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5784 shift
5785 libs="$*"
5786 echo "libs = $libs" >&4
5787 ;;
5788 esac
5789 ;;
5790*)
5791 usemymalloc='n'
5792 mallocsrc=''
5793 mallocobj=''
5794 d_mymalloc="$undef"
5795 ;;
5796esac
5797
5798: compute the return types of malloc and free
5799echo " "
5800$cat >malloc.c <<END
5801#$i_malloc I_MALLOC
5802#$i_stdlib I_STDLIB
5803#include <stdio.h>
5804#include <sys/types.h>
5805#ifdef I_MALLOC
5806#include <malloc.h>
5807#endif
5808#ifdef I_STDLIB
5809#include <stdlib.h>
5810#endif
5811#ifdef TRY_MALLOC
5812void *malloc();
5813#endif
5814#ifdef TRY_FREE
5815void free();
5816#endif
5817END
5818case "$malloctype" in
5819'')
5820 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5821 malloctype='void *'
5822 else
5823 malloctype='char *'
5824 fi
5825 ;;
5826esac
5827echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5828
5829case "$freetype" in
5830'')
5831 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5832 freetype='void'
5833 else
5834 freetype='int'
5835 fi
5836 ;;
5837esac
5838echo "Your system uses $freetype free(), it would seem." >&4
5839$rm -f malloc.[co]
5840$cat <<EOM
5841
5842After $package is installed, you may wish to install various
5843add-on modules and utilities. Typically, these add-ons will
5844be installed under $prefix with the rest
5845of this package. However, you may wish to install such add-ons
5846elsewhere under a different prefix.
5847
5848If you do not wish to put everything under a single prefix, that's
5849ok. You will be prompted for the individual locations; this siteprefix
5850is only used to suggest the defaults.
5851
5852The default should be fine for most people.
5853
5854EOM
5855fn=d~+
5856rp='Installation prefix to use for add-on modules and utilities?'
5857: XXX Here might be another good place for an installstyle setting.
5858case "$siteprefix" in
5859'') dflt=$prefix ;;
5860*) dflt=$siteprefix ;;
5861esac
5862. ./getfile
5863: XXX Prefixit unit does not yet support siteprefix and vendorprefix
5864oldsiteprefix=''
5865case "$siteprefix" in
5866'') ;;
5867*) case "$ans" in
5868 "$prefix") ;;
5869 *) oldsiteprefix="$prefix";;
5870 esac
5871 ;;
5872esac
5873siteprefix="$ans"
5874siteprefixexp="$ansexp"
5875
5876: determine where site specific libraries go.
5877: Usual default is /usr/local/lib/perl5/site_perl/$version
5878: The default "style" setting is made in installstyle.U
5879: XXX No longer works with Prefixit stuff.
5880prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5881case "$sitelib" in
5882'') case "$installstyle" in
5883 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5884 *) dflt=$siteprefix/lib/site_$prog/$version ;;
5885 esac
5886 ;;
5887*) dflt="$sitelib"
5888 ;;
5889esac
5890$cat <<EOM
5891
5892The installation process will create a directory for
5893site-specific extensions and modules. Most users find it convenient
5894to place all site-specific files in this directory rather than in the
5895main distribution directory.
5896
5897EOM
5898fn=d~+
5899rp='Pathname for the site-specific library files?'
5900. ./getfile
5901sitelib="$ans"
5902sitelibexp="$ansexp"
5903sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5904: Change installation prefix, if necessary.
5905if $test X"$prefix" != X"$installprefix"; then
5906 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5907else
5908 installsitelib="$sitelibexp"
5909fi
5910
5911: determine where site specific architecture-dependent libraries go.
5912: sitelib default is /usr/local/lib/perl5/site_perl/$version
5913: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5914: sitelib may have an optional trailing /share.
5915case "$sitearch" in
5916'') dflt=`echo $sitelib | $sed 's,/share$,,'`
5917 dflt="$dflt/$archname"
5918 ;;
5919*) dflt="$sitearch"
5920 ;;
5921esac
5922set sitearch sitearch none
5923eval $prefixit
5924$cat <<EOM
5925
5926The installation process will also create a directory for
5927architecture-dependent site-specific extensions and modules.
5928
5929EOM
5930fn=d~+
5931rp='Pathname for the site-specific architecture-dependent library files?'
5932. ./getfile
5933sitearch="$ans"
5934sitearchexp="$ansexp"
5935: Change installation prefix, if necessary.
5936if $test X"$prefix" != X"$installprefix"; then
5937 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5938else
5939 installsitearch="$sitearchexp"
5940fi
5941
5942$cat <<EOM
5943
5944The installation process will also create a directory for
5945vendor-supplied add-ons. Vendors who supply perl with their system
5946may find it convenient to place all vendor-supplied files in this
5947directory rather than in the main distribution directory. This will
5948ease upgrades between binary-compatible maintenance versions of perl.
5949
5950Of course you may also use these directories in whatever way you see
5951fit. For example, you might use them to access modules shared over a
5952company-wide network.
5953
5954The default answer should be fine for most people.
5955This causes further questions about vendor add-ons to be skipped
5956and no vendor-specific directories will be configured for perl.
5957
5958EOM
5959rp='Do you want to configure vendor-specific add-on directories?'
5960case "$usevendorprefix" in
5961define|true|[yY]*) dflt=y ;;
5962*) : User may have set vendorprefix directly on Configure command line.
5963 case "$vendorprefix" in
5964 ''|' ') dflt=n ;;
5965 *) dflt=y ;;
5966 esac
5967 ;;
5968esac
5969. ./myread
5970case "$ans" in
5971[yY]*) fn=d~+
5972 rp='Installation prefix to use for vendor-supplied add-ons?'
5973 case "$vendorprefix" in
5974 '') dflt='' ;;
5975 *) dflt=$vendorprefix ;;
5976 esac
5977 . ./getfile
5978 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5979 oldvendorprefix=''
5980 case "$vendorprefix" in
5981 '') ;;
5982 *) case "$ans" in
5983 "$prefix") ;;
5984 *) oldvendorprefix="$prefix";;
5985 esac
5986 ;;
5987 esac
5988 usevendorprefix="$define"
5989 vendorprefix="$ans"
5990 vendorprefixexp="$ansexp"
5991 ;;
5992*) usevendorprefix="$undef"
5993 vendorprefix=''
5994 vendorprefixexp=''
5995 ;;
5996esac
5997
5998case "$vendorprefix" in
5999'') d_vendorlib="$undef"
6000 vendorlib=''
6001 vendorlibexp=''
6002 ;;
6003*) d_vendorlib="$define"
6004 : determine where vendor-supplied modules go.
6005 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6006 case "$vendorlib" in
6007 '')
6008 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6009 case "$installstyle" in
6010 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6011 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6012 esac
6013 ;;
6014 *) dflt="$vendorlib"
6015 ;;
6016 esac
6017 fn=d~+
6018 rp='Pathname for the vendor-supplied library files?'
6019 . ./getfile
6020 vendorlib="$ans"
6021 vendorlibexp="$ansexp"
6022 ;;
6023esac
6024vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6025: Change installation prefix, if necessary.
6026if $test X"$prefix" != X"$installprefix"; then
6027 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6028else
6029 installvendorlib="$vendorlibexp"
6030fi
6031
6032case "$vendorprefix" in
6033'') d_vendorarch="$undef"
6034 vendorarch=''
6035 vendorarchexp=''
6036 ;;
6037*) d_vendorarch="$define"
6038 : determine where vendor-supplied architecture-dependent libraries go.
6039 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6040 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6041 : vendorlib may have an optional trailing /share.
6042 case "$vendorarch" in
6043 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6044 dflt="$dflt/$archname"
6045 ;;
6046 *) dflt="$vendorarch" ;;
6047 esac
6048 fn=d~+
6049 rp='Pathname for vendor-supplied architecture-dependent files?'
6050 . ./getfile
6051 vendorarch="$ans"
6052 vendorarchexp="$ansexp"
6053 ;;
6054esac
6055: Change installation prefix, if necessary.
6056if $test X"$prefix" != X"$installprefix"; then
6057 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6058else
6059 installvendorarch="$vendorarchexp"
6060fi
6061
6062: Final catch-all directories to search
6063$cat <<EOM
6064
6065Lastly, you can have perl look in other directories for extensions and
6066modules in addition to those already specified.
6067These directories will be searched after
6068 $sitearch
6069 $sitelib
6070EOM
6071test X"$vendorlib" != "X" && echo ' ' $vendorlib
6072test X"$vendorarch" != "X" && echo ' ' $vendorarch
6073echo ' '
6074case "$otherlibdirs" in
6075''|' ') dflt='none' ;;
6076*) dflt="$otherlibdirs" ;;
6077esac
6078$cat <<EOM
6079Enter a colon-separated set of extra paths to include in perl's @INC
6080search path, or enter 'none' for no extra paths.
6081
6082EOM
6083
6084rp='Colon-separated list of additional directories for perl to search?'
6085. ./myread
6086case "$ans" in
6087' '|''|none) otherlibdirs=' ' ;;
6088*) otherlibdirs="$ans" ;;
6089esac
6090case "$otherlibdirs" in
6091' ') val=$undef ;;
6092*) val=$define ;;
6093esac
6094set d_perl_otherlibdirs
6095eval $setvar
6096
6097: Cruising for prototypes
6098echo " "
6099echo "Checking out function prototypes..." >&4
6100$cat >prototype.c <<'EOCP'
6101int main(int argc, char *argv[]) {
6102 exit(0);}
6103EOCP
6104if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6105 echo "Your C compiler appears to support function prototypes."
6106 val="$define"
6107else
6108 echo "Your C compiler doesn't seem to understand function prototypes."
6109 val="$undef"
6110fi
6111set prototype
6112eval $setvar
6113$rm -f prototype*
6114
6115case "$prototype" in
6116"$define") ;;
6117*) ansi2knr='ansi2knr'
6118 echo " "
6119 cat <<EOM >&4
6120
6121$me: FATAL ERROR:
6122This version of $package can only be compiled by a compiler that
6123understands function prototypes. Unfortunately, your C compiler
6124 $cc $ccflags
6125doesn't seem to understand them. Sorry about that.
6126
6127If GNU cc is available for your system, perhaps you could try that instead.
6128
6129Eventually, we hope to support building Perl with pre-ANSI compilers.
6130If you would like to help in that effort, please contact <perlbug@perl.org>.
6131
6132Aborting Configure now.
6133EOM
6134 exit 2
6135 ;;
6136esac
6137
6138: determine where public executables go
6139echo " "
6140set dflt bin bin
6141eval $prefixit
6142fn=d~
6143rp='Pathname where the public executables will reside?'
6144. ./getfile
6145if $test "X$ansexp" != "X$binexp"; then
6146 installbin=''
6147fi
6148bin="$ans"
6149binexp="$ansexp"
6150: Change installation prefix, if necessary.
6151: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6152if $test X"$prefix" != X"$installprefix"; then
6153 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6154else
6155 installbin="$binexp"
6156fi
6157
6158: Find perl5.005 or later.
6159echo "Looking for a previously installed perl5.005 or later... "
6160case "$perl5" in
6161'') for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6162 : Check if this perl is recent and can load a simple module
6163 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6164 perl5=$tdir/perl
6165 break;
6166 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6167 perl5=$tdir/perl
6168 break;
6169 fi
6170 done
6171 ;;
6172*) perl5="$perl5"
6173 ;;
6174esac
6175case "$perl5" in
6176'') echo "None found. That's ok.";;
6177*) echo "Using $perl5." ;;
6178esac
6179
6180: Determine list of previous versions to include in @INC
6181$cat > getverlist <<EOPL
6182#!$perl5 -w
6183use File::Basename;
6184\$api_versionstring = "$api_versionstring";
6185\$version = "$version";
6186\$stem = "$sitelib_stem";
6187\$archname = "$archname";
6188EOPL
6189 $cat >> getverlist <<'EOPL'
6190# Can't have leading @ because metaconfig interprets it as a command!
6191;@inc_version_list=();
6192# XXX Redo to do opendir/readdir?
6193if (-d $stem) {
6194 chdir($stem);
6195 ;@candidates = glob("5.*");
6196}
6197else {
6198 ;@candidates = ();
6199}
6200
6201# XXX ToDo: These comparisons must be reworked when two-digit
6202# subversions come along, so that 5.7.10 compares as greater than
6203# 5.7.3! By that time, hope that 5.6.x is sufficiently
6204# widespread that we can use the built-in version vectors rather
6205# than reinventing them here. For 5.6.0, however, we must
6206# assume this script will likely be run by 5.005_0x. --AD 1/2000.
6207foreach $d (@candidates) {
6208 if ($d lt $version) {
6209 if ($d ge $api_versionstring) {
6210 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6211 }
6212 elsif ($d ge "5.005") {
6213 unshift(@inc_version_list, grep { -d } $d);
6214 }
6215 }
6216 else {
6217 # Skip newer version. I.e. don't look in
6218 # 5.7.0 if we're installing 5.6.1.
6219 }
6220}
6221
6222if (@inc_version_list) {
6223 print join(' ', @inc_version_list);
6224}
6225else {
6226 # Blank space to preserve value for next Configure run.
6227 print " ";
6228}
6229EOPL
6230chmod +x getverlist
6231case "$inc_version_list" in
6232'') if test -x "$perl5"; then
6233 dflt=`$perl5 getverlist`
6234 else
6235 dflt='none'
6236 fi
6237 ;;
6238$undef) dflt='none' ;;
6239*) dflt="$inc_version_list" ;;
6240esac
6241case "$dflt" in
6242''|' ') dflt=none ;;
6243esac
6244case "$dflt" in
62455.005) case "$bincompat5005" in
6246 $define|true|[yY]*) ;;
6247 *) dflt=none ;;
6248 esac
6249 ;;
6250esac
6251$cat <<'EOM'
6252
6253In order to ease the process of upgrading, this version of perl
6254can be configured to use modules built and installed with earlier
6255versions of perl that were installed under $prefix. Specify here
6256the list of earlier versions that this version of perl should check.
6257If Configure detected no earlier versions of perl installed under
6258$prefix, then the list will be empty. Answer 'none' to tell perl
6259to not search earlier versions.
6260
6261The default should almost always be sensible, so if you're not sure,
6262just accept the default.
6263EOM
6264
6265rp='List of earlier versions to include in @INC?'
6266. ./myread
6267case "$ans" in
6268[Nn]one|''|' ') inc_version_list=' ' ;;
6269*) inc_version_list="$ans" ;;
6270esac
6271case "$inc_version_list" in
6272''|' ')
6273 inc_version_list_init='0';;
6274*) inc_version_list_init=`echo $inc_version_list |
6275 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6276 ;;
6277esac
6278$rm -f getverlist
6279
6280: determine whether to install perl also as /usr/bin/perl
6281
6282echo " "
6283if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6284 $cat <<EOM
6285Many scripts expect perl to be installed as /usr/bin/perl.
6286I can install the perl you are about to compile also as /usr/bin/perl
6287(in addition to $installbin/perl).
6288EOM
6289 case "$installusrbinperl" in
6290 "$undef"|[nN]*) dflt='n';;
6291 *) dflt='y';;
6292 esac
6293 rp="Do you want to install perl as /usr/bin/perl?"
6294 . ./myread
6295 case "$ans" in
6296 [yY]*) val="$define";;
6297 *) val="$undef" ;;
6298 esac
6299else
6300 val="$undef"
6301fi
6302set installusrbinperl
6303eval $setvar
6304
6305: see if dld is available
6306set dld.h i_dld
6307eval $inhdr
6308
6309: see if dlopen exists
6310xxx_runnm="$runnm"
6311runnm=false
6312set dlopen d_dlopen
6313eval $inlibc
6314runnm="$xxx_runnm"
6315
6316: determine which dynamic loading, if any, to compile in
6317echo " "
6318dldir="ext/DynaLoader"
6319case "$usedl" in
6320$define|y|true)
6321 dflt='y'
6322 usedl="$define"
6323 ;;
6324$undef|n|false)
6325 dflt='n'
6326 usedl="$undef"
6327 ;;
6328*)
6329 dflt='n'
6330 case "$d_dlopen" in
6331 $define) dflt='y' ;;
6332 esac
6333 case "$i_dld" in
6334 $define) dflt='y' ;;
6335 esac
6336 : Does a dl_xxx.xs file exist for this operating system
6337 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6338 ;;
6339esac
6340rp="Do you wish to use dynamic loading?"
6341. ./myread
6342usedl="$ans"
6343case "$ans" in
6344y*) usedl="$define"
6345 case "$dlsrc" in
6346 '')
6347 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6348 dflt="$dldir/dl_${osname}.xs"
6349 elif $test "$d_dlopen" = "$define" ; then
6350 dflt="$dldir/dl_dlopen.xs"
6351 elif $test "$i_dld" = "$define" ; then
6352 dflt="$dldir/dl_dld.xs"
6353 else
6354 dflt=''
6355 fi
6356 ;;
6357 *) dflt="$dldir/$dlsrc"
6358 ;;
6359 esac
6360 echo "The following dynamic loading files are available:"
6361 : Can not go over to $dldir because getfile has path hard-coded in.
6362 tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6363 rp="Source file to use for dynamic loading"
6364 fn="fne"
6365 gfpth="$src"
6366 . ./getfile
6367 usedl="$define"
6368 : emulate basename
6369 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6370
6371 $cat << EOM
6372
6373Some systems may require passing special flags to $cc -c to
6374compile modules that will be used to create a shared library.
6375To use no flags, say "none".
6376
6377EOM
6378 case "$cccdlflags" in
6379 '') case "$gccversion" in
6380 '') case "$osname" in
6381 hpux) dflt='+z' ;;
6382 next) dflt='none' ;;
6383 irix*) dflt='-KPIC' ;;
48bcfe03 6384 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
6385 sunos) dflt='-pic' ;;
6386 *) dflt='none' ;;
6387 esac
6388 ;;
6389 *) case "$osname" in
48bcfe03 6390 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
6391 *) dflt='-fpic' ;;
6392 esac ;;
6393 esac ;;
6394 ' ') dflt='none' ;;
6395 *) dflt="$cccdlflags" ;;
6396 esac
6397 rp="Any special flags to pass to $cc -c to compile shared library modules?"
6398 . ./myread
6399 case "$ans" in
6400 none) cccdlflags=' ' ;;
6401 *) cccdlflags="$ans" ;;
6402 esac
6403
6404 cat << EOM
6405
6406Some systems use ld to create libraries that can be dynamically loaded,
6407while other systems (such as those using ELF) use $cc.
6408
6409EOM
6410 case "$ld" in
6411 '') $cat >try.c <<'EOM'
6412/* Test for whether ELF binaries are produced */
6413#include <fcntl.h>
6414#include <stdlib.h>
6415int main() {
6416 char b[4];
6417 int i = open("a.out",O_RDONLY);
6418 if(i == -1)
6419 exit(1); /* fail */
6420 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6421 exit(0); /* succeed (yes, it's ELF) */
6422 else
6423 exit(1); /* fail */
6424}
6425EOM
6426 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6427 cat <<EOM
6428You appear to have ELF support. I'll use $cc to build dynamic libraries.
6429EOM
6430 dflt="$cc"
6431 else
6432 echo "I'll use ld to build dynamic libraries."
6433 dflt='ld'
6434 fi
6435 rm -f try.c a.out
6436 ;;
6437 *) dflt="$ld"
6438 ;;
6439 esac
6440
6441 rp="What command should be used to create dynamic libraries?"
6442 . ./myread
6443 ld="$ans"
6444
6445 cat << EOM
6446
6447Some systems may require passing special flags to $ld to create a
6448library that can be dynamically loaded. If your ld flags include
6449-L/other/path options to locate libraries outside your loader's normal
6450search path, you may need to specify those -L options here as well. To
6451use no flags, say "none".
6452
6453EOM
6454 case "$lddlflags" in
6455 '') case "$osname" in
6456 beos) dflt='-nostart' ;;
6457 hpux) dflt='-b';
6458 case "$gccversion" in
6459 '') dflt="$dflt +vnocompatwarnings" ;;
6460 esac
6461 ;;
6462 linux|irix*) dflt='-shared' ;;
6463 next) dflt='none' ;;
6464 solaris) dflt='-G' ;;
6465 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 6466 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
6467 *) dflt='none' ;;
6468 esac
6469 ;;
6470 *) dflt="$lddlflags" ;;
6471 esac
6472
6473 : Try to guess additional flags to pick up local libraries.
6474 : Be careful not to append to a plain 'none'
6475 case "$dflt" in
6476 none) dflt='' ;;
6477 esac
6478 for thisflag in $ldflags; do
6479 case "$thisflag" in
6480 -L*|-R*)
6481 case " $dflt " in
6482 *" $thisflag "*) ;;
6483 *) dflt="$dflt $thisflag" ;;
6484 esac
6485 ;;
6486 esac
6487 done
6488
6489 case "$dflt" in
6490 ''|' ') dflt='none' ;;
6491 esac
6492
6493 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6494 . ./myread
6495 case "$ans" in
6496 none) lddlflags=' ' ;;
6497 *) lddlflags="$ans" ;;
6498 esac
6499
6500 cat <<EOM
6501
6502Some systems may require passing special flags to $cc to indicate that
6503the resulting executable will use dynamic linking. To use no flags,
6504say "none".
6505
6506EOM
6507 case "$ccdlflags" in
6508 '') case "$osname" in
6509 hpux) dflt='-Wl,-E' ;;
6510 linux) dflt='-rdynamic' ;;
6511 next) dflt='none' ;;
6512 sunos) dflt='none' ;;
6513 *) dflt='none' ;;
6514 esac ;;
6515 ' ') dflt='none' ;;
6516 *) dflt="$ccdlflags" ;;
6517 esac
6518 rp="Any special flags to pass to $cc to use dynamic linking?"
6519 . ./myread
6520 case "$ans" in
6521 none) ccdlflags=' ' ;;
6522 *) ccdlflags="$ans" ;;
6523 esac
6524 ;;
6525*) usedl="$undef"
6526 ld='ld'
6527 dlsrc='dl_none.xs'
6528 lddlflags=''
6529 ccdlflags=''
6530 ;;
6531esac
6532
6533also=''
6534case "$usedl" in
6535$undef)
6536 # No dynamic loading being used, so don't bother even to prompt.
6537 useshrplib='false'
6538 ;;
6539*) case "$useshrplib" in
6540 '') case "$osname" in
48bcfe03 6541 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
6542 dflt=y
6543 also='Building a shared libperl is required for dynamic loading to work on your system.'
6544 ;;
6545 next*)
6546 case "$osvers" in
6547 4*) dflt=y
6548 also='Building a shared libperl is needed for MAB support.'
6549 ;;
6550 *) dflt=n
6551 ;;
6552 esac
6553 ;;
6554 *) dflt=n
6555 ;;
6556 esac
6557 ;;
6558 $define|true|[Yy]*)
6559 dflt=y
6560 ;;
6561 *) dflt=n
6562 ;;
6563 esac
6564 $cat << EOM
6565
6566The perl executable is normally obtained by linking perlmain.c with
6567libperl${_a}, any static extensions (usually just DynaLoader), and
6568any other libraries needed on this system (such as -lm, etc.). Since
6569your system supports dynamic loading, it is probably possible to build
6570a shared libperl.$so. If you will have more than one executable linked
6571to libperl.$so, this will significantly reduce the size of each
6572executable, but it may have a noticeable affect on performance. The
6573default is probably sensible for your system.
6574$also
6575
6576EOM
6577 rp="Build a shared libperl.$so (y/n)"
6578 . ./myread
6579 case "$ans" in
6580 true|$define|[Yy]*)
6581 useshrplib='true' ;;
6582 *) useshrplib='false' ;;
6583 esac
6584 ;;
6585esac
6586
6587case "$useshrplib" in
6588true)
6589 case "$libperl" in
6590 '')
6591 # Figure out a good name for libperl.so. Since it gets stored in
6592 # a version-specific architecture-dependent library, the version
6593 # number isn't really that important, except for making cc/ld happy.
6594 #
6595 # A name such as libperl.so.3.1
6596 majmin="libperl.$so.$patchlevel.$subversion"
6597 # A name such as libperl.so.301
6598 majonly=`echo $patchlevel $subversion |
6599 $awk '{printf "%d%02d", $1, $2}'`
6600 majonly=libperl.$so.$majonly
6601 # I'd prefer to keep the os-specific stuff here to a minimum, and
6602 # rely on figuring it out from the naming of libc.
6603 case "${osname}${osvers}" in
6604 next4*)
6605 dflt=libperl.5.$so
6606 # XXX How handle the --version stuff for MAB?
6607 ;;
6608 linux*) # ld won't link with a bare -lperl otherwise.
6609 dflt=libperl.$so
6610 ;;
6611 cygwin*) # include version
6612 dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6613 ;;
6614 *) # Try to guess based on whether libc has major.minor.
6615 case "$libc" in
6616 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6617 *libc.$so.[0-9]*) dflt=$majonly ;;
6618 *) dflt=libperl.$so ;;
6619 esac
6620 ;;
6621 esac
6622 ;;
6623 *) dflt=$libperl
6624 ;;
6625 esac
6626 cat << EOM
6627
6628I need to select a good name for the shared libperl. If your system uses
6629library names with major and minor numbers, then you might want something
6630like $majmin. Alternatively, if your system uses a single version
6631number for shared libraries, then you might want to use $majonly.
6632Or, your system might be quite happy with a simple libperl.$so.
6633
6634Since the shared libperl will get installed into a version-specific
6635architecture-dependent directory, the version number of the shared perl
6636library probably isn't important, so the default should be o.k.
6637
6638EOM
6639 rp='What name do you want to give to the shared libperl?'
6640 . ./myread
6641 libperl=$ans
6642 echo "Ok, I'll use $libperl"
6643 ;;
6644*)
6645 libperl="libperl${_a}"
6646 ;;
6647esac
6648
6649# Detect old use of shrpdir via undocumented Configure -Dshrpdir
6650case "$shrpdir" in
6651'') ;;
6652*) $cat >&4 <<EOM
6653WARNING: Use of the shrpdir variable for the installation location of
6654the shared $libperl is not supported. It was never documented and
6655will not work in this version. Let me (perlbug@perl.org)
6656know of any problems this may cause.
6657
6658EOM
6659 case "$shrpdir" in
6660 "$archlibexp/CORE")
6661 $cat >&4 <<EOM
6662But your current setting of $shrpdir is
6663the default anyway, so it's harmless.
6664EOM
6665 ;;
6666 *)
6667 $cat >&4 <<EOM
6668Further, your current attempted setting of $shrpdir
6669conflicts with the value of $archlibexp/CORE
6670that installperl will use.
6671EOM
6672 ;;
6673 esac
6674 ;;
6675esac
6676
6677# How will the perl executable find the installed shared $libperl?
6678# Add $xxx to ccdlflags.
6679# If we can't figure out a command-line option, use $shrpenv to
6680# set env LD_RUN_PATH. The main perl makefile uses this.
6681shrpdir=$archlibexp/CORE
6682xxx=''
6683tmp_shrpenv=''
6684if "$useshrplib"; then
6685 case "$osname" in
6686 aix)
6687 # We'll set it in Makefile.SH...
6688 ;;
6689 solaris|netbsd)
6690 xxx="-R $shrpdir"
6691 ;;
6692 freebsd)
6693 xxx="-Wl,-R$shrpdir"
6694 ;;
6695 linux|irix*|dec_osf)
6696 xxx="-Wl,-rpath,$shrpdir"
6697 ;;
6698 next)
6699 # next doesn't like the default...
6700 ;;
6701 beos)
6702 # beos doesn't like the default, either.
6703 ;;
6704 hpux*)
6705 # hpux doesn't like the default, either.
6706 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6707 ;;
6708 *)
6709 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6710 ;;
6711 esac
6712 case "$xxx" in
6713 '') ;;
6714 *)
6715 # Only add $xxx if it isn't already in ccdlflags.
6716 case " $ccdlflags " in
6717 *" $xxx "*) ;;
6718 *) ccdlflags="$ccdlflags $xxx"
6719 cat <<EOM >&4
6720
6721Adding $xxx to the flags
6722passed to $ld so that the perl executable will find the
6723installed shared $libperl.
6724
6725EOM
6726 ;;
6727 esac
6728 ;;
6729 esac
6730fi
6731# Fix ccdlflags in AIX for building external extensions.
6732# (For building Perl itself bare -bE:perl.exp is needed,
6733# Makefile.SH takes care of this.)
6734case "$osname" in
6735aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6736esac
6737# Respect a hint or command-line value.
6738case "$shrpenv" in
6739'') shrpenv="$tmp_shrpenv" ;;
6740esac
6741case "$ldlibpthname" in
6742'') ldlibpthname=LD_LIBRARY_PATH ;;
6743none) ldlibpthname='' ;;
6744esac
6745
6746: determine where manual pages are on this system
6747echo " "
6748case "$sysman" in
6749'')
6750 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
6751 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
6752 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
6753 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6754 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
6755 sysman=`./loc . /usr/man/man1 $syspath`
6756 ;;
6757esac
6758if $test -d "$sysman"; then
6759 echo "System manual is in $sysman." >&4
6760else
6761 echo "Could not find manual pages in source form." >&4
6762fi
6763
6764: determine where manual pages go
6765set man1dir man1dir none
6766eval $prefixit
6767$cat <<EOM
6768
6769$spackage has manual pages available in source form.
6770EOM
6771case "$nroff" in
6772nroff)
6773 echo "However, you don't have nroff, so they're probably useless to you."
6774 case "$man1dir" in
6775 '') man1dir="none";;
6776 esac;;
6777esac
6778echo "If you don't want the manual sources installed, answer 'none'."
6779case "$man1dir" in
6780' ') dflt=none
6781 ;;
6782'')
6783 lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6784 lookpath="$lookpath $prefixexp/man/p_man/man1"
6785 lookpath="$lookpath $prefixexp/man/u_man/man1"
6786 lookpath="$lookpath $prefixexp/man/man.1"
6787 case "$sysman" in
6788 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6789 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6790 esac
6791 set dflt
6792 eval $prefixup
6793 ;;
6794*) dflt="$man1dir"
6795 ;;
6796esac
6797echo " "
6798fn=dn+~
6799rp="Where do the main $spackage manual pages (source) go?"
6800. ./getfile
6801if $test "X$man1direxp" != "X$ansexp"; then
6802 installman1dir=''
6803fi
6804man1dir="$ans"
6805man1direxp="$ansexp"
6806case "$man1dir" in
6807'') man1dir=' '
6808 installman1dir='';;
6809esac
6810
6811: Change installation prefix, if necessary.
6812if $test X"$prefix" != X"$installprefix"; then
6813 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6814else
6815 installman1dir="$man1direxp"
6816fi
6817
6818: What suffix to use on installed man pages
6819
6820case "$man1dir" in
6821' ')
6822 man1ext='0'
6823 ;;
6824*)
6825 rp="What suffix should be used for the main $spackage man pages?"
6826 case "$man1ext" in
6827 '') case "$man1dir" in
6828 *1) dflt=1 ;;
6829 *1p) dflt=1p ;;
6830 *1pm) dflt=1pm ;;
6831 *l) dflt=l;;
6832 *n) dflt=n;;
6833 *o) dflt=o;;
6834 *p) dflt=p;;
6835 *C) dflt=C;;
6836 *L) dflt=L;;
6837 *L1) dflt=L1;;
6838 *) dflt=1;;
6839 esac
6840 ;;
6841 *) dflt="$man1ext";;
6842 esac
6843 . ./myread
6844 man1ext="$ans"
6845 ;;
6846esac
6847
6848: see if we can have long filenames
6849echo " "
6850first=123456789abcdef
6851$rm -f $first
6852if (echo hi >$first) 2>/dev/null; then
6853 if $test -f 123456789abcde; then
6854 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
6855 val="$undef"
6856 else
6857 echo 'You can have filenames longer than 14 characters.'>&4
6858 val="$define"
6859 fi
6860else
6861 $cat <<'EOM'
6862You can't have filenames longer than 14 chars.
6863You can't even think about them!
6864EOM
6865 val="$undef"
6866fi
6867set d_flexfnam
6868eval $setvar
6869$rm -rf 123456789abcde*
6870
6871: determine where library module manual pages go
6872set man3dir man3dir none
6873eval $prefixit
6874$cat <<EOM
6875
6876$spackage has manual pages for many of the library modules.
6877EOM
6878
6879case "$nroff" in
6880nroff)
6881 $cat <<'EOM'
6882However, you don't have nroff, so they're probably useless to you.
6883EOM
6884 case "$man3dir" in
6885 '') man3dir="none";;
6886 esac;;
6887esac
6888
6889case "$d_flexfnam" in
6890undef)
6891 $cat <<'EOM'
6892However, your system can't handle the long file names like File::Basename.3.
6893EOM
6894 case "$man3dir" in
6895 '') man3dir="none";;
6896 esac;;
6897esac
6898
6899echo "If you don't want the manual sources installed, answer 'none'."
6900prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6901case "$man3dir" in
6902'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6903 if $test -d "$privlib/man/man3"; then
6904 cat <<EOM >&4
6905
6906WARNING: Previous versions of perl installed man3 pages into
6907$privlib/man/man3. This version will suggest a
6908new default of $dflt.
6909EOM
6910 tdflt=$dflt
6911 dflt='n'
6912 rp='Do you wish to preserve the old behavior?(y/n)'
6913 . ./myread
6914 case "$ans" in
6915 y*) dflt="$privlib/man/man3" ;;
6916 *) dflt=$tdflt ;;
6917 esac
6918 fi
6919 ;;
6920*) dflt="$man3dir" ;;
6921esac
6922case "$dflt" in
6923' ') dflt=none ;;
6924esac
6925echo " "
6926fn=dn+~
6927rp="Where do the $package library man pages (source) go?"
6928. ./getfile
6929man3dir="$ans"
6930man3direxp="$ansexp"
6931case "$man3dir" in
6932'') man3dir=' '
6933 installman3dir='';;
6934esac
6935
6936: Change installation prefix, if necessary.
6937if $test X"$prefix" != X"$installprefix"; then
6938 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6939else
6940 installman3dir="$man3direxp"
6941fi
6942
6943: What suffix to use on installed man pages
6944case "$man3dir" in
6945' ')
6946 man3ext='0'
6947 ;;
6948*)
6949 rp="What suffix should be used for the $package library man pages?"
6950 case "$man3ext" in
6951 '') case "$man3dir" in
6952 *3) dflt=3 ;;
6953 *3p) dflt=3p ;;
6954 *3pm) dflt=3pm ;;
6955 *l) dflt=l;;
6956 *n) dflt=n;;
6957 *o) dflt=o;;
6958 *p) dflt=p;;
6959 *C) dflt=C;;
6960 *L) dflt=L;;
6961 *L3) dflt=L3;;
6962 *) dflt=3;;
6963 esac
6964 ;;
6965 *) dflt="$man3ext";;
6966 esac
6967 . ./myread
6968 man3ext="$ans"
6969 ;;
6970esac
6971
6972: see if we have to deal with yellow pages, now NIS.
6973if $test -d /usr/etc/yp || $test -d /etc/yp; then
6974 if $test -f /usr/etc/nibindd; then
6975 echo " "
6976 echo "I'm fairly confident you're on a NeXT."
6977 echo " "
6978 rp='Do you get the hosts file via NetInfo?'
6979 dflt=y
6980 case "$hostcat" in
6981 nidump*) ;;
6982 '') ;;
6983 *) dflt=n;;
6984 esac
6985 . ./myread
6986 case "$ans" in
6987 y*) hostcat='nidump hosts .';;
6988 *) case "$hostcat" in
6989 nidump*) hostcat='';;
6990 esac
6991 ;;
6992 esac
6993 fi
6994 case "$hostcat" in
6995 nidump*) ;;
6996 *)
6997 case "$hostcat" in
6998 *ypcat*) dflt=y;;
6999 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7000 dflt=y
7001 else
7002 dflt=n
7003 fi;;
7004 *) dflt=n;;
7005 esac
7006 echo " "
7007 rp='Are you getting the hosts file via yellow pages?'
7008 . ./myread
7009 case "$ans" in
7010 y*) hostcat='ypcat hosts';;
7011 *) hostcat='cat /etc/hosts';;
7012 esac
7013 ;;
7014 esac
7015fi
7016case "$hostcat" in
7017'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7018esac
7019case "$groupcat" in
7020'') test -f /etc/group && groupcat='cat /etc/group';;
7021esac
7022case "$passcat" in
7023'') test -f /etc/passwd && passcat='cat /etc/passwd';;
7024esac
7025
7026: now get the host name
7027echo " "
7028echo "Figuring out host name..." >&4
7029case "$myhostname" in
7030'') cont=true
7031 echo 'Maybe "hostname" will work...'
7032 if tans=`sh -c hostname 2>&1` ; then
7033 myhostname=$tans
7034 phostname=hostname
7035 cont=''
7036 fi
7037 ;;
7038*) cont='';;
7039esac
7040if $test "$cont"; then
7041 if ./xenix; then
7042 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
7043 if tans=`cat /etc/systemid 2>&1` ; then
7044 myhostname=$tans
7045 phostname='cat /etc/systemid'
7046 echo "Whadyaknow. Xenix always was a bit strange..."
7047 cont=''
7048 fi
7049 elif $test -r /etc/systemid; then
7050 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7051 fi
7052fi
7053if $test "$cont"; then
7054 echo 'No, maybe "uuname -l" will work...'
7055 if tans=`sh -c 'uuname -l' 2>&1` ; then
7056 myhostname=$tans
7057 phostname='uuname -l'
7058 else
7059 echo 'Strange. Maybe "uname -n" will work...'
7060 if tans=`sh -c 'uname -n' 2>&1` ; then
7061 myhostname=$tans
7062 phostname='uname -n'
7063 else
7064 echo 'Oh well, maybe I can mine it out of whoami.h...'
7065 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7066 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7067 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7068 else
7069 case "$myhostname" in
7070 '') echo "Does this machine have an identity crisis or something?"
7071 phostname='';;
7072 *)
7073 echo "Well, you said $myhostname before..."
7074 phostname='echo $myhostname';;
7075 esac
7076 fi
7077 fi
7078 fi
7079fi
7080: you do not want to know about this
7081set $myhostname
7082myhostname=$1
7083
7084: verify guess
7085if $test "$myhostname" ; then
7086 dflt=y
7087 rp='Your host name appears to be "'$myhostname'".'" Right?"
7088 . ./myread
7089 case "$ans" in
7090 y*) ;;
7091 *) myhostname='';;
7092 esac
7093fi
7094
7095: bad guess or no guess
7096while $test "X$myhostname" = X ; do
7097 dflt=''
7098 rp="Please type the (one word) name of your host:"
7099 . ./myread
7100 myhostname="$ans"
7101done
7102
7103: translate upper to lower if necessary
7104case "$myhostname" in
7105*[A-Z]*)
7106 echo "(Normalizing case in your host name)"
7107 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7108 ;;
7109esac
7110
7111case "$myhostname" in
7112*.*)
7113 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7114 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7115 echo "(Trimming domain name from host name--host name is now $myhostname)"
7116 ;;
7117*) case "$mydomain" in
7118 '')
7119 {
7120 test "X$hostcat" = "Xypcat hosts" &&
7121 ypmatch "$myhostname" hosts 2>/dev/null |\
7122 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
7123 $test -s hosts
7124 } || {
7125 test "X$hostcat" != "X" &&
7126 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
7127 /[ ]$myhostname[ . ]/p" > hosts
7128 }
7129 tmp_re="[ . ]"
f08cbdd1
PP
7130 if $test -f hosts; then
7131 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 7132 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
7133 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7134 hosts | $sort | $uniq | \
7135 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7136 case `$echo X$dflt` in
7137 X*\ *) echo "(Several hosts in the database matched hostname)"
7138 dflt=.
7139 ;;
7140 X.) echo "(You do not have fully-qualified names in the hosts database)"
7141 ;;
7142 esac
7143 else
7144 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 7145 dflt=.
f08cbdd1 7146 fi
b4eb6b3d
JH
7147 case "$dflt" in
7148 .)
7149 tans=`./loc resolv.conf X /etc /usr/etc`
7150 if $test -f "$tans"; then
7151 echo "(Attempting domain name extraction from $tans)"
7152 dflt=.`$sed -n -e 's/ / /g' \
7153 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
7154 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7155 case "$dflt" in
7156 .) dflt=.`$sed -n -e 's/ / /g' \
7157 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
7158 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7159 ;;
7160 esac
7161 fi
7162 ;;
7163 esac
7164 case "$dflt" in
7165 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7166 dflt=.`sh -c domainname 2>/dev/null`
7167 case "$dflt" in
7168 '') dflt='.';;
7169 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7170 esac
7171 ;;
7172 esac
7173 case "$dflt" in
7174 .) echo "(Lost all hope -- silly guess then)"
7175 dflt='.uucp'
7176 ;;
7177 esac
7178 $rm -f hosts
7179 ;;
7180 *) dflt="$mydomain";;
7181 esac;;
7182esac
7183echo " "
7184rp="What is your domain name?"
7185. ./myread
7186tans="$ans"
7187case "$ans" in
7188'') ;;
7189.*) ;;
7190*) tans=".$tans";;
7191esac
7192mydomain="$tans"
7193
7194: translate upper to lower if necessary
7195case "$mydomain" in
7196*[A-Z]*)
7197 echo "(Normalizing case in your domain name)"
7198 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7199 ;;
7200esac
7201
7202: a little sanity check here
7203case "$phostname" in
7204'') ;;
7205*)
7206 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7207 $myhostname$mydomain|$myhostname) ;;
7208 *)
7209 case "$phostname" in
7210 sed*)
7211 echo "(That doesn't agree with your whoami.h file, by the way.)"
7212 ;;
7213 *)
7214 echo "(That doesn't agree with your $phostname command, by the way.)"
7215 ;;
7216 esac
7217 ;;
7218 esac
7219 ;;
7220esac
7221
7222$cat <<EOM
7223
7224I need to get your e-mail address in Internet format if possible, i.e.
7225something like user@host.domain. Please answer accurately since I have
7226no easy means to double check it. The default value provided below
7227is most probably close to reality but may not be valid from outside
7228your organization...
7229
7230EOM
7231cont=x
7232while test "$cont"; do
7233 case "$cf_email" in
7234 '') dflt="$cf_by@$myhostname$mydomain";;
7235 *) dflt="$cf_email";;
7236 esac
7237 rp='What is your e-mail address?'
7238 . ./myread
7239 cf_email="$ans"
7240 case "$cf_email" in
7241 *@*.*) cont='' ;;
7242 *)
7243 rp='Address does not look like an Internet one. Use it anyway?'
7244 case "$fastread" in
7245 yes) dflt=y ;;
7246 *) dflt=n ;;
7247 esac
7248 . ./myread
7249 case "$ans" in
7250 y*) cont='' ;;
7251 *) echo " " ;;
7252 esac
7253 ;;
7254 esac
7255done
7256
7257$cat <<EOM
7258
7259If you or somebody else will be maintaining perl at your site, please
7260fill in the correct e-mail address here so that they may be contacted
7261if necessary. Currently, the "perlbug" program included with perl
7262will send mail to this address in addition to perlbug@perl.org. You may
7263enter "none" for no administrator.
7264
7265EOM
7266case "$perladmin" in
7267'') dflt="$cf_email";;
7268*) dflt="$perladmin";;
7269esac
7270rp='Perl administrator e-mail address'
7271. ./myread
7272perladmin="$ans"
7273
674912d7
RB
7274: determine whether to only install version-specific parts.
7275echo " "
7276$cat <<EOM
7277Do you want to install only the version-specific parts of the perl
7278distribution? Usually you do *not* want to do this.
7279EOM
7280case "$versiononly" in
7281"$define"|[Yy]*|true) dflt='y' ;;
7282*) dflt='n';
7283esac
7284rp="Do you want to install only the version-specific parts of perl?"
7285. ./myread
7286case "$ans" in
7287[yY]*) val="$define";;
7288*) val="$undef" ;;
7289esac
7290set versiononly
7291eval $setvar
7292
b4eb6b3d
JH
7293: figure out how to guarantee perl startup
7294case "$startperl" in
7295'')
7296 case "$sharpbang" in
7297 *!)
7298 $cat <<EOH
7299
7300I can use the #! construct to start perl on your system. This will
7301make startup of perl scripts faster, but may cause problems if you
7302want to share those scripts and perl is not in a standard place
7303($binexp/perl) on all your platforms. The alternative is to force
7304a shell by starting the script with a single ':' character.
7305
7306EOH
674912d7
RB
7307 case "$versiononly" in
7308 "$define") dflt="$binexp/perl$version";;
7309 *) dflt="$binexp/perl";;
7310 esac
b4eb6b3d
JH
7311 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7312 . ./myread
7313 case "$ans" in
7314 none) startperl=": # use perl";;
7315 *) startperl="#!$ans"
7316 if $test 30 -lt `echo "$ans" | wc -c`; then
7317 $cat >&4 <<EOM
7318
7319WARNING: Some systems limit the #! command to 32 characters.
7320If you experience difficulty running Perl scripts with #!, try
7321installing Perl in a directory with a shorter pathname.
7322
7323EOM
7324 fi ;;
7325 esac
7326 ;;
7327 *) startperl=": # use perl"
7328 ;;
7329 esac
7330 ;;
7331esac
7332echo "I'll use $startperl to start perl scripts."
7333
7334: figure best path for perl in scripts
7335case "$perlpath" in
7336'')
7337 perlpath="$binexp/perl"
7338 case "$startperl" in
7339 *!*) ;;
7340 *)
7341 $cat <<EOH
7342
7343I will use the "eval 'exec'" idiom to start Perl on your system.
7344I can use the full path of your Perl binary for this purpose, but
7345doing so may cause problems if you want to share those scripts and
7346Perl is not always in a standard place ($binexp/perl).
7347
7348EOH
7349 dflt="$binexp/perl"
7350 rp="What path shall I use in \"eval 'exec'\"?"
7351 . ./myread
7352 perlpath="$ans"
7353 ;;
7354 esac
7355 ;;
7356esac
7357case "$startperl" in
7358*!*) ;;
7359*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7360esac
7361
7362: determine where public executable scripts go
7363set scriptdir scriptdir
7364eval $prefixit
7365case "$scriptdir" in
7366'')
7367 dflt="$bin"
7368 : guess some guesses
7369 $test -d /usr/share/scripts && dflt=/usr/share/scripts
7370 $test -d /usr/share/bin && dflt=/usr/share/bin
7371 $test -d /usr/local/script && dflt=/usr/local/script
7372 $test -d /usr/local/scripts && dflt=/usr/local/scripts
7373 $test -d $prefixexp/script && dflt=$prefixexp/script
7374 set dflt
7375 eval $prefixup
7376 ;;
7377*) dflt="$scriptdir"
7378 ;;
7379esac
7380$cat <<EOM
7381
7382Some installations have a separate directory just for executable scripts so
7383that they can mount it across multiple architectures but keep the scripts in
7384one spot. You might, for example, have a subdirectory of /usr/share for this.
7385Or you might just lump your scripts in with all your other executables.
7386
7387EOM
7388fn=d~
7389rp='Where do you keep publicly executable scripts?'
7390. ./getfile
7391if $test "X$ansexp" != "X$scriptdirexp"; then
7392 installscript=''
7393fi
7394scriptdir="$ans"
7395scriptdirexp="$ansexp"
7396: Change installation prefix, if necessary.
7397if $test X"$prefix" != X"$installprefix"; then
7398 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7399else
7400 installscript="$scriptdirexp"
7401fi
7402
7403: determine where add-on public executables go
7404case "$sitebin" in
7405'') dflt=$siteprefix/bin ;;
7406*) dflt=$sitebin ;;
7407esac
7408fn=d~
7409rp='Pathname where the add-on public executables should be installed?'
7410. ./getfile
7411sitebin="$ans"
7412sitebinexp="$ansexp"
7413: Change installation prefix, if necessary.
7414if $test X"$prefix" != X"$installprefix"; then
7415 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7416else
7417 installsitebin="$sitebinexp"
7418fi
7419
7420case "$useperlio" in
7421$define|true|[yY]*) dflt='y';;
7422*) dflt='n';;
7423esac
7424cat <<EOM
7425
7426Previous version of $package used the standard IO mechanisms as defined
7427in <stdio.h>. Versions 5.003_02 and later of perl allow alternate IO
7428mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7429the default. This abstraction layer can use AT&T's sfio (if you already
7430have sfio installed) or regular stdio. Using PerlIO with sfio may cause
7431problems with some extension modules. Using PerlIO with stdio is safe,
7432but it is slower than plain stdio and therefore is not the default.
7433
7434If this doesn't make any sense to you, just accept the default '$dflt'.
7435EOM
7436rp='Use the experimental PerlIO abstraction layer?'
7437. ./myread
7438case "$ans" in
7439y|Y)
7440 val="$define"
7441 ;;
7442*)
7443 echo "Ok, doing things the stdio way"
7444 val="$undef"
7445 ;;
7446esac
7447set useperlio
7448eval $setvar
7449
7450case "$vendorprefix" in
7451'') d_vendorbin="$undef"
7452 vendorbin=''
7453 vendorbinexp=''
7454 ;;
7455*) d_vendorbin="$define"
7456 : determine where vendor-supplied executables go.
7457 case "$vendorbin" in
7458 '') dflt=$vendorprefix/bin ;;
7459 *) dflt="$vendorbin" ;;
7460 esac
7461 fn=d~+
7462 rp='Pathname for the vendor-supplied executables directory?'
7463 . ./getfile
7464 vendorbin="$ans"
7465 vendorbinexp="$ansexp"
7466 ;;
7467esac
7468: Change installation prefix, if necessary.
7469if $test X"$prefix" != X"$installprefix"; then
7470 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7471else
7472 installvendorbin="$vendorbinexp"
7473fi
7474
7475: see if qgcvt exists
7476set qgcvt d_qgcvt
7477eval $inlibc
7478
7479echo " "
7480
7481if $test X"$d_longdbl" = X"$define"; then
7482
7483echo "Checking how to print long doubles..." >&4
7484
7485if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7486 $cat >try.c <<'EOCP'
7487#include <sys/types.h>
7488#include <stdio.h>
7489int main() {
7490 double d = 123.456;
7491 printf("%.3f\n", d);
7492}
7493EOCP
7494 set try
7495 if eval $compile; then
7496 yyy=`./try$exe_ext`
7497 case "$yyy" in
7498 123.456)
7499 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7500 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7501 echo "We will use %f."
7502 ;;
7503 esac
7504 fi
7505fi
7506
7507if $test X"$sPRIfldbl" = X; then
7508 $cat >try.c <<'EOCP'
7509#include <sys/types.h>
7510#include <stdio.h>
7511int main() {
7512 long double d = 123.456;
7513 printf("%.3llf\n", d);
7514}
7515EOCP
7516 set try
7517 if eval $compile; then
7518 yyy=`./try$exe_ext`
7519 case "$yyy" in
7520 123.456)
7521 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7522 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7523 echo "We will use %llf."
7524 ;;
7525 esac
7526 fi
7527fi
7528
7529if $test X"$sPRIfldbl" = X; then
7530 $cat >try.c <<'EOCP'
7531#include <sys/types.h>
7532#include <stdio.h>
7533int main() {
7534 long double d = 123.456;
7535 printf("%.3Lf\n", d);
7536}
7537EOCP
7538 set try
7539 if eval $compile; then
7540 yyy=`./try$exe_ext`
7541 case "$yyy" in
7542 123.456)
7543 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7544 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7545 echo "We will use %Lf."
7546 ;;
7547 esac
7548 fi
7549fi
7550
7551if $test X"$sPRIfldbl" = X; then
7552 $cat >try.c <<'EOCP'
7553#include <sys/types.h>
7554#include <stdio.h>
7555int main() {
7556 long double d = 123.456;
7557 printf("%.3lf\n", d);
7558}
7559EOCP
7560 set try
7561 if eval $compile; then
7562 yyy=`./try$exe_ext`
7563 case "$yyy" in
7564 123.456)
7565 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7566 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7567 echo "We will use %lf."
7568 ;;
7569 esac
7570 fi
7571fi
7572
7573if $test X"$sPRIfldbl" = X; then
7574 echo "Cannot figure out how to print long doubles." >&4
7575else
7576 sSCNfldbl=$sPRIfldbl # expect consistency
7577fi
7578
7579$rm -f try try.*
7580
7581fi # d_longdbl
7582
7583case "$sPRIfldbl" in
7584'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
7585 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
7586 d_SCNfldbl="$undef";
7587 ;;
7588*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
7589 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
7590 d_SCNfldbl="$define";
7591 ;;
7592esac
7593
7594: Check how to convert floats to strings.
7595echo " "
7596echo "Checking for an efficient way to convert floats to strings."
7597echo " " > try.c
7598case "$uselongdouble" in
7599"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7600esac
7601case "$d_longdbl" in
7602"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7603esac
7604case "$d_PRIgldbl" in
7605"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
7606esac
7607$cat >>try.c <<EOP
7608#ifdef TRY_gconvert
7609#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7610char *myname = "gconvert";
7611#endif
7612#ifdef TRY_gcvt
7613#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7614char *myname = "gcvt";
7615#endif
7616#ifdef TRY_qgcvt
7617#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7618char *myname = "qgcvt";
7619#define DOUBLETYPE long double
7620#endif
7621#ifdef TRY_sprintf
7622#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7623#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7624#else
7625#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7626#endif
7627char *myname = "sprintf";
7628#endif
7629
7630#ifndef DOUBLETYPE
7631#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7632#define DOUBLETYPE long double
7633#else
7634#define DOUBLETYPE double
7635#endif
7636#endif
7637
7638#include <stdio.h>
7639
7640#define I_STDLIB $i_stdlib
7641#ifdef I_STDLIB
7642#include <stdlib.h>
7643#endif
7644
7645int
7646checkit(expect, got)
7647char *expect;
7648char *got;
7649{
7650 if (strcmp(expect, got)) {
7651 printf("%s oddity: Expected %s, got %s\n",
7652 myname, expect, got);
7653 exit(1);
7654 }
7655}
7656
7657int main()
7658{
7659 char buf[64];
7660 buf[63] = '\0';
7661
7662 /* This must be 1st test on (which?) platform */
7663 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7664 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7665 checkit("0.1", buf);
7666
7667 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
7668 checkit("1", buf);
7669
7670 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
7671 checkit("1.1", buf);
7672
7673 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
7674 checkit("1.01", buf);
7675
7676 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
7677 checkit("1.001", buf);
7678
7679 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
7680 checkit("1.0001", buf);
7681
7682 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
7683 checkit("1.00001", buf);
7684
7685 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
7686 checkit("1.000001", buf);
7687
7688 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
7689 checkit("0", buf);
7690
7691 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
7692 checkit("-1", buf);
7693
7694 /* Some Linux gcvt's give 1.e+5 here. */
7695 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
7696 checkit("100000", buf);
7697
7698 /* Some Linux gcvt's give -1.e+5 here. */
7699 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
7700 checkit("-100000", buf);
7701
7702 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
7703 checkit("123.456", buf);
7704
7705 exit(0);
7706}
7707EOP
7708case "$d_Gconvert" in
7709gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7710gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7711sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7712*) xxx_list='gconvert gcvt sprintf' ;;
7713esac
7714
7715case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7716"$define$define$define")
7717 # for long doubles prefer first qgcvt, then sprintf
7718 xxx_list="`echo $xxx_list|sed s/sprintf//`"
7719 xxx_list="sprintf $xxx_list"
7720 case "$d_qgcvt" in
7721 "$define") xxx_list="qgcvt $xxx_list" ;;
7722 esac
7723 ;;
7724esac
7725
7726for xxx_convert in $xxx_list; do
7727 echo "Trying $xxx_convert..."
7728 $rm -f try try$_o
7729 set try -DTRY_$xxx_convert
7730 if eval $compile; then
7731 echo "$xxx_convert() found." >&4
7732 if ./try; then
7733 echo "I'll use $xxx_convert to convert floats into a string." >&4
7734 break;
7735 else
7736 echo "...But $xxx_convert didn't work as I expected."
7737 fi
7738 else
7739 echo "$xxx_convert NOT found." >&4
7740 fi
7741done
7742
7743case "$xxx_convert" in
7744gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7745gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7746qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7747*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7748 "$define$define$define")
7749 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7750 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7751 esac
7752 ;;
7753esac
7754
7755: Initialize h_fcntl
7756h_fcntl=false
7757
7758: Initialize h_sysfile
7759h_sysfile=false
7760
7761: access call always available on UNIX
7762set access d_access
7763eval $inlibc
7764
7765: locate the flags for 'access()'
7766case "$d_access" in
7767"$define")
7768 echo " "
7769 $cat >access.c <<'EOCP'
7770#include <sys/types.h>
7771#ifdef I_FCNTL
7772#include <fcntl.h>
7773#endif
7774#ifdef I_SYS_FILE
7775#include <sys/file.h>
7776#endif
7777#ifdef I_UNISTD
7778#include <unistd.h>
7779#endif
7780int main() {
7781 exit(R_OK);
7782}
7783EOCP
7784 : check sys/file.h first, no particular reason here
7785 if $test `./findhdr sys/file.h` && \
7a282f6d 7786 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
7787 h_sysfile=true;
7788 echo "<sys/file.h> defines the *_OK access constants." >&4
7789 elif $test `./findhdr fcntl.h` && \
7a282f6d 7790 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
7791 h_fcntl=true;
7792 echo "<fcntl.h> defines the *_OK access constants." >&4
7793 elif $test `./findhdr unistd.h` && \
7a282f6d 7794 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
7795 echo "<unistd.h> defines the *_OK access constants." >&4
7796 else
7797 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7798 fi
7799 ;;
7800esac
7801$rm -f access*
7802
7803: see if accessx exists
7804set accessx d_accessx
7805eval $inlibc
7806
7807: see if alarm exists
7808set alarm d_alarm
7809eval $inlibc
7810
7811: see if atolf exists
7812set atolf d_atolf
7813eval $inlibc
7814
7815: see if atoll exists
7816set atoll d_atoll
7817eval $inlibc
7818
7819: Look for GNU-cc style attribute checking
7820echo " "
7821echo "Checking whether your compiler can handle __attribute__ ..." >&4
7822$cat >attrib.c <<'EOCP'
7823#include <stdio.h>
7824void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7825EOCP
7826if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7827 if $contains 'warning' attrib.out >/dev/null 2>&1; then
7828 echo "Your C compiler doesn't fully support __attribute__."
7829 val="$undef"
7830 else
7831 echo "Your C compiler supports __attribute__."
7832 val="$define"
7833 fi
7834else
7835 echo "Your C compiler doesn't seem to understand __attribute__ at all."
7836 val="$undef"
7837fi
7838set d_attribut
7839eval $setvar
7840$rm -f attrib*
7841
7842: see if bcmp exists
7843set bcmp d_bcmp
7844eval $inlibc
7845
7846: see if bcopy exists
7847set bcopy d_bcopy
7848eval $inlibc
7849
7850: see if this is a unistd.h system
7851set unistd.h i_unistd
7852eval $inhdr
7853
7854: see if getpgrp exists
7855set getpgrp d_getpgrp
7856eval $inlibc
7857
7858case "$d_getpgrp" in
7859"$define")
7860 echo " "
7861 echo "Checking to see which flavor of getpgrp is in use..."
7862 $cat >set.c <<EOP
7863#$i_unistd I_UNISTD
7864#include <sys/types.h>
7865#ifdef I_UNISTD
7866# include <unistd.h>
7867#endif
7868int main()
7869{
7870 if (getuid() == 0) {
7871 printf("(I see you are running Configure as super-user...)\n");
7872 setuid(1);
7873 }
7874#ifdef TRY_BSD_PGRP
7875 if (getpgrp(1) == 0)
7876 exit(0);
7877#else
7878 if (getpgrp() > 0)
7879 exit(0);
7880#endif
7881 exit(1);
7882}
7883EOP
7a282f6d 7884 if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
7885 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7886 val="$define"
7a282f6d 7887 elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
7888 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7889 val="$undef"
7890 else
7891 echo "I can't seem to compile and run the test program."
7892 if ./usg; then
7893 xxx="a USG one, i.e. you use getpgrp()."
7894 else
7895 # SVR4 systems can appear rather BSD-ish.
7896 case "$i_unistd" in
7897 $undef)
7898 xxx="a BSD one, i.e. you use getpgrp(pid)."
7899 val="$define"
7900 ;;
7901 $define)
7902 xxx="probably a USG one, i.e. you use getpgrp()."
7903 val="$undef"
7904 ;;
7905 esac
7906 fi
7907 echo "Assuming your getpgrp is $xxx" >&4
7908 fi
7909 ;;
7910*) val="$undef";;
7911esac
7912set d_bsdgetpgrp
7913eval $setvar
7914$rm -f set set.c
7915
7916: see if setpgrp exists
7917set setpgrp d_setpgrp
7918eval $inlibc
7919
7920case "$d_setpgrp" in
7921"$define")
7922 echo " "
7923 echo "Checking to see which flavor of setpgrp is in use..."
7924 $cat >set.c <<EOP
7925#$i_unistd I_UNISTD
7926#include <sys/types.h>
7927#ifdef I_UNISTD
7928# include <unistd.h>
7929#endif
7930int main()
7931{
7932 if (getuid() == 0) {
7933 printf("(I see you are running Configure as super-user...)\n");
7934 setuid(1);
7935 }
7936#ifdef TRY_BSD_PGRP
7937 if (-1 == setpgrp(1, 1))
7938 exit(0);
7939#else
7940 if (setpgrp() != -1)
7941 exit(0);
7942#endif
7943 exit(1);
7944}
7945EOP
7a282f6d 7946 if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
7947 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7948 val="$define"
7a282f6d 7949 elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
7950 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7951 val="$undef"
7952 else
7953 echo "(I can't seem to compile and run the test program.)"
7954 if ./usg; then
7955 xxx="a USG one, i.e. you use setpgrp()."
7956 else
7957 # SVR4 systems can appear rather BSD-ish.
7958 case "$i_unistd" in
7959 $undef)
7960 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7961 val="$define"
7962 ;;
7963 $define)
7964 xxx="probably a USG one, i.e. you use setpgrp()."
7965 val="$undef"
7966 ;;
7967 esac
7968 fi
7969 echo "Assuming your setpgrp is $xxx" >&4
7970 fi
7971 ;;
7972*) val="$undef";;
7973esac
7974set d_bsdsetpgrp
7975eval $setvar
7976$rm -f set set.c
7977: see if bzero exists
7978set bzero d_bzero
7979eval $inlibc
7980
7981: see if signal is declared as pointer to function returning int or void
7982echo " "
7983xxx=`./findhdr signal.h`
7984$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7985if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
7986 echo "You have int (*signal())() instead of void." >&4
7987 val="$undef"
7988elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
7989 echo "You have void (*signal())()." >&4
7990 val="$define"
7991elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7992 echo "You have int (*signal())() instead of void." >&4
7993 val="$undef"
7994elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7995 echo "You have void (*signal())()." >&4
7996 val="$define"
7997else
7998 case "$d_voidsig" in
7999 '')
8000 echo "I can't determine whether signal handler returns void or int..." >&4
8001 dflt=void
8002 rp="What type does your signal handler return?"
8003 . ./myread
8004 case "$ans" in
8005 v*) val="$define";;
8006 *) val="$undef";;
8007 esac;;
8008 "$define")
8009 echo "As you already told me, signal handler returns void." >&4
8010 val="$define"
8011 ;;
8012 *) echo "As you already told me, signal handler returns int." >&4
8013 val="$undef"
8014 ;;
8015 esac
8016fi
8017set d_voidsig
8018eval $setvar
8019case "$d_voidsig" in
8020"$define") signal_t="void";;
8021*) signal_t="int";;
8022esac
8023$rm -f $$.tmp
8024
8025: check for ability to cast large floats to 32-bit ints.
8026echo " "
8027echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8028if $test "$intsize" -ge 4; then
8029 xxx=int
8030else
8031 xxx=long
8032fi
8033$cat >try.c <<EOCP
8034#include <stdio.h>
8035#include <sys/types.h>
8036#include <signal.h>
8037$signal_t blech(s) int s; { exit(3); }
8038int main()
8039{
8040 $xxx i32;
8041 double f, g;
8042 int result = 0;
8043 char str[16];
8044 signal(SIGFPE, blech);
8045
8046 /* Don't let compiler optimize the test away. Store the number
8047 in a writable string for gcc to pass to sscanf under HP/UX.
8048 */
8049 sprintf(str, "2147483647");
8050 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8051 g = 10 * f;
8052 i32 = ($xxx) g;
8053
8054 /* x86 processors will probably give 0x8000 0000, which is a
8055 sign change. We don't want that. We want to mimic SPARC
8056 behavior here, which is to preserve the sign and give
8057 back 0x7fff ffff.
8058 */
8059 if (i32 != ($xxx) f)
8060 result |= 1;
8061 exit(result);
8062}
8063EOCP
8064set try
8065if eval $compile_ok; then
8066 ./try
8067 yyy=$?
8068else
8069 echo "(I can't seem to compile the test program--assuming it can't)"
8070 yyy=1
8071fi
8072case "$yyy" in
80730) val="$define"
8074 echo "Yup, it can."
8075 ;;
8076*) val="$undef"
8077 echo "Nope, it can't."
8078 ;;
8079esac
8080set d_casti32
8081eval $setvar
8082$rm -f try try.*
8083
8084: check for ability to cast negative floats to unsigned
8085echo " "
8086echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8087$cat >try.c <<EOCP
8088#include <stdio.h>
8089#include <sys/types.h>
8090#include <signal.h>
8091$signal_t blech(s) int s; { exit(7); }
8092$signal_t blech_in_list(s) int s; { exit(4); }
8093unsigned long dummy_long(p) unsigned long p; { return p; }
8094unsigned int dummy_int(p) unsigned int p; { return p; }
8095unsigned short dummy_short(p) unsigned short p; { return p; }
8096int main()
8097{
8098 double f;
8099 unsigned long along;
8100 unsigned int aint;
8101 unsigned short ashort;
8102 int result = 0;
8103 char str[16];
8104
8105 /* Frustrate gcc-2.7.2's optimizer which failed this test with
8106 a direct f = -123. assignment. gcc-2.8.0 reportedly
8107 optimized the whole file away
8108 */
8109 /* Store the number in a writable string for gcc to pass to
8110 sscanf under HP/UX.
8111 */
8112 sprintf(str, "-123");
8113 sscanf(str, "%lf", &f); /* f = -123.; */
8114
8115 signal(SIGFPE, blech);
8116 along = (unsigned long)f;
8117 aint = (unsigned int)f;
8118 ashort = (unsigned short)f;
8119 if (along != (unsigned long)-123)
8120 result |= 1;
8121 if (aint != (unsigned int)-123)
8122 result |= 1;
8123 if (ashort != (unsigned short)-123)
8124 result |= 1;
8125 sprintf(str, "1073741824.");
8126 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8127 f = f + f;
8128 along = 0;
8129 along = (unsigned long)f;
8130 if (along != 0x80000000)
8131 result |= 2;
8132 f -= 1.;
8133 along = 0;
8134 along = (unsigned long)f;
8135 if (along != 0x7fffffff)
8136 result |= 1;
8137 f += 2.;
8138 along = 0;
8139 along = (unsigned long)f;
8140 if (along != 0x80000001)
8141 result |= 2;
8142 if (result)
8143 exit(result);
8144 signal(SIGFPE, blech_in_list);
8145 sprintf(str, "123.");
8146 sscanf(str, "%lf", &f); /* f = 123.; */
8147 along = dummy_long((unsigned long)f);
8148 aint = dummy_int((unsigned int)f);
8149 ashort = dummy_short((unsigned short)f);
8150 if (along != (unsigned long)123)
8151 result |= 4;
8152 if (aint != (unsigned int)123)
8153 result |= 4;
8154 if (ashort != (unsigned short)123)
8155 result |= 4;
8156 exit(result);
8157
8158}
8159EOCP
8160set try
8161if eval $compile_ok; then
8162 ./try
8163 castflags=$?
8164else
8165 echo "(I can't seem to compile the test program--assuming it can't)"
8166 castflags=7
8167fi
8168case "$castflags" in
81690) val="$define"
8170 echo "Yup, it can."
8171 ;;
8172*) val="$undef"
8173 echo "Nope, it can't."
8174 ;;
8175esac
8176set d_castneg
8177eval $setvar
8178$rm -f try.*
8179
8180: see if vprintf exists
8181echo " "
8182if set vprintf val -f d_vprintf; eval $csym; $val; then
8183 echo 'vprintf() found.' >&4
8184 val="$define"
8185 $cat >vprintf.c <<'EOF'
8186#include <varargs.h>
8187
8188int main() { xxx("foo"); }
8189
8190xxx(va_alist)
8191va_dcl
8192{
8193 va_list args;
8194 char buf[10];
8195
8196 va_start(args);
8197 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8198}
8199EOF
8200 set vprintf
8201 if eval $compile && ./vprintf; then
8202 echo "Your vsprintf() returns (int)." >&4
8203 val2="$undef"
8204 else
8205 echo "Your vsprintf() returns (char*)." >&4
8206 val2="$define"
8207 fi
8208else
8209 echo 'vprintf() NOT found.' >&4
8210 val="$undef"
8211 val2="$undef"
8212fi
8213set d_vprintf
8214eval $setvar
8215val=$val2
8216set d_charvspr
8217eval $setvar
8218
8219: see if chown exists
8220set chown d_chown
8221eval $inlibc
8222
8223: see if chroot exists
8224set chroot d_chroot
8225eval $inlibc
8226
8227: see if chsize exists
8228set chsize d_chsize
8229eval $inlibc
8230
8231: check for const keyword
8232echo " "
8233echo 'Checking to see if your C compiler knows about "const"...' >&4
8234$cat >const.c <<'EOCP'
8235typedef struct spug { int drokk; } spug;
8236int main()
8237{
8238 const char *foo;
8239 const spug y;
8240}
8241EOCP
8242if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8243 val="$define"
8244 echo "Yup, it does."
8245else
8246 val="$undef"
8247 echo "Nope, it doesn't."
8248fi
8249set d_const
8250eval $setvar
8251
8252: see if crypt exists
8253echo " "
8254if set crypt val -f d_crypt; eval $csym; $val; then
8255 echo 'crypt() found.' >&4
8256 val="$define"
8257 cryptlib=''
8258else
8259 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8260 if $test -z "$cryptlib"; then
8261 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8262 else
8263 cryptlib=-lcrypt
8264 fi
8265 if $test -z "$cryptlib"; then
8266 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8267 else
8268 cryptlib=-lcrypt
8269 fi
8270 if $test -z "$cryptlib"; then
8271 cryptlib=`./loc libcrypt$_a "" $libpth`
8272 else
8273 cryptlib=-lcrypt
8274 fi
8275 if $test -z "$cryptlib"; then
8276 echo 'crypt() NOT found.' >&4
8277 val="$undef"
8278 else
8279 val="$define"
8280 fi
8281fi
8282set d_crypt
8283eval $setvar
8284
8285: get csh whereabouts
8286case "$csh" in
8287'csh') val="$undef" ;;
8288*) val="$define" ;;
8289esac
8290set d_csh
8291eval $setvar
8292: Respect a hint or command line value for full_csh.
8293case "$full_csh" in
8294'') full_csh=$csh ;;
8295esac
8296
8297: see if cuserid exists
8298set cuserid d_cuserid
8299eval $inlibc
8300
8301: see if this is a limits.h system
8302set limits.h i_limits
8303eval $inhdr
8304
8305: see if this is a float.h system
8306set float.h i_float
8307eval $inhdr
8308
8309: See if number of significant digits in a double precision number is known
8310echo " "
8311$cat >dbl_dig.c <<EOM
8312#$i_limits I_LIMITS
8313#$i_float I_FLOAT
8314#ifdef I_LIMITS
8315#include <limits.h>
8316#endif
8317#ifdef I_FLOAT
8318#include <float.h>
8319#endif
8320#ifdef DBL_DIG
8321printf("Contains DBL_DIG");
8322#endif
8323EOM
8324$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8325if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8326 echo "DBL_DIG found." >&4
8327 val="$define"
8328else
8329 echo "DBL_DIG NOT found." >&4
8330 val="$undef"
8331fi
8332$rm -f dbl_dig.?
8333set d_dbl_dig
8334eval $setvar
8335
8336: see if difftime exists
8337set difftime d_difftime
8338eval $inlibc
8339
8340: see if this is a dirent system
8341echo " "
8342if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8343 val="$define"
8344 echo "<dirent.h> found." >&4
8345else
8346 val="$undef"
8347 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8348 echo "<sys/dir.h> found." >&4
8349 echo " "
8350 else
8351 xinc=`./findhdr sys/ndir.h`
8352 fi
8353 echo "<dirent.h> NOT found." >&4
8354fi
8355set i_dirent
8356eval $setvar
8357
8358: Look for type of directory structure.
8359echo " "
8360$cppstdin $cppflags $cppminus < "$xinc" > try.c
8361
8362case "$direntrytype" in
8363''|' ')
8364 case "$i_dirent" in
8365 $define) guess1='struct dirent' ;;
8366 *) guess1='struct direct' ;;
8367 esac
8368 ;;
8369*) guess1="$direntrytype"
8370 ;;
8371esac
8372
8373case "$guess1" in
8374'struct dirent') guess2='struct direct' ;;
8375*) guess2='struct dirent' ;;
8376esac
8377
8378if $contains "$guess1" try.c >/dev/null 2>&1; then
8379 direntrytype="$guess1"
8380 echo "Your directory entries are $direntrytype." >&4
8381elif $contains "$guess2" try.c >/dev/null 2>&1; then
8382 direntrytype="$guess2"
8383 echo "Your directory entries seem to be $direntrytype." >&4
8384else
8385 echo "I don't recognize your system's directory entries." >&4
8386 rp="What type is used for directory entries on this system?"
8387 dflt="$guess1"
8388 . ./myread
8389 direntrytype="$ans"
8390fi
8391$rm -f try.c
8392
8393
8394: see if the directory entry stores field length
8395echo " "
8396$cppstdin $cppflags $cppminus < "$xinc" > try.c
8397if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8398 echo "Good, your directory entry keeps length information in d_namlen." >&4
8399 val="$define"
8400else
8401 echo "Your directory entry does not know about the d_namlen field." >&4
8402 val="$undef"
8403fi
8404set d_dirnamlen
8405eval $setvar
8406$rm -f try.c
8407
8408: see if dlerror exists
8409xxx_runnm="$runnm"
8410runnm=false
8411set dlerror d_dlerror
8412eval $inlibc
8413runnm="$xxx_runnm"
8414
8415: see if dlfcn is available
8416set dlfcn.h i_dlfcn
8417eval $inhdr
8418
8419case "$usedl" in
8420$define|y|true)
8421 $cat << EOM
8422
8423On a few systems, the dynamically loaded modules that perl generates and uses
8424will need a different extension than shared libs. The default will probably
8425be appropriate.
8426
8427EOM
8428 case "$dlext" in
8429 '') dflt="$so" ;;
8430 *) dflt="$dlext" ;;
8431 esac
8432 rp='What is the extension of dynamically loaded modules'
8433 . ./myread
8434 dlext="$ans"
8435 ;;
8436*)
8437 dlext="none"
8438 ;;
8439esac
8440
8441: Check if dlsym need a leading underscore
8442echo " "
8443val="$undef"
8444
8445case "$dlsrc" in
8446dl_dlopen.xs)
8447 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8448 $cat >dyna.c <<'EOM'
8449fred () { }
8450EOM
8451
8452$cat >fred.c<<EOM
8453
8454#include <stdio.h>
8455#$i_dlfcn I_DLFCN
8456#ifdef I_DLFCN
8457#include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
8458#else
8459#include <sys/types.h>
8460#include <nlist.h>
8461#include <link.h>
8462#endif
8463
8464extern int fred() ;
8465
8466int main()
8467{
8468 void * handle ;
8469 void * symbol ;
8470#ifndef RTLD_LAZY
8471 int mode = 1 ;
8472#else
8473 int mode = RTLD_LAZY ;
8474#endif
8475 handle = dlopen("./dyna.$dlext", mode) ;
8476 if (handle == NULL) {
8477 printf ("1\n") ;
8478 fflush (stdout) ;
8479 exit(0);
8480 }
8481 symbol = dlsym(handle, "fred") ;
8482 if (symbol == NULL) {
8483 /* try putting a leading underscore */
8484 symbol = dlsym(handle, "_fred") ;
8485 if (symbol == NULL) {
8486 printf ("2\n") ;
8487 fflush (stdout) ;
8488 exit(0);
8489 }
8490 printf ("3\n") ;
8491 }
8492 else
8493 printf ("4\n") ;
8494 fflush (stdout) ;
8495 exit(0);
8496}
8497EOM
8498 : Call the object file tmp-dyna.o in case dlext=o.
8499 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
8500 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
7a282f6d
JH
8501 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
8502 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
b4eb6b3d
JH
8503 xxx=`./fred`
8504 case $xxx in
8505 1) echo "Test program failed using dlopen." >&4
8506 echo "Perhaps you should not use dynamic loading." >&4;;
8507 2) echo "Test program failed using dlsym." >&4
8508 echo "Perhaps you should not use dynamic loading." >&4;;
8509 3) echo "dlsym needs a leading underscore" >&4
8510 val="$define" ;;
8511 4) echo "dlsym doesn't need a leading underscore." >&4;;
8512 esac
8513 else
8514 echo "I can't compile and run the test program." >&4
8515 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8516 fi
8517 ;;
8518esac
8519
8520$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8521
8522set d_dlsymun
8523eval $setvar
8524
8525hasproto='varname=$1; func=$2; shift; shift;
8526while $test $# -ge 2; do
8527 case "$1" in
8528 $define) echo "#include <$2>";;
8529 esac ;
8530 shift 2;
8531done > try.c;
8532$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8533if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8534 echo "$func() prototype found.";
8535 val="$define";
8536else
8537 echo "$func() prototype NOT found.";
8538 val="$undef";
8539fi;
8540set $varname;
8541eval $setvar;
8542$rm -f try.c tryout.c'
8543
8544: see if prototype for drand48 is available
8545echo " "
8546set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8547eval $hasproto
8548
8549: see if dup2 exists
8550set dup2 d_dup2
8551eval $inlibc
8552
8553: see if eaccess exists
8554set eaccess d_eaccess
8555eval $inlibc
8556
8557: see if endgrent exists
8558set endgrent d_endgrent
8559eval $inlibc
8560
8561: see if endhostent exists
8562set endhostent d_endhent
8563eval $inlibc
8564
8565: see if endnetent exists
8566set endnetent d_endnent
8567eval $inlibc
8568
8569: see if endprotoent exists
8570set endprotoent d_endpent
8571eval $inlibc
8572
8573: see if endpwent exists
8574set endpwent d_endpwent
8575eval $inlibc
8576
8577: see if endservent exists
8578set endservent d_endsent
8579eval $inlibc
8580
8581: Locate the flags for 'open()'
8582echo " "
8583$cat >open3.c <<'EOCP'
8584#include <sys/types.h>
8585#ifdef I_FCNTL
8586#include <fcntl.h>
8587#endif
8588#ifdef I_SYS_FILE
8589#include <sys/file.h>
8590#endif
8591int main() {
8592 if(O_RDONLY);
8593#ifdef O_TRUNC
8594 exit(0);
8595#else
8596 exit(1);
8597#endif
8598}
8599EOCP
8600: check sys/file.h first to get FREAD on Sun
8601if $test `./findhdr sys/file.h` && \
8602 set open3 -DI_SYS_FILE && eval $compile; then
8603 h_sysfile=true;
8604 echo "<sys/file.h> defines the O_* constants..." >&4
8605 if ./open3; then
8606 echo "and you have the 3 argument form of open()." >&4
8607 val="$define"
8608 else
8609 echo "but not the 3 argument form of open(). Oh, well." >&4
8610 val="$undef"
8611 fi
8612elif $test `./findhdr fcntl.h` && \
8613 set open3 -DI_FCNTL && eval $compile; then
8614 h_fcntl=true;
8615 echo "<fcntl.h> defines the O_* constants..." >&4
8616 if ./open3; then
8617 echo "and you have the 3 argument form of open()." >&4
8618 val="$define"
8619 else
8620 echo "but not the 3 argument form of open(). Oh, well." >&4
8621 val="$undef"
8622 fi
8623else
8624 val="$undef"
8625 echo "I can't find the O_* constant definitions! You got problems." >&4
8626fi
8627set d_open3
8628eval $setvar
8629$rm -f open3*
8630
8631: see which of string.h or strings.h is needed
8632echo " "
8633strings=`./findhdr string.h`
8634if $test "$strings" && $test -r "$strings"; then
8635 echo "Using <string.h> instead of <strings.h>." >&4
8636 val="$define"
8637else
8638 val="$undef"
8639 strings=`./findhdr strings.h`
8640 if $test "$strings" && $test -r "$strings"; then
8641 echo "Using <strings.h> instead of <string.h>." >&4
8642 else
8643 echo "No string header found -- You'll surely have problems." >&4
8644 fi
8645fi
8646set i_string
8647eval $setvar
8648case "$i_string" in
8649"$undef") strings=`./findhdr strings.h`;;
8650*) strings=`./findhdr string.h`;;
8651esac
8652
8653: check for non-blocking I/O stuff
8654case "$h_sysfile" in
8655true) echo "#include <sys/file.h>" > head.c;;
8656*)
8657 case "$h_fcntl" in
8658 true) echo "#include <fcntl.h>" > head.c;;
8659 *) echo "#include <sys/fcntl.h>" > head.c;;
8660 esac
8661 ;;
8662esac
8663echo " "
8664echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8665case "$o_nonblock" in
8666'')
8667 $cat head.c > try.c
8668 $cat >>try.c <<'EOCP'
8669#include <stdio.h>
8670int main() {
8671#ifdef O_NONBLOCK
8672 printf("O_NONBLOCK\n");
8673 exit(0);
8674#endif
8675#ifdef O_NDELAY
8676 printf("O_NDELAY\n");
8677 exit(0);
8678#endif
8679#ifdef FNDELAY
8680 printf("FNDELAY\n");
8681 exit(0);
8682#endif
8683 exit(0);
8684}
8685EOCP
8686 set try
8687 if eval $compile_ok; then
8688 o_nonblock=`./try`
8689 case "$o_nonblock" in
8690 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8691 *) echo "Seems like we can use $o_nonblock.";;
8692 esac
8693 else
8694 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8695 fi
8696 ;;
8697*) echo "Using $hint value $o_nonblock.";;
8698esac
8699$rm -f try try.* .out core
8700
8701echo " "
8702echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8703case "$eagain" in
8704'')
8705 $cat head.c > try.c
8706 $cat >>try.c <<EOCP
8707#include <errno.h>
8708#include <sys/types.h>
8709#include <signal.h>
8710#include <stdio.h>
8711#define MY_O_NONBLOCK $o_nonblock
8712#ifndef errno /* XXX need better Configure test */
8713extern int errno;
8714#endif
8715#$i_unistd I_UNISTD
8716#ifdef I_UNISTD
8717#include <unistd.h>
8718#endif
8719#$i_string I_STRING
8720#ifdef I_STRING
8721#include <string.h>
8722#else
8723#include <strings.h>
8724#endif
8725$signal_t blech(x) int x; { exit(3); }
8726EOCP
8727 $cat >> try.c <<'EOCP'
8728int main()
8729{
8730 int pd[2];
8731 int pu[2];
8732 char buf[1];
8733 char string[100];
8734
8735 pipe(pd); /* Down: child -> parent */
8736 pipe(pu); /* Up: parent -> child */
8737 if (0 != fork()) {
8738 int ret;
8739 close(pd[1]); /* Parent reads from pd[0] */
8740 close(pu[0]); /* Parent writes (blocking) to pu[1] */
8741 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8742 exit(1);
8743 signal(SIGALRM, blech);
8744 alarm(5);
8745 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
8746 exit(2);
8747 sprintf(string, "%d\n", ret);
8748 write(2, string, strlen(string));
8749 alarm(0);
8750#ifdef EAGAIN
8751 if (errno == EAGAIN) {
8752 printf("EAGAIN\n");
8753 goto ok;
8754 }
8755#endif
8756#ifdef EWOULDBLOCK
8757 if (errno == EWOULDBLOCK)
8758 printf("EWOULDBLOCK\n");
8759#endif
8760 ok:
8761 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
8762 sleep(2); /* Give it time to close our pipe */
8763 alarm(5);
8764 ret = read(pd[0], buf, 1); /* Should read EOF */
8765 alarm(0);
8766 sprintf(string, "%d\n", ret);
8767 write(3, string, strlen(string));
8768 exit(0);
8769 }
8770
8771 close(pd[0]); /* We write to pd[1] */
8772 close(pu[1]); /* We read from pu[0] */
8773 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
8774 close(pd[1]); /* Pipe pd is now fully closed! */
8775 exit(0); /* Bye bye, thank you for playing! */
8776}
8777EOCP
8778 set try
8779 if eval $compile_ok; then
8780 echo "$startsh" >mtry
8781 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8782 chmod +x mtry
8783 ./mtry >/dev/null 2>&1
8784 case $? in
8785 0) eagain=`$cat try.out`;;
8786 1) echo "Could not perform non-blocking setting!";;
8787 2) echo "I did a successful read() for something that was not there!";;
8788 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8789 *) echo "Something terribly wrong happened during testing.";;
8790 esac
8791 rd_nodata=`$cat try.ret`
8792 echo "A read() system call with no data present returns $rd_nodata."
8793 case "$rd_nodata" in
8794 0|-1) ;;
8795 *)
8796 echo "(That's peculiar, fixing that to be -1.)"
8797 rd_nodata=-1
8798 ;;
8799 esac
8800 case "$eagain" in
8801 '')
8802 echo "Forcing errno EAGAIN on read() with no data available."
8803 eagain=EAGAIN
8804 ;;
8805 *)
8806 echo "Your read() sets errno to $eagain when no data is available."
8807 ;;
8808 esac
8809 status=`$cat try.err`
8810 case "$status" in
8811 0) echo "And it correctly returns 0 to signal EOF.";;
8812 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8813 *) echo "However, your read() returns '$status' on EOF??";;
8814 esac
8815 val="$define"
8816 if test "$status" = "$rd_nodata"; then
8817 echo "WARNING: you can't distinguish between EOF and no data!"
8818 val="$undef"
8819 fi
8820 else
8821 echo "I can't compile the test program--assuming errno EAGAIN will do."
8822 eagain=EAGAIN
8823 fi
8824 set d_eofnblk
8825 eval $setvar
8826 ;;
8827*)
8828 echo "Using $hint value $eagain."
8829 echo "Your read() returns $rd_nodata when no data is present."
8830 case "$d_eofnblk" in
8831 "$define") echo "And you can see EOF because read() returns 0.";;
8832 "$undef") echo "But you can't see EOF status from read() returned value.";;
8833 *)
8834 echo "(Assuming you can't see EOF status from read anyway.)"
8835 d_eofnblk=$undef
8836 ;;
8837 esac
8838 ;;
8839esac
8840$rm -f try try.* .out core head.c mtry
8841
8842: see if fchmod exists
8843set fchmod d_fchmod
8844eval $inlibc
8845
8846: see if fchown exists
8847set fchown d_fchown
8848eval $inlibc
8849
8850: see if this is an fcntl system
8851set fcntl d_fcntl
8852eval $inlibc
8853
9d9004a9
AD
8854echo " "
8855: See if fcntl-based locking works.
8856$cat >try.c <<'EOCP'
8857#include <stdlib.h>
8858#include <unistd.h>
8859#include <fcntl.h>
8860int main() {
8861#if defined(F_SETLK) && defined(F_SETLKW)
8862 struct flock flock;
8863 int retval, fd;
8864 fd = open("try.c", O_RDONLY);
8865 flock.l_type = F_RDLCK;
8866 flock.l_whence = SEEK_SET;
8867 flock.l_start = flock.l_len = 0;
8868 retval = fcntl(fd, F_SETLK, &flock);
8869 close(fd);
8870 (retval < 0 ? exit(2) : exit(0));
8871#else
8872 exit(2);
8873#endif
8874}
8875EOCP
8876echo "Checking if fcntl-based file locking works... "
8877case "$d_fcntl" in
8878"$define")
8879 set try
8880 if eval $compile_ok; then
8881 if ./try; then
8882 echo "Yes, it seems to work."
8883 val="$define"
8884 else
8885 echo "Nope, it didn't work."
8886 val="$undef"
8887 fi
8888 else
8889 echo "I'm unable to compile the test program, so I'll assume not."
8890 val="$undef"
8891 fi
8892 ;;
8893*) val="$undef";
8894 echo "Nope, since you don't even have fcntl()."
8895 ;;
8896esac
8897set d_fcntl_can_lock
8898eval $setvar
8899$rm -f try*
8900
8901
b4eb6b3d
JH
8902hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8903while $test $# -ge 2; do
8904 case "$1" in
8905 $define) echo "#include <$2>";;
8906 esac ;
8907 shift 2;
8908done > try.c;
8909echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8910set try;
8911if eval $compile; then
8912 val="$define";
8913else
8914 val="$undef";
8915fi;
8916set $varname;
8917eval $setvar;
8918$rm -f try.c try.o'
8919
8920socketlib=''
8921sockethdr=''
8922: see whether socket exists
8923echo " "
8924$echo $n "Hmm... $c" >&4
8925if set socket val -f d_socket; eval $csym; $val; then
8926 echo "Looks like you have Berkeley networking support." >&4
8927 d_socket="$define"
8928 if set setsockopt val -f; eval $csym; $val; then
8929 d_oldsock="$undef"
8930 else
8931 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8932 d_oldsock="$define"
8933 fi
8934else
8935 if $contains socklib libc.list >/dev/null 2>&1; then
8936 echo "Looks like you have Berkeley networking support." >&4
8937 d_socket="$define"
8938 : we will have to assume that it supports the 4.2 BSD interface
8939 d_oldsock="$undef"
8940 else
8941 echo "You don't have Berkeley networking in libc$_a..." >&4
8942 if test "X$d_socket" = "X$define"; then
8943 echo "...but you seem to believe that you have sockets." >&4
8944 else
8945 for net in net socket
8946 do
8947 if test -f /usr/lib/lib$net$_a; then
8948 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
8949 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8950 if $contains socket libc.list >/dev/null 2>&1; then
8951 d_socket="$define"
8952 socketlib="-l$net"
8953 case "$net" in
8954 net)
8955 echo "...but the Wollongong group seems to have hacked it in." >&4
8956 sockethdr="-I/usr/netinclude"
8957 ;;
8958 esac
8959 echo "Found Berkeley sockets interface in lib$net." >& 4
8960 if $contains setsockopt libc.list >/dev/null 2>&1; then
8961 d_oldsock="$undef"
8962 else
8963 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8964 d_oldsock="$define"
8965 fi
8966 break
8967 fi
8968 fi
8969 done
8970 if test "X$d_socket" != "X$define"; then
8971 echo "or anywhere else I see." >&4
8972 d_socket="$undef"
8973 d_oldsock="$undef"
8974 fi
8975 fi
8976 fi
8977fi
8978
8979: see if socketpair exists
8980set socketpair d_sockpair
8981eval $inlibc
8982
8983
8984echo " "
8985echo "Checking the availability of certain socket constants..." >& 4
8986for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8987 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8988 $cat >try.c <<EOF
8989#include <sys/types.h>
8990#include <sys/socket.h>
8991int main() {
8992 int i = $ENUM;
8993}
8994EOF
8995 val="$undef"
8996 set try; if eval $compile; then
8997 val="$define"
8998 fi
8999 set d_${enum}; eval $setvar
9000 $rm -f try.c try
9001done
9002
9003: see if sys/select.h has to be included
9004set sys/select.h i_sysselct
9005eval $inhdr
9006
9007: see if we should include time.h, sys/time.h, or both
9008echo " "
9009if test "X$timeincl" = X; then
9010 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9011 $echo $n "I'm now running the test program...$c"
9012 $cat >try.c <<'EOCP'
9013#include <sys/types.h>
9014#ifdef I_TIME
9015#include <time.h>
9016#endif
9017#ifdef I_SYSTIME
9018#ifdef SYSTIMEKERNEL
9019#define KERNEL
9020#endif
9021#include <sys/time.h>
9022#endif
9023#ifdef I_SYSSELECT
9024#include <sys/select.h>
9025#endif
9026int main()
9027{
9028 struct tm foo;
9029#ifdef S_TIMEVAL
9030 struct timeval bar;
9031#endif
9032#ifdef S_TIMEZONE
9033 struct timezone tzp;
9034#endif
9035 if (foo.tm_sec == foo.tm_sec)
9036 exit(0);
9037#ifdef S_TIMEVAL
9038 if (bar.tv_sec == bar.tv_sec)
9039 exit(0);
9040#endif
9041 exit(1);
9042}
9043EOCP
9044 flags=''
9045 for s_timezone in '-DS_TIMEZONE' ''; do
9046 sysselect=''
9047 for s_timeval in '-DS_TIMEVAL' ''; do
9048 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9049 for i_time in '' '-DI_TIME'; do
9050 for i_systime in '-DI_SYSTIME' ''; do
9051 case "$flags" in
9052 '') $echo $n ".$c"
9053 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9054 if eval $compile; then
9055 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9056 shift
9057 flags="$*"
9058 echo " "
9059 $echo $n "Succeeded with $flags$c"
9060 fi
9061 ;;
9062 esac
9063 done
9064 done
9065 done
9066 done
9067 done
9068 timeincl=''
9069 echo " "
9070 case "$flags" in
9071 *SYSTIMEKERNEL*) i_systimek="$define"
9072 timeincl=`./findhdr sys/time.h`
9073 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9074 *) i_systimek="$undef";;
9075 esac
9076 case "$flags" in
9077 *I_TIME*) i_time="$define"
9078 timeincl=`./findhdr time.h`" $timeincl"
9079 echo "We'll include <time.h>." >&4;;
9080 *) i_time="$undef";;
9081 esac
9082 case "$flags" in
9083 *I_SYSTIME*) i_systime="$define"
9084 timeincl=`./findhdr sys/time.h`" $timeincl"
9085 echo "We'll include <sys/time.h>." >&4;;
9086 *) i_systime="$undef";;
9087 esac
9088 $rm -f try.c try
9089fi
9090
9091: check for fd_set items
9092$cat <<EOM
9093
9094Checking to see how well your C compiler handles fd_set and friends ...
9095EOM
9096$cat >fd_set.c <<EOCP
9097#$i_systime I_SYS_TIME
9098#$i_sysselct I_SYS_SELECT
9099#$d_socket HAS_SOCKET
9100#include <sys/types.h>
9101#ifdef HAS_SOCKET
9102#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9103#endif
9104#ifdef I_SYS_TIME
9105#include <sys/time.h>
9106#endif
9107#ifdef I_SYS_SELECT
9108#include <sys/select.h>
9109#endif
9110int main() {
9111 fd_set fds;
9112
9113#ifdef TRYBITS
9114 if(fds.fds_bits);
9115#endif
9116
9117#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9118 exit(0);
9119#else
9120 exit(1);
9121#endif
9122}
9123EOCP
9124set fd_set -DTRYBITS
9125if eval $compile; then
9126 d_fds_bits="$define"
9127 d_fd_set="$define"
9128 echo "Well, your system knows about the normal fd_set typedef..." >&4
9129 if ./fd_set; then
9130 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9131 d_fd_macros="$define"
9132 else
9133 $cat >&4 <<'EOM'
9134but not the normal fd_set macros! Gaaack! I'll have to cover for you.
9135EOM
9136 d_fd_macros="$undef"
9137 fi
9138else
9139 $cat <<'EOM'
9140Hmm, your compiler has some difficulty with fd_set. Checking further...
9141EOM
9142 set fd_set
9143 if eval $compile; then
9144 d_fds_bits="$undef"
9145 d_fd_set="$define"
9146 echo "Well, your system has some sort of fd_set available..." >&4
9147 if ./fd_set; then
9148 echo "and you have the normal fd_set macros." >&4
9149 d_fd_macros="$define"
9150 else
9151 $cat <<'EOM'
9152but not the normal fd_set macros! Gross! More work for me...
9153EOM
9154 d_fd_macros="$undef"
9155 fi
9156 else
9157 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
9158 d_fd_set="$undef"
9159 d_fds_bits="$undef"
9160 d_fd_macros="$undef"
9161 fi
9162fi
9163$rm -f fd_set*
9164
9165: see if fgetpos exists
9166set fgetpos d_fgetpos
9167eval $inlibc
9168
9169: see if flock exists
9170set flock d_flock
9171eval $inlibc
9172
9173: see if fork exists
9174set fork d_fork
9175eval $inlibc
9176
9177: see if pathconf exists
9178set pathconf d_pathconf
9179eval $inlibc
9180
9181: see if fpathconf exists
9182set fpathconf d_fpathconf
9183eval $inlibc
9184
9185
9186: check for fpos64_t
9187echo " "
9188echo "Checking to see if you have fpos64_t..." >&4
9189$cat >try.c <<EOCP
9190#include <stdio.h>
9191int main() { fpos64_t x = 7; }
9192EOCP
9193set try
9194if eval $compile; then
9195 val="$define"
9196 echo "You have fpos64_t."
9197else
9198 val="$undef"
9199 echo "You do not have fpos64_t."
9200 case "$fpossize" in
9201 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9202 esac
9203fi
9204$rm -f try.* try
9205set d_fpos64_t
9206eval $setvar
9207
9208: see if frexpl exists
9209set frexpl d_frexpl
9210eval $inlibc
9211
9212hasstruct='varname=$1; struct=$2; shift; shift;
9213while $test $# -ge 2; do
9214 case "$1" in
9215 $define) echo "#include <$2>";;
9216 esac ;
9217 shift 2;
9218done > try.c;
9219echo "int main () { struct $struct foo; }" >> try.c;
9220set try;
9221if eval $compile; then
9222 val="$define";
9223else
9224 val="$undef";
9225fi;
9226set $varname;
9227eval $setvar;
9228$rm -f try.c try.o'
9229
9230: see if this is a sys/param system
9231set sys/param.h i_sysparam
9232eval $inhdr
9233
9234: see if this is a sys/mount.h system
9235set sys/mount.h i_sysmount
9236eval $inhdr
9237
9238: see if sys/types.h has to be included
9239set sys/types.h i_systypes
9240eval $inhdr
9241
9242
9243echo " "
9244echo "Checking to see if your system supports struct fs_data..." >&4
9245set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9246eval $hasstruct
9247case "$d_fs_data_s" in
9248"$define") echo "Yes, it does." ;;
9249*) echo "No, it doesn't." ;;
9250esac
9251
9252: see if fseeko exists
9253set fseeko d_fseeko
9254eval $inlibc
9255case "$longsize" in
92568) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9257esac
9258
9259: see if fsetpos exists
9260set fsetpos d_fsetpos
9261eval $inlibc
9262
9263
9264: see if fstatfs exists
9265set fstatfs d_fstatfs
9266eval $inlibc
9267
9268
9269: see if statvfs exists
9270set statvfs d_statvfs
9271eval $inlibc
9272
9273: see if fstatvfs exists
9274set fstatvfs d_fstatvfs
9275eval $inlibc
9276
9277
9278: see if ftello exists
9279set ftello d_ftello
9280eval $inlibc
9281case "$longsize" in
92828) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9283esac
9284
9285: see if getcwd exists
9286set getcwd d_getcwd
9287eval $inlibc
9288
9289: see if getespwnam exists
9290set getespwnam d_getespwnam
9291eval $inlibc
9292
9293
9294: see if getfsstat exists
9295set getfsstat d_getfsstat
9296eval $inlibc
9297
9298: see if getgrent exists
9299set getgrent d_getgrent
9300eval $inlibc
9301
9302: see if gethostbyaddr exists
9303set gethostbyaddr d_gethbyaddr
9304eval $inlibc
9305
9306: see if gethostbyname exists
9307set gethostbyname d_gethbyname
9308eval $inlibc
9309
9310: see if gethostent exists
9311set gethostent d_gethent
9312eval $inlibc
9313
9314: see how we will look up host name
9315echo " "
9316call=''
9317if set gethostname val -f d_gethname; eval $csym; $val; then
9318 echo 'gethostname() found.' >&4
9319 d_gethname="$define"
9320 call=gethostname
9321fi
9322if set uname val -f d_uname; eval $csym; $val; then
9323 if ./xenix; then
9324 $cat <<'EOM'
9325uname() was found, but you're running xenix, and older versions of xenix
9326have a broken uname(). If you don't really know whether your xenix is old
9327enough to have a broken system call, use the default answer.
9328
9329EOM
9330 dflt=y
9331 case "$d_uname" in
9332 "$define") dflt=n;;
9333 esac
9334 rp='Is your uname() broken?'
9335 . ./myread
9336 case "$ans" in
9337 n*) d_uname="$define"; call=uname;;
9338 esac
9339 else
9340 echo 'uname() found.' >&4
9341 d_uname="$define"
9342 case "$call" in
9343 '') call=uname ;;
9344 esac
9345 fi
9346fi
9347case "$d_gethname" in
9348'') d_gethname="$undef";;
9349esac
9350case "$d_uname" in
9351'') d_uname="$undef";;
9352esac
9353case "$d_uname$d_gethname" in
9354*define*)
9355 dflt=n
9356 cat <<EOM
9357
9358Every now and then someone has a $call() that lies about the hostname
9359but can't be fixed for political or economic reasons. If you wish, I can
9360pretend $call() isn't there and maybe compute hostname at run-time
9361thanks to the '$phostname' command.
9362
9363EOM
9364 rp="Shall I ignore $call() from now on?"
9365 . ./myread
9366 case "$ans" in
9367 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9368 esac;;
9369esac
9370case "$phostname" in
9371'') aphostname='';;
9372*) case "$aphostname" in
9373 /*) ;;
9374 *) set X $phostname
9375 shift
9376 file=$1
9377 shift
9378 file=`./loc $file $file $pth`
9379 aphostname=`echo $file $*`
9380 ;;
9381 esac
9382 ;;
9383esac
9384case "$d_uname$d_gethname" in
9385*define*) ;;
9386*)
9387 case "$phostname" in
9388 '')
9389 echo "There will be no way for $package to get your hostname." >&4;;
9390 *)
9391 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9392 ;;
9393 esac;;
9394esac
9395case "$d_phostname" in
9396'') d_phostname="$undef";;
9397esac
9398
9399: see if this is a netdb.h system
9400set netdb.h i_netdb
9401eval $inhdr
9402
9403: see if prototypes for various gethostxxx netdb.h functions are available
9404echo " "
9405set d_gethostprotos gethostent $i_netdb netdb.h
9406eval $hasproto
9407
9408: see if getlogin exists
9409set getlogin d_getlogin
9410eval $inlibc
9411
9412: see if getmnt exists
9413set getmnt d_getmnt
9414eval $inlibc
9415
9416: see if getmntent exists
9417set getmntent d_getmntent
9418eval $inlibc
9419
9420: see if getnetbyaddr exists
9421set getnetbyaddr d_getnbyaddr
9422eval $inlibc
9423
9424: see if getnetbyname exists
9425set getnetbyname d_getnbyname
9426eval $inlibc
9427
9428: see if getnetent exists
9429set getnetent d_getnent
9430eval $inlibc
9431
9432: see if prototypes for various getnetxxx netdb.h functions are available
9433echo " "
9434set d_getnetprotos getnetent $i_netdb netdb.h
9435eval $hasproto
9436
9437
9438: see if getprotobyname exists
9439set getprotobyname d_getpbyname
9440eval $inlibc
9441
9442: see if getprotobynumber exists
9443set getprotobynumber d_getpbynumber
9444eval $inlibc
9445
9446: see if getprotoent exists
9447set getprotoent d_getpent
9448eval $inlibc
9449
9450: see if getpgid exists
9451set getpgid d_getpgid
9452eval $inlibc
9453
9454: see if getpgrp2 exists
9455set getpgrp2 d_getpgrp2
9456eval $inlibc
9457
9458: see if getppid exists
9459set getppid d_getppid
9460eval $inlibc
9461
9462: see if getpriority exists
9463set getpriority d_getprior
9464eval $inlibc
9465
9466: see if prototypes for various getprotoxxx netdb.h functions are available
9467echo " "
9468set d_getprotoprotos getprotoent $i_netdb netdb.h
9469eval $hasproto
9470
9471: see if getprpwnam exists
9472set getprpwnam d_getprpwnam
9473eval $inlibc
9474
9475: see if getpwent exists
9476set getpwent d_getpwent
9477eval $inlibc
9478
9479
9480: see if getservbyname exists
9481set getservbyname d_getsbyname
9482eval $inlibc
9483
9484: see if getservbyport exists
9485set getservbyport d_getsbyport
9486eval $inlibc
9487
9488: see if getservent exists
9489set getservent d_getsent
9490eval $inlibc
9491
9492: see if prototypes for various getservxxx netdb.h functions are available
9493echo " "
9494set d_getservprotos getservent $i_netdb netdb.h
9495eval $hasproto
9496
9497: see if getspnam exists
9498set getspnam d_getspnam
9499eval $inlibc
9500
9501: see if gettimeofday or ftime exists
9502set gettimeofday d_gettimeod
9503eval $inlibc
9504case "$d_gettimeod" in
9505"$undef")
9506 set ftime d_ftime
9507 eval $inlibc
9508 ;;
9509*)
9510 val="$undef"; set d_ftime; eval $setvar
9511 ;;
9512esac
9513case "$d_gettimeod$d_ftime" in
9514"$undef$undef")
9515 echo " "
9516 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9517 ;;
9518esac
9519
9520: see if this is an grp system
9521set grp.h i_grp
9522eval $inhdr
9523
9524case "$i_grp" in
9525$define)
9526 xxx=`./findhdr grp.h`
9527 $cppstdin $cppflags $cppminus < $xxx >$$.h
9528
9529 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9530 val="$define"
9531 else
9532 val="$undef"
9533 fi
9534 set d_grpasswd
9535 eval $setvar
9536
9537 $rm -f $$.h
9538 ;;
9539*)
9540 val="$undef";
9541 set d_grpasswd; eval $setvar
9542 ;;
9543esac
9544
9545: see if hasmntopt exists
9546set hasmntopt d_hasmntopt
9547eval $inlibc
9548
9549: see if this is a netinet/in.h or sys/in.h system
9550set netinet/in.h i_niin sys/in.h i_sysin
9551eval $inhdr
9552
9553: see if arpa/inet.h has to be included
9554set arpa/inet.h i_arpainet
9555eval $inhdr
9556
9557: see if htonl --and friends-- exists
9558val=''
9559set htonl val
9560eval $inlibc
9561
9562: Maybe they are macros.
9563case "$val" in
9564$undef)
9565 $cat >htonl.c <<EOM
9566#include <stdio.h>
9567#include <sys/types.h>
9568#$i_niin I_NETINET_IN
9569#$i_sysin I_SYS_IN
9570#$i_arpainet I_ARPA_INET
9571#ifdef I_NETINET_IN
9572#include <netinet/in.h>
9573#endif
9574#ifdef I_SYS_IN
9575#include <sys/in.h>
9576#endif
9577#ifdef I_ARPA_INET
9578#include <arpa/inet.h>
9579#endif
9580#ifdef htonl
9581printf("Defined as a macro.");
9582#endif
9583EOM
9584 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9585 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9586 val="$define"
9587 echo "But it seems to be defined as a macro." >&4
9588 fi
9589 $rm -f htonl.?
9590 ;;
9591esac
9592set d_htonl
9593eval $setvar
9594
9595: see if iconv exists
9596set iconv d_iconv
9597eval $inlibc
9598
9599: index or strchr
9600echo " "
9601if set index val -f; eval $csym; $val; then
9602 if set strchr val -f d_strchr; eval $csym; $val; then
9603 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9604 val="$define"
9605 vali="$undef"
9606 echo "strchr() found." >&4
9607 else
9608 val="$undef"
9609 vali="$define"
9610 echo "index() found." >&4
9611 fi
9612 else
9613 val="$undef"
9614 vali="$define"
9615 echo "index() found." >&4
9616 fi
9617else
9618 if set strchr val -f d_strchr; eval $csym; $val; then
9619 val="$define"
9620 vali="$undef"
9621 echo "strchr() found." >&4
9622 else
9623 echo "No index() or strchr() found!" >&4
9624 val="$undef"
9625 vali="$undef"
9626 fi
9627fi
9628set d_strchr; eval $setvar
9629val="$vali"
9630set d_index; eval $setvar
9631
9632: check whether inet_aton exists
9633set inet_aton d_inetaton
9634eval $inlibc
9635
9636: see if inttypes.h is available
9637: we want a real compile instead of Inhdr because some systems
9638: have an inttypes.h which includes non-existent headers
9639echo " "
9640$cat >try.c <<EOCP
9641#include <inttypes.h>
9642int main() {
9643 static int32_t foo32 = 0x12345678;
9644}
9645EOCP
9646set try
9647if eval $compile; then
9648 echo "<inttypes.h> found." >&4
9649 val="$define"
9650else
9651 echo "<inttypes.h> NOT found." >&4
9652 val="$undef"
9653fi
9654$rm -f try.c try
9655set i_inttypes
9656eval $setvar
9657
9658: check for int64_t
9659echo " "
9660echo "Checking to see if you have int64_t..." >&4
9661$cat >try.c <<EOCP
9662#include <sys/types.h>
9663#$i_inttypes I_INTTYPES
9664#ifdef I_INTTYPES
9665#include <inttypes.h>
9666#endif
9667int main() { int64_t x = 7; }
9668EOCP
9669set try
9670if eval $compile; then
9671 val="$define"
9672 echo "You have int64_t."
9673else
9674 val="$undef"
9675 echo "You do not have int64_t."
9676fi
9677$rm -f try try.*
9678set d_int64_t
9679eval $setvar
9680
9681: Look for isascii
9682echo " "
9683$cat >isascii.c <<'EOCP'
9684#include <stdio.h>
9685#include <ctype.h>
9686int main() {
9687 int c = 'A';
9688 if (isascii(c))
9689 exit(0);
9690 else
9691 exit(1);
9692}
9693EOCP
9694set isascii
9695if eval $compile; then
9696 echo "isascii() found." >&4
9697 val="$define"
9698else
9699 echo "isascii() NOT found." >&4
9700 val="$undef"
9701fi
9702set d_isascii
9703eval $setvar
9704$rm -f isascii*
9705
9706: see if isnan exists
9707set isnan d_isnan
9708eval $inlibc
9709
9710: see if isnanl exists
9711set isnanl d_isnanl
9712eval $inlibc
9713
9714: see if killpg exists
9715set killpg d_killpg
9716eval $inlibc
9717
9718: see if lchown exists
9719echo " "
9720$cat > try.c <<'EOCP'
9721/* System header to define __stub macros and hopefully few prototypes,
9722 which can conflict with char lchown(); below. */
9723#include <assert.h>
9724/* Override any gcc2 internal prototype to avoid an error. */
9725/* We use char because int might match the return type of a gcc2
9726 builtin and then its argument prototype would still apply. */
9727char lchown();
9728int main() {
9729 /* The GNU C library defines this for functions which it implements
9730 to always fail with ENOSYS. Some functions are actually named
9731 something starting with __ and the normal name is an alias. */
9732#if defined (__stub_lchown) || defined (__stub___lchown)
9733choke me
9734#else
9735lchown();
9736#endif
9737; return 0; }
9738EOCP
9739set try
9740if eval $compile; then
9741 $echo "lchown() found." >&4
9742 val="$define"
9743else
9744 $echo "lchown() NOT found." >&4
9745 val="$undef"
9746fi
9747set d_lchown
9748eval $setvar
9749
9750: See if number of significant digits in a double precision number is known
9751echo " "
9752$cat >ldbl_dig.c <<EOM
9753#$i_limits I_LIMITS
9754#$i_float I_FLOAT
9755#ifdef I_LIMITS
9756#include <limits.h>
9757#endif
9758#ifdef I_FLOAT
9759#include <float.h>
9760#endif
9761#ifdef LDBL_DIG
9762printf("Contains LDBL_DIG");
9763#endif
9764EOM
9765$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9766if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9767 echo "LDBL_DIG found." >&4
9768 val="$define"
9769else
9770 echo "LDBL_DIG NOT found." >&4
9771 val="$undef"
9772fi
9773$rm -f ldbl_dig.?
9774set d_ldbl_dig
9775eval $setvar
9776
9777: see if link exists
9778set link d_link
9779eval $inlibc
9780
9781: see if localeconv exists
9782set localeconv d_locconv
9783eval $inlibc
9784
9785: see if lockf exists
9786set lockf d_lockf
9787eval $inlibc
9788
9789: check for long long
9790echo " "
9791echo "Checking to see if you have long long..." >&4
9792echo 'int main() { long long x = 7; return 0; }' > try.c
9793set try
9794if eval $compile; then
9795 val="$define"
9796 echo "You have long long."
9797else
9798 val="$undef"
9799 echo "You do not have long long."
9800fi
9801$rm try.*
9802set d_longlong
9803eval $setvar
9804
9805: check for length of long long
9806case "${d_longlong}${longlongsize}" in
9807$define)
9808 echo " "
9809 echo "Checking to see how big your long longs are..." >&4
9810 $cat >try.c <<'EOCP'
9811#include <stdio.h>
9812int main()
9813{
9814 printf("%d\n", (int)sizeof(long long));
9815 return(0);
9816}
9817EOCP
9818 set try
9819 if eval $compile_ok; then
9820 longlongsize=`./try$exe_ext`
9821 echo "Your long longs are $longlongsize bytes long."
9822 else
9823 dflt='8'
9824 echo " "
9825 echo "(I can't seem to compile the test program. Guessing...)"
9826 rp="What is the size of a long long (in bytes)?"
9827 . ./myread
9828 longlongsize="$ans"
9829 fi
9830 if $test "X$longsize" = "X$longlongsize"; then
9831 echo "(That isn't any different from an ordinary long.)"
9832 fi
9833 ;;
9834esac
9835$rm -f try.* try
9836
9837: see if prototype for lseek is available
9838echo " "
9839set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9840eval $hasproto
9841
9842: see if lstat exists
9843set lstat d_lstat
9844eval $inlibc
9845
9846: see if madvise exists
9847set madvise d_madvise
9848eval $inlibc
9849
9850: see if mblen exists
9851set mblen d_mblen
9852eval $inlibc
9853
9854: see if mbstowcs exists
9855set mbstowcs d_mbstowcs
9856eval $inlibc
9857
9858: see if mbtowc exists
9859set mbtowc d_mbtowc
9860eval $inlibc
9861
9862: see if memchr exists
9863set memchr d_memchr
9864eval $inlibc
9865
9866: see if memcmp exists
9867set memcmp d_memcmp
9868eval $inlibc
9869
9870: see if memcpy exists
9871set memcpy d_memcpy
9872eval $inlibc
9873
9874: see if memmove exists
9875set memmove d_memmove
9876eval $inlibc
9877
9878: see if memset exists
9879set memset d_memset
9880eval $inlibc
9881
9882: see if mkdir exists
9883set mkdir d_mkdir
9884eval $inlibc
9885
9886: see if mkdtemp exists
9887set mkdtemp d_mkdtemp
9888eval $inlibc
9889
9890: see if mkfifo exists
9891set mkfifo d_mkfifo
9892eval $inlibc
9893
9894: see if mkstemp exists
9895set mkstemp d_mkstemp
9896eval $inlibc
9897
9898: see if mkstemps exists
9899set mkstemps d_mkstemps
9900eval $inlibc
9901
9902: see if mktime exists
9903set mktime d_mktime
9904eval $inlibc
9905
9906: see if this is a sys/mman.h system
9907set sys/mman.h i_sysmman
9908eval $inhdr
9909
9910: see if mmap exists
9911set mmap d_mmap
9912eval $inlibc
9913: see what shmat returns
9914: default to something harmless
9915mmaptype='void *'
9916case "$i_sysmman$d_mmap" in
9917"$define$define")
9918 $cat >mmap.c <<'END'
9919#include <sys/mman.h>
9920void *mmap();
9921END
9922 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9923 mmaptype='void *'
9924 else
9925 mmaptype='caddr_t'
9926 fi
9927 echo "and it returns ($mmaptype)." >&4
9928 ;;
9929esac
9930
9931
9932
9933: see if modfl exists
9934set modfl d_modfl
9935eval $inlibc
9936
9937: see if mprotect exists
9938set mprotect d_mprotect
9939eval $inlibc
9940
9941: see if msgctl exists
9942set msgctl d_msgctl
9943eval $inlibc
9944
9945: see if msgget exists
9946set msgget d_msgget
9947eval $inlibc
9948
9949: see if msgsnd exists
9950set msgsnd d_msgsnd
9951eval $inlibc
9952
9953: see if msgrcv exists
9954set msgrcv d_msgrcv
9955eval $inlibc
9956
9957: see how much of the 'msg*(2)' library is present.
9958h_msg=true
9959echo " "
9960case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9961*"$undef"*) h_msg=false;;
9962esac
9963case "$osname" in
9964freebsd)
9965 case "`ipcs 2>&1`" in
9966 "SVID messages"*"not configured"*)
9967 echo "Your $osname does not have the msg*(2) configured." >&4
9968 h_msg=false
9969 val="$undef"
9970 set msgctl d_msgctl
9971 eval $setvar
9972 set msgget d_msgget
9973 eval $setvar
9974 set msgsnd d_msgsnd
9975 eval $setvar
9976 set msgrcv d_msgrcv
9977 eval $setvar
9978 ;;
9979 esac
9980 ;;
9981esac
9982: we could also check for sys/ipc.h ...
9983if $h_msg && $test `./findhdr sys/msg.h`; then
9984 echo "You have the full msg*(2) library." >&4
9985 val="$define"
9986else
9987 echo "You don't have the full msg*(2) library." >&4
9988 val="$undef"
9989fi
9990set d_msg
9991eval $setvar
9992
9993: see if msync exists
9994set msync d_msync
9995eval $inlibc
9996
9997: see if munmap exists
9998set munmap d_munmap
9999eval $inlibc
10000
10001: see if nice exists
10002set nice d_nice
10003eval $inlibc
10004
10005
10006echo " "
10007echo "Checking which 64-bit integer type we could use..." >&4
10008
10009case "$intsize" in
100108) val=int
10011 set quadtype
10012 eval $setvar
10013 val='"unsigned int"'
10014 set uquadtype
10015 eval $setvar
10016 quadkind=1
10017 ;;
10018*) case "$longsize" in
10019 8) val=long
10020 set quadtype
10021 eval $setvar
10022 val='"unsigned long"'
10023 set uquadtype
10024 eval $setvar
10025 quadkind=2
10026 ;;
10027 *) case "$d_longlong:$longlongsize" in
10028 define:8)
10029 val='"long long"'
10030 set quadtype
10031 eval $setvar
10032 val='"unsigned long long"'
10033 set uquadtype
10034 eval $setvar
10035 quadkind=3
10036 ;;
10037 *) case "$d_int64_t" in
10038 define)
10039 val=int64_t
10040 set quadtype
10041 eval $setvar
10042 val=uint64_t
10043 set uquadtype
10044 eval $setvar
10045 quadkind=4
10046 ;;
10047 esac
10048 ;;
10049 esac
10050 ;;
10051 esac
10052 ;;
10053esac
10054
10055case "$quadtype" in
10056'') echo "Alas, no 64-bit integer types in sight." >&4
10057 d_quad="$undef"
10058 ;;
10059*) if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10060 verb="will"
10061 else
10062 verb="could"
10063 fi
10064 echo "We $verb use '$quadtype' for 64-bit integers." >&4
10065 d_quad="$define"
10066 ;;
10067esac
10068
10069: check for length of character
10070echo " "
10071case "$charsize" in
10072'')
10073 echo "Checking to see how big your characters are (hey, you never know)..." >&4
10074 $cat >try.c <<'EOCP'
10075#include <stdio.h>
10076int main()
10077{
10078 printf("%d\n", (int)sizeof(char));
10079 exit(0);
10080}
10081EOCP
10082 set try
10083 if eval $compile_ok; then
10084 dflt=`./try`
10085 else
10086 dflt='1'
10087 echo "(I can't seem to compile the test program. Guessing...)"
10088 fi
10089 ;;
10090*)
10091 dflt="$charsize"
10092 ;;
10093esac
10094rp="What is the size of a character (in bytes)?"
10095. ./myread
10096charsize="$ans"
10097$rm -f try.c try
10098
10099
10100echo " "
10101$echo "Choosing the C types to be used for Perl's internal types..." >&4
10102
10103case "$use64bitint:$d_quad:$quadtype" in
10104define:define:?*)
10105 ivtype="$quadtype"
10106 uvtype="$uquadtype"
10107 ivsize=8
10108 uvsize=8
10109 ;;
10110*) ivtype="long"
10111 uvtype="unsigned long"
10112 ivsize=$longsize
10113 uvsize=$longsize
10114 ;;
10115esac
10116
10117case "$uselongdouble:$d_longdbl" in
10118define:define)
10119 nvtype="long double"
10120 nvsize=$longdblsize
10121 ;;
10122*) nvtype=double
10123 nvsize=$doublesize
10124 ;;
10125esac
10126
10127$echo "(IV will be "$ivtype", $ivsize bytes)"
10128$echo "(UV will be "$uvtype", $uvsize bytes)"
10129$echo "(NV will be "$nvtype", $nvsize bytes)"
10130
10131$cat >try.c <<EOCP
10132#$i_inttypes I_INTTYPES
10133#ifdef I_INTTYPES
10134#include <inttypes.h>
10135#endif
10136#include <stdio.h>
10137int main() {
10138#ifdef INT8
10139 int8_t i = INT8_MAX;
10140 uint8_t u = UINT8_MAX;
10141 printf("int8_t\n");
10142#endif
10143#ifdef INT16
10144 int16_t i = INT16_MAX;
10145 uint16_t i = UINT16_MAX;
10146 printf("int16_t\n");
10147#endif
10148#ifdef INT32
10149 int32_t i = INT32_MAX;
10150 uint32_t u = UINT32_MAX;
10151 printf("int32_t\n");
10152#endif
10153}
10154EOCP
10155
10156case "$i8type" in
10157'') case "$charsize" in
10158 1) i8type=char
10159 u8type="unsigned char"
10160 i8size=$charsize
10161 u8size=$charsize
10162 ;;
10163 esac
10164 ;;
10165esac
10166case "$i8type" in
10167'') set try -DINT8
10168 if eval $compile; then
10169 case "`./try$exe_ext`" in
10170 int8_t) i8type=int8_t
10171 u8type=uint8_t
10172 i8size=1
10173 u8size=1
10174 ;;
10175 esac
10176 fi
10177 ;;
10178esac
10179case "$i8type" in
10180'') if $test $charsize -ge 1; then
10181 i8type=char
10182 u8type="unsigned char"
10183 i8size=$charsize
10184 u8size=$charsize
10185 fi
10186 ;;
10187esac
10188
10189case "$i16type" in
10190'') case "$shortsize" in
10191 2) i16type=short
10192 u16type="unsigned short"
10193 i16size=$shortsize
10194 u16size=$shortsize
10195 ;;
10196 esac
10197 ;;
10198esac
10199case "$i16type" in
10200'') set try -DINT16
10201 if eval $compile; then
10202 case "`./try$exe_ext`" in
10203 int16_t)
10204 i16type=int16_t
10205 u16type=uint16_t
10206 i16size=2
10207 u16size=2
10208 ;;
10209 esac
10210 fi
10211 ;;
10212esac
10213case "$i16type" in
10214'') if $test $shortsize -ge 2; then
10215 i16type=short
10216 u16type="unsigned short"
10217 i16size=$shortsize
10218 u16size=$shortsize
10219 fi
10220 ;;
10221esac
10222
10223case "$i32type" in
10224'') case "$longsize" in
10225 4) i32type=long
10226 u32type="unsigned long"
10227 i32size=$longsize
10228 u32size=$longsize
10229 ;;
10230 *) case "$intsize" in
10231 4) i32type=int
10232 u32type="unsigned int"
10233 i32size=$intsize
10234 u32size=$intsize
10235 ;;
10236 esac
10237 ;;
10238 esac
10239 ;;
10240esac
10241case "$i32type" in
10242'') set try -DINT32
10243 if eval $compile; then
10244 case "`./try$exe_ext`" in
10245 int32_t)
10246 i32type=int32_t
10247 u32type=uint32_t
10248 i32size=4
10249 u32size=4
10250 ;;
10251 esac
10252 fi
10253 ;;
10254esac
10255case "$i32type" in
10256'') if $test $intsize -ge 4; then
10257 i32type=int
10258 u32type="unsigned int"
10259 i32size=$intsize
10260 u32size=$intsize
10261 fi
10262 ;;
10263esac
10264
10265case "$i64type" in
10266'') case "$d_quad:$quadtype" in
10267 define:?*)
10268 i64type="$quadtype"
10269 u64type="$uquadtype"
10270 i64size=8
10271 u64size=8
10272 ;;
10273 esac
10274 ;;
10275esac
10276
10277$echo "Checking whether your NVs can preserve your UVs..." >&4
10278$cat <<EOP >try.c
10279#include <stdio.h>
10280int main() {
10281 $uvtype k = ($uvtype)~0, l;
10282 $nvtype d;
10283 l = k;
10284 d = ($nvtype)l;
10285 l = ($uvtype)d;
10286 if (l == k)
10287 printf("preserve\n");
10288 exit(0);
10289}
10290EOP
10291set try
10292if eval $compile; then
10293 case "`./try$exe_ext`" in
10294 preserve) d_nv_preserves_uv="$define" ;;
10295 esac
10296fi
10297case "$d_nv_preserves_uv" in
10298$define) $echo "Yes, they can." 2>&1 ;;
10299*) $echo "No, they can't." 2>&1
10300 d_nv_preserves_uv="$undef"
10301 ;;
10302esac
10303
10304$rm -f try.* try
10305
10306case "$d_nv_preserves_uv" in
10307"$define") d_nv_preserves_uv_bits=`expr $uvsize \* 8` ;;
10308*) $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10309 $cat <<EOP >try.c
10310#include <stdio.h>
10311int main() {
10312 $uvtype u = 0;
10313 int n = 8 * $uvsize;
10314 int i;
10315 for (i = 0; i < n; i++) {
10316 u = u << 1 | ($uvtype)1;
10317 if (($uvtype)($nvtype)u != u)
10318 break;
10319 }
10320 printf("%d\n", i);
10321 exit(0);
10322}
10323EOP
10324 set try
10325 if eval $compile; then
10326 d_nv_preserves_uv_bits="`./try$exe_ext`"
10327 fi
10328 case "$d_nv_preserves_uv_bits" in
10329 [1-9]*) $echo "Your NVs can preserve $d_nv_preserves_uv_bits bits of your UVs." 2>&1 ;;
10330 *) $echo "Can't figure out how many bits your NVs preserve." 2>&1
10331 d_nv_preserves_uv_bits="$undef"
10332 ;;
10333 esac
10334 $rm -f try.* try
10335 ;;
10336esac
10337
10338
10339: check for off64_t
10340echo " "
10341echo "Checking to see if you have off64_t..." >&4
10342$cat >try.c <<EOCP
10343#include <sys/types.h>
10344#include <unistd.h>
10345int main() { off64_t x = 7; }
10346EOCP
10347set try
10348if eval $compile; then
10349 val="$define"
10350 echo "You have off64_t."
10351else
10352 val="$undef"
10353 echo "You do not have off64_t."
10354 case "$lseeksize" in
10355 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10356 esac
10357fi
10358$rm -f try.* try
10359set d_off64_t
10360eval $setvar
10361
10362: see if POSIX threads are available
10363set pthread.h i_pthread
10364eval $inhdr
10365
10366
10367
10368
10369: how to create joinable pthreads
10370if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10371 echo " "
10372 echo "Checking what constant to use for creating joinable pthreads..." >&4
10373 $cat >try.c <<'EOCP'
10374#include <pthread.h>
10375int main() {
10376 int detachstate = JOINABLE;
10377}
10378EOCP
10379 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10380 if eval $compile; then
10381 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10382 val="$undef" # Yes, undef.
10383 set d_old_pthread_create_joinable
10384 eval $setvar
10385 val=""
10386 set old_pthread_create_joinable
10387 eval $setvar
10388 else
10389 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10390 if eval $compile; then
10391 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10392 val="$define"
10393 set d_old_pthread_create_joinable
10394 eval $setvar
10395 val=PTHREAD_CREATE_UNDETACHED
10396 set old_pthread_create_joinable
10397 eval $setvar
10398 else
10399 set try -DJOINABLE=__UNDETACHED
10400 if eval $compile; then
10401 echo "You seem to use __UNDETACHED." >&4
10402 val="$define"
10403 set d_old_pthread_create_joinable
10404 eval $setvar
10405 val=__UNDETACHED
10406 set old_pthread_create_joinable
10407 eval $setvar
10408 else
10409 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
10410 val="$define"
10411 set d_old_pthread_create_joinable
10412 eval $setvar
10413 val=0
10414 set old_pthread_create_joinable
10415 eval $setvar
10416 fi
10417 fi
10418 fi
10419 $rm -f try try.*
10420else
10421 d_old_pthread_create_joinable="$undef"
10422 old_pthread_create_joinable=""
10423fi
10424
10425: see if pause exists
10426set pause d_pause
10427eval $inlibc
10428
10429: see if pipe exists
10430set pipe d_pipe
10431eval $inlibc
10432
10433: see if poll exists
10434set poll d_poll
10435eval $inlibc
10436
10437
10438: see whether the various POSIXish _yields exist
10439$cat >try.c <<EOP
10440#include <pthread.h>
10441#include <stdio.h>
10442int main() {
10443#ifdef SCHED_YIELD
10444 sched_yield();
10445#else
10446#ifdef PTHREAD_YIELD
10447 pthread_yield();
10448#else
10449#ifdef PTHREAD_YIELD_NULL
10450 pthread_yield(NULL);
10451#endif
10452#endif
10453#endif
10454}
10455EOP
10456: see if sched_yield exists
10457set try -DSCHED_YIELD
10458if eval $compile; then
10459 val="$define"
10460 sched_yield='sched_yield()'
10461else
10462 val="$undef"
10463fi
10464case "$usethreads" in
10465$define)
10466 case "$val" in
10467 $define) echo 'sched_yield() found.' >&4 ;;
10468 *) echo 'sched_yield() NOT found.' >&4 ;;
10469 esac
10470esac
10471set d_sched_yield
10472eval $setvar
10473
10474: see if pthread_yield exists
10475set try -DPTHREAD_YIELD
10476if eval $compile; then
10477 val="$define"
10478 case "$sched_yield" in
10479 '') sched_yield='pthread_yield()' ;;
10480 esac
10481else
10482 set try -DPTHREAD_YIELD_NULL
10483 if eval $compile; then
10484 val="$define"
10485 case "$sched_yield" in
10486 '') sched_yield='pthread_yield(NULL)' ;;
10487 esac
10488 else
10489 val="$undef"
10490 fi
10491fi
10492case "$usethreads" in
10493$define)
10494 case "$val" in
10495 $define) echo 'pthread_yield() found.' >&4 ;;
10496 *) echo 'pthread_yield() NOT found.' >&4 ;;
10497 esac
10498 ;;
10499esac
10500set d_pthread_yield
10501eval $setvar
10502
10503case "$sched_yield" in
10504'') sched_yield=undef ;;
10505esac
10506
10507$rm -f try try.*
10508
10509: see if this is a pwd.h system
10510set pwd.h i_pwd
10511eval $inhdr
10512
10513case "$i_pwd" in
10514$define)
10515 xxx=`./findhdr pwd.h`
10516 $cppstdin $cppflags $cppminus < $xxx >$$.h
10517
10518 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10519 val="$define"
10520 else
10521 val="$undef"
10522 fi
10523 set d_pwquota
10524 eval $setvar
10525
10526 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10527 val="$define"
10528 else
10529 val="$undef"
10530 fi
10531 set d_pwage
10532 eval $setvar
10533
10534 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10535 val="$define"
10536 else
10537 val="$undef"
10538 fi
10539 set d_pwchange
10540 eval $setvar
10541
10542 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10543 val="$define"
10544 else
10545 val="$undef"
10546 fi
10547 set d_pwclass
10548 eval $setvar
10549
10550 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10551 val="$define"
10552 else
10553 val="$undef"
10554 fi
10555 set d_pwexpire
10556 eval $setvar
10557
10558 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10559 val="$define"
10560 else
10561 val="$undef"
10562 fi
10563 set d_pwcomment
10564 eval $setvar
10565
10566 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10567 val="$define"
10568 else
10569 val="$undef"
10570 fi
10571 set d_pwgecos
10572 eval $setvar
10573
10574 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10575 val="$define"
10576 else
10577 val="$undef"
10578 fi
10579 set d_pwpasswd
10580 eval $setvar
10581
10582 $rm -f $$.h
10583 ;;
10584*)
10585 val="$undef";
10586 set d_pwquota; eval $setvar
10587 set d_pwage; eval $setvar
10588 set d_pwchange; eval $setvar
10589 set d_pwclass; eval $setvar
10590 set d_pwexpire; eval $setvar
10591 set d_pwcomment; eval $setvar
10592 set d_pwgecos; eval $setvar
10593 set d_pwpasswd; eval $setvar
10594 ;;
10595esac
10596
10597: see if readdir and friends exist
10598set readdir d_readdir
10599eval $inlibc
10600set seekdir d_seekdir
10601eval $inlibc
10602set telldir d_telldir
10603eval $inlibc
10604set rewinddir d_rewinddir
10605eval $inlibc
10606
10607: see if readlink exists
10608set readlink d_readlink
10609eval $inlibc
10610
10611: see if rename exists
10612set rename d_rename
10613eval $inlibc
10614
10615: see if rmdir exists
10616set rmdir d_rmdir
10617eval $inlibc
10618
10619: see if memory.h is available.
10620val=''
10621set memory.h val
10622eval $inhdr
10623
10624: See if it conflicts with string.h
10625case "$val" in
10626$define)
10627 case "$strings" in
10628 '') ;;
10629 *)
10630 $cppstdin $cppflags $cppminus < $strings > mem.h
10631 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10632 echo " "
10633 echo "We won't be including <memory.h>."
10634 val="$undef"
10635 fi
10636 $rm -f mem.h
10637 ;;
10638 esac
10639esac
10640set i_memory
10641eval $setvar
10642
10643: can bcopy handle overlapping blocks?
10644val="$undef"
10645case "$d_bcopy" in
10646"$define")
10647 echo " "
10648 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10649 $cat >try.c <<EOCP
10650#$i_memory I_MEMORY
10651#$i_stdlib I_STDLIB
10652#$i_string I_STRING
10653#$i_unistd I_UNISTD
10654EOCP
10655 $cat >>try.c <<'EOCP'
10656#include <stdio.h>
10657#ifdef I_MEMORY
10658# include <memory.h>
10659#endif
10660#ifdef I_STDLIB
10661# include <stdlib.h>
10662#endif
10663#ifdef I_STRING
10664# include <string.h>
10665#else
10666# include <strings.h>
10667#endif
10668#ifdef I_UNISTD
10669# include <unistd.h> /* Needed for NetBSD */
10670#endif
10671int main()
10672{
10673char buf[128], abc[128];
10674char *b;
10675int len;
10676int off;
10677int align;
10678
10679bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10680
10681for (align = 7; align >= 0; align--) {
10682 for (len = 36; len; len--) {
10683 b = buf+align;
10684 bcopy(abc, b, len);
10685 for (off = 1; off <= len; off++) {
10686 bcopy(b, b+off, len);
10687 bcopy(b+off, b, len);
10688 if (bcmp(b, abc, len))
10689 exit(1);
10690 }
10691 }
10692}
10693exit(0);
10694}
10695EOCP
10696 set try
10697 if eval $compile_ok; then
10698 if ./try 2>/dev/null; then
10699 echo "Yes, it can."
10700 val="$define"
10701 else
10702 echo "It can't, sorry."
10703 case "$d_memmove" in
10704 "$define") echo "But that's Ok since you have memmove()." ;;
10705 esac
10706 fi
10707 else
10708 echo "(I can't compile the test program, so we'll assume not...)"
10709 case "$d_memmove" in
10710 "$define") echo "But that's Ok since you have memmove()." ;;
10711 esac
10712 fi
10713 ;;
10714esac
10715$rm -f try.* try core
10716set d_safebcpy
10717eval $setvar
10718
10719: can memcpy handle overlapping blocks?
10720val="$undef"
10721case "$d_memcpy" in
10722"$define")
10723 echo " "
10724 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10725 $cat >try.c <<EOCP
10726#$i_memory I_MEMORY
10727#$i_stdlib I_STDLIB
10728#$i_string I_STRING
10729#$i_unistd I_UNISTD
10730EOCP
10731 $cat >>try.c <<'EOCP'
10732#include <stdio.h>
10733#ifdef I_MEMORY
10734# include <memory.h>
10735#endif
10736#ifdef I_STDLIB
10737# include <stdlib.h>
10738#endif
10739#ifdef I_STRING
10740# include <string.h>
10741#else
10742# include <strings.h>
10743#endif
10744#ifdef I_UNISTD
10745# include <unistd.h> /* Needed for NetBSD */
10746#endif
10747int main()
10748{
10749char buf[128], abc[128];
10750char *b;
10751int len;
10752int off;
10753int align;
10754
10755/* Copy "abcde..." string to char abc[] so that gcc doesn't
10756 try to store the string in read-only memory. */
10757memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10758
10759for (align = 7; align >= 0; align--) {
10760 for (len = 36; len; len--) {
10761 b = buf+align;
10762 memcpy(b, abc, len);
10763 for (off = 1; off <= len; off++) {
10764 memcpy(b+off, b, len);
10765 memcpy(b, b+off, len);
10766 if (memcmp(b, abc, len))
10767 exit(1);
10768 }
10769 }
10770}
10771exit(0);
10772}
10773EOCP
10774 set try
10775 if eval $compile_ok; then
10776 if ./try 2>/dev/null; then
10777 echo "Yes, it can."
10778 val="$define"
10779 else
10780 echo "It can't, sorry."
10781 case "$d_memmove" in
10782 "$define") echo "But that's Ok since you have memmove()." ;;
10783 esac
10784 fi
10785 else
10786 echo "(I can't compile the test program, so we'll assume not...)"
10787 case "$d_memmove" in
10788 "$define") echo "But that's Ok since you have memmove()." ;;
10789 esac
10790 fi
10791 ;;
10792esac
10793$rm -f try.* try core
10794set d_safemcpy
10795eval $setvar
10796
10797: can memcmp be trusted to compare relative magnitude?
10798val="$undef"
10799case "$d_memcmp" in
10800"$define")
10801 echo " "
10802 echo "Checking if your memcmp() can compare relative magnitude..." >&4
10803 $cat >try.c <<EOCP
10804#$i_memory I_MEMORY
10805#$i_stdlib I_STDLIB
10806#$i_string I_STRING
10807#$i_unistd I_UNISTD
10808EOCP
10809 $cat >>try.c <<'EOCP'
10810#include <stdio.h>
10811#ifdef I_MEMORY
10812# include <memory.h>
10813#endif
10814#ifdef I_STDLIB
10815# include <stdlib.h>
10816#endif
10817#ifdef I_STRING
10818# include <string.h>
10819#else
10820# include <strings.h>
10821#endif
10822#ifdef I_UNISTD
10823# include <unistd.h> /* Needed for NetBSD */
10824#endif
10825int main()
10826{
10827char a = -1;
10828char b = 0;
10829if ((a < b) && memcmp(&a, &b, 1) < 0)
10830 exit(1);
10831exit(0);
10832}
10833EOCP
10834 set try
10835 if eval $compile_ok; then
10836 if ./try 2>/dev/null; then
10837 echo "Yes, it can."
10838 val="$define"
10839 else
10840 echo "No, it can't (it uses signed chars)."
10841 fi
10842 else
10843 echo "(I can't compile the test program, so we'll assume not...)"
10844 fi
10845 ;;
10846esac
10847$rm -f try.* try core
10848set d_sanemcmp
10849eval $setvar
10850
10851: see if select exists
10852set select d_select
10853eval $inlibc
10854
10855: see if semctl exists
10856set semctl d_semctl
10857eval $inlibc
10858
10859: see if semget exists
10860set semget d_semget
10861eval $inlibc
10862
10863: see if semop exists
10864set semop d_semop
10865eval $inlibc
10866
10867: see how much of the 'sem*(2)' library is present.
10868h_sem=true
10869echo " "
10870case "$d_semctl$d_semget$d_semop" in
10871*"$undef"*) h_sem=false;;
10872esac
10873case "$osname" in
10874freebsd)
10875 case "`ipcs 2>&1`" in
10876 "SVID messages"*"not configured"*)
10877 echo "Your $osname does not have the sem*(2) configured." >&4
10878 h_sem=false
10879 val="$undef"
10880 set semctl d_semctl
10881 eval $setvar
10882 set semget d_semget
10883 eval $setvar
10884 set semop d_semop
10885 eval $setvar
10886 ;;
10887 esac
10888 ;;
10889esac
10890: we could also check for sys/ipc.h ...
10891if $h_sem && $test `./findhdr sys/sem.h`; then
10892 echo "You have the full sem*(2) library." >&4
10893 val="$define"
10894else
10895 echo "You don't have the full sem*(2) library." >&4
10896 val="$undef"
10897fi
10898set d_sem
10899eval $setvar
10900
10901: see whether sys/sem.h defines union semun
10902echo " "
10903$cat > try.c <<'END'
10904#include <sys/types.h>
10905#include <sys/ipc.h>
10906#include <sys/sem.h>
10907int main () { union semun semun; semun.buf = 0; }
10908END
10909set try
10910if eval $compile; then
10911 echo "You have union semun in <sys/sem.h>." >&4
10912 val="$define"
10913else
10914 echo "You do not have union semun in <sys/sem.h>." >&4
10915 val="$undef"
10916fi
10917$rm -f try try.c try.h
10918set d_union_semun
10919eval $setvar
10920
10921: see how to do semctl IPC_STAT
10922case "$d_sem" in
10923$define)
10924 : see whether semctl IPC_STAT can use union semun
10925 echo " "
10926 $cat > try.h <<END
10927#ifndef S_IRUSR
10928# ifdef S_IREAD
10929# define S_IRUSR S_IREAD
10930# define S_IWUSR S_IWRITE
10931# define S_IXUSR S_IEXEC
10932# else
10933# define S_IRUSR 0400
10934# define S_IWUSR 0200
10935# define S_IXUSR 0100
10936# endif
10937# define S_IRGRP (S_IRUSR>>3)
10938# define S_IWGRP (S_IWUSR>>3)
10939# define S_IXGRP (S_IXUSR>>3)
10940# define S_IROTH (S_IRUSR>>6)
10941# define S_IWOTH (S_IWUSR>>6)
10942# define S_IXOTH (S_IXUSR>>6)
10943#endif
10944#ifndef S_IRWXU
10945# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10946# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10947# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10948#endif
10949END
10950
10951 $cat > try.c <<END
10952#include <sys/types.h>
10953#include <sys/ipc.h>
10954#include <sys/sem.h>
10955#include <sys/stat.h>
10956#include <stdio.h>
10957#include <errno.h>
10958#include "try.h"
10959#ifndef errno
10960extern int errno;
10961#endif
10962#$d_union_semun HAS_UNION_SEMUN
10963int main() {
10964 union semun
10965#ifndef HAS_UNION_SEMUN
10966 {
10967 int val;
10968 struct semid_ds *buf;
10969 unsigned short *array;
10970 }
10971#endif
10972 arg;
10973 int sem, st;
10974
10975#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10976 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10977 if (sem > -1) {
10978 struct semid_ds argbuf;
10979 arg.buf = &argbuf;
10980# ifdef IPC_STAT
10981 st = semctl(sem, 0, IPC_STAT, arg);
10982 if (st == 0)
10983 printf("semun\n");
10984 else
10985# endif /* IPC_STAT */
10986 printf("semctl IPC_STAT failed: errno = %d\n", errno);
10987# ifdef IPC_RMID
10988 if (semctl(sem, 0, IPC_RMID, arg) != 0)
10989# endif /* IPC_RMID */
10990 printf("semctl IPC_RMID failed: errno = %d\n", errno);
10991 } else
10992#endif /* IPC_PRIVATE && ... */
10993 printf("semget failed: errno = %d\n", errno);
10994 return 0;
10995}
10996END
10997 val="$undef"
10998 set try
10999 if eval $compile; then
11000 xxx=`./try`
11001 case "$xxx" in
11002 semun) val="$define" ;;
11003 esac
11004 fi
11005 $rm -f try try.c
11006 set d_semctl_semun
11007 eval $setvar
11008 case "$d_semctl_semun" in
11009 $define)
11010 echo "You can use union semun for semctl IPC_STAT." >&4
11011 also='also'
11012 ;;
11013 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
11014 also=''
11015 ;;
11016 esac
11017
11018 : see whether semctl IPC_STAT can use struct semid_ds pointer
11019 $cat > try.c <<'END'
11020#include <sys/types.h>
11021#include <sys/ipc.h>
11022#include <sys/sem.h>
11023#include <sys/stat.h>
11024#include "try.h"
11025#include <stdio.h>
11026#include <errno.h>
11027#ifndef errno
11028extern int errno;
11029#endif
11030int main() {
11031 struct semid_ds arg;
11032 int sem, st;
11033
11034#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11035 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11036 if (sem > -1) {
11037# ifdef IPC_STAT
11038 st = semctl(sem, 0, IPC_STAT, &arg);
11039 if (st == 0)
11040 printf("semid_ds\n");
11041 else
11042# endif /* IPC_STAT */
11043 printf("semctl IPC_STAT failed: errno = %d\n", errno);
11044# ifdef IPC_RMID
11045 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11046# endif /* IPC_RMID */
11047 printf("semctl IPC_RMID failed: errno = %d\n", errno);
11048 } else
11049#endif /* IPC_PRIVATE && ... */
11050 printf("semget failed: errno = %d\n", errno);
11051
11052 return 0;
11053}
11054END
11055 val="$undef"
11056 set try
11057 if eval $compile; then
11058 xxx=`./try`
11059 case "$xxx" in
11060 semid_ds) val="$define" ;;
11061 esac
11062 fi
11063 $rm -f try try.c
11064 set d_semctl_semid_ds
11065 eval $setvar
11066 case "$d_semctl_semid_ds" in
11067 $define)
11068 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11069 ;;
11070 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11071 ;;
11072 esac
11073 $rm -f try.h
11074 ;;
11075*) val="$undef"
11076
11077 # We do not have the full sem*(2) library, so assume we can not
11078 # use either.
11079
11080 set d_semctl_semun
11081 eval $setvar
11082
11083 set d_semctl_semid_ds
11084 eval $setvar
11085 ;;
11086esac
11087
11088: see if setegid exists
11089set setegid d_setegid
11090eval $inlibc
11091
11092: see if seteuid exists
11093set seteuid d_seteuid
11094eval $inlibc
11095
11096: see if setgrent exists
11097set setgrent d_setgrent
11098eval $inlibc
11099
11100: see if sethostent exists
11101set sethostent d_sethent
11102eval $inlibc
11103
11104: see if setlinebuf exists
11105set setlinebuf d_setlinebuf
11106eval $inlibc
11107
11108: see if setlocale exists
11109set setlocale d_setlocale
11110eval $inlibc
11111
11112: see if setnetent exists
11113set setnetent d_setnent
11114eval $inlibc
11115
11116: see if setprotoent exists
11117set setprotoent d_setpent
11118eval $inlibc
11119
11120: see if setpgid exists
11121set setpgid d_setpgid
11122eval $inlibc
11123
11124: see if setpgrp2 exists
11125set setpgrp2 d_setpgrp2
11126eval $inlibc
11127
11128: see if setpriority exists
11129set setpriority d_setprior
11130eval $inlibc
11131
11132: see if setproctitle exists
11133set setproctitle d_setproctitle
11134eval $inlibc
11135
11136: see if setpwent exists
11137set setpwent d_setpwent
11138eval $inlibc
11139
11140: see if setregid exists
11141set setregid d_setregid
11142eval $inlibc
11143set setresgid d_setresgid
11144eval $inlibc
11145
11146: see if setreuid exists
11147set setreuid d_setreuid
11148eval $inlibc
11149set setresuid d_setresuid
11150eval $inlibc
11151
11152: see if setrgid exists
11153set setrgid d_setrgid
11154eval $inlibc
11155
11156: see if setruid exists
11157set setruid d_setruid
11158eval $inlibc
11159
11160: see if setservent exists
11161set setservent d_setsent
11162eval $inlibc
11163
11164: see if setsid exists
11165set setsid d_setsid
11166eval $inlibc
11167
11168: see if setvbuf exists
11169set setvbuf d_setvbuf
11170eval $inlibc
11171
11172: see if sfio.h is available
11173set sfio.h i_sfio
11174eval $inhdr
11175
11176
11177: see if sfio library is available
11178case "$i_sfio" in
11179$define)
11180 val=''
11181 set sfreserve val
11182 eval $inlibc
11183 ;;
11184*)
11185 val="$undef"
11186 ;;
11187esac
11188: Ok, but do we want to use it.
11189case "$val" in
11190$define)
11191 case "$usesfio" in
11192 true|$define|[yY]*) dflt='y';;
11193 *) dflt='n';;
11194 esac
11195 echo "$package can use the sfio library, but it is experimental."
11196 case "$useperlio" in
11197 "$undef")
11198 echo "For sfio also the PerlIO abstraction layer is needed."
11199 echo "Earlier you said you wouldn't want that."
11200 ;;
11201 esac
11202 rp="You seem to have sfio available, do you want to try using it?"
11203 . ./myread
11204 case "$ans" in
11205 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
11206 useperlio="$define"
11207 val="$define"
11208 ;;
11209 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
11210 val="$undef"
11211 : Remove sfio from list of libraries to use
11212 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11213 shift
11214 libs="$*"
11215 echo "libs = $libs" >&4
11216 ;;
11217 esac
11218 ;;
11219*) case "$usesfio" in
11220 true|$define|[yY]*)
11221 echo "Sorry, cannot find sfio on this machine." >&4
11222 echo "Ignoring your setting of usesfio=$usesfio." >&4
11223 val="$undef"
11224 ;;
11225 esac
11226 ;;
11227esac
11228set d_sfio
11229eval $setvar
11230case "$d_sfio" in
11231$define) usesfio='true';;
11232*) usesfio='false';;
11233esac
11234
11235: see if shmctl exists
11236set shmctl d_shmctl
11237eval $inlibc
11238
11239: see if shmget exists
11240set shmget d_shmget
11241eval $inlibc
11242
11243: see if shmat exists
11244set shmat d_shmat
11245eval $inlibc
11246: see what shmat returns
11247case "$d_shmat" in
11248"$define")
11249 $cat >shmat.c <<'END'
11250#include <sys/shm.h>
11251void *shmat();
11252END
11253 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11254 shmattype='void *'
11255 else
11256 shmattype='char *'
11257 fi
11258 echo "and it returns ($shmattype)." >&4
11259 : see if a prototype for shmat is available
11260 xxx=`./findhdr sys/shm.h`
11261 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11262 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11263 val="$define"
11264 else
11265 val="$undef"
11266 fi
11267 $rm -f shmat.[co]
11268 ;;
11269*)
11270 val="$undef"
11271 ;;
11272esac
11273set d_shmatprototype
11274eval $setvar
11275
11276: see if shmdt exists
11277set shmdt d_shmdt
11278eval $inlibc
11279
11280: see how much of the 'shm*(2)' library is present.
11281h_shm=true
11282echo " "
11283case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11284*"$undef"*) h_shm=false;;
11285esac
11286case "$osname" in
11287freebsd)
11288 case "`ipcs 2>&1`" in
11289 "SVID shared memory"*"not configured"*)
11290 echo "Your $osname does not have the shm*(2) configured." >&4
11291 h_shm=false
11292 val="$undef"
11293 set shmctl d_shmctl
11294 evat $setvar
11295 set shmget d_shmget
11296 evat $setvar
11297 set shmat d_shmat
11298 evat $setvar
11299 set shmdt d_shmdt
11300 evat $setvar
11301 ;;
11302 esac
11303 ;;
11304esac
11305: we could also check for sys/ipc.h ...
11306if $h_shm && $test `./findhdr sys/shm.h`; then
11307 echo "You have the full shm*(2) library." >&4
11308 val="$define"
11309else
11310 echo "You don't have the full shm*(2) library." >&4
11311 val="$undef"
11312fi
11313set d_shm
11314eval $setvar
11315
11316echo " "
11317: see if we have sigaction
11318if set sigaction val -f d_sigaction; eval $csym; $val; then
11319 echo 'sigaction() found.' >&4
11320 $cat > try.c <<'EOP'
11321#include <stdio.h>
11322#include <sys/types.h>
11323#include <signal.h>
11324int main()
11325{
11326 struct sigaction act, oact;
11327 act.sa_flags = 0;
11328 oact.sa_handler = 0;
11329 /* so that act and oact are used */
11330 exit(act.sa_flags == 0 && oact.sa_handler == 0);
11331}
11332EOP
11333 set try
11334 if eval $compile_ok; then
11335 val="$define"
11336 else
11337 echo "But you don't seem to have a useable struct sigaction." >&4
11338 val="$undef"
11339 fi
11340else
11341 echo 'sigaction NOT found.' >&4
11342 val="$undef"
11343fi
11344set d_sigaction; eval $setvar
11345$rm -f try try$_o try.c
11346
11347: see if sigsetjmp exists
11348echo " "
11349case "$d_sigsetjmp" in
11350'')
11351 $cat >try.c <<'EOP'
11352#include <setjmp.h>
11353sigjmp_buf env;
11354int set = 1;
11355int main()
11356{
11357 if (sigsetjmp(env,1))
11358 exit(set);
11359 set = 0;
11360 siglongjmp(env, 1);
11361 exit(1);
11362}
11363EOP
11364 set try
11365 if eval $compile; then
11366 if ./try >/dev/null 2>&1; then
11367 echo "POSIX sigsetjmp found." >&4
11368 val="$define"
11369 else
11370 $cat >&4 <<EOM
11371Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11372I'll ignore them.
11373EOM
11374 val="$undef"
11375 fi
11376 else
11377 echo "sigsetjmp not found." >&4
11378 val="$undef"
11379 fi
11380 ;;
11381*) val="$d_sigsetjmp"
11382 case "$d_sigsetjmp" in
11383 $define) echo "POSIX sigsetjmp found." >&4;;
11384 $undef) echo "sigsetjmp not found." >&4;;
11385 esac
11386 ;;
11387esac
11388set d_sigsetjmp
11389eval $setvar
11390$rm -f try.c try
11391
11392: see if socks5_init exists
11393set socks5_init d_socks5_init
11394eval $inlibc
11395
11396: see if sys/stat.h is available
11397set sys/stat.h i_sysstat
11398eval $inhdr
11399
11400
11401: see if stat knows about block sizes
11402echo " "
11403echo "Checking to see if your struct stat has st_blocks field..." >&4
11404set d_statblks stat st_blocks $i_sysstat sys/stat.h
11405eval $hasfield
11406
11407
11408: see if this is a sys/vfs.h system
11409set sys/vfs.h i_sysvfs
11410eval $inhdr
11411
11412
11413: see if this is a sys/statfs.h system
11414set sys/statfs.h i_sysstatfs
11415eval $inhdr
11416
11417
11418echo " "
11419echo "Checking to see if your system supports struct statfs..." >&4
11420set 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
11421eval $hasstruct
11422case "$d_statfs_s" in
11423"$define") echo "Yes, it does." ;;
11424*) echo "No, it doesn't." ;;
11425esac
11426
11427
11428
11429: see if struct statfs knows about f_flags
11430case "$d_statfs_s" in
11431define)
11432 echo " "
11433 echo "Checking to see if your struct statfs has f_flags field..." >&4
11434 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
11435 eval $hasfield
11436 ;;
11437*) val="$undef"
11438 set d_statfs_f_flags
11439 eval $setvar
11440 ;;
11441esac
11442case "$d_statfs_f_flags" in
11443"$define") echo "Yes, it does." ;;
11444*) echo "No, it doesn't." ;;
11445esac
11446
11447: see if _ptr and _cnt from stdio act std
11448echo " "
11449if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11450 echo "(Looks like you have stdio.h from Linux.)"
11451 case "$stdio_ptr" in
11452 '') stdio_ptr='((fp)->_IO_read_ptr)'
11453 ptr_lval=$define
11454 ;;
11455 *) ptr_lval=$d_stdio_ptr_lval;;
11456 esac
11457 case "$stdio_cnt" in
11458 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11459 cnt_lval=$undef
11460 ;;
11461 *) cnt_lval=$d_stdio_cnt_lval;;
11462 esac
11463 case "$stdio_base" in
11464 '') stdio_base='((fp)->_IO_read_base)';;
11465 esac
11466 case "$stdio_bufsiz" in
11467 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11468 esac
11469else
11470 case "$stdio_ptr" in
11471 '') stdio_ptr='((fp)->_ptr)'
11472 ptr_lval=$define
11473 ;;
11474 *) ptr_lval=$d_stdio_ptr_lval;;
11475 esac
11476 case "$stdio_cnt" in
11477 '') stdio_cnt='((fp)->_cnt)'
11478 cnt_lval=$define
11479 ;;
11480 *) cnt_lval=$d_stdio_cnt_lval;;
11481 esac
11482 case "$stdio_base" in
11483 '') stdio_base='((fp)->_base)';;
11484 esac
11485 case "$stdio_bufsiz" in
11486 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11487 esac
11488fi
11489: test whether _ptr and _cnt really work
11490echo "Checking how std your stdio is..." >&4
11491$cat >try.c <<EOP
11492#include <stdio.h>
11493#define FILE_ptr(fp) $stdio_ptr
11494#define FILE_cnt(fp) $stdio_cnt
11495int main() {
11496 FILE *fp = fopen("try.c", "r");
11497 char c = getc(fp);
11498 if (
11499 18 <= FILE_cnt(fp) &&
11500 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11501 )
11502 exit(0);
11503 exit(1);
11504}
11505EOP
11506val="$undef"
11507set try
11508if eval $compile; then
11509 if ./try; then
11510 echo "Your stdio acts pretty std."
11511 val="$define"
11512 else
11513 echo "Your stdio isn't very std."
11514 fi
11515else
11516 echo "Your stdio doesn't appear very std."
11517fi
11518$rm -f try.c try
11519set d_stdstdio
11520eval $setvar
11521
11522: Can _ptr be used as an lvalue?
11523case "$d_stdstdio$ptr_lval" in
11524$define$define) val=$define ;;
11525*) val=$undef ;;
11526esac
11527set d_stdio_ptr_lval
11528eval $setvar
11529
11530: Can _cnt be used as an lvalue?
11531case "$d_stdstdio$cnt_lval" in
11532$define$define) val=$define ;;
11533*) val=$undef ;;
11534esac
11535set d_stdio_cnt_lval
11536eval $setvar
11537
a7ffa9b9
NC
11538
11539: test whether setting _ptr sets _cnt as a side effect
11540d_stdio_ptr_lval_sets_cnt="$undef"
11541d_stdio_ptr_lval_nochange_cnt="$undef"
11542case "$d_stdio_ptr_lval$d_stdstdio" in
11543$define$define)
11544 echo "Checking to see what happens if we set the stdio ptr..." >&4
11545$cat >try.c <<EOP
11546#include <stdio.h>
11547/* Can we scream? */
11548/* Eat dust sed :-) */
11549#define FILE_ptr(fp) $stdio_ptr
11550#define FILE_cnt(fp) $stdio_cnt
11551int main() {
11552 FILE *fp = fopen("try.c", "r");
11553 char c = getc(fp);
11554 char *ptr;
11555 size_t cnt;
11556 if (!(
11557 18 <= FILE_cnt(fp) &&
11558 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11559 )) {
11560 puts("Fail even to read");
11561 exit (1);
11562 }
11563 ptr = FILE_ptr(fp);
11564 cnt = FILE_cnt(fp);
11565
11566 FILE_ptr(fp)+= 42;
11567
11568 if (FILE_ptr(fp) != (ptr + 42)) {
11569 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11570 exit (1);
11571 }
11572 if (FILE_cnt(fp) <= 20) {
11573 printf ("Fail (<20 chars to test)");
11574 exit (1);
11575 }
11576 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11577 puts("Fail compare");
11578 exit (1);
11579 }
11580 if (cnt == FILE_cnt(fp)) {
11581 puts("Pass_unchanged");
11582 exit (0);
11583 }
11584 if (FILE_cnt(fp) == (cnt - 42)) {
11585 puts("Pass_changed");
11586 exit (0);
11587 }
11588 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11589 return 1;
11590
11591}
11592EOP
11593 set try
11594 if eval $compile; then
11595 case `./try$exe_ext` in
11596 Pass_changed)
2e32dcfe 11597 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
a7ffa9b9
NC
11598 d_stdio_ptr_lval_sets_cnt="$define" ;;
11599 Pass_unchanged)
11600 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
11601 d_stdio_ptr_lval_nochange_cnt="$define" ;;
11602 Fail*)
11603 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
11604 *)
11605 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11606 esac
11607 else
11608 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
11609 fi
11610 $rm -f try.c try
11611 ;;
11612esac
11613
b4eb6b3d
JH
11614: see if _base is also standard
11615val="$undef"
11616case "$d_stdstdio" in
11617$define)
11618 $cat >try.c <<EOP
11619#include <stdio.h>
11620#define FILE_base(fp) $stdio_base
11621#define FILE_bufsiz(fp) $stdio_bufsiz
11622int main() {
11623 FILE *fp = fopen("try.c", "r");
11624 char c = getc(fp);
11625 if (
11626 19 <= FILE_bufsiz(fp) &&
11627 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11628 )
11629 exit(0);
11630 exit(1);
11631}
11632EOP
11633 set try
11634 if eval $compile; then
11635 if ./try; then
11636 echo "And its _base field acts std."
11637 val="$define"
11638 else
11639 echo "But its _base field isn't std."
11640 fi
11641 else
11642 echo "However, it seems to be lacking the _base field."
11643 fi
11644 $rm -f try.c try
11645 ;;
11646esac
11647set d_stdiobase
11648eval $setvar
11649
11650$cat >&4 <<EOM
11651Checking how to access stdio streams by file descriptor number...
11652EOM
11653case "$stdio_stream_array" in
11654'') $cat >try.c <<EOCP
11655#include <stdio.h>
11656int main() {
11657 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11658 printf("yes\n");
11659}
11660EOCP
11661 for s in _iob __iob __sF
11662 do
11663 set try -DSTDIO_STREAM_ARRAY=$s
11664 if eval $compile; then
11665 case "`./try$exe_ext`" in
11666 yes) stdio_stream_array=$s; break ;;
11667 esac
11668 fi
11669 done
11670 $rm -f try.* try$exe_ext
11671esac
11672case "$stdio_stream_array" in
11673'') $cat >&4 <<EOM
11674I can't figure out how to access stdio streams by file descriptor number.
11675EOM
11676 d_stdio_stream_array="$undef"
11677 ;;
11678*) $cat >&4 <<EOM
11679You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11680EOM
11681 d_stdio_stream_array="$define"
11682 ;;
11683esac
11684
11685: see if strcoll exists
11686set strcoll d_strcoll
11687eval $inlibc
11688
11689: check for structure copying
11690echo " "
11691echo "Checking to see if your C compiler can copy structs..." >&4
11692$cat >try.c <<'EOCP'
11693int main()
11694{
11695 struct blurfl {
11696 int dyick;
11697 } foo, bar;
11698
11699 foo = bar;
11700}
11701EOCP
11702if $cc -c try.c >/dev/null 2>&1 ; then
11703 val="$define"
11704 echo "Yup, it can."
11705else
11706 val="$undef"
11707 echo "Nope, it can't."
11708fi
11709set d_strctcpy
11710eval $setvar
11711$rm -f try.*
11712
11713: see if strerror and/or sys_errlist[] exist
11714echo " "
11715if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11716 if set strerror val -f d_strerror; eval $csym; $val; then
11717 echo 'strerror() found.' >&4
11718 d_strerror="$define"
11719 d_strerrm='strerror(e)'
11720 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11721 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
11722 d_syserrlst="$define"
11723 else
11724 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11725 d_syserrlst="$undef"
11726 fi
11727 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11728 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11729 echo 'strerror() found in string header.' >&4
11730 d_strerror="$define"
11731 d_strerrm='strerror(e)'
11732 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11733 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11734 d_syserrlst="$define"
11735 else
11736 echo "(You don't appear to have any sys_errlist[], how can this be?)"
11737 d_syserrlst="$undef"
11738 fi
11739 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11740 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11741 d_strerror="$undef"
11742 d_syserrlst="$define"
11743 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11744 else
11745 echo 'strerror() and sys_errlist[] NOT found.' >&4
11746 d_strerror="$undef"
11747 d_syserrlst="$undef"
11748 d_strerrm='"unknown"'
11749 fi
11750fi
11751
11752: see if strtod exists
11753set strtod d_strtod
11754eval $inlibc
11755
11756: see if strtol exists
11757set strtol d_strtol
11758eval $inlibc
11759
11760: see if strtold exists
11761set strtold d_strtold
11762eval $inlibc
11763
11764: see if strtoll exists
11765set strtoll d_strtoll
11766eval $inlibc
11767
11768case "$d_longlong-$d_strtoll" in
11769"$define-$define")
11770 $cat <<EOM
11771Checking whether your strtoll() works okay...
11772EOM
11773 $cat >try.c <<'EOCP'
11774#include <errno.h>
11775#ifdef __hpux
11776#define strtoll __strtoll
11777#endif
e75931a7
YST
11778#ifdef __EMX__
11779#define strtoll _strtoll
11780#endif
b4eb6b3d
JH
11781#include <stdio.h>
11782extern long long int strtoll(char *s, char **, int);
11783static int bad = 0;
11784int check(char *s, long long ell, int een) {
11785 long long gll;
11786 errno = 0;
11787 gll = strtoll(s, 0, 10);
11788 if (!((gll == ell) && (errno == een)))
11789 bad++;
11790}
11791int main() {
11792 check(" 1", 1LL, 0);
11793 check(" 0", 0LL, 0);
11794 check("-1", -1LL, 0);
11795 check("-9223372036854775808", -9223372036854775808LL, 0);
11796 check("-9223372036854775808", -9223372036854775808LL, 0);
11797 check(" 9223372036854775807", 9223372036854775807LL, 0);
11798 check("-9223372036854775808", -9223372036854775808LL, 0);
11799 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
11800 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11801 if (!bad)
11802 printf("ok\n");
11803}
11804EOCP
11805 set try
11806 if eval $compile; then
e75931a7
YST
11807 yyy=`./try`
11808 case "$yyy" in
b4eb6b3d
JH
11809 ok) echo "Your strtoll() seems to be working okay." ;;
11810 *) cat <<EOM >&4
11811Your strtoll() doesn't seem to be working okay.
11812EOM
11813 d_strtoll="$undef"
11814 ;;
69eadf66 11815 esac
e75931a7
YST
11816 else
11817 echo "(I can't seem to compile the test program--assuming it doesn't)"
11818 d_strtoll="$undef"
b4eb6b3d
JH
11819 fi
11820 ;;
11821esac
11822
11823: see if strtoul exists
11824set strtoul d_strtoul
11825eval $inlibc
11826
11827: see if strtoull exists
11828set strtoull d_strtoull
11829eval $inlibc
11830
11831case "$d_longlong-$d_strtoull" in
11832"$define-$define")
11833 $cat <<EOM
11834Checking whether your strtoull() works okay...
11835EOM
11836 $cat >try.c <<'EOCP'
11837#include <errno.h>
11838#ifdef __hpux
11839#define strtoull __strtoull
11840#endif
11841#include <stdio.h>
11842extern unsigned long long int strtoull(char *s, char **, int);
11843static int bad = 0;
11844int check(char *s, long long eull, int een) {
11845 long long gull;
11846 errno = 0;
11847 gull = strtoull(s, 0, 10);
11848 if (!((gull == eull) && (errno == een)))
11849 bad++;
11850}
11851int main() {
11852 check(" 1", 1LL, 0);
11853 check(" 0", 0LL, 0);
11854 check("18446744073709551615", 18446744073709551615ULL, 0);
11855 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11856 if (!bad)
11857 printf("ok\n");
11858}
11859EOCP
11860 set try
11861 if eval $compile; then
11862 case "`./try`" in
11863 ok) echo "Your strtoull() seems to be working okay." ;;
11864 *) cat <<EOM >&4
11865Your strtoull() doesn't seem to be working okay.
11866EOM
11867 d_strtoull="$undef"
11868 ;;
11869 esac
11870 fi
11871 ;;
11872esac
11873
11874: see if strtouq exists
11875set strtouq d_strtouq
11876eval $inlibc
11877
11878: see if strxfrm exists
11879set strxfrm d_strxfrm
11880eval $inlibc
11881
11882: see if symlink exists
11883set symlink d_symlink
11884eval $inlibc
11885
11886: see if syscall exists
11887set syscall d_syscall
11888eval $inlibc
11889
11890: see if sysconf exists
11891set sysconf d_sysconf
11892eval $inlibc
11893
11894: see if system exists
11895set system d_system
11896eval $inlibc
11897
11898: see if tcgetpgrp exists
11899set tcgetpgrp d_tcgetpgrp
11900eval $inlibc
11901
11902: see if tcsetpgrp exists
11903set tcsetpgrp d_tcsetpgrp
11904eval $inlibc
11905
11906: see if prototype for telldir is available
11907echo " "
11908set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11909eval $hasproto
11910
11911: see if this is a sys/times.h system
11912set sys/times.h i_systimes
11913eval $inhdr
11914
11915: see if times exists
11916echo " "
11917if set times val -f d_times; eval $csym; $val; then
11918 echo 'times() found.' >&4
11919 d_times="$define"
11920 inc=''
11921 case "$i_systimes" in
11922 "$define") inc='sys/times.h';;
11923 esac
11924 rp="What is the type returned by times() on this system?"
11925 set clock_t clocktype long stdio.h sys/types.h $inc
11926 eval $typedef_ask
11927else
11928 echo 'times() NOT found, hope that will do.' >&4
11929 d_times="$undef"
11930 clocktype='int'
11931fi
11932
11933: see if truncate exists
11934set truncate d_truncate
11935eval $inlibc
11936
11937: see if tzname[] exists
11938echo " "
11939if set tzname val -a d_tzname; eval $csym; $val; then
11940 val="$define"
11941 echo 'tzname[] found.' >&4
11942else
11943 val="$undef"
11944 echo 'tzname[] NOT found.' >&4
11945fi
11946set d_tzname
11947eval $setvar
11948
11949: see if umask exists
11950set umask d_umask
11951eval $inlibc
11952
11953: see if ustat exists
11954set ustat d_ustat
11955eval $inlibc
11956
11957: backward compatibility for d_hvfork
11958if test X$d_hvfork != X; then
11959 d_vfork="$d_hvfork"
11960 d_hvfork=''
11961fi
11962: see if there is a vfork
11963val=''
11964set vfork val
11965eval $inlibc
11966
11967: Ok, but do we want to use it. vfork is reportedly unreliable in
11968: perl on Solaris 2.x, and probably elsewhere.
11969case "$val" in
11970$define)
11971 echo " "
11972 case "$usevfork" in
11973 false) dflt='n';;
11974 *) dflt='y';;
11975 esac
11976 cat <<'EOM'
11977
11978Perl can only use a vfork() that doesn't suffer from strict
11979restrictions on calling functions or modifying global data in
11980the child. For example, glibc-2.1 contains such a vfork()
11981that is unsuitable. If your system provides a proper fork()
11982call, chances are that you do NOT want perl to use vfork().
11983
11984EOM
11985 rp="Do you still want to use vfork()?"
11986 . ./myread
11987 case "$ans" in
11988 y|Y) ;;
11989 *)
11990 echo "Ok, we won't use vfork()."
11991 val="$undef"
11992 ;;
11993 esac
11994 ;;
11995esac
11996set d_vfork
11997eval $setvar
11998case "$d_vfork" in
11999$define) usevfork='true';;
12000*) usevfork='false';;
12001esac
12002
12003: see if this is an sysdir system
12004set sys/dir.h i_sysdir
12005eval $inhdr
12006
12007: see if this is an sysndir system
12008set sys/ndir.h i_sysndir
12009eval $inhdr
12010
12011: see if closedir exists
12012set closedir d_closedir
12013eval $inlibc
12014
12015case "$d_closedir" in
12016"$define")
12017 echo " "
12018 echo "Checking whether closedir() returns a status..." >&4
12019 cat > closedir.c <<EOM
12020#$i_dirent I_DIRENT /**/
12021#$i_sysdir I_SYS_DIR /**/
12022#$i_sysndir I_SYS_NDIR /**/
12023#$i_systypes I_SYS_TYPES /**/
12024
12025#if defined(I_SYS_TYPES)
12026#include <sys/types.h>
12027#endif
12028#if defined(I_DIRENT)
12029#include <dirent.h>
12030#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12031#include <sys/dir.h>
12032#endif
12033#else
12034#ifdef I_SYS_NDIR
12035#include <sys/ndir.h>
12036#else
12037#ifdef I_SYS_DIR
12038#ifdef hp9000s500
12039#include <ndir.h> /* may be wrong in the future */
12040#else
12041#include <sys/dir.h>
12042#endif
12043#endif
12044#endif
12045#endif
12046int main() { return closedir(opendir(".")); }
12047EOM
12048 set closedir
12049 if eval $compile_ok; then
12050 if ./closedir > /dev/null 2>&1 ; then
12051 echo "Yes, it does."
12052 val="$undef"
12053 else
12054 echo "No, it doesn't."
12055 val="$define"
12056 fi
12057 else
12058 echo "(I can't seem to compile the test program--assuming it doesn't)"
12059 val="$define"
12060 fi
12061 ;;
12062*)
12063 val="$undef";
12064 ;;
12065esac
12066set d_void_closedir
12067eval $setvar
12068$rm -f closedir*
12069: check for volatile keyword
12070echo " "
12071echo 'Checking to see if your C compiler knows about "volatile"...' >&4
12072$cat >try.c <<'EOCP'
12073int main()
12074{
12075 typedef struct _goo_struct goo_struct;
12076 goo_struct * volatile goo = ((goo_struct *)0);
12077 struct _goo_struct {
12078 long long_int;
12079 int reg_int;
12080 char char_var;
12081 };
12082 typedef unsigned short foo_t;
12083 char *volatile foo;
12084 volatile int bar;
12085 volatile foo_t blech;
12086 foo = foo;
12087}
12088EOCP
12089if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
12090 val="$define"
12091 echo "Yup, it does."
12092else
12093 val="$undef"
12094 echo "Nope, it doesn't."
12095fi
12096set d_volatile
12097eval $setvar
12098$rm -f try.*
12099
12100: see if there is a wait4
12101set wait4 d_wait4
12102eval $inlibc
12103
12104: see if waitpid exists
12105set waitpid d_waitpid
12106eval $inlibc
12107
12108: see if wcstombs exists
12109set wcstombs d_wcstombs
12110eval $inlibc
12111
12112: see if wctomb exists
12113set wctomb d_wctomb
12114eval $inlibc
12115
12116: preserve RCS keywords in files with variable substitution, grrr
12117Date='$Date'
12118Id='$Id'
12119Log='$Log'
12120RCSfile='$RCSfile'
12121Revision='$Revision'
12122
12123case "$crosscompile" in
12124''|[nN]*) crosscompile="$undef" ;;
12125esac
12126
12127case "$osname" in
12128next|rhapsody|darwin) multiarch="$define" ;;
12129esac
12130case "$multiarch" in
12131''|[nN]*) multiarch="$undef" ;;
12132esac
12133
12134: check for alignment requirements
12135echo " "
12136case "$crosscompile$multiarch" in
12137*$define*)
12138 $cat <<EOM
12139You seem to be either cross-compiling or doing a multiarchitecture build,
12140skipping the memory alignment check.
12141
12142EOM
12143 case "$alignbytes" in
12144 '') alignbytes=8 ;;
12145 esac
12146 ;;
12147*)
12148 case "$alignbytes" in
12149 '') echo "Checking alignment constraints..." >&4
12150 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12151 $cat >try.c <<'EOCP'
12152typedef long double NV;
12153EOCP
12154 else
12155 $cat >try.c <<'EOCP'
12156typedef double NV;
12157EOCP
12158 fi
12159 $cat >>try.c <<'EOCP'
12160#include <stdio.h>
12161struct foobar {
12162 char foo;
12163 NV bar;
12164} try_algn;
12165int main()
12166{
12167 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12168 return(0);
12169}
12170EOCP
12171 set try
12172 if eval $compile_ok; then
12173 dflt=`./try`
12174 else
12175 dflt='8'
12176 echo "(I can't seem to compile the test program...)"
12177 fi
12178 ;;
12179 *) dflt="$alignbytes"
12180 ;;
12181 esac
12182 rp="Doubles must be aligned on a how-many-byte boundary?"
12183 . ./myread
12184 alignbytes="$ans"
12185 $rm -f try.c try
12186 ;;
12187esac
12188
12189
12190: set the base revision
12191baserev=5.0
12192
12193: check for ordering of bytes in a long
12194echo " "
12195case "$crosscompile$multiarch" in
12196*$define*)
12197 $cat <<EOM
12198You seem to be either cross-compiling or doing a multiarchitecture build,
12199skipping the byteorder check.
12200
12201EOM
12202 byteorder='0xffff'
12203 ;;
12204*)
12205 case "$byteorder" in
12206 '')
12207 $cat <<'EOM'
12208In the following, larger digits indicate more significance. A big-endian
12209machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12210little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12211machines may have weird orders like 3412. A Cray will report 87654321,
12212an Alpha will report 12345678. If the test program works the default is
12213probably right.
12214I'm now running the test program...
12215EOM
12216 $cat >try.c <<'EOCP'
12217#include <stdio.h>
12218int main()
12219{
12220 int i;
12221 union {
12222 unsigned long l;
12223 char c[sizeof(long)];
12224 } u;
12225
12226 if (sizeof(long) > 4)
12227 u.l = (0x08070605L << 32) | 0x04030201L;
12228 else
12229 u.l = 0x04030201L;
12230 for (i = 0; i < sizeof(long); i++)
12231 printf("%c", u.c[i]+'0');
12232 printf("\n");
12233 exit(0);
12234}
12235EOCP
12236 xxx_prompt=y
12237 set try
12238 if eval $compile && ./try > /dev/null; then
12239 dflt=`./try`
12240 case "$dflt" in
12241 [1-4][1-4][1-4][1-4]|12345678|87654321)
12242 echo "(The test program ran ok.)"
12243 echo "byteorder=$dflt"
12244 xxx_prompt=n
12245 ;;
12246 ????|????????) echo "(The test program ran ok.)" ;;
12247 *) echo "(The test program didn't run right for some reason.)" ;;
12248 esac
12249 else
12250 dflt='4321'
12251 cat <<'EOM'
12252(I can't seem to compile the test program. Guessing big-endian...)
12253EOM
12254 fi
12255 case "$xxx_prompt" in
12256 y)
12257 rp="What is the order of bytes in a long?"
12258 . ./myread
12259 byteorder="$ans"
12260 ;;
12261 *) byteorder=$dflt
12262 ;;
12263 esac
12264 ;;
12265 esac
12266 $rm -f try.c try
12267 ;;
12268esac
12269
12270
12271: how do we catenate cpp tokens here?
12272echo " "
12273echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12274$cat >cpp_stuff.c <<'EOCP'
12275#define RCAT(a,b)a/**/b
12276#define ACAT(a,b)a ## b
12277RCAT(Rei,ser)
12278ACAT(Cir,cus)
12279EOCP
12280$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12281if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12282 echo "Oh! Smells like ANSI's been here." >&4
12283 echo "We can catify or stringify, separately or together!"
12284 cpp_stuff=42
12285elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12286 echo "Ah, yes! The good old days!" >&4
12287 echo "However, in the good old days we don't know how to stringify and"
12288 echo "catify at the same time."
12289 cpp_stuff=1
12290else
12291 $cat >&4 <<EOM
12292Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
12293to have to edit the values of CAT[2-5] in config.h...
12294EOM
12295 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12296fi
12297$rm -f cpp_stuff.*
12298
12299: see if this is a db.h system
12300set db.h i_db
12301eval $inhdr
12302
12303case "$i_db" in
12304$define)
12305 : Check db version.
12306 echo " "
12307 echo "Checking Berkeley DB version ..." >&4
12308 $cat >try.c <<EOCP
12309#$d_const HASCONST
12310#ifndef HASCONST
12311#define const
12312#endif
12313#include <sys/types.h>
12314#include <stdio.h>
12315#include <db.h>
12316int main()
12317{
12318#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12319 int Major, Minor, Patch ;
12320 unsigned long Version ;
12321 (void)db_version(&Major, &Minor, &Patch) ;
12322 printf("You have Berkeley DB Version 2 or greater\n");
12323
12324 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12325 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12326 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12327 Major, Minor, Patch) ;
12328
12329 /* check that db.h & libdb are compatible */
12330 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12331 printf("db.h and libdb are incompatible\n") ;
12332 exit(3);
12333 }
12334
12335 printf("db.h and libdb are compatible\n") ;
12336
12337 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12338 + DB_VERSION_PATCH ;
12339
12340 /* needs to be >= 2.3.4 */
12341 if (Version < 2003004) {
12342 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12343 printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12344 exit(2);
12345 }
12346
12347 exit(0);
12348#else
12349#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12350 printf("You have Berkeley DB Version 1\n");
12351 exit(0); /* DB version < 2: the coast is clear. */
12352#else
12353 exit(1); /* <db.h> not Berkeley DB? */
12354#endif
12355#endif
12356}
12357EOCP
12358 set try
12359 if eval $compile_ok && ./try; then
12360 echo 'Looks OK.' >&4
12361 else
12362 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
12363 i_db=$undef
12364 case " $libs " in
12365 *"-ldb "*)
12366 : Remove db from list of libraries to use
12367 echo "Removing unusable -ldb from library list" >&4
12368 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12369 shift
12370 libs="$*"
12371 echo "libs = $libs" >&4
12372 ;;
12373 esac
12374 fi
12375 $rm -f try.*
12376 ;;
12377esac
12378
12379case "$i_db" in
12380define)
12381 : Check the return type needed for hash
12382 echo " "
12383 echo "Checking return type needed for hash for Berkeley DB ..." >&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 <db.h>
12391
12392#ifndef DB_VERSION_MAJOR
12393u_int32_t hash_cb (ptr, size)
12394const void *ptr;
12395size_t size;
12396{
12397}
12398HASHINFO info;
12399int main()
12400{
12401 info.hash = hash_cb;
12402}
12403#endif
12404EOCP
12405 if $cc $ccflags -c try.c >try.out 2>&1 ; then
12406 if $contains warning try.out >>/dev/null 2>&1 ; then
12407 db_hashtype='int'
12408 else
12409 db_hashtype='u_int32_t'
12410 fi
12411 else
12412 : XXX Maybe we should just give up here.
12413 db_hashtype=u_int32_t
12414 $cat try.out >&4
12415 echo "Help: I can't seem to compile the db test program." >&4
12416 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12417 fi
12418 $rm -f try.*
12419 echo "Your version of Berkeley DB uses $db_hashtype for hash."
12420 ;;
12421*) db_hashtype=u_int32_t
12422 ;;
12423esac
12424case "$i_db" in
12425define)
12426 : Check the return type needed for prefix
12427 echo " "
12428 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12429 cat >try.c <<EOCP
12430#$d_const HASCONST
12431#ifndef HASCONST
12432#define const
12433#endif
12434#include <sys/types.h>
12435#include <db.h>
12436
12437#ifndef DB_VERSION_MAJOR
12438size_t prefix_cb (key1, key2)
12439const DBT *key1;
12440const DBT *key2;
12441{
12442}
12443BTREEINFO info;
12444int main()
12445{
12446 info.prefix = prefix_cb;
12447}
12448#endif
12449EOCP
12450 if $cc $ccflags -c try.c >try.out 2>&1 ; then
12451 if $contains warning try.out >>/dev/null 2>&1 ; then
12452 db_prefixtype='int'
12453 else
12454 db_prefixtype='size_t'
12455 fi
12456 else
12457 db_prefixtype='size_t'
12458 : XXX Maybe we should just give up here.
12459 $cat try.out >&4
12460 echo "Help: I can't seem to compile the db test program." >&4
12461 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12462 fi
12463 $rm -f try.*
12464 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12465 ;;
12466*) db_prefixtype='size_t'
12467 ;;
12468esac
12469
12470: check for void type
12471echo " "
12472echo "Checking to see how well your C compiler groks the void type..." >&4
12473case "$voidflags" in
12474'')
12475 $cat >try.c <<'EOCP'
12476#if TRY & 1
12477void sub() {
12478#else
12479sub() {
12480#endif
12481 extern void moo(); /* function returning void */
12482 void (*goo)(); /* ptr to func returning void */
12483#if TRY & 8
12484 void *hue; /* generic ptr */
12485#endif
12486#if TRY & 2
12487 void (*foo[10])();
12488#endif
12489
12490#if TRY & 4
12491 if(goo == moo) {
12492 exit(0);
12493 }
12494#endif
12495 exit(0);
12496}
12497int main() { sub(); }
12498EOCP
12499 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12500 voidflags=$defvoidused
12501 echo "Good. It appears to support void to the level $package wants.">&4
12502 if $contains warning .out >/dev/null 2>&1; then
12503 echo "However, you might get some warnings that look like this:"
12504 $cat .out
12505 fi
12506 else
12507echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12508 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12509 echo "It supports 1..."
12510 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12511 echo "It also supports 2..."
12512 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12513 voidflags=7
12514 echo "And it supports 4 but not 8 definitely."
12515 else
12516 echo "It doesn't support 4..."
12517 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12518 voidflags=11
12519 echo "But it supports 8."
12520 else
12521 voidflags=3
12522 echo "Neither does it support 8."
12523 fi
12524 fi
12525 else
12526 echo "It does not support 2..."
12527 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12528 voidflags=13
12529 echo "But it supports 4 and 8."
12530 else
12531 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12532 voidflags=5
12533 echo "And it supports 4 but has not heard about 8."
12534 else
12535 echo "However it supports 8 but not 4."
12536 fi
12537 fi
12538 fi
12539 else
12540 echo "There is no support at all for void."
12541 voidflags=0
12542 fi
12543 fi
12544esac
12545case "$voidflags" in
12546"$defvoidused") ;;
12547*) $cat >&4 <<'EOM'
12548 Support flag bits are:
12549 1: basic void declarations.
12550 2: arrays of pointers to functions returning void.
12551 4: operations between pointers to and addresses of void functions.
12552 8: generic void pointers.
12553EOM
12554 dflt="$voidflags";
12555 rp="Your void support flags add up to what?"
12556 . ./myread
12557 voidflags="$ans"
12558 ;;
12559esac
12560$rm -f try.* .out
12561
12562
12563: How can we generate normalized random numbers ?
12564echo " "
12565echo "Looking for a random number function..." >&4
12566case "$randfunc" in
12567'')
12568 if set drand48 val -f; eval $csym; $val; then
12569 dflt="drand48"
12570 echo "Good, found drand48()." >&4
12571 elif set random val -f; eval $csym; $val; then
12572 dflt="random"
12573 echo "OK, found random()." >&4
12574 else
12575 dflt="rand"
12576 echo "Yick, looks like I have to use rand()." >&4
12577 fi
12578 echo " "
12579 ;;
12580*)
12581 dflt="$randfunc"
12582 ;;
12583esac
12584cont=true
12585
12586case "$ccflags" in
12587*-Dmy_rand=*|*-Dmy_srand=*)
12588 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12589 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12590 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12591 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12592 ;;
12593esac
12594
12595while $test "$cont"; do
12596 rp="Use which function to generate random numbers?"
12597 . ./myread
12598 if $test "$ans" = "$dflt"; then
12599 : null
12600 else
12601 randbits=''
12602 fi
12603 randfunc="$ans"
12604 if set $ans val -f; eval $csym; $val; then
12605 cont=''
12606 else
12607 dflt=y
12608 rp="I cannot find function $ans. Use that name anyway?"
12609 . ./myread
12610 dflt=rand
12611 case "$ans" in
12612 [yY]*) cont='';;
12613 esac
12614 fi
12615 case "$cont" in
12616 '')
12617 case "$randfunc" in
12618 drand48)
12619 drand01="drand48()"
12620 seedfunc="srand48"
12621 randbits=48
12622 randseedtype=long
12623 ;;
12624 rand|random)
12625 case "$randbits" in
12626 '')
12627echo "Checking to see how many bits your $randfunc() function produces..." >&4
12628 $cat >try.c <<EOCP
12629#$i_unistd I_UNISTD
12630#$i_stdlib I_STDLIB
12631#include <stdio.h>
12632#ifdef I_UNISTD
12633# include <unistd.h>
12634#endif
12635#ifdef I_STDLIB
12636# include <stdlib.h>
12637#endif
12638int main()
12639{
12640 register int i;
12641 register unsigned long tmp;
12642 register unsigned long max = 0L;
12643
12644 for (i = 1000; i; i--) {
12645 tmp = (unsigned long) $randfunc();
12646 if (tmp > max) max = tmp;
12647 }
12648 for (i = 0; max; i++)
12649 max /= 2;
12650 printf("%d\n",i);
12651}
12652EOCP
12653 set try
12654 if eval $compile_ok; then
12655 dflt=`try`
12656 else
12657 dflt='?'
12658 echo "(I can't seem to compile the test program...)"
12659 fi
12660 ;;
12661 *)
12662 dflt="$randbits"
12663 ;;
12664 esac
12665 rp="How many bits does your $randfunc() function produce?"
12666 . ./myread
12667 randbits="$ans"
12668 $rm -f try.c try
12669 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12670 seedfunc="s$randfunc"
12671 randseedtype=unsigned
12672 ;;
12673 *)
12674 dflt="31"
12675 rp="How many bits does your $randfunc() function produce?"
12676 . ./myread
12677 randbits="$ans"
12678 seedfunc="s$randfunc"
12679 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12680 if set $seedfunc val -f; eval $csym; $val; then
12681 echo "(Using $seedfunc() to seed random generator)"
12682 else
12683 echo "(Warning: no $seedfunc() to seed random generator)"
12684 seedfunc=rand
12685 fi
12686 randseedtype=unsigned
12687 ;;
12688 esac
12689 ;;
12690 esac
12691done
12692
12693echo " "
12694echo "Determining whether or not we are on an EBCDIC system..." >&4
12695$cat >tebcdic.c <<'EOM'
12696int main()
12697{
12698 if ('M'==0xd4) return 0;
12699 return 1;
12700}
12701EOM
12702
12703val=$undef
12704set tebcdic
12705if eval $compile_ok; then
12706 if ./tebcdic; then
12707 echo "You seem to speak EBCDIC." >&4
12708 val="$define"
12709 else
12710 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
12711 fi
12712else
12713 echo "I'm unable to compile the test program." >&4
12714 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
12715fi
12716$rm -f tebcdic.c tebcdic
12717set ebcdic
12718eval $setvar
12719
12720echo " "
12721$cat >&4 <<EOM
12722Checking how to flush all pending stdio output...
12723EOM
12724# I only know how to find the first 32 possibly open files on SunOS.
12725# See also hints/sunos_4_1.sh and util.c --AD
12726case "$osname" in
12727sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12728esac
12729$cat >>try.c <<EOCP
12730#include <stdio.h>
12731#$i_unistd I_UNISTD
12732#ifdef I_UNISTD
12733# include <unistd.h>
12734#endif
12735#$d_sysconf HAS_SYSCONF
12736#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12737#ifdef HAS_STDIO_STREAM_ARRAY
12738# define STDIO_STREAM_ARRAY $stdio_stream_array
12739#endif
12740int main() {
12741 FILE* p = fopen("try.out", "w");
12742#ifdef TRY_FPUTC
12743 fputc('x', p);
12744#else
12745# ifdef TRY_FPRINTF
12746 fprintf(p, "x");
12747# endif
12748#endif
12749#ifdef TRY_FFLUSH_NULL
12750 fflush(NULL);
12751#endif
12752#ifdef TRY_FFLUSH_ALL
12753 {
12754 long open_max = -1;
12755# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12756 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12757# else
12758# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12759 open_max = sysconf(_SC_OPEN_MAX);
12760# else
12761# ifdef FOPEN_MAX
12762 open_max = FOPEN_MAX;
12763# else
12764# ifdef OPEN_MAX
12765 open_max = OPEN_MAX;
12766# else
12767# ifdef _NFILE
12768 open_max = _NFILE;
12769# endif
12770# endif
12771# endif
12772# endif
12773# endif
12774# ifdef HAS_STDIO_STREAM_ARRAY
12775 if (open_max > 0) {
12776 long i;
12777 for (i = 0; i < open_max; i++)
12778 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12779 STDIO_STREAM_ARRAY[i]._file < open_max &&
12780 STDIO_STREAM_ARRAY[i]._flag)
12781 fflush(&STDIO_STREAM_ARRAY[i]);
12782 }
12783 }
12784# endif
12785#endif
12786 _exit(42);
12787}
12788EOCP
12789: first we have to find out how _not_ to flush
12790if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12791 output=''
12792 set try -DTRY_FPUTC
12793 if eval $compile; then
12794 $rm -f try.out
12795 ./try$exe_ext 2>/dev/null
12796 if $test ! -s try.out -a "X$?" = X42; then
12797 output=-DTRY_FPUTC
12798 fi
12799 fi
12800 case "$output" in
12801 '')
12802 set try -DTRY_FPRINTF
12803 $rm -f try.out
12804 if eval $compile; then
12805 $rm -f try.out
12806 ./try$exe_ext 2>/dev/null
12807 if $test ! -s try.out -a "X$?" = X42; then
12808 output=-DTRY_FPRINTF
12809 fi
12810 fi
12811 ;;
12812 esac
12813fi
12814: check for fflush NULL behaviour
12815case "$fflushNULL" in
12816'') set try -DTRY_FFLUSH_NULL $output
12817 if eval $compile; then
12818 $rm -f try.out
12819 ./try$exe_ext 2>/dev/null
12820 code="$?"
12821 if $test -s try.out -a "X$code" = X42; then
12822 fflushNULL="`$cat try.out`"
12823 else
12824 if $test "X$code" != X42; then
12825 $cat >&4 <<EOM
12826(If this test failed, don't worry, we'll try another method shortly.)
12827EOM
12828 fi
12829 fi
12830 fi
12831 $rm -f core try.core core.try.*
12832 case "$fflushNULL" in
12833 x) $cat >&4 <<EOM
12834Your fflush(NULL) works okay for output streams.
12835Let's see if it clobbers input pipes...
12836EOM
12837# As of mid-March 2000 all versions of Solaris appear to have a stdio
12838# bug that improperly flushes the input end of pipes. So we avoid the
12839# autoflush on fork/system/exec support for now. :-(
12840$cat >tryp.c <<EOCP
12841#include <stdio.h>
12842int
12843main(int argc, char **argv)
12844{
12845 char buf[1024];
12846 int i;
12847 char *bp = buf;
12848 while (1) {
12849 while ((i = getc(stdin)) != -1
12850 && (*bp++ = i) != '\n'
12851 && bp < &buf[1024])
12852 /* DO NOTHING */ ;
12853 *bp = '\0';
12854 fprintf(stdout, "%s", buf);
12855 fflush(NULL);
12856 if (i == -1)
12857 return 0;
12858 bp = buf;
12859 }
12860}
12861EOCP
12862 fflushNULL="$define"
12863 set tryp
12864 if eval $compile; then
12865 $rm -f tryp.out
12866 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12867 if cmp tryp.c tryp.out >/dev/null 2>&1; then
12868 $cat >&4 <<EOM
12869fflush(NULL) seems to behave okay with input streams.
12870EOM
12871 fflushNULL="$define"
12872 else
12873 $cat >&4 <<EOM
12874Ouch, fflush(NULL) clobbers input pipes! We will not use it.
12875EOM
12876 fflushNULL="$undef"
12877 fi
12878 fi
12879 $rm -f core tryp.c tryp.core core.tryp.*
12880 ;;
12881 '') $cat >&4 <<EOM
12882Your fflush(NULL) isn't working (contrary to ANSI C).
12883EOM
12884 fflushNULL="$undef"
12885 ;;
12886 *) $cat >&4 <<EOM
12887Cannot figure out whether your fflush(NULL) works or not.
12888I'm assuming it doesn't (contrary to ANSI C).
12889EOM
12890 fflushNULL="$undef"
12891 ;;
12892 esac
12893 ;;
12894$define|true|[yY]*)
12895 fflushNULL="$define"
12896 ;;
12897*)
12898 fflushNULL="$undef"
12899 ;;
12900esac
12901: check explicit looping only if NULL did not work, and if the pipe
12902: bug does not show up on an explicit flush too
12903case "$fflushNULL" in
12904"$undef")
12905 $cat >tryp.c <<EOCP
12906#include <stdio.h>
12907int
12908main(int argc, char **argv)
12909{
12910 char buf[1024];
12911 int i;
12912 char *bp = buf;
12913 while (1) {
12914 while ((i = getc(stdin)) != -1
12915 && (*bp++ = i) != '\n'
12916 && bp < &buf[1024])
12917 /* DO NOTHING */ ;
12918 *bp = '\0';
12919 fprintf(stdout, "%s", buf);
12920 fflush(stdin);
12921 if (i == -1)
12922 return 0;
12923 bp = buf;
12924 }
12925}
12926EOCP
12927 set tryp
12928 if eval $compile; then
12929 $rm -f tryp.out
12930 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12931 if cmp tryp.c tryp.out >/dev/null 2>&1; then
12932 $cat >&4 <<EOM
12933Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12934EOM
12935 : now check for fflushall behaviour
12936 case "$fflushall" in
12937 '') set try -DTRY_FFLUSH_ALL $output
12938 if eval $compile; then
12939 $cat >&4 <<EOM
12940(Now testing the other method--but note that this also may fail.)
12941EOM
12942 $rm -f try.out
12943 ./try$exe_ext 2>/dev/null
12944 if $test -s try.out -a "X$?" = X42; then
12945 fflushall="`$cat try.out`"
12946 fi
12947 fi
12948 $rm -f core try.core core.try.*
12949 case "$fflushall" in
12950 x) $cat >&4 <<EOM
12951Whew. Flushing explicitly all the stdio streams works.
12952EOM
12953 fflushall="$define"
12954 ;;
12955 '') $cat >&4 <<EOM
12956Sigh. Flushing explicitly all the stdio streams doesn't work.
12957EOM
12958 fflushall="$undef"
12959 ;;
12960 *) $cat >&4 <<EOM
12961Cannot figure out whether flushing stdio streams explicitly works or not.
12962I'm assuming it doesn't.
12963EOM
12964 fflushall="$undef"
12965 ;;
12966 esac
12967 ;;
12968 "$define"|true|[yY]*)
12969 fflushall="$define"
12970 ;;
12971 *)
12972 fflushall="$undef"
12973 ;;
12974 esac
12975 else
12976 $cat >&4 <<EOM
12977All is futile. Even fflush(stdin) clobbers input pipes!
12978EOM
12979 fflushall="$undef"
12980 fi
12981 else
12982 fflushall="$undef"
12983 fi
12984 $rm -f core tryp.c tryp.core core.tryp.*
12985 ;;
12986*) fflushall="$undef"
12987 ;;
12988esac
12989
12990case "$fflushNULL$fflushall" in
12991undefundef)
12992 $cat <<EOM
12993OK, I give up. I cannot figure out how to flush pending stdio output.
12994We won't be flushing handles at all before fork/exec/popen.
12995EOM
12996 ;;
12997esac
12998$rm -f try.* try$exe_ext
12999
13000: Store the full pathname to the ar program for use in the C program
13001: Respect a hint or command line value for full_ar.
13002case "$full_ar" in
13003'') full_ar=$ar ;;
13004esac
13005
13006: Store the full pathname to the sed program for use in the C program
13007full_sed=$sed
13008
13009: see what type gids are declared as in the kernel
13010echo " "
13011echo "Looking for the type for group ids returned by getgid()."
13012set gid_t gidtype xxx stdio.h sys/types.h
13013eval $typedef
13014case "$gidtype" in
13015xxx)
13016 xxx=`./findhdr sys/user.h`
13017 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13018 case $1 in
13019 unsigned) dflt="$1 $2" ;;
13020 *) dflt="$1" ;;
13021 esac
13022 ;;
13023*) dflt="$gidtype";;
13024esac
13025case "$gidtype" in
13026gid_t) echo "gid_t found." ;;
13027*) rp="What is the type for group ids returned by getgid()?"
13028 . ./myread
13029 gidtype="$ans"
13030 ;;
13031esac
13032
13033echo " "
13034case "$gidtype" in
13035*_t) zzz="$gidtype" ;;
13036*) zzz="gid" ;;
13037esac
13038echo "Checking the size of $zzz..." >&4
13039cat > try.c <<EOCP
13040#include <sys/types.h>
13041#include <stdio.h>
13042int main() {
13043 printf("%d\n", (int)sizeof($gidtype));
13044 exit(0);
13045}
13046EOCP
13047set try
13048if eval $compile_ok; then
13049 yyy=`./try`
13050 case "$yyy" in
13051 '') gidsize=4
13052 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13053 ;;
13054 *) gidsize=$yyy
13055 echo "Your $zzz is $gidsize bytes long."
13056 ;;
13057 esac
13058else
13059 gidsize=4
13060 echo "(I can't compile the test program--guessing $gidsize.)" >&4
13061fi
13062
13063
13064echo " "
13065case "$gidtype" in
13066*_t) zzz="$gidtype" ;;
13067*) zzz="gid" ;;
13068esac
13069echo "Checking the sign of $zzz..." >&4
13070cat > try.c <<EOCP
13071#include <sys/types.h>
13072#include <stdio.h>
13073int main() {
13074 $gidtype foo = -1;
13075 if (foo < 0)
13076 printf("-1\n");
13077 else
13078 printf("1\n");
13079}
13080EOCP
13081set try
13082if eval $compile; then
13083 yyy=`./try`
13084 case "$yyy" in
13085 '') gidsign=1
13086 echo "(I can't execute the test program--guessing unsigned.)" >&4
13087 ;;
13088 *) gidsign=$yyy
13089 case "$gidsign" in
13090 1) echo "Your $zzz is unsigned." ;;
13091 -1) echo "Your $zzz is signed." ;;
13092 esac
13093 ;;
13094 esac
13095else
13096 gidsign=1
13097 echo "(I can't compile the test program--guessing unsigned.)" >&4
13098fi
13099
13100
13101echo " "
13102
13103if $test X"$quadtype" != X; then
13104
13105echo "Checking how to print 64-bit integers..." >&4
13106
13107if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13108 $cat >try.c <<'EOCP'
13109#include <sys/types.h>
13110#include <stdio.h>
13111int main() {
13112 int q = 12345678901;
13113 printf("%ld\n", q);
13114}
13115EOCP
13116 set try
13117 if eval $compile; then
13118 yyy=`./try$exe_ext`
13119 case "$yyy" in
13120 12345678901)
13121 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13122 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13123 echo "We will use %d."
13124 ;;
13125 esac
13126 fi
13127fi
13128
13129if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13130 $cat >try.c <<'EOCP'
13131#include <sys/types.h>
13132#include <stdio.h>
13133int main() {
13134 long q = 12345678901;
13135 printf("%ld\n", q);
13136}
13137EOCP
13138 set try
13139 if eval $compile; then
13140 yyy=`./try$exe_ext`
13141 case "$yyy" in
13142 12345678901)
13143 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13144 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13145 echo "We will use %ld."
13146 ;;
13147 esac
13148 fi
13149fi
13150
13151if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13152 $cat >try.c <<'EOCP'
13153#include <sys/types.h>
13154#include <inttypes.h>
13155#include <stdio.h>
13156int main() {
13157 int64_t q = 12345678901;
13158 printf("%" PRId64 "\n", q);
13159}
13160EOCP
13161 set try
13162 if eval $compile; then
13163 yyy=`./try$exe_ext`
13164 case "$yyy" in
13165 12345678901)
13166 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13167 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13168 echo "We will use the C9X style."
13169 ;;
13170 esac
13171 fi
13172fi
13173
13174if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13175 $cat >try.c <<'EOCP'
13176#include <sys/types.h>
13177#include <stdio.h>
13178int main() {
13179 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13180 printf("%lld\n", q);
13181}
13182EOCP
13183 set try
13184 if eval $compile; then
13185 yyy=`./try$exe_ext`
13186 case "$yyy" in
13187 12345678901)
13188 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13189 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13190 echo "We will use the %lld style."
13191 ;;
13192 esac
13193 fi
13194fi
13195
13196if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13197 $cat >try.c <<EOCP
13198#include <sys/types.h>
13199#include <stdio.h>
13200int main() {
13201 $quadtype q = 12345678901;
13202 printf("%Ld\n", q);
13203}
13204EOCP
13205 set try
13206 if eval $compile; then
13207 yyy=`./try$exe_ext`
13208 case "$yyy" in
13209 12345678901)
13210 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13211 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13212 echo "We will use %Ld."
13213 ;;
13214 esac
13215 fi
13216fi
13217
13218if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13219 $cat >try.c <<EOCP
13220#include <sys/types.h>
13221#include <stdio.h>
13222int main() {
13223 $quadtype q = 12345678901;
13224 printf("%qd\n", q);
13225}
13226EOCP
13227 set try
13228 if eval $compile; then
13229 yyy=`./try$exe_ext`
13230 case "$yyy" in
13231 12345678901)
13232 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13233 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13234 echo "We will use %qd."
13235 ;;
13236 esac
13237 fi
13238fi
13239
13240if $test X"$sPRId64" = X; then
13241 echo "Cannot figure out how to print 64-bit integers." >&4
13242fi
13243
13244$rm -f try try.*
13245
13246fi
13247
13248case "$sPRId64" in
13249'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
13250 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
13251 ;;
13252*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
13253 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
13254 ;;
13255esac
13256
13257
13258echo " "
13259$echo "Checking the format strings to be used for Perl's internal types..." >&4
13260
13261if $test X"$ivsize" = X8; then
13262 ivdformat="$sPRId64"
13263 uvuformat="$sPRIu64"
13264 uvoformat="$sPRIo64"
13265 uvxformat="$sPRIx64"
13266 uvXUformat="$sPRIXU64"
13267else
13268 if $test X"$ivsize" = X"$longsize"; then
13269 ivdformat='"ld"'
13270 uvuformat='"lu"'
13271 uvoformat='"lo"'
13272 uvxformat='"lx"'
13273 uvXUformat='"lX"'
13274 else
13275 if $test X"$ivsize" = X"$intsize"; then
13276 ivdformat='"d"'
13277 uvuformat='"u"'
13278 uvoformat='"o"'
13279 uvxformat='"x"'
13280 uvXUformat='"X"'
13281 else
13282 : far out
13283 if $test X"$ivsize" = X"$shortsize"; then
13284 ivdformat='"hd"'
13285 uvuformat='"hu"'
13286 uvoformat='"ho"'
13287 uvxformat='"hx"'
13288 uvXUformat='"hX"'
13289 fi
13290 fi
13291 fi
13292fi
13293
13294if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13295 nveformat="$sPRIeldbl"
13296 nvfformat="$sPRIfldbl"
13297 nvgformat="$sPRIgldbl"
13298 nvEUformat="$sPRIEUldbl"
13299 nvFUformat="$sPRIFUldbl"
13300 nvGUformat="$sPRIGUldbl"
13301else
13302 nveformat='"e"'
13303 nvfformat='"f"'
13304 nvgformat='"g"'
13305 nvEUformat='"E"'
13306 nvFUformat='"F"'
13307 nvGUformat='"G"'
13308fi
13309
13310case "$ivdformat" in
13311'') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13312 exit 1
13313 ;;
13314esac
13315
13316
13317echo " "
13318$echo "Checking the format string to be used for gids..." >&4
13319
13320case "$gidsign" in
13321-1) if $test X"$gidsize" = X"$ivsize"; then
13322 gidformat="$ivdformat"
13323 else
13324 if $test X"$gidsize" = X"$longsize"; then
13325 gidformat='"ld"'
13326 else
13327 if $test X"$gidsize" = X"$intsize"; then
13328 gidformat='"d"'
13329 else
13330 if $test X"$gidsize" = X"$shortsize"; then
13331 gidformat='"hd"'
13332 fi
13333 fi
13334 fi
13335 fi
13336 ;;
13337*) if $test X"$gidsize" = X"$uvsize"; then
13338 gidformat="$uvuformat"
13339 else
13340 if $test X"$gidsize" = X"$longsize"; then
13341 gidformat='"lu"'
13342 else
13343 if $test X"$gidsize" = X"$intsize"; then
13344 gidformat='"u"'
13345 else
13346 if $test X"$gidsize" = X"$shortsize"; then
13347 gidformat='"hu"'
13348 fi
13349 fi
13350 fi
13351 fi
13352 ;;
13353esac
13354
13355: see if getgroups exists
13356set getgroups d_getgrps
13357eval $inlibc
13358
13359: see if setgroups exists
13360set setgroups d_setgrps
13361eval $inlibc
13362
13363
13364: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13365echo " "
13366case "$d_getgrps$d_setgrps" in
13367*define*)
13368 case "$groupstype" in
13369 '') dflt="$gidtype" ;;
13370 *) dflt="$groupstype" ;;
13371 esac
13372 $cat <<EOM
13373What type of pointer is the second argument to getgroups() and setgroups()?
13374Usually this is the same as group ids, $gidtype, but not always.
13375
13376EOM
13377 rp='What type pointer is the second argument to getgroups() and setgroups()?'
13378 . ./myread
13379 groupstype="$ans"
13380 ;;
13381*) groupstype="$gidtype";;
13382esac
13383
13384echo " "
13385echo "Checking if your $make program sets \$(MAKE)..." >&4
13386case "$make_set_make" in
13387'')
13388 $sed 's/^X //' > testmake.mak << 'EOF'
13389Xall:
13390X @echo 'maketemp="$(MAKE)"'
13391EOF
13392 case "`$make -f testmake.mak 2>/dev/null`" in
13393 *maketemp=*) make_set_make='#' ;;
13394 *) make_set_make="MAKE=$make" ;;
13395 esac
13396 $rm -f testmake.mak
13397 ;;
13398esac
13399case "$make_set_make" in
13400'#') echo "Yup, it does.";;
13401*) echo "Nope, it doesn't.";;
13402esac
13403
13404: see what type is used for mode_t
13405rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13406set mode_t modetype int stdio.h sys/types.h
13407eval $typedef_ask
13408
13409: define a fucntion to check prototypes
13410$cat > protochk <<EOSH
13411$startsh
13412cc="$cc"
13413optimize="$optimize"
13414ccflags="$ccflags"
13415prototype="$prototype"
13416define="$define"
13417rm=$rm
13418EOSH
13419
13420$cat >> protochk <<'EOSH'
13421
13422$rm -f try.c
13423foo="$1"
13424shift
13425while test $# -ge 2; do
13426 case "$1" in
13427 $define) echo "#include <$2>" >> try.c ;;
13428 literal) echo "$2" >> try.c ;;
13429 esac
13430 shift 2
13431done
13432test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
13433cat >> try.c <<'EOCP'
13434#ifdef CAN_PROTOTYPE
13435#define _(args) args
13436#else
13437#define _(args) ()
13438#endif
13439EOCP
13440echo "$foo" >> try.c
13441echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13442$cc $optimize $ccflags -c try.c > /dev/null 2>&1
13443status=$?
13444$rm -f try.[co]
13445exit $status
13446EOSH
13447chmod +x protochk
13448$eunicefix protochk
13449
13450: see what type is used for size_t
13451rp="What is the type used for the length parameter for string functions?"
13452set size_t sizetype 'unsigned int' stdio.h sys/types.h
13453eval $typedef_ask
13454
13455: check for type of arguments to gethostbyaddr.
13456if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13457 case "$d_gethbyaddr" in
13458 $define)
13459 $cat <<EOM
13460
13461Checking to see what type of arguments are accepted by gethostbyaddr().
13462EOM
13463 hdrs="$define sys/types.h
13464 $d_socket sys/socket.h
13465 $i_niin netinet/in.h
13466 $i_netdb netdb.h
13467 $i_unistd unistd.h"
13468 : The first arg can 'char *' or 'void *'
13469 : The second arg is some of integral type
13470 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13471 for yyy in size_t long int; do
13472 case "$netdb_host_type" in
13473 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13474 if ./protochk "$try" $hdrs; then
13475 echo "Your system accepts $xxx for the first arg."
13476 echo "...and $yyy for the second arg."
13477 netdb_host_type="$xxx"
13478 netdb_hlen_type="$yyy"
13479 fi
13480 ;;
13481 esac
13482 done
13483 done
13484 : In case none of those worked, prompt the user.
13485 case "$netdb_host_type" in
13486 '') rp='What is the type for the 1st argument to gethostbyaddr?'
13487 dflt='char *'
13488 . ./myread
13489 netdb_host_type=$ans
13490 rp='What is the type for the 2nd argument to gethostbyaddr?'
13491 dflt="$sizetype"
13492 . ./myread
13493 netdb_hlen_type=$ans
13494 ;;
13495 esac
13496 ;;
13497 *) : no gethostbyaddr, so pick harmless defaults
13498 netdb_host_type='char *'
13499 netdb_hlen_type="$sizetype"
13500 ;;
13501 esac
13502 # Remove the "const" if needed. -- but then we'll have a
13503 # prototype clash!
13504 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13505fi
13506
13507: check for type of argument to gethostbyname.
13508if test "X$netdb_name_type" = X ; then
13509 case "$d_gethbyname" in
13510 $define)
13511 $cat <<EOM
13512
13513Checking to see what type of argument is accepted by gethostbyname().
13514EOM
13515 hdrs="$define sys/types.h
13516 $d_socket sys/socket.h
13517 $i_niin netinet/in.h
13518 $i_netdb netdb.h
13519 $i_unistd unistd.h"
13520 for xxx in "const char *" "char *"; do
13521 case "$netdb_name_type" in
13522 '') try="extern struct hostent *gethostbyname($xxx);"
13523 if ./protochk "$try" $hdrs; then
13524 echo "Your system accepts $xxx."
13525 netdb_name_type="$xxx"
13526 fi
13527 ;;
13528 esac
13529 done
13530 : In case none of those worked, prompt the user.
13531 case "$netdb_name_type" in
13532 '') rp='What is the type for the 1st argument to gethostbyname?'
13533 dflt='char *'
13534 . ./myread
13535 netdb_name_type=$ans
13536 ;;
13537 esac
13538 ;;
13539 *) : no gethostbyname, so pick harmless default
13540 netdb_name_type='char *'
13541 ;;
13542 esac
13543fi
13544
13545: check for type of 1st argument to getnetbyaddr.
13546if test "X$netdb_net_type" = X ; then
13547 case "$d_getnbyaddr" in
13548 $define)
13549 $cat <<EOM
13550
13551Checking to see what type of 1st argument is accepted by getnetbyaddr().
13552EOM
13553 hdrs="$define sys/types.h
13554 $d_socket sys/socket.h
13555 $i_niin netinet/in.h
13556 $i_netdb netdb.h
13557 $i_unistd unistd.h"
13558 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13559 case "$netdb_net_type" in
13560 '') try="extern struct netent *getnetbyaddr($xxx, int);"
13561 if ./protochk "$try" $hdrs; then
13562 echo "Your system accepts $xxx."
13563 netdb_net_type="$xxx"
13564 fi
13565 ;;
13566 esac
13567 done
13568 : In case none of those worked, prompt the user.
13569 case "$netdb_net_type" in
13570 '') rp='What is the type for the 1st argument to getnetbyaddr?'
13571 dflt='long'
13572 . ./myread
13573 netdb_net_type=$ans
13574 ;;
13575 esac
13576 ;;
13577 *) : no getnetbyaddr, so pick harmless default
13578 netdb_net_type='long'
13579 ;;
13580 esac
13581fi
13582: locate the preferred pager for this system
13583case "$pager" in
13584'')
13585 dflt=''
13586 case "$pg" in
13587 /*) dflt=$pg;;
13588 [a-zA-Z]:/*) dflt=$pg;;
13589 esac
13590 case "$more" in
13591 /*) dflt=$more;;
13592 [a-zA-Z]:/*) dflt=$more;;
13593 esac
13594 case "$less" in
13595 /*) dflt=$less;;
13596 [a-zA-Z]:/*) dflt=$less;;
13597 esac
13598 case "$dflt" in
13599 '') dflt=/usr/ucb/more;;
13600 esac
13601 ;;
13602*) dflt="$pager";;
13603esac
13604echo " "
13605fn=f/
13606rp='What pager is used on your system?'
13607. ./getfile
13608pager="$ans"
13609
13610: see what type pids are declared as in the kernel
13611rp="What is the type of process ids on this system?"
13612set pid_t pidtype int stdio.h sys/types.h
13613eval $typedef_ask
13614
13615: Find earliest binary compatible site_perl subdirectory perl can use.
13616case "$bincompat5005" in
13617"$define") xs_apiversion='5.005' ;;
13618*) xs_apiversion=$version ;; # The current site_perl version.
13619esac
13620: Find earliest pure perl site_perl subdirectory perl can use.
13621: The versioned directories started at 5.005.
13622pm_apiversion='5.005'
13623
13624: check for length of pointer
13625echo " "
13626case "$ptrsize" in
13627'')
13628 echo "Checking to see how big your pointers are..." >&4
13629 if test "$voidflags" -gt 7; then
13630 echo '#define VOID_PTR char *' > try.c
13631 else
13632 echo '#define VOID_PTR void *' > try.c
13633 fi
13634 $cat >>try.c <<'EOCP'
13635#include <stdio.h>
13636int main()
13637{
13638 printf("%d\n", (int)sizeof(VOID_PTR));
13639 exit(0);
13640}
13641EOCP
13642 set try
13643 if eval $compile_ok; then
13644 ptrsize=`./try`
13645 echo "Your pointers are $ptrsize bytes long."
13646 else
13647 dflt='4'
13648 echo "(I can't seem to compile the test program. Guessing...)" >&4
13649 rp="What is the size of a pointer (in bytes)?"
13650 . ./myread
13651 ptrsize="$ans"
13652 fi
13653 ;;
13654esac
13655$rm -f try.c try
13656
13657: see if ar generates random libraries by itself
13658echo " "
13659echo "Checking how to generate random libraries on your machine..." >&4
13660echo 'int bar1() { return bar2(); }' > bar1.c
13661echo 'int bar2() { return 2; }' > bar2.c
13662$cat > foo.c <<'EOP'
13663int main() { printf("%d\n", bar1()); exit(0); }
13664EOP
13665$cc $ccflags -c bar1.c >/dev/null 2>&1
13666$cc $ccflags -c bar2.c >/dev/null 2>&1
13667$cc $ccflags -c foo.c >/dev/null 2>&1
13668$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 13669if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
b4eb6b3d
JH
13670 ./foobar >/dev/null 2>&1; then
13671 echo "$ar appears to generate random libraries itself."
13672 orderlib=false
13673 ranlib=":"
13674elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 13675 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
b4eb6b3d
JH
13676 ./foobar >/dev/null 2>&1; then
13677 echo "a table of contents needs to be added with '$ar ts'."
13678 orderlib=false
13679 ranlib="$ar ts"
13680else
13681 case "$ranlib" in
13682 :) ranlib='';;
13683 '')
13684 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13685 $test -f $ranlib || ranlib=''
13686 ;;
13687 esac
13688 if $test -n "$ranlib"; then
13689 echo "your system has '$ranlib'; we'll use that."
13690 orderlib=false
13691 else
13692 echo "your system doesn't seem to support random libraries"
13693 echo "so we'll use lorder and tsort to order the libraries."
13694 orderlib=true
13695 ranlib=":"
13696 fi
13697fi
13698$rm -f foo* bar*
13699
13700: check for type of arguments to select.
13701case "$selecttype" in
13702'') case "$d_select" in
13703 $define)
13704 echo " "
13705 $cat <<EOM
13706Checking to see what type of arguments are accepted by select().
13707EOM
13708 hdrs="$define sys/types.h
13709 $i_systime sys/time.h
13710 $i_sysselct sys/select.h
13711 $d_socket sys/socket.h"
13712 : The first arg can be int, unsigned, or size_t
13713 : The last arg may or may not be 'const'
13714 val=''
13715 : void pointer has been seen but using that
13716 : breaks the selectminbits test
13717 for xxx in 'fd_set *' 'int *'; do
13718 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13719 for tmo in 'struct timeval *' 'const struct timeval *'; do
13720 case "$val" in
13721 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13722 if ./protochk "$try" $hdrs; then
13723 echo "Your system accepts $xxx."
13724 val="$xxx"
13725 fi
13726 ;;
13727 esac
13728 done
13729 done
13730 done
13731 case "$val" in
13732 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13733 case "$d_fd_set" in
13734 $define) dflt="fd_set *" ;;
13735 *) dflt="int *" ;;
13736 esac
13737 . ./myread
13738 val=$ans
13739 ;;
13740 esac
13741 selecttype="$val"
13742 ;;
13743 *) : no select, so pick a harmless default
13744 selecttype='int *'
13745 ;;
13746 esac
13747 ;;
13748esac
13749
13750: check for the select 'width'
13751case "$selectminbits" in
13752'') case "$d_select" in
13753 $define)
13754 $cat <<EOM
13755
13756Checking to see on how many bits at a time your select() operates...
13757EOM
13758 $cat >try.c <<EOCP
13759#include <sys/types.h>
13760#$i_time I_TIME
13761#$i_systime I_SYS_TIME
13762#$i_systimek I_SYS_TIME_KERNEL
13763#ifdef I_TIME
13764# include <time.h>
13765#endif
13766#ifdef I_SYS_TIME
13767# ifdef I_SYS_TIME_KERNEL
13768# define KERNEL
13769# endif
13770# include <sys/time.h>
13771# ifdef I_SYS_TIME_KERNEL
13772# undef KERNEL
13773# endif
13774#endif
13775#$i_sysselct I_SYS_SELECT
13776#ifdef I_SYS_SELECT
13777#include <sys/select.h>
13778#endif
13779#$d_socket HAS_SOCKET
13780#ifdef HAS_SOCKET
13781# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13782#endif
13783#include <stdio.h>
13784$selecttype b;
13785#define S sizeof(*(b))
13786#define MINBITS 64
13787#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13788#define NBITS (NBYTES * 8)
13789int main() {
13790 char s[NBYTES];
13791 struct timeval t;
13792 int i;
13793 FILE* fp;
13794 int fd;
13795
13796 fclose(stdin);
13797 fp = fopen("try.c", "r");
13798 if (fp == 0)
13799 exit(1);
13800 fd = fileno(fp);
13801 if (fd < 0)
13802 exit(2);
13803 b = ($selecttype)s;
13804 for (i = 0; i < NBITS; i++)
13805 FD_SET(i, b);
13806 t.tv_sec = 0;
13807 t.tv_usec = 0;
13808 select(fd + 1, b, 0, 0, &t);
13809 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13810 printf("%d\n", i + 1);
13811 return 0;
13812}
13813EOCP
13814 set try
13815 if eval $compile_ok; then
13816 selectminbits=`./try`
13817 case "$selectminbits" in
13818 '') cat >&4 <<EOM
13819Cannot figure out on how many bits at a time your select() operates.
13820I'll play safe and guess it is 32 bits.
13821EOM
13822 selectminbits=32
13823 bits="32 bits"
13824 ;;
13825 1) bits="1 bit" ;;
13826 *) bits="$selectminbits bits" ;;
13827 esac
13828 echo "Your select() operates on $bits at a time." >&4
13829 else
13830 rp='What is the minimum number of bits your select() operates on?'
13831 case "$byteorder" in
13832 1234|12345678) dflt=32 ;;
13833 *) dflt=1 ;;
13834 esac
13835 . ./myread
13836 val=$ans
13837 selectminbits="$val"
13838 fi
13839 $rm -f try.* try
13840 ;;
13841 *) : no select, so pick a harmless default
13842 selectminbits='32'
13843 ;;
13844 esac
13845 ;;
13846esac
13847
13848: Trace out the files included by signal.h, then look for SIGxxx names.
13849: Remove SIGARRAYSIZE used by HPUX.
13850: Remove SIGSTKSIZE used by Linux.
13851: Remove SIGSTKSZ used by Posix.
13852: Remove SIGTYP void lines used by OS2.
13853: Some cpps, like os390, dont give the file name anywhere
13854if [ "X$fieldn" = X ]; then
13855 : Just make some guesses. We check them later.
13856 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13857else
13858 xxx=`echo '#include <signal.h>' |
13859 $cppstdin $cppminus $cppflags 2>/dev/null |
13860 $grep '^[ ]*#.*include' |
13861 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13862fi
13863: Check this list of files to be sure we have parsed the cpp output ok.
13864: This will also avoid potentially non-existent files, such
13865: as ../foo/bar.h
13866xxxfiles=''
13867for xx in $xxx /dev/null ; do
13868 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13869done
13870: If we have found no files, at least try signal.h
13871case "$xxxfiles" in
13872'') xxxfiles=`./findhdr signal.h` ;;
13873esac
13874xxx=`awk '
13875$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13876 print substr($2, 4, 20)
13877}
13878$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13879 print substr($3, 4, 20)
13880}' $xxxfiles`
13881: Append some common names just in case the awk scan failed.
13882xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13883xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13884xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13885xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13886xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13887
13888: generate a few handy files for later
13889$cat > signal.c <<'EOCP'
13890#include <sys/types.h>
13891#include <signal.h>
13892#include <stdio.h>
13893int main() {
13894
13895/* Strange style to avoid deeply-nested #if/#else/#endif */
13896#ifndef NSIG
13897# ifdef _NSIG
13898# define NSIG (_NSIG)
13899# endif
13900#endif
13901
13902#ifndef NSIG
13903# ifdef SIGMAX
13904# define NSIG (SIGMAX+1)
13905# endif
13906#endif
13907
13908#ifndef NSIG
13909# ifdef SIG_MAX
13910# define NSIG (SIG_MAX+1)
13911# endif
13912#endif
13913
13914#ifndef NSIG
13915# ifdef MAXSIG
13916# define NSIG (MAXSIG+1)
13917# endif
13918#endif
13919
13920#ifndef NSIG
13921# ifdef MAX_SIG
13922# define NSIG (MAX_SIG+1)
13923# endif
13924#endif
13925
13926#ifndef NSIG
13927# ifdef SIGARRAYSIZE
13928# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13929# endif
13930#endif
13931
13932#ifndef NSIG
13933# ifdef _sys_nsig
13934# define NSIG (_sys_nsig) /* Solaris 2.5 */
13935# endif
13936#endif
13937
13938/* Default to some arbitrary number that's big enough to get most
13939 of the common signals.
13940*/
13941#ifndef NSIG
13942# define NSIG 50
13943#endif
13944
13945printf("NSIG %d\n", NSIG);
13946
13947#ifndef JUST_NSIG
13948
13949EOCP
13950
13951echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13952{
13953 printf "#ifdef SIG"; printf $1; printf "\n"
13954 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13955 printf $1; printf ");\n"
13956 printf "#endif\n"
13957}
13958END {
13959 printf "#endif /* JUST_NSIG */\n";
13960 printf "exit(0);\n}\n";
13961}
13962' >>signal.c
13963$cat >signal.awk <<'EOP'
13964BEGIN { ndups = 0 }
13965$1 ~ /^NSIG$/ { nsig = $2 }
13966($1 !~ /^NSIG$/) && (NF == 2) {
13967 if ($2 > maxsig) { maxsig = $2 }
13968 if (sig_name[$2]) {
13969 dup_name[ndups] = $1
13970 dup_num[ndups] = $2
13971 ndups++
13972 }
13973 else {
13974 sig_name[$2] = $1
13975 sig_num[$2] = $2
13976 }
13977}
13978END {
13979 if (nsig == 0) {
13980 nsig = maxsig + 1
13981 }
13982 printf("NSIG %d\n", nsig);
13983 for (n = 1; n < nsig; n++) {
13984 if (sig_name[n]) {
13985 printf("%s %d\n", sig_name[n], sig_num[n])
13986 }
13987 else {
13988 printf("NUM%d %d\n", n, n)
13989 }
13990 }
13991 for (n = 0; n < ndups; n++) {
13992 printf("%s %d\n", dup_name[n], dup_num[n])
13993 }
13994}
13995EOP
13996$cat >signal_cmd <<EOS
13997$startsh
13998if $test -s signal.lst; then
13999 echo "Using your existing signal.lst file"
14000 exit 0
14001fi
14002xxx="$xxx"
14003EOS
14004$cat >>signal_cmd <<'EOS'
14005
14006set signal
14007if eval $compile_ok; then
14008 ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14009else
14010 echo "(I can't seem be able to compile the whole test program)" >&4
14011 echo "(I'll try it in little pieces.)" >&4
14012 set signal -DJUST_NSIG
14013 if eval $compile_ok; then
14014 ./signal$_exe > signal.nsg
14015 $cat signal.nsg
14016 else
14017 echo "I can't seem to figure out how many signals you have." >&4
14018 echo "Guessing 50." >&4
14019 echo 'NSIG 50' > signal.nsg
14020 fi
14021 : Now look at all the signal names, one at a time.
14022 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14023 $cat > signal.c <<EOCP
14024#include <sys/types.h>
14025#include <signal.h>
14026#include <stdio.h>
14027int main() {
14028printf("$xx %d\n", SIG${xx});
14029return 0;
14030}
14031EOCP
14032 set signal
14033 if eval $compile; then
14034 echo "SIG${xx} found."
14035 ./signal$_exe >> signal.ls1
14036 else
14037 echo "SIG${xx} NOT found."
14038 fi
14039 done
14040 if $test -s signal.ls1; then
14041 $cat signal.nsg signal.ls1 |
14042 $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14043 fi
14044
14045fi
14046if $test -s signal.lst; then
14047 :
14048else
14049 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14050 echo 'kill -l' >signal
14051 set X `csh -f <signal`
14052 $rm -f signal
14053 shift
14054 case $# in
14055 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14056 esac
14057 echo $@ | $tr ' ' $trnl | \
14058 $awk '{ printf "%s %d\n", $1, ++s; }
14059 END { printf "NSIG %d\n", ++s }' >signal.lst
14060fi
14061$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14062EOS
14063chmod a+x signal_cmd
14064$eunicefix signal_cmd
14065
14066: generate list of signal names
14067echo " "
14068case "$sig_name_init" in
14069'') doinit=yes ;;
14070*) case "$sig_num_init" in
14071 ''|*,*) doinit=yes ;;
14072 esac ;;
14073esac
14074case "$doinit" in
14075yes)
14076 echo "Generating a list of signal names and numbers..." >&4
14077 . ./signal_cmd
14078 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14079 sig_name=`$awk 'BEGIN { printf "ZERO " }
14080 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14081 sig_num=`$awk 'BEGIN { printf "0 " }
14082 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14083 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
14084 !/^NSIG/ { printf "\"%s\", ", $1 }
14085 END { printf "0\n" }' signal.lst`
14086 sig_num_init=`$awk 'BEGIN { printf "0, " }
14087 !/^NSIG/ { printf "%d, ", $2}
14088 END { printf "0\n"}' signal.lst`
14089 ;;
14090esac
14091echo "The following $sig_count signals are available:"
14092echo " "
14093echo $sig_name | $awk \
14094'BEGIN { linelen = 0 }
14095{
14096 for (i = 1; i <= NF; i++) {
14097 name = "SIG" $i " "
14098 linelen = linelen + length(name)
14099 if (linelen > 70) {
14100 printf "\n"
14101 linelen = length(name)
14102 }
14103 printf "%s", name
14104 }
14105 printf "\n"
14106}'
14107$rm -f signal signal.c signal.awk signal.lst signal_cmd
14108
14109echo " "
14110case "$sizetype" in
14111*_t) zzz="$sizetype" ;;
14112*) zzz="filesize" ;;
14113esac
14114echo "Checking the size of $zzz..." >&4
14115cat > try.c <<EOCP
14116#include <sys/types.h>
14117#include <stdio.h>
14118int main() {
14119 printf("%d\n", (int)sizeof($sizetype));
14120 exit(0);
14121}
14122EOCP
14123set try
14124if eval $compile_ok; then
14125 yyy=`./try`
14126 case "$yyy" in
14127 '') sizesize=4
14128 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14129 ;;
14130 *) sizesize=$yyy
14131 echo "Your $zzz size is $sizesize bytes."
14132 ;;
14133 esac
14134else
14135 sizesize=4
14136 echo "(I can't compile the test program--guessing $sizesize.)" >&4
14137fi
14138
14139
14140: check for socklen_t
14141echo " "
14142echo "Checking to see if you have socklen_t..." >&4
14143$cat >try.c <<EOCP
14144#include <sys/types.h>
14145#$d_socket HAS_SOCKET
14146#ifdef HAS_SOCKET
14147#include <sys/socket.h>
14148#endif
14149int main() { socklen_t x = 16; }
14150EOCP
14151set try
14152if eval $compile; then
14153 val="$define"
14154 echo "You have socklen_t."
14155else
14156 val="$undef"
14157 echo "You do not have socklen_t."
14158 case "$sizetype" in
14159 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14160 esac
14161fi
14162$rm -f try try.*
14163set d_socklen_t
14164eval $setvar
14165
14166: check for type of the size argument to socket calls
14167case "$d_socket" in
14168"$define")
14169 $cat <<EOM
14170
14171Checking to see what type is the last argument of accept().
14172EOM
14173 hdrs="$define sys/types.h $d_socket sys/socket.h"
14174 yyy=''
14175 case "$d_socklen_t" in
14176 "$define") yyy="$yyy socklen_t"
14177 esac
14178 yyy="$yyy $sizetype int long unsigned"
14179 for xxx in $yyy; do
14180 case "$socksizetype" in
14181 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
14182 if ./protochk "$try" $hdrs; then
14183 echo "Your system accepts '$xxx *' for the last argument of accept()."
14184 socksizetype="$xxx"
14185 fi
14186 ;;
14187 esac
14188 done
14189: In case none of those worked, prompt the user.
14190 case "$socksizetype" in
14191 '') rp='What is the type for socket address structure sizes?'
14192 dflt='int'
14193 . ./myread
14194 socksizetype=$ans
14195 ;;
14196 esac
14197 ;;
14198*) : no sockets, so pick relatively harmless default
14199 socksizetype='int'
14200 ;;
14201esac
14202
14203: see what type is used for signed size_t
14204set ssize_t ssizetype int stdio.h sys/types.h
14205eval $typedef
14206dflt="$ssizetype"
14207$cat > ssize.c <<EOM
14208#include <stdio.h>
14209#include <sys/types.h>
14210#define Size_t $sizetype
14211#define SSize_t $dflt
14212int main()
14213{
14214 if (sizeof(Size_t) == sizeof(SSize_t))
14215 printf("$dflt\n");
14216 else if (sizeof(Size_t) == sizeof(int))
14217 printf("int\n");
14218 else
14219 printf("long\n");
14220 exit(0);
14221}
14222EOM
14223echo " "
14224set ssize
14225if eval $compile_ok && ./ssize > /dev/null; then
14226 ssizetype=`./ssize`
14227 echo "I'll be using $ssizetype for functions returning a byte count." >&4
14228else
14229 $cat >&4 <<EOM
14230Help! I can't compile and run the ssize_t test program: please enlighten me!
14231(This is probably a misconfiguration in your system or libraries, and
14232you really ought to fix it. Still, I'll try anyway.)
14233
14234I need a type that is the same size as $sizetype, but is guaranteed to
14235be signed. Common values are ssize_t, int and long.
14236
14237EOM
14238 rp="What signed type is the same size as $sizetype?"
14239 . ./myread
14240 ssizetype="$ans"
14241fi
14242$rm -f ssize ssize.*
14243
14244: see what type of char stdio uses.
14245echo " "
14246if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
14247 echo "Your stdio uses unsigned chars." >&4
14248 stdchar="unsigned char"
14249else
14250 echo "Your stdio uses signed chars." >&4
14251 stdchar="char"
14252fi
14253
14254: see if time exists
14255echo " "
14256if test "X$d_time" = X -o X"$timetype" = X; then
14257 if set time val -f d_time; eval $csym; $val; then
14258 echo 'time() found.' >&4
14259 val="$define"
14260 rp="What is the type returned by time() on this system?"
14261 set time_t timetype long stdio.h sys/types.h
14262 eval $typedef_ask
14263 else
14264 echo 'time() not found, hope that will do.' >&4
14265 val="$undef"
14266 timetype='int';
14267 fi
14268 set d_time
14269 eval $setvar
14270fi
14271
14272: see what type uids are declared as in the kernel
14273echo " "
14274echo "Looking for the type for user ids returned by getuid()."
14275set uid_t uidtype xxx stdio.h sys/types.h
14276eval $typedef
14277case "$uidtype" in
14278xxx)
14279 xxx=`./findhdr sys/user.h`
14280 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14281 case $1 in
14282 unsigned) dflt="$1 $2" ;;
14283 *) dflt="$1" ;;
14284 esac
14285 ;;
14286*) dflt="$uidtype";;
14287esac
14288case "$uidtype" in
14289uid_t) echo "uid_t found." ;;
14290*) rp="What is the type for user ids returned by getuid()?"
14291 . ./myread
14292 uidtype="$ans"
14293 ;;
14294esac
14295
14296echo " "
14297case "$uidtype" in
14298*_t) zzz="$uidtype" ;;
14299*) zzz="uid" ;;
14300esac
14301echo "Checking the size of $zzz..." >&4
14302cat > try.c <<EOCP
14303#include <sys/types.h>
14304#include <stdio.h>
14305int main() {
14306 printf("%d\n", (int)sizeof($uidtype));
14307 exit(0);
14308}
14309EOCP
14310set try
14311if eval $compile_ok; then
14312 yyy=`./try`
14313 case "$yyy" in
14314 '') uidsize=4
14315 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14316 ;;
14317 *) uidsize=$yyy
14318 echo "Your $zzz is $uidsize bytes long."
14319 ;;
14320 esac
14321else
14322 uidsize=4
14323 echo "(I can't compile the test program--guessing $uidsize.)" >&4
14324fi
14325
14326echo " "
14327case "$uidtype" in
14328*_t) zzz="$uidtype" ;;
14329*) zzz="uid" ;;
14330esac
14331echo "Checking the sign of $zzz..." >&4
14332cat > try.c <<EOCP
14333#include <sys/types.h>
14334#include <stdio.h>
14335int main() {
14336 $uidtype foo = -1;
14337 if (foo < 0)
14338 printf("-1\n");
14339 else
14340 printf("1\n");
14341}
14342EOCP
14343set try
14344if eval $compile; then
14345 yyy=`./try`
14346 case "$yyy" in
14347 '') uidsign=1
14348 echo "(I can't execute the test program--guessing unsigned.)" >&4
14349 ;;
14350 *) uidsign=$yyy
14351 case "$uidsign" in
14352 1) echo "Your $zzz is unsigned." ;;
14353 -1) echo "Your $zzz is signed." ;;
14354 esac
14355 ;;
14356 esac
14357else
14358 uidsign=1
14359 echo "(I can't compile the test program--guessing unsigned.)" >&4
14360fi
14361
14362
14363
14364echo " "
14365$echo "Checking the format string to be used for uids..." >&4
14366
14367case "$uidsign" in
14368-1) if $test X"$uidsize" = X"$ivsize"; then
14369 uidformat="$ivdformat"
14370 else
14371 if $test X"$uidsize" = X"$longsize"; then
14372 uidformat='"ld"'
14373 else
14374 if $test X"$uidsize" = X"$intsize"; then
14375 uidformat='"d"'
14376 else
14377 if $test X"$uidsize" = X"$shortsize"; then
14378 uidformat='"hd"'
14379 fi
14380 fi
14381 fi
14382 fi
14383 ;;
14384*) if $test X"$uidsize" = X"$uvsize"; then
14385 uidformat="$uvuformat"
14386 else
14387 if $test X"$uidsize" = X"$longsize"; then
14388 uidformat='"lu"'
14389 else
14390 if $test X"$uidsize" = X"$intsize"; then
14391 uidformat='"u"'
14392 else
14393 if $test X"$uidsize" = X"$shortsize"; then
14394 uidformat='"hu"'
14395 fi
14396 fi
14397 fi
14398 fi
14399 ;;
14400esac
14401
14402: see if dbm.h is available
14403: see if dbmclose exists
14404set dbmclose d_dbmclose
14405eval $inlibc
14406
14407case "$d_dbmclose" in
14408$define)
14409 set dbm.h i_dbm
14410 eval $inhdr
14411 case "$i_dbm" in
14412 $define)
14413 val="$undef"
14414 set i_rpcsvcdbm
14415 eval $setvar
14416 ;;
14417 *) set rpcsvc/dbm.h i_rpcsvcdbm
14418 eval $inhdr
14419 ;;
14420 esac
14421 ;;
14422*) echo "We won't be including <dbm.h>"
14423 val="$undef"
14424 set i_dbm
14425 eval $setvar
14426 val="$undef"
14427 set i_rpcsvcdbm
14428 eval $setvar
14429 ;;
14430esac
14431
14432: see if this is a sys/file.h system
14433val=''
14434set sys/file.h val
14435eval $inhdr
14436
14437: do we need to include sys/file.h ?
14438case "$val" in
14439"$define")
14440 echo " "
14441 if $h_sysfile; then
14442 val="$define"
14443 echo "We'll be including <sys/file.h>." >&4
14444 else
14445 val="$undef"
14446 echo "We won't be including <sys/file.h>." >&4
14447 fi
14448 ;;
14449*)
14450 h_sysfile=false
14451 ;;
14452esac
14453set i_sysfile
14454eval $setvar
14455
14456: see if fcntl.h is there
14457val=''
14458set fcntl.h val
14459eval $inhdr
14460
14461: see if we can include fcntl.h
14462case "$val" in
14463"$define")
14464 echo " "
14465 if $h_fcntl; then
14466 val="$define"
14467 echo "We'll be including <fcntl.h>." >&4
14468 else
14469 val="$undef"
14470 if $h_sysfile; then
14471 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14472 else
14473 echo "We won't be including <fcntl.h>." >&4
14474 fi
14475 fi
14476 ;;
14477*)
14478 h_fcntl=false
14479 val="$undef"
14480 ;;
14481esac
14482set i_fcntl
14483eval $setvar
14484
14485: see if this is a iconv.h system
14486set iconv.h i_iconv
14487eval $inhdr
14488
14489: see if this is a ieeefp.h system
14490set ieeefp.h i_ieeefp
14491eval $inhdr
14492
14493: see if this is a libutil.h system
14494set libutil.h i_libutil
14495eval $inhdr
14496
14497: see if locale.h is available
14498set locale.h i_locale
14499eval $inhdr
14500
14501: see if mach cthreads are available
14502if test "X$usethreads" = "X$define"; then
14503 set mach/cthreads.h i_machcthr
14504 eval $inhdr
14505else
14506 i_machcthr="$undef"
14507fi
14508
14509
14510
14511: see if this is a math.h system
14512set math.h i_math
14513eval $inhdr
14514
14515: see if this is a mntent.h system
14516set mntent.h i_mntent
14517eval $inhdr
14518
14519: see if ndbm.h is available
14520set ndbm.h t_ndbm
14521eval $inhdr
14522case "$t_ndbm" in
14523$define)
14524 : see if dbm_open exists
14525 set dbm_open d_dbm_open
14526 eval $inlibc
14527 case "$d_dbm_open" in
14528 $undef)
14529 t_ndbm="$undef"
14530 echo "We won't be including <ndbm.h>"
14531 ;;
14532 esac
14533 ;;
14534esac
14535val="$t_ndbm"
14536set i_ndbm
14537eval $setvar
14538
14539: see if net/errno.h is available
14540val=''
14541set net/errno.h val
14542eval $inhdr
14543
14544: Unfortunately, it causes problems on some systems. Arrgh.
14545case "$val" in
14546$define)
14547 cat > try.c <<'EOM'
14548#include <stdio.h>
14549#include <errno.h>
14550#include <net/errno.h>
14551int func()
14552{
14553 return ENOTSOCK;
14554}
14555EOM
14556 if $cc $ccflags -c try.c >/dev/null 2>&1; then
14557 echo "We'll be including <net/errno.h>." >&4
14558 else
14559 echo "We won't be including <net/errno.h>." >&4
14560 val="$undef"
14561 fi
14562 $rm -f try.* try
14563 ;;
14564esac
14565set i_neterrno
14566eval $setvar
14567
14568: see if netinet/tcp.h is available
14569set netinet/tcp.h i_netinettcp
14570eval $inhdr
14571
14572: see if this is a poll.h system
14573set poll.h i_poll
14574eval $inhdr
14575
14576: see if this is a prot.h system
14577set prot.h i_prot
14578eval $inhdr
14579
14580echo " "
14581$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
14582$cat <<'EOSH' > Cppsym.know
14583a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14584AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14585alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14586ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14587BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14588BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14589bull c cadmus clipper CMU COFF COMPILER_VERSION
14590concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14591CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14592Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14593FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14594GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14595H3050R H3050RX hbullx20 hcx host_mips
14596hp200 hp300 hp700 HP700 hp800 hp9000
14597hp9000s200 hp9000s300 hp9000s400 hp9000s500
14598hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14599i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14600iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14601INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14602LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14603LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14604Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14605LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14606M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14607M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14608M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14609MATH_HAS_NO_SIDE_EFFECTS
14610mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14611mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14612mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14613MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14614mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14615NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 14616news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
14617ns32016 ns32332 ns32k nsc32000
14618OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14619pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14620pc532 pdp11 PGC PIC plexus PORTAR posix
14621POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14622POSIX_C_SOURCE POSIX_SOURCE POWER
14623PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14624riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14625SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14626sony sony_news sonyrisc sparc sparclite spectrum
14627stardent stdc STDC_EXT stratos sun sun3 sun386
14628Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14629SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14630SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14631sysV68 sysV88 Tek4132 Tek4300 titan
14632tower tower32 tower32_200 tower32_600 tower32_700
14633tower32_800 tower32_850 tss
14634u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14635ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14636unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14637Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14638XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14639XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14640z8000
14641EOSH
14642# Maybe put other stuff here too.
14643cat <<EOSH >>Cppsym.know
14644$osname
14645EOSH
14646./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14647./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14648$cat Cppsym.know > Cppsym.c
381aa1ff 14649$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
14650$rm -f Cppsym.a Cppsym.b Cppsym.c
14651cat <<EOSH > Cppsym
14652$startsh
14653if $test \$# -gt 0; then
14654 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14655 if $test -s Cppsym.got; then
14656 $rm -f Cppsym.got
14657 exit 0
14658 fi
14659 $rm -f Cppsym.got
14660 exit 1
14661else
14662 $tr " " "$trnl" | ./Cppsym.try
14663 exit 0
14664fi
14665EOSH
14666chmod +x Cppsym
14667$eunicefix Cppsym
14668cat <<EOSH > Cppsym.try
14669$startsh
14670cat <<'EOCP' > try.c
14671#include <stdio.h>
14672int main() {
14673EOCP
14674$awk \\
14675EOSH
14676cat <<'EOSH' >> Cppsym.try
14677'length($1) > 0 {
14678 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
14679 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
14680 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
14681 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
14682}' >> try.c
14683echo '}' >> try.c
14684EOSH
14685cat <<EOSH >> Cppsym.try
14686ccflags="$ccflags"
14687case "$osname-$gccversion" in
14688irix-) ccflags="\$ccflags -woff 1178" ;;
14689os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
14690esac
7a282f6d 14691$cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
b4eb6b3d
JH
14692EOSH
14693chmod +x Cppsym.try
14694$eunicefix Cppsym.try
14695./Cppsym < Cppsym.know > Cppsym.true
14696: now check the C compiler for additional symbols
14697postprocess_cc_v=''
14698case "$osname" in
14699aix) postprocess_cc_v="|$tr , ' '" ;;
14700esac
14701$cat >ccsym <<EOS
14702$startsh
14703$cat >tmp.c <<EOF
14704extern int foo;
14705EOF
14706for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14707do
14708 case "\$i" in
14709 -D*) echo "\$i" | $sed 's/^-D//';;
14710 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14711 esac
14712done
14713$rm -f try.c
14714EOS
14715postprocess_cc_v=''
14716chmod +x ccsym
14717$eunicefix ccsym
14718./ccsym > ccsym1.raw
14719if $test -s ccsym1.raw; then
14720 $sort ccsym1.raw | $uniq >ccsym.raw
14721else
14722 mv ccsym1.raw ccsym.raw
14723fi
14724
14725$awk '/\=/ { print $0; next }
14726 { print $0"=1" }' ccsym.raw >ccsym.list
14727$awk '/\=/ { print $0; next }
14728 { print $0"=1" }' Cppsym.true >ccsym.true
14729$comm -13 ccsym.true ccsym.list >ccsym.own
14730$comm -12 ccsym.true ccsym.list >ccsym.com
14731$comm -23 ccsym.true ccsym.list >ccsym.cpp
14732also=''
14733if $test -z ccsym.raw; then
14734 echo "Your C compiler doesn't seem to define any symbols!" >&4
14735 echo " "
14736 echo "However, your C preprocessor defines the following symbols:"
14737 $cat Cppsym.true
14738 ccsymbols=''
14739 cppsymbols=`$cat Cppsym.true`
14740 cppsymbols=`echo $cppsymbols`
14741 cppccsymbols="$cppsymbols"
14742else
14743 if $test -s ccsym.com; then
14744 echo "Your C compiler and pre-processor define these symbols:"
14745 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
14746 also='also '
14747 symbols='ones'
14748 cppccsymbols=`$cat ccsym.com`
14749 cppccsymbols=`echo $cppccsymbols`
14750 $test "$silent" || sleep 1
14751 fi
14752 if $test -s ccsym.cpp; then
14753 $test "$also" && echo " "
14754 echo "Your C pre-processor ${also}defines the following symbols:"
14755 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
14756 also='further '
14757 cppsymbols=`$cat ccsym.cpp`
14758 cppsymbols=`echo $cppsymbols`
14759 $test "$silent" || sleep 1
14760 fi
14761 if $test -s ccsym.own; then
14762 $test "$also" && echo " "
14763 echo "Your C compiler ${also}defines the following cpp symbols:"
14764 $sed -e 's/\(..*\)=1/\1/' ccsym.own
14765 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14766 ccsymbols=`$cat ccsym.own`
14767 ccsymbols=`echo $ccsymbols`
14768 $test "$silent" || sleep 1
14769 fi
14770fi
14771$rm -f ccsym* Cppsym.*
14772
14773: see if this is a termio system
14774val="$undef"
14775val2="$undef"
14776val3="$undef"
14777if $test `./findhdr termios.h`; then
14778 set tcsetattr i_termios
14779 eval $inlibc
14780 val3="$i_termios"
14781fi
14782echo " "
14783case "$val3" in
14784"$define") echo "You have POSIX termios.h... good!" >&4;;
14785*) if ./Cppsym pyr; then
14786 case "`/bin/universe`" in
14787 ucb) if $test `./findhdr sgtty.h`; then
14788 val2="$define"
14789 echo "<sgtty.h> found." >&4
14790 else
14791 echo "System is pyramid with BSD universe."
14792 echo "<sgtty.h> not found--you could have problems." >&4
14793 fi;;
14794 *) if $test `./findhdr termio.h`; then
14795 val="$define"
14796 echo "<termio.h> found." >&4
14797 else
14798 echo "System is pyramid with USG universe."
14799 echo "<termio.h> not found--you could have problems." >&4
14800 fi;;
14801 esac
14802 elif ./usg; then
14803 if $test `./findhdr termio.h`; then
14804 echo "<termio.h> found." >&4
14805 val="$define"
14806 elif $test `./findhdr sgtty.h`; then
14807 echo "<sgtty.h> found." >&4
14808 val2="$define"
14809 else
14810echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14811 fi
14812 else
14813 if $test `./findhdr sgtty.h`; then
14814 echo "<sgtty.h> found." >&4
14815 val2="$define"
14816 elif $test `./findhdr termio.h`; then
14817 echo "<termio.h> found." >&4
14818 val="$define"
14819 else
14820echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14821 fi
14822 fi;;
14823esac
14824set i_termio; eval $setvar
14825val=$val2; set i_sgtty; eval $setvar
14826val=$val3; set i_termios; eval $setvar
14827
14828: see if this is a shadow.h system
14829set shadow.h i_shadow
14830eval $inhdr
14831
14832: see if this is a socks.h system
14833set socks.h i_socks
14834eval $inhdr
14835
14836: see if stdarg is available
14837echo " "
14838if $test `./findhdr stdarg.h`; then
14839 echo "<stdarg.h> found." >&4
14840 valstd="$define"
14841else
14842 echo "<stdarg.h> NOT found." >&4
14843 valstd="$undef"
14844fi
14845
14846: see if varags is available
14847echo " "
14848if $test `./findhdr varargs.h`; then
14849 echo "<varargs.h> found." >&4
14850else
14851 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14852fi
14853
14854: set up the varargs testing programs
14855$cat > varargs.c <<EOP
14856#ifdef I_STDARG
14857#include <stdarg.h>
14858#endif
14859#ifdef I_VARARGS
14860#include <varargs.h>
14861#endif
14862
14863#ifdef I_STDARG
14864int f(char *p, ...)
14865#else
14866int f(va_alist)
14867va_dcl
14868#endif
14869{
14870 va_list ap;
14871#ifndef I_STDARG
14872 char *p;
14873#endif
14874#ifdef I_STDARG
14875 va_start(ap,p);
14876#else
14877 va_start(ap);
14878 p = va_arg(ap, char *);
14879#endif
14880 va_end(ap);
14881}
14882EOP
14883$cat > varargs <<EOP
14884$startsh
14885if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14886 echo "true"
14887else
14888 echo "false"
14889fi
14890$rm -f varargs$_o
14891EOP
14892chmod +x varargs
14893
14894: now check which varargs header should be included
14895echo " "
14896i_varhdr=''
14897case "$valstd" in
14898"$define")
14899 if `./varargs I_STDARG`; then
14900 val='stdarg.h'
14901 elif `./varargs I_VARARGS`; then
14902 val='varargs.h'
14903 fi
14904 ;;
14905*)
14906 if `./varargs I_VARARGS`; then
14907 val='varargs.h'
14908 fi
14909 ;;
14910esac
14911case "$val" in
14912'')
14913echo "I could not find the definition for va_dcl... You have problems..." >&4
14914 val="$undef"; set i_stdarg; eval $setvar
14915 val="$undef"; set i_varargs; eval $setvar
14916 ;;
14917*)
14918 set i_varhdr
14919 eval $setvar
14920 case "$i_varhdr" in
14921 stdarg.h)
14922 val="$define"; set i_stdarg; eval $setvar
14923 val="$undef"; set i_varargs; eval $setvar
14924 ;;
14925 varargs.h)
14926 val="$undef"; set i_stdarg; eval $setvar
14927 val="$define"; set i_varargs; eval $setvar
14928 ;;
14929 esac
14930 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14931esac
14932$rm -f varargs*
5f80c64f 14933
b4eb6b3d
JH
14934: see if stddef is available
14935set stddef.h i_stddef
14936eval $inhdr
923fc586 14937
b4eb6b3d
JH
14938: see if this is a sunmath.h system
14939set sunmath.h i_sunmath
14940eval $inhdr
5f80c64f 14941
b4eb6b3d
JH
14942: see if sys/access.h is available
14943set sys/access.h i_sysaccess
14944eval $inhdr
14945
14946: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14947set sys/filio.h i_sysfilio
14948eval $inhdr
14949echo " "
14950if $test `./findhdr sys/ioctl.h`; then
14951 val="$define"
14952 echo '<sys/ioctl.h> found.' >&4
14953else
14954 val="$undef"
14955 if $test $i_sysfilio = "$define"; then
14956 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 14957 else
b4eb6b3d
JH
14958 $test $i_sgtty = "$define" && xxx="sgtty.h"
14959 $test $i_termio = "$define" && xxx="termio.h"
14960 $test $i_termios = "$define" && xxx="termios.h"
14961echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14962 fi
14963fi
14964set i_sysioctl
14965eval $setvar
14966
14967
14968: see if this is a syslog.h system
14969set syslog.h i_syslog
14970eval $inhdr
14971
14972
14973: see if this is a sys/mode.h system
14974set sys/mode.h i_sysmode
14975eval $inhdr
14976
14977: see if sys/resource.h has to be included
14978set sys/resource.h i_sysresrc
14979eval $inhdr
14980
14981: see if sys/security.h is available
14982set sys/security.h i_syssecrt
14983eval $inhdr
14984
14985: see if this is a sys/statvfs.h system
14986set sys/statvfs.h i_sysstatvfs
14987eval $inhdr
14988
14989: see if this is a sys/uio.h system
14990set sys/uio.h i_sysuio
14991eval $inhdr
14992
14993: see if this is a sys/un.h system
14994set sys/un.h i_sysun
14995eval $inhdr
14996
14997
14998: see if this is a sys/utsname.h system
14999set sys/utsname.h i_sysutsname
15000eval $inhdr
15001
15002: see if this is a syswait system
15003set sys/wait.h i_syswait
15004eval $inhdr
15005
15006: see if this is a ustat.h system
15007set ustat.h i_ustat
15008eval $inhdr
15009
15010: see if this is an utime system
15011set utime.h i_utime
15012eval $inhdr
15013
15014: see if this is a values.h system
15015set values.h i_values
15016eval $inhdr
15017
15018: see if this is a vfork system
15019case "$d_vfork" in
15020"$define")
15021 set vfork.h i_vfork
15022 eval $inhdr
15023 ;;
15024*)
15025 i_vfork="$undef"
15026 ;;
15027esac
15028
15029: see if gdbm.h is available
15030set gdbm.h t_gdbm
15031eval $inhdr
15032case "$t_gdbm" in
15033$define)
15034 : see if gdbm_open exists
15035 set gdbm_open d_gdbm_open
15036 eval $inlibc
15037 case "$d_gdbm_open" in
15038 $undef)
15039 t_gdbm="$undef"
15040 echo "We won't be including <gdbm.h>"
5f80c64f 15041 ;;
b4eb6b3d
JH
15042 esac
15043 ;;
15044esac
15045val="$t_gdbm"
15046set i_gdbm
15047eval $setvar
15048
15049echo " "
15050echo "Looking for extensions..." >&4
15051: If we are using the old config.sh, known_extensions may contain
15052: old or inaccurate or duplicate values.
15053known_extensions=''
15054nonxs_extensions=''
15055: We do not use find because it might not be available.
15056: We do not just use MANIFEST because the user may have dropped
15057: some additional extensions into the source tree and expect them
15058: to be built.
15059
15060: Function to recursively find available extensions, ignoring DynaLoader
15061: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15062find_extensions='
15063 for xxx in *; do
15064 case "$xxx" in
15065 DynaLoader|dynaload) ;;
15066 *)
15067 if $test -f $xxx/$xxx.xs; then
15068 known_extensions="$known_extensions $1$xxx";
15069 elif $test -f $xxx/Makefile.PL; then
15070 nonxs_extensions="$nonxs_extensions $1$xxx";
15071 else
15072 if $test -d $xxx -a $# -lt 10; then
15073 set $1$xxx/ $*;
15074 cd $xxx;
15075 eval $find_extensions;
15076 cd ..;
15077 shift;
15078 fi;
15079 fi
15080 ;;
15081 esac;
15082 done'
15083tdir=`pwd`
15084cd $rsrc/ext
15085set X
15086shift
15087eval $find_extensions
15088set X $nonxs_extensions
15089shift
15090nonxs_extensions="$*"
15091set X $known_extensions
15092shift
15093known_extensions="$*"
15094cd $tdir
15095
15096: Now see which are supported on this system.
15097avail_ext=''
15098for xxx in $known_extensions ; do
15099 case "$xxx" in
15100 DB_File|db_file)
15101 case "$i_db" in
15102 $define) avail_ext="$avail_ext $xxx" ;;
15103 esac
15104 ;;
15105 GDBM_File|gdbm_fil)
15106 case "$i_gdbm" in
15107 $define) avail_ext="$avail_ext $xxx" ;;
15108 esac
15109 ;;
15110 NDBM_File|ndbm_fil)
15111 case "$i_ndbm" in
15112 $define)
15113 case "$osname-$use64bitint" in
15114 hpux-define)
15115 case "$libs" in
15116 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15117 esac
15118 ;;
15119 *) avail_ext="$avail_ext $xxx" ;;
15120 esac
15121 ;;
15122 esac
15123 ;;
15124 ODBM_File|odbm_fil)
15125 case "${i_dbm}${i_rpcsvcdbm}" in
15126 *"${define}"*)
15127 case "$osname-$use64bitint" in
15128 hpux-define)
15129 case "$libs" in
15130 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15131 esac
15132 ;;
15133 *) avail_ext="$avail_ext $xxx" ;;
15134 esac
15135 ;;
15136 esac
15137 ;;
15138 POSIX|posix)
15139 case "$useposix" in
15140 true|define|y) avail_ext="$avail_ext $xxx" ;;
15141 esac
15142 ;;
15143 Opcode|opcode)
15144 case "$useopcode" in
15145 true|define|y) avail_ext="$avail_ext $xxx" ;;
15146 esac
15147 ;;
15148 Socket|socket)
15149 case "$d_socket" in
15150 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15151 esac
15152 ;;
15153 Sys/Syslog|sys/syslog)
15154 : XXX syslog requires socket
15155 case "$d_socket" in
15156 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15157 esac
15158 ;;
15159 Thread|thread)
15160 case "$usethreads" in
15161 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15162 esac
15163 ;;
15164 IPC/SysV|ipc/sysv)
15165 : XXX Do we need a useipcsysv variable here
15166 case "${d_msg}${d_sem}${d_shm}" in
15167 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15168 esac
15169 ;;
15170 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
15171 ;;
15172 esac
b4eb6b3d 15173done
5f80c64f 15174
b4eb6b3d
JH
15175set X $avail_ext
15176shift
15177avail_ext="$*"
5f80c64f 15178
b4eb6b3d
JH
15179: Now see which nonxs extensions are supported on this system.
15180: For now assume all are.
15181nonxs_ext=''
15182for xxx in $nonxs_extensions ; do
15183 case "$xxx" in
15184 *) nonxs_ext="$nonxs_ext $xxx"
15185 ;;
15186 esac
15187done
5f80c64f 15188
b4eb6b3d
JH
15189set X $nonxs_ext
15190shift
15191nonxs_ext="$*"
15192
15193case $usedl in
15194$define)
15195 $cat <<EOM
15196A number of extensions are supplied with $package. You may choose to
15197compile these extensions for dynamic loading (the default), compile
15198them into the $package executable (static loading), or not include
15199them at all. Answer "none" to include no extensions.
15200Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
15201
15202EOM
b4eb6b3d
JH
15203 case "$dynamic_ext" in
15204 '') dflt="$avail_ext" ;;
15205 *) dflt="$dynamic_ext"
15206 # Perhaps we are reusing an old out-of-date config.sh.
15207 case "$hint" in
15208 previous)
15209 if test X"$dynamic_ext" != X"$avail_ext"; then
15210 $cat <<EOM
15211NOTICE: Your previous config.sh list may be incorrect.
15212The extensions now available to you are
15213 ${avail_ext}
15214but the default list from your previous config.sh is
15215 ${dynamic_ext}
9c839522 15216
b4eb6b3d
JH
15217EOM
15218 fi
9c839522
PM
15219 ;;
15220 esac
b4eb6b3d
JH
15221 ;;
15222 esac
5f80c64f 15223 case "$dflt" in
b4eb6b3d
JH
15224 '') dflt=none;;
15225 esac
15226 rp="What extensions do you wish to load dynamically?"
15227 . ./myread
15228 case "$ans" in
15229 none) dynamic_ext=' ' ;;
15230 *) dynamic_ext="$ans" ;;
5f80c64f 15231 esac
5f80c64f 15232
b4eb6b3d
JH
15233 case "$static_ext" in
15234 '')
15235 : Exclude those already listed in dynamic linking
15236 dflt=''
15237 for xxx in $avail_ext; do
15238 case " $dynamic_ext " in
15239 *" $xxx "*) ;;
15240 *) dflt="$dflt $xxx" ;;
15241 esac
15242 done
15243 set X $dflt
15244 shift
15245 dflt="$*"
15246 ;;
15247 *) dflt="$static_ext"
15248 ;;
15249 esac
9c839522 15250
b4eb6b3d
JH
15251 case "$dflt" in
15252 '') dflt=none;;
15253 esac
15254 rp="What extensions do you wish to load statically?"
15255 . ./myread
15256 case "$ans" in
15257 none) static_ext=' ' ;;
15258 *) static_ext="$ans" ;;
15259 esac
15260 ;;
15261*)
15262 $cat <<EOM
15263A number of extensions are supplied with $package. Answer "none"
15264to include no extensions.
15265Note that DynaLoader is always built and need not be mentioned here.
9c839522 15266
b4eb6b3d
JH
15267EOM
15268 case "$static_ext" in
15269 '') dflt="$avail_ext" ;;
15270 *) dflt="$static_ext"
15271 # Perhaps we are reusing an old out-of-date config.sh.
15272 case "$hint" in
15273 previous)
15274 if test X"$static_ext" != X"$avail_ext"; then
15275 $cat <<EOM
15276NOTICE: Your previous config.sh list may be incorrect.
15277The extensions now available to you are
15278 ${avail_ext}
15279but the default list from your previous config.sh is
15280 ${static_ext}
5f80c64f
JH
15281
15282EOM
b4eb6b3d
JH
15283 fi
15284 ;;
15285 esac
15286 ;;
15287 esac
15288 : Exclude those that are not xs extensions
15289 case "$dflt" in
15290 '') dflt=none;;
15291 esac
15292 rp="What extensions do you wish to include?"
15293 . ./myread
15294 case "$ans" in
15295 none) static_ext=' ' ;;
15296 *) static_ext="$ans" ;;
15297 esac
15298 ;;
5f80c64f
JH
15299esac
15300
b4eb6b3d
JH
15301set X $dynamic_ext $static_ext $nonxs_ext
15302shift
15303extensions="$*"
15304
9c839522
PM
15305: Remove libraries needed only for extensions
15306: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
15307: The exception is SunOS 4.x, which needs them.
15308case "${osname}X${osvers}" in
15309sunos*X4*)
15310 perllibs="$libs"
15311 ;;
15312*) case "$usedl" in
15313 $define|true|[yY]*)
15314 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
15315 shift
15316 perllibs="$*"
15317 ;;
15318 *) perllibs="$libs"
15319 ;;
15320 esac
15321 ;;
9c839522 15322esac
5f80c64f
JH
15323
15324: Remove build directory name from cppstdin so it can be used from
15325: either the present location or the final installed location.
15326echo " "
15327: Get out of the UU directory to get correct path name.
15328cd ..
15329case "$cppstdin" in
15330`pwd`/cppstdin)
15331 echo "Stripping down cppstdin path name"
15332 cppstdin=cppstdin
15333 ;;
15334esac
15335cd UU
15336
15337: end of configuration questions
15338echo " "
15339echo "End of configuration questions."
15340echo " "
15341
15342: back to where it started
15343if test -d ../UU; then
15344 cd ..
15345fi
15346
15347: configuration may be patched via a 'config.over' file
15348if $test -f config.over; then
15349 echo " "
15350 dflt=y
15351 rp='I see a config.over file. Do you wish to load it?'
15352 . UU/myread
15353 case "$ans" in
15354 n*) echo "OK, I'll ignore it.";;
15355 *) . ./config.over
15356 echo "Configuration override changes have been loaded."
15357 ;;
15358 esac
15359fi
15360
15361: in case they want portability, strip down executable paths
15362case "$d_portable" in
15363"$define")
15364 echo " "
15365 echo "Stripping down executable paths..." >&4
15366 for file in $loclist $trylist; do
534ac15a
JH
15367 eval temp=\$$file
15368 eval $file=`basename $temp`
5f80c64f
JH
15369 done
15370 ;;
15371esac
15372
15373: create config.sh file
15374echo " "
15375echo "Creating config.sh..." >&4
15376$spitshell <<EOT >config.sh
15377$startsh
15378#
15379# This file was produced by running the Configure script. It holds all the
15380# definitions figured out by Configure. Should you modify one of these values,
15381# do not forget to propagate your changes by running "Configure -der". You may
15382# instead choose to run each of the .SH files by yourself, or "Configure -S".
15383#
15384
15385# Package name : $package
15386# Source directory : $src
15387# Configuration time: $cf_time
15388# Configured by : $cf_by
15389# Target system : $myuname
15390
15391Author='$Author'
15392Date='$Date'
15393Header='$Header'
15394Id='$Id'
15395Locker='$Locker'
15396Log='$Log'
15397Mcc='$Mcc'
15398RCSfile='$RCSfile'
15399Revision='$Revision'
15400Source='$Source'
15401State='$State'
15402_a='$_a'
15403_exe='$_exe'
15404_o='$_o'
b4eb6b3d
JH
15405afs='$afs'
15406alignbytes='$alignbytes'
15407ansi2knr='$ansi2knr'
15408aphostname='$aphostname'
15409api_revision='$api_revision'
15410api_subversion='$api_subversion'
15411api_version='$api_version'
15412api_versionstring='$api_versionstring'
5f80c64f 15413ar='$ar'
b4eb6b3d
JH
15414archlib='$archlib'
15415archlibexp='$archlibexp'
15416archname64='$archname64'
15417archname='$archname'
5f80c64f
JH
15418archobjs='$archobjs'
15419awk='$awk'
b4eb6b3d 15420baserev='$baserev'
5f80c64f 15421bash='$bash'
b4eb6b3d
JH
15422bin='$bin'
15423bincompat5005='$bincompat5005'
15424binexp='$binexp'
5f80c64f
JH
15425bison='$bison'
15426byacc='$byacc'
b4eb6b3d 15427byteorder='$byteorder'
5f80c64f 15428c='$c'
b4eb6b3d 15429castflags='$castflags'
5f80c64f
JH
15430cat='$cat'
15431cc='$cc'
15432cccdlflags='$cccdlflags'
15433ccdlflags='$ccdlflags'
15434ccflags='$ccflags'
b4eb6b3d 15435ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 15436ccname='$ccname'
b4eb6b3d 15437ccsymbols='$ccsymbols'
6b356c8e 15438ccversion='$ccversion'
5f80c64f 15439cf_by='$cf_by'
b4eb6b3d 15440cf_email='$cf_email'
5f80c64f 15441cf_time='$cf_time'
b4eb6b3d 15442charsize='$charsize'
5f80c64f
JH
15443chgrp='$chgrp'
15444chmod='$chmod'
15445chown='$chown'
b4eb6b3d 15446clocktype='$clocktype'
5f80c64f
JH
15447comm='$comm'
15448compress='$compress'
15449contains='$contains'
15450cp='$cp'
15451cpio='$cpio'
15452cpp='$cpp'
b4eb6b3d
JH
15453cpp_stuff='$cpp_stuff'
15454cppccsymbols='$cppccsymbols'
5f80c64f
JH
15455cppflags='$cppflags'
15456cpplast='$cpplast'
15457cppminus='$cppminus'
15458cpprun='$cpprun'
15459cppstdin='$cppstdin'
b4eb6b3d
JH
15460cppsymbols='$cppsymbols'
15461crosscompile='$crosscompile'
15462cryptlib='$cryptlib'
5f80c64f 15463csh='$csh'
b4eb6b3d
JH
15464d_Gconvert='$d_Gconvert'
15465d_PRIEUldbl='$d_PRIEUldbl'
15466d_PRIFUldbl='$d_PRIFUldbl'
15467d_PRIGUldbl='$d_PRIGUldbl'
15468d_PRIXU64='$d_PRIXU64'
15469d_PRId64='$d_PRId64'
15470d_PRIeldbl='$d_PRIeldbl'
15471d_PRIfldbl='$d_PRIfldbl'
15472d_PRIgldbl='$d_PRIgldbl'
15473d_PRIi64='$d_PRIi64'
15474d_PRIo64='$d_PRIo64'
15475d_PRIu64='$d_PRIu64'
15476d_PRIx64='$d_PRIx64'
15477d_SCNfldbl='$d_SCNfldbl'
15478d_access='$d_access'
15479d_accessx='$d_accessx'
15480d_alarm='$d_alarm'
15481d_archlib='$d_archlib'
15482d_atolf='$d_atolf'
15483d_atoll='$d_atoll'
15484d_attribut='$d_attribut'
15485d_bcmp='$d_bcmp'
15486d_bcopy='$d_bcopy'
15487d_bincompat5005='$d_bincompat5005'
5f80c64f 15488d_bsd='$d_bsd'
b4eb6b3d
JH
15489d_bsdgetpgrp='$d_bsdgetpgrp'
15490d_bsdsetpgrp='$d_bsdsetpgrp'
15491d_bzero='$d_bzero'
15492d_casti32='$d_casti32'
15493d_castneg='$d_castneg'
15494d_charvspr='$d_charvspr'
15495d_chown='$d_chown'
15496d_chroot='$d_chroot'
15497d_chsize='$d_chsize'
15498d_closedir='$d_closedir'
15499d_const='$d_const'
15500d_crypt='$d_crypt'
15501d_csh='$d_csh'
15502d_cuserid='$d_cuserid'
15503d_dbl_dig='$d_dbl_dig'
15504d_difftime='$d_difftime'
15505d_dirnamlen='$d_dirnamlen'
15506d_dlerror='$d_dlerror'
5f80c64f 15507d_dlopen='$d_dlopen'
b4eb6b3d
JH
15508d_dlsymun='$d_dlsymun'
15509d_dosuid='$d_dosuid'
15510d_drand48proto='$d_drand48proto'
15511d_dup2='$d_dup2'
15512d_eaccess='$d_eaccess'
15513d_endgrent='$d_endgrent'
15514d_endhent='$d_endhent'
15515d_endnent='$d_endnent'
15516d_endpent='$d_endpent'
15517d_endpwent='$d_endpwent'
15518d_endsent='$d_endsent'
15519d_eofnblk='$d_eofnblk'
5f80c64f 15520d_eunice='$d_eunice'
b4eb6b3d
JH
15521d_fchmod='$d_fchmod'
15522d_fchown='$d_fchown'
15523d_fcntl='$d_fcntl'
9d9004a9 15524d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
15525d_fd_macros='$d_fd_macros'
15526d_fd_set='$d_fd_set'
15527d_fds_bits='$d_fds_bits'
15528d_fgetpos='$d_fgetpos'
15529d_flexfnam='$d_flexfnam'
15530d_flock='$d_flock'
15531d_fork='$d_fork'
15532d_fpathconf='$d_fpathconf'
15533d_fpos64_t='$d_fpos64_t'
15534d_frexpl='$d_frexpl'
15535d_fs_data_s='$d_fs_data_s'
15536d_fseeko='$d_fseeko'
15537d_fsetpos='$d_fsetpos'
15538d_fstatfs='$d_fstatfs'
15539d_fstatvfs='$d_fstatvfs'
15540d_ftello='$d_ftello'
15541d_ftime='$d_ftime'
15542d_getcwd='$d_getcwd'
15543d_getespwnam='$d_getespwnam'
15544d_getfsstat='$d_getfsstat'
15545d_getgrent='$d_getgrent'
15546d_getgrps='$d_getgrps'
15547d_gethbyaddr='$d_gethbyaddr'
15548d_gethbyname='$d_gethbyname'
15549d_gethent='$d_gethent'
15550d_gethname='$d_gethname'
15551d_gethostprotos='$d_gethostprotos'
15552d_getlogin='$d_getlogin'
15553d_getmnt='$d_getmnt'
15554d_getmntent='$d_getmntent'
15555d_getnbyaddr='$d_getnbyaddr'
15556d_getnbyname='$d_getnbyname'
15557d_getnent='$d_getnent'
15558d_getnetprotos='$d_getnetprotos'
15559d_getpbyname='$d_getpbyname'
15560d_getpbynumber='$d_getpbynumber'
15561d_getpent='$d_getpent'
15562d_getpgid='$d_getpgid'
15563d_getpgrp2='$d_getpgrp2'
15564d_getpgrp='$d_getpgrp'
15565d_getppid='$d_getppid'
15566d_getprior='$d_getprior'
15567d_getprotoprotos='$d_getprotoprotos'
15568d_getprpwnam='$d_getprpwnam'
15569d_getpwent='$d_getpwent'
15570d_getsbyname='$d_getsbyname'
15571d_getsbyport='$d_getsbyport'
15572d_getsent='$d_getsent'
15573d_getservprotos='$d_getservprotos'
15574d_getspnam='$d_getspnam'
15575d_gettimeod='$d_gettimeod'
5f80c64f 15576d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
15577d_grpasswd='$d_grpasswd'
15578d_hasmntopt='$d_hasmntopt'
15579d_htonl='$d_htonl'
15580d_iconv='$d_iconv'
15581d_index='$d_index'
15582d_inetaton='$d_inetaton'
15583d_int64_t='$d_int64_t'
15584d_isascii='$d_isascii'
15585d_isnan='$d_isnan'
15586d_isnanl='$d_isnanl'
15587d_killpg='$d_killpg'
15588d_lchown='$d_lchown'
15589d_ldbl_dig='$d_ldbl_dig'
15590d_link='$d_link'
15591d_locconv='$d_locconv'
15592d_lockf='$d_lockf'
15593d_longdbl='$d_longdbl'
15594d_longlong='$d_longlong'
15595d_lseekproto='$d_lseekproto'
15596d_lstat='$d_lstat'
15597d_madvise='$d_madvise'
15598d_mblen='$d_mblen'
15599d_mbstowcs='$d_mbstowcs'
15600d_mbtowc='$d_mbtowc'
15601d_memchr='$d_memchr'
15602d_memcmp='$d_memcmp'
15603d_memcpy='$d_memcpy'
15604d_memmove='$d_memmove'
15605d_memset='$d_memset'
15606d_mkdir='$d_mkdir'
15607d_mkdtemp='$d_mkdtemp'
15608d_mkfifo='$d_mkfifo'
15609d_mkstemp='$d_mkstemp'
15610d_mkstemps='$d_mkstemps'
15611d_mktime='$d_mktime'
15612d_mmap='$d_mmap'
15613d_modfl='$d_modfl'
15614d_mprotect='$d_mprotect'
15615d_msg='$d_msg'
15616d_msg_ctrunc='$d_msg_ctrunc'
15617d_msg_dontroute='$d_msg_dontroute'
15618d_msg_oob='$d_msg_oob'
15619d_msg_peek='$d_msg_peek'
15620d_msg_proxy='$d_msg_proxy'
15621d_msgctl='$d_msgctl'
15622d_msgget='$d_msgget'
15623d_msgrcv='$d_msgrcv'
15624d_msgsnd='$d_msgsnd'
15625d_msync='$d_msync'
15626d_munmap='$d_munmap'
15627d_mymalloc='$d_mymalloc'
15628d_nice='$d_nice'
15629d_nv_preserves_uv='$d_nv_preserves_uv'
15630d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15631d_off64_t='$d_off64_t'
15632d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15633d_oldpthreads='$d_oldpthreads'
15634d_oldsock='$d_oldsock'
15635d_open3='$d_open3'
15636d_pathconf='$d_pathconf'
15637d_pause='$d_pause'
15638d_perl_otherlibdirs='$d_perl_otherlibdirs'
15639d_phostname='$d_phostname'
15640d_pipe='$d_pipe'
15641d_poll='$d_poll'
5f80c64f 15642d_portable='$d_portable'
b4eb6b3d
JH
15643d_pthread_yield='$d_pthread_yield'
15644d_pwage='$d_pwage'
15645d_pwchange='$d_pwchange'
15646d_pwclass='$d_pwclass'
15647d_pwcomment='$d_pwcomment'
15648d_pwexpire='$d_pwexpire'
15649d_pwgecos='$d_pwgecos'
15650d_pwpasswd='$d_pwpasswd'
15651d_pwquota='$d_pwquota'
15652d_qgcvt='$d_qgcvt'
15653d_quad='$d_quad'
15654d_readdir='$d_readdir'
15655d_readlink='$d_readlink'
15656d_rename='$d_rename'
15657d_rewinddir='$d_rewinddir'
15658d_rmdir='$d_rmdir'
15659d_safebcpy='$d_safebcpy'
15660d_safemcpy='$d_safemcpy'
15661d_sanemcmp='$d_sanemcmp'
15662d_sched_yield='$d_sched_yield'
15663d_scm_rights='$d_scm_rights'
15664d_seekdir='$d_seekdir'
15665d_select='$d_select'
15666d_sem='$d_sem'
15667d_semctl='$d_semctl'
15668d_semctl_semid_ds='$d_semctl_semid_ds'
15669d_semctl_semun='$d_semctl_semun'
15670d_semget='$d_semget'
15671d_semop='$d_semop'
15672d_setegid='$d_setegid'
15673d_seteuid='$d_seteuid'
15674d_setgrent='$d_setgrent'
15675d_setgrps='$d_setgrps'
15676d_sethent='$d_sethent'
15677d_setlinebuf='$d_setlinebuf'
15678d_setlocale='$d_setlocale'
15679d_setnent='$d_setnent'
15680d_setpent='$d_setpent'
15681d_setpgid='$d_setpgid'
15682d_setpgrp2='$d_setpgrp2'
15683d_setpgrp='$d_setpgrp'
15684d_setprior='$d_setprior'
15685d_setproctitle='$d_setproctitle'
15686d_setpwent='$d_setpwent'
15687d_setregid='$d_setregid'
15688d_setresgid='$d_setresgid'
15689d_setresuid='$d_setresuid'
15690d_setreuid='$d_setreuid'
15691d_setrgid='$d_setrgid'
15692d_setruid='$d_setruid'
15693d_setsent='$d_setsent'
15694d_setsid='$d_setsid'
15695d_setvbuf='$d_setvbuf'
15696d_sfio='$d_sfio'
15697d_shm='$d_shm'
15698d_shmat='$d_shmat'
15699d_shmatprototype='$d_shmatprototype'
15700d_shmctl='$d_shmctl'
15701d_shmdt='$d_shmdt'
15702d_shmget='$d_shmget'
15703d_sigaction='$d_sigaction'
15704d_sigsetjmp='$d_sigsetjmp'
15705d_socket='$d_socket'
15706d_socklen_t='$d_socklen_t'
15707d_sockpair='$d_sockpair'
15708d_socks5_init='$d_socks5_init'
15709d_sqrtl='$d_sqrtl'
15710d_statblks='$d_statblks'
15711d_statfs_f_flags='$d_statfs_f_flags'
15712d_statfs_s='$d_statfs_s'
15713d_statvfs='$d_statvfs'
15714d_stdio_cnt_lval='$d_stdio_cnt_lval'
15715d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
15716d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
15717d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
15718d_stdio_stream_array='$d_stdio_stream_array'
15719d_stdiobase='$d_stdiobase'
15720d_stdstdio='$d_stdstdio'
15721d_strchr='$d_strchr'
15722d_strcoll='$d_strcoll'
15723d_strctcpy='$d_strctcpy'
15724d_strerrm='$d_strerrm'
15725d_strerror='$d_strerror'
15726d_strtod='$d_strtod'
15727d_strtol='$d_strtol'
15728d_strtold='$d_strtold'
15729d_strtoll='$d_strtoll'
15730d_strtoul='$d_strtoul'
15731d_strtoull='$d_strtoull'
15732d_strtouq='$d_strtouq'
15733d_strxfrm='$d_strxfrm'
15734d_suidsafe='$d_suidsafe'
15735d_symlink='$d_symlink'
15736d_syscall='$d_syscall'
15737d_sysconf='$d_sysconf'
15738d_sysernlst='$d_sysernlst'
15739d_syserrlst='$d_syserrlst'
15740d_system='$d_system'
15741d_tcgetpgrp='$d_tcgetpgrp'
15742d_tcsetpgrp='$d_tcsetpgrp'
15743d_telldir='$d_telldir'
15744d_telldirproto='$d_telldirproto'
15745d_time='$d_time'
15746d_times='$d_times'
15747d_truncate='$d_truncate'
15748d_tzname='$d_tzname'
15749d_umask='$d_umask'
15750d_uname='$d_uname'
15751d_union_semun='$d_union_semun'
15752d_ustat='$d_ustat'
15753d_vendorarch='$d_vendorarch'
15754d_vendorbin='$d_vendorbin'
15755d_vendorlib='$d_vendorlib'
15756d_vfork='$d_vfork'
15757d_void_closedir='$d_void_closedir'
15758d_voidsig='$d_voidsig'
15759d_voidtty='$d_voidtty'
15760d_volatile='$d_volatile'
15761d_vprintf='$d_vprintf'
15762d_wait4='$d_wait4'
15763d_waitpid='$d_waitpid'
15764d_wcstombs='$d_wcstombs'
15765d_wctomb='$d_wctomb'
5f80c64f
JH
15766d_xenix='$d_xenix'
15767date='$date'
b4eb6b3d
JH
15768db_hashtype='$db_hashtype'
15769db_prefixtype='$db_prefixtype'
15770defvoidused='$defvoidused'
15771direntrytype='$direntrytype'
15772dlext='$dlext'
5f80c64f 15773dlsrc='$dlsrc'
b4eb6b3d
JH
15774doublesize='$doublesize'
15775drand01='$drand01'
15776dynamic_ext='$dynamic_ext'
15777eagain='$eagain'
15778ebcdic='$ebcdic'
5f80c64f
JH
15779echo='$echo'
15780egrep='$egrep'
15781emacs='$emacs'
15782eunicefix='$eunicefix'
15783exe_ext='$exe_ext'
15784expr='$expr'
b4eb6b3d
JH
15785extensions='$extensions'
15786fflushNULL='$fflushNULL'
15787fflushall='$fflushall'
5f80c64f
JH
15788find='$find'
15789firstmakefile='$firstmakefile'
15790flex='$flex'
b4eb6b3d
JH
15791fpossize='$fpossize'
15792fpostype='$fpostype'
15793freetype='$freetype'
15794full_ar='$full_ar'
15795full_csh='$full_csh'
15796full_sed='$full_sed'
5b463ca7 15797gccosandvers='$gccosandvers'
5f80c64f 15798gccversion='$gccversion'
b4eb6b3d
JH
15799gidformat='$gidformat'
15800gidsign='$gidsign'
15801gidsize='$gidsize'
15802gidtype='$gidtype'
5f80c64f
JH
15803glibpth='$glibpth'
15804grep='$grep'
b4eb6b3d
JH
15805groupcat='$groupcat'
15806groupstype='$groupstype'
5f80c64f 15807gzip='$gzip'
b4eb6b3d
JH
15808h_fcntl='$h_fcntl'
15809h_sysfile='$h_sysfile'
5f80c64f 15810hint='$hint'
b4eb6b3d
JH
15811hostcat='$hostcat'
15812i16size='$i16size'
15813i16type='$i16type'
15814i32size='$i32size'
15815i32type='$i32type'
15816i64size='$i64size'
15817i64type='$i64type'
15818i8size='$i8size'
15819i8type='$i8type'
15820i_arpainet='$i_arpainet'
15821i_bsdioctl='$i_bsdioctl'
15822i_db='$i_db'
15823i_dbm='$i_dbm'
15824i_dirent='$i_dirent'
5f80c64f 15825i_dld='$i_dld'
b4eb6b3d
JH
15826i_dlfcn='$i_dlfcn'
15827i_fcntl='$i_fcntl'
15828i_float='$i_float'
15829i_gdbm='$i_gdbm'
15830i_grp='$i_grp'
15831i_iconv='$i_iconv'
15832i_ieeefp='$i_ieeefp'
15833i_inttypes='$i_inttypes'
15834i_libutil='$i_libutil'
15835i_limits='$i_limits'
15836i_locale='$i_locale'
15837i_machcthr='$i_machcthr'
15838i_malloc='$i_malloc'
15839i_math='$i_math'
15840i_memory='$i_memory'
15841i_mntent='$i_mntent'
15842i_ndbm='$i_ndbm'
15843i_netdb='$i_netdb'
15844i_neterrno='$i_neterrno'
15845i_netinettcp='$i_netinettcp'
15846i_niin='$i_niin'
15847i_poll='$i_poll'
15848i_prot='$i_prot'
15849i_pthread='$i_pthread'
15850i_pwd='$i_pwd'
15851i_rpcsvcdbm='$i_rpcsvcdbm'
15852i_sfio='$i_sfio'
15853i_sgtty='$i_sgtty'
15854i_shadow='$i_shadow'
15855i_socks='$i_socks'
15856i_stdarg='$i_stdarg'
15857i_stddef='$i_stddef'
15858i_stdlib='$i_stdlib'
15859i_string='$i_string'
15860i_sunmath='$i_sunmath'
15861i_sysaccess='$i_sysaccess'
15862i_sysdir='$i_sysdir'
15863i_sysfile='$i_sysfile'
15864i_sysfilio='$i_sysfilio'
15865i_sysin='$i_sysin'
15866i_sysioctl='$i_sysioctl'
15867i_syslog='$i_syslog'
15868i_sysmman='$i_sysmman'
15869i_sysmode='$i_sysmode'
15870i_sysmount='$i_sysmount'
15871i_sysndir='$i_sysndir'
15872i_sysparam='$i_sysparam'
15873i_sysresrc='$i_sysresrc'
15874i_syssecrt='$i_syssecrt'
15875i_sysselct='$i_sysselct'
15876i_syssockio='$i_syssockio'
15877i_sysstat='$i_sysstat'
15878i_sysstatfs='$i_sysstatfs'
15879i_sysstatvfs='$i_sysstatvfs'
15880i_systime='$i_systime'
15881i_systimek='$i_systimek'
15882i_systimes='$i_systimes'
15883i_systypes='$i_systypes'
15884i_sysuio='$i_sysuio'
15885i_sysun='$i_sysun'
15886i_sysutsname='$i_sysutsname'
15887i_sysvfs='$i_sysvfs'
15888i_syswait='$i_syswait'
15889i_termio='$i_termio'
15890i_termios='$i_termios'
15891i_time='$i_time'
15892i_unistd='$i_unistd'
15893i_ustat='$i_ustat'
15894i_utime='$i_utime'
15895i_values='$i_values'
15896i_varargs='$i_varargs'
15897i_varhdr='$i_varhdr'
15898i_vfork='$i_vfork'
5f80c64f 15899ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
15900inc_version_list='$inc_version_list'
15901inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
15902incpath='$incpath'
15903inews='$inews'
b4eb6b3d
JH
15904installarchlib='$installarchlib'
15905installbin='$installbin'
15906installman1dir='$installman1dir'
15907installman3dir='$installman3dir'
15908installprefix='$installprefix'
15909installprefixexp='$installprefixexp'
15910installprivlib='$installprivlib'
15911installscript='$installscript'
15912installsitearch='$installsitearch'
15913installsitebin='$installsitebin'
15914installsitelib='$installsitelib'
15915installstyle='$installstyle'
15916installusrbinperl='$installusrbinperl'
15917installvendorarch='$installvendorarch'
15918installvendorbin='$installvendorbin'
15919installvendorlib='$installvendorlib'
15920intsize='$intsize'
15921ivdformat='$ivdformat'
15922ivsize='$ivsize'
15923ivtype='$ivtype'
15924known_extensions='$known_extensions'
5f80c64f 15925ksh='$ksh'
5f80c64f
JH
15926ld='$ld'
15927lddlflags='$lddlflags'
15928ldflags='$ldflags'
b4eb6b3d
JH
15929ldflags_uselargefiles='$ldflags_uselargefiles'
15930ldlibpthname='$ldlibpthname'
5f80c64f
JH
15931less='$less'
15932lib_ext='$lib_ext'
15933libc='$libc'
b4eb6b3d 15934libperl='$libperl'
5f80c64f
JH
15935libpth='$libpth'
15936libs='$libs'
43999f95
JH
15937libsdirs='$libsdirs'
15938libsfiles='$libsfiles'
15939libsfound='$libsfound'
13b3f787 15940libspath='$libspath'
5f80c64f 15941libswanted='$libswanted'
b4eb6b3d 15942libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
15943line='$line'
15944lint='$lint'
15945lkflags='$lkflags'
15946ln='$ln'
15947lns='$lns'
15948locincpth='$locincpth'
15949loclibpth='$loclibpth'
b4eb6b3d
JH
15950longdblsize='$longdblsize'
15951longlongsize='$longlongsize'
15952longsize='$longsize'
5f80c64f
JH
15953lp='$lp'
15954lpr='$lpr'
15955ls='$ls'
b4eb6b3d
JH
15956lseeksize='$lseeksize'
15957lseektype='$lseektype'
5f80c64f
JH
15958mail='$mail'
15959mailx='$mailx'
15960make='$make'
15961make_set_make='$make_set_make'
b4eb6b3d
JH
15962mallocobj='$mallocobj'
15963mallocsrc='$mallocsrc'
15964malloctype='$malloctype'
15965man1dir='$man1dir'
15966man1direxp='$man1direxp'
15967man1ext='$man1ext'
15968man3dir='$man3dir'
15969man3direxp='$man3direxp'
15970man3ext='$man3ext'
5f80c64f
JH
15971mips_type='$mips_type'
15972mkdir='$mkdir'
b4eb6b3d
JH
15973mmaptype='$mmaptype'
15974modetype='$modetype'
5f80c64f 15975more='$more'
b4eb6b3d 15976multiarch='$multiarch'
5f80c64f 15977mv='$mv'
b4eb6b3d
JH
15978myarchname='$myarchname'
15979mydomain='$mydomain'
15980myhostname='$myhostname'
5f80c64f
JH
15981myuname='$myuname'
15982n='$n'
b4eb6b3d
JH
15983netdb_hlen_type='$netdb_hlen_type'
15984netdb_host_type='$netdb_host_type'
15985netdb_name_type='$netdb_name_type'
15986netdb_net_type='$netdb_net_type'
5f80c64f
JH
15987nm='$nm'
15988nm_opt='$nm_opt'
15989nm_so_opt='$nm_so_opt'
b4eb6b3d 15990nonxs_ext='$nonxs_ext'
5f80c64f 15991nroff='$nroff'
b4eb6b3d
JH
15992nvEUformat='$nvEUformat'
15993nvFUformat='$nvFUformat'
15994nvGUformat='$nvGUformat'
15995nveformat='$nveformat'
15996nvfformat='$nvfformat'
15997nvgformat='$nvgformat'
15998nvsize='$nvsize'
15999nvtype='$nvtype'
16000o_nonblock='$o_nonblock'
5f80c64f 16001obj_ext='$obj_ext'
b4eb6b3d 16002old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 16003optimize='$optimize'
b4eb6b3d 16004orderlib='$orderlib'
5f80c64f
JH
16005osname='$osname'
16006osvers='$osvers'
b4eb6b3d 16007otherlibdirs='$otherlibdirs'
5f80c64f 16008package='$package'
b4eb6b3d
JH
16009pager='$pager'
16010passcat='$passcat'
16011patchlevel='$patchlevel'
5f80c64f 16012path_sep='$path_sep'
b4eb6b3d 16013perl5='$perl5'
5f80c64f 16014perl='$perl'
b4eb6b3d 16015perladmin='$perladmin'
9c839522 16016perllibs='$perllibs'
b4eb6b3d 16017perlpath='$perlpath'
5f80c64f 16018pg='$pg'
b4eb6b3d
JH
16019phostname='$phostname'
16020pidtype='$pidtype'
5f80c64f 16021plibpth='$plibpth'
b4eb6b3d 16022pm_apiversion='$pm_apiversion'
5f80c64f
JH
16023pmake='$pmake'
16024pr='$pr'
b4eb6b3d
JH
16025prefix='$prefix'
16026prefixexp='$prefixexp'
16027privlib='$privlib'
16028privlibexp='$privlibexp'
16029prototype='$prototype'
16030ptrsize='$ptrsize'
16031quadkind='$quadkind'
16032quadtype='$quadtype'
16033randbits='$randbits'
16034randfunc='$randfunc'
16035randseedtype='$randseedtype'
16036ranlib='$ranlib'
16037rd_nodata='$rd_nodata'
16038revision='$revision'
5f80c64f
JH
16039rm='$rm'
16040rmail='$rmail'
16041runnm='$runnm'
b4eb6b3d
JH
16042sPRIEUldbl='$sPRIEUldbl'
16043sPRIFUldbl='$sPRIFUldbl'
16044sPRIGUldbl='$sPRIGUldbl'
16045sPRIXU64='$sPRIXU64'
16046sPRId64='$sPRId64'
16047sPRIeldbl='$sPRIeldbl'
16048sPRIfldbl='$sPRIfldbl'
16049sPRIgldbl='$sPRIgldbl'
16050sPRIi64='$sPRIi64'
16051sPRIo64='$sPRIo64'
16052sPRIu64='$sPRIu64'
16053sPRIx64='$sPRIx64'
16054sSCNfldbl='$sSCNfldbl'
16055sched_yield='$sched_yield'
16056scriptdir='$scriptdir'
16057scriptdirexp='$scriptdirexp'
5f80c64f 16058sed='$sed'
b4eb6b3d
JH
16059seedfunc='$seedfunc'
16060selectminbits='$selectminbits'
16061selecttype='$selecttype'
5f80c64f
JH
16062sendmail='$sendmail'
16063sh='$sh'
16064shar='$shar'
16065sharpbang='$sharpbang'
b4eb6b3d
JH
16066shmattype='$shmattype'
16067shortsize='$shortsize'
16068shrpenv='$shrpenv'
5f80c64f 16069shsharp='$shsharp'
b4eb6b3d
JH
16070sig_count='$sig_count'
16071sig_name='$sig_name'
16072sig_name_init='$sig_name_init'
16073sig_num='$sig_num'
16074sig_num_init='$sig_num_init'
16075signal_t='$signal_t'
16076sitearch='$sitearch'
16077sitearchexp='$sitearchexp'
16078sitebin='$sitebin'
16079sitebinexp='$sitebinexp'
16080sitelib='$sitelib'
16081sitelib_stem='$sitelib_stem'
16082sitelibexp='$sitelibexp'
16083siteprefix='$siteprefix'
16084siteprefixexp='$siteprefixexp'
16085sizesize='$sizesize'
16086sizetype='$sizetype'
5f80c64f
JH
16087sleep='$sleep'
16088smail='$smail'
5f80c64f 16089so='$so'
b4eb6b3d
JH
16090sockethdr='$sockethdr'
16091socketlib='$socketlib'
16092socksizetype='$socksizetype'
5f80c64f
JH
16093sort='$sort'
16094spackage='$spackage'
16095spitshell='$spitshell'
5f80c64f 16096src='$src'
b4eb6b3d
JH
16097ssizetype='$ssizetype'
16098startperl='$startperl'
5f80c64f 16099startsh='$startsh'
b4eb6b3d
JH
16100static_ext='$static_ext'
16101stdchar='$stdchar'
16102stdio_base='$stdio_base'
16103stdio_bufsiz='$stdio_bufsiz'
16104stdio_cnt='$stdio_cnt'
16105stdio_filbuf='$stdio_filbuf'
16106stdio_ptr='$stdio_ptr'
16107stdio_stream_array='$stdio_stream_array'
16108strings='$strings'
5f80c64f 16109submit='$submit'
b4eb6b3d
JH
16110subversion='$subversion'
16111sysman='$sysman'
5f80c64f
JH
16112tail='$tail'
16113tar='$tar'
16114tbl='$tbl'
16115tee='$tee'
16116test='$test'
b4eb6b3d
JH
16117timeincl='$timeincl'
16118timetype='$timetype'
5f80c64f
JH
16119touch='$touch'
16120tr='$tr'
16121trnl='$trnl'
16122troff='$troff'
b4eb6b3d
JH
16123u16size='$u16size'
16124u16type='$u16type'
16125u32size='$u32size'
16126u32type='$u32type'
16127u64size='$u64size'
16128u64type='$u64type'
16129u8size='$u8size'
16130u8type='$u8type'
16131uidformat='$uidformat'
16132uidsign='$uidsign'
16133uidsize='$uidsize'
16134uidtype='$uidtype'
5f80c64f
JH
16135uname='$uname'
16136uniq='$uniq'
b4eb6b3d
JH
16137uquadtype='$uquadtype'
16138use5005threads='$use5005threads'
16139use64bitall='$use64bitall'
16140use64bitint='$use64bitint'
5f80c64f 16141usedl='$usedl'
b4eb6b3d
JH
16142useithreads='$useithreads'
16143uselargefiles='$uselargefiles'
16144uselongdouble='$uselongdouble'
16145usemorebits='$usemorebits'
16146usemultiplicity='$usemultiplicity'
16147usemymalloc='$usemymalloc'
5f80c64f 16148usenm='$usenm'
b4eb6b3d
JH
16149useopcode='$useopcode'
16150useperlio='$useperlio'
16151useposix='$useposix'
16152usesfio='$usesfio'
16153useshrplib='$useshrplib'
29209bc5 16154usesocks='$usesocks'
b4eb6b3d
JH
16155usethreads='$usethreads'
16156usevendorprefix='$usevendorprefix'
16157usevfork='$usevfork'
5f80c64f
JH
16158usrinc='$usrinc'
16159uuname='$uuname'
b4eb6b3d
JH
16160uvXUformat='$uvXUformat'
16161uvoformat='$uvoformat'
16162uvsize='$uvsize'
16163uvtype='$uvtype'
16164uvuformat='$uvuformat'
16165uvxformat='$uvxformat'
16166vendorarch='$vendorarch'
16167vendorarchexp='$vendorarchexp'
16168vendorbin='$vendorbin'
16169vendorbinexp='$vendorbinexp'
16170vendorlib='$vendorlib'
16171vendorlib_stem='$vendorlib_stem'
16172vendorlibexp='$vendorlibexp'
16173vendorprefix='$vendorprefix'
16174vendorprefixexp='$vendorprefixexp'
16175version='$version'
d56c5707 16176versiononly='$versiononly'
5f80c64f 16177vi='$vi'
b4eb6b3d 16178voidflags='$voidflags'
5f80c64f 16179xlibpth='$xlibpth'
b4eb6b3d 16180xs_apiversion='$xs_apiversion'
5f80c64f
JH
16181zcat='$zcat'
16182zip='$zip'
16183EOT
16184
16185: Add in command line options if available
16186$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16187
16188: add special variables
16189$test -f $src/patchlevel.h && \
d00b958f 16190awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
2000072c 16191echo "CONFIGDOTSH=true" >>config.sh
5f80c64f
JH
16192
16193: propagate old symbols
16194if $test -f UU/config.sh; then
381aa1ff 16195 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 16196 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 16197 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
16198 set X `cat UU/oldsyms`
16199 shift
16200 case $# in
16201 0) ;;
16202 *)
16203 cat <<EOM
16204Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16205EOM
16206 echo "# Variables propagated from previous config.sh file." >>config.sh
16207 for sym in `cat UU/oldsyms`; do
16208 echo " Propagating $hint variable "'$'"$sym..."
16209 eval 'tmp="$'"${sym}"'"'
16210 echo "$tmp" | \
16211 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16212 done
16213 ;;
16214 esac
16215fi
16216
16217: Finish up by extracting the .SH files
16218case "$alldone" in
16219exit)
16220 $rm -rf UU
16221 echo "Done."
16222 exit 0
16223 ;;
16224cont)
16225 ;;
16226'')
16227 dflt=''
16228 nostick=true
16229 $cat <<EOM
16230
16231If you'd like to make any changes to the config.sh file before I begin
16232to configure things, do it as a shell escape now (e.g. !vi config.sh).
16233
16234EOM
16235 rp="Press return or use a shell escape to edit config.sh:"
16236 . UU/myread
16237 nostick=''
16238 case "$ans" in
16239 '') ;;
16240 *) : in case they cannot read
16241 sh 1>&4 -c "$ans";;
16242 esac
16243 ;;
16244esac
16245
16246: if this fails, just run all the .SH files by hand
16247. ./config.sh
16248
16249echo " "
16250exec 1>&4
16251. ./UU/extract
16252
16253if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16254 dflt=y
16255 case "$silent" in
16256 true) ;;
16257 *)
16258 $cat <<EOM
16259
16260Now you need to generate make dependencies by running "$make depend".
16261You might prefer to run it in background: "$make depend > makedepend.out &"
16262It can take a while, so you might not want to run it right now.
16263
16264EOM
16265 ;;
16266 esac
16267 rp="Run $make depend now?"
16268 . UU/myread
16269 case "$ans" in
16270 y*)
3d5d58b1 16271 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
16272 ;;
16273 *)
16274 echo "You must run '$make depend' then '$make'."
16275 ;;
16276 esac
16277elif test -f [Mm]akefile; then
16278 echo " "
16279 echo "Now you must run a $make."
16280else
16281 echo "Done."
16282fi
16283
16284if $test -f Policy.sh; then
16285 $cat <<EOM
16286
16287If you compile $package on a different machine or from a different object
16288directory, copy the Policy.sh file from this object directory to the
16289new one before you run Configure -- this will help you with most of
16290the policy defaults.
16291
16292EOM
16293fi
16294if $test -f config.msg; then
16295 echo "Hmm. I also noted the following information while running:"
16296 echo " "
16297 $cat config.msg >&4
16298 $rm -f config.msg
16299fi
16300$rm -f kit*isdone ark*isdone
16301$rm -rf UU
16302
16303: End of Configure
16304