This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate perlio:
[perl5.git] / Configure
CommitLineData
2304df62
AD
1#! /bin/sh
2#
3# If these # comments don't work, trim them. Don't worry about any other
4# shell scripts, Configure will trim # comments from them for you.
5#
6# (If you are trying to port this package to a machine without sh,
7# I would suggest you have a look at the prototypical config_h.SH file
8# and edit it to reflect your system. Some packages may include samples
9# of config.h for certain machines, so you might look for one of those.)
10#
11# Yes, you may rip this off to use in other distribution packages. This
12# script belongs to the public domain and cannot be copyrighted.
13#
14# (Note: this Configure script was generated automatically. Rather than
15# working with this copy of Configure, you may wish to get metaconfig.
16# The dist-3.0 package (which contains metaconfig) was posted in
dfe9444c
AD
17# comp.sources.misc and is available on CPAN under authors/id/RAM so
18# you may fetch it yourself from your nearest archive site.)
2304df62
AD
19#
20
dfe9444c 21# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
2304df62 22#
411ab01c 23# Generated on Sun Nov 12 20:50:13 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=''
411ab01c 365d_fsync=''
b4eb6b3d
JH
366d_ftello=''
367d_ftime=''
368d_gettimeod=''
369d_Gconvert=''
370d_getcwd=''
371d_getespwnam=''
372d_getfsstat=''
373d_getgrent=''
374d_getgrps=''
375d_gethbyaddr=''
376d_gethbyname=''
377d_gethent=''
378aphostname=''
379d_gethname=''
380d_phostname=''
381d_uname=''
382d_gethostprotos=''
383d_getlogin=''
384d_getmnt=''
385d_getmntent=''
386d_getnbyaddr=''
387d_getnbyname=''
388d_getnent=''
389d_getnetprotos=''
0c0643d0 390d_getpagsz=''
b4eb6b3d
JH
391d_getpent=''
392d_getpgid=''
393d_getpgrp2=''
394d_bsdgetpgrp=''
395d_getpgrp=''
396d_getppid=''
397d_getprior=''
398d_getpbyname=''
399d_getpbynumber=''
400d_getprotoprotos=''
401d_getprpwnam=''
402d_getpwent=''
403d_getsent=''
404d_getservprotos=''
405d_getspnam=''
406d_getsbyname=''
407d_getsbyport=''
a4f3eea9 408d_gnulibc=''
b4eb6b3d
JH
409d_hasmntopt=''
410d_htonl=''
411d_iconv=''
412d_inetaton=''
413d_int64_t=''
414d_isascii=''
415d_isnan=''
416d_isnanl=''
417d_killpg=''
418d_lchown=''
419d_ldbl_dig=''
420d_link=''
421d_locconv=''
422d_lockf=''
423d_longdbl=''
424longdblsize=''
425d_longlong=''
426longlongsize=''
427d_lseekproto=''
428d_lstat=''
429d_madvise=''
430d_mblen=''
431d_mbstowcs=''
432d_mbtowc=''
433d_memchr=''
434d_memcmp=''
435d_memcpy=''
436d_memmove=''
437d_memset=''
438d_mkdir=''
439d_mkdtemp=''
440d_mkfifo=''
441d_mkstemp=''
442d_mkstemps=''
443d_mktime=''
444d_mmap=''
445mmaptype=''
446d_modfl=''
447d_mprotect=''
448d_msg=''
449d_msgctl=''
450d_msgget=''
451d_msgrcv=''
452d_msgsnd=''
453d_msync=''
454d_munmap=''
455d_nice=''
456d_off64_t=''
457d_open3=''
458d_fpathconf=''
459d_pathconf=''
460d_pause=''
461d_pipe=''
462d_poll=''
2304df62 463d_portable=''
b4eb6b3d
JH
464d_old_pthread_create_joinable=''
465old_pthread_create_joinable=''
466d_pthread_yield=''
467d_sched_yield=''
468sched_yield=''
469d_qgcvt=''
470d_readdir=''
471d_rewinddir=''
472d_seekdir=''
473d_telldir=''
474d_readlink=''
475d_rename=''
476d_rmdir=''
477d_safebcpy=''
478d_safemcpy=''
479d_sanemcmp=''
480d_select=''
481d_sem=''
482d_semctl=''
483d_semget=''
484d_semop=''
485d_setegid=''
486d_seteuid=''
487d_setgrent=''
488d_setgrps=''
489d_sethent=''
490d_setlinebuf=''
491d_setlocale=''
492d_setnent=''
493d_setpent=''
494d_setpgid=''
495d_setpgrp2=''
496d_bsdsetpgrp=''
497d_setpgrp=''
498d_setprior=''
499d_setproctitle=''
500d_setpwent=''
501d_setregid=''
502d_setresgid=''
503d_setresuid=''
504d_setreuid=''
505d_setrgid=''
506d_setruid=''
507d_setsent=''
508d_setsid=''
509d_setvbuf=''
510d_sfio=''
511usesfio=''
512d_shm=''
513d_shmat=''
514d_shmatprototype=''
515shmattype=''
516d_shmctl=''
517d_shmdt=''
518d_shmget=''
519d_sigaction=''
520d_sigsetjmp=''
521d_msg_ctrunc=''
522d_msg_dontroute=''
523d_msg_oob=''
524d_msg_peek=''
525d_msg_proxy=''
526d_oldsock=''
527d_scm_rights=''
528d_socket=''
529d_sockpair=''
530sockethdr=''
531socketlib=''
532d_socklen_t=''
533d_socks5_init=''
534d_sqrtl=''
535d_statblks=''
536d_statfs_f_flags=''
537d_statfs_s=''
538d_fstatvfs=''
539d_statvfs=''
540d_stdio_cnt_lval=''
541d_stdio_ptr_lval=''
a7ffa9b9
NC
542d_stdio_ptr_lval_nochange_cnt=''
543d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
544d_stdiobase=''
545d_stdstdio=''
546stdio_base=''
547stdio_bufsiz=''
548stdio_cnt=''
549stdio_filbuf=''
550stdio_ptr=''
551d_index=''
552d_strchr=''
553d_strcoll=''
554d_strctcpy=''
555d_strerrm=''
556d_strerror=''
557d_sysernlst=''
558d_syserrlst=''
559d_strtod=''
560d_strtol=''
561d_strtold=''
562d_strtoll=''
563d_strtoul=''
564d_strtoull=''
565d_strtouq=''
566d_strxfrm=''
567d_symlink=''
568d_syscall=''
569d_sysconf=''
570d_system=''
571d_tcgetpgrp=''
572d_tcsetpgrp=''
573d_telldirproto=''
574d_time=''
575timetype=''
576clocktype=''
577d_times=''
578d_truncate=''
579d_tzname=''
580d_umask=''
581d_semctl_semid_ds=''
582d_semctl_semun=''
583d_union_semun=''
584d_ustat=''
585d_vfork=''
586usevfork=''
587d_voidsig=''
588signal_t=''
589d_volatile=''
590d_charvspr=''
591d_vprintf=''
592d_wait4=''
593d_waitpid=''
594d_wcstombs=''
595d_wctomb=''
596dlext=''
85e6fe83
LW
597cccdlflags=''
598ccdlflags=''
2304df62 599dlsrc=''
232e078e 600ld=''
85e6fe83 601lddlflags=''
2304df62 602usedl=''
b4eb6b3d
JH
603doublesize=''
604ebcdic=''
605fflushNULL=''
606fflushall=''
607fpossize=''
608fpostype=''
5b463ca7 609gccosandvers=''
8a27cf78 610gccversion=''
b4eb6b3d
JH
611gidformat=''
612gidsign=''
613gidsize=''
614gidtype=''
615groupstype=''
616h_fcntl=''
617h_sysfile=''
618i_arpainet=''
619db_hashtype=''
620db_prefixtype=''
621i_db=''
622i_dbm=''
623i_rpcsvcdbm=''
624d_dirnamlen=''
625direntrytype=''
626i_dirent=''
a0d0e21e 627i_dld=''
b4eb6b3d
JH
628i_dlfcn=''
629i_fcntl=''
630i_float=''
631i_gdbm=''
632d_grpasswd=''
633i_grp=''
634i_iconv=''
635i_ieeefp=''
636i_inttypes=''
637i_libutil=''
638i_limits=''
639i_locale=''
640i_machcthr=''
641i_malloc=''
642i_math=''
643i_memory=''
644i_mntent=''
645i_ndbm=''
646i_netdb=''
647i_neterrno=''
648i_netinettcp=''
649i_niin=''
650i_sysin=''
651i_poll=''
652i_prot=''
653i_pthread=''
654d_pwage=''
655d_pwchange=''
656d_pwclass=''
657d_pwcomment=''
658d_pwexpire=''
659d_pwgecos=''
660d_pwpasswd=''
661d_pwquota=''
662i_pwd=''
663i_sfio=''
664i_shadow=''
665i_socks=''
666i_stddef=''
667i_stdlib=''
668i_string=''
669strings=''
670i_sunmath=''
671i_sysaccess=''
672i_sysdir=''
673i_sysfile=''
674d_voidtty=''
675i_bsdioctl=''
676i_sysfilio=''
677i_sysioctl=''
678i_syssockio=''
679i_syslog=''
680i_sysmman=''
681i_sysmode=''
682i_sysmount=''
683i_sysndir=''
684i_sysparam=''
685i_sysresrc=''
686i_syssecrt=''
687i_sysselct=''
688i_sysstat=''
689i_sysstatfs=''
690i_sysstatvfs=''
691i_systimes=''
692i_systypes=''
693i_sysuio=''
694i_sysun=''
695i_sysutsname=''
696i_sysvfs=''
697i_syswait=''
698i_sgtty=''
699i_termio=''
700i_termios=''
701i_systime=''
702i_systimek=''
703i_time=''
704timeincl=''
705i_unistd=''
706i_ustat=''
707i_utime=''
708i_values=''
709i_stdarg=''
710i_varargs=''
711i_varhdr=''
712i_vfork=''
713inc_version_list=''
714inc_version_list_init=''
715installprefix=''
716installprefixexp=''
717installstyle=''
718installusrbinperl=''
719intsize=''
720longsize=''
721shortsize=''
2304df62 722libc=''
b4eb6b3d
JH
723ldlibpthname=''
724libperl=''
725shrpenv=''
726useshrplib=''
a0d0e21e 727glibpth=''
2304df62 728libpth=''
8e07c86e 729loclibpth=''
2304df62
AD
730plibpth=''
731xlibpth=''
1cfa4ec7 732ignore_versioned_solibs=''
2304df62 733libs=''
43999f95
JH
734libsdirs=''
735libsfiles=''
736libsfound=''
13b3f787 737libspath=''
85e6fe83 738lns=''
b4eb6b3d
JH
739d_PRIEUldbl=''
740d_PRIFUldbl=''
741d_PRIGUldbl=''
742d_PRIeldbl=''
743d_PRIfldbl=''
744d_PRIgldbl=''
745d_SCNfldbl=''
746sPRIEUldbl=''
747sPRIFUldbl=''
748sPRIGUldbl=''
749sPRIeldbl=''
750sPRIfldbl=''
751sPRIgldbl=''
752sSCNfldbl=''
753lseeksize=''
754lseektype=''
8ff267be 755make_set_make=''
b4eb6b3d
JH
756d_mymalloc=''
757freetype=''
758mallocobj=''
759mallocsrc=''
760malloctype=''
761usemymalloc=''
762installman1dir=''
763man1dir=''
764man1direxp=''
765man1ext=''
766installman3dir=''
767man3dir=''
768man3direxp=''
769man3ext=''
770modetype=''
771multiarch=''
772mydomain=''
773myhostname=''
774phostname=''
2304df62
AD
775c=''
776n=''
b4eb6b3d
JH
777d_eofnblk=''
778eagain=''
779o_nonblock=''
780rd_nodata=''
781netdb_hlen_type=''
782netdb_host_type=''
783netdb_name_type=''
784netdb_net_type=''
785groupcat=''
786hostcat=''
787passcat=''
788orderlib=''
789ranlib=''
790d_perl_otherlibdirs=''
791otherlibdirs=''
2304df62
AD
792package=''
793spackage=''
b4eb6b3d
JH
794pager=''
795api_revision=''
796api_subversion=''
797api_version=''
798api_versionstring=''
799patchlevel=''
800revision=''
801subversion=''
802version=''
803perl5=''
804perladmin=''
805perlpath=''
806d_nv_preserves_uv=''
807d_nv_preserves_uv_bits=''
808i16size=''
809i16type=''
810i32size=''
811i32type=''
812i64size=''
813i64type=''
814i8size=''
815i8type=''
816ivsize=''
817ivtype=''
818nvsize=''
819nvtype=''
820u16size=''
821u16type=''
822u32size=''
823u32type=''
824u64size=''
825u64type=''
826u8size=''
827u8type=''
828uvsize=''
829uvtype=''
830ivdformat=''
831nvEUformat=''
832nvFUformat=''
833nvGUformat=''
834nveformat=''
835nvfformat=''
836nvgformat=''
837uvXUformat=''
838uvoformat=''
839uvuformat=''
840uvxformat=''
841pidtype=''
842prefix=''
843prefixexp=''
844installprivlib=''
845privlib=''
846privlibexp=''
847prototype=''
848ptrsize=''
849d_PRIXU64=''
850d_PRId64=''
851d_PRIi64=''
852d_PRIo64=''
853d_PRIu64=''
854d_PRIx64=''
855sPRIXU64=''
856sPRId64=''
857sPRIi64=''
858sPRIo64=''
859sPRIu64=''
860sPRIx64=''
861d_quad=''
862quadkind=''
863quadtype=''
864uquadtype=''
865drand01=''
866randbits=''
867randfunc=''
868randseedtype=''
869seedfunc=''
870installscript=''
871scriptdir=''
872scriptdirexp=''
873selectminbits=''
874selecttype=''
8ff267be 875sh=''
b4eb6b3d
JH
876sig_count=''
877sig_name=''
878sig_name_init=''
879sig_num=''
880sig_num_init=''
881installsitearch=''
882sitearch=''
883sitearchexp=''
884installsitebin=''
885sitebin=''
886sitebinexp=''
887installsitelib=''
888sitelib=''
889sitelib_stem=''
890sitelibexp=''
891siteprefix=''
892siteprefixexp=''
893sizesize=''
894sizetype=''
a0d0e21e 895so=''
b4eb6b3d 896socksizetype=''
2304df62
AD
897sharpbang=''
898shsharp=''
899spitshell=''
dfe9444c 900src=''
b4eb6b3d
JH
901ssizetype=''
902startperl=''
2304df62 903startsh=''
b4eb6b3d
JH
904stdchar=''
905d_stdio_stream_array=''
906stdio_stream_array=''
907sysman=''
5ff3f7a4 908trnl=''
b4eb6b3d
JH
909uidformat=''
910uidsign=''
911uidsize=''
912uidtype=''
913archname64=''
914use64bitall=''
915use64bitint=''
916ccflags_uselargefiles=''
917ldflags_uselargefiles=''
918libswanted_uselargefiles=''
919uselargefiles=''
920uselongdouble=''
921usemorebits=''
922usemultiplicity=''
2304df62 923nm_opt=''
40a7a20a 924nm_so_opt=''
2304df62
AD
925runnm=''
926usenm=''
b4eb6b3d 927useperlio=''
29209bc5 928usesocks=''
b4eb6b3d
JH
929d_oldpthreads=''
930use5005threads=''
931useithreads=''
932usethreads=''
2304df62 933incpath=''
2304df62
AD
934mips_type=''
935usrinc=''
b4eb6b3d
JH
936d_vendorarch=''
937installvendorarch=''
938vendorarch=''
939vendorarchexp=''
940d_vendorbin=''
941installvendorbin=''
942vendorbin=''
943vendorbinexp=''
944d_vendorlib=''
945installvendorlib=''
946vendorlib=''
947vendorlib_stem=''
948vendorlibexp=''
949usevendorprefix=''
950vendorprefix=''
951vendorprefixexp=''
d56c5707 952versiononly=''
b4eb6b3d
JH
953defvoidused=''
954voidflags=''
955pm_apiversion=''
956xs_apiversion=''
2304df62
AD
957CONFIG=''
958
ecfc5424
AD
959define='define'
960undef='undef'
961smallmach='pdp11 i8086 z8000 i80286 iAPX286'
962rmlist=''
963
964: We must find out about Eunice early
965eunicefix=':'
966if test -f /etc/unixtovms; then
967 eunicefix=/etc/unixtovms
968fi
969if test -f /etc/unixtovms.exe; then
970 eunicefix=/etc/unixtovms.exe
971fi
972
b4eb6b3d 973i_whoami=''
6b356c8e
JH
974ccname=''
975ccversion=''
9c839522 976perllibs=''
b4eb6b3d
JH
977: set useposix=false in your hint file to disable the POSIX extension.
978useposix=true
979: set useopcode=false in your hint file to disable the Opcode extension.
980useopcode=true
dfe9444c 981: Trailing extension. Override this in a hint file, if needed.
4e2a5f63 982_exe=''
dfe9444c
AD
983: Extra object files, if any, needed on this platform.
984archobjs=''
b4eb6b3d 985archname=''
ff935051
JH
986: Possible local include directories to search.
987: Set locincpth to "" in a hint file to defeat local include searches.
988locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
989locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
990:
991: no include file wanted by default
992inclwanted=''
993
b4eb6b3d 994groupstype=''
732c9516
JH
995: change the next line if compiling for Xenix/286 on Xenix/386
996xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
997: Possible local library directories to search.
998loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
999loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1000
1001: general looking path for locating libraries
5869b1f1 1002glibpth="/lib /usr/lib $xlibpth"
732c9516 1003glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1004test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1005test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1006
1007: Private path used by Configure to find libraries. Its value
1008: is prepended to libpth. This variable takes care of special
1009: machines, like the mips. Usually, it should be empty.
1010plibpth=''
1011
1cfa4ec7
GS
1012: default library list
1013libswanted=''
921b2963 1014: some systems want to use only the non-versioned libso:s
1cfa4ec7 1015ignore_versioned_solibs=''
b4eb6b3d
JH
1016archname64=''
1017ccflags_uselargefiles=''
1018ldflags_uselargefiles=''
1019libswanted_uselargefiles=''
1020: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1021: set usesocks on the Configure command line to enable socks.
b4eb6b3d
JH
1022: set usethreads on the Configure command line to enable threads.
1023: full support for void wanted by default
1024defvoidused=15
1025
ecfc5424 1026: List of libraries we want.
693762b4 1027: If anyone needs -lnet, put it in a hint file.
997d70a2 1028libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
69e84d1d 1029libswanted="$libswanted dld ld sun m c cposix posix"
f1066039 1030libswanted="$libswanted ndir dir crypt sec"
0c9177ab 1031libswanted="$libswanted ucb bsd BSD PW x iconv util"
1aef975c 1032: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1033: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1034glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1035glibpth="/usr/shlib $glibpth"
1036: Do not use vfork unless overridden by a hint file.
1037usevfork=false
1038
8ff267be 1039: Find the basic shell for Bourne shell scripts
1040case "$sh" in
1041'')
8ff267be 1042 case "$SYSTYPE" in
1043 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1044 *) xxx='/bin/sh';;
1045 esac
1046 if test -f "$xxx"; then
1047 sh="$xxx"
1048 else
1049 : Build up a list and do a single loop so we can 'break' out.
1050 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1051 for xxx in sh bash ksh pdksh ash; do
1052 for p in $pth; do
1053 try="$try ${p}/${xxx}"
1054 done
1055 done
1056 for xxx in $try; do
1057 if test -f "$xxx"; then
1058 sh="$xxx";
8ff267be 1059 break
1060 elif test -f "$xxx.exe"; then
1061 sh="$xxx";
8ff267be 1062 break
1063 fi
1064 done
1065 fi
1066 ;;
1067esac
1068
1069case "$sh" in
1070'') cat <<EOM >&2
1071$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1072
8ff267be 1073Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1074Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1075we'll try to straighten this all out.
8ff267be 1076EOM
1077 exit 1
1078 ;;
1079esac
1080
760ac839 1081: see if sh knows # comments
8ff267be 1082if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1083 shsharp=true
1084 spitshell=cat
760ac839
LW
1085 xcat=/bin/cat
1086 test -f $xcat || xcat=/usr/bin/cat
1087 echo "#!$xcat" >try
1088 $eunicefix try
1089 chmod +x try
1090 ./try > today
1091 if test -s today; then
760ac839
LW
1092 sharpbang='#!'
1093 else
1094 echo "#! $xcat" > try
1095 $eunicefix try
1096 chmod +x try
1097 ./try > today
1098 if test -s today; then
760ac839
LW
1099 sharpbang='#! '
1100 else
760ac839
LW
1101 sharpbang=': use '
1102 fi
1103 fi
1104else
dfe9444c 1105 echo " "
8ff267be 1106 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1107 shsharp=false
1108 cd ..
1109 echo "exec grep -v '^[ ]*#'" >spitshell
1110 chmod +x spitshell
1111 $eunicefix spitshell
1112 spitshell=`pwd`/spitshell
1113 cd UU
1114 echo "I presume that if # doesn't work, #! won't work either!"
1115 sharpbang=': use '
1116fi
1117rm -f try today
1118
1119: figure out how to guarantee sh startup
8ff267be 1120case "$startsh" in
1121'') startsh=${sharpbang}${sh} ;;
1122*)
760ac839 1123esac
760ac839
LW
1124cat >try <<EOSS
1125$startsh
1126set abc
1127test "$?abc" != 1
1128EOSS
1129
1130chmod +x try
1131$eunicefix try
1132if ./try; then
8ff267be 1133 : echo "Yup, it does."
760ac839 1134else
dfe9444c
AD
1135 echo "Hmm... '$startsh' does not guarantee sh startup..."
1136 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839
LW
1137fi
1138rm -f try
1139
aebf16e7
AD
1140
1141: Save command line options in file UU/cmdline.opt for later use in
1142: generating config.sh.
1143cat > cmdline.opt <<EOSH
1144# Configure command line arguments.
1145config_arg0='$0'
1146config_args='$*'
1147config_argc=$#
1148EOSH
1149argn=1
1150for arg in "$@"; do
1151 cat >>cmdline.opt <<EOSH
1152config_arg$argn='$arg'
1153EOSH
1154 argn=`expr $argn + 1`
1155done
1156
2304df62
AD
1157: produce awk script to parse command line options
1158cat >options.awk <<'EOF'
1159BEGIN {
02e93a22 1160 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1161
1162 len = length(optstr);
1163 for (i = 1; i <= len; i++) {
1164 c = substr(optstr, i, 1);
1165 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1166 if (a == ":") {
1167 arg[c] = 1;
1168 i++;
1169 }
1170 opt[c] = 1;
1171 }
1172}
1173{
1174 expect = 0;
1175 str = $0;
1176 if (substr(str, 1, 1) != "-") {
1177 printf("'%s'\n", str);
1178 next;
1179 }
1180 len = length($0);
1181 for (i = 2; i <= len; i++) {
1182 c = substr(str, i, 1);
1183 if (!opt[c]) {
1184 printf("-%s\n", substr(str, i));
1185 next;
1186 }
1187 printf("-%s\n", c);
1188 if (arg[c]) {
1189 if (i < len)
1190 printf("'%s'\n", substr(str, i + 1));
1191 else
1192 expect = 1;
1193 next;
1194 }
1195 }
1196}
1197END {
1198 if (expect)
1199 print "?";
1200}
1201EOF
1202
1203: process the command line options
4633a7c4
LW
1204set X `for arg in "$@"; do echo "X$arg"; done |
1205 sed -e s/X// | awk -f options.awk`
2304df62
AD
1206eval "set $*"
1207shift
1208rm -f options.awk
1209
1210: set up default values
1211fastread=''
1212reuseval=false
1213config_sh=''
1214alldone=''
1215error=''
1216silent=''
1217extractsh=''
ecfc5424 1218override=''
16d20bd9 1219knowitall=''
02e93a22 1220rm -f optdef.sh posthint.sh
28757baa 1221cat >optdef.sh <<EOS
1222$startsh
1223EOS
2304df62 1224
dfe9444c 1225
2304df62
AD
1226: option parsing
1227while test $# -gt 0; do
1228 case "$1" in
1229 -d) shift; fastread=yes;;
1230 -e) shift; alldone=cont;;
1231 -f)
1232 shift
1233 cd ..
1234 if test -r "$1"; then
1235 config_sh="$1"
1236 else
a0d0e21e 1237 echo "$me: cannot read config file $1." >&2
2304df62
AD
1238 error=true
1239 fi
1240 cd UU
1241 shift;;
1242 -h) shift; error=true;;
1243 -r) shift; reuseval=true;;
dfe9444c 1244 -s) shift; silent=true; realsilent=true;;
2304df62 1245 -E) shift; alldone=exit;;
16d20bd9 1246 -K) shift; knowitall=true;;
ecfc5424 1247 -O) shift; override=true;;
dfe9444c 1248 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1249 -D)
1250 shift
1251 case "$1" in
1252 *=)
1253 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1254 echo "$me: ignoring -D $1" >&2
1255 ;;
ecfc5424 1256 *=*) echo "$1" | \
1aef975c
AD
1257 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1258 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1259 esac
1260 shift
1261 ;;
1262 -U)
1263 shift
1264 case "$1" in
1aef975c 1265 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1266 *=*)
1267 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1268 echo "$me: ignoring -U $1" >&2
1269 ;;
1aef975c 1270 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1271 esac
1272 shift
1273 ;;
02e93a22
JH
1274 -A)
1275 shift
1276 xxx=''
1277 yyy="$1"
02e93a22 1278 zzz=''
5f83a3e9 1279 uuu=undef
02e93a22 1280 case "$yyy" in
5f83a3e9
JH
1281 *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1282 case "$zzz" in
1283 *:*) zzz='' ;;
1284 *) xxx=append
1285 zzz=" "`echo $yyy|sed 's!^[^=]*=!!'`
1286 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1287 esac
1288 ;;
1289 esac
1290 case "$xxx" in
1291 '') case "$yyy" in
1292 *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1293 yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1294 zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1295 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1296 *) xxx=`echo $yyy|sed 's!:.*!!'`
1297 yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1298 esac
1299 ;;
1300 esac
02e93a22
JH
1301 case "$xxx" in
1302 append)
5f83a3e9 1303 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1304 clear)
5f83a3e9 1305 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1306 define)
1307 case "$zzz" in
1308 '') zzz=define ;;
1309 esac
5f83a3e9 1310 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1311 eval)
5f83a3e9 1312 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1313 prepend)
5f83a3e9 1314 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1315 undef)
1316 case "$zzz" in
1317 '') zzz="$uuu" ;;
1318 esac
5f83a3e9
JH
1319 echo "$yyy=$zzz" >> posthint.sh ;;
1320 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1321 esac
bde6b06b 1322 shift
02e93a22 1323 ;;
dfe9444c 1324 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1325 exit 0;;
2304df62 1326 --) break;;
a0d0e21e 1327 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1328 *) break;;
1329 esac
1330done
1331
1332case "$error" in
1333true)
1334 cat >&2 <<EOM
2afac517 1335Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1336 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1337 -d : use defaults for all answers.
1338 -e : go on without questioning past the production of config.sh.
1339 -f : specify an alternate default configuration file.
1340 -h : print this help message and exit (with an error status).
1341 -r : reuse C symbols value if possible (skips costly nm extraction).
1342 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1343 -D : define symbol to have some value:
1344 -D symbol symbol gets the value 'define'
1345 -D symbol=value symbol gets the value 'value'
2304df62 1346 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1347 -K : do not use unless you know what you are doing.
ecfc5424 1348 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1349 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1350 -U : undefine symbol:
1351 -U symbol symbol gets the value 'undef'
1352 -U symbol= symbol gets completely empty
02e93a22 1353 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1354 -A symbol=value append " "value to symbol
02e93a22
JH
1355 -A append:symbol=value append value to symbol
1356 -A define:symbol=value define symbol to have value
02e93a22
JH
1357 -A clear:symbol define symbol to be ''
1358 -A define:symbol define symbol to be 'define'
1359 -A eval:symbol=value define symbol to be eval of value
1360 -A prepend:symbol=value prepend value to symbol
1361 -A undef:symbol define symbol to be 'undef'
1362 -A undef:symbol= define symbol to be ''
2304df62
AD
1363 -V : print version number and exit (with a zero status).
1364EOM
1365 exit 1
1366 ;;
1367esac
1368
dfe9444c
AD
1369: Sanity checks
1370case "$fastread$alldone" in
1371yescont|yesexit) ;;
1372*)
aaeb8e51
GS
1373 case "$extractsh" in
1374 true) ;;
1375 *)
1376 if test ! -t 0; then
1377 echo "Say 'sh Configure', not 'sh <Configure'"
1378 exit 1
1379 fi
1380 ;;
1381 esac
dfe9444c
AD
1382 ;;
1383esac
1384
2304df62
AD
1385exec 4>&1
1386case "$silent" in
1387true) exec 1>/dev/null;;
1388esac
1389
ecfc5424 1390: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1391touch optdef.sh
1392. ./optdef.sh
02e93a22
JH
1393: create the posthint manipulation script and leave the file out there...
1394touch posthint.sh
a0d0e21e 1395
2304df62 1396: set package name
85e6fe83 1397package=perl5
b4eb6b3d
JH
1398first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1399last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1400case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1401ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1402*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1403esac
2304df62 1404
2304df62
AD
1405: Some greps do not return status, grrr.
1406echo "grimblepritz" >grimble
1407if grep blurfldyick grimble >/dev/null 2>&1 ; then
1408 contains=contains
1409elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1410 contains=grep
1411else
1412 contains=contains
1413fi
1414rm -f grimble
1415: the following should work in any shell
1416case "$contains" in
1417contains*)
1418 echo " "
1419 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1420 cat >contains <<'EOSS'
1421grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1422EOSS
1423chmod +x contains
1424esac
1425
dfe9444c
AD
1426: Find the path to the source tree
1427case "$src" in
1428'') case "$0" in
b233458b
JH
1429 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1430 case "$src" in
1431 /*) ;;
1432 *) src=`cd ../$src && pwd` ;;
1433 esac
1434 ;;
dfe9444c
AD
1435 *) src='.';;
1436 esac;;
1437esac
1438case "$src" in
1439'') src=/
1440 rsrc=/
1441 ;;
1442/*) rsrc="$src";;
1443*) rsrc="../$src";;
1444esac
1445if test -f $rsrc/Configure && \
1446 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1447then
1448 : found it, so we are ok.
1449else
1450 rsrc=''
1451 for src in . .. ../.. ../../.. ../../../..; do
1452 if test -f ../$src/Configure && \
1453 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1454 then
1455 rsrc=../$src
1456 break
1457 fi
1458 done
1459fi
1460case "$rsrc" in
1461'')
1462 cat <<EOM >&4
1463
1464Sorry, I can't seem to locate the source dir for $package. Please start
1465Configure with an explicit path -- i.e. /some/path/Configure.
1466
1467EOM
1468 exit 1
1469 ;;
1470../.) rsrc='..';;
1471*)
1472 echo " "
1473 echo "Sources for $package found in \"$src\"." >&4
1474 ;;
1475esac
1476
1477: script used to extract .SH files with variable substitutions
1478cat >extract <<'EOS'
2000072c 1479CONFIGDOTSH=true
dfe9444c
AD
1480echo "Doing variable substitutions on .SH files..."
1481if test -f $src/MANIFEST; then
f7ab18e9 1482 set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
dfe9444c
AD
1483else
1484 echo "(Looking for .SH files under the source directory.)"
1485 set x `(cd $src; find . -name "*.SH" -print)`
1486fi
1487shift
1488case $# in
14890) set x `(cd $src; echo *.SH)`; shift;;
1490esac
1491if test ! -f $src/$1; then
1492 shift
1493fi
1494mkdir_p='
1495name=$1;
1496create="";
1497while test $name; do
1498 if test ! -d "$name"; then
1499 create="$name $create";
1500 name=`echo $name | sed -e "s|^[^/]*$||"`;
1501 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1502 else
1503 name="";
1504 fi;
1505done;
1506for file in $create; do
1507 mkdir $file;
1508done
1509'
1510for file in $*; do
1511 case "$src" in
1512 ".")
1513 case "$file" in
1514 */*)
1515 dir=`expr X$file : 'X\(.*\)/'`
1516 file=`expr X$file : 'X.*/\(.*\)'`
1517 (cd $dir && . ./$file)
1518 ;;
1519 *)
1520 . ./$file
1521 ;;
1522 esac
1523 ;;
1524 *)
1525 case "$file" in
1526 */*)
1527 dir=`expr X$file : 'X\(.*\)/'`
1528 file=`expr X$file : 'X.*/\(.*\)'`
1529 (set x $dir; shift; eval $mkdir_p)
1530 sh <$src/$dir/$file
1531 ;;
1532 *)
1533 sh <$src/$file
1534 ;;
1535 esac
1536 ;;
1537 esac
1538done
1539if test -f $src/config_h.SH; then
1540 if test ! -f config.h; then
1541 : oops, they left it out of MANIFEST, probably, so do it anyway.
1542 . $src/config_h.SH
1543 fi
1544fi
1545EOS
1546
1547: extract files and exit if asked to do so
1548case "$extractsh" in
1549true)
1550 case "$realsilent" in
1551 true) ;;
1552 *) exec 1>&4;;
1553 esac
1554 case "$config_sh" in
1555 '') config_sh='config.sh';;
1556 esac
1557 echo " "
1558 echo "Fetching answers from $config_sh..."
1559 cd ..
1560 . $config_sh
1561 test "$override" && . ./optdef.sh
1562 echo " "
1563 . UU/extract
1564 rm -rf UU
1565 echo "Done."
1566 exit 0
1567 ;;
1568esac
1569
1570: Eunice requires " " instead of "", can you believe it
1571echo " "
1572: Here we go...
1573echo "Beginning of configuration questions for $package."
1574
1575trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1576
2304df62
AD
1577: first determine how to suppress newline on echo command
1578echo " "
1579echo "Checking echo to see how to suppress newlines..."
1580(echo "hi there\c" ; echo " ") >.echotmp
1581if $contains c .echotmp >/dev/null 2>&1 ; then
1582 echo "...using -n."
1583 n='-n'
1584 c=''
1585else
1586 cat <<'EOM'
1587...using \c
1588EOM
1589 n=''
1590 c='\c'
1591fi
1592echo $n "The star should be here-->$c"
1593echo '*'
1594rm -f .echotmp
1595
1596: Now test for existence of everything in MANIFEST
1597echo " "
dfe9444c 1598if test -f $rsrc/MANIFEST; then
2304df62 1599 echo "First let's make sure your kit is complete. Checking..." >&4
dfe9444c 1600 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
2304df62 1601 rm -f missing
dfe9444c 1602 tmppwd=`pwd`
2304df62 1603 for filelist in x??; do
dfe9444c 1604 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
2304df62
AD
1605 done
1606 if test -s missing; then
1607 cat missing >&4
1608 cat >&4 <<'EOM'
1609
1610THIS PACKAGE SEEMS TO BE INCOMPLETE.
1611
1612You have the option of continuing the configuration process, despite the
1613distinct possibility that your kit is damaged, by typing 'y'es. If you
1614do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1615and contact the author (perlbug@perl.org).
2304df62
AD
1616
1617EOM
1618 echo $n "Continue? [n] $c" >&4
1619 read ans
1620 case "$ans" in
1621 y*)
1622 echo "Continuing..." >&4
1623 rm -f missing
1624 ;;
1625 *)
1626 echo "ABORTING..." >&4
1627 kill $$
1628 ;;
1629 esac
1630 else
dfe9444c 1631 echo "Looks good..."
2304df62
AD
1632 fi
1633else
1634 echo "There is no MANIFEST file. I hope your kit is complete !"
1635fi
1636rm -f missing x??
1637
5ff3f7a4
GS
1638echo " "
1639: Find the appropriate value for a newline for tr
1640if test -n "$DJGPP"; then
1641 trnl='\012'
1642fi
1643if test X"$trnl" = X; then
1644 case "`echo foo|tr '\n' x 2>/dev/null`" in
1645 foox) trnl='\n' ;;
1646 esac
1647fi
1648if test X"$trnl" = X; then
1649 case "`echo foo|tr '\012' x 2>/dev/null`" in
1650 foox) trnl='\012' ;;
1651 esac
1652fi
1653if test X"$trnl" = X; then
1654 cat <<EOM >&2
1655
1656$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1657
1658EOM
1659 exit 1
1660fi
1661
2304df62
AD
1662: compute the number of columns on the terminal for proper question formatting
1663case "$COLUMNS" in
1664'') COLUMNS='80';;
1665esac
1666
1667: set up the echo used in my read
1668myecho="case \"\$xxxm\" in
1669'') echo $n \"\$rp $c\" >&4;;
1670*) case \"\$rp\" in
1671 '') echo $n \"[\$xxxm] $c\";;
1672 *)
1673 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1674 echo \"\$rp\" >&4
1675 echo $n \"[\$xxxm] $c\" >&4
1676 else
1677 echo $n \"\$rp [\$xxxm] $c\" >&4
1678 fi
1679 ;;
1680 esac;;
1681esac"
1682
1683: now set up to do reads with possible shell escape and default assignment
1684cat <<EOSC >myread
28757baa 1685$startsh
2304df62
AD
1686xxxm=\$dflt
1687$myecho
1688ans='!'
1689case "\$fastread" in
1690yes) case "\$dflt" in
1691 '') ;;
1692 *) ans='';
1693 case "\$silent-\$rp" in
1694 true-) ;;
1695 *) echo " " >&4;;
1696 esac;;
1697 esac;;
1698*) case "\$silent" in
1699 true) case "\$rp" in
1700 '') ans='';;
1701 esac;;
1702 esac;;
1703esac
1704while expr "X\$ans" : "X!" >/dev/null; do
1705 read answ
1706 set x \$xxxm
1707 shift
dfe9444c 1708 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1709 case "\$answ" in
dfe9444c
AD
1710 "!")
1711 sh 1>&4
1712 echo " "
1713 $myecho
1714 ;;
1715 !*)
1716 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1717 shift
1718 sh 1>&4 -c "\$*"
1719 echo " "
1720 $myecho
1721 ;;
2304df62
AD
1722 "\$ans")
1723 case "\$ans" in
ecfc5424
AD
1724 \\&*)
1725 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1726 shift
1727 case "\$1" in
1728 -d)
1729 fastread=yes
40a7a20a 1730 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1731 ;;
1732 -*)
40a7a20a 1733 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1734 ;;
1735 esac
1736 $myecho
1737 ans=!
1738 ;;
2304df62
AD
1739 esac;;
1740 *)
1741 case "\$aok" in
1742 y)
1743 echo "*** Substitution done -- please confirm."
1744 xxxm="\$ans"
c9795ab7 1745 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1746 xxxm="\$ans"
1747 ans=!
1748 ;;
1749 *)
1750 echo "*** Error -- try again."
1751 ans=!
1752 ;;
1753 esac
1754 $myecho
1755 ;;
1756 esac
1757 case "\$ans\$xxxm\$nostick" in
1758 '')
1759 ans=!
1760 $myecho
1761 ;;
1762 esac
1763done
1764case "\$ans" in
1765'') ans="\$xxxm";;
1766esac
1767EOSC
1768
1769: create .config dir to save info across Configure sessions
1770test -d ../.config || mkdir ../.config
1771cat >../.config/README <<EOF
1772This directory created by Configure to save information that should
dfe9444c 1773persist across sessions for $package.
2304df62
AD
1774
1775You may safely delete it if you wish.
1776EOF
1777
9507cadf 1778xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 1779case "$usedevel" in
0107c034 1780$define|true|[yY]*) ;;
9507cadf 1781*) case "$xversion" in
0107c034
JH
1782 *[13579])
1783 cat >&4 <<EOH
1784*** WHOA THERE!!! ***
1785
1786 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
1787 The version of this $package distribution is $xversion, that is, odd,
1788 (as opposed to even) and that signifies a development release.
3d5d58b1 1789 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
1790
1791 Do ***NOT*** install this into production use.
1792 Data corruption and crashes are possible.
1793
1794 It is most seriously suggested that you do not continue any further
1795 unless you want to help in developing and debugging Perl.
1796
1797EOH
1798 rp='Do you really want to continue?'
1799 dflt='n'
1800 . ./myread
1801 case "$ans" in
1802 [yY]) echo >&4 "Okay, continuing." ;;
1803 *) echo >&4 "Okay, bye."
1804 exit 1
1805 ;;
1806 esac
1807 ;;
1808 esac
1809 ;;
1810esac
1811
2304df62
AD
1812: general instructions
1813needman=true
1814firsttime=true
760ac839 1815user=`(logname) 2>/dev/null`
dfe9444c
AD
1816case "$user" in
1817'') user=`whoami 2>&1`;;
760ac839 1818esac
2304df62
AD
1819if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1820 firsttime=false
1821 echo " "
1822 rp='Would you like to see the instructions?'
1823 dflt=n
1824 . ./myread
1825 case "$ans" in
1826 [yY]*) ;;
1827 *) needman=false;;
1828 esac
1829fi
1830if $needman; then
1831 cat <<EOH
4e2a5f63 1832
2304df62 1833This installation shell script will examine your system and ask you questions
a0d0e21e 1834to determine how the perl5 package should be installed. If you get
2304df62
AD
1835stuck on a question, you may use a ! shell escape to start a subshell or
1836execute a command. Many of the questions will have default answers in square
1837brackets; typing carriage return will give you the default.
1838
1839On some of the questions which ask for file or directory names you are allowed
1840to use the ~name construct to specify the login directory belonging to "name",
1841even if you don't have a shell which knows about that. Questions where this is
1842allowed will be marked "(~name ok)".
1843
1844EOH
1845 rp=''
1846 dflt='Type carriage return to continue'
1847 . ./myread
1848 cat <<'EOH'
1849
1850The prompter used in this script allows you to use shell variables and
1851backticks in your answers. You may use $1, $2, etc... to refer to the words
1852in the default answer, as if the default line was a set of arguments given to a
1853script shell. This means you may also use $* to repeat the whole default line,
1854so you do not have to re-type everything to add something to the default.
1855
1856Everytime there is a substitution, you will have to confirm. If there is an
1857error (e.g. an unmatched backtick), the default answer will remain unchanged
1858and you will be prompted again.
1859
1860If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1861the questions and use the computed defaults (or the previous answers if there
1862was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1863You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1864on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1865
1866EOH
1867 . ./myread
1868 cat <<EOH
1869
1870Much effort has been expended to ensure that this shell script will run on any
1871Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1872Configure and run it again. If you can't run Configure for some reason,
1873you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 1874have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
1875
1876This installation script affects things in two ways:
1877
18781) it may do direct variable substitutions on some of the files included
1879 in this kit.
18802) it builds a config.h file for inclusion in C programs. You may edit
1881 any of these files as the need arises after running this script.
1882
1883If you make a mistake on a question, there is no easy way to back up to it
1884currently. The easiest thing to do is to edit config.sh and rerun all the SH
1885files. Configure will offer to let you do this before it runs the SH files.
1886
1887EOH
1888 dflt='Type carriage return to continue'
1889 . ./myread
1890 case "$firsttime" in
1891 true) echo $user >>../.config/instruct;;
1892 esac
1893fi
1894
2304df62
AD
1895: find out where common programs are
1896echo " "
1897echo "Locating common programs..." >&4
1898cat <<EOSC >loc
1899$startsh
1900case \$# in
19010) exit 1;;
1902esac
1903thing=\$1
1904shift
1905dflt=\$1
1906shift
1907for dir in \$*; do
1908 case "\$thing" in
1909 .)
1910 if test -d \$dir/\$thing; then
1911 echo \$dir
1912 exit 0
1913 fi
1914 ;;
1915 *)
a0d0e21e 1916 for thisthing in \$dir/\$thing; do
ecfc5424 1917 : just loop through to pick last item
a0d0e21e 1918 done
25f94b33 1919 if test -f \$thisthing; then
a0d0e21e 1920 echo \$thisthing
2304df62
AD
1921 exit 0
1922 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
1923 if test -n "$DJGPP"; then
1924 echo \$dir/\$thing.exe
1925 else
1926 : on Eunice apparently
1927 echo \$dir/\$thing
1928 fi
2304df62
AD
1929 exit 0
1930 fi
1931 ;;
1932 esac
1933done
1934echo \$dflt
1935exit 1
1936EOSC
1937chmod +x loc
1938$eunicefix loc
1939loclist="
1940awk
1941cat
b4eb6b3d
JH
1942comm
1943cp
2304df62
AD
1944echo
1945expr
1946grep
a0d0e21e 1947ls
dfe9444c 1948make
b4eb6b3d 1949mkdir
2304df62
AD
1950rm
1951sed
b4eb6b3d 1952sort
85e6fe83 1953touch
2304df62 1954tr
b4eb6b3d 1955uniq
2304df62
AD
1956"
1957trylist="
1958Mcc
dfe9444c 1959ar
b4eb6b3d 1960byacc
2304df62 1961cpp
b4eb6b3d 1962csh
2304df62
AD
1963date
1964egrep
8ff267be 1965gzip
b4eb6b3d 1966less
8ff267be 1967ln
b4eb6b3d 1968more
693762b4 1969nm
b4eb6b3d
JH
1970nroff
1971pg
2304df62
AD
1972test
1973uname
8ff267be 1974zip
2304df62 1975"
8e07c86e 1976pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
1977pth="$pth /lib /usr/lib"
1978for file in $loclist; do
dfe9444c
AD
1979 eval xxx=\$$file
1980 case "$xxx" in
1981 /*|?:[\\/]*)
1982 if test -f "$xxx"; then
1983 : ok
1984 else
1985 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1986 xxx=`./loc $file $file $pth`
1987 fi
1988 ;;
1989 '') xxx=`./loc $file $file $pth`;;
1990 *) xxx=`./loc $xxx $xxx $pth`;;
1991 esac
2304df62
AD
1992 eval $file=$xxx
1993 eval _$file=$xxx
1994 case "$xxx" in
1995 /*)
1996 echo $file is in $xxx.
1997 ;;
8e07c86e
AD
1998 ?:[\\/]*)
1999 echo $file is in $xxx.
2000 ;;
2304df62 2001 *)
25f94b33
AD
2002 echo "I don't know where '$file' is, and my life depends on it." >&4
2003 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2004 exit 1
2304df62
AD
2005 ;;
2006 esac
2007done
2008echo " "
2009echo "Don't worry if any of the following aren't found..."
2010say=offhand
2011for file in $trylist; do
dfe9444c
AD
2012 eval xxx=\$$file
2013 case "$xxx" in
2014 /*|?:[\\/]*)
2015 if test -f "$xxx"; then
2016 : ok
2017 else
2018 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2019 xxx=`./loc $file $file $pth`
2020 fi
2021 ;;
2022 '') xxx=`./loc $file $file $pth`;;
2023 *) xxx=`./loc $xxx $xxx $pth`;;
2024 esac
2304df62
AD
2025 eval $file=$xxx
2026 eval _$file=$xxx
2027 case "$xxx" in
2028 /*)
2029 echo $file is in $xxx.
2030 ;;
8e07c86e
AD
2031 ?:[\\/]*)
2032 echo $file is in $xxx.
2033 ;;
2304df62
AD
2034 *)
2035 echo "I don't see $file out there, $say."
2036 say=either
2037 ;;
2038 esac
2039done
2040case "$egrep" in
2041egrep)
2042 echo "Substituting grep for egrep."
2043 egrep=$grep
2044 ;;
2045esac
8ff267be 2046case "$ln" in
2047ln)
2048 echo "Substituting cp for ln."
2049 ln=$cp
2050 ;;
2051esac
2304df62
AD
2052case "$test" in
2053test)
2054 echo "Hopefully test is built into your sh."
2055 ;;
2056*)
ecfc5424 2057 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2304df62
AD
2058 echo "Using the test built into your sh."
2059 test=test
2060 _test=test
2061 fi
2062 ;;
2063esac
2064case "$echo" in
2065echo)
2066 echo "Hopefully echo is built into your sh."
2067 ;;
2068'') ;;
2069*)
2070 echo " "
2071echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2072 $echo $n "hi there$c" >foo1
2073 echo $n "hi there$c" >foo2
2074 if cmp foo1 foo2 >/dev/null 2>&1; then
2075 echo "They are compatible. In fact, they may be identical."
2076 else
2077 case "$n" in
2078 '-n') n='' c='\c';;
2079 *) n='-n' c='';;
2080 esac
2081 cat <<FOO
2082They are not compatible! You are probably running ksh on a non-USG system.
2083I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2084have echo built in and we may have to run some Bourne shell scripts. That
2085means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2086
2087FOO
2088 $echo $n "The star should be here-->$c"
2089 $echo "*"
2090 fi
2091 $rm -f foo1 foo2
2092 ;;
2093esac
2094
2573c5f9
JH
2095cat <<EOS >checkcc
2096$startsh
2097EOS
2098cat <<'EOSC' >>checkcc
2099case "$cc" in
2100'') ;;
2101*) $rm -f try try.*
2102 $cat >try.c <<EOM
2103int main(int argc, char *argv[]) {
2104 return 0;
2105}
2106EOM
7a282f6d 2107 if $cc -o try $ccflags try.c; then
2573c5f9
JH
2108 :
2109 else
2110 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2111 despair=yes
2112 trygcc=yes
2113 case "$cc" in
2114 *gcc*) trygcc=no ;;
2115 esac
2116 case "`$cc -v -c try.c 2>&1`" in
2117 *gcc*) trygcc=no ;;
2118 esac
2119 if $test X"$trygcc" = Xyes; then
2120 if gcc -o try -c try.c; then
2121 echo " "
2122 echo "You seem to have a working gcc, though." >&4
2123 rp="Would you like to use it?"
2124 dflt=y
2125 if $test -f myread; then
2126 . ./myread
2127 else
2128 if $test -f UU/myread; then
2129 . ./UU/myread
2130 else
2131 echo "Cannot find myread, sorry. Aborting." >&2
2132 exit 1
2133 fi
2134 fi
2135 case "$ans" in
e723fc21 2136 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2573c5f9
JH
2137 esac
2138 fi
2139 fi
2140 if $test X"$despair" = Xyes; then
5dd4fbdf
MB
2141 $cat >&4 <<EOM
2142You need to find a working C compiler.
2143Either (purchase and) install the C compiler supplied by your OS vendor,
2144or for a free C compiler try http://gcc.gnu.org/
2145I cannot continue any further, aborting.
2146EOM
2573c5f9
JH
2147 exit 1
2148 fi
2149 fi
2150 $rm -f try try.*
2151 ;;
2152esac
2153EOSC
2154
a0d0e21e
LW
2155: determine whether symbolic links are supported
2156echo " "
2157$touch blurfl
2158if $ln -s blurfl sym > /dev/null 2>&1 ; then
2159 echo "Symbolic links are supported." >&4
2160 lns="$ln -s"
2161else
2162 echo "Symbolic links are NOT supported." >&4
2163 lns="$ln"
2164fi
2165$rm -f blurfl sym
2166
ecfc5424
AD
2167: see whether [:lower:] and [:upper:] are supported character classes
2168echo " "
ecfc5424
AD
2169case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2170ABYZ)
2171 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2172 up='[:upper:]'
2173 low='[:lower:]'
2174 ;;
28e8609d
JH
2175*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2176 # (0xc9 and 0xd1), therefore that is a nice testing point.
2177 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2178 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2179 ij) up='[A-Z]'
2180 low='[a-z]'
2181 ;;
2182 esac
2183 fi
2184 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2185 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2186 ij) up='A-Z'
2187 low='a-z'
2188 ;;
2189 esac
2190 fi
2191 if test "X$up" = X -o "X$low" = X; then
2192 case "`echo IJ | od -x 2>/dev/null`" in
2193 *C9D1*|*c9d1*)
2194 echo "Hey, this might be EBCDIC." >&4
2195 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2196 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2197 ij) up='[A-IJ-RS-Z]'
2198 low='[a-ij-rs-z]'
2199 ;;
2200 esac
2201 fi
2202 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2203 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2204 ij) up='A-IJ-RS-Z'
2205 low='a-ij-rs-z'
2206 ;;
2207 esac
2208 fi
2209 ;;
2210 esac
2211 fi
2212esac
3eaeeeae 2213case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2214ij)
2215 echo "Using $up and $low to convert case." >&4
2216 ;;
ecfc5424 2217*)
28e8609d
JH
2218 echo "I don't know how to translate letters from upper to lower case." >&4
2219 echo "Your tr is not acting any way I know of." >&4
2220 exit 1
2221 ;;
ecfc5424
AD
2222esac
2223: set up the translation script tr, must be called with ./tr of course
2224cat >tr <<EOSC
2225$startsh
2226case "\$1\$2" in
2227'[A-Z][a-z]') exec $tr '$up' '$low';;
2228'[a-z][A-Z]') exec $tr '$low' '$up';;
2229esac
2230exec $tr "\$@"
2231EOSC
2232chmod +x tr
2233$eunicefix tr
2234
2304df62
AD
2235: Try to determine whether config.sh was made on this system
2236case "$config_sh" in
2237'')
43999f95
JH
2238myuname=`$uname -a 2>/dev/null`
2239$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2240# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2241# because the A-Z/a-z are not consecutive.
a0d0e21e 2242myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2243 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2244newmyuname="$myuname"
2304df62 2245dflt=n
16d20bd9
AD
2246case "$knowitall" in
2247'')
2248 if test -f ../config.sh; then
2249 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2250 eval "`grep myuname= ../config.sh`"
2251 fi
2252 if test "X$myuname" = "X$newmyuname"; then
2253 dflt=y
2254 fi
2304df62 2255 fi
16d20bd9
AD
2256 ;;
2257*) dflt=y;;
2258esac
2304df62
AD
2259
2260: Get old answers from old config file if Configure was run on the
2261: same system, otherwise use the hints.
2262hint=default
2263cd ..
2264if test -f config.sh; then
16d20bd9
AD
2265 echo " "
2266 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2267 . UU/myread
2268 case "$ans" in
f83701cd
AD
2269 n*|N*) echo "OK, I'll ignore it."
2270 mv config.sh config.sh.old
2271 myuname="$newmyuname"
2272 ;;
2304df62 2273 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2274 tmp_n="$n"
2275 tmp_c="$c"
85cad39c 2276 tmp_sh="$sh"
2304df62
AD
2277 . ./config.sh
2278 cp config.sh UU
ecfc5424
AD
2279 n="$tmp_n"
2280 c="$tmp_c"
85cad39c 2281 : Older versions did not always set $sh. Catch re-use of such
2282 : an old config.sh.
2283 case "$sh" in
2284 '') sh="$tmp_sh" ;;
2285 esac
2304df62
AD
2286 hint=previous
2287 ;;
2288 esac
2289fi
2573c5f9 2290. ./UU/checkcc
2304df62
AD
2291if test ! -f config.sh; then
2292 $cat <<EOM
2293
4e2a5f63
AD
2294First time through, eh? I have some defaults handy for some systems
2295that need some extra help getting the Configure answers right:
2304df62
AD
2296
2297EOM
dfe9444c 2298 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2299 dflt=''
2300 : Half the following guesses are probably wrong... If you have better
7f2de2d2 2301 : tests or hints, please send them to perlbug@perl.org
2304df62 2302 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2303 $test -f /irix && osname=irix
85e6fe83
LW
2304 $test -f /xenix && osname=sco_xenix
2305 $test -f /dynix && osname=dynix
2306 $test -f /dnix && osname=dnix
5f05dabc 2307 $test -f /lynx.os && osname=lynxos
2308 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2309 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2310 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2311 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2312 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2313 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2314 $test -d /usr/apollo/bin && osname=apollo
2315 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2316 $test -d /usr/include/minix && osname=minix
e060872b 2317 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2318 osname=machten
4633a7c4 2319 if $test -x /sbin/version; then
dfe9444c 2320 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2321 $sed -e 's/[A-Za-z]$//'`
2322 elif $test -x /usr/etc/version; then
dfe9444c 2323 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2324 $sed -e 's/[A-Za-z]$//'`
2325 else
2326 osvers="$2.$3"
2327 fi
2328 fi
aaacdc8b
GS
2329
2330 $test -f /sys/posix.dll &&
2331 $test -f /usr/bin/what &&
2332 set X `/usr/bin/what /sys/posix.dll` &&
2333 $test "$3" = UWIN &&
2334 osname=uwin &&
2335 osvers="$5"
2336
2304df62
AD
2337 if $test -f $uname; then
2338 set X $myuname
2339 shift
2340
2304df62 2341 case "$5" in
85e6fe83 2342 fps*) osname=fps ;;
2304df62
AD
2343 mips*)
2344 case "$4" in
85e6fe83
LW
2345 umips) osname=umips ;;
2346 *) osname=mips ;;
2304df62 2347 esac;;
85e6fe83
LW
2348 [23]100) osname=mips ;;
2349 next*) osname=next ;;
ecfc5424 2350 i386*)
c6912327
JH
2351 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2352 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2353 osname='sco'
2354 osvers=$tmp
2355 elif $test -f /etc/kconfig; then
ecfc5424 2356 osname=isc
bd628c73 2357 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2358 osvers=4
2359 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2360 osvers=3
2304df62 2361 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2362 osvers=2
ecfc5424
AD
2363 fi
2364 fi
2000072c 2365 tmp=''
ecfc5424 2366 ;;
c4f23d77
AD
2367 pc*)
2368 if test -n "$DJGPP"; then
2369 osname=dos
2370 osvers=djgpp
2371 fi
2372 ;;
2304df62
AD
2373 esac
2374
2375 case "$1" in
a0d0e21e
LW
2376 aix) osname=aix
2377 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2378 case "$tmp" in
1aef975c 2379 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2380 '<3240'|'<>3240') osvers=3.2.0 ;;
2381 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2382 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2383 *) osvers=$tmp;;
a0d0e21e
LW
2384 esac
2385 ;;
aaacdc8b
GS
2386 bsd386) osname=bsd386
2387 osvers=`$uname -r`
2388 ;;
2389 cygwin*) osname=cygwin
2390 osvers="$3"
2391 ;;
23f87696
SZ
2392 *dc.osx) osname=dcosx
2393 osvers="$3"
2394 ;;
a0d0e21e
LW
2395 dnix) osname=dnix
2396 osvers="$3"
2397 ;;
2398 domainos) osname=apollo
2399 osvers="$3"
2400 ;;
2401 dgux) osname=dgux
2402 osvers="$3"
2403 ;;
760ac839 2404 dynixptx*) osname=dynixptx
e58e581d 2405 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2406 ;;
a0d0e21e
LW
2407 freebsd) osname=freebsd
2408 osvers="$3" ;;
2409 genix) osname=genix ;;
2410 hp*) osname=hpux
bfb7748a 2411 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2412 ;;
a78b0d02 2413 irix*) osname=irix
a0d0e21e
LW
2414 case "$3" in
2415 4*) osvers=4 ;;
2416 5*) osvers=5 ;;
ecfc5424 2417 *) osvers="$3" ;;
a0d0e21e
LW
2418 esac
2419 ;;
2420 linux) osname=linux
2421 case "$3" in
a0d0e21e
LW
2422 *) osvers="$3" ;;
2423 esac
2424 ;;
28e8609d
JH
2425 MiNT) osname=mint
2426 ;;
2427 netbsd*) osname=netbsd
ecfc5424
AD
2428 osvers="$3"
2429 ;;
4e81affe
MM
2430 news-os) osvers="$3"
2431 case "$3" in
2432 4*) osname=newsos4 ;;
2433 *) osname=newsos ;;
2434 esac
2435 ;;
aaacdc8b 2436 next*) osname=next ;;
28bb1e2c 2437 nonstop-ux) osname=nonstopux ;;
aaacdc8b
GS
2438 POSIX-BC | posix-bc ) osname=posix-bc
2439 osvers="$3"
a0d0e21e 2440 ;;
ae3afa4e
TH
2441 powerux | power_ux | powermax_os | powermaxos | \
2442 powerunix | power_unix) osname=powerux
2443 osvers="$3"
2444 ;;
aaacdc8b
GS
2445 qnx) osname=qnx
2446 osvers="$4"
2447 ;;
a0d0e21e
LW
2448 solaris) osname=solaris
2449 case "$3" in
2450 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2451 *) osvers="$3" ;;
a0d0e21e
LW
2452 esac
2453 ;;
85e6fe83
LW
2454 sunos) osname=sunos
2455 case "$3" in
85e6fe83
LW
2456 5*) osname=solaris
2457 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2458 *) osvers="$3" ;;
2304df62
AD
2459 esac
2460 ;;
a0d0e21e 2461 titanos) osname=titanos
85e6fe83 2462 case "$3" in
a0d0e21e
LW
2463 1*) osvers=1 ;;
2464 2*) osvers=2 ;;
2465 3*) osvers=3 ;;
2466 4*) osvers=4 ;;
ecfc5424 2467 *) osvers="$3" ;;
2304df62
AD
2468 esac
2469 ;;
85e6fe83 2470 ultrix) osname=ultrix
ecfc5424 2471 osvers="$3"
2304df62 2472 ;;
28757baa 2473 osf1|mls+) case "$5" in
fed7345c
AD
2474 alpha)
2475 osname=dec_osf
2aa76180
JH
2476 osvers=`sizer -v | awk '{print $3}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2477 case "$osvers" in
2478 [1-9].[0-9]*) ;;
2479 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2480 esac
ecfc5424
AD
2481 ;;
2482 hp*) osname=hp_osf1 ;;
2483 mips) osname=mips_osf1 ;;
85e6fe83
LW
2484 esac
2485 ;;
0337d152
BG
2486 unixware) osname=svr5
2487 osvers="$4"
2488 ;;
2489 uts) osname=uts
a0d0e21e
LW
2490 osvers="$3"
2491 ;;
85e6fe83 2492 $2) case "$osname" in
2304df62 2493 *isc*) ;;
a0d0e21e 2494 *freebsd*) ;;
5f05dabc 2495 svr*)
a0d0e21e
LW
2496 : svr4.x or possibly later
2497 case "svr$3" in
2498 ${osname}*)
2499 osname=svr$3
2500 osvers=$4
2501 ;;
2502 esac
2503 case "$osname" in
2504 svr4.0)
2505 : Check for ESIX
2506 if test -f /stand/boot ; then
2507 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2508 if test -n "$INITPROG" -a -f "$INITPROG"; then
2509 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2510 if test -n "$isesix"; then
a0d0e21e
LW
2511 osname=esix4
2512 fi
2513 fi
2514 fi
2515 ;;
2516 esac
2517 ;;
2304df62 2518 *) if test -f /etc/systemid; then
a0d0e21e
LW
2519 osname=sco
2520 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2521 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2522 osvers=$1.$2.$3
c4f23d77 2523 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2524 osvers=$1.$2
c4f23d77 2525 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2526 osvers=$1
2304df62 2527 fi
a0d0e21e
LW
2528 else
2529 case "$osname" in
2530 '') : Still unknown. Probably a generic Sys V.
2531 osname="sysv"
2532 osvers="$3"
2533 ;;
2534 esac
2304df62
AD
2535 fi
2536 ;;
2537 esac
2538 ;;
a0d0e21e
LW
2539 *) case "$osname" in
2540 '') : Still unknown. Probably a generic BSD.
2541 osname="$1"
2542 osvers="$3"
2543 ;;
2544 esac
2545 ;;
2304df62
AD
2546 esac
2547 else
dfe9444c
AD
2548 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2549 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2550 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2551 osname=news_os
2304df62 2552 fi
dfe9444c 2553 $rm -f UU/kernel.what
8e07c86e
AD
2554 elif test -d c:/.; then
2555 set X $myuname
2556 osname=os2
2557 osvers="$5"
2304df62
AD
2558 fi
2559 fi
85e6fe83 2560
a0d0e21e
LW
2561 : Now look for a hint file osname_osvers, unless one has been
2562 : specified already.
2563 case "$hintfile" in
2564 ''|' ')
1e127011 2565 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 2566 : Also try without trailing minor version numbers.
1e127011
DD
2567 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2568 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2569 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2570 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
2571 case "$file" in
2572 '') dflt=none ;;
2573 *) case "$osvers" in
2574 '') dflt=$file
2575 ;;
dfe9444c 2576 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 2577 dflt=$file
dfe9444c 2578 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 2579 dflt=$xfile
dfe9444c 2580 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 2581 dflt=$xxfile
dfe9444c 2582 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 2583 dflt=$xxxfile
dfe9444c 2584 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 2585 dflt=$xxxxfile
dfe9444c 2586 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
2587 dflt="${osname}"
2588 else
2589 dflt=none
2590 fi
2591 ;;
2592 esac
85e6fe83
LW
2593 ;;
2594 esac
4e2a5f63
AD
2595 if $test -f Policy.sh ; then
2596 case "$dflt" in
2597 *Policy*) ;;
2598 none) dflt="Policy" ;;
2599 *) dflt="Policy $dflt" ;;
2600 esac
2601 fi
85e6fe83 2602 ;;
a0d0e21e 2603 *)
ecfc5424 2604 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 2605 ;;
2304df62 2606 esac
1aef975c 2607
4e2a5f63
AD
2608 if $test -f Policy.sh ; then
2609 $cat <<EOM
2610
2611There's also a Policy hint file available, which should make the
2612site-specific (policy) questions easier to answer.
2613EOM
2614
2615 fi
2616
2304df62
AD
2617 $cat <<EOM
2618
2619You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 2620A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 2621is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
2622
2623EOM
4e2a5f63 2624
2304df62 2625 rp="Which of these apply, if any?"
dfe9444c 2626 . UU/myread
85e6fe83
LW
2627 tans=$ans
2628 for file in $tans; do
4e2a5f63
AD
2629 if $test X$file = XPolicy -a -f Policy.sh; then
2630 . Policy.sh
2631 $cat Policy.sh >> UU/config.sh
2632 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
2633 . $src/hints/$file.sh
2634 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83 2635 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
2636 : nothing
2637 else
85e6fe83
LW
2638 : Give one chance to correct a possible typo.
2639 echo "$file.sh does not exist"
2640 dflt=$file
2641 rp="hint to use instead?"
dfe9444c 2642 . UU/myread
85e6fe83 2643 for file in $ans; do
dfe9444c
AD
2644 if $test -f "$src/hints/$file.sh"; then
2645 . $src/hints/$file.sh
2646 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
2647 elif $test X$ans = X -o X$ans = Xnone ; then
2648 : nothing
2649 else
2650 echo "$file.sh does not exist -- ignored."
2651 fi
2652 done
2304df62
AD
2653 fi
2654 done
85e6fe83 2655
2304df62 2656 hint=recommended
85e6fe83 2657 : Remember our hint file for later.
dfe9444c 2658 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 2659 hintfile="$file"
85e6fe83 2660 else
a0d0e21e 2661 hintfile=''
85e6fe83 2662 fi
2304df62
AD
2663fi
2664cd UU
2665;;
2666*)
2667 echo " "
2668 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
2669 tmp_n="$n"
2670 tmp_c="$c"
2304df62
AD
2671 cd ..
2672 cp $config_sh config.sh 2>/dev/null
a78b0d02 2673 chmod +w config.sh
2304df62
AD
2674 . ./config.sh
2675 cd UU
2676 cp ../config.sh .
ecfc5424
AD
2677 n="$tmp_n"
2678 c="$tmp_c"
2304df62
AD
2679 hint=previous
2680 ;;
2681esac
1aef975c 2682test "$override" && . ./optdef.sh
2304df62
AD
2683
2684: Restore computed paths
2685for file in $loclist $trylist; do
2686 eval $file="\$_$file"
2687done
2688
85e6fe83 2689cat << EOM
a0d0e21e 2690
85e6fe83 2691Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
2692The default value is probably right if the name rings a bell. Otherwise,
2693since spelling matters for me, either accept the default or answer "none"
2694to leave it blank.
a0d0e21e 2695
85e6fe83 2696EOM
85e6fe83 2697case "$osname" in
a0d0e21e 2698 ''|' ')
85e6fe83 2699 case "$hintfile" in
a0d0e21e 2700 ''|' '|none) dflt=none ;;
ecfc5424 2701 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
2702 esac
2703 ;;
2704 *) dflt="$osname" ;;
2705esac
2706rp="Operating system name?"
2707. ./myread
2708case "$ans" in
ecfc5424
AD
2709none) osname='' ;;
2710*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 2711esac
8ff267be 2712echo " "
2713case "$osvers" in
2714 ''|' ')
2715 case "$hintfile" in
2716 ''|' '|none) dflt=none ;;
2717 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2718 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2719 case "$dflt" in
2720 ''|' ') dflt=none ;;
2721 esac
2722 ;;
2723 esac
2724 ;;
2725 *) dflt="$osvers" ;;
2726esac
2727rp="Operating system version?"
2728. ./myread
2729case "$ans" in
2730none) osvers='' ;;
2731*) osvers="$ans" ;;
2732esac
2733
02e93a22
JH
2734
2735. ./posthint.sh
2736
2304df62 2737: who configured the system
59b83a6f 2738cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 2739cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
2740case "$cf_by" in
2741"")
8ff267be 2742 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
2743 case "$cf_by" in
2744 "") cf_by=unknown ;;
8ff267be 2745 esac ;;
2746esac
2304df62 2747
b4eb6b3d
JH
2748: set up the script used to warn in case of inconsistency
2749cat <<EOS >whoa
2750$startsh
2751EOS
2752cat <<'EOSC' >>whoa
2753dflt=y
2754echo " "
2755echo "*** WHOA THERE!!! ***" >&4
2756echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2757rp=" Keep the $hint value?"
2758. ./myread
2759case "$ans" in
2760y) td=$was; tu=$was;;
2761esac
2762EOSC
2763
2764: function used to set $1 to $val
2765setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2766case "$val$was" in
2767$define$undef) . ./whoa; eval "$var=\$td";;
2768$undef$define) . ./whoa; eval "$var=\$tu";;
2769*) eval "$var=$val";;
2770esac'
2771
2772case "$usethreads" in
2773$define|true|[yY]*) dflt='y';;
2774*) dflt='n';;
2775esac
2776cat <<EOM
2777
2778Perl can be built to take advantage of threads on some systems.
2779To do so, Configure can be run with -Dusethreads.
2780
2781Note that threading is a highly experimental feature, and
2782some known race conditions still remain. If you choose to try
2783it, be very sure to not actually deploy it for production
2784purposes. README.threads has more details, and is required
2785reading if you enable threads.
2786
2787If this doesn't make any sense to you, just accept the default '$dflt'.
2788EOM
2789rp='Build a threading Perl?'
2790. ./myread
2791case "$ans" in
2792y|Y) val="$define" ;;
2793*) val="$undef" ;;
2794esac
2795set usethreads
2796eval $setvar
2797
2798case "$usethreads" in
2799$define)
2800 $cat <<EOM
2801
2802As of 5.5.640, Perl has two different internal threading implementations,
2803the 5.005 version (5005threads) and an interpreter-based version
2804(ithreads) that has one interpreter per thread. Both are very
2805experimental. This arrangement exists to help developers work out
2806which one is better.
2807
2808If you're a casual user, you probably don't want interpreter-threads
2809at this time. There doesn't yet exist a way to create threads from
2810within Perl in this model, i.e., "use Thread;" will NOT work.
2811EOM
2812 : Default to ithreads unless overridden on command line or with
2813 : old config.sh
2814 dflt='y'
2815 case "$use5005threads" in
2816 $define|true|[yY]*) dflt='n';;
2817 esac
2818 case "$useithreads" in
2819 $undef|false|[nN]*) dflt='n';;
2820 esac
2821 rp='Use interpreter-based ithreads?'
2822 . ./myread
2823 case "$ans" in
2824 y|Y) val="$define" ;;
2825 *) val="$undef" ;;
2826 esac
2827 set useithreads
2828 eval $setvar
2829 : Now set use5005threads to the opposite value.
2830 case "$useithreads" in
2831 $define) val="$undef" ;;
2832 *) val="$define" ;;
2833 esac
2834 set use5005threads
2835 eval $setvar
2836 ;;
2837*)
2838 useithreads="$undef"
2839 use5005threads="$undef"
2840 ;;
2841esac
2842
2843case "$d_oldpthreads" in
2844'') : Configure tests would be welcome here. For now, assume undef.
2845 val="$undef" ;;
2846*) val="$d_oldpthreads" ;;
2847esac
2848set d_oldpthreads
2849eval $setvar
2850
2851
2852case "$usethreads" in
2853"$define"|true|[yY]*)
2854: Look for a hint-file generated 'call-back-unit'. If the
2855: user has specified that a threading perl is to be built,
2856: we may need to set or change some other defaults.
2857 if $test -f usethreads.cbu; then
2858 echo "Your platform has some specific hints for threaded builds, using them..."
2859 . ./usethreads.cbu
2860 else
2861 $cat <<EOM
2862(Your platform doesn't have any specific hints for threaded builds.
2863 Assuming POSIX threads, then.)
2864EOM
2865 fi
2866 ;;
2867esac
2868
2869cat <<EOM
2870
2871Perl can be built so that multiple Perl interpreters can coexist
2872within the same Perl executable.
2873EOM
2874
2875case "$useithreads" in
2876$define)
2877 cat <<EOM
2878This multiple interpreter support is required for interpreter-based threads.
2879EOM
2880 val="$define"
2881 ;;
2882*) case "$usemultiplicity" in
2883 $define|true|[yY]*) dflt='y';;
2884 *) dflt='n';;
2885 esac
2886 echo " "
2887 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2888 rp='Build Perl for multiplicity?'
2889 . ./myread
2890 case "$ans" in
2891 y|Y) val="$define" ;;
2892 *) val="$undef" ;;
2893 esac
2894 ;;
2895esac
2896set usemultiplicity
2897eval $setvar
2898
e5e20432
JH
2899: make some quick guesses about what we are up against
2900echo " "
2901$echo $n "Hmm... $c"
2902echo exit 1 >bsd
2903echo exit 1 >usg
2904echo exit 1 >v7
2905echo exit 1 >osf1
2906echo exit 1 >eunice
2907echo exit 1 >xenix
2908echo exit 1 >venix
2909echo exit 1 >os2
2910d_bsd="$undef"
2911$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2912if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2913then
2914 echo "Looks kind of like an OSF/1 system, but we'll see..."
2915 echo exit 0 >osf1
381aa1ff 2916elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
2917 xxx=`./loc addbib blurfl $pth`
2918 if $test -f $xxx; then
2919 echo "Looks kind of like a USG system with BSD features, but we'll see..."
2920 echo exit 0 >bsd
2921 echo exit 0 >usg
2922 else
2923 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2924 echo "Looks kind of like an extended USG system, but we'll see..."
2925 else
2926 echo "Looks kind of like a USG system, but we'll see..."
2927 fi
2928 echo exit 0 >usg
2929 fi
2930elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2931 echo "Looks kind of like a BSD system, but we'll see..."
2932 d_bsd="$define"
2933 echo exit 0 >bsd
2934else
2935 echo "Looks kind of like a Version 7 system, but we'll see..."
2936 echo exit 0 >v7
2937fi
2938case "$eunicefix" in
2939*unixtovms*)
2940 $cat <<'EOI'
2941There is, however, a strange, musty smell in the air that reminds me of
2942something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2943EOI
2944 echo exit 0 >eunice
2945 d_eunice="$define"
2946: it so happens the Eunice I know will not run shell scripts in Unix format
2947 ;;
2948*)
2949 echo " "
2950 echo "Congratulations. You aren't running Eunice."
2951 d_eunice="$undef"
2952 ;;
2953esac
2954: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
2955: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
2956: semicolon as a patch separator
e5e20432
JH
2957case "$p_" in
2958:) ;;
2959*)
2960 $cat <<'EOI'
2961I have the feeling something is not exactly right, however...don't tell me...
2962lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 2963(Or you may be running DOS with DJGPP.)
e5e20432
JH
2964EOI
2965 echo exit 0 >os2
2966 ;;
2967esac
2968if test -f /xenix; then
2969 echo "Actually, this looks more like a XENIX system..."
2970 echo exit 0 >xenix
2971 d_xenix="$define"
2972else
2973 echo " "
2974 echo "It's not Xenix..."
2975 d_xenix="$undef"
2976fi
2977chmod +x xenix
2978$eunicefix xenix
2979if test -f /venix; then
2980 echo "Actually, this looks more like a VENIX system..."
2981 echo exit 0 >venix
2982else
2983 echo " "
2984 if ./xenix; then
2985 : null
2986 else
2987 echo "Nor is it Venix..."
2988 fi
2989fi
2990chmod +x bsd usg v7 osf1 eunice xenix venix os2
2991$eunicefix bsd usg v7 osf1 eunice xenix venix os2
2992$rm -f foo
2993
5869b1f1
JH
2994case "$cc" in
2995'') dflt=cc;;
2996*) dflt="$cc";;
2997esac
2998rp="Use which C compiler?"
2999. ./myread
3000cc="$ans"
e5e20432
JH
3001: Look for a hint-file generated 'call-back-unit'. Now that the
3002: user has specified the compiler, we may need to set or change some
3003: other defaults.
3004if $test -f cc.cbu; then
3005 . ./cc.cbu
3006fi
2573c5f9 3007. ./checkcc
8a27cf78 3008
e5e20432
JH
3009echo " "
3010echo "Checking for GNU cc in disguise and/or its version number..." >&4
3011$cat >gccvers.c <<EOM
3012#include <stdio.h>
3013int main() {
3014#ifdef __GNUC__
3015#ifdef __VERSION__
3016 printf("%s\n", __VERSION__);
3017#else
3018 printf("%s\n", "1");
3019#endif
3020#endif
3021 exit(0);
3022}
3023EOM
7a282f6d 3024if $cc -o gccvers $ldflags gccvers.c; then
e5e20432
JH
3025 gccversion=`./gccvers`
3026 case "$gccversion" in
3027 '') echo "You are not using GNU cc." ;;
fc68435e 3028 *) echo "You are using GNU cc $gccversion."
e723fc21 3029 ccname=gcc
fc68435e 3030 ;;
e5e20432
JH
3031 esac
3032else
3033 echo " "
3034 echo "*** WHOA THERE!!! ***" >&4
3035 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3036 case "$knowitall" in
3037 '')
3038 echo " You'd better start hunting for one and let me know about it." >&4
3039 exit 1
3040 ;;
3041 esac
3042fi
3043$rm -f gccvers*
3044case "$gccversion" in
30451*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3046esac
5b463ca7
KS
3047case "$gccversion" in
3048'') gccosandvers='' ;;
10b4ebb5
JH
3049*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3050 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3051 gccshortvers=''
5b463ca7 3052 case "$gccosandvers" in
02903077
JH
3053 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3054 $osname$osvers) ;; # looking good
5b463ca7
KS
3055 $osname*) cat <<EOM >&4
3056
3057*** WHOA THERE!!! ***
3058
3059 Your gcc has not been compiled for the exact release of
3060 your operating system ($gccosandvers versus $osname$osvers).
3061
3062 In general it is a good idea to keep gcc synchronized with
3063 the operating system because otherwise serious problems
3064 may ensue when trying to compile software, like Perl.
3065
3066 I'm trying to be optimistic here, though, and will continue.
3067 If later during the configuration and build icky compilation
02903077
JH
3068 problems appear (headerfile conflicts being the most common
3069 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3070 your operating system release.
3071
3072EOM
3073 ;;
81575342 3074 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3075 esac
3076 ;;
3077esac
e723fc21
JH
3078case "$ccname" in
3079'') ccname="$cc" ;;
3080esac
e5e20432 3081
8a27cf78
JH
3082: see how we invoke the C preprocessor
3083echo " "
3084echo "Now, how can we feed standard input to your C preprocessor..." >&4
3085cat <<'EOT' >testcpp.c
3086#define ABC abc
3087#define XYZ xyz
3088ABC.XYZ
3089EOT
3090cd ..
3091if test ! -f cppstdin; then
3092 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3093 # AIX cc -E doesn't show the absolute headerfile
3094 # locations but we'll cheat by using the -M flag.
3095 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
3096 else
3097 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3098 fi
3099else
3100 echo "Keeping your $hint cppstdin wrapper."
3101fi
3102chmod 755 cppstdin
3103wrapper=`pwd`/cppstdin
3104ok='false'
3105cd UU
3106
3107if $test "X$cppstdin" != "X" && \
3108 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3109 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3110then
3111 echo "You used to use $cppstdin $cppminus so we'll use that again."
3112 case "$cpprun" in
3113 '') echo "But let's see if we can live without a wrapper..." ;;
3114 *)
3115 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3116 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3117 then
3118 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3119 ok='true'
3120 else
3121 echo "(However, $cpprun $cpplast does not work, let's see...)"
3122 fi
3123 ;;
3124 esac
3125else
3126 case "$cppstdin" in
3127 '') ;;
3128 *)
3129 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3130 ;;
3131 esac
3132fi
3133
3134if $ok; then
3135 : nothing
3136elif echo 'Maybe "'"$cc"' -E" will work...'; \
3137 $cc -E <testcpp.c >testcpp.out 2>&1; \
3138 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3139 echo "Yup, it does."
3140 x_cpp="$cc -E"
3141 x_minus='';
3142elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3143 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3144 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3145 echo "Yup, it does."
3146 x_cpp="$cc -E"
3147 x_minus='-';
3148elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3149 $cc -P <testcpp.c >testcpp.out 2>&1; \
3150 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3151 echo "Yipee, that works!"
3152 x_cpp="$cc -P"
3153 x_minus='';
3154elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3155 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3156 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3157 echo "At long last!"
3158 x_cpp="$cc -P"
3159 x_minus='-';
3160elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3161 $cpp <testcpp.c >testcpp.out 2>&1; \
3162 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3163 echo "It works!"
3164 x_cpp="$cpp"
3165 x_minus='';
3166elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3167 $cpp - <testcpp.c >testcpp.out 2>&1; \
3168 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3169 echo "Hooray, it works! I was beginning to wonder."
3170 x_cpp="$cpp"
3171 x_minus='-';
3172elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3173 $wrapper <testcpp.c >testcpp.out 2>&1; \
3174 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3175 x_cpp="$wrapper"
3176 x_minus=''
3177 echo "Eureka!"
3178else
3179 dflt=''
3180 rp="No dice. I can't find a C preprocessor. Name one:"
3181 . ./myread
3182 x_cpp="$ans"
3183 x_minus=''
3184 $x_cpp <testcpp.c >testcpp.out 2>&1
3185 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3186 echo "OK, that will do." >&4
3187 else
3188echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3189 exit 1
3190 fi
3191fi
3192
3193case "$ok" in
3194false)
3195 cppstdin="$x_cpp"
3196 cppminus="$x_minus"
3197 cpprun="$x_cpp"
3198 cpplast="$x_minus"
3199 set X $x_cpp
3200 shift
3201 case "$1" in
3202 "$cpp")
3203 echo "Perhaps can we force $cc -E using a wrapper..."
3204 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3205 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3206 then
3207 echo "Yup, we can."
3208 cppstdin="$wrapper"
3209 cppminus='';
3210 else
3211 echo "Nope, we'll have to live without it..."
3212 fi
3213 ;;
3214 esac
3215 case "$cpprun" in
3216 "$wrapper")
3217 cpprun=''
3218 cpplast=''
3219 ;;
3220 esac
3221 ;;
3222esac
3223
3224case "$cppstdin" in
3225"$wrapper"|'cppstdin') ;;
3226*) $rm -f $wrapper;;
3227esac
3228$rm -f testcpp.c testcpp.out
3229
bd9b35c9
JH
3230: decide how portable to be. Allow command line overrides.
3231case "$d_portable" in
3232"$undef") ;;
3233*) d_portable="$define" ;;
104d25b7 3234esac
85ab1d1d 3235
bd9b35c9
JH
3236: set up shell script to do ~ expansion
3237cat >filexp <<EOSS
3238$startsh
3239: expand filename
3240case "\$1" in
3241 ~/*|~)
3242 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3243 ;;
3244 ~*)
3245 if $test -f /bin/csh; then
3246 /bin/csh -f -c "glob \$1"
3247 failed=\$?
3248 echo ""
3249 exit \$failed
e5e20432 3250 else
bd9b35c9
JH
3251 name=\`$expr x\$1 : '..\([^/]*\)'\`
3252 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3253 if $test ! -d "\$dir"; then
3254 me=\`basename \$0\`
3255 echo "\$me: can't locate home directory for: \$name" >&2
3256 exit 1
3257 fi
3258 case "\$1" in
3259 */*)
3260 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3261 ;;
3262 *)
3263 echo \$dir
e5e20432
JH
3264 ;;
3265 esac
3266 fi
b691c02f 3267 ;;
4633a7c4 3268*)
bd9b35c9 3269 echo \$1
2304df62
AD
3270 ;;
3271esac
4633a7c4
LW
3272EOSS
3273chmod +x filexp
3274$eunicefix filexp
2304df62
AD
3275
3276: now set up to get a file name
28757baa 3277cat <<EOS >getfile
3278$startsh
3279EOS
3280cat <<'EOSC' >>getfile
2304df62
AD
3281tilde=''
3282fullpath=''
3283already=''
3284skip=''
3285none_ok=''
3286exp_file=''
a0d0e21e 3287nopath_ok=''
2304df62
AD
3288orig_rp="$rp"
3289orig_dflt="$dflt"
b233458b
JH
3290case "$gfpth" in
3291'') gfpth='.' ;;
3292esac
2304df62
AD
3293
3294case "$fn" in
ecfc5424 3295*\(*)
381aa1ff 3296 expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
3297 fn=`echo $fn | sed 's/(.*)//'`
3298 ;;
3299esac
3300
3301case "$fn" in
a0d0e21e
LW
3302*:*)
3303 loc_file=`expr $fn : '.*:\(.*\)'`
3304 fn=`expr $fn : '\(.*\):.*'`
3305 ;;
3306esac
3307
3308case "$fn" in
2304df62
AD
3309*~*) tilde=true;;
3310esac
3311case "$fn" in
3312*/*) fullpath=true;;
3313esac
3314case "$fn" in
3315*+*) skip=true;;
3316esac
3317case "$fn" in
3318*n*) none_ok=true;;
3319esac
3320case "$fn" in
3321*e*) exp_file=true;;
3322esac
a0d0e21e
LW
3323case "$fn" in
3324*p*) nopath_ok=true;;
3325esac
2304df62
AD
3326
3327case "$fn" in
3328*f*) type='File';;
3329*d*) type='Directory';;
a0d0e21e 3330*l*) type='Locate';;
2304df62
AD
3331esac
3332
3333what="$type"
3334case "$what" in
3335Locate) what='File';;
3336esac
3337
3338case "$exp_file" in
3339'')
3340 case "$d_portable" in
3341 "$define") ;;
3342 *) exp_file=true;;
3343 esac
3344 ;;
3345esac
3346
3347cd ..
3348while test "$type"; do
3349 redo=''
3350 rp="$orig_rp"
3351 dflt="$orig_dflt"
3352 case "$tilde" in
3353 true) rp="$rp (~name ok)";;
3354 esac
3355 . UU/myread
ecfc5424
AD
3356 if test -f UU/getfile.ok && \
3357 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3358 then
3359 value="$ans"
3360 ansexp="$ans"
3361 break
3362 fi
2304df62
AD
3363 case "$ans" in
3364 none)
3365 value=''
3366 ansexp=''
3367 case "$none_ok" in
3368 true) type='';;
3369 esac
3370 ;;
3371 *)
3372 case "$tilde" in
3373 '') value="$ans"
3374 ansexp="$ans";;
3375 *)
3376 value=`UU/filexp $ans`
3377 case $? in
3378 0)
3379 if test "$ans" != "$value"; then
ecfc5424 3380 echo "(That expands to $value on this system.)"
2304df62
AD
3381 fi
3382 ;;
3383 *) value="$ans";;
3384 esac
3385 ansexp="$value"
3386 case "$exp_file" in
3387 '') value="$ans";;
3388 esac
3389 ;;
3390 esac
3391 case "$fullpath" in
3392 true)
3393 case "$ansexp" in
3394 /*) value="$ansexp" ;;
23da6c43 3395 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
3396 *)
3397 redo=true
3398 case "$already" in
3399 true)
3400 echo "I shall only accept a full path name, as in /bin/ls." >&4
3401 echo "Use a ! shell escape if you wish to check pathnames." >&4
3402 ;;
3403 *)
3404 echo "Please give a full path name, starting with slash." >&4
3405 case "$tilde" in
3406 true)
3407 echo "Note that using ~name is ok provided it expands well." >&4
3408 already=true
3409 ;;
3410 esac
3411 esac
3412 ;;
3413 esac
3414 ;;
3415 esac
3416 case "$redo" in
3417 '')
3418 case "$type" in
3419 File)
b233458b
JH
3420 for fp in $gfpth; do
3421 if test "X$fp" = X.; then
3422 pf="$ansexp"
3423 else
3424 pf="$fp/$ansexp"
3425 fi
3426 if test -f "$pf"; then
3427 type=''
3428 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3429 then
3430 echo "($value is not a plain file, but that's ok.)"
3431 type=''
3432 fi
3433 if test X"$type" = X; then
3434 value="$pf"
3435 break
3436 fi
3437 done
2304df62
AD
3438 ;;
3439 Directory)
b233458b
JH
3440 for fp in $gfpth; do
3441 if test "X$fp" = X.; then
f78bfc9c
JH
3442 dir="$ans"
3443 direxp="$ansexp"
b233458b 3444 else
dd858076 3445 dir="$fp/$ansexp"
f78bfc9c 3446 direxp="$fp/$ansexp"
b233458b 3447 fi
f78bfc9c 3448 if test -d "$direxp"; then
b233458b 3449 type=''
f78bfc9c 3450 value="$dir"
b233458b
JH
3451 break
3452 fi
3453 done
2304df62
AD
3454 ;;
3455 Locate)
40000a8c 3456 if test -d "$ansexp"; then
a0d0e21e
LW
3457 echo "(Looking for $loc_file in directory $value.)"
3458 value="$value/$loc_file"
40000a8c 3459 ansexp="$ansexp/$loc_file"
2304df62 3460 fi
40000a8c 3461 if test -f "$ansexp"; then
2304df62
AD
3462 type=''
3463 fi
a0d0e21e
LW
3464 case "$nopath_ok" in
3465 true) case "$value" in
3466 */*) ;;
3467 *) echo "Assuming $value will be in people's path."
3468 type=''
3469 ;;
3470 esac
3471 ;;
3472 esac
2304df62
AD
3473 ;;
3474 esac
3475
3476 case "$skip" in
3477 true) type='';
3478 esac
3479
3480 case "$type" in
3481 '') ;;
3482 *)
3483 if test "$fastread" = yes; then
3484 dflt=y
3485 else
3486 dflt=n
3487 fi
3488 rp="$what $value doesn't exist. Use that name anyway?"
3489 . UU/myread
3490 dflt=''
3491 case "$ans" in
3492 y*) type='';;
3493 *) echo " ";;
3494 esac
3495 ;;
3496 esac
3497 ;;
3498 esac
3499 ;;
3500 esac
3501done
3502cd UU
3503ans="$value"
3504rp="$orig_rp"
3505dflt="$orig_dflt"
ecfc5424 3506rm -f getfile.ok
b233458b 3507test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3508EOSC
3509
bd9b35c9
JH
3510: What should the include directory be ?
3511echo " "
3512$echo $n "Hmm... $c"
3513dflt='/usr/include'
3514incpath=''
3515mips_type=''
3516if $test -f /bin/mips && /bin/mips; then
3517 echo "Looks like a MIPS system..."
3518 $cat >usr.c <<'EOCP'
3519#ifdef SYSTYPE_BSD43
3520/bsd43
3521#endif
3522EOCP
8a27cf78 3523 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
3524 dflt='/bsd43/usr/include'
3525 incpath='/bsd43'
3526 mips_type='BSD 4.3'
3527 else
3528 mips_type='System V'
3529 fi
3530 $rm -f usr.c usr.out
3531 echo "and you're compiling with the $mips_type compiler and libraries."
3532 xxx_prompt=y
3533 echo "exit 0" >mips
3534else
3535 echo "Doesn't look like a MIPS system."
3536 xxx_prompt=n
3537 echo "exit 1" >mips
3538fi
3539chmod +x mips
3540$eunicefix mips
3541case "$usrinc" in
3542'') ;;
3543*) dflt="$usrinc";;
3544esac
3545case "$xxx_prompt" in
3546y) fn=d/
3547 echo " "
3548 rp='Where are the include files you want to use?'
3549 . ./getfile
3550 usrinc="$ans"
8e07c86e 3551 ;;
bd9b35c9 3552*) usrinc="$dflt"
8e07c86e
AD
3553 ;;
3554esac
2304df62 3555
bd9b35c9
JH
3556: Set private lib path
3557case "$plibpth" in
3558'') if ./mips; then
3559 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3560 fi;;
3561esac
3562case "$libpth" in
3563' ') dlist='';;
3564'') dlist="$loclibpth $plibpth $glibpth";;
3565*) dlist="$libpth";;
3566esac
3567
3568: Now check and see which directories actually exist, avoiding duplicates
3569libpth=''
3570for xxx in $dlist
3571do
3572 if $test -d $xxx; then
3573 case " $libpth " in
3574 *" $xxx "*) ;;
3575 *) libpth="$libpth $xxx";;
3576 esac
3577 fi
3578done
3579$cat <<'EOM'
3580
3581Some systems have incompatible or broken versions of libraries. Among
3582the directories listed in the question below, please remove any you
3583know not to be holding relevant libraries, and add any that are needed.
3584Say "none" for none.
8e07c86e
AD
3585
3586EOM
bd9b35c9
JH
3587case "$libpth" in
3588'') dflt='none';;
8e07c86e 3589*)
bd9b35c9
JH
3590 set X $libpth
3591 shift
3592 dflt=${1+"$@"}
8e07c86e 3593 ;;
a0d0e21e 3594esac
bd9b35c9
JH
3595rp="Directories to use for library searches?"
3596. ./myread
3597case "$ans" in
3598none) libpth=' ';;
3599*) libpth="$ans";;
3600esac
a0d0e21e 3601
bd9b35c9
JH
3602: compute shared library extension
3603case "$so" in
3604'')
3605 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3606 dflt='sl'
dd4e71fd 3607 else
bd9b35c9 3608 dflt='so'
dd4e71fd
JH
3609 fi
3610 ;;
bd9b35c9 3611*) dflt="$so";;
dd4e71fd 3612esac
dd4e71fd
JH
3613$cat <<EOM
3614
bd9b35c9 3615On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 3616you want to suppress searching of shared libraries for the remainder
bd9b35c9 3617of this configuration.
dd4e71fd
JH
3618
3619EOM
bd9b35c9
JH
3620rp='What is the file extension used for shared libraries?'
3621. ./myread
3622so="$ans"
dd4e71fd 3623
bd9b35c9
JH
3624: Define several unixisms.
3625: Hints files or command line option can be used to override them.
3626: The convoluted testing is in case hints files set either the old
3627: or the new name.
3628case "$_exe" in
3629'') case "$exe_ext" in
3630 '') ;;
3631 *) _exe="$exe_ext" ;;
dd4e71fd 3632 esac
bd9b35c9 3633 ;;
bfb7748a 3634esac
bd9b35c9
JH
3635case "$_a" in
3636'') case "$lib_ext" in
3637 '') _a='.a';;
3638 *) _a="$lib_ext" ;;
dd4e71fd
JH
3639 esac
3640 ;;
dd4e71fd 3641esac
bd9b35c9
JH
3642case "$_o" in
3643'') case "$obj_ext" in
3644 '') _o='.o';;
3645 *) _o="$obj_ext";;
3646 esac
3647 ;;
3648esac
3649case "$p_" in
3650'') case "$path_sep" in
3651 '') p_=':';;
3652 *) p_="$path_sep";;
3653 esac
3654 ;;
3655esac
3656exe_ext=$_exe
3657lib_ext=$_a
3658obj_ext=$_o
3659path_sep=$p_
dd4e71fd 3660
b4eb6b3d
JH
3661: Which makefile gets called first. This is used by make depend.
3662case "$firstmakefile" in
3663'') firstmakefile='makefile';;
4633a7c4 3664esac
4633a7c4 3665
0f0995ae
JH
3666case "$usesocks" in
3667$define|true|[yY]*) dflt='y';;
3668*) dflt='n';;
3669esac
bd9b35c9 3670cat <<EOM
4633a7c4 3671
bd9b35c9
JH
3672Perl can be built to use the SOCKS proxy protocol library. To do so,
3673Configure must be run with -Dusesocks.
4633a7c4 3674
0f0995ae 3675If this doesn't make any sense to you, just accept the default '$dflt'.
bd9b35c9 3676EOM
bd9b35c9
JH
3677rp='Build Perl for SOCKS?'
3678. ./myread
3679case "$ans" in
3680y|Y) val="$define" ;;
3681*) val="$undef" ;;
3682esac
3683set usesocks
3684eval $setvar
3685
3686: Looking for optional libraries
3687echo " "
3688echo "Checking for optional libraries..." >&4
3689case "$libs" in
3690' '|'') dflt='';;
3691*) dflt="$libs";;
3692esac
3693case "$libswanted" in
3694'') libswanted='c_s';;
3695esac
3696case "$usesocks" in
923fc586 3697"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 3698esac
68435ea7
JH
3699libsfound=''
3700libsfiles=''
3701libsdirs=''
13b3f787
JH
3702libspath=''
3703for thisdir in $libpth $xlibpth; do
3704 test -d $thisdir && libspath="$libspath $thisdir"
3705done
bd9b35c9 3706for thislib in $libswanted; do
13b3f787 3707 for thisdir in $libspath; do
f7dd4e7f
JH
3708 xxx=''
3709 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3710 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3711 $test -f "$xxx" && eval $libscheck
3712 $test -f "$xxx" && libstyle=shared
3713 fi
3714 if test ! -f "$xxx"; then
3715 xxx=$thisdir/lib$thislib.$so
3716 $test -f "$xxx" && eval $libscheck
3717 $test -f "$xxx" && libstyle=shared
3718 fi
3719 if test ! -f "$xxx"; then
3720 xxx=$thisdir/lib$thislib$_a
3721 $test -f "$xxx" && eval $libscheck
3722 $test -f "$xxx" && libstyle=static
3723 fi
3724 if test ! -f "$xxx"; then
3725 xxx=$thisdir/$thislib$_a
3726 $test -f "$xxx" && eval $libscheck
3727 $test -f "$xxx" && libstyle=static
3728 fi
3729 if test ! -f "$xxx"; then
3730 xxx=$thisdir/lib${thislib}_s$_a
3731 $test -f "$xxx" && eval $libscheck
3732 $test -f "$xxx" && libstyle=static
09ea5ba9 3733 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
3734 fi
3735 if test ! -f "$xxx"; then
3736 xxx=$thisdir/Slib$thislib$_a
3737 $test -f "$xxx" && eval $libscheck
3738 $test -f "$xxx" && libstyle=static
3739 fi
3740 if $test -f "$xxx"; then
43999f95 3741 case "$libstyle" in
f7dd4e7f
JH
3742 shared) echo "Found -l$thislib (shared)." ;;
3743 static) echo "Found -l$thislib." ;;
3744 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 3745 esac
bd9b35c9
JH
3746 case " $dflt " in
3747 *"-l$thislib "*);;
f7dd4e7f 3748 *) dflt="$dflt -l$thislib"
43999f95
JH
3749 libsfound="$libsfound $xxx"
3750 yyy=`basename $xxx`
3751 libsfiles="$libsfiles $yyy"
1e127011 3752 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
3753 case " $libsdirs " in
3754 *" $yyy "*) ;;
3755 *) libsdirs="$libsdirs $yyy" ;;
3756 esac
3757 ;;
bd9b35c9 3758 esac
f7dd4e7f
JH
3759 break
3760 fi
3761 done
3762 if $test ! -f "$xxx"; then
3763 echo "No -l$thislib."
bd9b35c9
JH
3764 fi
3765done
3766set X $dflt
3767shift
3768dflt="$*"
3769case "$libs" in
3770'') dflt="$dflt";;
3771*) dflt="$libs";;
3772esac
3773case "$dflt" in
3774' '|'') dflt='none';;
3775esac
4633a7c4 3776
bd9b35c9 3777$cat <<EOM
4633a7c4 3778
bd9b35c9
JH
3779In order to compile $package on your machine, a number of libraries
3780are usually needed. Include any other special libraries here as well.
3781Say "none" for none. The default list is almost always right.
8e07c86e 3782EOM
8e07c86e 3783
bd9b35c9
JH
3784echo " "
3785rp="What libraries to use?"
3786. ./myread
3787case "$ans" in
3788none) libs=' ';;
3789*) libs="$ans";;
3790esac
d71b2b6b 3791
bd9b35c9
JH
3792: determine optimization, if desired, or use for debug flag also
3793case "$optimize" in
3794' '|$undef) dflt='none';;
3795'') dflt='-O';;
3796*) dflt="$optimize";;
3797esac
3798$cat <<EOH
d71b2b6b 3799
bd9b35c9
JH
3800By default, $package compiles with the -O flag to use the optimizer.
3801Alternately, you might want to use the symbolic debugger, which uses
3802the -g flag (on traditional Unix systems). Either flag can be
3803specified here. To use neither flag, specify the word "none".
d71b2b6b 3804
bd9b35c9
JH
3805EOH
3806rp="What optimizer/debugger flag should be used?"
3807. ./myread
3808optimize="$ans"
3809case "$optimize" in
3810'none') optimize=" ";;
3811esac
3812
3813dflt=''
3814: We will not override a previous value, but we might want to
3815: augment a hint file
3816case "$hint" in
3817default|recommended)
3818 case "$gccversion" in
3819 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 3820 esac
bd9b35c9
JH
3821 case "$optimize" in
3822 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 3823 esac
bd9b35c9
JH
3824 case "$gccversion" in
3825 2*) if test -d /etc/conf/kconfig.d &&
3826 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3827 then
3828 dflt="$dflt -posix"
3829 fi
f0d04425 3830 ;;
bd9b35c9
JH
3831 esac
3832 case "$gccversion" in
3833 1*) ;;
3834 2.[0-8]*) ;;
3835 ?*) echo " "
3836 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3837 echo 'int main(void) { return 0; }' > gcctest.c
3838 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3839 echo "Yes, it does." 2>&1
3840 case "$ccflags" in
3841 *strict-aliasing*)
3842 echo "Leaving current flags $ccflags alone." 2>&1
3843 ;;
3844 *) dflt="$dflt -fno-strict-aliasing" ;;
3845 esac
3846 else
3847 echo "Nope, it doesn't, but that's ok." 2>&1
3848 fi
f0d04425 3849 ;;
e5e20432
JH
3850 esac
3851 ;;
3852esac
3853
bd9b35c9
JH
3854case "$mips_type" in
3855*BSD*|'') inclwanted="$locincpth $usrinc";;
3856*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3857esac
3858for thisincl in $inclwanted; do
3859 if $test -d $thisincl; then
3860 if $test x$thisincl != x$usrinc; then
3861 case "$dflt" in
422af00a
LC
3862 *" -I$thisincl "*);;
3863 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
3864 esac
3865 fi
3866 fi
3867done
40a7a20a 3868
bd9b35c9
JH
3869inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3870 xxx=true;
3871elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3872 xxx=true;
3873else
3874 xxx=false;
3875fi;
3876if $xxx; then
3877 case "$dflt" in
3878 *$2*);;
3879 *) dflt="$dflt -D$2";;
3880 esac;
3881fi'
40a7a20a 3882
bd9b35c9 3883set signal.h LANGUAGE_C; eval $inctest
40a7a20a 3884
bd9b35c9
JH
3885case "$usesocks" in
3886$define)
3887 ccflags="$ccflags -DSOCKS"
3888 ;;
3889esac
40a7a20a 3890
bd9b35c9
JH
3891case "$hint" in
3892default|recommended) dflt="$ccflags $dflt" ;;
3893*) dflt="$ccflags";;
3894esac
40a7a20a 3895
bd9b35c9
JH
3896case "$dflt" in
3897''|' ') dflt=none;;
3898esac
422af00a 3899
bd9b35c9 3900$cat <<EOH
40a7a20a 3901
bd9b35c9
JH
3902Your C compiler may want other flags. For this question you should include
3903-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3904but you should NOT include libraries or ld flags like -lwhatever. If you
3905want $package to honor its debug switch, you should include -DDEBUGGING here.
3906Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 3907
bd9b35c9 3908To use no flags, specify the word "none".
40a7a20a 3909
bd9b35c9
JH
3910EOH
3911set X $dflt
3912shift
3913dflt=${1+"$@"}
3914rp="Any additional cc flags?"
3915. ./myread
3916case "$ans" in
3917none) ccflags='';;
3918*) ccflags="$ans";;
3919esac
8e07c86e 3920
bd9b35c9
JH
3921: the following weeds options from ccflags that are of no interest to cpp
3922cppflags="$ccflags"
3923case "$gccversion" in
39241*) cppflags="$cppflags -D__GNUC__"
4633a7c4 3925esac
bd9b35c9
JH
3926case "$mips_type" in
3927'');;
3928*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3929esac
3930case "$cppflags" in
3931'');;
3932*)
3933 echo " "
3934 echo "Let me guess what the preprocessor flags are..." >&4
3935 set X $cppflags
3936 shift
3937 cppflags=''
3938 $cat >cpp.c <<'EOM'
3939#define BLURFL foo
8e07c86e 3940
bd9b35c9
JH
3941BLURFL xx LFRULB
3942EOM
3943 previous=''
3944 for flag in $*
3945 do
3946 case "$flag" in
3947 -*) ftry="$flag";;
3948 *) ftry="$previous $flag";;
3949 esac
3950 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3951 >cpp1.out 2>/dev/null && \
3952 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3953 >cpp2.out 2>/dev/null && \
3954 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3955 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3956 then
3957 cppflags="$cppflags $ftry"
3958 previous=''
3959 else
3960 previous="$flag"
3961 fi
3962 done
3963 set X $cppflags
3964 shift
3965 cppflags=${1+"$@"}
3966 case "$cppflags" in
3967 *-*) echo "They appear to be: $cppflags";;
3968 esac
3969 $rm -f cpp.c cpp?.out
2afac517 3970 ;;
3971esac
8e07c86e 3972
bd9b35c9
JH
3973: flags used in final linking phase
3974case "$ldflags" in
3975'') if ./venix; then
3976 dflt='-i -z'
10a23457 3977 else
bd9b35c9 3978 dflt=''
10a23457 3979 fi
bd9b35c9
JH
3980 case "$ccflags" in
3981 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 3982 esac
bd9b35c9
JH
3983 ;;
3984*) dflt="$ldflags";;
3985esac
3986
3987: Try to guess additional flags to pick up local libraries.
3988for thislibdir in $libpth; do
3989 case " $loclibpth " in
3990 *" $thislibdir "*)
3991 case "$dflt " in
3992 *"-L$thislibdir "*) ;;
3993 *) dflt="$dflt -L$thislibdir" ;;
3994 esac
c4f23d77
AD
3995 ;;
3996 esac
bd9b35c9 3997done
c4f23d77 3998
bd9b35c9
JH
3999case "$dflt" in
4000'') dflt='none' ;;
4001esac
c4f23d77 4002
bd9b35c9
JH
4003$cat <<EOH
4004
4005Your C linker may need flags. For this question you should
4006include -L/whatever and any other flags used by the C linker, but you
4007should NOT include libraries like -lwhatever.
4008
4009Make sure you include the appropriate -L/path flags if your C linker
4010does not normally search all of the directories you specified above,
4011namely
4012 $libpth
4013To use no flags, specify the word "none".
4014
4015EOH
4016
4017rp="Any additional ld flags (NOT including libraries)?"
4018. ./myread
4019case "$ans" in
4020none) ldflags='';;
4021*) ldflags="$ans";;
4022esac
4023rmlist="$rmlist pdp11"
4024
4025: coherency check
4026echo " "
4027echo "Checking your choice of C compiler and flags for coherency..." >&4
4028$cat > try.c <<'EOF'
4029#include <stdio.h>
4030int main() { printf("Ok\n"); exit(0); }
4031EOF
7a282f6d 4032set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
4033shift
4034$cat >try.msg <<'EOM'
4035I've tried to compile and run the following simple program:
4036
4037EOM
4038$cat try.c >> try.msg
4039
4040$cat >> try.msg <<EOM
4041
4042I used the command:
4043
4044 $*
4045 ./try
4046
4047and I got the following output:
4048
4049EOM
4050dflt=y
7a282f6d 4051if sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
bd9b35c9
JH
4052 if sh -c './try' >>try.msg 2>&1; then
4053 xxx=`./try`
4054 case "$xxx" in
4055 "Ok") dflt=n ;;
4056 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4057 case " $libs " in
4058 *" -lsfio "*)
4059 cat >> try.msg <<'EOQS'
4060If $libs contains -lsfio, and sfio is mis-configured, then it
4061sometimes (apparently) runs and exits with a 0 status, but with no
4062output! It may have to do with sfio's use of _exit vs. exit.
4063
4064EOQS
4065 rp="You have a big problem. Shall I abort Configure"
4066 dflt=y
4067 ;;
4068 esac
4069 ;;
4070 esac
4071 else
4072 echo "The program compiled OK, but exited with status $?." >>try.msg
4073 rp="You have a problem. Shall I abort Configure"
4074 dflt=y
4075 fi
4076else
4077 echo "I can't compile the test program." >>try.msg
4078 rp="You have a BIG problem. Shall I abort Configure"
4079 dflt=y
4080fi
4081case "$dflt" in
4082y)
4083 $cat try.msg >&4
4084 case "$knowitall" in
4085 '')
4086 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 4087 ;;
bd9b35c9 4088 *) dflt=n;;
c4f23d77 4089 esac
bd9b35c9
JH
4090 echo " "
4091 . ./myread
4092 case "$ans" in
4093 n*|N*) ;;
4094 *) echo "Ok. Stopping Configure." >&4
4095 exit 1
c4f23d77
AD
4096 ;;
4097 esac
4098 ;;
bd9b35c9 4099n) echo "OK, that should do.";;
c4f23d77 4100esac
bd9b35c9 4101$rm -f try try.* core
c4f23d77 4102
b4eb6b3d
JH
4103: define an is-a-typedef? function
4104typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4105case "$inclist" in
4106"") inclist="sys/types.h";;
4107esac;
4108eval "varval=\$$var";
4109case "$varval" in
4110"")
4111 $rm -f temp.c;
4112 for inc in $inclist; do
4113 echo "#include <$inc>" >>temp.c;
4114 done;
4115 echo "#ifdef $type" >> temp.c;
4116 echo "printf(\"We have $type\");" >> temp.c;
4117 echo "#endif" >> temp.c;
4118 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4119 if $contains $type temp.E >/dev/null 2>&1; then
4120 eval "$var=\$type";
4121 else
4122 eval "$var=\$def";
4123 fi;
4124 $rm -f temp.?;;
4125*) eval "$var=\$varval";;
4126esac'
4127
4128: define an is-a-typedef? function that prompts if the type is not available.
4129typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4130case "$inclist" in
4131"") inclist="sys/types.h";;
4132esac;
4133eval "varval=\$$var";
4134case "$varval" in
4135"")
4136 $rm -f temp.c;
4137 for inc in $inclist; do
4138 echo "#include <$inc>" >>temp.c;
4139 done;
4140 echo "#ifdef $type" >> temp.c;
4141 echo "printf(\"We have $type\");" >> temp.c;
4142 echo "#endif" >> temp.c;
4143 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4144 echo " " ;
4145 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4146 if $contains $type temp.E >/dev/null 2>&1; then
4147 echo "$type found." >&4;
4148 eval "$var=\$type";
4149 else
4150 echo "$type NOT found." >&4;
4151 dflt="$def";
4152 . ./myread ;
4153 eval "$var=\$ans";
4154 fi;
4155 $rm -f temp.?;;
4156*) eval "$var=\$varval";;
4157esac'
4158
bd9b35c9
JH
4159: define a shorthand compile call
4160compile='
4161mc_file=$1;
4162shift;
08413ebc 4163$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
4164: define a shorthand compile call for compilations that should be ok.
4165compile_ok='
4166mc_file=$1;
4167shift;
7a282f6d 4168$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 4169
b4eb6b3d 4170: check for lengths of integral types
bd9b35c9 4171echo " "
b4eb6b3d
JH
4172case "$intsize" in
4173'')
4174 echo "Checking to see how big your integers are..." >&4
4175 $cat >intsize.c <<'EOCP'
bd9b35c9
JH
4176#include <stdio.h>
4177int main()
4178{
b4eb6b3d
JH
4179 printf("intsize=%d;\n", (int)sizeof(int));
4180 printf("longsize=%d;\n", (int)sizeof(long));
4181 printf("shortsize=%d;\n", (int)sizeof(short));
4182 exit(0);
bd9b35c9 4183}
b4eb6b3d
JH
4184EOCP
4185 set intsize
4186 if eval $compile_ok && ./intsize > /dev/null; then
4187 eval `./intsize`
4188 echo "Your integers are $intsize bytes long."
4189 echo "Your long integers are $longsize bytes long."
4190 echo "Your short integers are $shortsize bytes long."
4191 else
4192 $cat >&4 <<EOM
4193!
4194Help! I can't compile and run the intsize test program: please enlighten me!
4195(This is probably a misconfiguration in your system or libraries, and
4196you really ought to fix it. Still, I'll try anyway.)
4197!
bd9b35c9 4198EOM
b4eb6b3d
JH
4199 dflt=4
4200 rp="What is the size of an integer (in bytes)?"
4201 . ./myread
4202 intsize="$ans"
4203 dflt=$intsize
4204 rp="What is the size of a long integer (in bytes)?"
4205 . ./myread
4206 longsize="$ans"
4207 dflt=2
4208 rp="What is the size of a short integer (in bytes)?"
4209 . ./myread
4210 shortsize="$ans"
4211 fi
4212 ;;
4213esac
4214$rm -f intsize intsize.*
c1a7f87b 4215
b4eb6b3d
JH
4216: see what type lseek is declared as in the kernel
4217rp="What is the type used for lseek's offset on this system?"
4218set off_t lseektype long stdio.h sys/types.h
4219eval $typedef_ask
4220
4221echo " "
4222echo "Checking to see how big your file offsets are..." >&4
4223$cat >try.c <<EOCP
4224#include <sys/types.h>
4225#include <stdio.h>
4226int main()
4227{
4228 printf("%d\n", (int)sizeof($lseektype));
4229 return(0);
4230}
4231EOCP
4232set try
4233if eval $compile_ok; then
4234 lseeksize=`./try`
4235 echo "Your file offsets are $lseeksize bytes long."
4236else
4237 dflt=$longsize
4238 echo " "
4239 echo "(I can't seem to compile the test program. Guessing...)"
4240 rp="What is the size of your file offsets (in bytes)?"
4241 . ./myread
4242 lseeksize="$ans"
4243fi
4244$rm -f try.c try
4245
4246: see what type file positions are declared as in the library
4247rp="What is the type for file position used by fsetpos()?"
4248set fpos_t fpostype long stdio.h sys/types.h
4249eval $typedef_ask
4250
4251echo " "
4252case "$fpostype" in
4253*_t) zzz="$fpostype" ;;
4254*) zzz="fpos_t" ;;
4255esac
4256echo "Checking the size of $zzz..." >&4
4257cat > try.c <<EOCP
4258#include <sys/types.h>
4259#include <stdio.h>
4260int main() {
4261 printf("%d\n", (int)sizeof($fpostype));
4262 exit(0);
4263}
4264EOCP
4265set try
4266if eval $compile_ok; then
4267 yyy=`./try`
4268 case "$yyy" in
4269 '') fpossize=4
4270 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4271 ;;
4272 *) fpossize=$yyy
4273 echo "Your $zzz is $fpossize bytes long."
4274 ;;
4275 esac
4276else
4277 dflt="$longsize"
4278 echo " " >&4
4279 echo "(I can't compile the test program. Guessing...)" >&4
4280 rp="What is the size of your file positions (in bytes)?"
4281 . ./myread
4282 fpossize="$ans"
4283fi
4284
4285
4286
4287# Backward compatibility (uselfs is deprecated).
4288case "$uselfs" in
4289"$define"|true|[yY]*)
4290 cat <<EOM >&4
4291
4292*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4293EOM
4294 uselargefiles="$define"
4295 ;;
4296esac
4297
4298case "$lseeksize:$fpossize" in
42998:8) cat <<EOM
4300
4301You can have files larger than 2 gigabytes.
4302EOM
4303 val="$define" ;;
4304*) case "$uselargefiles" in
4305 "$undef"|false|[nN]*) dflt='n' ;;
4306 *) dflt='y' ;;
4307 esac
4308 cat <<EOM
4309
4310Perl can be built to understand large files (files larger than 2 gigabytes)
4311on some systems. To do so, Configure can be run with -Duselargefiles.
4312
4313If this doesn't make any sense to you, just accept the default '$dflt'.
4314EOM
4315 rp='Try to understand large files, if available?'
4316 . ./myread
4317 case "$ans" in
4318 y|Y) val="$define" ;;
4319 *) val="$undef" ;;
4320 esac
4321 ;;
4322esac
4323set uselargefiles
4324eval $setvar
4325case "$uselargefiles" in
4326"$define")
4327: Look for a hint-file generated 'call-back-unit'. If the
4328: user has specified that a large files perl is to be built,
4329: we may need to set or change some other defaults.
4330 if $test -f uselargefiles.cbu; then
4331 echo "Your platform has some specific hints for large file builds, using them..."
4332 . ./uselargefiles.cbu
4333 echo " "
4334 echo "Rechecking to see how big your file offsets are..." >&4
4335 $cat >try.c <<EOCP
4336#include <sys/types.h>
4337#include <stdio.h>
4338int main()
4339{
4340 printf("%d\n", (int)sizeof($lseektype));
4341 return(0);
4342}
4343EOCP
4344 set try
4345 if eval $compile_ok; then
4346 lseeksize=`./try`
4347 $echo "Your file offsets are now $lseeksize bytes long."
4348 else
4349 dflt="$lseeksize"
4350 echo " "
4351 echo "(I can't seem to compile the test program. Guessing...)"
4352 rp="What is the size of your file offsets (in bytes)?"
4353 . ./myread
4354 lseeksize="$ans"
4355 fi
4356 case "$fpostype" in
4357 *_t) zzz="$fpostype" ;;
4358 *) zzz="fpos_t" ;;
4359 esac
4360 $echo $n "Rechecking the size of $zzz...$c" >&4
4361 $cat > try.c <<EOCP
4362#include <sys/types.h>
4363#include <stdio.h>
4364int main() {
4365 printf("%d\n", (int)sizeof($fpostype));
4366 exit(0);
4367}
4368EOCP
4369 set try
4370 if eval $compile_ok; then
4371 yyy=`./try`
4372 dflt="$lseeksize"
4373 case "$yyy" in
4374 '') echo " "
4375 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4376 ;;
4377 *) fpossize=$yyy
4378 echo " $fpossize bytes." >&4
4379 ;;
4380 esac
4381 else
4382 dflt="$fpossize"
4383 echo " "
4384 echo "(I can't compile the test program. Guessing...)" >&4
4385 rp="What is the size of your file positions (in bytes)?"
4386 . ./myread
4387 fpossize="$ans"
4388 fi
4389 $rm -f try.c try
4390 fi
4391 ;;
4392esac
4393
4394
4395case "$usemorebits" in
4396"$define"|true|[yY]*)
4397 use64bitint="$define"
4398 uselongdouble="$define"
4399 usemorebits="$define"
4400 ;;
4401*) usemorebits="$undef"
4402 ;;
4403esac
4404
4405
4406case "$uselonglong" in
4407"$define"|true|[yY]*)
4408 cat <<EOM >&4
4409
4410*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4411EOM
4412 use64bitint="$define"
4413 ;;
4414esac
4415case "$use64bits" in
4416"$define"|true|[yY]*)
4417 cat <<EOM >&4
4418
4419*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4420EOM
4421 use64bitint="$define"
4422 ;;
4423esac
4424case "$use64bitints" in
4425"$define"|true|[yY]*)
4426 cat <<EOM >&4
4427
4428*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4429EOM
4430 use64bitint="$define"
4431 ;;
4432esac
4433case "$use64bitsint" in
4434"$define"|true|[yY]*)
4435 cat <<EOM >&4
4436
4437*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4438EOM
4439 use64bitint="$define"
4440 ;;
4441esac
4442case "$uselonglongs" in
4443"$define"|true|[yY]*)
4444 cat <<EOM >&4
4445
4446*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4447EOM
4448 use64bitint="$define"
4449 ;;
4450esac
4451case "$use64bitsall" in
4452"$define"|true|[yY]*)
4453 cat <<EOM >&4
4454
4455*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4456EOM
4457 use64bitall="$define"
4458 ;;
4459esac
4460
4461case "$ccflags" in
4462*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4463esac
4464case "$use64bitall" in
4465"$define"|true|[yY]*) use64bitint="$define" ;;
4466esac
4467
4468case "$longsize" in
44698) cat <<EOM
4470
4471You have natively 64-bit long integers.
4472EOM
4473 val="$define"
4474 ;;
4475*) case "$use64bitint" in
4476 "$define"|true|[yY]*) dflt='y';;
4477 *) dflt='n';;
4478 esac
4479 cat <<EOM
4480
4481Perl can be built to take advantage of 64-bit integer types
4482on some systems. To do so, Configure can be run with -Duse64bitint.
4483Choosing this option will most probably introduce binary incompatibilities.
4484
4485If this doesn't make any sense to you, just accept the default '$dflt'.
4486EOM
4487 rp='Try to use 64-bit integers, if available?'
4488 . ./myread
4489 case "$ans" in
4490 [yY]*) val="$define" ;;
4491 *) val="$undef" ;;
4492 esac
4493 ;;
4494esac
4495set use64bitint
4496eval $setvar
4497
4498case "$use64bitall" in
4499"$define"|true|[yY]*) dflt='y' ;;
4500*) case "$longsize" in
4501 8) dflt='y' ;;
4502 *) dflt='n' ;;
4503 esac
4504 ;;
4505esac
4506cat <<EOM
4507
4508You may also choose to try maximal 64-bitness. It means using as much
450964-bitness as possible on the platform. This in turn means even more
4510binary incompatibilities. On the other hand, your platform may not
4511have any more 64-bitness available than what you already have chosen.
4512
4513If this doesn't make any sense to you, just accept the default '$dflt'.
4514EOM
4515rp='Try to use maximal 64-bit support, if available?'
4516. ./myread
4517case "$ans" in
4518[yY]*) val="$define" ;;
4519*) val="$undef" ;;
4520esac
4521set use64bitall
4522eval $setvar
4523case "$use64bitall" in
4524"$define")
4525 case "$use64bitint" in
4526 "$undef")
4527 cat <<EOM
4528
4529Since you have chosen a maximally 64-bit build, I'm also turning on
4530the use of 64-bit integers.
4531EOM
4532 use64bitint="$define" ;;
4533 esac
4534 ;;
4535esac
4536
4537case "$use64bitint" in
4538"$define"|true|[yY]*)
4539: Look for a hint-file generated 'call-back-unit'. If the
4540: user has specified that a 64-bit perl is to be built,
4541: we may need to set or change some other defaults.
4542 if $test -f use64bitint.cbu; then
4543 echo "Your platform has some specific hints for 64-bit integers, using them..."
4544 . ./use64bitint.cbu
4545 fi
4546 case "$longsize" in
4547 4) case "$archname64" in
4548 '') archname64=64int ;;
4549 esac
4550 ;;
4551 esac
4552 ;;
4553esac
4554
4555case "$use64bitall" in
4556"$define"|true|[yY]*)
4557: Look for a hint-file generated 'call-back-unit'. If the
4558: user has specified that a maximally 64-bit perl is to be built,
4559: we may need to set or change some other defaults.
4560 if $test -f use64bitall.cbu; then
4561 echo "Your platform has some specific hints for 64-bit builds, using them..."
4562 . ./use64bitall.cbu
4563 fi
4564 case "$longsize" in
4565 4) case "$archname64" in
4566 ''|64int) archname64=64all ;;
4567 esac
4568 ;;
4569 esac
4570 ;;
4571esac
4572
4573echo " "
4574echo "Checking for GNU C Library..." >&4
4575cat >gnulibc.c <<EOM
4576#include <stdio.h>
4577int main()
4578{
4579#ifdef __GLIBC__
4580 exit(0);
4581#else
4582 exit(1);
4583#endif
4584}
4585EOM
4586set gnulibc
4587if eval $compile_ok && ./gnulibc; then
4588 val="$define"
4589 echo "You are using the GNU C Library"
4590else
4591 val="$undef"
4592 echo "You are not using the GNU C Library"
4593fi
4594$rm -f gnulibc*
4595set d_gnulibc
4596eval $setvar
4597
4598: see if nm is to be used to determine whether a symbol is defined or not
4599case "$usenm" in
4600'')
4601 dflt=''
c1a7f87b
JH
4602 case "$d_gnulibc" in
4603 "$define")
4604 echo " "
4605 echo "nm probably won't work on the GNU C Library." >&4
4606 dflt=n
bd9b35c9 4607 ;;
c1a7f87b
JH
4608 esac
4609 case "$dflt" in
4610 '')
4611 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4612 echo " "
4613 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
4614 echo "'nm' won't be sufficient on this sytem." >&4
4615 dflt=n
4616 fi
4617 ;;
4618 esac
4619 case "$dflt" in
4620 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4621 if $test $dflt -gt 20; then
4622 dflt=y
4623 else
4624 dflt=n
4625 fi
bd9b35c9
JH
4626 ;;
4627 esac
bd9b35c9
JH
4628 ;;
4629*)
c1a7f87b
JH
4630 case "$usenm" in
4631 true|$define) dflt=y;;
4632 *) dflt=n;;
4633 esac
bd9b35c9
JH
4634 ;;
4635esac
4636$cat <<EOM
4637
c1a7f87b
JH
4638I can use $nm to extract the symbols from your C libraries. This
4639is a time consuming task which may generate huge output on the disk (up
4640to 3 megabytes) but that should make the symbols extraction faster. The
4641alternative is to skip the 'nm' extraction part and to compile a small
4642test program instead to determine whether each symbol is present. If
4643you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4644this may be the best solution.
4645
4646You probably shouldn't let me use 'nm' if you are using the GNU C Library.
bd9b35c9
JH
4647
4648EOM
c1a7f87b
JH
4649rp="Shall I use $nm to extract C symbols from the libraries?"
4650. ./myread
4651case "$ans" in
4652[Nn]*) usenm=false;;
4653*) usenm=true;;
bd9b35c9 4654esac
bd9b35c9 4655
c1a7f87b
JH
4656runnm=$usenm
4657case "$reuseval" in
4658true) runnm=false;;
8e07c86e 4659esac
29209bc5 4660
c1a7f87b
JH
4661: nm options which may be necessary
4662case "$nm_opt" in
4663'') if $test -f /mach_boot; then
4664 nm_opt='' # Mach
4665 elif $test -d /usr/ccs/lib; then
4666 nm_opt='-p' # Solaris (and SunOS?)
4667 elif $test -f /dgux; then
4668 nm_opt='-p' # DG-UX
4669 elif $test -f /lib64/rld; then
4670 nm_opt='-p' # 64-bit Irix
4671 else
4672 nm_opt=''
4673 fi;;
4674esac
bd9b35c9 4675
c1a7f87b
JH
4676: nm options which may be necessary for shared libraries but illegal
4677: for archive libraries. Thank you, Linux.
4678case "$nm_so_opt" in
4679'') case "$myuname" in
4680 *linux*)
4681 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4682 nm_so_opt='--dynamic'
4683 fi
4684 ;;
bd9b35c9 4685 esac
c1a7f87b
JH
4686 ;;
4687esac
8e07c86e 4688
c1a7f87b
JH
4689case "$runnm" in
4690true)
4691: get list of predefined functions in a handy place
4692echo " "
4693case "$libc" in
4694'') libc=unknown
4695 case "$libs" in
4696 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
bd9b35c9 4697 esac
ff935051
JH
4698 ;;
4699esac
c1a7f87b
JH
4700libnames='';
4701case "$libs" in
4702'') ;;
4703*) for thislib in $libs; do
4704 case "$thislib" in
4705 -lc|-lc_s)
4706 : Handle C library specially below.
4707 ;;
4708 -l*)
4709 thislib=`echo $thislib | $sed -e 's/^-l//'`
4710 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4711 :
4712 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4713 :
4714 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4715 :
4716 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4717 :
4718 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4719 :
4720 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4721 :
4722 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4723 :
4724 else
4725 try=''
4726 fi
4727 libnames="$libnames $try"
4728 ;;
4729 *) libnames="$libnames $thislib" ;;
34d1710f 4730 esac
c1a7f87b 4731 done
4633a7c4
LW
4732 ;;
4733esac
c1a7f87b
JH
4734xxx=normal
4735case "$libc" in
4736unknown)
4737 set /lib/libc.$so
4738 for xxx in $libpth; do
4739 $test -r $1 || set $xxx/libc.$so
4740 : The messy sed command sorts on library version numbers.
4741 $test -r $1 || \
4742 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4743 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4744 h
4745 s/[0-9][0-9]*/0000&/g
4746 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4747 G
4748 s/\n/ /' | \
381aa1ff 4749 $sort | $sed -e 's/^.* //'`
c1a7f87b
JH
4750 eval set \$$#
4751 done
4752 $test -r $1 || set /usr/ccs/lib/libc.$so
4753 $test -r $1 || set /lib/libsys_s$_a
4754 ;;
4755*)
4756 set blurfl
4757 ;;
a4f3eea9 4758esac
c1a7f87b
JH
4759if $test -r "$1"; then
4760 echo "Your (shared) C library seems to be in $1."
4761 libc="$1"
4762elif $test -r /lib/libc && $test -r /lib/clib; then
4763 echo "Your C library seems to be in both /lib/clib and /lib/libc."
4764 xxx=apollo
4765 libc='/lib/clib /lib/libc'
4766 if $test -r /lib/syslib; then
4767 echo "(Your math library is in /lib/syslib.)"
4768 libc="$libc /lib/syslib"
4769 fi
4770elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4771 echo "Your C library seems to be in $libc, as you said before."
4772elif $test -r $incpath/usr/lib/libc$_a; then
4773 libc=$incpath/usr/lib/libc$_a;
4774 echo "Your C library seems to be in $libc. That's fine."
4775elif $test -r /lib/libc$_a; then
4776 libc=/lib/libc$_a;
4777 echo "Your C library seems to be in $libc. You're normal."
4778else
4779 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4780 :
4781 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4782 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4783 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4784 :
4785 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4786 :
4787 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4788 :
4789 else
4790 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4791 fi
4792 if $test -r "$tans"; then
4793 echo "Your C library seems to be in $tans, of all places."
4794 libc=$tans
4795 else
4796 libc='blurfl'
4797 fi
4798fi
4799if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4800 dflt="$libc"
4801 cat <<EOM
a4f3eea9 4802
c1a7f87b
JH
4803If the guess above is wrong (which it might be if you're using a strange
4804compiler, or your machine supports multiple models), you can override it here.
bd9b35c9
JH
4805
4806EOM
a4f3eea9 4807else
c1a7f87b 4808 dflt=''
381aa1ff 4809 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
c1a7f87b
JH
4810 cat >&4 <<EOM
4811I can't seem to find your C library. I've looked in the following places:
a4f3eea9 4812
c1a7f87b
JH
4813EOM
4814 $sed 's/^/ /' libpath
4815 cat <<EOM
29209bc5 4816
c1a7f87b 4817None of these seems to contain your C library. I need to get its name...
a4f3eea9 4818
bd9b35c9 4819EOM
bd9b35c9 4820fi
c1a7f87b
JH
4821fn=f
4822rp='Where is your C library?'
4823. ./getfile
4824libc="$ans"
a4f3eea9 4825
c1a7f87b 4826echo " "
381aa1ff 4827echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
c1a7f87b
JH
4828set X `cat libnames`
4829shift
4830xxx=files
4831case $# in 1) xxx=file; esac
4832echo "Extracting names from the following $xxx for later perusal:" >&4
4833echo " "
4834$sed 's/^/ /' libnames >&4
4835echo " "
4836$echo $n "This may take a while...$c" >&4
a4f3eea9 4837
c1a7f87b
JH
4838for file in $*; do
4839 case $file in
4840 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4841 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 4842 esac
c1a7f87b 4843done >libc.tmp
a4f3eea9 4844
c1a7f87b
JH
4845$echo $n ".$c"
4846$grep fprintf libc.tmp > libc.ptf
4847xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4848xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4849xxx='[ADTSIW]'
4850if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
4851 eval $xscan;\
4852 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4853 eval $xrun
4854elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4855 eval $xscan;\
4856 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4857 eval $xrun
4858elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4859 eval $xscan;\
4860 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4861 eval $xrun
4862elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4863 eval $xscan;\
4864 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4865 eval $xrun
4866elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4867 eval $xscan;\
4868 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4869 eval $xrun
4870elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4871 eval $xscan;\
4872 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4873 eval $xrun
4874elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4875 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
4876 eval $xscan;\
4877 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4878 eval $xrun
4879elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4880 eval $xscan;\
4881 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4882 eval $xrun
4883elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4884 eval $xscan;\
4885 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4886 eval $xrun
4887elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4888 eval $xscan;\
4889 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4890 eval $xrun
4891elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4892 eval $xscan;\
4893 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4894 eval $xrun
4895elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4896 eval $xscan;\
4897 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4898 eval $xrun
4899elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4900 eval $xscan;\
4901 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4902 eval $xrun
4903elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
4904 eval $xscan;\
4905 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4906 eval $xrun
4907else
4908 $nm -p $* 2>/dev/null >libc.tmp
4909 $grep fprintf libc.tmp > libc.ptf
4910 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4911 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4912 then
4913 nm_opt='-p'
4914 eval $xrun
bd9b35c9 4915 else
c1a7f87b
JH
4916 echo " "
4917 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
4918 com=''
4919 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
4920 for thisname in $libnames $libc; do
4921 $ar t $thisname >>libc.tmp
4922 done
4923 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
4924 echo "Ok." >&4
4925 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
4926 # Repeat libc to extract forwarders to DLL entries too
4927 for thisname in $libnames $libc; do
4928 $ar tv $thisname >>libc.tmp
4929 # Revision 50 of EMX has bug in $ar.
4930 # it will not extract forwarders to DLL entries
4931 # Use emximp which will extract exactly them.
4932 emximp -o tmp.imp $thisname \
4933 2>/dev/null && \
4934 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
4935 < tmp.imp >>libc.tmp
4936 $rm tmp.imp
4937 done
4938 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
4939 echo "Ok." >&4
4940 else
4941 echo "$ar didn't seem to work right." >&4
4942 echo "Maybe this is a Cray...trying bld instead..." >&4
4943 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
4944 then
4945 for thisname in $libnames; do
4946 bld t $libnames | \
4947 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
4948 $ar t $thisname >>libc.tmp
4949 done
4950 echo "Ok." >&4
bd9b35c9 4951 else
c1a7f87b
JH
4952 echo "That didn't work either. Giving up." >&4
4953 exit 1
bd9b35c9 4954 fi
c1a7f87b 4955 fi
a4f3eea9 4956 fi
a4f3eea9 4957fi
c1a7f87b
JH
4958nm_extract="$com"
4959if $test -f /lib/syscalls.exp; then
4960 echo " "
4961 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4962 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
4963fi
4964;;
4965esac
4966$rm -f libnames libpath
bd9b35c9 4967
c1a7f87b
JH
4968: is a C symbol defined?
4969csym='tlook=$1;
4970case "$3" in
4971-v) tf=libc.tmp; tc=""; tdc="";;
4972-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
4973*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4974esac;
4975tx=yes;
4976case "$reuseval-$4" in
4977true-) ;;
4978true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4979esac;
4980case "$tx" in
4981yes)
4982 case "$runnm" in
4983 true)
4984 if $contains $tlook $tf >/dev/null 2>&1;
4985 then tval=true;
4986 else tval=false;
4987 fi;;
4988 *)
4989 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
7a282f6d 4990 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
c1a7f87b
JH
4991 then tval=true;
4992 else tval=false;
4993 fi;
4994 $rm -f t t.c;;
4995 esac;;
4996*)
4997 case "$tval" in
4998 $define) tval=true;;
4999 *) tval=false;;
5000 esac;;
5001esac;
5002eval "$2=$tval"'
bd9b35c9 5003
c1a7f87b
JH
5004: define an is-in-libc? function
5005inlibc='echo " "; td=$define; tu=$undef;
5006sym=$1; var=$2; eval "was=\$$2";
5007tx=yes;
5008case "$reuseval$was" in
5009true) ;;
5010true*) tx=no;;
5011esac;
5012case "$tx" in
5013yes)
5014 set $sym tres -f;
5015 eval $csym;
5016 case "$tres" in
5017 true)
5018 echo "$sym() found." >&4;
5019 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5020 *)
5021 echo "$sym() NOT found." >&4;
5022 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5023 esac;;
bd9b35c9 5024*)
c1a7f87b
JH
5025 case "$was" in
5026 $define) echo "$sym() found." >&4;;
5027 *) echo "$sym() NOT found." >&4;;
5028 esac;;
5029esac'
5030
b4eb6b3d
JH
5031: see if sqrtl exists
5032set sqrtl d_sqrtl
c1a7f87b
JH
5033eval $inlibc
5034
b4eb6b3d
JH
5035case "$ccflags" in
5036*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
c1a7f87b 5037esac
b4eb6b3d
JH
5038
5039case "$uselongdouble" in
5040$define|true|[yY]*) dflt='y';;
5041*) dflt='n';;
5042esac
5043cat <<EOM
5044
5045Perl can be built to take advantage of long doubles which
5046(if available) may give more accuracy and range for floating point numbers.
5047
5048If this doesn't make any sense to you, just accept the default '$dflt'.
5049EOM
5050rp='Try to use long doubles if available?'
c1a7f87b
JH
5051. ./myread
5052case "$ans" in
b4eb6b3d
JH
5053y|Y) val="$define" ;;
5054*) val="$undef" ;;
5055esac
5056set uselongdouble
5057eval $setvar
bfb7748a 5058
b4eb6b3d
JH
5059case "$uselongdouble" in
5060true|[yY]*) uselongdouble="$define" ;;
5061esac
bfb7748a 5062
b4eb6b3d
JH
5063case "$uselongdouble" in
5064$define)
5065: Look for a hint-file generated 'call-back-unit'. If the
5066: user has specified that long doubles should be used,
5067: we may need to set or change some other defaults.
5068 if $test -f uselongdouble.cbu; then
5069 echo "Your platform has some specific hints for long doubles, using them..."
5070 . ./uselongdouble.cbu
5071 else
5072 $cat <<EOM
5073(Your platform doesn't have any specific hints for long doubles.)
c1a7f87b 5074EOM
b4eb6b3d
JH
5075 fi
5076 ;;
5077esac
5078
5079case "$uselongdouble:$d_sqrtl" in
5080$define:$undef)
5081 $cat <<EOM >&4
5082
5083*** You requested the use of long doubles but you do not seem to have
5084*** the mathematic functions for long doubles. I'm disabling the use
5085*** of long doubles.
5086
5087EOM
5088 uselongdouble=$undef
5089 ;;
5090esac
5091
5092: check for length of double
5093echo " "
5094case "$doublesize" in
5095'')
5096 echo "Checking to see how big your double precision numbers are..." >&4
5097 $cat >try.c <<'EOCP'
5098#include <stdio.h>
5099int main()
5100{
5101 printf("%d\n", (int)sizeof(double));
5102 exit(0);
5103}
5104EOCP
5105 set try
5106 if eval $compile_ok; then
5107 doublesize=`./try`
5108 echo "Your double is $doublesize bytes long."
5109 else
5110 dflt='8'
5111 echo "(I can't seem to compile the test program. Guessing...)"
5112 rp="What is the size of a double precision number (in bytes)?"
5113 . ./myread
5114 doublesize="$ans"
5115 fi
5116 ;;
5117esac
5118$rm -f try.c try
5119
5120: check for long doubles
5121echo " "
5122echo "Checking to see if you have long double..." >&4
5123echo 'int main() { long double x = 7.0; }' > try.c
5124set try
5125if eval $compile; then
5126 val="$define"
5127 echo "You have long double."
5128else
5129 val="$undef"
5130 echo "You do not have long double."
5131fi
5132$rm try.*
5133set d_longdbl
5134eval $setvar
5135
5136: check for length of long double
5137case "${d_longdbl}${longdblsize}" in
5138$define)
5139 echo " "
5140 echo "Checking to see how big your long doubles are..." >&4
5141 $cat >try.c <<'EOCP'
5142#include <stdio.h>
5143int main()
5144{
5145 printf("%d\n", sizeof(long double));
5146}
5147EOCP
5148 set try
5149 set try
5150 if eval $compile; then
5151 longdblsize=`./try$exe_ext`
5152 echo "Your long doubles are $longdblsize bytes long."
5153 else
5154 dflt='8'
5155 echo " "
5156 echo "(I can't seem to compile the test program. Guessing...)" >&4
5157 rp="What is the size of a long double (in bytes)?"
5158 . ./myread
5159 longdblsize="$ans"
5160 fi
5161 if $test "X$doublesize" = "X$longdblsize"; then
5162 echo "(That isn't any different from an ordinary double.)"
5163 fi
5164 ;;
5165esac
5166$rm -f try.* try
5167
5168: determine the architecture name
5169echo " "
5170if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5171 tarch=`arch`"-$osname"
5172elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5173 if uname -m > tmparch 2>&1 ; then
5174 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5175 -e 's/$/'"-$osname/" tmparch`
5176 else
5177 tarch="$osname"
5178 fi
5179 $rm -f tmparch
5180else
5181 tarch="$osname"
5182fi
5183case "$myarchname" in
5184''|"$tarch") ;;
5185*)
5186 echo "(Your architecture name used to be $myarchname.)"
5187 archname=''
5188 ;;
5189esac
5190myarchname="$tarch"
5191case "$archname" in
5192'') dflt="$tarch";;
5193*) dflt="$archname";;
5194esac
5195rp='What is your architecture name'
5196. ./myread
5197archname="$ans"
5198case "$usethreads" in
5199$define)
5200 echo "Threads selected." >&4
5201 case "$archname" in
5202 *-thread*) echo "...and architecture name already has -thread." >&4
5203 ;;
5204 *) archname="$archname-thread"
5205 echo "...setting architecture name to $archname." >&4
5206 ;;
5207 esac
5208 ;;
5209esac
5210case "$usemultiplicity" in
5211$define)
5212 echo "Multiplicity selected." >&4
5213 case "$archname" in
5214 *-multi*) echo "...and architecture name already has -multi." >&4
5215 ;;
5216 *) archname="$archname-multi"
5217 echo "...setting architecture name to $archname." >&4
5218 ;;
5219 esac
5220 ;;
5221esac
5222case "$use64bitint$use64bitall" in
5223*"$define"*)
5224 case "$archname64" in
5225 '')
5226 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5227 ;;
5228 *)
5229 case "$use64bitint" in
5230 "$define") echo "64 bit integers selected." >&4 ;;
5231 esac
5232 case "$use64bitall" in
5233 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5234 esac
5235 case "$archname" in
5236 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5237 ;;
5238 *) archname="$archname-$archname64"
5239 echo "...setting architecture name to $archname." >&4
5240 ;;
5241 esac
5242 ;;
5243 esac
5244esac
5245case "$uselongdouble" in
5246$define)
5247 echo "Long doubles selected." >&4
5248 case "$longdblsize" in
5249 $doublesize)
5250 "...but long doubles are equal to doubles, not changing architecture name." >&4
5251 ;;
5252 *)
5253 case "$archname" in
5254 *-ld*) echo "...and architecture name already has -ld." >&4
5255 ;;
5256 *) archname="$archname-ld"
5257 echo "...setting architecture name to $archname." >&4
5258 ;;
5259 esac
5260 ;;
5261 esac
5262 ;;
5263esac
5264
5265: determine root of directory hierarchy where package will be installed.
5266case "$prefix" in
5267'')
5268 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5269 ;;
5270*)
5271 dflt="$prefix"
5272 ;;
5273esac
5274$cat <<EOM
5275
5276By default, $package will be installed in $dflt/bin, manual pages
5277under $dflt/man, etc..., i.e. with $dflt as prefix for all
5278installation directories. Typically this is something like /usr/local.
5279If you wish to have binaries under /usr/bin but other parts of the
5280installation under /usr/local, that's ok: you will be prompted
5281separately for each of the installation directories, the prefix being
5282only used to set the defaults.
5283
5284EOM
5285fn=d~
5286rp='Installation prefix to use?'
5287. ./getfile
5288oldprefix=''
5289case "$prefix" in
5290'') ;;
5291*)
5292 case "$ans" in
5293 "$prefix") ;;
5294 *) oldprefix="$prefix";;
5295 esac
5296 ;;
5297esac
5298prefix="$ans"
5299prefixexp="$ansexp"
5300
5301: is AFS running?
5302echo " "
5303case "$afs" in
5304$define|true) afs=true ;;
5305$undef|false) afs=false ;;
5306*) if test -d /afs; then
5307 afs=true
5308 else
5309 afs=false
5310 fi
5311 ;;
5312esac
5313if $afs; then
5314 echo "AFS may be running... I'll be extra cautious then..." >&4
5315else
5316 echo "AFS does not seem to be running..." >&4
5317fi
5318
5319: determine installation prefix for where package is to be installed.
5320if $afs; then
5321$cat <<EOM
5322
5323Since you are running AFS, I need to distinguish the directory in which
5324files will reside from the directory in which they are installed (and from
5325which they are presumably copied to the former directory by occult means).
5326
5327EOM
5328 case "$installprefix" in
5329 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5330 *) dflt="$installprefix";;
5331 esac
5332else
5333$cat <<EOM
5334
5335In some special cases, particularly when building $package for distribution,
5336it is convenient to distinguish between the directory in which files should
5337be installed from the directory ($prefix) in which they
5338will eventually reside. For most users, these two directories are the same.
5339
5340EOM
5341 case "$installprefix" in
5342 '') dflt=$prefix ;;
5343 *) dflt=$installprefix;;
5344 esac
5345fi
5346fn=d~
5347rp='What installation prefix should I use for installing files?'
5348. ./getfile
5349installprefix="$ans"
5350installprefixexp="$ansexp"
5351
5352: set the prefixit variable, to compute a suitable default value
5353prefixit='case "$3" in
5354""|none)
5355 case "$oldprefix" in
5356 "") eval "$1=\"\$$2\"";;
5357 *)
5358 case "$3" in
5359 "") eval "$1=";;
5360 none)
5361 eval "tp=\"\$$2\"";
5362 case "$tp" in
5363 ""|" ") eval "$1=\"\$$2\"";;
5364 *) eval "$1=";;
5365 esac;;
5366 esac;;
5367 esac;;
5368*)
5369 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5370 case "$tp" in
5371 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5372 /*-$oldprefix/*|\~*-$oldprefix/*)
5373 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5374 *) eval "$1=\"\$$2\"";;
5375 esac;;
5376esac'
5377
5378
5379: get the patchlevel
5380echo " "
5381echo "Getting the current patchlevel..." >&4
5382if $test -r $rsrc/patchlevel.h;then
5383 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5384 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5385 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5386 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5387 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5388 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5389else
5390 revision=0
5391 patchlevel=0
5392 subversion=0
5393 api_revision=0
5394 api_version=0
5395 api_subversion=0
5396fi
5397$echo "(You have $package version $patchlevel subversion $subversion.)"
5398case "$osname" in
5399dos|vms)
5400 : XXX Should be a Configure test for double-dots in filenames.
5401 version=`echo $revision $patchlevel $subversion | \
5402 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5403 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5404 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5405 ;;
5406*)
5407 version=`echo $revision $patchlevel $subversion | \
5408 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5409 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5410 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5411 ;;
5412esac
5413: Special case the 5.005_xx maintenance series, which used 5.005
5414: without any subversion label as a subdirectory in $sitelib
5415if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5416 api_versionstring='5.005'
5417fi
5418
5419: determine installation style
5420: For now, try to deduce it from prefix unless it is already set.
5421: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5422case "$installstyle" in
5423'') case "$prefix" in
5424 *perl*) dflt='lib';;
5425 *) dflt='lib/perl5' ;;
5426 esac
5427 ;;
5428*) dflt="$installstyle" ;;
5429esac
5430: Probably not worth prompting for this since we prompt for all
5431: the directories individually, and the prompt would be too long and
5432: confusing anyway.
5433installstyle=$dflt
5434
5435: determine where private library files go
5436: Usual default is /usr/local/lib/perl5/$version.
5437: Also allow things like /opt/perl/lib/$version, since
5438: /opt/perl/lib/perl5... would be redundant.
5439: The default "style" setting is made in installstyle.U
5440case "$installstyle" in
5441*lib/perl5*) set dflt privlib lib/$package/$version ;;
5442*) set dflt privlib lib/$version ;;
5443esac
5444eval $prefixit
5445$cat <<EOM
5446
5447There are some auxiliary files for $package that need to be put into a
5448private library directory that is accessible by everyone.
5449
5450EOM
5451fn=d~+
5452rp='Pathname where the private library files will reside?'
5453. ./getfile
5454privlib="$ans"
5455privlibexp="$ansexp"
5456: Change installation prefix, if necessary.
5457if $test X"$prefix" != X"$installprefix"; then
5458 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5459else
5460 installprivlib="$privlibexp"
5461fi
5462
5463: set the prefixup variable, to restore leading tilda escape
5464prefixup='case "$prefixexp" in
5465"$prefix") ;;
5466*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5467esac'
5468
5469: determine where public architecture dependent libraries go
5470set archlib archlib
5471eval $prefixit
5472: privlib default is /usr/local/lib/$package/$version
5473: archlib default is /usr/local/lib/$package/$version/$archname
5474: privlib may have an optional trailing /share.
5475tdflt=`echo $privlib | $sed 's,/share$,,'`
5476tdflt=$tdflt/$archname
5477case "$archlib" in
5478'') dflt=$tdflt
5479 ;;
5480*) dflt="$archlib"
5481 ;;
5482esac
5483$cat <<EOM
5484
5485$spackage contains architecture-dependent library files. If you are
5486sharing libraries in a heterogeneous environment, you might store
5487these files in a separate location. Otherwise, you can just include
5488them with the rest of the public library files.
5489
5490EOM
5491fn=d+~
5492rp='Where do you want to put the public architecture-dependent libraries?'
5493. ./getfile
5494archlib="$ans"
5495archlibexp="$ansexp"
5496if $test X"$archlib" = X"$privlib"; then
5497 d_archlib="$undef"
5498else
5499 d_archlib="$define"
5500fi
5501: Change installation prefix, if necessary.
5502if $test X"$prefix" != X"$installprefix"; then
5503 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5504else
5505 installarchlib="$archlibexp"
5506fi
5507
5508
5509: Binary compatibility with 5.005 is not possible for builds
5510: with advanced features
5511case "$usethreads$usemultiplicity" in
5512*define*)
5513 bincompat5005="$undef"
5514 d_bincompat5005="$undef"
5515 ;;
5516*) $cat <<EOM
5517
5518This version of Perl can be compiled for binary compatibility with 5.005.
5519If you decide to do so, you will be able to continue using most of the
5520extensions that were compiled for Perl 5.005.
5521
5522EOM
5523 case "$bincompat5005$d_bincompat5005" in
5524 *"$undef"*) dflt=n ;;
5525 *) dflt=y ;;
5526 esac
5527 rp='Binary compatibility with Perl 5.005?'
5528 . ./myread
5529 case "$ans" in
5530 y*) val="$define" ;;
5531 *) val="$undef" ;;
5532 esac
5533 set d_bincompat5005
5534 eval $setvar
5535 case "$d_bincompat5005" in
5536 "$define")
5537 bincompat5005="$define"
5538 ;;
5539 *) bincompat5005="$undef"
5540 d_bincompat5005="$undef"
5541 ;;
5542 esac
5543 ;;
5544esac
5545
5546
5547: see if setuid scripts can be secure
5548$cat <<EOM
5549
5550Some kernels have a bug that prevents setuid #! scripts from being
5551secure. Some sites have disabled setuid #! scripts because of this.
5552
5553First let's decide if your kernel supports secure setuid #! scripts.
5554(If setuid #! scripts would be secure but have been disabled anyway,
5555don't say that they are secure if asked.)
5556
5557EOM
5558
5559val="$undef"
5560if $test -d /dev/fd; then
5561 echo "#!$ls" >reflect
5562 chmod +x,u+s reflect
5563 ./reflect >flect 2>&1
5564 if $contains "/dev/fd" flect >/dev/null; then
5565 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5566 val="$define"
5567 else
5568 $cat <<EOM
5569If you are not sure if they are secure, I can check but I'll need a
5570username and password different from the one you are using right now.
5571If you don't have such a username or don't want me to test, simply
5572enter 'none'.
5573
5574EOM
5575 rp='Other username to test security of setuid scripts with?'
5576 dflt='none'
5577 . ./myread
5578 case "$ans" in
5579 n|none)
5580 case "$d_suidsafe" in
5581 '') echo "I'll assume setuid scripts are *not* secure." >&4
5582 dflt=n;;
5583 "$undef")
5584 echo "Well, the $hint value is *not* secure." >&4
5585 dflt=n;;
5586 *) echo "Well, the $hint value *is* secure." >&4
5587 dflt=y;;
5588 esac
c1a7f87b 5589 ;;
b4eb6b3d
JH
5590 *)
5591 $rm -f reflect flect
5592 echo "#!$ls" >reflect
5593 chmod +x,u+s reflect
5594 echo >flect
5595 chmod a+w flect
5596 echo '"su" will (probably) prompt you for '"$ans's password."
5597 su $ans -c './reflect >flect'
5598 if $contains "/dev/fd" flect >/dev/null; then
5599 echo "Okay, it looks like setuid scripts are secure." >&4
5600 dflt=y
5601 else
5602 echo "I don't think setuid scripts are secure." >&4
5603 dflt=n
5604 fi
5605 ;;
5606 esac
5607 rp='Does your kernel have *secure* setuid scripts?'
5608 . ./myread
5609 case "$ans" in
5610 [yY]*) val="$define";;
5611 *) val="$undef";;
5612 esac
5613 fi
5614else
5615 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5616 echo "(That's for file descriptors, not floppy disks.)"
5617 val="$undef"
5618fi
5619set d_suidsafe
5620eval $setvar
5621
5622$rm -f reflect flect
5623
5624: now see if they want to do setuid emulation
5625echo " "
5626val="$undef"
5627case "$d_suidsafe" in
5628"$define")
5629 val="$undef"
5630 echo "No need to emulate SUID scripts since they are secure here." >& 4
5631 ;;
5632*)
5633 $cat <<EOM
5634Some systems have disabled setuid scripts, especially systems where
5635setuid scripts cannot be secure. On systems where setuid scripts have
5636been disabled, the setuid/setgid bits on scripts are currently
5637useless. It is possible for $package to detect those bits and emulate
5638setuid/setgid in a secure fashion. This emulation will only work if
5639setuid scripts have been disabled in your kernel.
5640
5641EOM
5642 case "$d_dosuid" in
5643 "$define") dflt=y ;;
5644 *) dflt=n ;;
5645 esac
5646 rp="Do you want to do setuid/setgid emulation?"
5647 . ./myread
5648 case "$ans" in
5649 [yY]*) val="$define";;
5650 *) val="$undef";;
5651 esac
5652 ;;
5653esac
5654set d_dosuid
5655eval $setvar
5656
5657: determine filename position in cpp output
5658echo " "
5659echo "Computing filename position in cpp output for #include directives..." >&4
5660echo '#include <stdio.h>' > foo.c
5661$cat >fieldn <<EOF
5662$startsh
5663$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5664$grep '^[ ]*#.*stdio\.h' | \
5665while read cline; do
5666 pos=1
5667 set \$cline
5668 while $test \$# -gt 0; do
5669 if $test -r \`echo \$1 | $tr -d '"'\`; then
5670 echo "\$pos"
5671 exit 0
5672 fi
5673 shift
5674 pos=\`expr \$pos + 1\`
5675 done
5676done
5677EOF
5678chmod +x fieldn
5679fieldn=`./fieldn`
5680$rm -f foo.c fieldn
5681case $fieldn in
5682'') pos='???';;
56831) pos=first;;
56842) pos=second;;
56853) pos=third;;
5686*) pos="${fieldn}th";;
5687esac
5688echo "Your cpp writes the filename in the $pos field of the line."
5689
5690: locate header file
5691$cat >findhdr <<EOF
5692$startsh
5693wanted=\$1
5694name=''
5695for usrincdir in $usrinc
5696do
5697 if test -f \$usrincdir/\$wanted; then
5698 echo "\$usrincdir/\$wanted"
5699 exit 0
5700 fi
5701done
5702awkprg='{ print \$$fieldn }'
5703echo "#include <\$wanted>" > foo\$\$.c
5704$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5705$grep "^[ ]*#.*\$wanted" | \
5706while read cline; do
5707 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5708 case "\$name" in
5709 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5710 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5711 *) exit 2;;
5712 esac;
5713done;
5714#
5715# status = 0: grep returned 0 lines, case statement not executed
5716# status = 1: headerfile found
5717# status = 2: while loop executed, no headerfile found
5718#
5719status=\$?
5720$rm -f foo\$\$.c;
5721if test \$status -eq 1; then
5722 exit 0;
5723fi
5724exit 1
5725EOF
5726chmod +x findhdr
5727
5728: define an alternate in-header-list? function
5729inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5730cont=true; xxf="echo \"<\$1> found.\" >&4";
5731case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5732*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5733esac;
5734case $# in 4) instead=instead;; *) instead="at last";; esac;
5735while $test "$cont"; do
5736 xxx=`./findhdr $1`
5737 var=$2; eval "was=\$$2";
5738 if $test "$xxx" && $test -r "$xxx";
5739 then eval $xxf;
5740 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5741 cont="";
5742 else eval $xxnf;
5743 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5744 set $yyy; shift; shift; yyy=$@;
5745 case $# in 0) cont="";;
5746 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5747 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5748 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5749 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5750 esac;
5751done;
5752while $test "$yyy";
5753do set $yyy; var=$2; eval "was=\$$2";
5754 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5755 set $yyy; shift; shift; yyy=$@;
5756done'
5757
5758: see if this is a malloc.h system
5759set malloc.h i_malloc
5760eval $inhdr
5761
5762: see if stdlib is available
5763set stdlib.h i_stdlib
5764eval $inhdr
5765
5766: determine which malloc to compile in
5767echo " "
5768case "$usemymalloc" in
5769''|[yY]*|true|$define) dflt='y' ;;
5770*) dflt='n' ;;
5771esac
5772rp="Do you wish to attempt to use the malloc that comes with $package?"
5773. ./myread
5774usemymalloc="$ans"
5775case "$ans" in
5776y*|true)
5777 usemymalloc='y'
5778 mallocsrc='malloc.c'
5779 mallocobj="malloc$_o"
5780 d_mymalloc="$define"
5781 case "$libs" in
5782 *-lmalloc*)
5783 : Remove malloc from list of libraries to use
5784 echo "Removing unneeded -lmalloc from library list" >&4
5785 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5786 shift
5787 libs="$*"
5788 echo "libs = $libs" >&4
5789 ;;
5790 esac
5791 ;;
5792*)
5793 usemymalloc='n'
5794 mallocsrc=''
5795 mallocobj=''
5796 d_mymalloc="$undef"
5797 ;;
5798esac
5799
5800: compute the return types of malloc and free
5801echo " "
5802$cat >malloc.c <<END
5803#$i_malloc I_MALLOC
5804#$i_stdlib I_STDLIB
5805#include <stdio.h>
5806#include <sys/types.h>
5807#ifdef I_MALLOC
5808#include <malloc.h>
5809#endif
5810#ifdef I_STDLIB
5811#include <stdlib.h>
5812#endif
5813#ifdef TRY_MALLOC
5814void *malloc();
5815#endif
5816#ifdef TRY_FREE
5817void free();
5818#endif
5819END
5820case "$malloctype" in
5821'')
5822 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5823 malloctype='void *'
5824 else
5825 malloctype='char *'
5826 fi
5827 ;;
5828esac
5829echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5830
5831case "$freetype" in
5832'')
5833 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5834 freetype='void'
5835 else
5836 freetype='int'
5837 fi
5838 ;;
5839esac
5840echo "Your system uses $freetype free(), it would seem." >&4
5841$rm -f malloc.[co]
5842$cat <<EOM
5843
5844After $package is installed, you may wish to install various
5845add-on modules and utilities. Typically, these add-ons will
5846be installed under $prefix with the rest
5847of this package. However, you may wish to install such add-ons
5848elsewhere under a different prefix.
5849
5850If you do not wish to put everything under a single prefix, that's
5851ok. You will be prompted for the individual locations; this siteprefix
5852is only used to suggest the defaults.
5853
5854The default should be fine for most people.
5855
5856EOM
5857fn=d~+
5858rp='Installation prefix to use for add-on modules and utilities?'
5859: XXX Here might be another good place for an installstyle setting.
5860case "$siteprefix" in
5861'') dflt=$prefix ;;
5862*) dflt=$siteprefix ;;
5863esac
5864. ./getfile
5865: XXX Prefixit unit does not yet support siteprefix and vendorprefix
5866oldsiteprefix=''
5867case "$siteprefix" in
5868'') ;;
5869*) case "$ans" in
5870 "$prefix") ;;
5871 *) oldsiteprefix="$prefix";;
5872 esac
5873 ;;
5874esac
5875siteprefix="$ans"
5876siteprefixexp="$ansexp"
5877
5878: determine where site specific libraries go.
5879: Usual default is /usr/local/lib/perl5/site_perl/$version
5880: The default "style" setting is made in installstyle.U
5881: XXX No longer works with Prefixit stuff.
5882prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5883case "$sitelib" in
5884'') case "$installstyle" in
5885 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5886 *) dflt=$siteprefix/lib/site_$prog/$version ;;
5887 esac
5888 ;;
5889*) dflt="$sitelib"
5890 ;;
5891esac
5892$cat <<EOM
5893
5894The installation process will create a directory for
5895site-specific extensions and modules. Most users find it convenient
5896to place all site-specific files in this directory rather than in the
5897main distribution directory.
5898
5899EOM
5900fn=d~+
5901rp='Pathname for the site-specific library files?'
5902. ./getfile
5903sitelib="$ans"
5904sitelibexp="$ansexp"
5905sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5906: Change installation prefix, if necessary.
5907if $test X"$prefix" != X"$installprefix"; then
5908 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5909else
5910 installsitelib="$sitelibexp"
5911fi
5912
5913: determine where site specific architecture-dependent libraries go.
5914: sitelib default is /usr/local/lib/perl5/site_perl/$version
5915: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5916: sitelib may have an optional trailing /share.
5917case "$sitearch" in
5918'') dflt=`echo $sitelib | $sed 's,/share$,,'`
5919 dflt="$dflt/$archname"
5920 ;;
5921*) dflt="$sitearch"
5922 ;;
5923esac
5924set sitearch sitearch none
5925eval $prefixit
5926$cat <<EOM
5927
5928The installation process will also create a directory for
5929architecture-dependent site-specific extensions and modules.
5930
5931EOM
5932fn=d~+
5933rp='Pathname for the site-specific architecture-dependent library files?'
5934. ./getfile
5935sitearch="$ans"
5936sitearchexp="$ansexp"
5937: Change installation prefix, if necessary.
5938if $test X"$prefix" != X"$installprefix"; then
5939 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5940else
5941 installsitearch="$sitearchexp"
5942fi
5943
5944$cat <<EOM
5945
5946The installation process will also create a directory for
5947vendor-supplied add-ons. Vendors who supply perl with their system
5948may find it convenient to place all vendor-supplied files in this
5949directory rather than in the main distribution directory. This will
5950ease upgrades between binary-compatible maintenance versions of perl.
5951
5952Of course you may also use these directories in whatever way you see
5953fit. For example, you might use them to access modules shared over a
5954company-wide network.
5955
5956The default answer should be fine for most people.
5957This causes further questions about vendor add-ons to be skipped
5958and no vendor-specific directories will be configured for perl.
5959
5960EOM
5961rp='Do you want to configure vendor-specific add-on directories?'
5962case "$usevendorprefix" in
5963define|true|[yY]*) dflt=y ;;
5964*) : User may have set vendorprefix directly on Configure command line.
5965 case "$vendorprefix" in
5966 ''|' ') dflt=n ;;
5967 *) dflt=y ;;
5968 esac
5969 ;;
5970esac
5971. ./myread
5972case "$ans" in
5973[yY]*) fn=d~+
5974 rp='Installation prefix to use for vendor-supplied add-ons?'
5975 case "$vendorprefix" in
5976 '') dflt='' ;;
5977 *) dflt=$vendorprefix ;;
5978 esac
5979 . ./getfile
5980 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5981 oldvendorprefix=''
5982 case "$vendorprefix" in
5983 '') ;;
5984 *) case "$ans" in
5985 "$prefix") ;;
5986 *) oldvendorprefix="$prefix";;
5987 esac
5988 ;;
5989 esac
5990 usevendorprefix="$define"
5991 vendorprefix="$ans"
5992 vendorprefixexp="$ansexp"
5993 ;;
5994*) usevendorprefix="$undef"
5995 vendorprefix=''
5996 vendorprefixexp=''
5997 ;;
5998esac
5999
6000case "$vendorprefix" in
6001'') d_vendorlib="$undef"
6002 vendorlib=''
6003 vendorlibexp=''
6004 ;;
6005*) d_vendorlib="$define"
6006 : determine where vendor-supplied modules go.
6007 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6008 case "$vendorlib" in
6009 '')
6010 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6011 case "$installstyle" in
6012 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6013 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6014 esac
6015 ;;
6016 *) dflt="$vendorlib"
6017 ;;
6018 esac
6019 fn=d~+
6020 rp='Pathname for the vendor-supplied library files?'
6021 . ./getfile
6022 vendorlib="$ans"
6023 vendorlibexp="$ansexp"
6024 ;;
6025esac
6026vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6027: Change installation prefix, if necessary.
6028if $test X"$prefix" != X"$installprefix"; then
6029 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6030else
6031 installvendorlib="$vendorlibexp"
6032fi
6033
6034case "$vendorprefix" in
6035'') d_vendorarch="$undef"
6036 vendorarch=''
6037 vendorarchexp=''
6038 ;;
6039*) d_vendorarch="$define"
6040 : determine where vendor-supplied architecture-dependent libraries go.
6041 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6042 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6043 : vendorlib may have an optional trailing /share.
6044 case "$vendorarch" in
6045 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6046 dflt="$dflt/$archname"
6047 ;;
6048 *) dflt="$vendorarch" ;;
6049 esac
6050 fn=d~+
6051 rp='Pathname for vendor-supplied architecture-dependent files?'
6052 . ./getfile
6053 vendorarch="$ans"
6054 vendorarchexp="$ansexp"
6055 ;;
6056esac
6057: Change installation prefix, if necessary.
6058if $test X"$prefix" != X"$installprefix"; then
6059 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6060else
6061 installvendorarch="$vendorarchexp"
6062fi
6063
6064: Final catch-all directories to search
6065$cat <<EOM
6066
6067Lastly, you can have perl look in other directories for extensions and
6068modules in addition to those already specified.
6069These directories will be searched after
6070 $sitearch
6071 $sitelib
6072EOM
6073test X"$vendorlib" != "X" && echo ' ' $vendorlib
6074test X"$vendorarch" != "X" && echo ' ' $vendorarch
6075echo ' '
6076case "$otherlibdirs" in
6077''|' ') dflt='none' ;;
6078*) dflt="$otherlibdirs" ;;
6079esac
6080$cat <<EOM
6081Enter a colon-separated set of extra paths to include in perl's @INC
6082search path, or enter 'none' for no extra paths.
6083
6084EOM
6085
6086rp='Colon-separated list of additional directories for perl to search?'
6087. ./myread
6088case "$ans" in
6089' '|''|none) otherlibdirs=' ' ;;
6090*) otherlibdirs="$ans" ;;
6091esac
6092case "$otherlibdirs" in
6093' ') val=$undef ;;
6094*) val=$define ;;
6095esac
6096set d_perl_otherlibdirs
6097eval $setvar
6098
6099: Cruising for prototypes
6100echo " "
6101echo "Checking out function prototypes..." >&4
6102$cat >prototype.c <<'EOCP'
6103int main(int argc, char *argv[]) {
6104 exit(0);}
6105EOCP
6106if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6107 echo "Your C compiler appears to support function prototypes."
6108 val="$define"
6109else
6110 echo "Your C compiler doesn't seem to understand function prototypes."
6111 val="$undef"
6112fi
6113set prototype
6114eval $setvar
6115$rm -f prototype*
6116
6117case "$prototype" in
6118"$define") ;;
6119*) ansi2knr='ansi2knr'
6120 echo " "
6121 cat <<EOM >&4
6122
6123$me: FATAL ERROR:
6124This version of $package can only be compiled by a compiler that
6125understands function prototypes. Unfortunately, your C compiler
6126 $cc $ccflags
6127doesn't seem to understand them. Sorry about that.
6128
6129If GNU cc is available for your system, perhaps you could try that instead.
6130
6131Eventually, we hope to support building Perl with pre-ANSI compilers.
6132If you would like to help in that effort, please contact <perlbug@perl.org>.
6133
6134Aborting Configure now.
6135EOM
6136 exit 2
6137 ;;
6138esac
6139
6140: determine where public executables go
6141echo " "
6142set dflt bin bin
6143eval $prefixit
6144fn=d~
6145rp='Pathname where the public executables will reside?'
6146. ./getfile
6147if $test "X$ansexp" != "X$binexp"; then
6148 installbin=''
6149fi
6150bin="$ans"
6151binexp="$ansexp"
6152: Change installation prefix, if necessary.
6153: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6154if $test X"$prefix" != X"$installprefix"; then
6155 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6156else
6157 installbin="$binexp"
6158fi
6159
6160: Find perl5.005 or later.
6161echo "Looking for a previously installed perl5.005 or later... "
6162case "$perl5" in
6163'') for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6164 : Check if this perl is recent and can load a simple module
6165 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6166 perl5=$tdir/perl
6167 break;
6168 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6169 perl5=$tdir/perl
6170 break;
6171 fi
6172 done
6173 ;;
6174*) perl5="$perl5"
6175 ;;
6176esac
6177case "$perl5" in
6178'') echo "None found. That's ok.";;
6179*) echo "Using $perl5." ;;
6180esac
6181
6182: Determine list of previous versions to include in @INC
6183$cat > getverlist <<EOPL
6184#!$perl5 -w
6185use File::Basename;
6186\$api_versionstring = "$api_versionstring";
6187\$version = "$version";
6188\$stem = "$sitelib_stem";
6189\$archname = "$archname";
6190EOPL
6191 $cat >> getverlist <<'EOPL'
6192# Can't have leading @ because metaconfig interprets it as a command!
6193;@inc_version_list=();
6194# XXX Redo to do opendir/readdir?
6195if (-d $stem) {
6196 chdir($stem);
6197 ;@candidates = glob("5.*");
6198}
6199else {
6200 ;@candidates = ();
6201}
6202
6203# XXX ToDo: These comparisons must be reworked when two-digit
6204# subversions come along, so that 5.7.10 compares as greater than
6205# 5.7.3! By that time, hope that 5.6.x is sufficiently
6206# widespread that we can use the built-in version vectors rather
6207# than reinventing them here. For 5.6.0, however, we must
6208# assume this script will likely be run by 5.005_0x. --AD 1/2000.
6209foreach $d (@candidates) {
6210 if ($d lt $version) {
6211 if ($d ge $api_versionstring) {
6212 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6213 }
6214 elsif ($d ge "5.005") {
6215 unshift(@inc_version_list, grep { -d } $d);
6216 }
6217 }
6218 else {
6219 # Skip newer version. I.e. don't look in
6220 # 5.7.0 if we're installing 5.6.1.
6221 }
6222}
6223
6224if (@inc_version_list) {
6225 print join(' ', @inc_version_list);
6226}
6227else {
6228 # Blank space to preserve value for next Configure run.
6229 print " ";
6230}
6231EOPL
6232chmod +x getverlist
6233case "$inc_version_list" in
6234'') if test -x "$perl5"; then
6235 dflt=`$perl5 getverlist`
6236 else
6237 dflt='none'
6238 fi
6239 ;;
6240$undef) dflt='none' ;;
6241*) dflt="$inc_version_list" ;;
6242esac
6243case "$dflt" in
6244''|' ') dflt=none ;;
6245esac
6246case "$dflt" in
62475.005) case "$bincompat5005" in
6248 $define|true|[yY]*) ;;
6249 *) dflt=none ;;
6250 esac
6251 ;;
6252esac
6253$cat <<'EOM'
6254
6255In order to ease the process of upgrading, this version of perl
6256can be configured to use modules built and installed with earlier
6257versions of perl that were installed under $prefix. Specify here
6258the list of earlier versions that this version of perl should check.
6259If Configure detected no earlier versions of perl installed under
6260$prefix, then the list will be empty. Answer 'none' to tell perl
6261to not search earlier versions.
6262
6263The default should almost always be sensible, so if you're not sure,
6264just accept the default.
6265EOM
6266
6267rp='List of earlier versions to include in @INC?'
6268. ./myread
6269case "$ans" in
6270[Nn]one|''|' ') inc_version_list=' ' ;;
6271*) inc_version_list="$ans" ;;
6272esac
6273case "$inc_version_list" in
6274''|' ')
6275 inc_version_list_init='0';;
6276*) inc_version_list_init=`echo $inc_version_list |
6277 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6278 ;;
6279esac
6280$rm -f getverlist
6281
6282: determine whether to install perl also as /usr/bin/perl
6283
6284echo " "
6285if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6286 $cat <<EOM
6287Many scripts expect perl to be installed as /usr/bin/perl.
6288I can install the perl you are about to compile also as /usr/bin/perl
6289(in addition to $installbin/perl).
6290EOM
6291 case "$installusrbinperl" in
6292 "$undef"|[nN]*) dflt='n';;
6293 *) dflt='y';;
6294 esac
6295 rp="Do you want to install perl as /usr/bin/perl?"
6296 . ./myread
6297 case "$ans" in
6298 [yY]*) val="$define";;
6299 *) val="$undef" ;;
6300 esac
6301else
6302 val="$undef"
6303fi
6304set installusrbinperl
6305eval $setvar
6306
6307: see if dld is available
6308set dld.h i_dld
6309eval $inhdr
6310
6311: see if dlopen exists
6312xxx_runnm="$runnm"
6313runnm=false
6314set dlopen d_dlopen
6315eval $inlibc
6316runnm="$xxx_runnm"
6317
6318: determine which dynamic loading, if any, to compile in
6319echo " "
6320dldir="ext/DynaLoader"
6321case "$usedl" in
6322$define|y|true)
6323 dflt='y'
6324 usedl="$define"
6325 ;;
6326$undef|n|false)
6327 dflt='n'
6328 usedl="$undef"
6329 ;;
6330*)
6331 dflt='n'
6332 case "$d_dlopen" in
6333 $define) dflt='y' ;;
6334 esac
6335 case "$i_dld" in
6336 $define) dflt='y' ;;
6337 esac
6338 : Does a dl_xxx.xs file exist for this operating system
6339 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6340 ;;
6341esac
6342rp="Do you wish to use dynamic loading?"
6343. ./myread
6344usedl="$ans"
6345case "$ans" in
6346y*) usedl="$define"
6347 case "$dlsrc" in
6348 '')
6349 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6350 dflt="$dldir/dl_${osname}.xs"
6351 elif $test "$d_dlopen" = "$define" ; then
6352 dflt="$dldir/dl_dlopen.xs"
6353 elif $test "$i_dld" = "$define" ; then
6354 dflt="$dldir/dl_dld.xs"
6355 else
6356 dflt=''
6357 fi
6358 ;;
6359 *) dflt="$dldir/$dlsrc"
6360 ;;
6361 esac
6362 echo "The following dynamic loading files are available:"
6363 : Can not go over to $dldir because getfile has path hard-coded in.
6364 tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6365 rp="Source file to use for dynamic loading"
6366 fn="fne"
6367 gfpth="$src"
6368 . ./getfile
6369 usedl="$define"
6370 : emulate basename
6371 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6372
6373 $cat << EOM
6374
6375Some systems may require passing special flags to $cc -c to
6376compile modules that will be used to create a shared library.
6377To use no flags, say "none".
6378
6379EOM
6380 case "$cccdlflags" in
6381 '') case "$gccversion" in
6382 '') case "$osname" in
6383 hpux) dflt='+z' ;;
6384 next) dflt='none' ;;
6385 irix*) dflt='-KPIC' ;;
48bcfe03 6386 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
6387 sunos) dflt='-pic' ;;
6388 *) dflt='none' ;;
6389 esac
6390 ;;
6391 *) case "$osname" in
48bcfe03 6392 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
6393 *) dflt='-fpic' ;;
6394 esac ;;
6395 esac ;;
6396 ' ') dflt='none' ;;
6397 *) dflt="$cccdlflags" ;;
6398 esac
6399 rp="Any special flags to pass to $cc -c to compile shared library modules?"
6400 . ./myread
6401 case "$ans" in
6402 none) cccdlflags=' ' ;;
6403 *) cccdlflags="$ans" ;;
6404 esac
6405
6406 cat << EOM
6407
6408Some systems use ld to create libraries that can be dynamically loaded,
6409while other systems (such as those using ELF) use $cc.
6410
6411EOM
6412 case "$ld" in
6413 '') $cat >try.c <<'EOM'
6414/* Test for whether ELF binaries are produced */
6415#include <fcntl.h>
6416#include <stdlib.h>
6417int main() {
6418 char b[4];
6419 int i = open("a.out",O_RDONLY);
6420 if(i == -1)
6421 exit(1); /* fail */
6422 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6423 exit(0); /* succeed (yes, it's ELF) */
6424 else
6425 exit(1); /* fail */
6426}
6427EOM
6428 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6429 cat <<EOM
6430You appear to have ELF support. I'll use $cc to build dynamic libraries.
6431EOM
6432 dflt="$cc"
6433 else
6434 echo "I'll use ld to build dynamic libraries."
6435 dflt='ld'
6436 fi
6437 rm -f try.c a.out
6438 ;;
6439 *) dflt="$ld"
6440 ;;
6441 esac
6442
6443 rp="What command should be used to create dynamic libraries?"
6444 . ./myread
6445 ld="$ans"
6446
6447 cat << EOM
6448
6449Some systems may require passing special flags to $ld to create a
6450library that can be dynamically loaded. If your ld flags include
6451-L/other/path options to locate libraries outside your loader's normal
6452search path, you may need to specify those -L options here as well. To
6453use no flags, say "none".
6454
6455EOM
6456 case "$lddlflags" in
6457 '') case "$osname" in
6458 beos) dflt='-nostart' ;;
6459 hpux) dflt='-b';
6460 case "$gccversion" in
6461 '') dflt="$dflt +vnocompatwarnings" ;;
6462 esac
6463 ;;
6464 linux|irix*) dflt='-shared' ;;
6465 next) dflt='none' ;;
6466 solaris) dflt='-G' ;;
6467 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 6468 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
6469 *) dflt='none' ;;
6470 esac
6471 ;;
6472 *) dflt="$lddlflags" ;;
6473 esac
6474
6475 : Try to guess additional flags to pick up local libraries.
6476 : Be careful not to append to a plain 'none'
6477 case "$dflt" in
6478 none) dflt='' ;;
6479 esac
6480 for thisflag in $ldflags; do
6481 case "$thisflag" in
6482 -L*|-R*)
6483 case " $dflt " in
6484 *" $thisflag "*) ;;
6485 *) dflt="$dflt $thisflag" ;;
6486 esac
6487 ;;
6488 esac
6489 done
6490
6491 case "$dflt" in
6492 ''|' ') dflt='none' ;;
6493 esac
6494
6495 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6496 . ./myread
6497 case "$ans" in
6498 none) lddlflags=' ' ;;
6499 *) lddlflags="$ans" ;;
6500 esac
6501
6502 cat <<EOM
6503
6504Some systems may require passing special flags to $cc to indicate that
6505the resulting executable will use dynamic linking. To use no flags,
6506say "none".
6507
6508EOM
6509 case "$ccdlflags" in
6510 '') case "$osname" in
6511 hpux) dflt='-Wl,-E' ;;
6512 linux) dflt='-rdynamic' ;;
6513 next) dflt='none' ;;
6514 sunos) dflt='none' ;;
6515 *) dflt='none' ;;
6516 esac ;;
6517 ' ') dflt='none' ;;
6518 *) dflt="$ccdlflags" ;;
6519 esac
6520 rp="Any special flags to pass to $cc to use dynamic linking?"
6521 . ./myread
6522 case "$ans" in
6523 none) ccdlflags=' ' ;;
6524 *) ccdlflags="$ans" ;;
6525 esac
6526 ;;
6527*) usedl="$undef"
6528 ld='ld'
6529 dlsrc='dl_none.xs'
6530 lddlflags=''
6531 ccdlflags=''
6532 ;;
6533esac
6534
6535also=''
6536case "$usedl" in
6537$undef)
6538 # No dynamic loading being used, so don't bother even to prompt.
6539 useshrplib='false'
6540 ;;
6541*) case "$useshrplib" in
6542 '') case "$osname" in
48bcfe03 6543 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
6544 dflt=y
6545 also='Building a shared libperl is required for dynamic loading to work on your system.'
6546 ;;
6547 next*)
6548 case "$osvers" in
6549 4*) dflt=y
6550 also='Building a shared libperl is needed for MAB support.'
6551 ;;
6552 *) dflt=n
6553 ;;
6554 esac
6555 ;;
6556 *) dflt=n
6557 ;;
6558 esac
6559 ;;
6560 $define|true|[Yy]*)
6561 dflt=y
6562 ;;
6563 *) dflt=n
6564 ;;
6565 esac
6566 $cat << EOM
6567
6568The perl executable is normally obtained by linking perlmain.c with
6569libperl${_a}, any static extensions (usually just DynaLoader), and
6570any other libraries needed on this system (such as -lm, etc.). Since
6571your system supports dynamic loading, it is probably possible to build
6572a shared libperl.$so. If you will have more than one executable linked
6573to libperl.$so, this will significantly reduce the size of each
6574executable, but it may have a noticeable affect on performance. The
6575default is probably sensible for your system.
6576$also
6577
6578EOM
6579 rp="Build a shared libperl.$so (y/n)"
6580 . ./myread
6581 case "$ans" in
6582 true|$define|[Yy]*)
6583 useshrplib='true' ;;
6584 *) useshrplib='false' ;;
6585 esac
6586 ;;
6587esac
6588
6589case "$useshrplib" in
6590true)
6591 case "$libperl" in
6592 '')
6593 # Figure out a good name for libperl.so. Since it gets stored in
6594 # a version-specific architecture-dependent library, the version
6595 # number isn't really that important, except for making cc/ld happy.
6596 #
6597 # A name such as libperl.so.3.1
6598 majmin="libperl.$so.$patchlevel.$subversion"
6599 # A name such as libperl.so.301
6600 majonly=`echo $patchlevel $subversion |
6601 $awk '{printf "%d%02d", $1, $2}'`
6602 majonly=libperl.$so.$majonly
6603 # I'd prefer to keep the os-specific stuff here to a minimum, and
6604 # rely on figuring it out from the naming of libc.
6605 case "${osname}${osvers}" in
6606 next4*)
6607 dflt=libperl.5.$so
6608 # XXX How handle the --version stuff for MAB?
6609 ;;
6610 linux*) # ld won't link with a bare -lperl otherwise.
6611 dflt=libperl.$so
6612 ;;
6613 cygwin*) # include version
6614 dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6615 ;;
6616 *) # Try to guess based on whether libc has major.minor.
6617 case "$libc" in
6618 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6619 *libc.$so.[0-9]*) dflt=$majonly ;;
6620 *) dflt=libperl.$so ;;
6621 esac
6622 ;;
6623 esac
6624 ;;
6625 *) dflt=$libperl
6626 ;;
6627 esac
6628 cat << EOM
6629
6630I need to select a good name for the shared libperl. If your system uses
6631library names with major and minor numbers, then you might want something
6632like $majmin. Alternatively, if your system uses a single version
6633number for shared libraries, then you might want to use $majonly.
6634Or, your system might be quite happy with a simple libperl.$so.
6635
6636Since the shared libperl will get installed into a version-specific
6637architecture-dependent directory, the version number of the shared perl
6638library probably isn't important, so the default should be o.k.
6639
6640EOM
6641 rp='What name do you want to give to the shared libperl?'
6642 . ./myread
6643 libperl=$ans
6644 echo "Ok, I'll use $libperl"
6645 ;;
6646*)
6647 libperl="libperl${_a}"
6648 ;;
6649esac
6650
6651# Detect old use of shrpdir via undocumented Configure -Dshrpdir
6652case "$shrpdir" in
6653'') ;;
6654*) $cat >&4 <<EOM
6655WARNING: Use of the shrpdir variable for the installation location of
6656the shared $libperl is not supported. It was never documented and
6657will not work in this version. Let me (perlbug@perl.org)
6658know of any problems this may cause.
6659
6660EOM
6661 case "$shrpdir" in
6662 "$archlibexp/CORE")
6663 $cat >&4 <<EOM
6664But your current setting of $shrpdir is
6665the default anyway, so it's harmless.
6666EOM
6667 ;;
6668 *)
6669 $cat >&4 <<EOM
6670Further, your current attempted setting of $shrpdir
6671conflicts with the value of $archlibexp/CORE
6672that installperl will use.
6673EOM
6674 ;;
6675 esac
6676 ;;
6677esac
6678
6679# How will the perl executable find the installed shared $libperl?
6680# Add $xxx to ccdlflags.
6681# If we can't figure out a command-line option, use $shrpenv to
6682# set env LD_RUN_PATH. The main perl makefile uses this.
6683shrpdir=$archlibexp/CORE
6684xxx=''
6685tmp_shrpenv=''
6686if "$useshrplib"; then
6687 case "$osname" in
6688 aix)
6689 # We'll set it in Makefile.SH...
6690 ;;
6691 solaris|netbsd)
6692 xxx="-R $shrpdir"
6693 ;;
6694 freebsd)
6695 xxx="-Wl,-R$shrpdir"
6696 ;;
6697 linux|irix*|dec_osf)
6698 xxx="-Wl,-rpath,$shrpdir"
6699 ;;
6700 next)
6701 # next doesn't like the default...
6702 ;;
6703 beos)
6704 # beos doesn't like the default, either.
6705 ;;
6706 hpux*)
6707 # hpux doesn't like the default, either.
6708 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6709 ;;
6710 *)
6711 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6712 ;;
6713 esac
6714 case "$xxx" in
6715 '') ;;
6716 *)
6717 # Only add $xxx if it isn't already in ccdlflags.
6718 case " $ccdlflags " in
6719 *" $xxx "*) ;;
6720 *) ccdlflags="$ccdlflags $xxx"
6721 cat <<EOM >&4
6722
6723Adding $xxx to the flags
6724passed to $ld so that the perl executable will find the
6725installed shared $libperl.
6726
6727EOM
6728 ;;
6729 esac
6730 ;;
6731 esac
6732fi
6733# Fix ccdlflags in AIX for building external extensions.
6734# (For building Perl itself bare -bE:perl.exp is needed,
6735# Makefile.SH takes care of this.)
6736case "$osname" in
6737aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6738esac
6739# Respect a hint or command-line value.
6740case "$shrpenv" in
6741'') shrpenv="$tmp_shrpenv" ;;
6742esac
6743case "$ldlibpthname" in
6744'') ldlibpthname=LD_LIBRARY_PATH ;;
6745none) ldlibpthname='' ;;
6746esac
6747
6748: determine where manual pages are on this system
6749echo " "
6750case "$sysman" in
6751'')
6752 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
6753 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
6754 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
6755 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6756 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
6757 sysman=`./loc . /usr/man/man1 $syspath`
6758 ;;
6759esac
6760if $test -d "$sysman"; then
6761 echo "System manual is in $sysman." >&4
6762else
6763 echo "Could not find manual pages in source form." >&4
6764fi
6765
6766: determine where manual pages go
6767set man1dir man1dir none
6768eval $prefixit
6769$cat <<EOM
6770
6771$spackage has manual pages available in source form.
6772EOM
6773case "$nroff" in
6774nroff)
6775 echo "However, you don't have nroff, so they're probably useless to you."
6776 case "$man1dir" in
6777 '') man1dir="none";;
6778 esac;;
6779esac
6780echo "If you don't want the manual sources installed, answer 'none'."
6781case "$man1dir" in
6782' ') dflt=none
6783 ;;
6784'')
6785 lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6786 lookpath="$lookpath $prefixexp/man/p_man/man1"
6787 lookpath="$lookpath $prefixexp/man/u_man/man1"
6788 lookpath="$lookpath $prefixexp/man/man.1"
6789 case "$sysman" in
6790 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6791 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6792 esac
6793 set dflt
6794 eval $prefixup
6795 ;;
6796*) dflt="$man1dir"
6797 ;;
6798esac
6799echo " "
6800fn=dn+~
6801rp="Where do the main $spackage manual pages (source) go?"
6802. ./getfile
6803if $test "X$man1direxp" != "X$ansexp"; then
6804 installman1dir=''
6805fi
6806man1dir="$ans"
6807man1direxp="$ansexp"
6808case "$man1dir" in
6809'') man1dir=' '
6810 installman1dir='';;
6811esac
6812
6813: Change installation prefix, if necessary.
6814if $test X"$prefix" != X"$installprefix"; then
6815 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6816else
6817 installman1dir="$man1direxp"
6818fi
6819
6820: What suffix to use on installed man pages
6821
6822case "$man1dir" in
6823' ')
6824 man1ext='0'
6825 ;;
6826*)
6827 rp="What suffix should be used for the main $spackage man pages?"
6828 case "$man1ext" in
6829 '') case "$man1dir" in
6830 *1) dflt=1 ;;
6831 *1p) dflt=1p ;;
6832 *1pm) dflt=1pm ;;
6833 *l) dflt=l;;
6834 *n) dflt=n;;
6835 *o) dflt=o;;
6836 *p) dflt=p;;
6837 *C) dflt=C;;
6838 *L) dflt=L;;
6839 *L1) dflt=L1;;
6840 *) dflt=1;;
6841 esac
6842 ;;
6843 *) dflt="$man1ext";;
6844 esac
6845 . ./myread
6846 man1ext="$ans"
6847 ;;
6848esac
6849
6850: see if we can have long filenames
6851echo " "
6852first=123456789abcdef
6853$rm -f $first
6854if (echo hi >$first) 2>/dev/null; then
6855 if $test -f 123456789abcde; then
6856 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
6857 val="$undef"
6858 else
6859 echo 'You can have filenames longer than 14 characters.'>&4
6860 val="$define"
6861 fi
6862else
6863 $cat <<'EOM'
6864You can't have filenames longer than 14 chars.
6865You can't even think about them!
6866EOM
6867 val="$undef"
6868fi
6869set d_flexfnam
6870eval $setvar
6871$rm -rf 123456789abcde*
6872
6873: determine where library module manual pages go
6874set man3dir man3dir none
6875eval $prefixit
6876$cat <<EOM
6877
6878$spackage has manual pages for many of the library modules.
6879EOM
6880
6881case "$nroff" in
6882nroff)
6883 $cat <<'EOM'
6884However, you don't have nroff, so they're probably useless to you.
6885EOM
6886 case "$man3dir" in
6887 '') man3dir="none";;
6888 esac;;
6889esac
6890
6891case "$d_flexfnam" in
6892undef)
6893 $cat <<'EOM'
6894However, your system can't handle the long file names like File::Basename.3.
6895EOM
6896 case "$man3dir" in
6897 '') man3dir="none";;
6898 esac;;
6899esac
6900
6901echo "If you don't want the manual sources installed, answer 'none'."
6902prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6903case "$man3dir" in
6904'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6905 if $test -d "$privlib/man/man3"; then
6906 cat <<EOM >&4
6907
6908WARNING: Previous versions of perl installed man3 pages into
6909$privlib/man/man3. This version will suggest a
6910new default of $dflt.
6911EOM
6912 tdflt=$dflt
6913 dflt='n'
6914 rp='Do you wish to preserve the old behavior?(y/n)'
6915 . ./myread
6916 case "$ans" in
6917 y*) dflt="$privlib/man/man3" ;;
6918 *) dflt=$tdflt ;;
6919 esac
6920 fi
6921 ;;
6922*) dflt="$man3dir" ;;
6923esac
6924case "$dflt" in
6925' ') dflt=none ;;
6926esac
6927echo " "
6928fn=dn+~
6929rp="Where do the $package library man pages (source) go?"
6930. ./getfile
6931man3dir="$ans"
6932man3direxp="$ansexp"
6933case "$man3dir" in
6934'') man3dir=' '
6935 installman3dir='';;
6936esac
6937
6938: Change installation prefix, if necessary.
6939if $test X"$prefix" != X"$installprefix"; then
6940 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6941else
6942 installman3dir="$man3direxp"
6943fi
6944
6945: What suffix to use on installed man pages
6946case "$man3dir" in
6947' ')
6948 man3ext='0'
6949 ;;
6950*)
6951 rp="What suffix should be used for the $package library man pages?"
6952 case "$man3ext" in
6953 '') case "$man3dir" in
6954 *3) dflt=3 ;;
6955 *3p) dflt=3p ;;
6956 *3pm) dflt=3pm ;;
6957 *l) dflt=l;;
6958 *n) dflt=n;;
6959 *o) dflt=o;;
6960 *p) dflt=p;;
6961 *C) dflt=C;;
6962 *L) dflt=L;;
6963 *L3) dflt=L3;;
6964 *) dflt=3;;
6965 esac
6966 ;;
6967 *) dflt="$man3ext";;
6968 esac
6969 . ./myread
6970 man3ext="$ans"
6971 ;;
6972esac
6973
6974: see if we have to deal with yellow pages, now NIS.
6975if $test -d /usr/etc/yp || $test -d /etc/yp; then
6976 if $test -f /usr/etc/nibindd; then
6977 echo " "
6978 echo "I'm fairly confident you're on a NeXT."
6979 echo " "
6980 rp='Do you get the hosts file via NetInfo?'
6981 dflt=y
6982 case "$hostcat" in
6983 nidump*) ;;
6984 '') ;;
6985 *) dflt=n;;
6986 esac
6987 . ./myread
6988 case "$ans" in
6989 y*) hostcat='nidump hosts .';;
6990 *) case "$hostcat" in
6991 nidump*) hostcat='';;
6992 esac
6993 ;;
6994 esac
6995 fi
6996 case "$hostcat" in
6997 nidump*) ;;
6998 *)
6999 case "$hostcat" in
7000 *ypcat*) dflt=y;;
7001 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7002 dflt=y
7003 else
7004 dflt=n
7005 fi;;
7006 *) dflt=n;;
7007 esac
7008 echo " "
7009 rp='Are you getting the hosts file via yellow pages?'
7010 . ./myread
7011 case "$ans" in
7012 y*) hostcat='ypcat hosts';;
7013 *) hostcat='cat /etc/hosts';;
7014 esac
7015 ;;
7016 esac
7017fi
7018case "$hostcat" in
7019'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7020esac
7021case "$groupcat" in
7022'') test -f /etc/group && groupcat='cat /etc/group';;
7023esac
7024case "$passcat" in
7025'') test -f /etc/passwd && passcat='cat /etc/passwd';;
7026esac
7027
7028: now get the host name
7029echo " "
7030echo "Figuring out host name..." >&4
7031case "$myhostname" in
7032'') cont=true
7033 echo 'Maybe "hostname" will work...'
7034 if tans=`sh -c hostname 2>&1` ; then
7035 myhostname=$tans
7036 phostname=hostname
7037 cont=''
7038 fi
7039 ;;
7040*) cont='';;
7041esac
7042if $test "$cont"; then
7043 if ./xenix; then
7044 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
7045 if tans=`cat /etc/systemid 2>&1` ; then
7046 myhostname=$tans
7047 phostname='cat /etc/systemid'
7048 echo "Whadyaknow. Xenix always was a bit strange..."
7049 cont=''
7050 fi
7051 elif $test -r /etc/systemid; then
7052 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7053 fi
7054fi
7055if $test "$cont"; then
7056 echo 'No, maybe "uuname -l" will work...'
7057 if tans=`sh -c 'uuname -l' 2>&1` ; then
7058 myhostname=$tans
7059 phostname='uuname -l'
7060 else
7061 echo 'Strange. Maybe "uname -n" will work...'
7062 if tans=`sh -c 'uname -n' 2>&1` ; then
7063 myhostname=$tans
7064 phostname='uname -n'
7065 else
7066 echo 'Oh well, maybe I can mine it out of whoami.h...'
7067 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7068 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7069 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7070 else
7071 case "$myhostname" in
7072 '') echo "Does this machine have an identity crisis or something?"
7073 phostname='';;
7074 *)
7075 echo "Well, you said $myhostname before..."
7076 phostname='echo $myhostname';;
7077 esac
7078 fi
7079 fi
7080 fi
7081fi
7082: you do not want to know about this
7083set $myhostname
7084myhostname=$1
7085
7086: verify guess
7087if $test "$myhostname" ; then
7088 dflt=y
7089 rp='Your host name appears to be "'$myhostname'".'" Right?"
7090 . ./myread
7091 case "$ans" in
7092 y*) ;;
7093 *) myhostname='';;
7094 esac
7095fi
7096
7097: bad guess or no guess
7098while $test "X$myhostname" = X ; do
7099 dflt=''
7100 rp="Please type the (one word) name of your host:"
7101 . ./myread
7102 myhostname="$ans"
7103done
7104
7105: translate upper to lower if necessary
7106case "$myhostname" in
7107*[A-Z]*)
7108 echo "(Normalizing case in your host name)"
7109 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7110 ;;
7111esac
7112
7113case "$myhostname" in
7114*.*)
7115 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7116 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7117 echo "(Trimming domain name from host name--host name is now $myhostname)"
7118 ;;
7119*) case "$mydomain" in
7120 '')
7121 {
7122 test "X$hostcat" = "Xypcat hosts" &&
7123 ypmatch "$myhostname" hosts 2>/dev/null |\
7124 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
7125 $test -s hosts
7126 } || {
7127 test "X$hostcat" != "X" &&
7128 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
7129 /[ ]$myhostname[ . ]/p" > hosts
7130 }
7131 tmp_re="[ . ]"
f08cbdd1
PP
7132 if $test -f hosts; then
7133 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 7134 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
7135 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7136 hosts | $sort | $uniq | \
7137 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7138 case `$echo X$dflt` in
7139 X*\ *) echo "(Several hosts in the database matched hostname)"
7140 dflt=.
7141 ;;
7142 X.) echo "(You do not have fully-qualified names in the hosts database)"
7143 ;;
7144 esac
7145 else
7146 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 7147 dflt=.
f08cbdd1 7148 fi
b4eb6b3d
JH
7149 case "$dflt" in
7150 .)
7151 tans=`./loc resolv.conf X /etc /usr/etc`
7152 if $test -f "$tans"; then
7153 echo "(Attempting domain name extraction from $tans)"
7154 dflt=.`$sed -n -e 's/ / /g' \
7155 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
7156 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7157 case "$dflt" in
7158 .) dflt=.`$sed -n -e 's/ / /g' \
7159 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
7160 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7161 ;;
7162 esac
7163 fi
7164 ;;
7165 esac
7166 case "$dflt" in
7167 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7168 dflt=.`sh -c domainname 2>/dev/null`
7169 case "$dflt" in
7170 '') dflt='.';;
7171 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7172 esac
7173 ;;
7174 esac
7175 case "$dflt" in
7176 .) echo "(Lost all hope -- silly guess then)"
7177 dflt='.uucp'
7178 ;;
7179 esac
7180 $rm -f hosts
7181 ;;
7182 *) dflt="$mydomain";;
7183 esac;;
7184esac
7185echo " "
7186rp="What is your domain name?"
7187. ./myread
7188tans="$ans"
7189case "$ans" in
7190'') ;;
7191.*) ;;
7192*) tans=".$tans";;
7193esac
7194mydomain="$tans"
7195
7196: translate upper to lower if necessary
7197case "$mydomain" in
7198*[A-Z]*)
7199 echo "(Normalizing case in your domain name)"
7200 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7201 ;;
7202esac
7203
7204: a little sanity check here
7205case "$phostname" in
7206'') ;;
7207*)
7208 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7209 $myhostname$mydomain|$myhostname) ;;
7210 *)
7211 case "$phostname" in
7212 sed*)
7213 echo "(That doesn't agree with your whoami.h file, by the way.)"
7214 ;;
7215 *)
7216 echo "(That doesn't agree with your $phostname command, by the way.)"
7217 ;;
7218 esac
7219 ;;
7220 esac
7221 ;;
7222esac
7223
7224$cat <<EOM
7225
7226I need to get your e-mail address in Internet format if possible, i.e.
7227something like user@host.domain. Please answer accurately since I have
7228no easy means to double check it. The default value provided below
7229is most probably close to reality but may not be valid from outside
7230your organization...
7231
7232EOM
7233cont=x
7234while test "$cont"; do
7235 case "$cf_email" in
7236 '') dflt="$cf_by@$myhostname$mydomain";;
7237 *) dflt="$cf_email";;
7238 esac
7239 rp='What is your e-mail address?'
7240 . ./myread
7241 cf_email="$ans"
7242 case "$cf_email" in
7243 *@*.*) cont='' ;;
7244 *)
7245 rp='Address does not look like an Internet one. Use it anyway?'
7246 case "$fastread" in
7247 yes) dflt=y ;;
7248 *) dflt=n ;;
7249 esac
7250 . ./myread
7251 case "$ans" in
7252 y*) cont='' ;;
7253 *) echo " " ;;
7254 esac
7255 ;;
7256 esac
7257done
7258
7259$cat <<EOM
7260
7261If you or somebody else will be maintaining perl at your site, please
7262fill in the correct e-mail address here so that they may be contacted
7263if necessary. Currently, the "perlbug" program included with perl
7264will send mail to this address in addition to perlbug@perl.org. You may
7265enter "none" for no administrator.
7266
7267EOM
7268case "$perladmin" in
7269'') dflt="$cf_email";;
7270*) dflt="$perladmin";;
7271esac
7272rp='Perl administrator e-mail address'
7273. ./myread
7274perladmin="$ans"
7275
674912d7
RB
7276: determine whether to only install version-specific parts.
7277echo " "
7278$cat <<EOM
7279Do you want to install only the version-specific parts of the perl
7280distribution? Usually you do *not* want to do this.
7281EOM
7282case "$versiononly" in
7283"$define"|[Yy]*|true) dflt='y' ;;
7284*) dflt='n';
7285esac
7286rp="Do you want to install only the version-specific parts of perl?"
7287. ./myread
7288case "$ans" in
7289[yY]*) val="$define";;
7290*) val="$undef" ;;
7291esac
7292set versiononly
7293eval $setvar
7294
b4eb6b3d
JH
7295: figure out how to guarantee perl startup
7296case "$startperl" in
7297'')
7298 case "$sharpbang" in
7299 *!)
7300 $cat <<EOH
7301
7302I can use the #! construct to start perl on your system. This will
7303make startup of perl scripts faster, but may cause problems if you
7304want to share those scripts and perl is not in a standard place
7305($binexp/perl) on all your platforms. The alternative is to force
7306a shell by starting the script with a single ':' character.
7307
7308EOH
674912d7
RB
7309 case "$versiononly" in
7310 "$define") dflt="$binexp/perl$version";;
7311 *) dflt="$binexp/perl";;
7312 esac
b4eb6b3d
JH
7313 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7314 . ./myread
7315 case "$ans" in
7316 none) startperl=": # use perl";;
7317 *) startperl="#!$ans"
7318 if $test 30 -lt `echo "$ans" | wc -c`; then
7319 $cat >&4 <<EOM
7320
7321WARNING: Some systems limit the #! command to 32 characters.
7322If you experience difficulty running Perl scripts with #!, try
7323installing Perl in a directory with a shorter pathname.
7324
7325EOM
7326 fi ;;
7327 esac
7328 ;;
7329 *) startperl=": # use perl"
7330 ;;
7331 esac
7332 ;;
7333esac
7334echo "I'll use $startperl to start perl scripts."
7335
7336: figure best path for perl in scripts
7337case "$perlpath" in
7338'')
7339 perlpath="$binexp/perl"
7340 case "$startperl" in
7341 *!*) ;;
7342 *)
7343 $cat <<EOH
7344
7345I will use the "eval 'exec'" idiom to start Perl on your system.
7346I can use the full path of your Perl binary for this purpose, but
7347doing so may cause problems if you want to share those scripts and
7348Perl is not always in a standard place ($binexp/perl).
7349
7350EOH
7351 dflt="$binexp/perl"
7352 rp="What path shall I use in \"eval 'exec'\"?"
7353 . ./myread
7354 perlpath="$ans"
7355 ;;
7356 esac
7357 ;;
7358esac
7359case "$startperl" in
7360*!*) ;;
7361*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7362esac
7363
7364: determine where public executable scripts go
7365set scriptdir scriptdir
7366eval $prefixit
7367case "$scriptdir" in
7368'')
7369 dflt="$bin"
7370 : guess some guesses
7371 $test -d /usr/share/scripts && dflt=/usr/share/scripts
7372 $test -d /usr/share/bin && dflt=/usr/share/bin
7373 $test -d /usr/local/script && dflt=/usr/local/script
7374 $test -d /usr/local/scripts && dflt=/usr/local/scripts
7375 $test -d $prefixexp/script && dflt=$prefixexp/script
7376 set dflt
7377 eval $prefixup
7378 ;;
7379*) dflt="$scriptdir"
7380 ;;
7381esac
7382$cat <<EOM
7383
7384Some installations have a separate directory just for executable scripts so
7385that they can mount it across multiple architectures but keep the scripts in
7386one spot. You might, for example, have a subdirectory of /usr/share for this.
7387Or you might just lump your scripts in with all your other executables.
7388
7389EOM
7390fn=d~
7391rp='Where do you keep publicly executable scripts?'
7392. ./getfile
7393if $test "X$ansexp" != "X$scriptdirexp"; then
7394 installscript=''
7395fi
7396scriptdir="$ans"
7397scriptdirexp="$ansexp"
7398: Change installation prefix, if necessary.
7399if $test X"$prefix" != X"$installprefix"; then
7400 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7401else
7402 installscript="$scriptdirexp"
7403fi
7404
7405: determine where add-on public executables go
7406case "$sitebin" in
7407'') dflt=$siteprefix/bin ;;
7408*) dflt=$sitebin ;;
7409esac
7410fn=d~
7411rp='Pathname where the add-on public executables should be installed?'
7412. ./getfile
7413sitebin="$ans"
7414sitebinexp="$ansexp"
7415: Change installation prefix, if necessary.
7416if $test X"$prefix" != X"$installprefix"; then
7417 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7418else
7419 installsitebin="$sitebinexp"
7420fi
7421
7422case "$useperlio" in
7423$define|true|[yY]*) dflt='y';;
7424*) dflt='n';;
7425esac
7426cat <<EOM
7427
7428Previous version of $package used the standard IO mechanisms as defined
7429in <stdio.h>. Versions 5.003_02 and later of perl allow alternate IO
7430mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7431the default. This abstraction layer can use AT&T's sfio (if you already
7432have sfio installed) or regular stdio. Using PerlIO with sfio may cause
7433problems with some extension modules. Using PerlIO with stdio is safe,
7434but it is slower than plain stdio and therefore is not the default.
7435
7436If this doesn't make any sense to you, just accept the default '$dflt'.
7437EOM
7438rp='Use the experimental PerlIO abstraction layer?'
7439. ./myread
7440case "$ans" in
7441y|Y)
7442 val="$define"
7443 ;;
7444*)
7445 echo "Ok, doing things the stdio way"
7446 val="$undef"
7447 ;;
7448esac
7449set useperlio
7450eval $setvar
7451
7452case "$vendorprefix" in
7453'') d_vendorbin="$undef"
7454 vendorbin=''
7455 vendorbinexp=''
7456 ;;
7457*) d_vendorbin="$define"
7458 : determine where vendor-supplied executables go.
7459 case "$vendorbin" in
7460 '') dflt=$vendorprefix/bin ;;
7461 *) dflt="$vendorbin" ;;
7462 esac
7463 fn=d~+
7464 rp='Pathname for the vendor-supplied executables directory?'
7465 . ./getfile
7466 vendorbin="$ans"
7467 vendorbinexp="$ansexp"
7468 ;;
7469esac
7470: Change installation prefix, if necessary.
7471if $test X"$prefix" != X"$installprefix"; then
7472 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7473else
7474 installvendorbin="$vendorbinexp"
7475fi
7476
7477: see if qgcvt exists
7478set qgcvt d_qgcvt
7479eval $inlibc
7480
7481echo " "
7482
7483if $test X"$d_longdbl" = X"$define"; then
7484
7485echo "Checking how to print long doubles..." >&4
7486
7487if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7488 $cat >try.c <<'EOCP'
7489#include <sys/types.h>
7490#include <stdio.h>
7491int main() {
7492 double d = 123.456;
7493 printf("%.3f\n", d);
7494}
7495EOCP
7496 set try
7497 if eval $compile; then
7498 yyy=`./try$exe_ext`
7499 case "$yyy" in
7500 123.456)
7501 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7502 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7503 echo "We will use %f."
7504 ;;
7505 esac
7506 fi
7507fi
7508
7509if $test X"$sPRIfldbl" = X; then
7510 $cat >try.c <<'EOCP'
7511#include <sys/types.h>
7512#include <stdio.h>
7513int main() {
7514 long double d = 123.456;
7515 printf("%.3llf\n", d);
7516}
7517EOCP
7518 set try
7519 if eval $compile; then
7520 yyy=`./try$exe_ext`
7521 case "$yyy" in
7522 123.456)
7523 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7524 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7525 echo "We will use %llf."
7526 ;;
7527 esac
7528 fi
7529fi
7530
7531if $test X"$sPRIfldbl" = X; then
7532 $cat >try.c <<'EOCP'
7533#include <sys/types.h>
7534#include <stdio.h>
7535int main() {
7536 long double d = 123.456;
7537 printf("%.3Lf\n", d);
7538}
7539EOCP
7540 set try
7541 if eval $compile; then
7542 yyy=`./try$exe_ext`
7543 case "$yyy" in
7544 123.456)
7545 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7546 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7547 echo "We will use %Lf."
7548 ;;
7549 esac
7550 fi
7551fi
7552
7553if $test X"$sPRIfldbl" = X; then
7554 $cat >try.c <<'EOCP'
7555#include <sys/types.h>
7556#include <stdio.h>
7557int main() {
7558 long double d = 123.456;
7559 printf("%.3lf\n", d);
7560}
7561EOCP
7562 set try
7563 if eval $compile; then
7564 yyy=`./try$exe_ext`
7565 case "$yyy" in
7566 123.456)
7567 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7568 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7569 echo "We will use %lf."
7570 ;;
7571 esac
7572 fi
7573fi
7574
7575if $test X"$sPRIfldbl" = X; then
7576 echo "Cannot figure out how to print long doubles." >&4
7577else
7578 sSCNfldbl=$sPRIfldbl # expect consistency
7579fi
7580
7581$rm -f try try.*
7582
7583fi # d_longdbl
7584
7585case "$sPRIfldbl" in
7586'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
7587 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
7588 d_SCNfldbl="$undef";
7589 ;;
7590*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
7591 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
7592 d_SCNfldbl="$define";
7593 ;;
7594esac
7595
7596: Check how to convert floats to strings.
7597echo " "
7598echo "Checking for an efficient way to convert floats to strings."
7599echo " " > try.c
7600case "$uselongdouble" in
7601"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7602esac
7603case "$d_longdbl" in
7604"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7605esac
7606case "$d_PRIgldbl" in
7607"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
7608esac
7609$cat >>try.c <<EOP
7610#ifdef TRY_gconvert
7611#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7612char *myname = "gconvert";
7613#endif
7614#ifdef TRY_gcvt
7615#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7616char *myname = "gcvt";
7617#endif
7618#ifdef TRY_qgcvt
7619#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7620char *myname = "qgcvt";
7621#define DOUBLETYPE long double
7622#endif
7623#ifdef TRY_sprintf
7624#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7625#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7626#else
7627#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7628#endif
7629char *myname = "sprintf";
7630#endif
7631
7632#ifndef DOUBLETYPE
7633#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7634#define DOUBLETYPE long double
7635#else
7636#define DOUBLETYPE double
7637#endif
7638#endif
7639
7640#include <stdio.h>
7641
7642#define I_STDLIB $i_stdlib
7643#ifdef I_STDLIB
7644#include <stdlib.h>
7645#endif
7646
7647int
7648checkit(expect, got)
7649char *expect;
7650char *got;
7651{
7652 if (strcmp(expect, got)) {
7653 printf("%s oddity: Expected %s, got %s\n",
7654 myname, expect, got);
7655 exit(1);
7656 }
7657}
7658
7659int main()
7660{
7661 char buf[64];
7662 buf[63] = '\0';
7663
7664 /* This must be 1st test on (which?) platform */
7665 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7666 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7667 checkit("0.1", buf);
7668
7669 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
7670 checkit("1", buf);
7671
7672 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
7673 checkit("1.1", buf);
7674
7675 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
7676 checkit("1.01", buf);
7677
7678 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
7679 checkit("1.001", buf);
7680
7681 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
7682 checkit("1.0001", buf);
7683
7684 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
7685 checkit("1.00001", buf);
7686
7687 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
7688 checkit("1.000001", buf);
7689
7690 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
7691 checkit("0", buf);
7692
7693 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
7694 checkit("-1", buf);
7695
7696 /* Some Linux gcvt's give 1.e+5 here. */
7697 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
7698 checkit("100000", buf);
7699
7700 /* Some Linux gcvt's give -1.e+5 here. */
7701 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
7702 checkit("-100000", buf);
7703
7704 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
7705 checkit("123.456", buf);
7706
7707 exit(0);
7708}
7709EOP
7710case "$d_Gconvert" in
7711gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7712gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7713sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7714*) xxx_list='gconvert gcvt sprintf' ;;
7715esac
7716
7717case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7718"$define$define$define")
7719 # for long doubles prefer first qgcvt, then sprintf
7720 xxx_list="`echo $xxx_list|sed s/sprintf//`"
7721 xxx_list="sprintf $xxx_list"
7722 case "$d_qgcvt" in
7723 "$define") xxx_list="qgcvt $xxx_list" ;;
7724 esac
7725 ;;
7726esac
7727
7728for xxx_convert in $xxx_list; do
7729 echo "Trying $xxx_convert..."
7730 $rm -f try try$_o
7731 set try -DTRY_$xxx_convert
7732 if eval $compile; then
7733 echo "$xxx_convert() found." >&4
7734 if ./try; then
7735 echo "I'll use $xxx_convert to convert floats into a string." >&4
7736 break;
7737 else
7738 echo "...But $xxx_convert didn't work as I expected."
7739 fi
7740 else
7741 echo "$xxx_convert NOT found." >&4
7742 fi
7743done
7744
7745case "$xxx_convert" in
7746gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7747gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7748qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7749*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7750 "$define$define$define")
7751 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7752 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7753 esac
7754 ;;
7755esac
7756
7757: Initialize h_fcntl
7758h_fcntl=false
7759
7760: Initialize h_sysfile
7761h_sysfile=false
7762
7763: access call always available on UNIX
7764set access d_access
7765eval $inlibc
7766
7767: locate the flags for 'access()'
7768case "$d_access" in
7769"$define")
7770 echo " "
7771 $cat >access.c <<'EOCP'
7772#include <sys/types.h>
7773#ifdef I_FCNTL
7774#include <fcntl.h>
7775#endif
7776#ifdef I_SYS_FILE
7777#include <sys/file.h>
7778#endif
7779#ifdef I_UNISTD
7780#include <unistd.h>
7781#endif
7782int main() {
7783 exit(R_OK);
7784}
7785EOCP
7786 : check sys/file.h first, no particular reason here
7787 if $test `./findhdr sys/file.h` && \
7a282f6d 7788 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
7789 h_sysfile=true;
7790 echo "<sys/file.h> defines the *_OK access constants." >&4
7791 elif $test `./findhdr fcntl.h` && \
7a282f6d 7792 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
7793 h_fcntl=true;
7794 echo "<fcntl.h> defines the *_OK access constants." >&4
7795 elif $test `./findhdr unistd.h` && \
7a282f6d 7796 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
7797 echo "<unistd.h> defines the *_OK access constants." >&4
7798 else
7799 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7800 fi
7801 ;;
7802esac
7803$rm -f access*
7804
7805: see if accessx exists
7806set accessx d_accessx
7807eval $inlibc
7808
7809: see if alarm exists
7810set alarm d_alarm
7811eval $inlibc
7812
7813: see if atolf exists
7814set atolf d_atolf
7815eval $inlibc
7816
7817: see if atoll exists
7818set atoll d_atoll
7819eval $inlibc
7820
7821: Look for GNU-cc style attribute checking
7822echo " "
7823echo "Checking whether your compiler can handle __attribute__ ..." >&4
7824$cat >attrib.c <<'EOCP'
7825#include <stdio.h>
7826void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7827EOCP
7828if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7829 if $contains 'warning' attrib.out >/dev/null 2>&1; then
7830 echo "Your C compiler doesn't fully support __attribute__."
7831 val="$undef"
7832 else
7833 echo "Your C compiler supports __attribute__."
7834 val="$define"
7835 fi
7836else
7837 echo "Your C compiler doesn't seem to understand __attribute__ at all."
7838 val="$undef"
7839fi
7840set d_attribut
7841eval $setvar
7842$rm -f attrib*
7843
7844: see if bcmp exists
7845set bcmp d_bcmp
7846eval $inlibc
7847
7848: see if bcopy exists
7849set bcopy d_bcopy
7850eval $inlibc
7851
7852: see if this is a unistd.h system
7853set unistd.h i_unistd
7854eval $inhdr
7855
7856: see if getpgrp exists
7857set getpgrp d_getpgrp
7858eval $inlibc
7859
7860case "$d_getpgrp" in
7861"$define")
7862 echo " "
7863 echo "Checking to see which flavor of getpgrp is in use..."
7864 $cat >set.c <<EOP
7865#$i_unistd I_UNISTD
7866#include <sys/types.h>
7867#ifdef I_UNISTD
7868# include <unistd.h>
7869#endif
7870int main()
7871{
7872 if (getuid() == 0) {
7873 printf("(I see you are running Configure as super-user...)\n");
7874 setuid(1);
7875 }
7876#ifdef TRY_BSD_PGRP
7877 if (getpgrp(1) == 0)
7878 exit(0);
7879#else
7880 if (getpgrp() > 0)
7881 exit(0);
7882#endif
7883 exit(1);
7884}
7885EOP
7a282f6d 7886 if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
7887 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7888 val="$define"
7a282f6d 7889 elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
7890 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7891 val="$undef"
7892 else
7893 echo "I can't seem to compile and run the test program."
7894 if ./usg; then
7895 xxx="a USG one, i.e. you use getpgrp()."
7896 else
7897 # SVR4 systems can appear rather BSD-ish.
7898 case "$i_unistd" in
7899 $undef)
7900 xxx="a BSD one, i.e. you use getpgrp(pid)."
7901 val="$define"
7902 ;;
7903 $define)
7904 xxx="probably a USG one, i.e. you use getpgrp()."
7905 val="$undef"
7906 ;;
7907 esac
7908 fi
7909 echo "Assuming your getpgrp is $xxx" >&4
7910 fi
7911 ;;
7912*) val="$undef";;
7913esac
7914set d_bsdgetpgrp
7915eval $setvar
7916$rm -f set set.c
7917
7918: see if setpgrp exists
7919set setpgrp d_setpgrp
7920eval $inlibc
7921
7922case "$d_setpgrp" in
7923"$define")
7924 echo " "
7925 echo "Checking to see which flavor of setpgrp is in use..."
7926 $cat >set.c <<EOP
7927#$i_unistd I_UNISTD
7928#include <sys/types.h>
7929#ifdef I_UNISTD
7930# include <unistd.h>
7931#endif
7932int main()
7933{
7934 if (getuid() == 0) {
7935 printf("(I see you are running Configure as super-user...)\n");
7936 setuid(1);
7937 }
7938#ifdef TRY_BSD_PGRP
7939 if (-1 == setpgrp(1, 1))
7940 exit(0);
7941#else
7942 if (setpgrp() != -1)
7943 exit(0);
7944#endif
7945 exit(1);
7946}
7947EOP
7a282f6d 7948 if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
7949 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7950 val="$define"
7a282f6d 7951 elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
7952 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7953 val="$undef"
7954 else
7955 echo "(I can't seem to compile and run the test program.)"
7956 if ./usg; then
7957 xxx="a USG one, i.e. you use setpgrp()."
7958 else
7959 # SVR4 systems can appear rather BSD-ish.
7960 case "$i_unistd" in
7961 $undef)
7962 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7963 val="$define"
7964 ;;
7965 $define)
7966 xxx="probably a USG one, i.e. you use setpgrp()."
7967 val="$undef"
7968 ;;
7969 esac
7970 fi
7971 echo "Assuming your setpgrp is $xxx" >&4
7972 fi
7973 ;;
7974*) val="$undef";;
7975esac
7976set d_bsdsetpgrp
7977eval $setvar
7978$rm -f set set.c
7979: see if bzero exists
7980set bzero d_bzero
7981eval $inlibc
7982
7983: see if signal is declared as pointer to function returning int or void
7984echo " "
7985xxx=`./findhdr signal.h`
7986$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7987if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
7988 echo "You have int (*signal())() instead of void." >&4
7989 val="$undef"
7990elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
7991 echo "You have void (*signal())()." >&4
7992 val="$define"
7993elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7994 echo "You have int (*signal())() instead of void." >&4
7995 val="$undef"
7996elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7997 echo "You have void (*signal())()." >&4
7998 val="$define"
7999else
8000 case "$d_voidsig" in
8001 '')
8002 echo "I can't determine whether signal handler returns void or int..." >&4
8003 dflt=void
8004 rp="What type does your signal handler return?"
8005 . ./myread
8006 case "$ans" in
8007 v*) val="$define";;
8008 *) val="$undef";;
8009 esac;;
8010 "$define")
8011 echo "As you already told me, signal handler returns void." >&4
8012 val="$define"
8013 ;;
8014 *) echo "As you already told me, signal handler returns int." >&4
8015 val="$undef"
8016 ;;
8017 esac
8018fi
8019set d_voidsig
8020eval $setvar
8021case "$d_voidsig" in
8022"$define") signal_t="void";;
8023*) signal_t="int";;
8024esac
8025$rm -f $$.tmp
8026
8027: check for ability to cast large floats to 32-bit ints.
8028echo " "
8029echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8030if $test "$intsize" -ge 4; then
8031 xxx=int
8032else
8033 xxx=long
8034fi
8035$cat >try.c <<EOCP
8036#include <stdio.h>
8037#include <sys/types.h>
8038#include <signal.h>
8039$signal_t blech(s) int s; { exit(3); }
8040int main()
8041{
8042 $xxx i32;
8043 double f, g;
8044 int result = 0;
8045 char str[16];
8046 signal(SIGFPE, blech);
8047
8048 /* Don't let compiler optimize the test away. Store the number
8049 in a writable string for gcc to pass to sscanf under HP/UX.
8050 */
8051 sprintf(str, "2147483647");
8052 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8053 g = 10 * f;
8054 i32 = ($xxx) g;
8055
8056 /* x86 processors will probably give 0x8000 0000, which is a
8057 sign change. We don't want that. We want to mimic SPARC
8058 behavior here, which is to preserve the sign and give
8059 back 0x7fff ffff.
8060 */
8061 if (i32 != ($xxx) f)
8062 result |= 1;
8063 exit(result);
8064}
8065EOCP
8066set try
8067if eval $compile_ok; then
8068 ./try
8069 yyy=$?
8070else
8071 echo "(I can't seem to compile the test program--assuming it can't)"
8072 yyy=1
8073fi
8074case "$yyy" in
80750) val="$define"
8076 echo "Yup, it can."
8077 ;;
8078*) val="$undef"
8079 echo "Nope, it can't."
8080 ;;
8081esac
8082set d_casti32
8083eval $setvar
8084$rm -f try try.*
8085
8086: check for ability to cast negative floats to unsigned
8087echo " "
8088echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8089$cat >try.c <<EOCP
8090#include <stdio.h>
8091#include <sys/types.h>
8092#include <signal.h>
8093$signal_t blech(s) int s; { exit(7); }
8094$signal_t blech_in_list(s) int s; { exit(4); }
8095unsigned long dummy_long(p) unsigned long p; { return p; }
8096unsigned int dummy_int(p) unsigned int p; { return p; }
8097unsigned short dummy_short(p) unsigned short p; { return p; }
8098int main()
8099{
8100 double f;
8101 unsigned long along;
8102 unsigned int aint;
8103 unsigned short ashort;
8104 int result = 0;
8105 char str[16];
8106
8107 /* Frustrate gcc-2.7.2's optimizer which failed this test with
8108 a direct f = -123. assignment. gcc-2.8.0 reportedly
8109 optimized the whole file away
8110 */
8111 /* Store the number in a writable string for gcc to pass to
8112 sscanf under HP/UX.
8113 */
8114 sprintf(str, "-123");
8115 sscanf(str, "%lf", &f); /* f = -123.; */
8116
8117 signal(SIGFPE, blech);
8118 along = (unsigned long)f;
8119 aint = (unsigned int)f;
8120 ashort = (unsigned short)f;
8121 if (along != (unsigned long)-123)
8122 result |= 1;
8123 if (aint != (unsigned int)-123)
8124 result |= 1;
8125 if (ashort != (unsigned short)-123)
8126 result |= 1;
8127 sprintf(str, "1073741824.");
8128 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8129 f = f + f;
8130 along = 0;
8131 along = (unsigned long)f;
8132 if (along != 0x80000000)
8133 result |= 2;
8134 f -= 1.;
8135 along = 0;
8136 along = (unsigned long)f;
8137 if (along != 0x7fffffff)
8138 result |= 1;
8139 f += 2.;
8140 along = 0;
8141 along = (unsigned long)f;
8142 if (along != 0x80000001)
8143 result |= 2;
8144 if (result)
8145 exit(result);
8146 signal(SIGFPE, blech_in_list);
8147 sprintf(str, "123.");
8148 sscanf(str, "%lf", &f); /* f = 123.; */
8149 along = dummy_long((unsigned long)f);
8150 aint = dummy_int((unsigned int)f);
8151 ashort = dummy_short((unsigned short)f);
8152 if (along != (unsigned long)123)
8153 result |= 4;
8154 if (aint != (unsigned int)123)
8155 result |= 4;
8156 if (ashort != (unsigned short)123)
8157 result |= 4;
8158 exit(result);
8159
8160}
8161EOCP
8162set try
8163if eval $compile_ok; then
8164 ./try
8165 castflags=$?
8166else
8167 echo "(I can't seem to compile the test program--assuming it can't)"
8168 castflags=7
8169fi
8170case "$castflags" in
81710) val="$define"
8172 echo "Yup, it can."
8173 ;;
8174*) val="$undef"
8175 echo "Nope, it can't."
8176 ;;
8177esac
8178set d_castneg
8179eval $setvar
8180$rm -f try.*
8181
8182: see if vprintf exists
8183echo " "
8184if set vprintf val -f d_vprintf; eval $csym; $val; then
8185 echo 'vprintf() found.' >&4
8186 val="$define"
8187 $cat >vprintf.c <<'EOF'
8188#include <varargs.h>
8189
8190int main() { xxx("foo"); }
8191
8192xxx(va_alist)
8193va_dcl
8194{
8195 va_list args;
8196 char buf[10];
8197
8198 va_start(args);
8199 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8200}
8201EOF
8202 set vprintf
8203 if eval $compile && ./vprintf; then
8204 echo "Your vsprintf() returns (int)." >&4
8205 val2="$undef"
8206 else
8207 echo "Your vsprintf() returns (char*)." >&4
8208 val2="$define"
8209 fi
8210else
8211 echo 'vprintf() NOT found.' >&4
8212 val="$undef"
8213 val2="$undef"
8214fi
8215set d_vprintf
8216eval $setvar
8217val=$val2
8218set d_charvspr
8219eval $setvar
8220
8221: see if chown exists
8222set chown d_chown
8223eval $inlibc
8224
8225: see if chroot exists
8226set chroot d_chroot
8227eval $inlibc
8228
8229: see if chsize exists
8230set chsize d_chsize
8231eval $inlibc
8232
8233: check for const keyword
8234echo " "
8235echo 'Checking to see if your C compiler knows about "const"...' >&4
8236$cat >const.c <<'EOCP'
8237typedef struct spug { int drokk; } spug;
8238int main()
8239{
8240 const char *foo;
8241 const spug y;
8242}
8243EOCP
8244if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8245 val="$define"
8246 echo "Yup, it does."
8247else
8248 val="$undef"
8249 echo "Nope, it doesn't."
8250fi
8251set d_const
8252eval $setvar
8253
8254: see if crypt exists
8255echo " "
8256if set crypt val -f d_crypt; eval $csym; $val; then
8257 echo 'crypt() found.' >&4
8258 val="$define"
8259 cryptlib=''
8260else
8261 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8262 if $test -z "$cryptlib"; then
8263 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8264 else
8265 cryptlib=-lcrypt
8266 fi
8267 if $test -z "$cryptlib"; then
8268 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8269 else
8270 cryptlib=-lcrypt
8271 fi
8272 if $test -z "$cryptlib"; then
8273 cryptlib=`./loc libcrypt$_a "" $libpth`
8274 else
8275 cryptlib=-lcrypt
8276 fi
8277 if $test -z "$cryptlib"; then
8278 echo 'crypt() NOT found.' >&4
8279 val="$undef"
8280 else
8281 val="$define"
8282 fi
8283fi
8284set d_crypt
8285eval $setvar
8286
8287: get csh whereabouts
8288case "$csh" in
8289'csh') val="$undef" ;;
8290*) val="$define" ;;
8291esac
8292set d_csh
8293eval $setvar
8294: Respect a hint or command line value for full_csh.
8295case "$full_csh" in
8296'') full_csh=$csh ;;
8297esac
8298
8299: see if cuserid exists
8300set cuserid d_cuserid
8301eval $inlibc
8302
8303: see if this is a limits.h system
8304set limits.h i_limits
8305eval $inhdr
8306
8307: see if this is a float.h system
8308set float.h i_float
8309eval $inhdr
8310
8311: See if number of significant digits in a double precision number is known
8312echo " "
8313$cat >dbl_dig.c <<EOM
8314#$i_limits I_LIMITS
8315#$i_float I_FLOAT
8316#ifdef I_LIMITS
8317#include <limits.h>
8318#endif
8319#ifdef I_FLOAT
8320#include <float.h>
8321#endif
8322#ifdef DBL_DIG
8323printf("Contains DBL_DIG");
8324#endif
8325EOM
8326$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8327if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8328 echo "DBL_DIG found." >&4
8329 val="$define"
8330else
8331 echo "DBL_DIG NOT found." >&4
8332 val="$undef"
8333fi
8334$rm -f dbl_dig.?
8335set d_dbl_dig
8336eval $setvar
8337
8338: see if difftime exists
8339set difftime d_difftime
8340eval $inlibc
8341
8342: see if this is a dirent system
8343echo " "
8344if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8345 val="$define"
8346 echo "<dirent.h> found." >&4
8347else
8348 val="$undef"
8349 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8350 echo "<sys/dir.h> found." >&4
8351 echo " "
8352 else
8353 xinc=`./findhdr sys/ndir.h`
8354 fi
8355 echo "<dirent.h> NOT found." >&4
8356fi
8357set i_dirent
8358eval $setvar
8359
8360: Look for type of directory structure.
8361echo " "
8362$cppstdin $cppflags $cppminus < "$xinc" > try.c
8363
8364case "$direntrytype" in
8365''|' ')
8366 case "$i_dirent" in
8367 $define) guess1='struct dirent' ;;
8368 *) guess1='struct direct' ;;
8369 esac
8370 ;;
8371*) guess1="$direntrytype"
8372 ;;
8373esac
8374
8375case "$guess1" in
8376'struct dirent') guess2='struct direct' ;;
8377*) guess2='struct dirent' ;;
8378esac
8379
8380if $contains "$guess1" try.c >/dev/null 2>&1; then
8381 direntrytype="$guess1"
8382 echo "Your directory entries are $direntrytype." >&4
8383elif $contains "$guess2" try.c >/dev/null 2>&1; then
8384 direntrytype="$guess2"
8385 echo "Your directory entries seem to be $direntrytype." >&4
8386else
8387 echo "I don't recognize your system's directory entries." >&4
8388 rp="What type is used for directory entries on this system?"
8389 dflt="$guess1"
8390 . ./myread
8391 direntrytype="$ans"
8392fi
8393$rm -f try.c
8394
8395
8396: see if the directory entry stores field length
8397echo " "
8398$cppstdin $cppflags $cppminus < "$xinc" > try.c
8399if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8400 echo "Good, your directory entry keeps length information in d_namlen." >&4
8401 val="$define"
8402else
8403 echo "Your directory entry does not know about the d_namlen field." >&4
8404 val="$undef"
8405fi
8406set d_dirnamlen
8407eval $setvar
8408$rm -f try.c
8409
8410: see if dlerror exists
8411xxx_runnm="$runnm"
8412runnm=false
8413set dlerror d_dlerror
8414eval $inlibc
8415runnm="$xxx_runnm"
8416
8417: see if dlfcn is available
8418set dlfcn.h i_dlfcn
8419eval $inhdr
8420
8421case "$usedl" in
8422$define|y|true)
8423 $cat << EOM
8424
8425On a few systems, the dynamically loaded modules that perl generates and uses
8426will need a different extension than shared libs. The default will probably
8427be appropriate.
8428
8429EOM
8430 case "$dlext" in
8431 '') dflt="$so" ;;
8432 *) dflt="$dlext" ;;
8433 esac
8434 rp='What is the extension of dynamically loaded modules'
8435 . ./myread
8436 dlext="$ans"
8437 ;;
8438*)
8439 dlext="none"
8440 ;;
8441esac
8442
8443: Check if dlsym need a leading underscore
8444echo " "
8445val="$undef"
8446
8447case "$dlsrc" in
8448dl_dlopen.xs)
8449 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8450 $cat >dyna.c <<'EOM'
8451fred () { }
8452EOM
8453
8454$cat >fred.c<<EOM
8455
8456#include <stdio.h>
8457#$i_dlfcn I_DLFCN
8458#ifdef I_DLFCN
8459#include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
8460#else
8461#include <sys/types.h>
8462#include <nlist.h>
8463#include <link.h>
8464#endif
8465
8466extern int fred() ;
8467
8468int main()
8469{
8470 void * handle ;
8471 void * symbol ;
8472#ifndef RTLD_LAZY
8473 int mode = 1 ;
8474#else
8475 int mode = RTLD_LAZY ;
8476#endif
8477 handle = dlopen("./dyna.$dlext", mode) ;
8478 if (handle == NULL) {
8479 printf ("1\n") ;
8480 fflush (stdout) ;
8481 exit(0);
8482 }
8483 symbol = dlsym(handle, "fred") ;
8484 if (symbol == NULL) {
8485 /* try putting a leading underscore */
8486 symbol = dlsym(handle, "_fred") ;
8487 if (symbol == NULL) {
8488 printf ("2\n") ;
8489 fflush (stdout) ;
8490 exit(0);
8491 }
8492 printf ("3\n") ;
8493 }
8494 else
8495 printf ("4\n") ;
8496 fflush (stdout) ;
8497 exit(0);
8498}
8499EOM
8500 : Call the object file tmp-dyna.o in case dlext=o.
8501 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
8502 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
7a282f6d
JH
8503 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
8504 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
b4eb6b3d
JH
8505 xxx=`./fred`
8506 case $xxx in
8507 1) echo "Test program failed using dlopen." >&4
8508 echo "Perhaps you should not use dynamic loading." >&4;;
8509 2) echo "Test program failed using dlsym." >&4
8510 echo "Perhaps you should not use dynamic loading." >&4;;
8511 3) echo "dlsym needs a leading underscore" >&4
8512 val="$define" ;;
8513 4) echo "dlsym doesn't need a leading underscore." >&4;;
8514 esac
8515 else
8516 echo "I can't compile and run the test program." >&4
8517 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8518 fi
8519 ;;
8520esac
8521
8522$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8523
8524set d_dlsymun
8525eval $setvar
8526
8527hasproto='varname=$1; func=$2; shift; shift;
8528while $test $# -ge 2; do
8529 case "$1" in
8530 $define) echo "#include <$2>";;
8531 esac ;
8532 shift 2;
8533done > try.c;
8534$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8535if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8536 echo "$func() prototype found.";
8537 val="$define";
8538else
8539 echo "$func() prototype NOT found.";
8540 val="$undef";
8541fi;
8542set $varname;
8543eval $setvar;
8544$rm -f try.c tryout.c'
8545
8546: see if prototype for drand48 is available
8547echo " "
8548set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8549eval $hasproto
8550
8551: see if dup2 exists
8552set dup2 d_dup2
8553eval $inlibc
8554
8555: see if eaccess exists
8556set eaccess d_eaccess
8557eval $inlibc
8558
8559: see if endgrent exists
8560set endgrent d_endgrent
8561eval $inlibc
8562
8563: see if endhostent exists
8564set endhostent d_endhent
8565eval $inlibc
8566
8567: see if endnetent exists
8568set endnetent d_endnent
8569eval $inlibc
8570
8571: see if endprotoent exists
8572set endprotoent d_endpent
8573eval $inlibc
8574
8575: see if endpwent exists
8576set endpwent d_endpwent
8577eval $inlibc
8578
8579: see if endservent exists
8580set endservent d_endsent
8581eval $inlibc
8582
8583: Locate the flags for 'open()'
8584echo " "
8585$cat >open3.c <<'EOCP'
8586#include <sys/types.h>
8587#ifdef I_FCNTL
8588#include <fcntl.h>
8589#endif
8590#ifdef I_SYS_FILE
8591#include <sys/file.h>
8592#endif
8593int main() {
8594 if(O_RDONLY);
8595#ifdef O_TRUNC
8596 exit(0);
8597#else
8598 exit(1);
8599#endif
8600}
8601EOCP
8602: check sys/file.h first to get FREAD on Sun
8603if $test `./findhdr sys/file.h` && \
8604 set open3 -DI_SYS_FILE && eval $compile; then
8605 h_sysfile=true;
8606 echo "<sys/file.h> defines the O_* constants..." >&4
8607 if ./open3; then
8608 echo "and you have the 3 argument form of open()." >&4
8609 val="$define"
8610 else
8611 echo "but not the 3 argument form of open(). Oh, well." >&4
8612 val="$undef"
8613 fi
8614elif $test `./findhdr fcntl.h` && \
8615 set open3 -DI_FCNTL && eval $compile; then
8616 h_fcntl=true;
8617 echo "<fcntl.h> defines the O_* constants..." >&4
8618 if ./open3; then
8619 echo "and you have the 3 argument form of open()." >&4
8620 val="$define"
8621 else
8622 echo "but not the 3 argument form of open(). Oh, well." >&4
8623 val="$undef"
8624 fi
8625else
8626 val="$undef"
8627 echo "I can't find the O_* constant definitions! You got problems." >&4
8628fi
8629set d_open3
8630eval $setvar
8631$rm -f open3*
8632
8633: see which of string.h or strings.h is needed
8634echo " "
8635strings=`./findhdr string.h`
8636if $test "$strings" && $test -r "$strings"; then
8637 echo "Using <string.h> instead of <strings.h>." >&4
8638 val="$define"
8639else
8640 val="$undef"
8641 strings=`./findhdr strings.h`
8642 if $test "$strings" && $test -r "$strings"; then
8643 echo "Using <strings.h> instead of <string.h>." >&4
8644 else
8645 echo "No string header found -- You'll surely have problems." >&4
8646 fi
8647fi
8648set i_string
8649eval $setvar
8650case "$i_string" in
8651"$undef") strings=`./findhdr strings.h`;;
8652*) strings=`./findhdr string.h`;;
8653esac
8654
8655: check for non-blocking I/O stuff
8656case "$h_sysfile" in
8657true) echo "#include <sys/file.h>" > head.c;;
8658*)
8659 case "$h_fcntl" in
8660 true) echo "#include <fcntl.h>" > head.c;;
8661 *) echo "#include <sys/fcntl.h>" > head.c;;
8662 esac
8663 ;;
8664esac
8665echo " "
8666echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8667case "$o_nonblock" in
8668'')
8669 $cat head.c > try.c
8670 $cat >>try.c <<'EOCP'
8671#include <stdio.h>
8672int main() {
8673#ifdef O_NONBLOCK
8674 printf("O_NONBLOCK\n");
8675 exit(0);
8676#endif
8677#ifdef O_NDELAY
8678 printf("O_NDELAY\n");
8679 exit(0);
8680#endif
8681#ifdef FNDELAY
8682 printf("FNDELAY\n");
8683 exit(0);
8684#endif
8685 exit(0);
8686}
8687EOCP
8688 set try
8689 if eval $compile_ok; then
8690 o_nonblock=`./try`
8691 case "$o_nonblock" in
8692 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8693 *) echo "Seems like we can use $o_nonblock.";;
8694 esac
8695 else
8696 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8697 fi
8698 ;;
8699*) echo "Using $hint value $o_nonblock.";;
8700esac
8701$rm -f try try.* .out core
8702
8703echo " "
8704echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8705case "$eagain" in
8706'')
8707 $cat head.c > try.c
8708 $cat >>try.c <<EOCP
8709#include <errno.h>
8710#include <sys/types.h>
8711#include <signal.h>
8712#include <stdio.h>
8713#define MY_O_NONBLOCK $o_nonblock
8714#ifndef errno /* XXX need better Configure test */
8715extern int errno;
8716#endif
8717#$i_unistd I_UNISTD
8718#ifdef I_UNISTD
8719#include <unistd.h>
8720#endif
8721#$i_string I_STRING
8722#ifdef I_STRING
8723#include <string.h>
8724#else
8725#include <strings.h>
8726#endif
8727$signal_t blech(x) int x; { exit(3); }
8728EOCP
8729 $cat >> try.c <<'EOCP'
8730int main()
8731{
8732 int pd[2];
8733 int pu[2];
8734 char buf[1];
8735 char string[100];
8736
8737 pipe(pd); /* Down: child -> parent */
8738 pipe(pu); /* Up: parent -> child */
8739 if (0 != fork()) {
8740 int ret;
8741 close(pd[1]); /* Parent reads from pd[0] */
8742 close(pu[0]); /* Parent writes (blocking) to pu[1] */
8743 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8744 exit(1);
8745 signal(SIGALRM, blech);
8746 alarm(5);
8747 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
8748 exit(2);
8749 sprintf(string, "%d\n", ret);
8750 write(2, string, strlen(string));
8751 alarm(0);
8752#ifdef EAGAIN
8753 if (errno == EAGAIN) {
8754 printf("EAGAIN\n");
8755 goto ok;
8756 }
8757#endif
8758#ifdef EWOULDBLOCK
8759 if (errno == EWOULDBLOCK)
8760 printf("EWOULDBLOCK\n");
8761#endif
8762 ok:
8763 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
8764 sleep(2); /* Give it time to close our pipe */
8765 alarm(5);
8766 ret = read(pd[0], buf, 1); /* Should read EOF */
8767 alarm(0);
8768 sprintf(string, "%d\n", ret);
8769 write(3, string, strlen(string));
8770 exit(0);
8771 }
8772
8773 close(pd[0]); /* We write to pd[1] */
8774 close(pu[1]); /* We read from pu[0] */
8775 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
8776 close(pd[1]); /* Pipe pd is now fully closed! */
8777 exit(0); /* Bye bye, thank you for playing! */
8778}
8779EOCP
8780 set try
8781 if eval $compile_ok; then
8782 echo "$startsh" >mtry
8783 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8784 chmod +x mtry
8785 ./mtry >/dev/null 2>&1
8786 case $? in
8787 0) eagain=`$cat try.out`;;
8788 1) echo "Could not perform non-blocking setting!";;
8789 2) echo "I did a successful read() for something that was not there!";;
8790 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8791 *) echo "Something terribly wrong happened during testing.";;
8792 esac
8793 rd_nodata=`$cat try.ret`
8794 echo "A read() system call with no data present returns $rd_nodata."
8795 case "$rd_nodata" in
8796 0|-1) ;;
8797 *)
8798 echo "(That's peculiar, fixing that to be -1.)"
8799 rd_nodata=-1
8800 ;;
8801 esac
8802 case "$eagain" in
8803 '')
8804 echo "Forcing errno EAGAIN on read() with no data available."
8805 eagain=EAGAIN
8806 ;;
8807 *)
8808 echo "Your read() sets errno to $eagain when no data is available."
8809 ;;
8810 esac
8811 status=`$cat try.err`
8812 case "$status" in
8813 0) echo "And it correctly returns 0 to signal EOF.";;
8814 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8815 *) echo "However, your read() returns '$status' on EOF??";;
8816 esac
8817 val="$define"
8818 if test "$status" = "$rd_nodata"; then
8819 echo "WARNING: you can't distinguish between EOF and no data!"
8820 val="$undef"
8821 fi
8822 else
8823 echo "I can't compile the test program--assuming errno EAGAIN will do."
8824 eagain=EAGAIN
8825 fi
8826 set d_eofnblk
8827 eval $setvar
8828 ;;
8829*)
8830 echo "Using $hint value $eagain."
8831 echo "Your read() returns $rd_nodata when no data is present."
8832 case "$d_eofnblk" in
8833 "$define") echo "And you can see EOF because read() returns 0.";;
8834 "$undef") echo "But you can't see EOF status from read() returned value.";;
8835 *)
8836 echo "(Assuming you can't see EOF status from read anyway.)"
8837 d_eofnblk=$undef
8838 ;;
8839 esac
8840 ;;
8841esac
8842$rm -f try try.* .out core head.c mtry
8843
8844: see if fchmod exists
8845set fchmod d_fchmod
8846eval $inlibc
8847
8848: see if fchown exists
8849set fchown d_fchown
8850eval $inlibc
8851
8852: see if this is an fcntl system
8853set fcntl d_fcntl
8854eval $inlibc
8855
9d9004a9
AD
8856echo " "
8857: See if fcntl-based locking works.
8858$cat >try.c <<'EOCP'
8859#include <stdlib.h>
8860#include <unistd.h>
8861#include <fcntl.h>
8862int main() {
8863#if defined(F_SETLK) && defined(F_SETLKW)
8864 struct flock flock;
8865 int retval, fd;
8866 fd = open("try.c", O_RDONLY);
8867 flock.l_type = F_RDLCK;
8868 flock.l_whence = SEEK_SET;
8869 flock.l_start = flock.l_len = 0;
8870 retval = fcntl(fd, F_SETLK, &flock);
8871 close(fd);
8872 (retval < 0 ? exit(2) : exit(0));
8873#else
8874 exit(2);
8875#endif
8876}
8877EOCP
8878echo "Checking if fcntl-based file locking works... "
8879case "$d_fcntl" in
8880"$define")
8881 set try
8882 if eval $compile_ok; then
8883 if ./try; then
8884 echo "Yes, it seems to work."
8885 val="$define"
8886 else
8887 echo "Nope, it didn't work."
8888 val="$undef"
8889 fi
8890 else
8891 echo "I'm unable to compile the test program, so I'll assume not."
8892 val="$undef"
8893 fi
8894 ;;
8895*) val="$undef";
8896 echo "Nope, since you don't even have fcntl()."
8897 ;;
8898esac
8899set d_fcntl_can_lock
8900eval $setvar
8901$rm -f try*
8902
8903
b4eb6b3d
JH
8904hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8905while $test $# -ge 2; do
8906 case "$1" in
8907 $define) echo "#include <$2>";;
8908 esac ;
8909 shift 2;
8910done > try.c;
8911echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8912set try;
8913if eval $compile; then
8914 val="$define";
8915else
8916 val="$undef";
8917fi;
8918set $varname;
8919eval $setvar;
8920$rm -f try.c try.o'
8921
8922socketlib=''
8923sockethdr=''
8924: see whether socket exists
8925echo " "
8926$echo $n "Hmm... $c" >&4
8927if set socket val -f d_socket; eval $csym; $val; then
8928 echo "Looks like you have Berkeley networking support." >&4
8929 d_socket="$define"
8930 if set setsockopt val -f; eval $csym; $val; then
8931 d_oldsock="$undef"
8932 else
8933 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8934 d_oldsock="$define"
8935 fi
8936else
8937 if $contains socklib libc.list >/dev/null 2>&1; then
8938 echo "Looks like you have Berkeley networking support." >&4
8939 d_socket="$define"
8940 : we will have to assume that it supports the 4.2 BSD interface
8941 d_oldsock="$undef"
8942 else
8943 echo "You don't have Berkeley networking in libc$_a..." >&4
8944 if test "X$d_socket" = "X$define"; then
8945 echo "...but you seem to believe that you have sockets." >&4
8946 else
8947 for net in net socket
8948 do
8949 if test -f /usr/lib/lib$net$_a; then
8950 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
8951 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8952 if $contains socket libc.list >/dev/null 2>&1; then
8953 d_socket="$define"
8954 socketlib="-l$net"
8955 case "$net" in
8956 net)
8957 echo "...but the Wollongong group seems to have hacked it in." >&4
8958 sockethdr="-I/usr/netinclude"
8959 ;;
8960 esac
8961 echo "Found Berkeley sockets interface in lib$net." >& 4
8962 if $contains setsockopt libc.list >/dev/null 2>&1; then
8963 d_oldsock="$undef"
8964 else
8965 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8966 d_oldsock="$define"
8967 fi
8968 break
8969 fi
8970 fi
8971 done
8972 if test "X$d_socket" != "X$define"; then
8973 echo "or anywhere else I see." >&4
8974 d_socket="$undef"
8975 d_oldsock="$undef"
8976 fi
8977 fi
8978 fi
8979fi
8980
8981: see if socketpair exists
8982set socketpair d_sockpair
8983eval $inlibc
8984
8985
8986echo " "
8987echo "Checking the availability of certain socket constants..." >& 4
8988for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8989 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8990 $cat >try.c <<EOF
8991#include <sys/types.h>
8992#include <sys/socket.h>
8993int main() {
8994 int i = $ENUM;
8995}
8996EOF
8997 val="$undef"
8998 set try; if eval $compile; then
8999 val="$define"
9000 fi
9001 set d_${enum}; eval $setvar
9002 $rm -f try.c try
9003done
9004
9005: see if sys/select.h has to be included
9006set sys/select.h i_sysselct
9007eval $inhdr
9008
9009: see if we should include time.h, sys/time.h, or both
9010echo " "
9011if test "X$timeincl" = X; then
9012 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9013 $echo $n "I'm now running the test program...$c"
9014 $cat >try.c <<'EOCP'
9015#include <sys/types.h>
9016#ifdef I_TIME
9017#include <time.h>
9018#endif
9019#ifdef I_SYSTIME
9020#ifdef SYSTIMEKERNEL
9021#define KERNEL
9022#endif
9023#include <sys/time.h>
9024#endif
9025#ifdef I_SYSSELECT
9026#include <sys/select.h>
9027#endif
9028int main()
9029{
9030 struct tm foo;
9031#ifdef S_TIMEVAL
9032 struct timeval bar;
9033#endif
9034#ifdef S_TIMEZONE
9035 struct timezone tzp;
9036#endif
9037 if (foo.tm_sec == foo.tm_sec)
9038 exit(0);
9039#ifdef S_TIMEVAL
9040 if (bar.tv_sec == bar.tv_sec)
9041 exit(0);
9042#endif
9043 exit(1);
9044}
9045EOCP
9046 flags=''
9047 for s_timezone in '-DS_TIMEZONE' ''; do
9048 sysselect=''
9049 for s_timeval in '-DS_TIMEVAL' ''; do
9050 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9051 for i_time in '' '-DI_TIME'; do
9052 for i_systime in '-DI_SYSTIME' ''; do
9053 case "$flags" in
9054 '') $echo $n ".$c"
9055 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9056 if eval $compile; then
9057 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9058 shift
9059 flags="$*"
9060 echo " "
9061 $echo $n "Succeeded with $flags$c"
9062 fi
9063 ;;
9064 esac
9065 done
9066 done
9067 done
9068 done
9069 done
9070 timeincl=''
9071 echo " "
9072 case "$flags" in
9073 *SYSTIMEKERNEL*) i_systimek="$define"
9074 timeincl=`./findhdr sys/time.h`
9075 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9076 *) i_systimek="$undef";;
9077 esac
9078 case "$flags" in
9079 *I_TIME*) i_time="$define"
9080 timeincl=`./findhdr time.h`" $timeincl"
9081 echo "We'll include <time.h>." >&4;;
9082 *) i_time="$undef";;
9083 esac
9084 case "$flags" in
9085 *I_SYSTIME*) i_systime="$define"
9086 timeincl=`./findhdr sys/time.h`" $timeincl"
9087 echo "We'll include <sys/time.h>." >&4;;
9088 *) i_systime="$undef";;
9089 esac
9090 $rm -f try.c try
9091fi
9092
9093: check for fd_set items
9094$cat <<EOM
9095
9096Checking to see how well your C compiler handles fd_set and friends ...
9097EOM
9098$cat >fd_set.c <<EOCP
9099#$i_systime I_SYS_TIME
9100#$i_sysselct I_SYS_SELECT
9101#$d_socket HAS_SOCKET
9102#include <sys/types.h>
9103#ifdef HAS_SOCKET
9104#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9105#endif
9106#ifdef I_SYS_TIME
9107#include <sys/time.h>
9108#endif
9109#ifdef I_SYS_SELECT
9110#include <sys/select.h>
9111#endif
9112int main() {
9113 fd_set fds;
9114
9115#ifdef TRYBITS
9116 if(fds.fds_bits);
9117#endif
9118
9119#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9120 exit(0);
9121#else
9122 exit(1);
9123#endif
9124}
9125EOCP
9126set fd_set -DTRYBITS
9127if eval $compile; then
9128 d_fds_bits="$define"
9129 d_fd_set="$define"
9130 echo "Well, your system knows about the normal fd_set typedef..." >&4
9131 if ./fd_set; then
9132 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9133 d_fd_macros="$define"
9134 else
9135 $cat >&4 <<'EOM'
9136but not the normal fd_set macros! Gaaack! I'll have to cover for you.
9137EOM
9138 d_fd_macros="$undef"
9139 fi
9140else
9141 $cat <<'EOM'
9142Hmm, your compiler has some difficulty with fd_set. Checking further...
9143EOM
9144 set fd_set
9145 if eval $compile; then
9146 d_fds_bits="$undef"
9147 d_fd_set="$define"
9148 echo "Well, your system has some sort of fd_set available..." >&4
9149 if ./fd_set; then
9150 echo "and you have the normal fd_set macros." >&4
9151 d_fd_macros="$define"
9152 else
9153 $cat <<'EOM'
9154but not the normal fd_set macros! Gross! More work for me...
9155EOM
9156 d_fd_macros="$undef"
9157 fi
9158 else
9159 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
9160 d_fd_set="$undef"
9161 d_fds_bits="$undef"
9162 d_fd_macros="$undef"
9163 fi
9164fi
9165$rm -f fd_set*
9166
9167: see if fgetpos exists
9168set fgetpos d_fgetpos
9169eval $inlibc
9170
9171: see if flock exists
9172set flock d_flock
9173eval $inlibc
9174
9175: see if fork exists
9176set fork d_fork
9177eval $inlibc
9178
9179: see if pathconf exists
9180set pathconf d_pathconf
9181eval $inlibc
9182
9183: see if fpathconf exists
9184set fpathconf d_fpathconf
9185eval $inlibc
9186
9187
9188: check for fpos64_t
9189echo " "
9190echo "Checking to see if you have fpos64_t..." >&4
9191$cat >try.c <<EOCP
9192#include <stdio.h>
9193int main() { fpos64_t x = 7; }
9194EOCP
9195set try
9196if eval $compile; then
9197 val="$define"
9198 echo "You have fpos64_t."
9199else
9200 val="$undef"
9201 echo "You do not have fpos64_t."
9202 case "$fpossize" in
9203 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9204 esac
9205fi
9206$rm -f try.* try
9207set d_fpos64_t
9208eval $setvar
9209
9210: see if frexpl exists
9211set frexpl d_frexpl
9212eval $inlibc
9213
9214hasstruct='varname=$1; struct=$2; shift; shift;
9215while $test $# -ge 2; do
9216 case "$1" in
9217 $define) echo "#include <$2>";;
9218 esac ;
9219 shift 2;
9220done > try.c;
9221echo "int main () { struct $struct foo; }" >> try.c;
9222set try;
9223if eval $compile; then
9224 val="$define";
9225else
9226 val="$undef";
9227fi;
9228set $varname;
9229eval $setvar;
9230$rm -f try.c try.o'
9231
9232: see if this is a sys/param system
9233set sys/param.h i_sysparam
9234eval $inhdr
9235
9236: see if this is a sys/mount.h system
9237set sys/mount.h i_sysmount
9238eval $inhdr
9239
9240: see if sys/types.h has to be included
9241set sys/types.h i_systypes
9242eval $inhdr
9243
9244
9245echo " "
9246echo "Checking to see if your system supports struct fs_data..." >&4
9247set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9248eval $hasstruct
9249case "$d_fs_data_s" in
9250"$define") echo "Yes, it does." ;;
9251*) echo "No, it doesn't." ;;
9252esac
9253
9254: see if fseeko exists
9255set fseeko d_fseeko
9256eval $inlibc
9257case "$longsize" in
92588) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9259esac
9260
9261: see if fsetpos exists
9262set fsetpos d_fsetpos
9263eval $inlibc
9264
9265
9266: see if fstatfs exists
9267set fstatfs d_fstatfs
9268eval $inlibc
9269
9270
9271: see if statvfs exists
9272set statvfs d_statvfs
9273eval $inlibc
9274
9275: see if fstatvfs exists
9276set fstatvfs d_fstatvfs
9277eval $inlibc
9278
9279
411ab01c
JH
9280: see if fsync exists
9281set fsync d_fsync
9282eval $inlibc
9283
b4eb6b3d
JH
9284: see if ftello exists
9285set ftello d_ftello
9286eval $inlibc
9287case "$longsize" in
92888) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9289esac
9290
9291: see if getcwd exists
9292set getcwd d_getcwd
9293eval $inlibc
9294
9295: see if getespwnam exists
9296set getespwnam d_getespwnam
9297eval $inlibc
9298
9299
9300: see if getfsstat exists
9301set getfsstat d_getfsstat
9302eval $inlibc
9303
9304: see if getgrent exists
9305set getgrent d_getgrent
9306eval $inlibc
9307
9308: see if gethostbyaddr exists
9309set gethostbyaddr d_gethbyaddr
9310eval $inlibc
9311
9312: see if gethostbyname exists
9313set gethostbyname d_gethbyname
9314eval $inlibc
9315
9316: see if gethostent exists
9317set gethostent d_gethent
9318eval $inlibc
9319
9320: see how we will look up host name
9321echo " "
9322call=''
9323if set gethostname val -f d_gethname; eval $csym; $val; then
9324 echo 'gethostname() found.' >&4
9325 d_gethname="$define"
9326 call=gethostname
9327fi
9328if set uname val -f d_uname; eval $csym; $val; then
9329 if ./xenix; then
9330 $cat <<'EOM'
9331uname() was found, but you're running xenix, and older versions of xenix
9332have a broken uname(). If you don't really know whether your xenix is old
9333enough to have a broken system call, use the default answer.
9334
9335EOM
9336 dflt=y
9337 case "$d_uname" in
9338 "$define") dflt=n;;
9339 esac
9340 rp='Is your uname() broken?'
9341 . ./myread
9342 case "$ans" in
9343 n*) d_uname="$define"; call=uname;;
9344 esac
9345 else
9346 echo 'uname() found.' >&4
9347 d_uname="$define"
9348 case "$call" in
9349 '') call=uname ;;
9350 esac
9351 fi
9352fi
9353case "$d_gethname" in
9354'') d_gethname="$undef";;
9355esac
9356case "$d_uname" in
9357'') d_uname="$undef";;
9358esac
9359case "$d_uname$d_gethname" in
9360*define*)
9361 dflt=n
9362 cat <<EOM
9363
9364Every now and then someone has a $call() that lies about the hostname
9365but can't be fixed for political or economic reasons. If you wish, I can
9366pretend $call() isn't there and maybe compute hostname at run-time
9367thanks to the '$phostname' command.
9368
9369EOM
9370 rp="Shall I ignore $call() from now on?"
9371 . ./myread
9372 case "$ans" in
9373 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9374 esac;;
9375esac
9376case "$phostname" in
9377'') aphostname='';;
9378*) case "$aphostname" in
9379 /*) ;;
9380 *) set X $phostname
9381 shift
9382 file=$1
9383 shift
9384 file=`./loc $file $file $pth`
9385 aphostname=`echo $file $*`
9386 ;;
9387 esac
9388 ;;
9389esac
9390case "$d_uname$d_gethname" in
9391*define*) ;;
9392*)
9393 case "$phostname" in
9394 '')
9395 echo "There will be no way for $package to get your hostname." >&4;;
9396 *)
9397 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9398 ;;
9399 esac;;
9400esac
9401case "$d_phostname" in
9402'') d_phostname="$undef";;
9403esac
9404
9405: see if this is a netdb.h system
9406set netdb.h i_netdb
9407eval $inhdr
9408
9409: see if prototypes for various gethostxxx netdb.h functions are available
9410echo " "
9411set d_gethostprotos gethostent $i_netdb netdb.h
9412eval $hasproto
9413
9414: see if getlogin exists
9415set getlogin d_getlogin
9416eval $inlibc
9417
9418: see if getmnt exists
9419set getmnt d_getmnt
9420eval $inlibc
9421
9422: see if getmntent exists
9423set getmntent d_getmntent
9424eval $inlibc
9425
9426: see if getnetbyaddr exists
9427set getnetbyaddr d_getnbyaddr
9428eval $inlibc
9429
9430: see if getnetbyname exists
9431set getnetbyname d_getnbyname
9432eval $inlibc
9433
9434: see if getnetent exists
9435set getnetent d_getnent
9436eval $inlibc
9437
9438: see if prototypes for various getnetxxx netdb.h functions are available
9439echo " "
9440set d_getnetprotos getnetent $i_netdb netdb.h
9441eval $hasproto
9442
0c0643d0
JH
9443: see if getpagesize exists
9444set getpagesize d_getpagsz
9445eval $inlibc
9446
b4eb6b3d
JH
9447
9448: see if getprotobyname exists
9449set getprotobyname d_getpbyname
9450eval $inlibc
9451
9452: see if getprotobynumber exists
9453set getprotobynumber d_getpbynumber
9454eval $inlibc
9455
9456: see if getprotoent exists
9457set getprotoent d_getpent
9458eval $inlibc
9459
9460: see if getpgid exists
9461set getpgid d_getpgid
9462eval $inlibc
9463
9464: see if getpgrp2 exists
9465set getpgrp2 d_getpgrp2
9466eval $inlibc
9467
9468: see if getppid exists
9469set getppid d_getppid
9470eval $inlibc
9471
9472: see if getpriority exists
9473set getpriority d_getprior
9474eval $inlibc
9475
9476: see if prototypes for various getprotoxxx netdb.h functions are available
9477echo " "
9478set d_getprotoprotos getprotoent $i_netdb netdb.h
9479eval $hasproto
9480
9481: see if getprpwnam exists
9482set getprpwnam d_getprpwnam
9483eval $inlibc
9484
9485: see if getpwent exists
9486set getpwent d_getpwent
9487eval $inlibc
9488
9489
9490: see if getservbyname exists
9491set getservbyname d_getsbyname
9492eval $inlibc
9493
9494: see if getservbyport exists
9495set getservbyport d_getsbyport
9496eval $inlibc
9497
9498: see if getservent exists
9499set getservent d_getsent
9500eval $inlibc
9501
9502: see if prototypes for various getservxxx netdb.h functions are available
9503echo " "
9504set d_getservprotos getservent $i_netdb netdb.h
9505eval $hasproto
9506
9507: see if getspnam exists
9508set getspnam d_getspnam
9509eval $inlibc
9510
9511: see if gettimeofday or ftime exists
9512set gettimeofday d_gettimeod
9513eval $inlibc
9514case "$d_gettimeod" in
9515"$undef")
9516 set ftime d_ftime
9517 eval $inlibc
9518 ;;
9519*)
9520 val="$undef"; set d_ftime; eval $setvar
9521 ;;
9522esac
9523case "$d_gettimeod$d_ftime" in
9524"$undef$undef")
9525 echo " "
9526 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9527 ;;
9528esac
9529
9530: see if this is an grp system
9531set grp.h i_grp
9532eval $inhdr
9533
9534case "$i_grp" in
9535$define)
9536 xxx=`./findhdr grp.h`
9537 $cppstdin $cppflags $cppminus < $xxx >$$.h
9538
9539 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9540 val="$define"
9541 else
9542 val="$undef"
9543 fi
9544 set d_grpasswd
9545 eval $setvar
9546
9547 $rm -f $$.h
9548 ;;
9549*)
9550 val="$undef";
9551 set d_grpasswd; eval $setvar
9552 ;;
9553esac
9554
9555: see if hasmntopt exists
9556set hasmntopt d_hasmntopt
9557eval $inlibc
9558
9559: see if this is a netinet/in.h or sys/in.h system
9560set netinet/in.h i_niin sys/in.h i_sysin
9561eval $inhdr
9562
9563: see if arpa/inet.h has to be included
9564set arpa/inet.h i_arpainet
9565eval $inhdr
9566
9567: see if htonl --and friends-- exists
9568val=''
9569set htonl val
9570eval $inlibc
9571
9572: Maybe they are macros.
9573case "$val" in
9574$undef)
9575 $cat >htonl.c <<EOM
9576#include <stdio.h>
9577#include <sys/types.h>
9578#$i_niin I_NETINET_IN
9579#$i_sysin I_SYS_IN
9580#$i_arpainet I_ARPA_INET
9581#ifdef I_NETINET_IN
9582#include <netinet/in.h>
9583#endif
9584#ifdef I_SYS_IN
9585#include <sys/in.h>
9586#endif
9587#ifdef I_ARPA_INET
9588#include <arpa/inet.h>
9589#endif
9590#ifdef htonl
9591printf("Defined as a macro.");
9592#endif
9593EOM
9594 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9595 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9596 val="$define"
9597 echo "But it seems to be defined as a macro." >&4
9598 fi
9599 $rm -f htonl.?
9600 ;;
9601esac
9602set d_htonl
9603eval $setvar
9604
9605: see if iconv exists
9606set iconv d_iconv
9607eval $inlibc
9608
9609: index or strchr
9610echo " "
9611if set index val -f; eval $csym; $val; then
9612 if set strchr val -f d_strchr; eval $csym; $val; then
9613 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9614 val="$define"
9615 vali="$undef"
9616 echo "strchr() found." >&4
9617 else
9618 val="$undef"
9619 vali="$define"
9620 echo "index() found." >&4
9621 fi
9622 else
9623 val="$undef"
9624 vali="$define"
9625 echo "index() found." >&4
9626 fi
9627else
9628 if set strchr val -f d_strchr; eval $csym; $val; then
9629 val="$define"
9630 vali="$undef"
9631 echo "strchr() found." >&4
9632 else
9633 echo "No index() or strchr() found!" >&4
9634 val="$undef"
9635 vali="$undef"
9636 fi
9637fi
9638set d_strchr; eval $setvar
9639val="$vali"
9640set d_index; eval $setvar
9641
9642: check whether inet_aton exists
9643set inet_aton d_inetaton
9644eval $inlibc
9645
9646: see if inttypes.h is available
9647: we want a real compile instead of Inhdr because some systems
9648: have an inttypes.h which includes non-existent headers
9649echo " "
9650$cat >try.c <<EOCP
9651#include <inttypes.h>
9652int main() {
9653 static int32_t foo32 = 0x12345678;
9654}
9655EOCP
9656set try
9657if eval $compile; then
9658 echo "<inttypes.h> found." >&4
9659 val="$define"
9660else
9661 echo "<inttypes.h> NOT found." >&4
9662 val="$undef"
9663fi
9664$rm -f try.c try
9665set i_inttypes
9666eval $setvar
9667
9668: check for int64_t
9669echo " "
9670echo "Checking to see if you have int64_t..." >&4
9671$cat >try.c <<EOCP
9672#include <sys/types.h>
9673#$i_inttypes I_INTTYPES
9674#ifdef I_INTTYPES
9675#include <inttypes.h>
9676#endif
9677int main() { int64_t x = 7; }
9678EOCP
9679set try
9680if eval $compile; then
9681 val="$define"
9682 echo "You have int64_t."
9683else
9684 val="$undef"
9685 echo "You do not have int64_t."
9686fi
9687$rm -f try try.*
9688set d_int64_t
9689eval $setvar
9690
9691: Look for isascii
9692echo " "
9693$cat >isascii.c <<'EOCP'
9694#include <stdio.h>
9695#include <ctype.h>
9696int main() {
9697 int c = 'A';
9698 if (isascii(c))
9699 exit(0);
9700 else
9701 exit(1);
9702}
9703EOCP
9704set isascii
9705if eval $compile; then
9706 echo "isascii() found." >&4
9707 val="$define"
9708else
9709 echo "isascii() NOT found." >&4
9710 val="$undef"
9711fi
9712set d_isascii
9713eval $setvar
9714$rm -f isascii*
9715
9716: see if isnan exists
9717set isnan d_isnan
9718eval $inlibc
9719
9720: see if isnanl exists
9721set isnanl d_isnanl
9722eval $inlibc
9723
9724: see if killpg exists
9725set killpg d_killpg
9726eval $inlibc
9727
9728: see if lchown exists
9729echo " "
9730$cat > try.c <<'EOCP'
9731/* System header to define __stub macros and hopefully few prototypes,
9732 which can conflict with char lchown(); below. */
9733#include <assert.h>
9734/* Override any gcc2 internal prototype to avoid an error. */
9735/* We use char because int might match the return type of a gcc2
9736 builtin and then its argument prototype would still apply. */
9737char lchown();
9738int main() {
9739 /* The GNU C library defines this for functions which it implements
9740 to always fail with ENOSYS. Some functions are actually named
9741 something starting with __ and the normal name is an alias. */
9742#if defined (__stub_lchown) || defined (__stub___lchown)
9743choke me
9744#else
9745lchown();
9746#endif
9747; return 0; }
9748EOCP
9749set try
9750if eval $compile; then
9751 $echo "lchown() found." >&4
9752 val="$define"
9753else
9754 $echo "lchown() NOT found." >&4
9755 val="$undef"
9756fi
9757set d_lchown
9758eval $setvar
9759
9760: See if number of significant digits in a double precision number is known
9761echo " "
9762$cat >ldbl_dig.c <<EOM
9763#$i_limits I_LIMITS
9764#$i_float I_FLOAT
9765#ifdef I_LIMITS
9766#include <limits.h>
9767#endif
9768#ifdef I_FLOAT
9769#include <float.h>
9770#endif
9771#ifdef LDBL_DIG
9772printf("Contains LDBL_DIG");
9773#endif
9774EOM
9775$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9776if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9777 echo "LDBL_DIG found." >&4
9778 val="$define"
9779else
9780 echo "LDBL_DIG NOT found." >&4
9781 val="$undef"
9782fi
9783$rm -f ldbl_dig.?
9784set d_ldbl_dig
9785eval $setvar
9786
9787: see if link exists
9788set link d_link
9789eval $inlibc
9790
9791: see if localeconv exists
9792set localeconv d_locconv
9793eval $inlibc
9794
9795: see if lockf exists
9796set lockf d_lockf
9797eval $inlibc
9798
9799: check for long long
9800echo " "
9801echo "Checking to see if you have long long..." >&4
9802echo 'int main() { long long x = 7; return 0; }' > try.c
9803set try
9804if eval $compile; then
9805 val="$define"
9806 echo "You have long long."
9807else
9808 val="$undef"
9809 echo "You do not have long long."
9810fi
9811$rm try.*
9812set d_longlong
9813eval $setvar
9814
9815: check for length of long long
9816case "${d_longlong}${longlongsize}" in
9817$define)
9818 echo " "
9819 echo "Checking to see how big your long longs are..." >&4
9820 $cat >try.c <<'EOCP'
9821#include <stdio.h>
9822int main()
9823{
9824 printf("%d\n", (int)sizeof(long long));
9825 return(0);
9826}
9827EOCP
9828 set try
9829 if eval $compile_ok; then
9830 longlongsize=`./try$exe_ext`
9831 echo "Your long longs are $longlongsize bytes long."
9832 else
9833 dflt='8'
9834 echo " "
9835 echo "(I can't seem to compile the test program. Guessing...)"
9836 rp="What is the size of a long long (in bytes)?"
9837 . ./myread
9838 longlongsize="$ans"
9839 fi
9840 if $test "X$longsize" = "X$longlongsize"; then
9841 echo "(That isn't any different from an ordinary long.)"
9842 fi
9843 ;;
9844esac
9845$rm -f try.* try
9846
9847: see if prototype for lseek is available
9848echo " "
9849set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9850eval $hasproto
9851
9852: see if lstat exists
9853set lstat d_lstat
9854eval $inlibc
9855
9856: see if madvise exists
9857set madvise d_madvise
9858eval $inlibc
9859
9860: see if mblen exists
9861set mblen d_mblen
9862eval $inlibc
9863
9864: see if mbstowcs exists
9865set mbstowcs d_mbstowcs
9866eval $inlibc
9867
9868: see if mbtowc exists
9869set mbtowc d_mbtowc
9870eval $inlibc
9871
9872: see if memchr exists
9873set memchr d_memchr
9874eval $inlibc
9875
9876: see if memcmp exists
9877set memcmp d_memcmp
9878eval $inlibc
9879
9880: see if memcpy exists
9881set memcpy d_memcpy
9882eval $inlibc
9883
9884: see if memmove exists
9885set memmove d_memmove
9886eval $inlibc
9887
9888: see if memset exists
9889set memset d_memset
9890eval $inlibc
9891
9892: see if mkdir exists
9893set mkdir d_mkdir
9894eval $inlibc
9895
9896: see if mkdtemp exists
9897set mkdtemp d_mkdtemp
9898eval $inlibc
9899
9900: see if mkfifo exists
9901set mkfifo d_mkfifo
9902eval $inlibc
9903
9904: see if mkstemp exists
9905set mkstemp d_mkstemp
9906eval $inlibc
9907
9908: see if mkstemps exists
9909set mkstemps d_mkstemps
9910eval $inlibc
9911
9912: see if mktime exists
9913set mktime d_mktime
9914eval $inlibc
9915
9916: see if this is a sys/mman.h system
9917set sys/mman.h i_sysmman
9918eval $inhdr
9919
9920: see if mmap exists
9921set mmap d_mmap
9922eval $inlibc
9923: see what shmat returns
9924: default to something harmless
9925mmaptype='void *'
9926case "$i_sysmman$d_mmap" in
9927"$define$define")
9928 $cat >mmap.c <<'END'
9929#include <sys/mman.h>
9930void *mmap();
9931END
9932 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9933 mmaptype='void *'
9934 else
9935 mmaptype='caddr_t'
9936 fi
9937 echo "and it returns ($mmaptype)." >&4
9938 ;;
9939esac
9940
9941
9942
9943: see if modfl exists
9944set modfl d_modfl
9945eval $inlibc
9946
9947: see if mprotect exists
9948set mprotect d_mprotect
9949eval $inlibc
9950
9951: see if msgctl exists
9952set msgctl d_msgctl
9953eval $inlibc
9954
9955: see if msgget exists
9956set msgget d_msgget
9957eval $inlibc
9958
9959: see if msgsnd exists
9960set msgsnd d_msgsnd
9961eval $inlibc
9962
9963: see if msgrcv exists
9964set msgrcv d_msgrcv
9965eval $inlibc
9966
9967: see how much of the 'msg*(2)' library is present.
9968h_msg=true
9969echo " "
9970case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9971*"$undef"*) h_msg=false;;
9972esac
9973case "$osname" in
9974freebsd)
9975 case "`ipcs 2>&1`" in
9976 "SVID messages"*"not configured"*)
9977 echo "Your $osname does not have the msg*(2) configured." >&4
9978 h_msg=false
9979 val="$undef"
9980 set msgctl d_msgctl
9981 eval $setvar
9982 set msgget d_msgget
9983 eval $setvar
9984 set msgsnd d_msgsnd
9985 eval $setvar
9986 set msgrcv d_msgrcv
9987 eval $setvar
9988 ;;
9989 esac
9990 ;;
9991esac
9992: we could also check for sys/ipc.h ...
9993if $h_msg && $test `./findhdr sys/msg.h`; then
9994 echo "You have the full msg*(2) library." >&4
9995 val="$define"
9996else
9997 echo "You don't have the full msg*(2) library." >&4
9998 val="$undef"
9999fi
10000set d_msg
10001eval $setvar
10002
10003: see if msync exists
10004set msync d_msync
10005eval $inlibc
10006
10007: see if munmap exists
10008set munmap d_munmap
10009eval $inlibc
10010
10011: see if nice exists
10012set nice d_nice
10013eval $inlibc
10014
10015
10016echo " "
10017echo "Checking which 64-bit integer type we could use..." >&4
10018
10019case "$intsize" in
100208) val=int
10021 set quadtype
10022 eval $setvar
10023 val='"unsigned int"'
10024 set uquadtype
10025 eval $setvar
10026 quadkind=1
10027 ;;
10028*) case "$longsize" in
10029 8) val=long
10030 set quadtype
10031 eval $setvar
10032 val='"unsigned long"'
10033 set uquadtype
10034 eval $setvar
10035 quadkind=2
10036 ;;
10037 *) case "$d_longlong:$longlongsize" in
10038 define:8)
10039 val='"long long"'
10040 set quadtype
10041 eval $setvar
10042 val='"unsigned long long"'
10043 set uquadtype
10044 eval $setvar
10045 quadkind=3
10046 ;;
10047 *) case "$d_int64_t" in
10048 define)
10049 val=int64_t
10050 set quadtype
10051 eval $setvar
10052 val=uint64_t
10053 set uquadtype
10054 eval $setvar
10055 quadkind=4
10056 ;;
10057 esac
10058 ;;
10059 esac
10060 ;;
10061 esac
10062 ;;
10063esac
10064
10065case "$quadtype" in
10066'') echo "Alas, no 64-bit integer types in sight." >&4
10067 d_quad="$undef"
10068 ;;
10069*) if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10070 verb="will"
10071 else
10072 verb="could"
10073 fi
10074 echo "We $verb use '$quadtype' for 64-bit integers." >&4
10075 d_quad="$define"
10076 ;;
10077esac
10078
10079: check for length of character
10080echo " "
10081case "$charsize" in
10082'')
10083 echo "Checking to see how big your characters are (hey, you never know)..." >&4
10084 $cat >try.c <<'EOCP'
10085#include <stdio.h>
10086int main()
10087{
10088 printf("%d\n", (int)sizeof(char));
10089 exit(0);
10090}
10091EOCP
10092 set try
10093 if eval $compile_ok; then
10094 dflt=`./try`
10095 else
10096 dflt='1'
10097 echo "(I can't seem to compile the test program. Guessing...)"
10098 fi
10099 ;;
10100*)
10101 dflt="$charsize"
10102 ;;
10103esac
10104rp="What is the size of a character (in bytes)?"
10105. ./myread
10106charsize="$ans"
10107$rm -f try.c try
10108
1d1be0dc
NC
10109: check for volatile keyword
10110echo " "
10111echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10112$cat >try.c <<'EOCP'
10113int main()
10114{
10115 typedef struct _goo_struct goo_struct;
10116 goo_struct * volatile goo = ((goo_struct *)0);
10117 struct _goo_struct {
10118 long long_int;
10119 int reg_int;
10120 char char_var;
10121 };
10122 typedef unsigned short foo_t;
10123 char *volatile foo;
10124 volatile int bar;
10125 volatile foo_t blech;
10126 foo = foo;
10127}
10128EOCP
10129if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10130 val="$define"
10131 echo "Yup, it does."
10132else
10133 val="$undef"
10134 echo "Nope, it doesn't."
10135fi
10136set d_volatile
10137eval $setvar
10138$rm -f try.*
10139
b4eb6b3d
JH
10140
10141echo " "
10142$echo "Choosing the C types to be used for Perl's internal types..." >&4
10143
10144case "$use64bitint:$d_quad:$quadtype" in
10145define:define:?*)
10146 ivtype="$quadtype"
10147 uvtype="$uquadtype"
10148 ivsize=8
10149 uvsize=8
10150 ;;
10151*) ivtype="long"
10152 uvtype="unsigned long"
10153 ivsize=$longsize
10154 uvsize=$longsize
10155 ;;
10156esac
10157
10158case "$uselongdouble:$d_longdbl" in
10159define:define)
10160 nvtype="long double"
10161 nvsize=$longdblsize
10162 ;;
10163*) nvtype=double
10164 nvsize=$doublesize
10165 ;;
10166esac
10167
10168$echo "(IV will be "$ivtype", $ivsize bytes)"
10169$echo "(UV will be "$uvtype", $uvsize bytes)"
10170$echo "(NV will be "$nvtype", $nvsize bytes)"
10171
10172$cat >try.c <<EOCP
10173#$i_inttypes I_INTTYPES
10174#ifdef I_INTTYPES
10175#include <inttypes.h>
10176#endif
10177#include <stdio.h>
10178int main() {
10179#ifdef INT8
10180 int8_t i = INT8_MAX;
10181 uint8_t u = UINT8_MAX;
10182 printf("int8_t\n");
10183#endif
10184#ifdef INT16
10185 int16_t i = INT16_MAX;
10186 uint16_t i = UINT16_MAX;
10187 printf("int16_t\n");
10188#endif
10189#ifdef INT32
10190 int32_t i = INT32_MAX;
10191 uint32_t u = UINT32_MAX;
10192 printf("int32_t\n");
10193#endif
10194}
10195EOCP
10196
10197case "$i8type" in
10198'') case "$charsize" in
10199 1) i8type=char
10200 u8type="unsigned char"
10201 i8size=$charsize
10202 u8size=$charsize
10203 ;;
10204 esac
10205 ;;
10206esac
10207case "$i8type" in
10208'') set try -DINT8
10209 if eval $compile; then
10210 case "`./try$exe_ext`" in
10211 int8_t) i8type=int8_t
10212 u8type=uint8_t
10213 i8size=1
10214 u8size=1
10215 ;;
10216 esac
10217 fi
10218 ;;
10219esac
10220case "$i8type" in
10221'') if $test $charsize -ge 1; then
10222 i8type=char
10223 u8type="unsigned char"
10224 i8size=$charsize
10225 u8size=$charsize
10226 fi
10227 ;;
10228esac
10229
10230case "$i16type" in
10231'') case "$shortsize" in
10232 2) i16type=short
10233 u16type="unsigned short"
10234 i16size=$shortsize
10235 u16size=$shortsize
10236 ;;
10237 esac
10238 ;;
10239esac
10240case "$i16type" in
10241'') set try -DINT16
10242 if eval $compile; then
10243 case "`./try$exe_ext`" in
10244 int16_t)
10245 i16type=int16_t
10246 u16type=uint16_t
10247 i16size=2
10248 u16size=2
10249 ;;
10250 esac
10251 fi
10252 ;;
10253esac
10254case "$i16type" in
10255'') if $test $shortsize -ge 2; then
10256 i16type=short
10257 u16type="unsigned short"
10258 i16size=$shortsize
10259 u16size=$shortsize
10260 fi
10261 ;;
10262esac
10263
10264case "$i32type" in
10265'') case "$longsize" in
10266 4) i32type=long
10267 u32type="unsigned long"
10268 i32size=$longsize
10269 u32size=$longsize
10270 ;;
10271 *) case "$intsize" in
10272 4) i32type=int
10273 u32type="unsigned int"
10274 i32size=$intsize
10275 u32size=$intsize
10276 ;;
10277 esac
10278 ;;
10279 esac
10280 ;;
10281esac
10282case "$i32type" in
10283'') set try -DINT32
10284 if eval $compile; then
10285 case "`./try$exe_ext`" in
10286 int32_t)
10287 i32type=int32_t
10288 u32type=uint32_t
10289 i32size=4
10290 u32size=4
10291 ;;
10292 esac
10293 fi
10294 ;;
10295esac
10296case "$i32type" in
10297'') if $test $intsize -ge 4; then
10298 i32type=int
10299 u32type="unsigned int"
10300 i32size=$intsize
10301 u32size=$intsize
10302 fi
10303 ;;
10304esac
10305
10306case "$i64type" in
10307'') case "$d_quad:$quadtype" in
10308 define:?*)
10309 i64type="$quadtype"
10310 u64type="$uquadtype"
10311 i64size=8
10312 u64size=8
10313 ;;
10314 esac
10315 ;;
10316esac
10317
1d1be0dc
NC
10318$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10319: volatile so that the compiler has to store it out to memory.
10320if test X"$d_volatile" = X"$define"; then
10321 volatile=volatile
10322fi
b4eb6b3d
JH
10323$cat <<EOP >try.c
10324#include <stdio.h>
1d1be0dc
NC
10325#include <sys/types.h>
10326#include <signal.h>
10327#ifdef SIGFPE
10328$volatile int bletched = 0;
10329$signal_t blech(s) int s; { bletched = 1; }
10330#endif
b4eb6b3d
JH
10331int main() {
10332 $uvtype u = 0;
1d1be0dc 10333 $nvtype d;
b4eb6b3d
JH
10334 int n = 8 * $uvsize;
10335 int i;
1d1be0dc
NC
10336#ifdef SIGFPE
10337 signal(SIGFPE, blech);
10338#endif
10339
b4eb6b3d
JH
10340 for (i = 0; i < n; i++) {
10341 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
10342 d = ($nvtype)u;
10343 if (($uvtype)d != u)
b4eb6b3d 10344 break;
1d1be0dc
NC
10345 if (d <= 0)
10346 break;
10347 d = ($nvtype)(u - 1);
10348 if (($uvtype)d != (u - 1))
10349 break;
10350#ifdef SIGFPE
10351 if (bletched) {
10352 break;
10353#endif
10354 }
b4eb6b3d 10355 }
efd1522b 10356 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
10357 exit(0);
10358}
10359EOP
1d1be0dc
NC
10360set try
10361
10362d_nv_preserves_uv="$undef"
10363if eval $compile; then
10364 d_nv_preserves_uv_bits="`./try$exe_ext`"
10365fi
10366case "$d_nv_preserves_uv_bits" in
10367\-[1-9]*)
10368 d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10369 $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs." 2>&1
10370 d_nv_preserves_uv="$define"
b4eb6b3d 10371 ;;
1d1be0dc
NC
10372[1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs." 2>&1
10373 d_nv_preserves_uv="$undef" ;;
10374*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
10375 d_nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
10376esac
10377
1d1be0dc
NC
10378$rm -f try.* try
10379
b4eb6b3d
JH
10380
10381: check for off64_t
10382echo " "
10383echo "Checking to see if you have off64_t..." >&4
10384$cat >try.c <<EOCP
10385#include <sys/types.h>
10386#include <unistd.h>
10387int main() { off64_t x = 7; }
10388EOCP
10389set try
10390if eval $compile; then
10391 val="$define"
10392 echo "You have off64_t."
10393else
10394 val="$undef"
10395 echo "You do not have off64_t."
10396 case "$lseeksize" in
10397 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10398 esac
10399fi
10400$rm -f try.* try
10401set d_off64_t
10402eval $setvar
10403
10404: see if POSIX threads are available
10405set pthread.h i_pthread
10406eval $inhdr
10407
10408
10409
10410
10411: how to create joinable pthreads
10412if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10413 echo " "
10414 echo "Checking what constant to use for creating joinable pthreads..." >&4
10415 $cat >try.c <<'EOCP'
10416#include <pthread.h>
10417int main() {
10418 int detachstate = JOINABLE;
10419}
10420EOCP
10421 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10422 if eval $compile; then
10423 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10424 val="$undef" # Yes, undef.
10425 set d_old_pthread_create_joinable
10426 eval $setvar
10427 val=""
10428 set old_pthread_create_joinable
10429 eval $setvar
10430 else
10431 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10432 if eval $compile; then
10433 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10434 val="$define"
10435 set d_old_pthread_create_joinable
10436 eval $setvar
10437 val=PTHREAD_CREATE_UNDETACHED
10438 set old_pthread_create_joinable
10439 eval $setvar
10440 else
10441 set try -DJOINABLE=__UNDETACHED
10442 if eval $compile; then
10443 echo "You seem to use __UNDETACHED." >&4
10444 val="$define"
10445 set d_old_pthread_create_joinable
10446 eval $setvar
10447 val=__UNDETACHED
10448 set old_pthread_create_joinable
10449 eval $setvar
10450 else
10451 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
10452 val="$define"
10453 set d_old_pthread_create_joinable
10454 eval $setvar
10455 val=0
10456 set old_pthread_create_joinable
10457 eval $setvar
10458 fi
10459 fi
10460 fi
10461 $rm -f try try.*
10462else
10463 d_old_pthread_create_joinable="$undef"
10464 old_pthread_create_joinable=""
10465fi
10466
10467: see if pause exists
10468set pause d_pause
10469eval $inlibc
10470
10471: see if pipe exists
10472set pipe d_pipe
10473eval $inlibc
10474
10475: see if poll exists
10476set poll d_poll
10477eval $inlibc
10478
10479
10480: see whether the various POSIXish _yields exist
10481$cat >try.c <<EOP
10482#include <pthread.h>
10483#include <stdio.h>
10484int main() {
10485#ifdef SCHED_YIELD
10486 sched_yield();
10487#else
10488#ifdef PTHREAD_YIELD
10489 pthread_yield();
10490#else
10491#ifdef PTHREAD_YIELD_NULL
10492 pthread_yield(NULL);
10493#endif
10494#endif
10495#endif
10496}
10497EOP
10498: see if sched_yield exists
10499set try -DSCHED_YIELD
10500if eval $compile; then
10501 val="$define"
10502 sched_yield='sched_yield()'
10503else
10504 val="$undef"
10505fi
10506case "$usethreads" in
10507$define)
10508 case "$val" in
10509 $define) echo 'sched_yield() found.' >&4 ;;
10510 *) echo 'sched_yield() NOT found.' >&4 ;;
10511 esac
10512esac
10513set d_sched_yield
10514eval $setvar
10515
10516: see if pthread_yield exists
10517set try -DPTHREAD_YIELD
10518if eval $compile; then
10519 val="$define"
10520 case "$sched_yield" in
10521 '') sched_yield='pthread_yield()' ;;
10522 esac
10523else
10524 set try -DPTHREAD_YIELD_NULL
10525 if eval $compile; then
10526 val="$define"
10527 case "$sched_yield" in
10528 '') sched_yield='pthread_yield(NULL)' ;;
10529 esac
10530 else
10531 val="$undef"
10532 fi
10533fi
10534case "$usethreads" in
10535$define)
10536 case "$val" in
10537 $define) echo 'pthread_yield() found.' >&4 ;;
10538 *) echo 'pthread_yield() NOT found.' >&4 ;;
10539 esac
10540 ;;
10541esac
10542set d_pthread_yield
10543eval $setvar
10544
10545case "$sched_yield" in
10546'') sched_yield=undef ;;
10547esac
10548
10549$rm -f try try.*
10550
10551: see if this is a pwd.h system
10552set pwd.h i_pwd
10553eval $inhdr
10554
10555case "$i_pwd" in
10556$define)
10557 xxx=`./findhdr pwd.h`
10558 $cppstdin $cppflags $cppminus < $xxx >$$.h
10559
10560 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10561 val="$define"
10562 else
10563 val="$undef"
10564 fi
10565 set d_pwquota
10566 eval $setvar
10567
10568 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10569 val="$define"
10570 else
10571 val="$undef"
10572 fi
10573 set d_pwage
10574 eval $setvar
10575
10576 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10577 val="$define"
10578 else
10579 val="$undef"
10580 fi
10581 set d_pwchange
10582 eval $setvar
10583
10584 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10585 val="$define"
10586 else
10587 val="$undef"
10588 fi
10589 set d_pwclass
10590 eval $setvar
10591
10592 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10593 val="$define"
10594 else
10595 val="$undef"
10596 fi
10597 set d_pwexpire
10598 eval $setvar
10599
10600 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10601 val="$define"
10602 else
10603 val="$undef"
10604 fi
10605 set d_pwcomment
10606 eval $setvar
10607
10608 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10609 val="$define"
10610 else
10611 val="$undef"
10612 fi
10613 set d_pwgecos
10614 eval $setvar
10615
10616 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10617 val="$define"
10618 else
10619 val="$undef"
10620 fi
10621 set d_pwpasswd
10622 eval $setvar
10623
10624 $rm -f $$.h
10625 ;;
10626*)
10627 val="$undef";
10628 set d_pwquota; eval $setvar
10629 set d_pwage; eval $setvar
10630 set d_pwchange; eval $setvar
10631 set d_pwclass; eval $setvar
10632 set d_pwexpire; eval $setvar
10633 set d_pwcomment; eval $setvar
10634 set d_pwgecos; eval $setvar
10635 set d_pwpasswd; eval $setvar
10636 ;;
10637esac
10638
10639: see if readdir and friends exist
10640set readdir d_readdir
10641eval $inlibc
10642set seekdir d_seekdir
10643eval $inlibc
10644set telldir d_telldir
10645eval $inlibc
10646set rewinddir d_rewinddir
10647eval $inlibc
10648
10649: see if readlink exists
10650set readlink d_readlink
10651eval $inlibc
10652
10653: see if rename exists
10654set rename d_rename
10655eval $inlibc
10656
10657: see if rmdir exists
10658set rmdir d_rmdir
10659eval $inlibc
10660
10661: see if memory.h is available.
10662val=''
10663set memory.h val
10664eval $inhdr
10665
10666: See if it conflicts with string.h
10667case "$val" in
10668$define)
10669 case "$strings" in
10670 '') ;;
10671 *)
10672 $cppstdin $cppflags $cppminus < $strings > mem.h
10673 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10674 echo " "
10675 echo "We won't be including <memory.h>."
10676 val="$undef"
10677 fi
10678 $rm -f mem.h
10679 ;;
10680 esac
10681esac
10682set i_memory
10683eval $setvar
10684
10685: can bcopy handle overlapping blocks?
10686val="$undef"
10687case "$d_bcopy" in
10688"$define")
10689 echo " "
10690 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10691 $cat >try.c <<EOCP
10692#$i_memory I_MEMORY
10693#$i_stdlib I_STDLIB
10694#$i_string I_STRING
10695#$i_unistd I_UNISTD
10696EOCP
10697 $cat >>try.c <<'EOCP'
10698#include <stdio.h>
10699#ifdef I_MEMORY
10700# include <memory.h>
10701#endif
10702#ifdef I_STDLIB
10703# include <stdlib.h>
10704#endif
10705#ifdef I_STRING
10706# include <string.h>
10707#else
10708# include <strings.h>
10709#endif
10710#ifdef I_UNISTD
10711# include <unistd.h> /* Needed for NetBSD */
10712#endif
10713int main()
10714{
10715char buf[128], abc[128];
10716char *b;
10717int len;
10718int off;
10719int align;
10720
10721bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10722
10723for (align = 7; align >= 0; align--) {
10724 for (len = 36; len; len--) {
10725 b = buf+align;
10726 bcopy(abc, b, len);
10727 for (off = 1; off <= len; off++) {
10728 bcopy(b, b+off, len);
10729 bcopy(b+off, b, len);
10730 if (bcmp(b, abc, len))
10731 exit(1);
10732 }
10733 }
10734}
10735exit(0);
10736}
10737EOCP
10738 set try
10739 if eval $compile_ok; then
10740 if ./try 2>/dev/null; then
10741 echo "Yes, it can."
10742 val="$define"
10743 else
10744 echo "It can't, sorry."
10745 case "$d_memmove" in
10746 "$define") echo "But that's Ok since you have memmove()." ;;
10747 esac
10748 fi
10749 else
10750 echo "(I can't compile the test program, so we'll assume not...)"
10751 case "$d_memmove" in
10752 "$define") echo "But that's Ok since you have memmove()." ;;
10753 esac
10754 fi
10755 ;;
10756esac
10757$rm -f try.* try core
10758set d_safebcpy
10759eval $setvar
10760
10761: can memcpy handle overlapping blocks?
10762val="$undef"
10763case "$d_memcpy" in
10764"$define")
10765 echo " "
10766 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10767 $cat >try.c <<EOCP
10768#$i_memory I_MEMORY
10769#$i_stdlib I_STDLIB
10770#$i_string I_STRING
10771#$i_unistd I_UNISTD
10772EOCP
10773 $cat >>try.c <<'EOCP'
10774#include <stdio.h>
10775#ifdef I_MEMORY
10776# include <memory.h>
10777#endif
10778#ifdef I_STDLIB
10779# include <stdlib.h>
10780#endif
10781#ifdef I_STRING
10782# include <string.h>
10783#else
10784# include <strings.h>
10785#endif
10786#ifdef I_UNISTD
10787# include <unistd.h> /* Needed for NetBSD */
10788#endif
10789int main()
10790{
10791char buf[128], abc[128];
10792char *b;
10793int len;
10794int off;
10795int align;
10796
10797/* Copy "abcde..." string to char abc[] so that gcc doesn't
10798 try to store the string in read-only memory. */
10799memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10800
10801for (align = 7; align >= 0; align--) {
10802 for (len = 36; len; len--) {
10803 b = buf+align;
10804 memcpy(b, abc, len);
10805 for (off = 1; off <= len; off++) {
10806 memcpy(b+off, b, len);
10807 memcpy(b, b+off, len);
10808 if (memcmp(b, abc, len))
10809 exit(1);
10810 }
10811 }
10812}
10813exit(0);
10814}
10815EOCP
10816 set try
10817 if eval $compile_ok; then
10818 if ./try 2>/dev/null; then
10819 echo "Yes, it can."
10820 val="$define"
10821 else
10822 echo "It can't, sorry."
10823 case "$d_memmove" in
10824 "$define") echo "But that's Ok since you have memmove()." ;;
10825 esac
10826 fi
10827 else
10828 echo "(I can't compile the test program, so we'll assume not...)"
10829 case "$d_memmove" in
10830 "$define") echo "But that's Ok since you have memmove()." ;;
10831 esac
10832 fi
10833 ;;
10834esac
10835$rm -f try.* try core
10836set d_safemcpy
10837eval $setvar
10838
10839: can memcmp be trusted to compare relative magnitude?
10840val="$undef"
10841case "$d_memcmp" in
10842"$define")
10843 echo " "
10844 echo "Checking if your memcmp() can compare relative magnitude..." >&4
10845 $cat >try.c <<EOCP
10846#$i_memory I_MEMORY
10847#$i_stdlib I_STDLIB
10848#$i_string I_STRING
10849#$i_unistd I_UNISTD
10850EOCP
10851 $cat >>try.c <<'EOCP'
10852#include <stdio.h>
10853#ifdef I_MEMORY
10854# include <memory.h>
10855#endif
10856#ifdef I_STDLIB
10857# include <stdlib.h>
10858#endif
10859#ifdef I_STRING
10860# include <string.h>
10861#else
10862# include <strings.h>
10863#endif
10864#ifdef I_UNISTD
10865# include <unistd.h> /* Needed for NetBSD */
10866#endif
10867int main()
10868{
10869char a = -1;
10870char b = 0;
10871if ((a < b) && memcmp(&a, &b, 1) < 0)
10872 exit(1);
10873exit(0);
10874}
10875EOCP
10876 set try
10877 if eval $compile_ok; then
10878 if ./try 2>/dev/null; then
10879 echo "Yes, it can."
10880 val="$define"
10881 else
10882 echo "No, it can't (it uses signed chars)."
10883 fi
10884 else
10885 echo "(I can't compile the test program, so we'll assume not...)"
10886 fi
10887 ;;
10888esac
10889$rm -f try.* try core
10890set d_sanemcmp
10891eval $setvar
10892
10893: see if select exists
10894set select d_select
10895eval $inlibc
10896
10897: see if semctl exists
10898set semctl d_semctl
10899eval $inlibc
10900
10901: see if semget exists
10902set semget d_semget
10903eval $inlibc
10904
10905: see if semop exists
10906set semop d_semop
10907eval $inlibc
10908
10909: see how much of the 'sem*(2)' library is present.
10910h_sem=true
10911echo " "
10912case "$d_semctl$d_semget$d_semop" in
10913*"$undef"*) h_sem=false;;
10914esac
10915case "$osname" in
10916freebsd)
10917 case "`ipcs 2>&1`" in
10918 "SVID messages"*"not configured"*)
10919 echo "Your $osname does not have the sem*(2) configured." >&4
10920 h_sem=false
10921 val="$undef"
10922 set semctl d_semctl
10923 eval $setvar
10924 set semget d_semget
10925 eval $setvar
10926 set semop d_semop
10927 eval $setvar
10928 ;;
10929 esac
10930 ;;
10931esac
10932: we could also check for sys/ipc.h ...
10933if $h_sem && $test `./findhdr sys/sem.h`; then
10934 echo "You have the full sem*(2) library." >&4
10935 val="$define"
10936else
10937 echo "You don't have the full sem*(2) library." >&4
10938 val="$undef"
10939fi
10940set d_sem
10941eval $setvar
10942
10943: see whether sys/sem.h defines union semun
10944echo " "
10945$cat > try.c <<'END'
10946#include <sys/types.h>
10947#include <sys/ipc.h>
10948#include <sys/sem.h>
10949int main () { union semun semun; semun.buf = 0; }
10950END
10951set try
10952if eval $compile; then
10953 echo "You have union semun in <sys/sem.h>." >&4
10954 val="$define"
10955else
10956 echo "You do not have union semun in <sys/sem.h>." >&4
10957 val="$undef"
10958fi
10959$rm -f try try.c try.h
10960set d_union_semun
10961eval $setvar
10962
10963: see how to do semctl IPC_STAT
10964case "$d_sem" in
10965$define)
10966 : see whether semctl IPC_STAT can use union semun
10967 echo " "
10968 $cat > try.h <<END
10969#ifndef S_IRUSR
10970# ifdef S_IREAD
10971# define S_IRUSR S_IREAD
10972# define S_IWUSR S_IWRITE
10973# define S_IXUSR S_IEXEC
10974# else
10975# define S_IRUSR 0400
10976# define S_IWUSR 0200
10977# define S_IXUSR 0100
10978# endif
10979# define S_IRGRP (S_IRUSR>>3)
10980# define S_IWGRP (S_IWUSR>>3)
10981# define S_IXGRP (S_IXUSR>>3)
10982# define S_IROTH (S_IRUSR>>6)
10983# define S_IWOTH (S_IWUSR>>6)
10984# define S_IXOTH (S_IXUSR>>6)
10985#endif
10986#ifndef S_IRWXU
10987# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10988# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10989# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10990#endif
10991END
10992
10993 $cat > try.c <<END
10994#include <sys/types.h>
10995#include <sys/ipc.h>
10996#include <sys/sem.h>
10997#include <sys/stat.h>
10998#include <stdio.h>
10999#include <errno.h>
11000#include "try.h"
11001#ifndef errno
11002extern int errno;
11003#endif
11004#$d_union_semun HAS_UNION_SEMUN
11005int main() {
11006 union semun
11007#ifndef HAS_UNION_SEMUN
11008 {
11009 int val;
11010 struct semid_ds *buf;
11011 unsigned short *array;
11012 }
11013#endif
11014 arg;
11015 int sem, st;
11016
11017#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11018 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11019 if (sem > -1) {
11020 struct semid_ds argbuf;
11021 arg.buf = &argbuf;
11022# ifdef IPC_STAT
11023 st = semctl(sem, 0, IPC_STAT, arg);
11024 if (st == 0)
11025 printf("semun\n");
11026 else
11027# endif /* IPC_STAT */
11028 printf("semctl IPC_STAT failed: errno = %d\n", errno);
11029# ifdef IPC_RMID
11030 if (semctl(sem, 0, IPC_RMID, arg) != 0)
11031# endif /* IPC_RMID */
11032 printf("semctl IPC_RMID failed: errno = %d\n", errno);
11033 } else
11034#endif /* IPC_PRIVATE && ... */
11035 printf("semget failed: errno = %d\n", errno);
11036 return 0;
11037}
11038END
11039 val="$undef"
11040 set try
11041 if eval $compile; then
11042 xxx=`./try`
11043 case "$xxx" in
11044 semun) val="$define" ;;
11045 esac
11046 fi
11047 $rm -f try try.c
11048 set d_semctl_semun
11049 eval $setvar
11050 case "$d_semctl_semun" in
11051 $define)
11052 echo "You can use union semun for semctl IPC_STAT." >&4
11053 also='also'
11054 ;;
11055 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
11056 also=''
11057 ;;
11058 esac
11059
11060 : see whether semctl IPC_STAT can use struct semid_ds pointer
11061 $cat > try.c <<'END'
11062#include <sys/types.h>
11063#include <sys/ipc.h>
11064#include <sys/sem.h>
11065#include <sys/stat.h>
11066#include "try.h"
11067#include <stdio.h>
11068#include <errno.h>
11069#ifndef errno
11070extern int errno;
11071#endif
11072int main() {
11073 struct semid_ds arg;
11074 int sem, st;
11075
11076#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11077 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11078 if (sem > -1) {
11079# ifdef IPC_STAT
11080 st = semctl(sem, 0, IPC_STAT, &arg);
11081 if (st == 0)
11082 printf("semid_ds\n");
11083 else
11084# endif /* IPC_STAT */
11085 printf("semctl IPC_STAT failed: errno = %d\n", errno);
11086# ifdef IPC_RMID
11087 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11088# endif /* IPC_RMID */
11089 printf("semctl IPC_RMID failed: errno = %d\n", errno);
11090 } else
11091#endif /* IPC_PRIVATE && ... */
11092 printf("semget failed: errno = %d\n", errno);
11093
11094 return 0;
11095}
11096END
11097 val="$undef"
11098 set try
11099 if eval $compile; then
11100 xxx=`./try`
11101 case "$xxx" in
11102 semid_ds) val="$define" ;;
11103 esac
11104 fi
11105 $rm -f try try.c
11106 set d_semctl_semid_ds
11107 eval $setvar
11108 case "$d_semctl_semid_ds" in
11109 $define)
11110 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11111 ;;
11112 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11113 ;;
11114 esac
11115 $rm -f try.h
11116 ;;
11117*) val="$undef"
11118
11119 # We do not have the full sem*(2) library, so assume we can not
11120 # use either.
11121
11122 set d_semctl_semun
11123 eval $setvar
11124
11125 set d_semctl_semid_ds
11126 eval $setvar
11127 ;;
11128esac
11129
11130: see if setegid exists
11131set setegid d_setegid
11132eval $inlibc
11133
11134: see if seteuid exists
11135set seteuid d_seteuid
11136eval $inlibc
11137
11138: see if setgrent exists
11139set setgrent d_setgrent
11140eval $inlibc
11141
11142: see if sethostent exists
11143set sethostent d_sethent
11144eval $inlibc
11145
11146: see if setlinebuf exists
11147set setlinebuf d_setlinebuf
11148eval $inlibc
11149
11150: see if setlocale exists
11151set setlocale d_setlocale
11152eval $inlibc
11153
11154: see if setnetent exists
11155set setnetent d_setnent
11156eval $inlibc
11157
11158: see if setprotoent exists
11159set setprotoent d_setpent
11160eval $inlibc
11161
11162: see if setpgid exists
11163set setpgid d_setpgid
11164eval $inlibc
11165
11166: see if setpgrp2 exists
11167set setpgrp2 d_setpgrp2
11168eval $inlibc
11169
11170: see if setpriority exists
11171set setpriority d_setprior
11172eval $inlibc
11173
11174: see if setproctitle exists
11175set setproctitle d_setproctitle
11176eval $inlibc
11177
11178: see if setpwent exists
11179set setpwent d_setpwent
11180eval $inlibc
11181
11182: see if setregid exists
11183set setregid d_setregid
11184eval $inlibc
11185set setresgid d_setresgid
11186eval $inlibc
11187
11188: see if setreuid exists
11189set setreuid d_setreuid
11190eval $inlibc
11191set setresuid d_setresuid
11192eval $inlibc
11193
11194: see if setrgid exists
11195set setrgid d_setrgid
11196eval $inlibc
11197
11198: see if setruid exists
11199set setruid d_setruid
11200eval $inlibc
11201
11202: see if setservent exists
11203set setservent d_setsent
11204eval $inlibc
11205
11206: see if setsid exists
11207set setsid d_setsid
11208eval $inlibc
11209
11210: see if setvbuf exists
11211set setvbuf d_setvbuf
11212eval $inlibc
11213
11214: see if sfio.h is available
11215set sfio.h i_sfio
11216eval $inhdr
11217
11218
11219: see if sfio library is available
11220case "$i_sfio" in
11221$define)
11222 val=''
11223 set sfreserve val
11224 eval $inlibc
11225 ;;
11226*)
11227 val="$undef"
11228 ;;
11229esac
11230: Ok, but do we want to use it.
11231case "$val" in
11232$define)
11233 case "$usesfio" in
11234 true|$define|[yY]*) dflt='y';;
11235 *) dflt='n';;
11236 esac
11237 echo "$package can use the sfio library, but it is experimental."
11238 case "$useperlio" in
11239 "$undef")
11240 echo "For sfio also the PerlIO abstraction layer is needed."
11241 echo "Earlier you said you wouldn't want that."
11242 ;;
11243 esac
11244 rp="You seem to have sfio available, do you want to try using it?"
11245 . ./myread
11246 case "$ans" in
11247 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
11248 useperlio="$define"
11249 val="$define"
11250 ;;
11251 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
11252 val="$undef"
11253 : Remove sfio from list of libraries to use
11254 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11255 shift
11256 libs="$*"
11257 echo "libs = $libs" >&4
11258 ;;
11259 esac
11260 ;;
11261*) case "$usesfio" in
11262 true|$define|[yY]*)
11263 echo "Sorry, cannot find sfio on this machine." >&4
11264 echo "Ignoring your setting of usesfio=$usesfio." >&4
11265 val="$undef"
11266 ;;
11267 esac
11268 ;;
11269esac
11270set d_sfio
11271eval $setvar
11272case "$d_sfio" in
11273$define) usesfio='true';;
11274*) usesfio='false';;
11275esac
11276
11277: see if shmctl exists
11278set shmctl d_shmctl
11279eval $inlibc
11280
11281: see if shmget exists
11282set shmget d_shmget
11283eval $inlibc
11284
11285: see if shmat exists
11286set shmat d_shmat
11287eval $inlibc
11288: see what shmat returns
11289case "$d_shmat" in
11290"$define")
11291 $cat >shmat.c <<'END'
11292#include <sys/shm.h>
11293void *shmat();
11294END
11295 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11296 shmattype='void *'
11297 else
11298 shmattype='char *'
11299 fi
11300 echo "and it returns ($shmattype)." >&4
11301 : see if a prototype for shmat is available
11302 xxx=`./findhdr sys/shm.h`
11303 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11304 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11305 val="$define"
11306 else
11307 val="$undef"
11308 fi
11309 $rm -f shmat.[co]
11310 ;;
11311*)
11312 val="$undef"
11313 ;;
11314esac
11315set d_shmatprototype
11316eval $setvar
11317
11318: see if shmdt exists
11319set shmdt d_shmdt
11320eval $inlibc
11321
11322: see how much of the 'shm*(2)' library is present.
11323h_shm=true
11324echo " "
11325case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11326*"$undef"*) h_shm=false;;
11327esac
11328case "$osname" in
11329freebsd)
11330 case "`ipcs 2>&1`" in
11331 "SVID shared memory"*"not configured"*)
11332 echo "Your $osname does not have the shm*(2) configured." >&4
11333 h_shm=false
11334 val="$undef"
11335 set shmctl d_shmctl
11336 evat $setvar
11337 set shmget d_shmget
11338 evat $setvar
11339 set shmat d_shmat
11340 evat $setvar
11341 set shmdt d_shmdt
11342 evat $setvar
11343 ;;
11344 esac
11345 ;;
11346esac
11347: we could also check for sys/ipc.h ...
11348if $h_shm && $test `./findhdr sys/shm.h`; then
11349 echo "You have the full shm*(2) library." >&4
11350 val="$define"
11351else
11352 echo "You don't have the full shm*(2) library." >&4
11353 val="$undef"
11354fi
11355set d_shm
11356eval $setvar
11357
11358echo " "
11359: see if we have sigaction
11360if set sigaction val -f d_sigaction; eval $csym; $val; then
11361 echo 'sigaction() found.' >&4
11362 $cat > try.c <<'EOP'
11363#include <stdio.h>
11364#include <sys/types.h>
11365#include <signal.h>
11366int main()
11367{
11368 struct sigaction act, oact;
11369 act.sa_flags = 0;
11370 oact.sa_handler = 0;
11371 /* so that act and oact are used */
11372 exit(act.sa_flags == 0 && oact.sa_handler == 0);
11373}
11374EOP
11375 set try
11376 if eval $compile_ok; then
11377 val="$define"
11378 else
11379 echo "But you don't seem to have a useable struct sigaction." >&4
11380 val="$undef"
11381 fi
11382else
11383 echo 'sigaction NOT found.' >&4
11384 val="$undef"
11385fi
11386set d_sigaction; eval $setvar
11387$rm -f try try$_o try.c
11388
11389: see if sigsetjmp exists
11390echo " "
11391case "$d_sigsetjmp" in
11392'')
11393 $cat >try.c <<'EOP'
11394#include <setjmp.h>
11395sigjmp_buf env;
11396int set = 1;
11397int main()
11398{
11399 if (sigsetjmp(env,1))
11400 exit(set);
11401 set = 0;
11402 siglongjmp(env, 1);
11403 exit(1);
11404}
11405EOP
11406 set try
11407 if eval $compile; then
11408 if ./try >/dev/null 2>&1; then
11409 echo "POSIX sigsetjmp found." >&4
11410 val="$define"
11411 else
11412 $cat >&4 <<EOM
11413Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11414I'll ignore them.
11415EOM
11416 val="$undef"
11417 fi
11418 else
11419 echo "sigsetjmp not found." >&4
11420 val="$undef"
11421 fi
11422 ;;
11423*) val="$d_sigsetjmp"
11424 case "$d_sigsetjmp" in
11425 $define) echo "POSIX sigsetjmp found." >&4;;
11426 $undef) echo "sigsetjmp not found." >&4;;
11427 esac
11428 ;;
11429esac
11430set d_sigsetjmp
11431eval $setvar
11432$rm -f try.c try
11433
11434: see if socks5_init exists
11435set socks5_init d_socks5_init
11436eval $inlibc
11437
11438: see if sys/stat.h is available
11439set sys/stat.h i_sysstat
11440eval $inhdr
11441
11442
11443: see if stat knows about block sizes
11444echo " "
11445echo "Checking to see if your struct stat has st_blocks field..." >&4
11446set d_statblks stat st_blocks $i_sysstat sys/stat.h
11447eval $hasfield
11448
11449
11450: see if this is a sys/vfs.h system
11451set sys/vfs.h i_sysvfs
11452eval $inhdr
11453
11454
11455: see if this is a sys/statfs.h system
11456set sys/statfs.h i_sysstatfs
11457eval $inhdr
11458
11459
11460echo " "
11461echo "Checking to see if your system supports struct statfs..." >&4
11462set 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
11463eval $hasstruct
11464case "$d_statfs_s" in
11465"$define") echo "Yes, it does." ;;
11466*) echo "No, it doesn't." ;;
11467esac
11468
11469
11470
11471: see if struct statfs knows about f_flags
11472case "$d_statfs_s" in
11473define)
11474 echo " "
11475 echo "Checking to see if your struct statfs has f_flags field..." >&4
11476 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
11477 eval $hasfield
11478 ;;
11479*) val="$undef"
11480 set d_statfs_f_flags
11481 eval $setvar
11482 ;;
11483esac
11484case "$d_statfs_f_flags" in
11485"$define") echo "Yes, it does." ;;
11486*) echo "No, it doesn't." ;;
11487esac
11488
11489: see if _ptr and _cnt from stdio act std
11490echo " "
80f36755
NC
11491
11492if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11493 echo "(Looks like you have stdio.h from BSD.)"
11494 case "$stdio_ptr" in
11495 '') stdio_ptr='((fp)->_p)'
11496 ptr_lval=$define
11497 ;;
11498 *) ptr_lval=$d_stdio_ptr_lval;;
11499 esac
11500 case "$stdio_cnt" in
11501 '') stdio_cnt='((fp)->_r)'
11502 cnt_lval=$define
11503 ;;
11504 *) cnt_lval=$d_stdio_cnt_lval;;
11505 esac
11506 case "$stdio_base" in
11507 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11508 esac
11509 case "$stdio_bufsiz" in
11510 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11511 esac
11512elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
b4eb6b3d
JH
11513 echo "(Looks like you have stdio.h from Linux.)"
11514 case "$stdio_ptr" in
11515 '') stdio_ptr='((fp)->_IO_read_ptr)'
11516 ptr_lval=$define
11517 ;;
11518 *) ptr_lval=$d_stdio_ptr_lval;;
11519 esac
11520 case "$stdio_cnt" in
11521 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11522 cnt_lval=$undef
11523 ;;
11524 *) cnt_lval=$d_stdio_cnt_lval;;
11525 esac
11526 case "$stdio_base" in
11527 '') stdio_base='((fp)->_IO_read_base)';;
11528 esac
11529 case "$stdio_bufsiz" in
11530 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11531 esac
11532else
11533 case "$stdio_ptr" in
11534 '') stdio_ptr='((fp)->_ptr)'
11535 ptr_lval=$define
11536 ;;
11537 *) ptr_lval=$d_stdio_ptr_lval;;
11538 esac
11539 case "$stdio_cnt" in
11540 '') stdio_cnt='((fp)->_cnt)'
11541 cnt_lval=$define
11542 ;;
11543 *) cnt_lval=$d_stdio_cnt_lval;;
11544 esac
11545 case "$stdio_base" in
11546 '') stdio_base='((fp)->_base)';;
11547 esac
11548 case "$stdio_bufsiz" in
11549 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11550 esac
11551fi
80f36755 11552
b4eb6b3d
JH
11553: test whether _ptr and _cnt really work
11554echo "Checking how std your stdio is..." >&4
11555$cat >try.c <<EOP
11556#include <stdio.h>
11557#define FILE_ptr(fp) $stdio_ptr
11558#define FILE_cnt(fp) $stdio_cnt
11559int main() {
11560 FILE *fp = fopen("try.c", "r");
11561 char c = getc(fp);
11562 if (
11563 18 <= FILE_cnt(fp) &&
11564 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11565 )
11566 exit(0);
11567 exit(1);
11568}
11569EOP
11570val="$undef"
11571set try
11572if eval $compile; then
11573 if ./try; then
11574 echo "Your stdio acts pretty std."
11575 val="$define"
11576 else
11577 echo "Your stdio isn't very std."
11578 fi
11579else
11580 echo "Your stdio doesn't appear very std."
11581fi
11582$rm -f try.c try
11583set d_stdstdio
11584eval $setvar
11585
11586: Can _ptr be used as an lvalue?
11587case "$d_stdstdio$ptr_lval" in
11588$define$define) val=$define ;;
11589*) val=$undef ;;
11590esac
11591set d_stdio_ptr_lval
11592eval $setvar
11593
11594: Can _cnt be used as an lvalue?
11595case "$d_stdstdio$cnt_lval" in
11596$define$define) val=$define ;;
11597*) val=$undef ;;
11598esac
11599set d_stdio_cnt_lval
11600eval $setvar
11601
a7ffa9b9
NC
11602
11603: test whether setting _ptr sets _cnt as a side effect
11604d_stdio_ptr_lval_sets_cnt="$undef"
11605d_stdio_ptr_lval_nochange_cnt="$undef"
11606case "$d_stdio_ptr_lval$d_stdstdio" in
11607$define$define)
11608 echo "Checking to see what happens if we set the stdio ptr..." >&4
11609$cat >try.c <<EOP
11610#include <stdio.h>
11611/* Can we scream? */
11612/* Eat dust sed :-) */
c1d9e6fa 11613/* In the buffer space, no one can hear you scream. */
0bbfc344
JH
11614#define FILE_ptr(fp) $stdio_ptr
11615#define FILE_cnt(fp) $stdio_cnt
c1d9e6fa 11616#include <sys/types.h>
a7ffa9b9
NC
11617int main() {
11618 FILE *fp = fopen("try.c", "r");
c1d9e6fa 11619 int c;
a7ffa9b9
NC
11620 char *ptr;
11621 size_t cnt;
c1d9e6fa
JH
11622 if (!fp) {
11623 puts("Fail even to read");
11624 exit(1);
11625 }
11626 c = getc(fp); /* Read away the first # */
11627 if (c == EOF) {
11628 puts("Fail even to read");
11629 exit(1);
11630 }
a7ffa9b9
NC
11631 if (!(
11632 18 <= FILE_cnt(fp) &&
11633 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11634 )) {
11635 puts("Fail even to read");
11636 exit (1);
11637 }
c1d9e6fa
JH
11638 ptr = (char*) FILE_ptr(fp);
11639 cnt = (size_t)FILE_cnt(fp);
a7ffa9b9 11640
c1d9e6fa 11641 FILE_ptr(fp) += 42;
a7ffa9b9 11642
c1d9e6fa 11643 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
a7ffa9b9
NC
11644 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11645 exit (1);
11646 }
11647 if (FILE_cnt(fp) <= 20) {
11648 printf ("Fail (<20 chars to test)");
11649 exit (1);
11650 }
11651 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11652 puts("Fail compare");
11653 exit (1);
11654 }
11655 if (cnt == FILE_cnt(fp)) {
11656 puts("Pass_unchanged");
11657 exit (0);
11658 }
11659 if (FILE_cnt(fp) == (cnt - 42)) {
11660 puts("Pass_changed");
11661 exit (0);
11662 }
11663 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11664 return 1;
11665
11666}
11667EOP
11668 set try
11669 if eval $compile; then
11670 case `./try$exe_ext` in
11671 Pass_changed)
2e32dcfe 11672 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
a7ffa9b9
NC
11673 d_stdio_ptr_lval_sets_cnt="$define" ;;
11674 Pass_unchanged)
11675 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
11676 d_stdio_ptr_lval_nochange_cnt="$define" ;;
11677 Fail*)
11678 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
11679 *)
11680 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11681 esac
11682 else
11683 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
11684 fi
11685 $rm -f try.c try
11686 ;;
11687esac
11688
b4eb6b3d
JH
11689: see if _base is also standard
11690val="$undef"
11691case "$d_stdstdio" in
11692$define)
11693 $cat >try.c <<EOP
11694#include <stdio.h>
11695#define FILE_base(fp) $stdio_base
11696#define FILE_bufsiz(fp) $stdio_bufsiz
11697int main() {
11698 FILE *fp = fopen("try.c", "r");
11699 char c = getc(fp);
11700 if (
11701 19 <= FILE_bufsiz(fp) &&
11702 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11703 )
11704 exit(0);
11705 exit(1);
11706}
11707EOP
11708 set try
11709 if eval $compile; then
11710 if ./try; then
11711 echo "And its _base field acts std."
11712 val="$define"
11713 else
11714 echo "But its _base field isn't std."
11715 fi
11716 else
11717 echo "However, it seems to be lacking the _base field."
11718 fi
11719 $rm -f try.c try
11720 ;;
11721esac
11722set d_stdiobase
11723eval $setvar
11724
11725$cat >&4 <<EOM
11726Checking how to access stdio streams by file descriptor number...
11727EOM
11728case "$stdio_stream_array" in
11729'') $cat >try.c <<EOCP
11730#include <stdio.h>
11731int main() {
11732 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11733 printf("yes\n");
11734}
11735EOCP
11736 for s in _iob __iob __sF
11737 do
11738 set try -DSTDIO_STREAM_ARRAY=$s
11739 if eval $compile; then
11740 case "`./try$exe_ext`" in
11741 yes) stdio_stream_array=$s; break ;;
11742 esac
11743 fi
11744 done
11745 $rm -f try.* try$exe_ext
11746esac
11747case "$stdio_stream_array" in
11748'') $cat >&4 <<EOM
11749I can't figure out how to access stdio streams by file descriptor number.
11750EOM
11751 d_stdio_stream_array="$undef"
11752 ;;
11753*) $cat >&4 <<EOM
11754You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11755EOM
11756 d_stdio_stream_array="$define"
11757 ;;
11758esac
11759
11760: see if strcoll exists
11761set strcoll d_strcoll
11762eval $inlibc
11763
11764: check for structure copying
11765echo " "
11766echo "Checking to see if your C compiler can copy structs..." >&4
11767$cat >try.c <<'EOCP'
11768int main()
11769{
11770 struct blurfl {
11771 int dyick;
11772 } foo, bar;
11773
11774 foo = bar;
11775}
11776EOCP
11777if $cc -c try.c >/dev/null 2>&1 ; then
11778 val="$define"
11779 echo "Yup, it can."
11780else
11781 val="$undef"
11782 echo "Nope, it can't."
11783fi
11784set d_strctcpy
11785eval $setvar
11786$rm -f try.*
11787
11788: see if strerror and/or sys_errlist[] exist
11789echo " "
11790if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11791 if set strerror val -f d_strerror; eval $csym; $val; then
11792 echo 'strerror() found.' >&4
11793 d_strerror="$define"
11794 d_strerrm='strerror(e)'
11795 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11796 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
11797 d_syserrlst="$define"
11798 else
11799 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11800 d_syserrlst="$undef"
11801 fi
11802 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11803 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11804 echo 'strerror() found in string header.' >&4
11805 d_strerror="$define"
11806 d_strerrm='strerror(e)'
11807 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11808 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11809 d_syserrlst="$define"
11810 else
11811 echo "(You don't appear to have any sys_errlist[], how can this be?)"
11812 d_syserrlst="$undef"
11813 fi
11814 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11815 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11816 d_strerror="$undef"
11817 d_syserrlst="$define"
11818 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11819 else
11820 echo 'strerror() and sys_errlist[] NOT found.' >&4
11821 d_strerror="$undef"
11822 d_syserrlst="$undef"
11823 d_strerrm='"unknown"'
11824 fi
11825fi
11826
11827: see if strtod exists
11828set strtod d_strtod
11829eval $inlibc
11830
11831: see if strtol exists
11832set strtol d_strtol
11833eval $inlibc
11834
11835: see if strtold exists
11836set strtold d_strtold
11837eval $inlibc
11838
11839: see if strtoll exists
11840set strtoll d_strtoll
11841eval $inlibc
11842
11843case "$d_longlong-$d_strtoll" in
11844"$define-$define")
11845 $cat <<EOM
11846Checking whether your strtoll() works okay...
11847EOM
11848 $cat >try.c <<'EOCP'
11849#include <errno.h>
11850#ifdef __hpux
11851#define strtoll __strtoll
11852#endif
e75931a7
YST
11853#ifdef __EMX__
11854#define strtoll _strtoll
11855#endif
b4eb6b3d
JH
11856#include <stdio.h>
11857extern long long int strtoll(char *s, char **, int);
11858static int bad = 0;
11859int check(char *s, long long ell, int een) {
11860 long long gll;
11861 errno = 0;
11862 gll = strtoll(s, 0, 10);
11863 if (!((gll == ell) && (errno == een)))
11864 bad++;
11865}
11866int main() {
11867 check(" 1", 1LL, 0);
11868 check(" 0", 0LL, 0);
11869 check("-1", -1LL, 0);
11870 check("-9223372036854775808", -9223372036854775808LL, 0);
11871 check("-9223372036854775808", -9223372036854775808LL, 0);
11872 check(" 9223372036854775807", 9223372036854775807LL, 0);
11873 check("-9223372036854775808", -9223372036854775808LL, 0);
11874 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
11875 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11876 if (!bad)
11877 printf("ok\n");
11878}
11879EOCP
11880 set try
11881 if eval $compile; then
e75931a7
YST
11882 yyy=`./try`
11883 case "$yyy" in
b4eb6b3d
JH
11884 ok) echo "Your strtoll() seems to be working okay." ;;
11885 *) cat <<EOM >&4
11886Your strtoll() doesn't seem to be working okay.
11887EOM
11888 d_strtoll="$undef"
11889 ;;
69eadf66 11890 esac
e75931a7
YST
11891 else
11892 echo "(I can't seem to compile the test program--assuming it doesn't)"
11893 d_strtoll="$undef"
b4eb6b3d
JH
11894 fi
11895 ;;
11896esac
11897
11898: see if strtoul exists
11899set strtoul d_strtoul
11900eval $inlibc
11901
11902: see if strtoull exists
11903set strtoull d_strtoull
11904eval $inlibc
11905
11906case "$d_longlong-$d_strtoull" in
11907"$define-$define")
11908 $cat <<EOM
11909Checking whether your strtoull() works okay...
11910EOM
11911 $cat >try.c <<'EOCP'
11912#include <errno.h>
11913#ifdef __hpux
11914#define strtoull __strtoull
11915#endif
11916#include <stdio.h>
11917extern unsigned long long int strtoull(char *s, char **, int);
11918static int bad = 0;
11919int check(char *s, long long eull, int een) {
11920 long long gull;
11921 errno = 0;
11922 gull = strtoull(s, 0, 10);
11923 if (!((gull == eull) && (errno == een)))
11924 bad++;
11925}
11926int main() {
11927 check(" 1", 1LL, 0);
11928 check(" 0", 0LL, 0);
11929 check("18446744073709551615", 18446744073709551615ULL, 0);
11930 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11931 if (!bad)
11932 printf("ok\n");
11933}
11934EOCP
11935 set try
11936 if eval $compile; then
11937 case "`./try`" in
11938 ok) echo "Your strtoull() seems to be working okay." ;;
11939 *) cat <<EOM >&4
11940Your strtoull() doesn't seem to be working okay.
11941EOM
11942 d_strtoull="$undef"
11943 ;;
11944 esac
11945 fi
11946 ;;
11947esac
11948
11949: see if strtouq exists
11950set strtouq d_strtouq
11951eval $inlibc
11952
11953: see if strxfrm exists
11954set strxfrm d_strxfrm
11955eval $inlibc
11956
11957: see if symlink exists
11958set symlink d_symlink
11959eval $inlibc
11960
11961: see if syscall exists
11962set syscall d_syscall
11963eval $inlibc
11964
11965: see if sysconf exists
11966set sysconf d_sysconf
11967eval $inlibc
11968
11969: see if system exists
11970set system d_system
11971eval $inlibc
11972
11973: see if tcgetpgrp exists
11974set tcgetpgrp d_tcgetpgrp
11975eval $inlibc
11976
11977: see if tcsetpgrp exists
11978set tcsetpgrp d_tcsetpgrp
11979eval $inlibc
11980
11981: see if prototype for telldir is available
11982echo " "
11983set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11984eval $hasproto
11985
11986: see if this is a sys/times.h system
11987set sys/times.h i_systimes
11988eval $inhdr
11989
11990: see if times exists
11991echo " "
11992if set times val -f d_times; eval $csym; $val; then
11993 echo 'times() found.' >&4
11994 d_times="$define"
11995 inc=''
11996 case "$i_systimes" in
11997 "$define") inc='sys/times.h';;
11998 esac
11999 rp="What is the type returned by times() on this system?"
12000 set clock_t clocktype long stdio.h sys/types.h $inc
12001 eval $typedef_ask
12002else
12003 echo 'times() NOT found, hope that will do.' >&4
12004 d_times="$undef"
12005 clocktype='int'
12006fi
12007
12008: see if truncate exists
12009set truncate d_truncate
12010eval $inlibc
12011
12012: see if tzname[] exists
12013echo " "
12014if set tzname val -a d_tzname; eval $csym; $val; then
12015 val="$define"
12016 echo 'tzname[] found.' >&4
12017else
12018 val="$undef"
12019 echo 'tzname[] NOT found.' >&4
12020fi
12021set d_tzname
12022eval $setvar
12023
12024: see if umask exists
12025set umask d_umask
12026eval $inlibc
12027
12028: see if ustat exists
12029set ustat d_ustat
12030eval $inlibc
12031
12032: backward compatibility for d_hvfork
12033if test X$d_hvfork != X; then
12034 d_vfork="$d_hvfork"
12035 d_hvfork=''
12036fi
12037: see if there is a vfork
12038val=''
12039set vfork val
12040eval $inlibc
12041
12042: Ok, but do we want to use it. vfork is reportedly unreliable in
12043: perl on Solaris 2.x, and probably elsewhere.
12044case "$val" in
12045$define)
12046 echo " "
12047 case "$usevfork" in
12048 false) dflt='n';;
12049 *) dflt='y';;
12050 esac
12051 cat <<'EOM'
12052
12053Perl can only use a vfork() that doesn't suffer from strict
12054restrictions on calling functions or modifying global data in
12055the child. For example, glibc-2.1 contains such a vfork()
12056that is unsuitable. If your system provides a proper fork()
12057call, chances are that you do NOT want perl to use vfork().
12058
12059EOM
12060 rp="Do you still want to use vfork()?"
12061 . ./myread
12062 case "$ans" in
12063 y|Y) ;;
12064 *)
12065 echo "Ok, we won't use vfork()."
12066 val="$undef"
12067 ;;
12068 esac
12069 ;;
12070esac
12071set d_vfork
12072eval $setvar
12073case "$d_vfork" in
12074$define) usevfork='true';;
12075*) usevfork='false';;
12076esac
12077
12078: see if this is an sysdir system
12079set sys/dir.h i_sysdir
12080eval $inhdr
12081
12082: see if this is an sysndir system
12083set sys/ndir.h i_sysndir
12084eval $inhdr
12085
12086: see if closedir exists
12087set closedir d_closedir
12088eval $inlibc
12089
12090case "$d_closedir" in
12091"$define")
12092 echo " "
12093 echo "Checking whether closedir() returns a status..." >&4
12094 cat > closedir.c <<EOM
12095#$i_dirent I_DIRENT /**/
12096#$i_sysdir I_SYS_DIR /**/
12097#$i_sysndir I_SYS_NDIR /**/
12098#$i_systypes I_SYS_TYPES /**/
12099
12100#if defined(I_SYS_TYPES)
12101#include <sys/types.h>
12102#endif
12103#if defined(I_DIRENT)
12104#include <dirent.h>
12105#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12106#include <sys/dir.h>
12107#endif
12108#else
12109#ifdef I_SYS_NDIR
12110#include <sys/ndir.h>
12111#else
12112#ifdef I_SYS_DIR
12113#ifdef hp9000s500
12114#include <ndir.h> /* may be wrong in the future */
12115#else
12116#include <sys/dir.h>
12117#endif
12118#endif
12119#endif
12120#endif
12121int main() { return closedir(opendir(".")); }
12122EOM
12123 set closedir
12124 if eval $compile_ok; then
12125 if ./closedir > /dev/null 2>&1 ; then
12126 echo "Yes, it does."
12127 val="$undef"
12128 else
12129 echo "No, it doesn't."
12130 val="$define"
12131 fi
12132 else
12133 echo "(I can't seem to compile the test program--assuming it doesn't)"
12134 val="$define"
12135 fi
12136 ;;
12137*)
12138 val="$undef";
12139 ;;
12140esac
12141set d_void_closedir
12142eval $setvar
12143$rm -f closedir*
b4eb6b3d
JH
12144: see if there is a wait4
12145set wait4 d_wait4
12146eval $inlibc
12147
12148: see if waitpid exists
12149set waitpid d_waitpid
12150eval $inlibc
12151
12152: see if wcstombs exists
12153set wcstombs d_wcstombs
12154eval $inlibc
12155
12156: see if wctomb exists
12157set wctomb d_wctomb
12158eval $inlibc
12159
12160: preserve RCS keywords in files with variable substitution, grrr
12161Date='$Date'
12162Id='$Id'
12163Log='$Log'
12164RCSfile='$RCSfile'
12165Revision='$Revision'
12166
12167case "$crosscompile" in
12168''|[nN]*) crosscompile="$undef" ;;
12169esac
12170
12171case "$osname" in
12172next|rhapsody|darwin) multiarch="$define" ;;
12173esac
12174case "$multiarch" in
12175''|[nN]*) multiarch="$undef" ;;
12176esac
12177
12178: check for alignment requirements
12179echo " "
12180case "$crosscompile$multiarch" in
12181*$define*)
12182 $cat <<EOM
12183You seem to be either cross-compiling or doing a multiarchitecture build,
12184skipping the memory alignment check.
12185
12186EOM
12187 case "$alignbytes" in
12188 '') alignbytes=8 ;;
12189 esac
12190 ;;
12191*)
12192 case "$alignbytes" in
12193 '') echo "Checking alignment constraints..." >&4
12194 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12195 $cat >try.c <<'EOCP'
12196typedef long double NV;
12197EOCP
12198 else
12199 $cat >try.c <<'EOCP'
12200typedef double NV;
12201EOCP
12202 fi
12203 $cat >>try.c <<'EOCP'
12204#include <stdio.h>
12205struct foobar {
12206 char foo;
12207 NV bar;
12208} try_algn;
12209int main()
12210{
12211 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12212 return(0);
12213}
12214EOCP
12215 set try
12216 if eval $compile_ok; then
12217 dflt=`./try`
12218 else
12219 dflt='8'
12220 echo "(I can't seem to compile the test program...)"
12221 fi
12222 ;;
12223 *) dflt="$alignbytes"
12224 ;;
12225 esac
12226 rp="Doubles must be aligned on a how-many-byte boundary?"
12227 . ./myread
12228 alignbytes="$ans"
12229 $rm -f try.c try
12230 ;;
12231esac
12232
12233
12234: set the base revision
12235baserev=5.0
12236
12237: check for ordering of bytes in a long
12238echo " "
12239case "$crosscompile$multiarch" in
12240*$define*)
12241 $cat <<EOM
12242You seem to be either cross-compiling or doing a multiarchitecture build,
12243skipping the byteorder check.
12244
12245EOM
12246 byteorder='0xffff'
12247 ;;
12248*)
12249 case "$byteorder" in
12250 '')
12251 $cat <<'EOM'
12252In the following, larger digits indicate more significance. A big-endian
12253machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12254little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12255machines may have weird orders like 3412. A Cray will report 87654321,
12256an Alpha will report 12345678. If the test program works the default is
12257probably right.
12258I'm now running the test program...
12259EOM
12260 $cat >try.c <<'EOCP'
12261#include <stdio.h>
12262int main()
12263{
12264 int i;
12265 union {
12266 unsigned long l;
12267 char c[sizeof(long)];
12268 } u;
12269
12270 if (sizeof(long) > 4)
12271 u.l = (0x08070605L << 32) | 0x04030201L;
12272 else
12273 u.l = 0x04030201L;
12274 for (i = 0; i < sizeof(long); i++)
12275 printf("%c", u.c[i]+'0');
12276 printf("\n");
12277 exit(0);
12278}
12279EOCP
12280 xxx_prompt=y
12281 set try
12282 if eval $compile && ./try > /dev/null; then
12283 dflt=`./try`
12284 case "$dflt" in
12285 [1-4][1-4][1-4][1-4]|12345678|87654321)
12286 echo "(The test program ran ok.)"
12287 echo "byteorder=$dflt"
12288 xxx_prompt=n
12289 ;;
12290 ????|????????) echo "(The test program ran ok.)" ;;
12291 *) echo "(The test program didn't run right for some reason.)" ;;
12292 esac
12293 else
12294 dflt='4321'
12295 cat <<'EOM'
12296(I can't seem to compile the test program. Guessing big-endian...)
12297EOM
12298 fi
12299 case "$xxx_prompt" in
12300 y)
12301 rp="What is the order of bytes in a long?"
12302 . ./myread
12303 byteorder="$ans"
12304 ;;
12305 *) byteorder=$dflt
12306 ;;
12307 esac
12308 ;;
12309 esac
12310 $rm -f try.c try
12311 ;;
12312esac
12313
12314
12315: how do we catenate cpp tokens here?
12316echo " "
12317echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12318$cat >cpp_stuff.c <<'EOCP'
12319#define RCAT(a,b)a/**/b
12320#define ACAT(a,b)a ## b
12321RCAT(Rei,ser)
12322ACAT(Cir,cus)
12323EOCP
12324$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12325if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12326 echo "Oh! Smells like ANSI's been here." >&4
12327 echo "We can catify or stringify, separately or together!"
12328 cpp_stuff=42
12329elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12330 echo "Ah, yes! The good old days!" >&4
12331 echo "However, in the good old days we don't know how to stringify and"
12332 echo "catify at the same time."
12333 cpp_stuff=1
12334else
12335 $cat >&4 <<EOM
12336Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
12337to have to edit the values of CAT[2-5] in config.h...
12338EOM
12339 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12340fi
12341$rm -f cpp_stuff.*
12342
12343: see if this is a db.h system
12344set db.h i_db
12345eval $inhdr
12346
12347case "$i_db" in
12348$define)
12349 : Check db version.
12350 echo " "
12351 echo "Checking Berkeley DB version ..." >&4
12352 $cat >try.c <<EOCP
12353#$d_const HASCONST
12354#ifndef HASCONST
12355#define const
12356#endif
12357#include <sys/types.h>
12358#include <stdio.h>
12359#include <db.h>
12360int main()
12361{
12362#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12363 int Major, Minor, Patch ;
12364 unsigned long Version ;
12365 (void)db_version(&Major, &Minor, &Patch) ;
12366 printf("You have Berkeley DB Version 2 or greater\n");
12367
12368 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12369 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12370 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12371 Major, Minor, Patch) ;
12372
12373 /* check that db.h & libdb are compatible */
12374 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12375 printf("db.h and libdb are incompatible\n") ;
12376 exit(3);
12377 }
12378
12379 printf("db.h and libdb are compatible\n") ;
12380
12381 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12382 + DB_VERSION_PATCH ;
12383
12384 /* needs to be >= 2.3.4 */
12385 if (Version < 2003004) {
12386 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12387 printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12388 exit(2);
12389 }
12390
12391 exit(0);
12392#else
12393#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12394 printf("You have Berkeley DB Version 1\n");
12395 exit(0); /* DB version < 2: the coast is clear. */
12396#else
12397 exit(1); /* <db.h> not Berkeley DB? */
12398#endif
12399#endif
12400}
12401EOCP
12402 set try
12403 if eval $compile_ok && ./try; then
12404 echo 'Looks OK.' >&4
12405 else
12406 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
12407 i_db=$undef
12408 case " $libs " in
12409 *"-ldb "*)
12410 : Remove db from list of libraries to use
12411 echo "Removing unusable -ldb from library list" >&4
12412 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12413 shift
12414 libs="$*"
12415 echo "libs = $libs" >&4
12416 ;;
12417 esac
12418 fi
12419 $rm -f try.*
12420 ;;
12421esac
12422
12423case "$i_db" in
12424define)
12425 : Check the return type needed for hash
12426 echo " "
12427 echo "Checking return type needed for hash for Berkeley DB ..." >&4
12428 $cat >try.c <<EOCP
12429#$d_const HASCONST
12430#ifndef HASCONST
12431#define const
12432#endif
12433#include <sys/types.h>
12434#include <db.h>
12435
12436#ifndef DB_VERSION_MAJOR
12437u_int32_t hash_cb (ptr, size)
12438const void *ptr;
12439size_t size;
12440{
12441}
12442HASHINFO info;
12443int main()
12444{
12445 info.hash = hash_cb;
12446}
12447#endif
12448EOCP
12449 if $cc $ccflags -c try.c >try.out 2>&1 ; then
12450 if $contains warning try.out >>/dev/null 2>&1 ; then
12451 db_hashtype='int'
12452 else
12453 db_hashtype='u_int32_t'
12454 fi
12455 else
12456 : XXX Maybe we should just give up here.
12457 db_hashtype=u_int32_t
12458 $cat try.out >&4
12459 echo "Help: I can't seem to compile the db test program." >&4
12460 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12461 fi
12462 $rm -f try.*
12463 echo "Your version of Berkeley DB uses $db_hashtype for hash."
12464 ;;
12465*) db_hashtype=u_int32_t
12466 ;;
12467esac
12468case "$i_db" in
12469define)
12470 : Check the return type needed for prefix
12471 echo " "
12472 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12473 cat >try.c <<EOCP
12474#$d_const HASCONST
12475#ifndef HASCONST
12476#define const
12477#endif
12478#include <sys/types.h>
12479#include <db.h>
12480
12481#ifndef DB_VERSION_MAJOR
12482size_t prefix_cb (key1, key2)
12483const DBT *key1;
12484const DBT *key2;
12485{
12486}
12487BTREEINFO info;
12488int main()
12489{
12490 info.prefix = prefix_cb;
12491}
12492#endif
12493EOCP
12494 if $cc $ccflags -c try.c >try.out 2>&1 ; then
12495 if $contains warning try.out >>/dev/null 2>&1 ; then
12496 db_prefixtype='int'
12497 else
12498 db_prefixtype='size_t'
12499 fi
12500 else
12501 db_prefixtype='size_t'
12502 : XXX Maybe we should just give up here.
12503 $cat try.out >&4
12504 echo "Help: I can't seem to compile the db test program." >&4
12505 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12506 fi
12507 $rm -f try.*
12508 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12509 ;;
12510*) db_prefixtype='size_t'
12511 ;;
12512esac
12513
12514: check for void type
12515echo " "
12516echo "Checking to see how well your C compiler groks the void type..." >&4
12517case "$voidflags" in
12518'')
12519 $cat >try.c <<'EOCP'
12520#if TRY & 1
12521void sub() {
12522#else
12523sub() {
12524#endif
12525 extern void moo(); /* function returning void */
12526 void (*goo)(); /* ptr to func returning void */
12527#if TRY & 8
12528 void *hue; /* generic ptr */
12529#endif
12530#if TRY & 2
12531 void (*foo[10])();
12532#endif
12533
12534#if TRY & 4
12535 if(goo == moo) {
12536 exit(0);
12537 }
12538#endif
12539 exit(0);
12540}
12541int main() { sub(); }
12542EOCP
12543 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12544 voidflags=$defvoidused
12545 echo "Good. It appears to support void to the level $package wants.">&4
12546 if $contains warning .out >/dev/null 2>&1; then
12547 echo "However, you might get some warnings that look like this:"
12548 $cat .out
12549 fi
12550 else
12551echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12552 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12553 echo "It supports 1..."
12554 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12555 echo "It also supports 2..."
12556 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12557 voidflags=7
12558 echo "And it supports 4 but not 8 definitely."
12559 else
12560 echo "It doesn't support 4..."
12561 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12562 voidflags=11
12563 echo "But it supports 8."
12564 else
12565 voidflags=3
12566 echo "Neither does it support 8."
12567 fi
12568 fi
12569 else
12570 echo "It does not support 2..."
12571 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12572 voidflags=13
12573 echo "But it supports 4 and 8."
12574 else
12575 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12576 voidflags=5
12577 echo "And it supports 4 but has not heard about 8."
12578 else
12579 echo "However it supports 8 but not 4."
12580 fi
12581 fi
12582 fi
12583 else
12584 echo "There is no support at all for void."
12585 voidflags=0
12586 fi
12587 fi
12588esac
12589case "$voidflags" in
12590"$defvoidused") ;;
12591*) $cat >&4 <<'EOM'
12592 Support flag bits are:
12593 1: basic void declarations.
12594 2: arrays of pointers to functions returning void.
12595 4: operations between pointers to and addresses of void functions.
12596 8: generic void pointers.
12597EOM
12598 dflt="$voidflags";
12599 rp="Your void support flags add up to what?"
12600 . ./myread
12601 voidflags="$ans"
12602 ;;
12603esac
12604$rm -f try.* .out
12605
12606
12607: How can we generate normalized random numbers ?
12608echo " "
12609echo "Looking for a random number function..." >&4
12610case "$randfunc" in
12611'')
12612 if set drand48 val -f; eval $csym; $val; then
12613 dflt="drand48"
12614 echo "Good, found drand48()." >&4
12615 elif set random val -f; eval $csym; $val; then
12616 dflt="random"
12617 echo "OK, found random()." >&4
12618 else
12619 dflt="rand"
12620 echo "Yick, looks like I have to use rand()." >&4
12621 fi
12622 echo " "
12623 ;;
12624*)
12625 dflt="$randfunc"
12626 ;;
12627esac
12628cont=true
12629
12630case "$ccflags" in
12631*-Dmy_rand=*|*-Dmy_srand=*)
12632 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12633 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12634 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12635 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12636 ;;
12637esac
12638
12639while $test "$cont"; do
12640 rp="Use which function to generate random numbers?"
12641 . ./myread
12642 if $test "$ans" = "$dflt"; then
12643 : null
12644 else
12645 randbits=''
12646 fi
12647 randfunc="$ans"
12648 if set $ans val -f; eval $csym; $val; then
12649 cont=''
12650 else
12651 dflt=y
12652 rp="I cannot find function $ans. Use that name anyway?"
12653 . ./myread
12654 dflt=rand
12655 case "$ans" in
12656 [yY]*) cont='';;
12657 esac
12658 fi
12659 case "$cont" in
12660 '')
12661 case "$randfunc" in
12662 drand48)
12663 drand01="drand48()"
12664 seedfunc="srand48"
12665 randbits=48
12666 randseedtype=long
12667 ;;
12668 rand|random)
12669 case "$randbits" in
12670 '')
12671echo "Checking to see how many bits your $randfunc() function produces..." >&4
12672 $cat >try.c <<EOCP
12673#$i_unistd I_UNISTD
12674#$i_stdlib I_STDLIB
12675#include <stdio.h>
12676#ifdef I_UNISTD
12677# include <unistd.h>
12678#endif
12679#ifdef I_STDLIB
12680# include <stdlib.h>
12681#endif
12682int main()
12683{
12684 register int i;
12685 register unsigned long tmp;
12686 register unsigned long max = 0L;
12687
12688 for (i = 1000; i; i--) {
12689 tmp = (unsigned long) $randfunc();
12690 if (tmp > max) max = tmp;
12691 }
12692 for (i = 0; max; i++)
12693 max /= 2;
12694 printf("%d\n",i);
12695}
12696EOCP
12697 set try
12698 if eval $compile_ok; then
12699 dflt=`try`
12700 else
12701 dflt='?'
12702 echo "(I can't seem to compile the test program...)"
12703 fi
12704 ;;
12705 *)
12706 dflt="$randbits"
12707 ;;
12708 esac
12709 rp="How many bits does your $randfunc() function produce?"
12710 . ./myread
12711 randbits="$ans"
12712 $rm -f try.c try
12713 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12714 seedfunc="s$randfunc"
12715 randseedtype=unsigned
12716 ;;
12717 *)
12718 dflt="31"
12719 rp="How many bits does your $randfunc() function produce?"
12720 . ./myread
12721 randbits="$ans"
12722 seedfunc="s$randfunc"
12723 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12724 if set $seedfunc val -f; eval $csym; $val; then
12725 echo "(Using $seedfunc() to seed random generator)"
12726 else
12727 echo "(Warning: no $seedfunc() to seed random generator)"
12728 seedfunc=rand
12729 fi
12730 randseedtype=unsigned
12731 ;;
12732 esac
12733 ;;
12734 esac
12735done
12736
12737echo " "
12738echo "Determining whether or not we are on an EBCDIC system..." >&4
12739$cat >tebcdic.c <<'EOM'
12740int main()
12741{
12742 if ('M'==0xd4) return 0;
12743 return 1;
12744}
12745EOM
12746
12747val=$undef
12748set tebcdic
12749if eval $compile_ok; then
12750 if ./tebcdic; then
12751 echo "You seem to speak EBCDIC." >&4
12752 val="$define"
12753 else
12754 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
12755 fi
12756else
12757 echo "I'm unable to compile the test program." >&4
12758 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
12759fi
12760$rm -f tebcdic.c tebcdic
12761set ebcdic
12762eval $setvar
12763
12764echo " "
12765$cat >&4 <<EOM
12766Checking how to flush all pending stdio output...
12767EOM
12768# I only know how to find the first 32 possibly open files on SunOS.
12769# See also hints/sunos_4_1.sh and util.c --AD
12770case "$osname" in
12771sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12772esac
12773$cat >>try.c <<EOCP
12774#include <stdio.h>
12775#$i_unistd I_UNISTD
12776#ifdef I_UNISTD
12777# include <unistd.h>
12778#endif
12779#$d_sysconf HAS_SYSCONF
12780#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12781#ifdef HAS_STDIO_STREAM_ARRAY
12782# define STDIO_STREAM_ARRAY $stdio_stream_array
12783#endif
12784int main() {
12785 FILE* p = fopen("try.out", "w");
12786#ifdef TRY_FPUTC
12787 fputc('x', p);
12788#else
12789# ifdef TRY_FPRINTF
12790 fprintf(p, "x");
12791# endif
12792#endif
12793#ifdef TRY_FFLUSH_NULL
12794 fflush(NULL);
12795#endif
12796#ifdef TRY_FFLUSH_ALL
12797 {
12798 long open_max = -1;
12799# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12800 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12801# else
12802# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12803 open_max = sysconf(_SC_OPEN_MAX);
12804# else
12805# ifdef FOPEN_MAX
12806 open_max = FOPEN_MAX;
12807# else
12808# ifdef OPEN_MAX
12809 open_max = OPEN_MAX;
12810# else
12811# ifdef _NFILE
12812 open_max = _NFILE;
12813# endif
12814# endif
12815# endif
12816# endif
12817# endif
12818# ifdef HAS_STDIO_STREAM_ARRAY
12819 if (open_max > 0) {
12820 long i;
12821 for (i = 0; i < open_max; i++)
12822 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12823 STDIO_STREAM_ARRAY[i]._file < open_max &&
12824 STDIO_STREAM_ARRAY[i]._flag)
12825 fflush(&STDIO_STREAM_ARRAY[i]);
12826 }
12827 }
12828# endif
12829#endif
12830 _exit(42);
12831}
12832EOCP
12833: first we have to find out how _not_ to flush
12834if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12835 output=''
12836 set try -DTRY_FPUTC
12837 if eval $compile; then
12838 $rm -f try.out
12839 ./try$exe_ext 2>/dev/null
12840 if $test ! -s try.out -a "X$?" = X42; then
12841 output=-DTRY_FPUTC
12842 fi
12843 fi
12844 case "$output" in
12845 '')
12846 set try -DTRY_FPRINTF
12847 $rm -f try.out
12848 if eval $compile; then
12849 $rm -f try.out
12850 ./try$exe_ext 2>/dev/null
12851 if $test ! -s try.out -a "X$?" = X42; then
12852 output=-DTRY_FPRINTF
12853 fi
12854 fi
12855 ;;
12856 esac
12857fi
12858: check for fflush NULL behaviour
12859case "$fflushNULL" in
12860'') set try -DTRY_FFLUSH_NULL $output
12861 if eval $compile; then
12862 $rm -f try.out
12863 ./try$exe_ext 2>/dev/null
12864 code="$?"
12865 if $test -s try.out -a "X$code" = X42; then
12866 fflushNULL="`$cat try.out`"
12867 else
12868 if $test "X$code" != X42; then
12869 $cat >&4 <<EOM
12870(If this test failed, don't worry, we'll try another method shortly.)
12871EOM
12872 fi
12873 fi
12874 fi
12875 $rm -f core try.core core.try.*
12876 case "$fflushNULL" in
12877 x) $cat >&4 <<EOM
12878Your fflush(NULL) works okay for output streams.
12879Let's see if it clobbers input pipes...
12880EOM
12881# As of mid-March 2000 all versions of Solaris appear to have a stdio
12882# bug that improperly flushes the input end of pipes. So we avoid the
12883# autoflush on fork/system/exec support for now. :-(
12884$cat >tryp.c <<EOCP
12885#include <stdio.h>
12886int
12887main(int argc, char **argv)
12888{
12889 char buf[1024];
12890 int i;
12891 char *bp = buf;
12892 while (1) {
12893 while ((i = getc(stdin)) != -1
12894 && (*bp++ = i) != '\n'
12895 && bp < &buf[1024])
12896 /* DO NOTHING */ ;
12897 *bp = '\0';
12898 fprintf(stdout, "%s", buf);
12899 fflush(NULL);
12900 if (i == -1)
12901 return 0;
12902 bp = buf;
12903 }
12904}
12905EOCP
12906 fflushNULL="$define"
12907 set tryp
12908 if eval $compile; then
12909 $rm -f tryp.out
12910 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12911 if cmp tryp.c tryp.out >/dev/null 2>&1; then
12912 $cat >&4 <<EOM
12913fflush(NULL) seems to behave okay with input streams.
12914EOM
12915 fflushNULL="$define"
12916 else
12917 $cat >&4 <<EOM
12918Ouch, fflush(NULL) clobbers input pipes! We will not use it.
12919EOM
12920 fflushNULL="$undef"
12921 fi
12922 fi
12923 $rm -f core tryp.c tryp.core core.tryp.*
12924 ;;
12925 '') $cat >&4 <<EOM
12926Your fflush(NULL) isn't working (contrary to ANSI C).
12927EOM
12928 fflushNULL="$undef"
12929 ;;
12930 *) $cat >&4 <<EOM
12931Cannot figure out whether your fflush(NULL) works or not.
12932I'm assuming it doesn't (contrary to ANSI C).
12933EOM
12934 fflushNULL="$undef"
12935 ;;
12936 esac
12937 ;;
12938$define|true|[yY]*)
12939 fflushNULL="$define"
12940 ;;
12941*)
12942 fflushNULL="$undef"
12943 ;;
12944esac
12945: check explicit looping only if NULL did not work, and if the pipe
12946: bug does not show up on an explicit flush too
12947case "$fflushNULL" in
12948"$undef")
12949 $cat >tryp.c <<EOCP
12950#include <stdio.h>
12951int
12952main(int argc, char **argv)
12953{
12954 char buf[1024];
12955 int i;
12956 char *bp = buf;
12957 while (1) {
12958 while ((i = getc(stdin)) != -1
12959 && (*bp++ = i) != '\n'
12960 && bp < &buf[1024])
12961 /* DO NOTHING */ ;
12962 *bp = '\0';
12963 fprintf(stdout, "%s", buf);
12964 fflush(stdin);
12965 if (i == -1)
12966 return 0;
12967 bp = buf;
12968 }
12969}
12970EOCP
12971 set tryp
12972 if eval $compile; then
12973 $rm -f tryp.out
12974 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12975 if cmp tryp.c tryp.out >/dev/null 2>&1; then
12976 $cat >&4 <<EOM
12977Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12978EOM
12979 : now check for fflushall behaviour
12980 case "$fflushall" in
12981 '') set try -DTRY_FFLUSH_ALL $output
12982 if eval $compile; then
12983 $cat >&4 <<EOM
12984(Now testing the other method--but note that this also may fail.)
12985EOM
12986 $rm -f try.out
12987 ./try$exe_ext 2>/dev/null
12988 if $test -s try.out -a "X$?" = X42; then
12989 fflushall="`$cat try.out`"
12990 fi
12991 fi
12992 $rm -f core try.core core.try.*
12993 case "$fflushall" in
12994 x) $cat >&4 <<EOM
12995Whew. Flushing explicitly all the stdio streams works.
12996EOM
12997 fflushall="$define"
12998 ;;
12999 '') $cat >&4 <<EOM
13000Sigh. Flushing explicitly all the stdio streams doesn't work.
13001EOM
13002 fflushall="$undef"
13003 ;;
13004 *) $cat >&4 <<EOM
13005Cannot figure out whether flushing stdio streams explicitly works or not.
13006I'm assuming it doesn't.
13007EOM
13008 fflushall="$undef"
13009 ;;
13010 esac
13011 ;;
13012 "$define"|true|[yY]*)
13013 fflushall="$define"
13014 ;;
13015 *)
13016 fflushall="$undef"
13017 ;;
13018 esac
13019 else
13020 $cat >&4 <<EOM
13021All is futile. Even fflush(stdin) clobbers input pipes!
13022EOM
13023 fflushall="$undef"
13024 fi
13025 else
13026 fflushall="$undef"
13027 fi
13028 $rm -f core tryp.c tryp.core core.tryp.*
13029 ;;
13030*) fflushall="$undef"
13031 ;;
13032esac
13033
13034case "$fflushNULL$fflushall" in
13035undefundef)
13036 $cat <<EOM
13037OK, I give up. I cannot figure out how to flush pending stdio output.
13038We won't be flushing handles at all before fork/exec/popen.
13039EOM
13040 ;;
13041esac
13042$rm -f try.* try$exe_ext
13043
13044: Store the full pathname to the ar program for use in the C program
13045: Respect a hint or command line value for full_ar.
13046case "$full_ar" in
13047'') full_ar=$ar ;;
13048esac
13049
13050: Store the full pathname to the sed program for use in the C program
13051full_sed=$sed
13052
13053: see what type gids are declared as in the kernel
13054echo " "
13055echo "Looking for the type for group ids returned by getgid()."
13056set gid_t gidtype xxx stdio.h sys/types.h
13057eval $typedef
13058case "$gidtype" in
13059xxx)
13060 xxx=`./findhdr sys/user.h`
13061 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13062 case $1 in
13063 unsigned) dflt="$1 $2" ;;
13064 *) dflt="$1" ;;
13065 esac
13066 ;;
13067*) dflt="$gidtype";;
13068esac
13069case "$gidtype" in
13070gid_t) echo "gid_t found." ;;
13071*) rp="What is the type for group ids returned by getgid()?"
13072 . ./myread
13073 gidtype="$ans"
13074 ;;
13075esac
13076
13077echo " "
13078case "$gidtype" in
13079*_t) zzz="$gidtype" ;;
13080*) zzz="gid" ;;
13081esac
13082echo "Checking the size of $zzz..." >&4
13083cat > try.c <<EOCP
13084#include <sys/types.h>
13085#include <stdio.h>
13086int main() {
13087 printf("%d\n", (int)sizeof($gidtype));
13088 exit(0);
13089}
13090EOCP
13091set try
13092if eval $compile_ok; then
13093 yyy=`./try`
13094 case "$yyy" in
13095 '') gidsize=4
13096 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13097 ;;
13098 *) gidsize=$yyy
13099 echo "Your $zzz is $gidsize bytes long."
13100 ;;
13101 esac
13102else
13103 gidsize=4
13104 echo "(I can't compile the test program--guessing $gidsize.)" >&4
13105fi
13106
13107
13108echo " "
13109case "$gidtype" in
13110*_t) zzz="$gidtype" ;;
13111*) zzz="gid" ;;
13112esac
13113echo "Checking the sign of $zzz..." >&4
13114cat > try.c <<EOCP
13115#include <sys/types.h>
13116#include <stdio.h>
13117int main() {
13118 $gidtype foo = -1;
13119 if (foo < 0)
13120 printf("-1\n");
13121 else
13122 printf("1\n");
13123}
13124EOCP
13125set try
13126if eval $compile; then
13127 yyy=`./try`
13128 case "$yyy" in
13129 '') gidsign=1
13130 echo "(I can't execute the test program--guessing unsigned.)" >&4
13131 ;;
13132 *) gidsign=$yyy
13133 case "$gidsign" in
13134 1) echo "Your $zzz is unsigned." ;;
13135 -1) echo "Your $zzz is signed." ;;
13136 esac
13137 ;;
13138 esac
13139else
13140 gidsign=1
13141 echo "(I can't compile the test program--guessing unsigned.)" >&4
13142fi
13143
13144
13145echo " "
13146
13147if $test X"$quadtype" != X; then
13148
13149echo "Checking how to print 64-bit integers..." >&4
13150
13151if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13152 $cat >try.c <<'EOCP'
13153#include <sys/types.h>
13154#include <stdio.h>
13155int main() {
13156 int q = 12345678901;
13157 printf("%ld\n", q);
13158}
13159EOCP
13160 set try
13161 if eval $compile; then
13162 yyy=`./try$exe_ext`
13163 case "$yyy" in
13164 12345678901)
13165 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13166 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13167 echo "We will use %d."
13168 ;;
13169 esac
13170 fi
13171fi
13172
13173if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13174 $cat >try.c <<'EOCP'
13175#include <sys/types.h>
13176#include <stdio.h>
13177int main() {
13178 long q = 12345678901;
13179 printf("%ld\n", q);
13180}
13181EOCP
13182 set try
13183 if eval $compile; then
13184 yyy=`./try$exe_ext`
13185 case "$yyy" in
13186 12345678901)
13187 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13188 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13189 echo "We will use %ld."
13190 ;;
13191 esac
13192 fi
13193fi
13194
13195if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13196 $cat >try.c <<'EOCP'
13197#include <sys/types.h>
13198#include <inttypes.h>
13199#include <stdio.h>
13200int main() {
13201 int64_t q = 12345678901;
13202 printf("%" PRId64 "\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=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13211 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13212 echo "We will use the C9X style."
13213 ;;
13214 esac
13215 fi
13216fi
13217
13218if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13219 $cat >try.c <<'EOCP'
13220#include <sys/types.h>
13221#include <stdio.h>
13222int main() {
13223 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13224 printf("%lld\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='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13233 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13234 echo "We will use the %lld style."
13235 ;;
13236 esac
13237 fi
13238fi
13239
13240if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13241 $cat >try.c <<EOCP
13242#include <sys/types.h>
13243#include <stdio.h>
13244int main() {
13245 $quadtype q = 12345678901;
13246 printf("%Ld\n", q);
13247}
13248EOCP
13249 set try
13250 if eval $compile; then
13251 yyy=`./try$exe_ext`
13252 case "$yyy" in
13253 12345678901)
13254 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13255 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13256 echo "We will use %Ld."
13257 ;;
13258 esac
13259 fi
13260fi
13261
13262if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13263 $cat >try.c <<EOCP
13264#include <sys/types.h>
13265#include <stdio.h>
13266int main() {
13267 $quadtype q = 12345678901;
13268 printf("%qd\n", q);
13269}
13270EOCP
13271 set try
13272 if eval $compile; then
13273 yyy=`./try$exe_ext`
13274 case "$yyy" in
13275 12345678901)
13276 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13277 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13278 echo "We will use %qd."
13279 ;;
13280 esac
13281 fi
13282fi
13283
13284if $test X"$sPRId64" = X; then
13285 echo "Cannot figure out how to print 64-bit integers." >&4
13286fi
13287
13288$rm -f try try.*
13289
13290fi
13291
13292case "$sPRId64" in
13293'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
13294 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
13295 ;;
13296*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
13297 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
13298 ;;
13299esac
13300
13301
13302echo " "
13303$echo "Checking the format strings to be used for Perl's internal types..." >&4
13304
13305if $test X"$ivsize" = X8; then
13306 ivdformat="$sPRId64"
13307 uvuformat="$sPRIu64"
13308 uvoformat="$sPRIo64"
13309 uvxformat="$sPRIx64"
13310 uvXUformat="$sPRIXU64"
13311else
13312 if $test X"$ivsize" = X"$longsize"; then
13313 ivdformat='"ld"'
13314 uvuformat='"lu"'
13315 uvoformat='"lo"'
13316 uvxformat='"lx"'
13317 uvXUformat='"lX"'
13318 else
13319 if $test X"$ivsize" = X"$intsize"; then
13320 ivdformat='"d"'
13321 uvuformat='"u"'
13322 uvoformat='"o"'
13323 uvxformat='"x"'
13324 uvXUformat='"X"'
13325 else
13326 : far out
13327 if $test X"$ivsize" = X"$shortsize"; then
13328 ivdformat='"hd"'
13329 uvuformat='"hu"'
13330 uvoformat='"ho"'
13331 uvxformat='"hx"'
13332 uvXUformat='"hX"'
13333 fi
13334 fi
13335 fi
13336fi
13337
13338if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13339 nveformat="$sPRIeldbl"
13340 nvfformat="$sPRIfldbl"
13341 nvgformat="$sPRIgldbl"
13342 nvEUformat="$sPRIEUldbl"
13343 nvFUformat="$sPRIFUldbl"
13344 nvGUformat="$sPRIGUldbl"
13345else
13346 nveformat='"e"'
13347 nvfformat='"f"'
13348 nvgformat='"g"'
13349 nvEUformat='"E"'
13350 nvFUformat='"F"'
13351 nvGUformat='"G"'
13352fi
13353
13354case "$ivdformat" in
13355'') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13356 exit 1
13357 ;;
13358esac
13359
13360
13361echo " "
13362$echo "Checking the format string to be used for gids..." >&4
13363
13364case "$gidsign" in
13365-1) if $test X"$gidsize" = X"$ivsize"; then
13366 gidformat="$ivdformat"
13367 else
13368 if $test X"$gidsize" = X"$longsize"; then
13369 gidformat='"ld"'
13370 else
13371 if $test X"$gidsize" = X"$intsize"; then
13372 gidformat='"d"'
13373 else
13374 if $test X"$gidsize" = X"$shortsize"; then
13375 gidformat='"hd"'
13376 fi
13377 fi
13378 fi
13379 fi
13380 ;;
13381*) if $test X"$gidsize" = X"$uvsize"; then
13382 gidformat="$uvuformat"
13383 else
13384 if $test X"$gidsize" = X"$longsize"; then
13385 gidformat='"lu"'
13386 else
13387 if $test X"$gidsize" = X"$intsize"; then
13388 gidformat='"u"'
13389 else
13390 if $test X"$gidsize" = X"$shortsize"; then
13391 gidformat='"hu"'
13392 fi
13393 fi
13394 fi
13395 fi
13396 ;;
13397esac
13398
13399: see if getgroups exists
13400set getgroups d_getgrps
13401eval $inlibc
13402
13403: see if setgroups exists
13404set setgroups d_setgrps
13405eval $inlibc
13406
13407
13408: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13409echo " "
13410case "$d_getgrps$d_setgrps" in
13411*define*)
13412 case "$groupstype" in
13413 '') dflt="$gidtype" ;;
13414 *) dflt="$groupstype" ;;
13415 esac
13416 $cat <<EOM
13417What type of pointer is the second argument to getgroups() and setgroups()?
13418Usually this is the same as group ids, $gidtype, but not always.
13419
13420EOM
13421 rp='What type pointer is the second argument to getgroups() and setgroups()?'
13422 . ./myread
13423 groupstype="$ans"
13424 ;;
13425*) groupstype="$gidtype";;
13426esac
13427
13428echo " "
13429echo "Checking if your $make program sets \$(MAKE)..." >&4
13430case "$make_set_make" in
13431'')
13432 $sed 's/^X //' > testmake.mak << 'EOF'
13433Xall:
13434X @echo 'maketemp="$(MAKE)"'
13435EOF
13436 case "`$make -f testmake.mak 2>/dev/null`" in
13437 *maketemp=*) make_set_make='#' ;;
13438 *) make_set_make="MAKE=$make" ;;
13439 esac
13440 $rm -f testmake.mak
13441 ;;
13442esac
13443case "$make_set_make" in
13444'#') echo "Yup, it does.";;
13445*) echo "Nope, it doesn't.";;
13446esac
13447
13448: see what type is used for mode_t
13449rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13450set mode_t modetype int stdio.h sys/types.h
13451eval $typedef_ask
13452
13453: define a fucntion to check prototypes
13454$cat > protochk <<EOSH
13455$startsh
13456cc="$cc"
13457optimize="$optimize"
13458ccflags="$ccflags"
13459prototype="$prototype"
13460define="$define"
13461rm=$rm
13462EOSH
13463
13464$cat >> protochk <<'EOSH'
13465
13466$rm -f try.c
13467foo="$1"
13468shift
13469while test $# -ge 2; do
13470 case "$1" in
13471 $define) echo "#include <$2>" >> try.c ;;
13472 literal) echo "$2" >> try.c ;;
13473 esac
13474 shift 2
13475done
13476test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
13477cat >> try.c <<'EOCP'
13478#ifdef CAN_PROTOTYPE
13479#define _(args) args
13480#else
13481#define _(args) ()
13482#endif
13483EOCP
13484echo "$foo" >> try.c
13485echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13486$cc $optimize $ccflags -c try.c > /dev/null 2>&1
13487status=$?
13488$rm -f try.[co]
13489exit $status
13490EOSH
13491chmod +x protochk
13492$eunicefix protochk
13493
13494: see what type is used for size_t
13495rp="What is the type used for the length parameter for string functions?"
13496set size_t sizetype 'unsigned int' stdio.h sys/types.h
13497eval $typedef_ask
13498
13499: check for type of arguments to gethostbyaddr.
13500if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13501 case "$d_gethbyaddr" in
13502 $define)
13503 $cat <<EOM
13504
13505Checking to see what type of arguments are accepted by gethostbyaddr().
13506EOM
13507 hdrs="$define sys/types.h
13508 $d_socket sys/socket.h
13509 $i_niin netinet/in.h
13510 $i_netdb netdb.h
13511 $i_unistd unistd.h"
13512 : The first arg can 'char *' or 'void *'
13513 : The second arg is some of integral type
13514 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13515 for yyy in size_t long int; do
13516 case "$netdb_host_type" in
13517 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13518 if ./protochk "$try" $hdrs; then
13519 echo "Your system accepts $xxx for the first arg."
13520 echo "...and $yyy for the second arg."
13521 netdb_host_type="$xxx"
13522 netdb_hlen_type="$yyy"
13523 fi
13524 ;;
13525 esac
13526 done
13527 done
13528 : In case none of those worked, prompt the user.
13529 case "$netdb_host_type" in
13530 '') rp='What is the type for the 1st argument to gethostbyaddr?'
13531 dflt='char *'
13532 . ./myread
13533 netdb_host_type=$ans
13534 rp='What is the type for the 2nd argument to gethostbyaddr?'
13535 dflt="$sizetype"
13536 . ./myread
13537 netdb_hlen_type=$ans
13538 ;;
13539 esac
13540 ;;
13541 *) : no gethostbyaddr, so pick harmless defaults
13542 netdb_host_type='char *'
13543 netdb_hlen_type="$sizetype"
13544 ;;
13545 esac
13546 # Remove the "const" if needed. -- but then we'll have a
13547 # prototype clash!
13548 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13549fi
13550
13551: check for type of argument to gethostbyname.
13552if test "X$netdb_name_type" = X ; then
13553 case "$d_gethbyname" in
13554 $define)
13555 $cat <<EOM
13556
13557Checking to see what type of argument is accepted by gethostbyname().
13558EOM
13559 hdrs="$define sys/types.h
13560 $d_socket sys/socket.h
13561 $i_niin netinet/in.h
13562 $i_netdb netdb.h
13563 $i_unistd unistd.h"
13564 for xxx in "const char *" "char *"; do
13565 case "$netdb_name_type" in
13566 '') try="extern struct hostent *gethostbyname($xxx);"
13567 if ./protochk "$try" $hdrs; then
13568 echo "Your system accepts $xxx."
13569 netdb_name_type="$xxx"
13570 fi
13571 ;;
13572 esac
13573 done
13574 : In case none of those worked, prompt the user.
13575 case "$netdb_name_type" in
13576 '') rp='What is the type for the 1st argument to gethostbyname?'
13577 dflt='char *'
13578 . ./myread
13579 netdb_name_type=$ans
13580 ;;
13581 esac
13582 ;;
13583 *) : no gethostbyname, so pick harmless default
13584 netdb_name_type='char *'
13585 ;;
13586 esac
13587fi
13588
13589: check for type of 1st argument to getnetbyaddr.
13590if test "X$netdb_net_type" = X ; then
13591 case "$d_getnbyaddr" in
13592 $define)
13593 $cat <<EOM
13594
13595Checking to see what type of 1st argument is accepted by getnetbyaddr().
13596EOM
13597 hdrs="$define sys/types.h
13598 $d_socket sys/socket.h
13599 $i_niin netinet/in.h
13600 $i_netdb netdb.h
13601 $i_unistd unistd.h"
13602 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13603 case "$netdb_net_type" in
13604 '') try="extern struct netent *getnetbyaddr($xxx, int);"
13605 if ./protochk "$try" $hdrs; then
13606 echo "Your system accepts $xxx."
13607 netdb_net_type="$xxx"
13608 fi
13609 ;;
13610 esac
13611 done
13612 : In case none of those worked, prompt the user.
13613 case "$netdb_net_type" in
13614 '') rp='What is the type for the 1st argument to getnetbyaddr?'
13615 dflt='long'
13616 . ./myread
13617 netdb_net_type=$ans
13618 ;;
13619 esac
13620 ;;
13621 *) : no getnetbyaddr, so pick harmless default
13622 netdb_net_type='long'
13623 ;;
13624 esac
13625fi
13626: locate the preferred pager for this system
13627case "$pager" in
13628'')
13629 dflt=''
13630 case "$pg" in
13631 /*) dflt=$pg;;
13632 [a-zA-Z]:/*) dflt=$pg;;
13633 esac
13634 case "$more" in
13635 /*) dflt=$more;;
13636 [a-zA-Z]:/*) dflt=$more;;
13637 esac
13638 case "$less" in
13639 /*) dflt=$less;;
13640 [a-zA-Z]:/*) dflt=$less;;
13641 esac
13642 case "$dflt" in
13643 '') dflt=/usr/ucb/more;;
13644 esac
13645 ;;
13646*) dflt="$pager";;
13647esac
13648echo " "
13649fn=f/
13650rp='What pager is used on your system?'
13651. ./getfile
13652pager="$ans"
13653
13654: see what type pids are declared as in the kernel
13655rp="What is the type of process ids on this system?"
13656set pid_t pidtype int stdio.h sys/types.h
13657eval $typedef_ask
13658
13659: Find earliest binary compatible site_perl subdirectory perl can use.
13660case "$bincompat5005" in
13661"$define") xs_apiversion='5.005' ;;
13662*) xs_apiversion=$version ;; # The current site_perl version.
13663esac
13664: Find earliest pure perl site_perl subdirectory perl can use.
13665: The versioned directories started at 5.005.
13666pm_apiversion='5.005'
13667
13668: check for length of pointer
13669echo " "
13670case "$ptrsize" in
13671'')
13672 echo "Checking to see how big your pointers are..." >&4
13673 if test "$voidflags" -gt 7; then
13674 echo '#define VOID_PTR char *' > try.c
13675 else
13676 echo '#define VOID_PTR void *' > try.c
13677 fi
13678 $cat >>try.c <<'EOCP'
13679#include <stdio.h>
13680int main()
13681{
13682 printf("%d\n", (int)sizeof(VOID_PTR));
13683 exit(0);
13684}
13685EOCP
13686 set try
13687 if eval $compile_ok; then
13688 ptrsize=`./try`
13689 echo "Your pointers are $ptrsize bytes long."
13690 else
13691 dflt='4'
13692 echo "(I can't seem to compile the test program. Guessing...)" >&4
13693 rp="What is the size of a pointer (in bytes)?"
13694 . ./myread
13695 ptrsize="$ans"
13696 fi
13697 ;;
13698esac
13699$rm -f try.c try
13700
13701: see if ar generates random libraries by itself
13702echo " "
13703echo "Checking how to generate random libraries on your machine..." >&4
13704echo 'int bar1() { return bar2(); }' > bar1.c
13705echo 'int bar2() { return 2; }' > bar2.c
13706$cat > foo.c <<'EOP'
13707int main() { printf("%d\n", bar1()); exit(0); }
13708EOP
13709$cc $ccflags -c bar1.c >/dev/null 2>&1
13710$cc $ccflags -c bar2.c >/dev/null 2>&1
13711$cc $ccflags -c foo.c >/dev/null 2>&1
13712$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 13713if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
b4eb6b3d
JH
13714 ./foobar >/dev/null 2>&1; then
13715 echo "$ar appears to generate random libraries itself."
13716 orderlib=false
13717 ranlib=":"
13718elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 13719 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
b4eb6b3d
JH
13720 ./foobar >/dev/null 2>&1; then
13721 echo "a table of contents needs to be added with '$ar ts'."
13722 orderlib=false
13723 ranlib="$ar ts"
13724else
13725 case "$ranlib" in
13726 :) ranlib='';;
13727 '')
13728 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13729 $test -f $ranlib || ranlib=''
13730 ;;
13731 esac
13732 if $test -n "$ranlib"; then
13733 echo "your system has '$ranlib'; we'll use that."
13734 orderlib=false
13735 else
13736 echo "your system doesn't seem to support random libraries"
13737 echo "so we'll use lorder and tsort to order the libraries."
13738 orderlib=true
13739 ranlib=":"
13740 fi
13741fi
13742$rm -f foo* bar*
13743
13744: check for type of arguments to select.
13745case "$selecttype" in
13746'') case "$d_select" in
13747 $define)
13748 echo " "
13749 $cat <<EOM
13750Checking to see what type of arguments are accepted by select().
13751EOM
13752 hdrs="$define sys/types.h
13753 $i_systime sys/time.h
13754 $i_sysselct sys/select.h
13755 $d_socket sys/socket.h"
13756 : The first arg can be int, unsigned, or size_t
13757 : The last arg may or may not be 'const'
13758 val=''
13759 : void pointer has been seen but using that
13760 : breaks the selectminbits test
13761 for xxx in 'fd_set *' 'int *'; do
13762 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13763 for tmo in 'struct timeval *' 'const struct timeval *'; do
13764 case "$val" in
13765 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13766 if ./protochk "$try" $hdrs; then
13767 echo "Your system accepts $xxx."
13768 val="$xxx"
13769 fi
13770 ;;
13771 esac
13772 done
13773 done
13774 done
13775 case "$val" in
13776 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13777 case "$d_fd_set" in
13778 $define) dflt="fd_set *" ;;
13779 *) dflt="int *" ;;
13780 esac
13781 . ./myread
13782 val=$ans
13783 ;;
13784 esac
13785 selecttype="$val"
13786 ;;
13787 *) : no select, so pick a harmless default
13788 selecttype='int *'
13789 ;;
13790 esac
13791 ;;
13792esac
13793
13794: check for the select 'width'
13795case "$selectminbits" in
13796'') case "$d_select" in
13797 $define)
13798 $cat <<EOM
13799
13800Checking to see on how many bits at a time your select() operates...
13801EOM
13802 $cat >try.c <<EOCP
13803#include <sys/types.h>
13804#$i_time I_TIME
13805#$i_systime I_SYS_TIME
13806#$i_systimek I_SYS_TIME_KERNEL
13807#ifdef I_TIME
13808# include <time.h>
13809#endif
13810#ifdef I_SYS_TIME
13811# ifdef I_SYS_TIME_KERNEL
13812# define KERNEL
13813# endif
13814# include <sys/time.h>
13815# ifdef I_SYS_TIME_KERNEL
13816# undef KERNEL
13817# endif
13818#endif
13819#$i_sysselct I_SYS_SELECT
13820#ifdef I_SYS_SELECT
13821#include <sys/select.h>
13822#endif
13823#$d_socket HAS_SOCKET
13824#ifdef HAS_SOCKET
13825# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13826#endif
13827#include <stdio.h>
13828$selecttype b;
13829#define S sizeof(*(b))
13830#define MINBITS 64
13831#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13832#define NBITS (NBYTES * 8)
13833int main() {
13834 char s[NBYTES];
13835 struct timeval t;
13836 int i;
13837 FILE* fp;
13838 int fd;
13839
13840 fclose(stdin);
13841 fp = fopen("try.c", "r");
13842 if (fp == 0)
13843 exit(1);
13844 fd = fileno(fp);
13845 if (fd < 0)
13846 exit(2);
13847 b = ($selecttype)s;
13848 for (i = 0; i < NBITS; i++)
13849 FD_SET(i, b);
13850 t.tv_sec = 0;
13851 t.tv_usec = 0;
13852 select(fd + 1, b, 0, 0, &t);
13853 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13854 printf("%d\n", i + 1);
13855 return 0;
13856}
13857EOCP
13858 set try
13859 if eval $compile_ok; then
13860 selectminbits=`./try`
13861 case "$selectminbits" in
13862 '') cat >&4 <<EOM
13863Cannot figure out on how many bits at a time your select() operates.
13864I'll play safe and guess it is 32 bits.
13865EOM
13866 selectminbits=32
13867 bits="32 bits"
13868 ;;
13869 1) bits="1 bit" ;;
13870 *) bits="$selectminbits bits" ;;
13871 esac
13872 echo "Your select() operates on $bits at a time." >&4
13873 else
13874 rp='What is the minimum number of bits your select() operates on?'
13875 case "$byteorder" in
13876 1234|12345678) dflt=32 ;;
13877 *) dflt=1 ;;
13878 esac
13879 . ./myread
13880 val=$ans
13881 selectminbits="$val"
13882 fi
13883 $rm -f try.* try
13884 ;;
13885 *) : no select, so pick a harmless default
13886 selectminbits='32'
13887 ;;
13888 esac
13889 ;;
13890esac
13891
13892: Trace out the files included by signal.h, then look for SIGxxx names.
13893: Remove SIGARRAYSIZE used by HPUX.
13894: Remove SIGSTKSIZE used by Linux.
13895: Remove SIGSTKSZ used by Posix.
13896: Remove SIGTYP void lines used by OS2.
13897: Some cpps, like os390, dont give the file name anywhere
13898if [ "X$fieldn" = X ]; then
13899 : Just make some guesses. We check them later.
13900 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13901else
13902 xxx=`echo '#include <signal.h>' |
13903 $cppstdin $cppminus $cppflags 2>/dev/null |
13904 $grep '^[ ]*#.*include' |
13905 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13906fi
13907: Check this list of files to be sure we have parsed the cpp output ok.
13908: This will also avoid potentially non-existent files, such
13909: as ../foo/bar.h
13910xxxfiles=''
13911for xx in $xxx /dev/null ; do
13912 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13913done
13914: If we have found no files, at least try signal.h
13915case "$xxxfiles" in
13916'') xxxfiles=`./findhdr signal.h` ;;
13917esac
13918xxx=`awk '
13919$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13920 print substr($2, 4, 20)
13921}
13922$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13923 print substr($3, 4, 20)
13924}' $xxxfiles`
13925: Append some common names just in case the awk scan failed.
13926xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13927xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13928xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13929xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13930xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13931
13932: generate a few handy files for later
13933$cat > signal.c <<'EOCP'
13934#include <sys/types.h>
13935#include <signal.h>
13936#include <stdio.h>
13937int main() {
13938
13939/* Strange style to avoid deeply-nested #if/#else/#endif */
13940#ifndef NSIG
13941# ifdef _NSIG
13942# define NSIG (_NSIG)
13943# endif
13944#endif
13945
13946#ifndef NSIG
13947# ifdef SIGMAX
13948# define NSIG (SIGMAX+1)
13949# endif
13950#endif
13951
13952#ifndef NSIG
13953# ifdef SIG_MAX
13954# define NSIG (SIG_MAX+1)
13955# endif
13956#endif
13957
13958#ifndef NSIG
13959# ifdef MAXSIG
13960# define NSIG (MAXSIG+1)
13961# endif
13962#endif
13963
13964#ifndef NSIG
13965# ifdef MAX_SIG
13966# define NSIG (MAX_SIG+1)
13967# endif
13968#endif
13969
13970#ifndef NSIG
13971# ifdef SIGARRAYSIZE
13972# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13973# endif
13974#endif
13975
13976#ifndef NSIG
13977# ifdef _sys_nsig
13978# define NSIG (_sys_nsig) /* Solaris 2.5 */
13979# endif
13980#endif
13981
13982/* Default to some arbitrary number that's big enough to get most
13983 of the common signals.
13984*/
13985#ifndef NSIG
13986# define NSIG 50
13987#endif
13988
13989printf("NSIG %d\n", NSIG);
13990
13991#ifndef JUST_NSIG
13992
13993EOCP
13994
13995echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13996{
13997 printf "#ifdef SIG"; printf $1; printf "\n"
13998 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13999 printf $1; printf ");\n"
14000 printf "#endif\n"
14001}
14002END {
14003 printf "#endif /* JUST_NSIG */\n";
14004 printf "exit(0);\n}\n";
14005}
14006' >>signal.c
14007$cat >signal.awk <<'EOP'
14008BEGIN { ndups = 0 }
14009$1 ~ /^NSIG$/ { nsig = $2 }
14010($1 !~ /^NSIG$/) && (NF == 2) {
14011 if ($2 > maxsig) { maxsig = $2 }
14012 if (sig_name[$2]) {
14013 dup_name[ndups] = $1
14014 dup_num[ndups] = $2
14015 ndups++
14016 }
14017 else {
14018 sig_name[$2] = $1
14019 sig_num[$2] = $2
14020 }
14021}
14022END {
14023 if (nsig == 0) {
14024 nsig = maxsig + 1
14025 }
14026 printf("NSIG %d\n", nsig);
14027 for (n = 1; n < nsig; n++) {
14028 if (sig_name[n]) {
14029 printf("%s %d\n", sig_name[n], sig_num[n])
14030 }
14031 else {
14032 printf("NUM%d %d\n", n, n)
14033 }
14034 }
14035 for (n = 0; n < ndups; n++) {
14036 printf("%s %d\n", dup_name[n], dup_num[n])
14037 }
14038}
14039EOP
14040$cat >signal_cmd <<EOS
14041$startsh
14042if $test -s signal.lst; then
14043 echo "Using your existing signal.lst file"
14044 exit 0
14045fi
14046xxx="$xxx"
14047EOS
14048$cat >>signal_cmd <<'EOS'
14049
14050set signal
14051if eval $compile_ok; then
14052 ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14053else
14054 echo "(I can't seem be able to compile the whole test program)" >&4
14055 echo "(I'll try it in little pieces.)" >&4
14056 set signal -DJUST_NSIG
14057 if eval $compile_ok; then
14058 ./signal$_exe > signal.nsg
14059 $cat signal.nsg
14060 else
14061 echo "I can't seem to figure out how many signals you have." >&4
14062 echo "Guessing 50." >&4
14063 echo 'NSIG 50' > signal.nsg
14064 fi
14065 : Now look at all the signal names, one at a time.
14066 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14067 $cat > signal.c <<EOCP
14068#include <sys/types.h>
14069#include <signal.h>
14070#include <stdio.h>
14071int main() {
14072printf("$xx %d\n", SIG${xx});
14073return 0;
14074}
14075EOCP
14076 set signal
14077 if eval $compile; then
14078 echo "SIG${xx} found."
14079 ./signal$_exe >> signal.ls1
14080 else
14081 echo "SIG${xx} NOT found."
14082 fi
14083 done
14084 if $test -s signal.ls1; then
14085 $cat signal.nsg signal.ls1 |
14086 $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14087 fi
14088
14089fi
14090if $test -s signal.lst; then
14091 :
14092else
14093 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14094 echo 'kill -l' >signal
14095 set X `csh -f <signal`
14096 $rm -f signal
14097 shift
14098 case $# in
14099 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14100 esac
14101 echo $@ | $tr ' ' $trnl | \
14102 $awk '{ printf "%s %d\n", $1, ++s; }
14103 END { printf "NSIG %d\n", ++s }' >signal.lst
14104fi
14105$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14106EOS
14107chmod a+x signal_cmd
14108$eunicefix signal_cmd
14109
14110: generate list of signal names
14111echo " "
14112case "$sig_name_init" in
14113'') doinit=yes ;;
14114*) case "$sig_num_init" in
14115 ''|*,*) doinit=yes ;;
14116 esac ;;
14117esac
14118case "$doinit" in
14119yes)
14120 echo "Generating a list of signal names and numbers..." >&4
14121 . ./signal_cmd
14122 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14123 sig_name=`$awk 'BEGIN { printf "ZERO " }
14124 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14125 sig_num=`$awk 'BEGIN { printf "0 " }
14126 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14127 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
14128 !/^NSIG/ { printf "\"%s\", ", $1 }
14129 END { printf "0\n" }' signal.lst`
14130 sig_num_init=`$awk 'BEGIN { printf "0, " }
14131 !/^NSIG/ { printf "%d, ", $2}
14132 END { printf "0\n"}' signal.lst`
14133 ;;
14134esac
14135echo "The following $sig_count signals are available:"
14136echo " "
14137echo $sig_name | $awk \
14138'BEGIN { linelen = 0 }
14139{
14140 for (i = 1; i <= NF; i++) {
14141 name = "SIG" $i " "
14142 linelen = linelen + length(name)
14143 if (linelen > 70) {
14144 printf "\n"
14145 linelen = length(name)
14146 }
14147 printf "%s", name
14148 }
14149 printf "\n"
14150}'
14151$rm -f signal signal.c signal.awk signal.lst signal_cmd
14152
14153echo " "
14154case "$sizetype" in
14155*_t) zzz="$sizetype" ;;
14156*) zzz="filesize" ;;
14157esac
14158echo "Checking the size of $zzz..." >&4
14159cat > try.c <<EOCP
14160#include <sys/types.h>
14161#include <stdio.h>
14162int main() {
14163 printf("%d\n", (int)sizeof($sizetype));
14164 exit(0);
14165}
14166EOCP
14167set try
14168if eval $compile_ok; then
14169 yyy=`./try`
14170 case "$yyy" in
14171 '') sizesize=4
14172 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14173 ;;
14174 *) sizesize=$yyy
14175 echo "Your $zzz size is $sizesize bytes."
14176 ;;
14177 esac
14178else
14179 sizesize=4
14180 echo "(I can't compile the test program--guessing $sizesize.)" >&4
14181fi
14182
14183
14184: check for socklen_t
14185echo " "
14186echo "Checking to see if you have socklen_t..." >&4
14187$cat >try.c <<EOCP
14188#include <sys/types.h>
14189#$d_socket HAS_SOCKET
14190#ifdef HAS_SOCKET
14191#include <sys/socket.h>
14192#endif
14193int main() { socklen_t x = 16; }
14194EOCP
14195set try
14196if eval $compile; then
14197 val="$define"
14198 echo "You have socklen_t."
14199else
14200 val="$undef"
14201 echo "You do not have socklen_t."
14202 case "$sizetype" in
14203 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14204 esac
14205fi
14206$rm -f try try.*
14207set d_socklen_t
14208eval $setvar
14209
14210: check for type of the size argument to socket calls
14211case "$d_socket" in
14212"$define")
14213 $cat <<EOM
14214
14215Checking to see what type is the last argument of accept().
14216EOM
14217 hdrs="$define sys/types.h $d_socket sys/socket.h"
14218 yyy=''
14219 case "$d_socklen_t" in
14220 "$define") yyy="$yyy socklen_t"
14221 esac
14222 yyy="$yyy $sizetype int long unsigned"
14223 for xxx in $yyy; do
14224 case "$socksizetype" in
14225 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
14226 if ./protochk "$try" $hdrs; then
14227 echo "Your system accepts '$xxx *' for the last argument of accept()."
14228 socksizetype="$xxx"
14229 fi
14230 ;;
14231 esac
14232 done
14233: In case none of those worked, prompt the user.
14234 case "$socksizetype" in
14235 '') rp='What is the type for socket address structure sizes?'
14236 dflt='int'
14237 . ./myread
14238 socksizetype=$ans
14239 ;;
14240 esac
14241 ;;
14242*) : no sockets, so pick relatively harmless default
14243 socksizetype='int'
14244 ;;
14245esac
14246
14247: see what type is used for signed size_t
14248set ssize_t ssizetype int stdio.h sys/types.h
14249eval $typedef
14250dflt="$ssizetype"
14251$cat > ssize.c <<EOM
14252#include <stdio.h>
14253#include <sys/types.h>
14254#define Size_t $sizetype
14255#define SSize_t $dflt
14256int main()
14257{
14258 if (sizeof(Size_t) == sizeof(SSize_t))
14259 printf("$dflt\n");
14260 else if (sizeof(Size_t) == sizeof(int))
14261 printf("int\n");
14262 else
14263 printf("long\n");
14264 exit(0);
14265}
14266EOM
14267echo " "
14268set ssize
14269if eval $compile_ok && ./ssize > /dev/null; then
14270 ssizetype=`./ssize`
14271 echo "I'll be using $ssizetype for functions returning a byte count." >&4
14272else
14273 $cat >&4 <<EOM
14274Help! I can't compile and run the ssize_t test program: please enlighten me!
14275(This is probably a misconfiguration in your system or libraries, and
14276you really ought to fix it. Still, I'll try anyway.)
14277
14278I need a type that is the same size as $sizetype, but is guaranteed to
14279be signed. Common values are ssize_t, int and long.
14280
14281EOM
14282 rp="What signed type is the same size as $sizetype?"
14283 . ./myread
14284 ssizetype="$ans"
14285fi
14286$rm -f ssize ssize.*
14287
14288: see what type of char stdio uses.
14289echo " "
14290if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
14291 echo "Your stdio uses unsigned chars." >&4
14292 stdchar="unsigned char"
14293else
14294 echo "Your stdio uses signed chars." >&4
14295 stdchar="char"
14296fi
14297
14298: see if time exists
14299echo " "
14300if test "X$d_time" = X -o X"$timetype" = X; then
14301 if set time val -f d_time; eval $csym; $val; then
14302 echo 'time() found.' >&4
14303 val="$define"
14304 rp="What is the type returned by time() on this system?"
14305 set time_t timetype long stdio.h sys/types.h
14306 eval $typedef_ask
14307 else
14308 echo 'time() not found, hope that will do.' >&4
14309 val="$undef"
14310 timetype='int';
14311 fi
14312 set d_time
14313 eval $setvar
14314fi
14315
14316: see what type uids are declared as in the kernel
14317echo " "
14318echo "Looking for the type for user ids returned by getuid()."
14319set uid_t uidtype xxx stdio.h sys/types.h
14320eval $typedef
14321case "$uidtype" in
14322xxx)
14323 xxx=`./findhdr sys/user.h`
14324 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14325 case $1 in
14326 unsigned) dflt="$1 $2" ;;
14327 *) dflt="$1" ;;
14328 esac
14329 ;;
14330*) dflt="$uidtype";;
14331esac
14332case "$uidtype" in
14333uid_t) echo "uid_t found." ;;
14334*) rp="What is the type for user ids returned by getuid()?"
14335 . ./myread
14336 uidtype="$ans"
14337 ;;
14338esac
14339
14340echo " "
14341case "$uidtype" in
14342*_t) zzz="$uidtype" ;;
14343*) zzz="uid" ;;
14344esac
14345echo "Checking the size of $zzz..." >&4
14346cat > try.c <<EOCP
14347#include <sys/types.h>
14348#include <stdio.h>
14349int main() {
14350 printf("%d\n", (int)sizeof($uidtype));
14351 exit(0);
14352}
14353EOCP
14354set try
14355if eval $compile_ok; then
14356 yyy=`./try`
14357 case "$yyy" in
14358 '') uidsize=4
14359 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14360 ;;
14361 *) uidsize=$yyy
14362 echo "Your $zzz is $uidsize bytes long."
14363 ;;
14364 esac
14365else
14366 uidsize=4
14367 echo "(I can't compile the test program--guessing $uidsize.)" >&4
14368fi
14369
14370echo " "
14371case "$uidtype" in
14372*_t) zzz="$uidtype" ;;
14373*) zzz="uid" ;;
14374esac
14375echo "Checking the sign of $zzz..." >&4
14376cat > try.c <<EOCP
14377#include <sys/types.h>
14378#include <stdio.h>
14379int main() {
14380 $uidtype foo = -1;
14381 if (foo < 0)
14382 printf("-1\n");
14383 else
14384 printf("1\n");
14385}
14386EOCP
14387set try
14388if eval $compile; then
14389 yyy=`./try`
14390 case "$yyy" in
14391 '') uidsign=1
14392 echo "(I can't execute the test program--guessing unsigned.)" >&4
14393 ;;
14394 *) uidsign=$yyy
14395 case "$uidsign" in
14396 1) echo "Your $zzz is unsigned." ;;
14397 -1) echo "Your $zzz is signed." ;;
14398 esac
14399 ;;
14400 esac
14401else
14402 uidsign=1
14403 echo "(I can't compile the test program--guessing unsigned.)" >&4
14404fi
14405
14406
14407
14408echo " "
14409$echo "Checking the format string to be used for uids..." >&4
14410
14411case "$uidsign" in
14412-1) if $test X"$uidsize" = X"$ivsize"; then
14413 uidformat="$ivdformat"
14414 else
14415 if $test X"$uidsize" = X"$longsize"; then
14416 uidformat='"ld"'
14417 else
14418 if $test X"$uidsize" = X"$intsize"; then
14419 uidformat='"d"'
14420 else
14421 if $test X"$uidsize" = X"$shortsize"; then
14422 uidformat='"hd"'
14423 fi
14424 fi
14425 fi
14426 fi
14427 ;;
14428*) if $test X"$uidsize" = X"$uvsize"; then
14429 uidformat="$uvuformat"
14430 else
14431 if $test X"$uidsize" = X"$longsize"; then
14432 uidformat='"lu"'
14433 else
14434 if $test X"$uidsize" = X"$intsize"; then
14435 uidformat='"u"'
14436 else
14437 if $test X"$uidsize" = X"$shortsize"; then
14438 uidformat='"hu"'
14439 fi
14440 fi
14441 fi
14442 fi
14443 ;;
14444esac
14445
14446: see if dbm.h is available
14447: see if dbmclose exists
14448set dbmclose d_dbmclose
14449eval $inlibc
14450
14451case "$d_dbmclose" in
14452$define)
14453 set dbm.h i_dbm
14454 eval $inhdr
14455 case "$i_dbm" in
14456 $define)
14457 val="$undef"
14458 set i_rpcsvcdbm
14459 eval $setvar
14460 ;;
14461 *) set rpcsvc/dbm.h i_rpcsvcdbm
14462 eval $inhdr
14463 ;;
14464 esac
14465 ;;
14466*) echo "We won't be including <dbm.h>"
14467 val="$undef"
14468 set i_dbm
14469 eval $setvar
14470 val="$undef"
14471 set i_rpcsvcdbm
14472 eval $setvar
14473 ;;
14474esac
14475
14476: see if this is a sys/file.h system
14477val=''
14478set sys/file.h val
14479eval $inhdr
14480
14481: do we need to include sys/file.h ?
14482case "$val" in
14483"$define")
14484 echo " "
14485 if $h_sysfile; then
14486 val="$define"
14487 echo "We'll be including <sys/file.h>." >&4
14488 else
14489 val="$undef"
14490 echo "We won't be including <sys/file.h>." >&4
14491 fi
14492 ;;
14493*)
14494 h_sysfile=false
14495 ;;
14496esac
14497set i_sysfile
14498eval $setvar
14499
14500: see if fcntl.h is there
14501val=''
14502set fcntl.h val
14503eval $inhdr
14504
14505: see if we can include fcntl.h
14506case "$val" in
14507"$define")
14508 echo " "
14509 if $h_fcntl; then
14510 val="$define"
14511 echo "We'll be including <fcntl.h>." >&4
14512 else
14513 val="$undef"
14514 if $h_sysfile; then
14515 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14516 else
14517 echo "We won't be including <fcntl.h>." >&4
14518 fi
14519 fi
14520 ;;
14521*)
14522 h_fcntl=false
14523 val="$undef"
14524 ;;
14525esac
14526set i_fcntl
14527eval $setvar
14528
14529: see if this is a iconv.h system
14530set iconv.h i_iconv
14531eval $inhdr
14532
14533: see if this is a ieeefp.h system
14534set ieeefp.h i_ieeefp
14535eval $inhdr
14536
14537: see if this is a libutil.h system
14538set libutil.h i_libutil
14539eval $inhdr
14540
14541: see if locale.h is available
14542set locale.h i_locale
14543eval $inhdr
14544
14545: see if mach cthreads are available
14546if test "X$usethreads" = "X$define"; then
14547 set mach/cthreads.h i_machcthr
14548 eval $inhdr
14549else
14550 i_machcthr="$undef"
14551fi
14552
14553
14554
14555: see if this is a math.h system
14556set math.h i_math
14557eval $inhdr
14558
14559: see if this is a mntent.h system
14560set mntent.h i_mntent
14561eval $inhdr
14562
14563: see if ndbm.h is available
14564set ndbm.h t_ndbm
14565eval $inhdr
14566case "$t_ndbm" in
14567$define)
14568 : see if dbm_open exists
14569 set dbm_open d_dbm_open
14570 eval $inlibc
14571 case "$d_dbm_open" in
14572 $undef)
14573 t_ndbm="$undef"
14574 echo "We won't be including <ndbm.h>"
14575 ;;
14576 esac
14577 ;;
14578esac
14579val="$t_ndbm"
14580set i_ndbm
14581eval $setvar
14582
14583: see if net/errno.h is available
14584val=''
14585set net/errno.h val
14586eval $inhdr
14587
14588: Unfortunately, it causes problems on some systems. Arrgh.
14589case "$val" in
14590$define)
14591 cat > try.c <<'EOM'
14592#include <stdio.h>
14593#include <errno.h>
14594#include <net/errno.h>
14595int func()
14596{
14597 return ENOTSOCK;
14598}
14599EOM
14600 if $cc $ccflags -c try.c >/dev/null 2>&1; then
14601 echo "We'll be including <net/errno.h>." >&4
14602 else
14603 echo "We won't be including <net/errno.h>." >&4
14604 val="$undef"
14605 fi
14606 $rm -f try.* try
14607 ;;
14608esac
14609set i_neterrno
14610eval $setvar
14611
14612: see if netinet/tcp.h is available
14613set netinet/tcp.h i_netinettcp
14614eval $inhdr
14615
14616: see if this is a poll.h system
14617set poll.h i_poll
14618eval $inhdr
14619
14620: see if this is a prot.h system
14621set prot.h i_prot
14622eval $inhdr
14623
14624echo " "
14625$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
14626$cat <<'EOSH' > Cppsym.know
14627a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14628AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14629alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14630ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14631BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14632BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14633bull c cadmus clipper CMU COFF COMPILER_VERSION
14634concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14635CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14636Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14637FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14638GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14639H3050R H3050RX hbullx20 hcx host_mips
14640hp200 hp300 hp700 HP700 hp800 hp9000
14641hp9000s200 hp9000s300 hp9000s400 hp9000s500
14642hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14643i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14644iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14645INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14646LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14647LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14648Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14649LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14650M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14651M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14652M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14653MATH_HAS_NO_SIDE_EFFECTS
14654mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14655mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14656mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14657MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14658mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14659NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 14660news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
14661ns32016 ns32332 ns32k nsc32000
14662OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14663pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14664pc532 pdp11 PGC PIC plexus PORTAR posix
14665POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14666POSIX_C_SOURCE POSIX_SOURCE POWER
14667PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14668riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14669SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14670sony sony_news sonyrisc sparc sparclite spectrum
14671stardent stdc STDC_EXT stratos sun sun3 sun386
14672Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14673SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14674SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14675sysV68 sysV88 Tek4132 Tek4300 titan
14676tower tower32 tower32_200 tower32_600 tower32_700
14677tower32_800 tower32_850 tss
14678u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14679ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14680unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14681Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14682XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14683XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14684z8000
14685EOSH
14686# Maybe put other stuff here too.
14687cat <<EOSH >>Cppsym.know
14688$osname
14689EOSH
14690./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14691./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14692$cat Cppsym.know > Cppsym.c
381aa1ff 14693$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
14694$rm -f Cppsym.a Cppsym.b Cppsym.c
14695cat <<EOSH > Cppsym
14696$startsh
14697if $test \$# -gt 0; then
14698 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14699 if $test -s Cppsym.got; then
14700 $rm -f Cppsym.got
14701 exit 0
14702 fi
14703 $rm -f Cppsym.got
14704 exit 1
14705else
14706 $tr " " "$trnl" | ./Cppsym.try
14707 exit 0
14708fi
14709EOSH
14710chmod +x Cppsym
14711$eunicefix Cppsym
14712cat <<EOSH > Cppsym.try
14713$startsh
14714cat <<'EOCP' > try.c
14715#include <stdio.h>
14716int main() {
14717EOCP
14718$awk \\
14719EOSH
14720cat <<'EOSH' >> Cppsym.try
14721'length($1) > 0 {
14722 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
14723 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
14724 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
14725 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
14726}' >> try.c
14727echo '}' >> try.c
14728EOSH
14729cat <<EOSH >> Cppsym.try
14730ccflags="$ccflags"
14731case "$osname-$gccversion" in
14732irix-) ccflags="\$ccflags -woff 1178" ;;
14733os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
14734esac
7a282f6d 14735$cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
b4eb6b3d
JH
14736EOSH
14737chmod +x Cppsym.try
14738$eunicefix Cppsym.try
14739./Cppsym < Cppsym.know > Cppsym.true
14740: now check the C compiler for additional symbols
14741postprocess_cc_v=''
14742case "$osname" in
14743aix) postprocess_cc_v="|$tr , ' '" ;;
14744esac
14745$cat >ccsym <<EOS
14746$startsh
14747$cat >tmp.c <<EOF
14748extern int foo;
14749EOF
14750for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14751do
14752 case "\$i" in
14753 -D*) echo "\$i" | $sed 's/^-D//';;
14754 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14755 esac
14756done
14757$rm -f try.c
14758EOS
14759postprocess_cc_v=''
14760chmod +x ccsym
14761$eunicefix ccsym
14762./ccsym > ccsym1.raw
14763if $test -s ccsym1.raw; then
14764 $sort ccsym1.raw | $uniq >ccsym.raw
14765else
14766 mv ccsym1.raw ccsym.raw
14767fi
14768
14769$awk '/\=/ { print $0; next }
14770 { print $0"=1" }' ccsym.raw >ccsym.list
14771$awk '/\=/ { print $0; next }
14772 { print $0"=1" }' Cppsym.true >ccsym.true
14773$comm -13 ccsym.true ccsym.list >ccsym.own
14774$comm -12 ccsym.true ccsym.list >ccsym.com
14775$comm -23 ccsym.true ccsym.list >ccsym.cpp
14776also=''
14777if $test -z ccsym.raw; then
14778 echo "Your C compiler doesn't seem to define any symbols!" >&4
14779 echo " "
14780 echo "However, your C preprocessor defines the following symbols:"
14781 $cat Cppsym.true
14782 ccsymbols=''
14783 cppsymbols=`$cat Cppsym.true`
14784 cppsymbols=`echo $cppsymbols`
14785 cppccsymbols="$cppsymbols"
14786else
14787 if $test -s ccsym.com; then
14788 echo "Your C compiler and pre-processor define these symbols:"
14789 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
14790 also='also '
14791 symbols='ones'
14792 cppccsymbols=`$cat ccsym.com`
14793 cppccsymbols=`echo $cppccsymbols`
14794 $test "$silent" || sleep 1
14795 fi
14796 if $test -s ccsym.cpp; then
14797 $test "$also" && echo " "
14798 echo "Your C pre-processor ${also}defines the following symbols:"
14799 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
14800 also='further '
14801 cppsymbols=`$cat ccsym.cpp`
14802 cppsymbols=`echo $cppsymbols`
14803 $test "$silent" || sleep 1
14804 fi
14805 if $test -s ccsym.own; then
14806 $test "$also" && echo " "
14807 echo "Your C compiler ${also}defines the following cpp symbols:"
14808 $sed -e 's/\(..*\)=1/\1/' ccsym.own
14809 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14810 ccsymbols=`$cat ccsym.own`
14811 ccsymbols=`echo $ccsymbols`
14812 $test "$silent" || sleep 1
14813 fi
14814fi
14815$rm -f ccsym* Cppsym.*
14816
14817: see if this is a termio system
14818val="$undef"
14819val2="$undef"
14820val3="$undef"
14821if $test `./findhdr termios.h`; then
14822 set tcsetattr i_termios
14823 eval $inlibc
14824 val3="$i_termios"
14825fi
14826echo " "
14827case "$val3" in
14828"$define") echo "You have POSIX termios.h... good!" >&4;;
14829*) if ./Cppsym pyr; then
14830 case "`/bin/universe`" in
14831 ucb) if $test `./findhdr sgtty.h`; then
14832 val2="$define"
14833 echo "<sgtty.h> found." >&4
14834 else
14835 echo "System is pyramid with BSD universe."
14836 echo "<sgtty.h> not found--you could have problems." >&4
14837 fi;;
14838 *) if $test `./findhdr termio.h`; then
14839 val="$define"
14840 echo "<termio.h> found." >&4
14841 else
14842 echo "System is pyramid with USG universe."
14843 echo "<termio.h> not found--you could have problems." >&4
14844 fi;;
14845 esac
14846 elif ./usg; then
14847 if $test `./findhdr termio.h`; then
14848 echo "<termio.h> found." >&4
14849 val="$define"
14850 elif $test `./findhdr sgtty.h`; then
14851 echo "<sgtty.h> found." >&4
14852 val2="$define"
14853 else
14854echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14855 fi
14856 else
14857 if $test `./findhdr sgtty.h`; then
14858 echo "<sgtty.h> found." >&4
14859 val2="$define"
14860 elif $test `./findhdr termio.h`; then
14861 echo "<termio.h> found." >&4
14862 val="$define"
14863 else
14864echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14865 fi
14866 fi;;
14867esac
14868set i_termio; eval $setvar
14869val=$val2; set i_sgtty; eval $setvar
14870val=$val3; set i_termios; eval $setvar
14871
14872: see if this is a shadow.h system
14873set shadow.h i_shadow
14874eval $inhdr
14875
14876: see if this is a socks.h system
14877set socks.h i_socks
14878eval $inhdr
14879
14880: see if stdarg is available
14881echo " "
14882if $test `./findhdr stdarg.h`; then
14883 echo "<stdarg.h> found." >&4
14884 valstd="$define"
14885else
14886 echo "<stdarg.h> NOT found." >&4
14887 valstd="$undef"
14888fi
14889
14890: see if varags is available
14891echo " "
14892if $test `./findhdr varargs.h`; then
14893 echo "<varargs.h> found." >&4
14894else
14895 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14896fi
14897
14898: set up the varargs testing programs
14899$cat > varargs.c <<EOP
14900#ifdef I_STDARG
14901#include <stdarg.h>
14902#endif
14903#ifdef I_VARARGS
14904#include <varargs.h>
14905#endif
14906
14907#ifdef I_STDARG
14908int f(char *p, ...)
14909#else
14910int f(va_alist)
14911va_dcl
14912#endif
14913{
14914 va_list ap;
14915#ifndef I_STDARG
14916 char *p;
14917#endif
14918#ifdef I_STDARG
14919 va_start(ap,p);
14920#else
14921 va_start(ap);
14922 p = va_arg(ap, char *);
14923#endif
14924 va_end(ap);
14925}
14926EOP
14927$cat > varargs <<EOP
14928$startsh
14929if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14930 echo "true"
14931else
14932 echo "false"
14933fi
14934$rm -f varargs$_o
14935EOP
14936chmod +x varargs
14937
14938: now check which varargs header should be included
14939echo " "
14940i_varhdr=''
14941case "$valstd" in
14942"$define")
14943 if `./varargs I_STDARG`; then
14944 val='stdarg.h'
14945 elif `./varargs I_VARARGS`; then
14946 val='varargs.h'
14947 fi
14948 ;;
14949*)
14950 if `./varargs I_VARARGS`; then
14951 val='varargs.h'
14952 fi
14953 ;;
14954esac
14955case "$val" in
14956'')
14957echo "I could not find the definition for va_dcl... You have problems..." >&4
14958 val="$undef"; set i_stdarg; eval $setvar
14959 val="$undef"; set i_varargs; eval $setvar
14960 ;;
14961*)
14962 set i_varhdr
14963 eval $setvar
14964 case "$i_varhdr" in
14965 stdarg.h)
14966 val="$define"; set i_stdarg; eval $setvar
14967 val="$undef"; set i_varargs; eval $setvar
14968 ;;
14969 varargs.h)
14970 val="$undef"; set i_stdarg; eval $setvar
14971 val="$define"; set i_varargs; eval $setvar
14972 ;;
14973 esac
14974 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14975esac
14976$rm -f varargs*
5f80c64f 14977
b4eb6b3d
JH
14978: see if stddef is available
14979set stddef.h i_stddef
14980eval $inhdr
923fc586 14981
b4eb6b3d
JH
14982: see if this is a sunmath.h system
14983set sunmath.h i_sunmath
14984eval $inhdr
5f80c64f 14985
b4eb6b3d
JH
14986: see if sys/access.h is available
14987set sys/access.h i_sysaccess
14988eval $inhdr
14989
14990: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14991set sys/filio.h i_sysfilio
14992eval $inhdr
14993echo " "
14994if $test `./findhdr sys/ioctl.h`; then
14995 val="$define"
14996 echo '<sys/ioctl.h> found.' >&4
14997else
14998 val="$undef"
14999 if $test $i_sysfilio = "$define"; then
15000 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 15001 else
b4eb6b3d
JH
15002 $test $i_sgtty = "$define" && xxx="sgtty.h"
15003 $test $i_termio = "$define" && xxx="termio.h"
15004 $test $i_termios = "$define" && xxx="termios.h"
15005echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15006 fi
15007fi
15008set i_sysioctl
15009eval $setvar
15010
15011
15012: see if this is a syslog.h system
15013set syslog.h i_syslog
15014eval $inhdr
15015
15016
15017: see if this is a sys/mode.h system
15018set sys/mode.h i_sysmode
15019eval $inhdr
15020
15021: see if sys/resource.h has to be included
15022set sys/resource.h i_sysresrc
15023eval $inhdr
15024
15025: see if sys/security.h is available
15026set sys/security.h i_syssecrt
15027eval $inhdr
15028
15029: see if this is a sys/statvfs.h system
15030set sys/statvfs.h i_sysstatvfs
15031eval $inhdr
15032
15033: see if this is a sys/uio.h system
15034set sys/uio.h i_sysuio
15035eval $inhdr
15036
15037: see if this is a sys/un.h system
15038set sys/un.h i_sysun
15039eval $inhdr
15040
15041
15042: see if this is a sys/utsname.h system
15043set sys/utsname.h i_sysutsname
15044eval $inhdr
15045
15046: see if this is a syswait system
15047set sys/wait.h i_syswait
15048eval $inhdr
15049
15050: see if this is a ustat.h system
15051set ustat.h i_ustat
15052eval $inhdr
15053
15054: see if this is an utime system
15055set utime.h i_utime
15056eval $inhdr
15057
15058: see if this is a values.h system
15059set values.h i_values
15060eval $inhdr
15061
15062: see if this is a vfork system
15063case "$d_vfork" in
15064"$define")
15065 set vfork.h i_vfork
15066 eval $inhdr
15067 ;;
15068*)
15069 i_vfork="$undef"
15070 ;;
15071esac
15072
15073: see if gdbm.h is available
15074set gdbm.h t_gdbm
15075eval $inhdr
15076case "$t_gdbm" in
15077$define)
15078 : see if gdbm_open exists
15079 set gdbm_open d_gdbm_open
15080 eval $inlibc
15081 case "$d_gdbm_open" in
15082 $undef)
15083 t_gdbm="$undef"
15084 echo "We won't be including <gdbm.h>"
5f80c64f 15085 ;;
b4eb6b3d
JH
15086 esac
15087 ;;
15088esac
15089val="$t_gdbm"
15090set i_gdbm
15091eval $setvar
15092
15093echo " "
15094echo "Looking for extensions..." >&4
15095: If we are using the old config.sh, known_extensions may contain
15096: old or inaccurate or duplicate values.
15097known_extensions=''
15098nonxs_extensions=''
15099: We do not use find because it might not be available.
15100: We do not just use MANIFEST because the user may have dropped
15101: some additional extensions into the source tree and expect them
15102: to be built.
15103
15104: Function to recursively find available extensions, ignoring DynaLoader
15105: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15106find_extensions='
15107 for xxx in *; do
15108 case "$xxx" in
15109 DynaLoader|dynaload) ;;
15110 *)
15111 if $test -f $xxx/$xxx.xs; then
15112 known_extensions="$known_extensions $1$xxx";
15113 elif $test -f $xxx/Makefile.PL; then
15114 nonxs_extensions="$nonxs_extensions $1$xxx";
15115 else
15116 if $test -d $xxx -a $# -lt 10; then
15117 set $1$xxx/ $*;
15118 cd $xxx;
15119 eval $find_extensions;
15120 cd ..;
15121 shift;
15122 fi;
15123 fi
15124 ;;
15125 esac;
15126 done'
15127tdir=`pwd`
15128cd $rsrc/ext
15129set X
15130shift
15131eval $find_extensions
15132set X $nonxs_extensions
15133shift
15134nonxs_extensions="$*"
15135set X $known_extensions
15136shift
15137known_extensions="$*"
15138cd $tdir
15139
15140: Now see which are supported on this system.
15141avail_ext=''
15142for xxx in $known_extensions ; do
15143 case "$xxx" in
15144 DB_File|db_file)
15145 case "$i_db" in
15146 $define) avail_ext="$avail_ext $xxx" ;;
15147 esac
15148 ;;
15149 GDBM_File|gdbm_fil)
15150 case "$i_gdbm" in
15151 $define) avail_ext="$avail_ext $xxx" ;;
15152 esac
15153 ;;
15154 NDBM_File|ndbm_fil)
15155 case "$i_ndbm" in
15156 $define)
15157 case "$osname-$use64bitint" in
15158 hpux-define)
15159 case "$libs" in
15160 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15161 esac
15162 ;;
15163 *) avail_ext="$avail_ext $xxx" ;;
15164 esac
15165 ;;
15166 esac
15167 ;;
15168 ODBM_File|odbm_fil)
15169 case "${i_dbm}${i_rpcsvcdbm}" in
15170 *"${define}"*)
15171 case "$osname-$use64bitint" in
15172 hpux-define)
15173 case "$libs" in
15174 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15175 esac
15176 ;;
15177 *) avail_ext="$avail_ext $xxx" ;;
15178 esac
15179 ;;
15180 esac
15181 ;;
15182 POSIX|posix)
15183 case "$useposix" in
15184 true|define|y) avail_ext="$avail_ext $xxx" ;;
15185 esac
15186 ;;
15187 Opcode|opcode)
15188 case "$useopcode" in
15189 true|define|y) avail_ext="$avail_ext $xxx" ;;
15190 esac
15191 ;;
15192 Socket|socket)
15193 case "$d_socket" in
15194 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15195 esac
15196 ;;
15197 Sys/Syslog|sys/syslog)
15198 : XXX syslog requires socket
15199 case "$d_socket" in
15200 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15201 esac
15202 ;;
15203 Thread|thread)
15204 case "$usethreads" in
15205 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15206 esac
15207 ;;
15208 IPC/SysV|ipc/sysv)
15209 : XXX Do we need a useipcsysv variable here
15210 case "${d_msg}${d_sem}${d_shm}" in
15211 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15212 esac
15213 ;;
15214 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
15215 ;;
15216 esac
b4eb6b3d 15217done
5f80c64f 15218
b4eb6b3d
JH
15219set X $avail_ext
15220shift
15221avail_ext="$*"
5f80c64f 15222
b4eb6b3d
JH
15223: Now see which nonxs extensions are supported on this system.
15224: For now assume all are.
15225nonxs_ext=''
15226for xxx in $nonxs_extensions ; do
15227 case "$xxx" in
15228 *) nonxs_ext="$nonxs_ext $xxx"
15229 ;;
15230 esac
15231done
5f80c64f 15232
b4eb6b3d
JH
15233set X $nonxs_ext
15234shift
15235nonxs_ext="$*"
15236
15237case $usedl in
15238$define)
15239 $cat <<EOM
15240A number of extensions are supplied with $package. You may choose to
15241compile these extensions for dynamic loading (the default), compile
15242them into the $package executable (static loading), or not include
15243them at all. Answer "none" to include no extensions.
15244Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
15245
15246EOM
b4eb6b3d
JH
15247 case "$dynamic_ext" in
15248 '') dflt="$avail_ext" ;;
15249 *) dflt="$dynamic_ext"
15250 # Perhaps we are reusing an old out-of-date config.sh.
15251 case "$hint" in
15252 previous)
15253 if test X"$dynamic_ext" != X"$avail_ext"; then
15254 $cat <<EOM
15255NOTICE: Your previous config.sh list may be incorrect.
15256The extensions now available to you are
15257 ${avail_ext}
15258but the default list from your previous config.sh is
15259 ${dynamic_ext}
9c839522 15260
b4eb6b3d
JH
15261EOM
15262 fi
9c839522
PM
15263 ;;
15264 esac
b4eb6b3d
JH
15265 ;;
15266 esac
5f80c64f 15267 case "$dflt" in
b4eb6b3d
JH
15268 '') dflt=none;;
15269 esac
15270 rp="What extensions do you wish to load dynamically?"
15271 . ./myread
15272 case "$ans" in
15273 none) dynamic_ext=' ' ;;
15274 *) dynamic_ext="$ans" ;;
5f80c64f 15275 esac
5f80c64f 15276
b4eb6b3d
JH
15277 case "$static_ext" in
15278 '')
15279 : Exclude those already listed in dynamic linking
15280 dflt=''
15281 for xxx in $avail_ext; do
15282 case " $dynamic_ext " in
15283 *" $xxx "*) ;;
15284 *) dflt="$dflt $xxx" ;;
15285 esac
15286 done
15287 set X $dflt
15288 shift
15289 dflt="$*"
15290 ;;
15291 *) dflt="$static_ext"
15292 ;;
15293 esac
9c839522 15294
b4eb6b3d
JH
15295 case "$dflt" in
15296 '') dflt=none;;
15297 esac
15298 rp="What extensions do you wish to load statically?"
15299 . ./myread
15300 case "$ans" in
15301 none) static_ext=' ' ;;
15302 *) static_ext="$ans" ;;
15303 esac
15304 ;;
15305*)
15306 $cat <<EOM
15307A number of extensions are supplied with $package. Answer "none"
15308to include no extensions.
15309Note that DynaLoader is always built and need not be mentioned here.
9c839522 15310
b4eb6b3d
JH
15311EOM
15312 case "$static_ext" in
15313 '') dflt="$avail_ext" ;;
15314 *) dflt="$static_ext"
15315 # Perhaps we are reusing an old out-of-date config.sh.
15316 case "$hint" in
15317 previous)
15318 if test X"$static_ext" != X"$avail_ext"; then
15319 $cat <<EOM
15320NOTICE: Your previous config.sh list may be incorrect.
15321The extensions now available to you are
15322 ${avail_ext}
15323but the default list from your previous config.sh is
15324 ${static_ext}
5f80c64f
JH
15325
15326EOM
b4eb6b3d
JH
15327 fi
15328 ;;
15329 esac
15330 ;;
15331 esac
15332 : Exclude those that are not xs extensions
15333 case "$dflt" in
15334 '') dflt=none;;
15335 esac
15336 rp="What extensions do you wish to include?"
15337 . ./myread
15338 case "$ans" in
15339 none) static_ext=' ' ;;
15340 *) static_ext="$ans" ;;
15341 esac
15342 ;;
5f80c64f
JH
15343esac
15344
b4eb6b3d
JH
15345set X $dynamic_ext $static_ext $nonxs_ext
15346shift
15347extensions="$*"
15348
9c839522
PM
15349: Remove libraries needed only for extensions
15350: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
15351: The exception is SunOS 4.x, which needs them.
15352case "${osname}X${osvers}" in
15353sunos*X4*)
15354 perllibs="$libs"
15355 ;;
15356*) case "$usedl" in
15357 $define|true|[yY]*)
15358 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
15359 shift
15360 perllibs="$*"
15361 ;;
15362 *) perllibs="$libs"
15363 ;;
15364 esac
15365 ;;
9c839522 15366esac
5f80c64f
JH
15367
15368: Remove build directory name from cppstdin so it can be used from
15369: either the present location or the final installed location.
15370echo " "
15371: Get out of the UU directory to get correct path name.
15372cd ..
15373case "$cppstdin" in
15374`pwd`/cppstdin)
15375 echo "Stripping down cppstdin path name"
15376 cppstdin=cppstdin
15377 ;;
15378esac
15379cd UU
15380
15381: end of configuration questions
15382echo " "
15383echo "End of configuration questions."
15384echo " "
15385
15386: back to where it started
15387if test -d ../UU; then
15388 cd ..
15389fi
15390
15391: configuration may be patched via a 'config.over' file
15392if $test -f config.over; then
15393 echo " "
15394 dflt=y
15395 rp='I see a config.over file. Do you wish to load it?'
15396 . UU/myread
15397 case "$ans" in
15398 n*) echo "OK, I'll ignore it.";;
15399 *) . ./config.over
15400 echo "Configuration override changes have been loaded."
15401 ;;
15402 esac
15403fi
15404
15405: in case they want portability, strip down executable paths
15406case "$d_portable" in
15407"$define")
15408 echo " "
15409 echo "Stripping down executable paths..." >&4
15410 for file in $loclist $trylist; do
534ac15a
JH
15411 eval temp=\$$file
15412 eval $file=`basename $temp`
5f80c64f
JH
15413 done
15414 ;;
15415esac
15416
15417: create config.sh file
15418echo " "
15419echo "Creating config.sh..." >&4
15420$spitshell <<EOT >config.sh
15421$startsh
15422#
15423# This file was produced by running the Configure script. It holds all the
15424# definitions figured out by Configure. Should you modify one of these values,
15425# do not forget to propagate your changes by running "Configure -der". You may
15426# instead choose to run each of the .SH files by yourself, or "Configure -S".
15427#
15428
15429# Package name : $package
15430# Source directory : $src
15431# Configuration time: $cf_time
15432# Configured by : $cf_by
15433# Target system : $myuname
15434
15435Author='$Author'
15436Date='$Date'
15437Header='$Header'
15438Id='$Id'
15439Locker='$Locker'
15440Log='$Log'
15441Mcc='$Mcc'
15442RCSfile='$RCSfile'
15443Revision='$Revision'
15444Source='$Source'
15445State='$State'
15446_a='$_a'
15447_exe='$_exe'
15448_o='$_o'
b4eb6b3d
JH
15449afs='$afs'
15450alignbytes='$alignbytes'
15451ansi2knr='$ansi2knr'
15452aphostname='$aphostname'
15453api_revision='$api_revision'
15454api_subversion='$api_subversion'
15455api_version='$api_version'
15456api_versionstring='$api_versionstring'
5f80c64f 15457ar='$ar'
b4eb6b3d
JH
15458archlib='$archlib'
15459archlibexp='$archlibexp'
15460archname64='$archname64'
15461archname='$archname'
5f80c64f
JH
15462archobjs='$archobjs'
15463awk='$awk'
b4eb6b3d 15464baserev='$baserev'
5f80c64f 15465bash='$bash'
b4eb6b3d
JH
15466bin='$bin'
15467bincompat5005='$bincompat5005'
15468binexp='$binexp'
5f80c64f
JH
15469bison='$bison'
15470byacc='$byacc'
b4eb6b3d 15471byteorder='$byteorder'
5f80c64f 15472c='$c'
b4eb6b3d 15473castflags='$castflags'
5f80c64f
JH
15474cat='$cat'
15475cc='$cc'
15476cccdlflags='$cccdlflags'
15477ccdlflags='$ccdlflags'
15478ccflags='$ccflags'
b4eb6b3d 15479ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 15480ccname='$ccname'
b4eb6b3d 15481ccsymbols='$ccsymbols'
6b356c8e 15482ccversion='$ccversion'
5f80c64f 15483cf_by='$cf_by'
b4eb6b3d 15484cf_email='$cf_email'
5f80c64f 15485cf_time='$cf_time'
b4eb6b3d 15486charsize='$charsize'
5f80c64f
JH
15487chgrp='$chgrp'
15488chmod='$chmod'
15489chown='$chown'
b4eb6b3d 15490clocktype='$clocktype'
5f80c64f
JH
15491comm='$comm'
15492compress='$compress'
15493contains='$contains'
15494cp='$cp'
15495cpio='$cpio'
15496cpp='$cpp'
b4eb6b3d
JH
15497cpp_stuff='$cpp_stuff'
15498cppccsymbols='$cppccsymbols'
5f80c64f
JH
15499cppflags='$cppflags'
15500cpplast='$cpplast'
15501cppminus='$cppminus'
15502cpprun='$cpprun'
15503cppstdin='$cppstdin'
b4eb6b3d
JH
15504cppsymbols='$cppsymbols'
15505crosscompile='$crosscompile'
15506cryptlib='$cryptlib'
5f80c64f 15507csh='$csh'
b4eb6b3d
JH
15508d_Gconvert='$d_Gconvert'
15509d_PRIEUldbl='$d_PRIEUldbl'
15510d_PRIFUldbl='$d_PRIFUldbl'
15511d_PRIGUldbl='$d_PRIGUldbl'
15512d_PRIXU64='$d_PRIXU64'
15513d_PRId64='$d_PRId64'
15514d_PRIeldbl='$d_PRIeldbl'
15515d_PRIfldbl='$d_PRIfldbl'
15516d_PRIgldbl='$d_PRIgldbl'
15517d_PRIi64='$d_PRIi64'
15518d_PRIo64='$d_PRIo64'
15519d_PRIu64='$d_PRIu64'
15520d_PRIx64='$d_PRIx64'
15521d_SCNfldbl='$d_SCNfldbl'
15522d_access='$d_access'
15523d_accessx='$d_accessx'
15524d_alarm='$d_alarm'
15525d_archlib='$d_archlib'
15526d_atolf='$d_atolf'
15527d_atoll='$d_atoll'
15528d_attribut='$d_attribut'
15529d_bcmp='$d_bcmp'
15530d_bcopy='$d_bcopy'
15531d_bincompat5005='$d_bincompat5005'
5f80c64f 15532d_bsd='$d_bsd'
b4eb6b3d
JH
15533d_bsdgetpgrp='$d_bsdgetpgrp'
15534d_bsdsetpgrp='$d_bsdsetpgrp'
15535d_bzero='$d_bzero'
15536d_casti32='$d_casti32'
15537d_castneg='$d_castneg'
15538d_charvspr='$d_charvspr'
15539d_chown='$d_chown'
15540d_chroot='$d_chroot'
15541d_chsize='$d_chsize'
15542d_closedir='$d_closedir'
15543d_const='$d_const'
15544d_crypt='$d_crypt'
15545d_csh='$d_csh'
15546d_cuserid='$d_cuserid'
15547d_dbl_dig='$d_dbl_dig'
15548d_difftime='$d_difftime'
15549d_dirnamlen='$d_dirnamlen'
15550d_dlerror='$d_dlerror'
5f80c64f 15551d_dlopen='$d_dlopen'
b4eb6b3d
JH
15552d_dlsymun='$d_dlsymun'
15553d_dosuid='$d_dosuid'
15554d_drand48proto='$d_drand48proto'
15555d_dup2='$d_dup2'
15556d_eaccess='$d_eaccess'
15557d_endgrent='$d_endgrent'
15558d_endhent='$d_endhent'
15559d_endnent='$d_endnent'
15560d_endpent='$d_endpent'
15561d_endpwent='$d_endpwent'
15562d_endsent='$d_endsent'
15563d_eofnblk='$d_eofnblk'
5f80c64f 15564d_eunice='$d_eunice'
b4eb6b3d
JH
15565d_fchmod='$d_fchmod'
15566d_fchown='$d_fchown'
15567d_fcntl='$d_fcntl'
9d9004a9 15568d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
15569d_fd_macros='$d_fd_macros'
15570d_fd_set='$d_fd_set'
15571d_fds_bits='$d_fds_bits'
15572d_fgetpos='$d_fgetpos'
15573d_flexfnam='$d_flexfnam'
15574d_flock='$d_flock'
15575d_fork='$d_fork'
15576d_fpathconf='$d_fpathconf'
15577d_fpos64_t='$d_fpos64_t'
15578d_frexpl='$d_frexpl'
15579d_fs_data_s='$d_fs_data_s'
15580d_fseeko='$d_fseeko'
15581d_fsetpos='$d_fsetpos'
15582d_fstatfs='$d_fstatfs'
15583d_fstatvfs='$d_fstatvfs'
411ab01c 15584d_fsync='$d_fsync'
b4eb6b3d
JH
15585d_ftello='$d_ftello'
15586d_ftime='$d_ftime'
15587d_getcwd='$d_getcwd'
15588d_getespwnam='$d_getespwnam'
15589d_getfsstat='$d_getfsstat'
15590d_getgrent='$d_getgrent'
15591d_getgrps='$d_getgrps'
15592d_gethbyaddr='$d_gethbyaddr'
15593d_gethbyname='$d_gethbyname'
15594d_gethent='$d_gethent'
15595d_gethname='$d_gethname'
15596d_gethostprotos='$d_gethostprotos'
15597d_getlogin='$d_getlogin'
15598d_getmnt='$d_getmnt'
15599d_getmntent='$d_getmntent'
15600d_getnbyaddr='$d_getnbyaddr'
15601d_getnbyname='$d_getnbyname'
15602d_getnent='$d_getnent'
15603d_getnetprotos='$d_getnetprotos'
0c0643d0 15604d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
15605d_getpbyname='$d_getpbyname'
15606d_getpbynumber='$d_getpbynumber'
15607d_getpent='$d_getpent'
15608d_getpgid='$d_getpgid'
15609d_getpgrp2='$d_getpgrp2'
15610d_getpgrp='$d_getpgrp'
15611d_getppid='$d_getppid'
15612d_getprior='$d_getprior'
15613d_getprotoprotos='$d_getprotoprotos'
15614d_getprpwnam='$d_getprpwnam'
15615d_getpwent='$d_getpwent'
15616d_getsbyname='$d_getsbyname'
15617d_getsbyport='$d_getsbyport'
15618d_getsent='$d_getsent'
15619d_getservprotos='$d_getservprotos'
15620d_getspnam='$d_getspnam'
15621d_gettimeod='$d_gettimeod'
5f80c64f 15622d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
15623d_grpasswd='$d_grpasswd'
15624d_hasmntopt='$d_hasmntopt'
15625d_htonl='$d_htonl'
15626d_iconv='$d_iconv'
15627d_index='$d_index'
15628d_inetaton='$d_inetaton'
15629d_int64_t='$d_int64_t'
15630d_isascii='$d_isascii'
15631d_isnan='$d_isnan'
15632d_isnanl='$d_isnanl'
15633d_killpg='$d_killpg'
15634d_lchown='$d_lchown'
15635d_ldbl_dig='$d_ldbl_dig'
15636d_link='$d_link'
15637d_locconv='$d_locconv'
15638d_lockf='$d_lockf'
15639d_longdbl='$d_longdbl'
15640d_longlong='$d_longlong'
15641d_lseekproto='$d_lseekproto'
15642d_lstat='$d_lstat'
15643d_madvise='$d_madvise'
15644d_mblen='$d_mblen'
15645d_mbstowcs='$d_mbstowcs'
15646d_mbtowc='$d_mbtowc'
15647d_memchr='$d_memchr'
15648d_memcmp='$d_memcmp'
15649d_memcpy='$d_memcpy'
15650d_memmove='$d_memmove'
15651d_memset='$d_memset'
15652d_mkdir='$d_mkdir'
15653d_mkdtemp='$d_mkdtemp'
15654d_mkfifo='$d_mkfifo'
15655d_mkstemp='$d_mkstemp'
15656d_mkstemps='$d_mkstemps'
15657d_mktime='$d_mktime'
15658d_mmap='$d_mmap'
15659d_modfl='$d_modfl'
15660d_mprotect='$d_mprotect'
15661d_msg='$d_msg'
15662d_msg_ctrunc='$d_msg_ctrunc'
15663d_msg_dontroute='$d_msg_dontroute'
15664d_msg_oob='$d_msg_oob'
15665d_msg_peek='$d_msg_peek'
15666d_msg_proxy='$d_msg_proxy'
15667d_msgctl='$d_msgctl'
15668d_msgget='$d_msgget'
15669d_msgrcv='$d_msgrcv'
15670d_msgsnd='$d_msgsnd'
15671d_msync='$d_msync'
15672d_munmap='$d_munmap'
15673d_mymalloc='$d_mymalloc'
15674d_nice='$d_nice'
15675d_nv_preserves_uv='$d_nv_preserves_uv'
15676d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15677d_off64_t='$d_off64_t'
15678d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15679d_oldpthreads='$d_oldpthreads'
15680d_oldsock='$d_oldsock'
15681d_open3='$d_open3'
15682d_pathconf='$d_pathconf'
15683d_pause='$d_pause'
15684d_perl_otherlibdirs='$d_perl_otherlibdirs'
15685d_phostname='$d_phostname'
15686d_pipe='$d_pipe'
15687d_poll='$d_poll'
5f80c64f 15688d_portable='$d_portable'
b4eb6b3d
JH
15689d_pthread_yield='$d_pthread_yield'
15690d_pwage='$d_pwage'
15691d_pwchange='$d_pwchange'
15692d_pwclass='$d_pwclass'
15693d_pwcomment='$d_pwcomment'
15694d_pwexpire='$d_pwexpire'
15695d_pwgecos='$d_pwgecos'
15696d_pwpasswd='$d_pwpasswd'
15697d_pwquota='$d_pwquota'
15698d_qgcvt='$d_qgcvt'
15699d_quad='$d_quad'
15700d_readdir='$d_readdir'
15701d_readlink='$d_readlink'
15702d_rename='$d_rename'
15703d_rewinddir='$d_rewinddir'
15704d_rmdir='$d_rmdir'
15705d_safebcpy='$d_safebcpy'
15706d_safemcpy='$d_safemcpy'
15707d_sanemcmp='$d_sanemcmp'
15708d_sched_yield='$d_sched_yield'
15709d_scm_rights='$d_scm_rights'
15710d_seekdir='$d_seekdir'
15711d_select='$d_select'
15712d_sem='$d_sem'
15713d_semctl='$d_semctl'
15714d_semctl_semid_ds='$d_semctl_semid_ds'
15715d_semctl_semun='$d_semctl_semun'
15716d_semget='$d_semget'
15717d_semop='$d_semop'
15718d_setegid='$d_setegid'
15719d_seteuid='$d_seteuid'
15720d_setgrent='$d_setgrent'
15721d_setgrps='$d_setgrps'
15722d_sethent='$d_sethent'
15723d_setlinebuf='$d_setlinebuf'
15724d_setlocale='$d_setlocale'
15725d_setnent='$d_setnent'
15726d_setpent='$d_setpent'
15727d_setpgid='$d_setpgid'
15728d_setpgrp2='$d_setpgrp2'
15729d_setpgrp='$d_setpgrp'
15730d_setprior='$d_setprior'
15731d_setproctitle='$d_setproctitle'
15732d_setpwent='$d_setpwent'
15733d_setregid='$d_setregid'
15734d_setresgid='$d_setresgid'
15735d_setresuid='$d_setresuid'
15736d_setreuid='$d_setreuid'
15737d_setrgid='$d_setrgid'
15738d_setruid='$d_setruid'
15739d_setsent='$d_setsent'
15740d_setsid='$d_setsid'
15741d_setvbuf='$d_setvbuf'
15742d_sfio='$d_sfio'
15743d_shm='$d_shm'
15744d_shmat='$d_shmat'
15745d_shmatprototype='$d_shmatprototype'
15746d_shmctl='$d_shmctl'
15747d_shmdt='$d_shmdt'
15748d_shmget='$d_shmget'
15749d_sigaction='$d_sigaction'
15750d_sigsetjmp='$d_sigsetjmp'
15751d_socket='$d_socket'
15752d_socklen_t='$d_socklen_t'
15753d_sockpair='$d_sockpair'
15754d_socks5_init='$d_socks5_init'
15755d_sqrtl='$d_sqrtl'
15756d_statblks='$d_statblks'
15757d_statfs_f_flags='$d_statfs_f_flags'
15758d_statfs_s='$d_statfs_s'
15759d_statvfs='$d_statvfs'
15760d_stdio_cnt_lval='$d_stdio_cnt_lval'
15761d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
15762d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
15763d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
15764d_stdio_stream_array='$d_stdio_stream_array'
15765d_stdiobase='$d_stdiobase'
15766d_stdstdio='$d_stdstdio'
15767d_strchr='$d_strchr'
15768d_strcoll='$d_strcoll'
15769d_strctcpy='$d_strctcpy'
15770d_strerrm='$d_strerrm'
15771d_strerror='$d_strerror'
15772d_strtod='$d_strtod'
15773d_strtol='$d_strtol'
15774d_strtold='$d_strtold'
15775d_strtoll='$d_strtoll'
15776d_strtoul='$d_strtoul'
15777d_strtoull='$d_strtoull'
15778d_strtouq='$d_strtouq'
15779d_strxfrm='$d_strxfrm'
15780d_suidsafe='$d_suidsafe'
15781d_symlink='$d_symlink'
15782d_syscall='$d_syscall'
15783d_sysconf='$d_sysconf'
15784d_sysernlst='$d_sysernlst'
15785d_syserrlst='$d_syserrlst'
15786d_system='$d_system'
15787d_tcgetpgrp='$d_tcgetpgrp'
15788d_tcsetpgrp='$d_tcsetpgrp'
15789d_telldir='$d_telldir'
15790d_telldirproto='$d_telldirproto'
15791d_time='$d_time'
15792d_times='$d_times'
15793d_truncate='$d_truncate'
15794d_tzname='$d_tzname'
15795d_umask='$d_umask'
15796d_uname='$d_uname'
15797d_union_semun='$d_union_semun'
15798d_ustat='$d_ustat'
15799d_vendorarch='$d_vendorarch'
15800d_vendorbin='$d_vendorbin'
15801d_vendorlib='$d_vendorlib'
15802d_vfork='$d_vfork'
15803d_void_closedir='$d_void_closedir'
15804d_voidsig='$d_voidsig'
15805d_voidtty='$d_voidtty'
15806d_volatile='$d_volatile'
15807d_vprintf='$d_vprintf'
15808d_wait4='$d_wait4'
15809d_waitpid='$d_waitpid'
15810d_wcstombs='$d_wcstombs'
15811d_wctomb='$d_wctomb'
5f80c64f
JH
15812d_xenix='$d_xenix'
15813date='$date'
b4eb6b3d
JH
15814db_hashtype='$db_hashtype'
15815db_prefixtype='$db_prefixtype'
15816defvoidused='$defvoidused'
15817direntrytype='$direntrytype'
15818dlext='$dlext'
5f80c64f 15819dlsrc='$dlsrc'
b4eb6b3d
JH
15820doublesize='$doublesize'
15821drand01='$drand01'
15822dynamic_ext='$dynamic_ext'
15823eagain='$eagain'
15824ebcdic='$ebcdic'
5f80c64f
JH
15825echo='$echo'
15826egrep='$egrep'
15827emacs='$emacs'
15828eunicefix='$eunicefix'
15829exe_ext='$exe_ext'
15830expr='$expr'
b4eb6b3d
JH
15831extensions='$extensions'
15832fflushNULL='$fflushNULL'
15833fflushall='$fflushall'
5f80c64f
JH
15834find='$find'
15835firstmakefile='$firstmakefile'
15836flex='$flex'
b4eb6b3d
JH
15837fpossize='$fpossize'
15838fpostype='$fpostype'
15839freetype='$freetype'
15840full_ar='$full_ar'
15841full_csh='$full_csh'
15842full_sed='$full_sed'
5b463ca7 15843gccosandvers='$gccosandvers'
5f80c64f 15844gccversion='$gccversion'
b4eb6b3d
JH
15845gidformat='$gidformat'
15846gidsign='$gidsign'
15847gidsize='$gidsize'
15848gidtype='$gidtype'
5f80c64f
JH
15849glibpth='$glibpth'
15850grep='$grep'
b4eb6b3d
JH
15851groupcat='$groupcat'
15852groupstype='$groupstype'
5f80c64f 15853gzip='$gzip'
b4eb6b3d
JH
15854h_fcntl='$h_fcntl'
15855h_sysfile='$h_sysfile'
5f80c64f 15856hint='$hint'
b4eb6b3d
JH
15857hostcat='$hostcat'
15858i16size='$i16size'
15859i16type='$i16type'
15860i32size='$i32size'
15861i32type='$i32type'
15862i64size='$i64size'
15863i64type='$i64type'
15864i8size='$i8size'
15865i8type='$i8type'
15866i_arpainet='$i_arpainet'
15867i_bsdioctl='$i_bsdioctl'
15868i_db='$i_db'
15869i_dbm='$i_dbm'
15870i_dirent='$i_dirent'
5f80c64f 15871i_dld='$i_dld'
b4eb6b3d
JH
15872i_dlfcn='$i_dlfcn'
15873i_fcntl='$i_fcntl'
15874i_float='$i_float'
15875i_gdbm='$i_gdbm'
15876i_grp='$i_grp'
15877i_iconv='$i_iconv'
15878i_ieeefp='$i_ieeefp'
15879i_inttypes='$i_inttypes'
15880i_libutil='$i_libutil'
15881i_limits='$i_limits'
15882i_locale='$i_locale'
15883i_machcthr='$i_machcthr'
15884i_malloc='$i_malloc'
15885i_math='$i_math'
15886i_memory='$i_memory'
15887i_mntent='$i_mntent'
15888i_ndbm='$i_ndbm'
15889i_netdb='$i_netdb'
15890i_neterrno='$i_neterrno'
15891i_netinettcp='$i_netinettcp'
15892i_niin='$i_niin'
15893i_poll='$i_poll'
15894i_prot='$i_prot'
15895i_pthread='$i_pthread'
15896i_pwd='$i_pwd'
15897i_rpcsvcdbm='$i_rpcsvcdbm'
15898i_sfio='$i_sfio'
15899i_sgtty='$i_sgtty'
15900i_shadow='$i_shadow'
15901i_socks='$i_socks'
15902i_stdarg='$i_stdarg'
15903i_stddef='$i_stddef'
15904i_stdlib='$i_stdlib'
15905i_string='$i_string'
15906i_sunmath='$i_sunmath'
15907i_sysaccess='$i_sysaccess'
15908i_sysdir='$i_sysdir'
15909i_sysfile='$i_sysfile'
15910i_sysfilio='$i_sysfilio'
15911i_sysin='$i_sysin'
15912i_sysioctl='$i_sysioctl'
15913i_syslog='$i_syslog'
15914i_sysmman='$i_sysmman'
15915i_sysmode='$i_sysmode'
15916i_sysmount='$i_sysmount'
15917i_sysndir='$i_sysndir'
15918i_sysparam='$i_sysparam'
15919i_sysresrc='$i_sysresrc'
15920i_syssecrt='$i_syssecrt'
15921i_sysselct='$i_sysselct'
15922i_syssockio='$i_syssockio'
15923i_sysstat='$i_sysstat'
15924i_sysstatfs='$i_sysstatfs'
15925i_sysstatvfs='$i_sysstatvfs'
15926i_systime='$i_systime'
15927i_systimek='$i_systimek'
15928i_systimes='$i_systimes'
15929i_systypes='$i_systypes'
15930i_sysuio='$i_sysuio'
15931i_sysun='$i_sysun'
15932i_sysutsname='$i_sysutsname'
15933i_sysvfs='$i_sysvfs'
15934i_syswait='$i_syswait'
15935i_termio='$i_termio'
15936i_termios='$i_termios'
15937i_time='$i_time'
15938i_unistd='$i_unistd'
15939i_ustat='$i_ustat'
15940i_utime='$i_utime'
15941i_values='$i_values'
15942i_varargs='$i_varargs'
15943i_varhdr='$i_varhdr'
15944i_vfork='$i_vfork'
5f80c64f 15945ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
15946inc_version_list='$inc_version_list'
15947inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
15948incpath='$incpath'
15949inews='$inews'
b4eb6b3d
JH
15950installarchlib='$installarchlib'
15951installbin='$installbin'
15952installman1dir='$installman1dir'
15953installman3dir='$installman3dir'
15954installprefix='$installprefix'
15955installprefixexp='$installprefixexp'
15956installprivlib='$installprivlib'
15957installscript='$installscript'
15958installsitearch='$installsitearch'
15959installsitebin='$installsitebin'
15960installsitelib='$installsitelib'
15961installstyle='$installstyle'
15962installusrbinperl='$installusrbinperl'
15963installvendorarch='$installvendorarch'
15964installvendorbin='$installvendorbin'
15965installvendorlib='$installvendorlib'
15966intsize='$intsize'
15967ivdformat='$ivdformat'
15968ivsize='$ivsize'
15969ivtype='$ivtype'
15970known_extensions='$known_extensions'
5f80c64f 15971ksh='$ksh'
5f80c64f
JH
15972ld='$ld'
15973lddlflags='$lddlflags'
15974ldflags='$ldflags'
b4eb6b3d
JH
15975ldflags_uselargefiles='$ldflags_uselargefiles'
15976ldlibpthname='$ldlibpthname'
5f80c64f
JH
15977less='$less'
15978lib_ext='$lib_ext'
15979libc='$libc'
b4eb6b3d 15980libperl='$libperl'
5f80c64f
JH
15981libpth='$libpth'
15982libs='$libs'
43999f95
JH
15983libsdirs='$libsdirs'
15984libsfiles='$libsfiles'
15985libsfound='$libsfound'
13b3f787 15986libspath='$libspath'
5f80c64f 15987libswanted='$libswanted'
b4eb6b3d 15988libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
15989line='$line'
15990lint='$lint'
15991lkflags='$lkflags'
15992ln='$ln'
15993lns='$lns'
15994locincpth='$locincpth'
15995loclibpth='$loclibpth'
b4eb6b3d
JH
15996longdblsize='$longdblsize'
15997longlongsize='$longlongsize'
15998longsize='$longsize'
5f80c64f
JH
15999lp='$lp'
16000lpr='$lpr'
16001ls='$ls'
b4eb6b3d
JH
16002lseeksize='$lseeksize'
16003lseektype='$lseektype'
5f80c64f
JH
16004mail='$mail'
16005mailx='$mailx'
16006make='$make'
16007make_set_make='$make_set_make'
b4eb6b3d
JH
16008mallocobj='$mallocobj'
16009mallocsrc='$mallocsrc'
16010malloctype='$malloctype'
16011man1dir='$man1dir'
16012man1direxp='$man1direxp'
16013man1ext='$man1ext'
16014man3dir='$man3dir'
16015man3direxp='$man3direxp'
16016man3ext='$man3ext'
5f80c64f
JH
16017mips_type='$mips_type'
16018mkdir='$mkdir'
b4eb6b3d
JH
16019mmaptype='$mmaptype'
16020modetype='$modetype'
5f80c64f 16021more='$more'
b4eb6b3d 16022multiarch='$multiarch'
5f80c64f 16023mv='$mv'
b4eb6b3d
JH
16024myarchname='$myarchname'
16025mydomain='$mydomain'
16026myhostname='$myhostname'
5f80c64f
JH
16027myuname='$myuname'
16028n='$n'
b4eb6b3d
JH
16029netdb_hlen_type='$netdb_hlen_type'
16030netdb_host_type='$netdb_host_type'
16031netdb_name_type='$netdb_name_type'
16032netdb_net_type='$netdb_net_type'
5f80c64f
JH
16033nm='$nm'
16034nm_opt='$nm_opt'
16035nm_so_opt='$nm_so_opt'
b4eb6b3d 16036nonxs_ext='$nonxs_ext'
5f80c64f 16037nroff='$nroff'
b4eb6b3d
JH
16038nvEUformat='$nvEUformat'
16039nvFUformat='$nvFUformat'
16040nvGUformat='$nvGUformat'
16041nveformat='$nveformat'
16042nvfformat='$nvfformat'
16043nvgformat='$nvgformat'
16044nvsize='$nvsize'
16045nvtype='$nvtype'
16046o_nonblock='$o_nonblock'
5f80c64f 16047obj_ext='$obj_ext'
b4eb6b3d 16048old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 16049optimize='$optimize'
b4eb6b3d 16050orderlib='$orderlib'
5f80c64f
JH
16051osname='$osname'
16052osvers='$osvers'
b4eb6b3d 16053otherlibdirs='$otherlibdirs'
5f80c64f 16054package='$package'
b4eb6b3d
JH
16055pager='$pager'
16056passcat='$passcat'
16057patchlevel='$patchlevel'
5f80c64f 16058path_sep='$path_sep'
b4eb6b3d 16059perl5='$perl5'
5f80c64f 16060perl='$perl'
b4eb6b3d 16061perladmin='$perladmin'
9c839522 16062perllibs='$perllibs'
b4eb6b3d 16063perlpath='$perlpath'
5f80c64f 16064pg='$pg'
b4eb6b3d
JH
16065phostname='$phostname'
16066pidtype='$pidtype'
5f80c64f 16067plibpth='$plibpth'
b4eb6b3d 16068pm_apiversion='$pm_apiversion'
5f80c64f
JH
16069pmake='$pmake'
16070pr='$pr'
b4eb6b3d
JH
16071prefix='$prefix'
16072prefixexp='$prefixexp'
16073privlib='$privlib'
16074privlibexp='$privlibexp'
16075prototype='$prototype'
16076ptrsize='$ptrsize'
16077quadkind='$quadkind'
16078quadtype='$quadtype'
16079randbits='$randbits'
16080randfunc='$randfunc'
16081randseedtype='$randseedtype'
16082ranlib='$ranlib'
16083rd_nodata='$rd_nodata'
16084revision='$revision'
5f80c64f
JH
16085rm='$rm'
16086rmail='$rmail'
16087runnm='$runnm'
b4eb6b3d
JH
16088sPRIEUldbl='$sPRIEUldbl'
16089sPRIFUldbl='$sPRIFUldbl'
16090sPRIGUldbl='$sPRIGUldbl'
16091sPRIXU64='$sPRIXU64'
16092sPRId64='$sPRId64'
16093sPRIeldbl='$sPRIeldbl'
16094sPRIfldbl='$sPRIfldbl'
16095sPRIgldbl='$sPRIgldbl'
16096sPRIi64='$sPRIi64'
16097sPRIo64='$sPRIo64'
16098sPRIu64='$sPRIu64'
16099sPRIx64='$sPRIx64'
16100sSCNfldbl='$sSCNfldbl'
16101sched_yield='$sched_yield'
16102scriptdir='$scriptdir'
16103scriptdirexp='$scriptdirexp'
5f80c64f 16104sed='$sed'
b4eb6b3d
JH
16105seedfunc='$seedfunc'
16106selectminbits='$selectminbits'
16107selecttype='$selecttype'
5f80c64f
JH
16108sendmail='$sendmail'
16109sh='$sh'
16110shar='$shar'
16111sharpbang='$sharpbang'
b4eb6b3d
JH
16112shmattype='$shmattype'
16113shortsize='$shortsize'
16114shrpenv='$shrpenv'
5f80c64f 16115shsharp='$shsharp'
b4eb6b3d
JH
16116sig_count='$sig_count'
16117sig_name='$sig_name'
16118sig_name_init='$sig_name_init'
16119sig_num='$sig_num'
16120sig_num_init='$sig_num_init'
16121signal_t='$signal_t'
16122sitearch='$sitearch'
16123sitearchexp='$sitearchexp'
16124sitebin='$sitebin'
16125sitebinexp='$sitebinexp'
16126sitelib='$sitelib'
16127sitelib_stem='$sitelib_stem'
16128sitelibexp='$sitelibexp'
16129siteprefix='$siteprefix'
16130siteprefixexp='$siteprefixexp'
16131sizesize='$sizesize'
16132sizetype='$sizetype'
5f80c64f
JH
16133sleep='$sleep'
16134smail='$smail'
5f80c64f 16135so='$so'
b4eb6b3d
JH
16136sockethdr='$sockethdr'
16137socketlib='$socketlib'
16138socksizetype='$socksizetype'
5f80c64f
JH
16139sort='$sort'
16140spackage='$spackage'
16141spitshell='$spitshell'
5f80c64f 16142src='$src'
b4eb6b3d
JH
16143ssizetype='$ssizetype'
16144startperl='$startperl'
5f80c64f 16145startsh='$startsh'
b4eb6b3d
JH
16146static_ext='$static_ext'
16147stdchar='$stdchar'
16148stdio_base='$stdio_base'
16149stdio_bufsiz='$stdio_bufsiz'
16150stdio_cnt='$stdio_cnt'
16151stdio_filbuf='$stdio_filbuf'
16152stdio_ptr='$stdio_ptr'
16153stdio_stream_array='$stdio_stream_array'
16154strings='$strings'
5f80c64f 16155submit='$submit'
b4eb6b3d
JH
16156subversion='$subversion'
16157sysman='$sysman'
5f80c64f
JH
16158tail='$tail'
16159tar='$tar'
16160tbl='$tbl'
16161tee='$tee'
16162test='$test'
b4eb6b3d
JH
16163timeincl='$timeincl'
16164timetype='$timetype'
5f80c64f
JH
16165touch='$touch'
16166tr='$tr'
16167trnl='$trnl'
16168troff='$troff'
b4eb6b3d
JH
16169u16size='$u16size'
16170u16type='$u16type'
16171u32size='$u32size'
16172u32type='$u32type'
16173u64size='$u64size'
16174u64type='$u64type'
16175u8size='$u8size'
16176u8type='$u8type'
16177uidformat='$uidformat'
16178uidsign='$uidsign'
16179uidsize='$uidsize'
16180uidtype='$uidtype'
5f80c64f
JH
16181uname='$uname'
16182uniq='$uniq'
b4eb6b3d
JH
16183uquadtype='$uquadtype'
16184use5005threads='$use5005threads'
16185use64bitall='$use64bitall'
16186use64bitint='$use64bitint'
5f80c64f 16187usedl='$usedl'
b4eb6b3d
JH
16188useithreads='$useithreads'
16189uselargefiles='$uselargefiles'
16190uselongdouble='$uselongdouble'
16191usemorebits='$usemorebits'
16192usemultiplicity='$usemultiplicity'
16193usemymalloc='$usemymalloc'
5f80c64f 16194usenm='$usenm'
b4eb6b3d
JH
16195useopcode='$useopcode'
16196useperlio='$useperlio'
16197useposix='$useposix'
16198usesfio='$usesfio'
16199useshrplib='$useshrplib'
29209bc5 16200usesocks='$usesocks'
b4eb6b3d
JH
16201usethreads='$usethreads'
16202usevendorprefix='$usevendorprefix'
16203usevfork='$usevfork'
5f80c64f
JH
16204usrinc='$usrinc'
16205uuname='$uuname'
b4eb6b3d
JH
16206uvXUformat='$uvXUformat'
16207uvoformat='$uvoformat'
16208uvsize='$uvsize'
16209uvtype='$uvtype'
16210uvuformat='$uvuformat'
16211uvxformat='$uvxformat'
16212vendorarch='$vendorarch'
16213vendorarchexp='$vendorarchexp'
16214vendorbin='$vendorbin'
16215vendorbinexp='$vendorbinexp'
16216vendorlib='$vendorlib'
16217vendorlib_stem='$vendorlib_stem'
16218vendorlibexp='$vendorlibexp'
16219vendorprefix='$vendorprefix'
16220vendorprefixexp='$vendorprefixexp'
16221version='$version'
d56c5707 16222versiononly='$versiononly'
5f80c64f 16223vi='$vi'
b4eb6b3d 16224voidflags='$voidflags'
5f80c64f 16225xlibpth='$xlibpth'
b4eb6b3d 16226xs_apiversion='$xs_apiversion'
5f80c64f
JH
16227zcat='$zcat'
16228zip='$zip'
16229EOT
16230
16231: Add in command line options if available
16232$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16233
16234: add special variables
16235$test -f $src/patchlevel.h && \
d00b958f 16236awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
2000072c 16237echo "CONFIGDOTSH=true" >>config.sh
5f80c64f
JH
16238
16239: propagate old symbols
16240if $test -f UU/config.sh; then
381aa1ff 16241 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 16242 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 16243 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
16244 set X `cat UU/oldsyms`
16245 shift
16246 case $# in
16247 0) ;;
16248 *)
16249 cat <<EOM
16250Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16251EOM
16252 echo "# Variables propagated from previous config.sh file." >>config.sh
16253 for sym in `cat UU/oldsyms`; do
16254 echo " Propagating $hint variable "'$'"$sym..."
16255 eval 'tmp="$'"${sym}"'"'
16256 echo "$tmp" | \
16257 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16258 done
16259 ;;
16260 esac
16261fi
16262
16263: Finish up by extracting the .SH files
16264case "$alldone" in
16265exit)
16266 $rm -rf UU
16267 echo "Done."
16268 exit 0
16269 ;;
16270cont)
16271 ;;
16272'')
16273 dflt=''
16274 nostick=true
16275 $cat <<EOM
16276
16277If you'd like to make any changes to the config.sh file before I begin
16278to configure things, do it as a shell escape now (e.g. !vi config.sh).
16279
16280EOM
16281 rp="Press return or use a shell escape to edit config.sh:"
16282 . UU/myread
16283 nostick=''
16284 case "$ans" in
16285 '') ;;
16286 *) : in case they cannot read
16287 sh 1>&4 -c "$ans";;
16288 esac
16289 ;;
16290esac
16291
16292: if this fails, just run all the .SH files by hand
16293. ./config.sh
16294
16295echo " "
16296exec 1>&4
16297. ./UU/extract
16298
16299if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16300 dflt=y
16301 case "$silent" in
16302 true) ;;
16303 *)
16304 $cat <<EOM
16305
16306Now you need to generate make dependencies by running "$make depend".
16307You might prefer to run it in background: "$make depend > makedepend.out &"
16308It can take a while, so you might not want to run it right now.
16309
16310EOM
16311 ;;
16312 esac
16313 rp="Run $make depend now?"
16314 . UU/myread
16315 case "$ans" in
16316 y*)
3d5d58b1 16317 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
16318 ;;
16319 *)
16320 echo "You must run '$make depend' then '$make'."
16321 ;;
16322 esac
16323elif test -f [Mm]akefile; then
16324 echo " "
16325 echo "Now you must run a $make."
16326else
16327 echo "Done."
16328fi
16329
16330if $test -f Policy.sh; then
16331 $cat <<EOM
16332
16333If you compile $package on a different machine or from a different object
16334directory, copy the Policy.sh file from this object directory to the
16335new one before you run Configure -- this will help you with most of
16336the policy defaults.
16337
16338EOM
16339fi
16340if $test -f config.msg; then
16341 echo "Hmm. I also noted the following information while running:"
16342 echo " "
16343 $cat config.msg >&4
16344 $rm -f config.msg
16345fi
16346$rm -f kit*isdone ark*isdone
16347$rm -rf UU
16348
16349: End of Configure
16350