This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
More VMS moves on environment handling, from Charles Lane.
[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#
80f36755 23# Generated on Wed Nov 8 18:52:10 EET 2000 [metaconfig 3.0 PL70]
7f2de2d2 24# (with additional metaconfig patches by perlbug@perl.org)
2304df62
AD
25
26cat >/tmp/c1$$ <<EOF
27ARGGGHHHH!!!!!
28
29SCO csh still thinks true is false. Write to SCO today and tell them that next
30year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
33we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35[End of diatribe. We now return you to your regularly scheduled programming...]
36EOF
37cat >/tmp/c2$$ <<EOF
38
39OOPS! You naughty creature! You didn't run Configure with sh!
40I will attempt to remedy the situation by running sh for you...
41EOF
42
43true || cat /tmp/c1$$ /tmp/c2$$
44true || exec sh $0 $argv:q
45
46(exit $?0) || cat /tmp/c2$$
47(exit $?0) || exec sh $0 $argv:q
48rm -f /tmp/c1$$ /tmp/c2$$
49
a0d0e21e
LW
50: compute my invocation name
51me=$0
52case "$0" in
53*/*)
54 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55 test "$me" || me=$0
56 ;;
57esac
58
dfe9444c 59: Proper separator for the PATH environment variable
8e07c86e
AD
60p_=:
61: On OS/2 this directory should exist if this is not floppy only system :-]
dfe9444c
AD
62if test -d c:/. ; then
63 if test -n "$OS2_SHELL"; then
64 p_=\;
65 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
c4f23d77 67 elif test -n "$DJGPP"; then
dfe9444c
AD
68 p_=\;
69 fi
39e571d4 70fi
a0d0e21e
LW
71
72: Proper PATH setting
73paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 74paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 75paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 76paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e
AD
77paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80paths="$paths /sbin /usr/sbin /usr/libexec"
a0d0e21e
LW
81
82for p in $paths
83do
8e07c86e
AD
84 case "$p_$PATH$p_" in
85 *$p_$p$p_*) ;;
86 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
87 esac
88done
89
8e07c86e 90PATH=.$p_$PATH
2304df62
AD
91export PATH
92
dfe9444c
AD
93: shall we be using ksh?
94inksh=''
95needksh=''
96avoidksh=''
97newsh=/bin/ksh
98changesh=''
ff0cee69 99if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
100 inksh=true
101fi
102if test -f /hp-ux -a -f /bin/ksh; then
103 needksh='to avoid sh bug in "here document" expansion'
104fi
105if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106 if test X`/usr/bin/uname -v` = X4; then
107 avoidksh="to avoid AIX 4's /bin/sh"
108 newsh=/usr/bin/bsh
2304df62 109 fi
dfe9444c 110fi
cf04f91f
JH
111if test -f /osf_boot -a -f /usr/sbin/setld; then
112 if test X`/usr/bin/uname -s` = XOSF1; then
113 avoidksh="to avoid Digital UNIX' ksh"
114 newsh=/bin/sh
115 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116 fi
117fi
dfe9444c
AD
118case "$inksh/$needksh" in
119/[a-z]*)
c4f23d77 120 ENV=''
dfe9444c
AD
121 changesh=true
122 reason="$needksh"
123 ;;
124esac
125case "$inksh/$avoidksh" in
126true/[a-z]*)
127 changesh=true
128 reason="$avoidksh"
129 ;;
130esac
131case "$inksh/$needksh-$avoidksh-" in
132true/--)
a0d0e21e
LW
133 cat <<EOM
134(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 135mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 136EOM
dfe9444c
AD
137 ;;
138esac
139case "$changesh" in
140true)
141 echo "(Feeding myself to $newsh $reason.)"
142 case "$0" in
143 Configure|*/Configure) exec $newsh $0 "$@";;
144 *) exec $newsh Configure "$@";;
145 esac
146 ;;
147esac
2304df62 148
bfb7748a
AD
149: if needed set CDPATH to a harmless value that is not chatty
150: avoid bash 2.02 problems with empty CDPATH.
151case "$CDPATH" in
152'') ;;
153*) case "$SHELL" in
154 *bash*) CDPATH='.' ;;
155 *) CDPATH='' ;;
156 esac
157 ;;
158esac
2304df62
AD
159: Configure runs within the UU subdirectory
160test -d UU || mkdir UU
8e07c86e 161cd UU && rm -f ./*
2304df62 162
6b356c8e
JH
163ccname=''
164ccversion=''
b4eb6b3d
JH
165ccsymbols=''
166cppccsymbols=''
167cppsymbols=''
9c839522 168perllibs=''
b4eb6b3d
JH
169dynamic_ext=''
170extensions=''
171known_extensions=''
172nonxs_ext=''
173static_ext=''
174useopcode=''
175useposix=''
ecfc5424 176d_bsd=''
40a7a20a 177d_eunice=''
2304df62
AD
178d_xenix=''
179eunicefix=''
180Mcc=''
dfe9444c 181ar=''
2304df62
AD
182awk=''
183bash=''
184bison=''
185byacc=''
186cat=''
187chgrp=''
188chmod=''
189chown=''
ecfc5424 190comm=''
2304df62
AD
191compress=''
192cp=''
193cpio=''
194cpp=''
195csh=''
196date=''
197echo=''
198egrep=''
199emacs=''
200expr=''
201find=''
202flex=''
2304df62 203grep=''
8ff267be 204gzip=''
2304df62
AD
205inews=''
206ksh=''
207less=''
208line=''
209lint=''
210ln=''
211lp=''
212lpr=''
213ls=''
214mail=''
215mailx=''
dfe9444c 216make=''
2304df62
AD
217mkdir=''
218more=''
219mv=''
693762b4 220nm=''
2304df62
AD
221nroff=''
222perl=''
223pg=''
224pmake=''
225pr=''
226rm=''
227rmail=''
228sed=''
229sendmail=''
2304df62
AD
230shar=''
231sleep=''
232smail=''
233sort=''
234submit=''
235tail=''
236tar=''
237tbl=''
693762b4 238tee=''
2304df62
AD
239test=''
240touch=''
241tr=''
242troff=''
243uname=''
244uniq=''
245uuname=''
246vi=''
247zcat=''
8ff267be 248zip=''
b4eb6b3d
JH
249full_ar=''
250full_sed=''
a0d0e21e 251libswanted=''
2304df62
AD
252hint=''
253myuname=''
85e6fe83
LW
254osname=''
255osvers=''
2304df62
AD
256Author=''
257Date=''
258Header=''
259Id=''
260Locker=''
261Log=''
262RCSfile=''
263Revision=''
264Source=''
265State=''
dfe9444c
AD
266_a=''
267_exe=''
268_o=''
4633a7c4
LW
269archobjs=''
270exe_ext=''
271firstmakefile=''
272lib_ext=''
273obj_ext=''
274path_sep=''
b4eb6b3d
JH
275afs=''
276alignbytes=''
277ansi2knr=''
278archlib=''
279archlibexp=''
280d_archlib=''
281installarchlib=''
282archname=''
283myarchname=''
284d_atolf=''
285d_atoll=''
286baserev=''
287bin=''
288binexp=''
289installbin=''
290bincompat5005=''
291d_bincompat5005=''
292byteorder=''
2304df62 293cc=''
2304df62
AD
294ccflags=''
295cppflags=''
296ldflags=''
297lkflags=''
8e07c86e 298locincpth=''
2304df62 299optimize=''
b4eb6b3d 300cf_email=''
2304df62
AD
301cf_by=''
302cf_time=''
b4eb6b3d 303charsize=''
2304df62 304contains=''
b4eb6b3d 305cpp_stuff=''
2304df62
AD
306cpplast=''
307cppminus=''
308cpprun=''
309cppstdin=''
b4eb6b3d
JH
310crosscompile=''
311d_access=''
312d_accessx=''
313d_alarm=''
314d_attribut=''
315d_bcmp=''
316d_bcopy=''
317d_bzero=''
318d_casti32=''
319castflags=''
320d_castneg=''
321d_chown=''
322d_chroot=''
323d_chsize=''
324d_closedir=''
325d_void_closedir=''
326d_const=''
327cryptlib=''
328d_crypt=''
329d_csh=''
330full_csh=''
331d_cuserid=''
332d_dbl_dig=''
333d_difftime=''
334d_dlerror=''
a0d0e21e 335d_dlopen=''
b4eb6b3d
JH
336d_dlsymun=''
337d_dosuid=''
338d_suidsafe=''
339d_drand48proto=''
340d_dup2=''
341d_eaccess=''
342d_endgrent=''
343d_endhent=''
344d_endnent=''
345d_endpent=''
346d_endpwent=''
347d_endsent=''
348d_fchmod=''
349d_fchown=''
350d_fcntl=''
9d9004a9 351d_fcntl_can_lock=''
b4eb6b3d
JH
352d_fd_macros=''
353d_fd_set=''
354d_fds_bits=''
355d_fgetpos=''
356d_flexfnam=''
357d_flock=''
358d_fork=''
359d_fpos64_t=''
360d_frexpl=''
361d_fs_data_s=''
362d_fseeko=''
363d_fsetpos=''
364d_fstatfs=''
365d_ftello=''
366d_ftime=''
367d_gettimeod=''
368d_Gconvert=''
369d_getcwd=''
370d_getespwnam=''
371d_getfsstat=''
372d_getgrent=''
373d_getgrps=''
374d_gethbyaddr=''
375d_gethbyname=''
376d_gethent=''
377aphostname=''
378d_gethname=''
379d_phostname=''
380d_uname=''
381d_gethostprotos=''
382d_getlogin=''
383d_getmnt=''
384d_getmntent=''
385d_getnbyaddr=''
386d_getnbyname=''
387d_getnent=''
388d_getnetprotos=''
389d_getpent=''
390d_getpgid=''
391d_getpgrp2=''
392d_bsdgetpgrp=''
393d_getpgrp=''
394d_getppid=''
395d_getprior=''
396d_getpbyname=''
397d_getpbynumber=''
398d_getprotoprotos=''
399d_getprpwnam=''
400d_getpwent=''
401d_getsent=''
402d_getservprotos=''
403d_getspnam=''
404d_getsbyname=''
405d_getsbyport=''
a4f3eea9 406d_gnulibc=''
b4eb6b3d
JH
407d_hasmntopt=''
408d_htonl=''
409d_iconv=''
410d_inetaton=''
411d_int64_t=''
412d_isascii=''
413d_isnan=''
414d_isnanl=''
415d_killpg=''
416d_lchown=''
417d_ldbl_dig=''
418d_link=''
419d_locconv=''
420d_lockf=''
421d_longdbl=''
422longdblsize=''
423d_longlong=''
424longlongsize=''
425d_lseekproto=''
426d_lstat=''
427d_madvise=''
428d_mblen=''
429d_mbstowcs=''
430d_mbtowc=''
431d_memchr=''
432d_memcmp=''
433d_memcpy=''
434d_memmove=''
435d_memset=''
436d_mkdir=''
437d_mkdtemp=''
438d_mkfifo=''
439d_mkstemp=''
440d_mkstemps=''
441d_mktime=''
442d_mmap=''
443mmaptype=''
444d_modfl=''
445d_mprotect=''
446d_msg=''
447d_msgctl=''
448d_msgget=''
449d_msgrcv=''
450d_msgsnd=''
451d_msync=''
452d_munmap=''
453d_nice=''
454d_off64_t=''
455d_open3=''
456d_fpathconf=''
457d_pathconf=''
458d_pause=''
459d_pipe=''
460d_poll=''
2304df62 461d_portable=''
b4eb6b3d
JH
462d_old_pthread_create_joinable=''
463old_pthread_create_joinable=''
464d_pthread_yield=''
465d_sched_yield=''
466sched_yield=''
467d_qgcvt=''
468d_readdir=''
469d_rewinddir=''
470d_seekdir=''
471d_telldir=''
472d_readlink=''
473d_rename=''
474d_rmdir=''
475d_safebcpy=''
476d_safemcpy=''
477d_sanemcmp=''
478d_select=''
479d_sem=''
480d_semctl=''
481d_semget=''
482d_semop=''
483d_setegid=''
484d_seteuid=''
485d_setgrent=''
486d_setgrps=''
487d_sethent=''
488d_setlinebuf=''
489d_setlocale=''
490d_setnent=''
491d_setpent=''
492d_setpgid=''
493d_setpgrp2=''
494d_bsdsetpgrp=''
495d_setpgrp=''
496d_setprior=''
497d_setproctitle=''
498d_setpwent=''
499d_setregid=''
500d_setresgid=''
501d_setresuid=''
502d_setreuid=''
503d_setrgid=''
504d_setruid=''
505d_setsent=''
506d_setsid=''
507d_setvbuf=''
508d_sfio=''
509usesfio=''
510d_shm=''
511d_shmat=''
512d_shmatprototype=''
513shmattype=''
514d_shmctl=''
515d_shmdt=''
516d_shmget=''
517d_sigaction=''
518d_sigsetjmp=''
519d_msg_ctrunc=''
520d_msg_dontroute=''
521d_msg_oob=''
522d_msg_peek=''
523d_msg_proxy=''
524d_oldsock=''
525d_scm_rights=''
526d_socket=''
527d_sockpair=''
528sockethdr=''
529socketlib=''
530d_socklen_t=''
531d_socks5_init=''
532d_sqrtl=''
533d_statblks=''
534d_statfs_f_flags=''
535d_statfs_s=''
536d_fstatvfs=''
537d_statvfs=''
538d_stdio_cnt_lval=''
539d_stdio_ptr_lval=''
a7ffa9b9
NC
540d_stdio_ptr_lval_nochange_cnt=''
541d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
542d_stdiobase=''
543d_stdstdio=''
544stdio_base=''
545stdio_bufsiz=''
546stdio_cnt=''
547stdio_filbuf=''
548stdio_ptr=''
549d_index=''
550d_strchr=''
551d_strcoll=''
552d_strctcpy=''
553d_strerrm=''
554d_strerror=''
555d_sysernlst=''
556d_syserrlst=''
557d_strtod=''
558d_strtol=''
559d_strtold=''
560d_strtoll=''
561d_strtoul=''
562d_strtoull=''
563d_strtouq=''
564d_strxfrm=''
565d_symlink=''
566d_syscall=''
567d_sysconf=''
568d_system=''
569d_tcgetpgrp=''
570d_tcsetpgrp=''
571d_telldirproto=''
572d_time=''
573timetype=''
574clocktype=''
575d_times=''
576d_truncate=''
577d_tzname=''
578d_umask=''
579d_semctl_semid_ds=''
580d_semctl_semun=''
581d_union_semun=''
582d_ustat=''
583d_vfork=''
584usevfork=''
585d_voidsig=''
586signal_t=''
587d_volatile=''
588d_charvspr=''
589d_vprintf=''
590d_wait4=''
591d_waitpid=''
592d_wcstombs=''
593d_wctomb=''
594dlext=''
85e6fe83
LW
595cccdlflags=''
596ccdlflags=''
2304df62 597dlsrc=''
232e078e 598ld=''
85e6fe83 599lddlflags=''
2304df62 600usedl=''
b4eb6b3d
JH
601doublesize=''
602ebcdic=''
603fflushNULL=''
604fflushall=''
605fpossize=''
606fpostype=''
5b463ca7 607gccosandvers=''
8a27cf78 608gccversion=''
b4eb6b3d
JH
609gidformat=''
610gidsign=''
611gidsize=''
612gidtype=''
613groupstype=''
614h_fcntl=''
615h_sysfile=''
616i_arpainet=''
617db_hashtype=''
618db_prefixtype=''
619i_db=''
620i_dbm=''
621i_rpcsvcdbm=''
622d_dirnamlen=''
623direntrytype=''
624i_dirent=''
a0d0e21e 625i_dld=''
b4eb6b3d
JH
626i_dlfcn=''
627i_fcntl=''
628i_float=''
629i_gdbm=''
630d_grpasswd=''
631i_grp=''
632i_iconv=''
633i_ieeefp=''
634i_inttypes=''
635i_libutil=''
636i_limits=''
637i_locale=''
638i_machcthr=''
639i_malloc=''
640i_math=''
641i_memory=''
642i_mntent=''
643i_ndbm=''
644i_netdb=''
645i_neterrno=''
646i_netinettcp=''
647i_niin=''
648i_sysin=''
649i_poll=''
650i_prot=''
651i_pthread=''
652d_pwage=''
653d_pwchange=''
654d_pwclass=''
655d_pwcomment=''
656d_pwexpire=''
657d_pwgecos=''
658d_pwpasswd=''
659d_pwquota=''
660i_pwd=''
661i_sfio=''
662i_shadow=''
663i_socks=''
664i_stddef=''
665i_stdlib=''
666i_string=''
667strings=''
668i_sunmath=''
669i_sysaccess=''
670i_sysdir=''
671i_sysfile=''
672d_voidtty=''
673i_bsdioctl=''
674i_sysfilio=''
675i_sysioctl=''
676i_syssockio=''
677i_syslog=''
678i_sysmman=''
679i_sysmode=''
680i_sysmount=''
681i_sysndir=''
682i_sysparam=''
683i_sysresrc=''
684i_syssecrt=''
685i_sysselct=''
686i_sysstat=''
687i_sysstatfs=''
688i_sysstatvfs=''
689i_systimes=''
690i_systypes=''
691i_sysuio=''
692i_sysun=''
693i_sysutsname=''
694i_sysvfs=''
695i_syswait=''
696i_sgtty=''
697i_termio=''
698i_termios=''
699i_systime=''
700i_systimek=''
701i_time=''
702timeincl=''
703i_unistd=''
704i_ustat=''
705i_utime=''
706i_values=''
707i_stdarg=''
708i_varargs=''
709i_varhdr=''
710i_vfork=''
711inc_version_list=''
712inc_version_list_init=''
713installprefix=''
714installprefixexp=''
715installstyle=''
716installusrbinperl=''
717intsize=''
718longsize=''
719shortsize=''
2304df62 720libc=''
b4eb6b3d
JH
721ldlibpthname=''
722libperl=''
723shrpenv=''
724useshrplib=''
a0d0e21e 725glibpth=''
2304df62 726libpth=''
8e07c86e 727loclibpth=''
2304df62
AD
728plibpth=''
729xlibpth=''
1cfa4ec7 730ignore_versioned_solibs=''
2304df62 731libs=''
43999f95
JH
732libsdirs=''
733libsfiles=''
734libsfound=''
13b3f787 735libspath=''
85e6fe83 736lns=''
b4eb6b3d
JH
737d_PRIEUldbl=''
738d_PRIFUldbl=''
739d_PRIGUldbl=''
740d_PRIeldbl=''
741d_PRIfldbl=''
742d_PRIgldbl=''
743d_SCNfldbl=''
744sPRIEUldbl=''
745sPRIFUldbl=''
746sPRIGUldbl=''
747sPRIeldbl=''
748sPRIfldbl=''
749sPRIgldbl=''
750sSCNfldbl=''
751lseeksize=''
752lseektype=''
8ff267be 753make_set_make=''
b4eb6b3d
JH
754d_mymalloc=''
755freetype=''
756mallocobj=''
757mallocsrc=''
758malloctype=''
759usemymalloc=''
760installman1dir=''
761man1dir=''
762man1direxp=''
763man1ext=''
764installman3dir=''
765man3dir=''
766man3direxp=''
767man3ext=''
768modetype=''
769multiarch=''
770mydomain=''
771myhostname=''
772phostname=''
2304df62
AD
773c=''
774n=''
b4eb6b3d
JH
775d_eofnblk=''
776eagain=''
777o_nonblock=''
778rd_nodata=''
779netdb_hlen_type=''
780netdb_host_type=''
781netdb_name_type=''
782netdb_net_type=''
783groupcat=''
784hostcat=''
785passcat=''
786orderlib=''
787ranlib=''
788d_perl_otherlibdirs=''
789otherlibdirs=''
2304df62
AD
790package=''
791spackage=''
b4eb6b3d
JH
792pager=''
793api_revision=''
794api_subversion=''
795api_version=''
796api_versionstring=''
797patchlevel=''
798revision=''
799subversion=''
800version=''
801perl5=''
802perladmin=''
803perlpath=''
804d_nv_preserves_uv=''
805d_nv_preserves_uv_bits=''
806i16size=''
807i16type=''
808i32size=''
809i32type=''
810i64size=''
811i64type=''
812i8size=''
813i8type=''
814ivsize=''
815ivtype=''
816nvsize=''
817nvtype=''
818u16size=''
819u16type=''
820u32size=''
821u32type=''
822u64size=''
823u64type=''
824u8size=''
825u8type=''
826uvsize=''
827uvtype=''
828ivdformat=''
829nvEUformat=''
830nvFUformat=''
831nvGUformat=''
832nveformat=''
833nvfformat=''
834nvgformat=''
835uvXUformat=''
836uvoformat=''
837uvuformat=''
838uvxformat=''
839pidtype=''
840prefix=''
841prefixexp=''
842installprivlib=''
843privlib=''
844privlibexp=''
845prototype=''
846ptrsize=''
847d_PRIXU64=''
848d_PRId64=''
849d_PRIi64=''
850d_PRIo64=''
851d_PRIu64=''
852d_PRIx64=''
853sPRIXU64=''
854sPRId64=''
855sPRIi64=''
856sPRIo64=''
857sPRIu64=''
858sPRIx64=''
859d_quad=''
860quadkind=''
861quadtype=''
862uquadtype=''
863drand01=''
864randbits=''
865randfunc=''
866randseedtype=''
867seedfunc=''
868installscript=''
869scriptdir=''
870scriptdirexp=''
871selectminbits=''
872selecttype=''
8ff267be 873sh=''
b4eb6b3d
JH
874sig_count=''
875sig_name=''
876sig_name_init=''
877sig_num=''
878sig_num_init=''
879installsitearch=''
880sitearch=''
881sitearchexp=''
882installsitebin=''
883sitebin=''
884sitebinexp=''
885installsitelib=''
886sitelib=''
887sitelib_stem=''
888sitelibexp=''
889siteprefix=''
890siteprefixexp=''
891sizesize=''
892sizetype=''
a0d0e21e 893so=''
b4eb6b3d 894socksizetype=''
2304df62
AD
895sharpbang=''
896shsharp=''
897spitshell=''
dfe9444c 898src=''
b4eb6b3d
JH
899ssizetype=''
900startperl=''
2304df62 901startsh=''
b4eb6b3d
JH
902stdchar=''
903d_stdio_stream_array=''
904stdio_stream_array=''
905sysman=''
5ff3f7a4 906trnl=''
b4eb6b3d
JH
907uidformat=''
908uidsign=''
909uidsize=''
910uidtype=''
911archname64=''
912use64bitall=''
913use64bitint=''
914ccflags_uselargefiles=''
915ldflags_uselargefiles=''
916libswanted_uselargefiles=''
917uselargefiles=''
918uselongdouble=''
919usemorebits=''
920usemultiplicity=''
2304df62 921nm_opt=''
40a7a20a 922nm_so_opt=''
2304df62
AD
923runnm=''
924usenm=''
b4eb6b3d 925useperlio=''
29209bc5 926usesocks=''
b4eb6b3d
JH
927d_oldpthreads=''
928use5005threads=''
929useithreads=''
930usethreads=''
2304df62 931incpath=''
2304df62
AD
932mips_type=''
933usrinc=''
b4eb6b3d
JH
934d_vendorarch=''
935installvendorarch=''
936vendorarch=''
937vendorarchexp=''
938d_vendorbin=''
939installvendorbin=''
940vendorbin=''
941vendorbinexp=''
942d_vendorlib=''
943installvendorlib=''
944vendorlib=''
945vendorlib_stem=''
946vendorlibexp=''
947usevendorprefix=''
948vendorprefix=''
949vendorprefixexp=''
d56c5707 950versiononly=''
b4eb6b3d
JH
951defvoidused=''
952voidflags=''
953pm_apiversion=''
954xs_apiversion=''
2304df62
AD
955CONFIG=''
956
ecfc5424
AD
957define='define'
958undef='undef'
959smallmach='pdp11 i8086 z8000 i80286 iAPX286'
960rmlist=''
961
962: We must find out about Eunice early
963eunicefix=':'
964if test -f /etc/unixtovms; then
965 eunicefix=/etc/unixtovms
966fi
967if test -f /etc/unixtovms.exe; then
968 eunicefix=/etc/unixtovms.exe
969fi
970
b4eb6b3d 971i_whoami=''
6b356c8e
JH
972ccname=''
973ccversion=''
9c839522 974perllibs=''
b4eb6b3d
JH
975: set useposix=false in your hint file to disable the POSIX extension.
976useposix=true
977: set useopcode=false in your hint file to disable the Opcode extension.
978useopcode=true
dfe9444c 979: Trailing extension. Override this in a hint file, if needed.
4e2a5f63 980_exe=''
dfe9444c
AD
981: Extra object files, if any, needed on this platform.
982archobjs=''
b4eb6b3d 983archname=''
ff935051
JH
984: Possible local include directories to search.
985: Set locincpth to "" in a hint file to defeat local include searches.
986locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
987locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
988:
989: no include file wanted by default
990inclwanted=''
991
b4eb6b3d 992groupstype=''
732c9516
JH
993: change the next line if compiling for Xenix/286 on Xenix/386
994xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
995: Possible local library directories to search.
996loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
997loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
998
999: general looking path for locating libraries
5869b1f1 1000glibpth="/lib /usr/lib $xlibpth"
732c9516 1001glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1002test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1003test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1004
1005: Private path used by Configure to find libraries. Its value
1006: is prepended to libpth. This variable takes care of special
1007: machines, like the mips. Usually, it should be empty.
1008plibpth=''
1009
1cfa4ec7
GS
1010: default library list
1011libswanted=''
921b2963 1012: some systems want to use only the non-versioned libso:s
1cfa4ec7 1013ignore_versioned_solibs=''
b4eb6b3d
JH
1014archname64=''
1015ccflags_uselargefiles=''
1016ldflags_uselargefiles=''
1017libswanted_uselargefiles=''
1018: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1019: set usesocks on the Configure command line to enable socks.
b4eb6b3d
JH
1020: set usethreads on the Configure command line to enable threads.
1021: full support for void wanted by default
1022defvoidused=15
1023
ecfc5424 1024: List of libraries we want.
693762b4 1025: If anyone needs -lnet, put it in a hint file.
997d70a2 1026libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
69e84d1d 1027libswanted="$libswanted dld ld sun m c cposix posix"
f1066039 1028libswanted="$libswanted ndir dir crypt sec"
0c9177ab 1029libswanted="$libswanted ucb bsd BSD PW x iconv util"
1aef975c 1030: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1031: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1032glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1033glibpth="/usr/shlib $glibpth"
1034: Do not use vfork unless overridden by a hint file.
1035usevfork=false
1036
8ff267be 1037: Find the basic shell for Bourne shell scripts
1038case "$sh" in
1039'')
8ff267be 1040 case "$SYSTYPE" in
1041 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1042 *) xxx='/bin/sh';;
1043 esac
1044 if test -f "$xxx"; then
1045 sh="$xxx"
1046 else
1047 : Build up a list and do a single loop so we can 'break' out.
1048 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1049 for xxx in sh bash ksh pdksh ash; do
1050 for p in $pth; do
1051 try="$try ${p}/${xxx}"
1052 done
1053 done
1054 for xxx in $try; do
1055 if test -f "$xxx"; then
1056 sh="$xxx";
8ff267be 1057 break
1058 elif test -f "$xxx.exe"; then
1059 sh="$xxx";
8ff267be 1060 break
1061 fi
1062 done
1063 fi
1064 ;;
1065esac
1066
1067case "$sh" in
1068'') cat <<EOM >&2
1069$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1070
8ff267be 1071Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1072Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1073we'll try to straighten this all out.
8ff267be 1074EOM
1075 exit 1
1076 ;;
1077esac
1078
760ac839 1079: see if sh knows # comments
8ff267be 1080if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1081 shsharp=true
1082 spitshell=cat
760ac839
LW
1083 xcat=/bin/cat
1084 test -f $xcat || xcat=/usr/bin/cat
1085 echo "#!$xcat" >try
1086 $eunicefix try
1087 chmod +x try
1088 ./try > today
1089 if test -s today; then
760ac839
LW
1090 sharpbang='#!'
1091 else
1092 echo "#! $xcat" > try
1093 $eunicefix try
1094 chmod +x try
1095 ./try > today
1096 if test -s today; then
760ac839
LW
1097 sharpbang='#! '
1098 else
760ac839
LW
1099 sharpbang=': use '
1100 fi
1101 fi
1102else
dfe9444c 1103 echo " "
8ff267be 1104 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1105 shsharp=false
1106 cd ..
1107 echo "exec grep -v '^[ ]*#'" >spitshell
1108 chmod +x spitshell
1109 $eunicefix spitshell
1110 spitshell=`pwd`/spitshell
1111 cd UU
1112 echo "I presume that if # doesn't work, #! won't work either!"
1113 sharpbang=': use '
1114fi
1115rm -f try today
1116
1117: figure out how to guarantee sh startup
8ff267be 1118case "$startsh" in
1119'') startsh=${sharpbang}${sh} ;;
1120*)
760ac839 1121esac
760ac839
LW
1122cat >try <<EOSS
1123$startsh
1124set abc
1125test "$?abc" != 1
1126EOSS
1127
1128chmod +x try
1129$eunicefix try
1130if ./try; then
8ff267be 1131 : echo "Yup, it does."
760ac839 1132else
dfe9444c
AD
1133 echo "Hmm... '$startsh' does not guarantee sh startup..."
1134 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839
LW
1135fi
1136rm -f try
1137
aebf16e7
AD
1138
1139: Save command line options in file UU/cmdline.opt for later use in
1140: generating config.sh.
1141cat > cmdline.opt <<EOSH
1142# Configure command line arguments.
1143config_arg0='$0'
1144config_args='$*'
1145config_argc=$#
1146EOSH
1147argn=1
1148for arg in "$@"; do
1149 cat >>cmdline.opt <<EOSH
1150config_arg$argn='$arg'
1151EOSH
1152 argn=`expr $argn + 1`
1153done
1154
2304df62
AD
1155: produce awk script to parse command line options
1156cat >options.awk <<'EOF'
1157BEGIN {
02e93a22 1158 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1159
1160 len = length(optstr);
1161 for (i = 1; i <= len; i++) {
1162 c = substr(optstr, i, 1);
1163 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1164 if (a == ":") {
1165 arg[c] = 1;
1166 i++;
1167 }
1168 opt[c] = 1;
1169 }
1170}
1171{
1172 expect = 0;
1173 str = $0;
1174 if (substr(str, 1, 1) != "-") {
1175 printf("'%s'\n", str);
1176 next;
1177 }
1178 len = length($0);
1179 for (i = 2; i <= len; i++) {
1180 c = substr(str, i, 1);
1181 if (!opt[c]) {
1182 printf("-%s\n", substr(str, i));
1183 next;
1184 }
1185 printf("-%s\n", c);
1186 if (arg[c]) {
1187 if (i < len)
1188 printf("'%s'\n", substr(str, i + 1));
1189 else
1190 expect = 1;
1191 next;
1192 }
1193 }
1194}
1195END {
1196 if (expect)
1197 print "?";
1198}
1199EOF
1200
1201: process the command line options
4633a7c4
LW
1202set X `for arg in "$@"; do echo "X$arg"; done |
1203 sed -e s/X// | awk -f options.awk`
2304df62
AD
1204eval "set $*"
1205shift
1206rm -f options.awk
1207
1208: set up default values
1209fastread=''
1210reuseval=false
1211config_sh=''
1212alldone=''
1213error=''
1214silent=''
1215extractsh=''
ecfc5424 1216override=''
16d20bd9 1217knowitall=''
02e93a22 1218rm -f optdef.sh posthint.sh
28757baa 1219cat >optdef.sh <<EOS
1220$startsh
1221EOS
2304df62 1222
dfe9444c 1223
2304df62
AD
1224: option parsing
1225while test $# -gt 0; do
1226 case "$1" in
1227 -d) shift; fastread=yes;;
1228 -e) shift; alldone=cont;;
1229 -f)
1230 shift
1231 cd ..
1232 if test -r "$1"; then
1233 config_sh="$1"
1234 else
a0d0e21e 1235 echo "$me: cannot read config file $1." >&2
2304df62
AD
1236 error=true
1237 fi
1238 cd UU
1239 shift;;
1240 -h) shift; error=true;;
1241 -r) shift; reuseval=true;;
dfe9444c 1242 -s) shift; silent=true; realsilent=true;;
2304df62 1243 -E) shift; alldone=exit;;
16d20bd9 1244 -K) shift; knowitall=true;;
ecfc5424 1245 -O) shift; override=true;;
dfe9444c 1246 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1247 -D)
1248 shift
1249 case "$1" in
1250 *=)
1251 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1252 echo "$me: ignoring -D $1" >&2
1253 ;;
ecfc5424 1254 *=*) echo "$1" | \
1aef975c
AD
1255 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1256 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1257 esac
1258 shift
1259 ;;
1260 -U)
1261 shift
1262 case "$1" in
1aef975c 1263 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1264 *=*)
1265 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1266 echo "$me: ignoring -U $1" >&2
1267 ;;
1aef975c 1268 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1269 esac
1270 shift
1271 ;;
02e93a22
JH
1272 -A)
1273 shift
1274 xxx=''
1275 yyy="$1"
02e93a22 1276 zzz=''
5f83a3e9 1277 uuu=undef
02e93a22 1278 case "$yyy" in
5f83a3e9
JH
1279 *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1280 case "$zzz" in
1281 *:*) zzz='' ;;
1282 *) xxx=append
1283 zzz=" "`echo $yyy|sed 's!^[^=]*=!!'`
1284 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1285 esac
1286 ;;
1287 esac
1288 case "$xxx" in
1289 '') case "$yyy" in
1290 *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1291 yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1292 zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1293 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1294 *) xxx=`echo $yyy|sed 's!:.*!!'`
1295 yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1296 esac
1297 ;;
1298 esac
02e93a22
JH
1299 case "$xxx" in
1300 append)
5f83a3e9 1301 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1302 clear)
5f83a3e9 1303 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1304 define)
1305 case "$zzz" in
1306 '') zzz=define ;;
1307 esac
5f83a3e9 1308 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1309 eval)
5f83a3e9 1310 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1311 prepend)
5f83a3e9 1312 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1313 undef)
1314 case "$zzz" in
1315 '') zzz="$uuu" ;;
1316 esac
5f83a3e9
JH
1317 echo "$yyy=$zzz" >> posthint.sh ;;
1318 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1319 esac
bde6b06b 1320 shift
02e93a22 1321 ;;
dfe9444c 1322 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1323 exit 0;;
2304df62 1324 --) break;;
a0d0e21e 1325 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1326 *) break;;
1327 esac
1328done
1329
1330case "$error" in
1331true)
1332 cat >&2 <<EOM
2afac517 1333Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1334 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1335 -d : use defaults for all answers.
1336 -e : go on without questioning past the production of config.sh.
1337 -f : specify an alternate default configuration file.
1338 -h : print this help message and exit (with an error status).
1339 -r : reuse C symbols value if possible (skips costly nm extraction).
1340 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1341 -D : define symbol to have some value:
1342 -D symbol symbol gets the value 'define'
1343 -D symbol=value symbol gets the value 'value'
2304df62 1344 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1345 -K : do not use unless you know what you are doing.
ecfc5424 1346 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1347 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1348 -U : undefine symbol:
1349 -U symbol symbol gets the value 'undef'
1350 -U symbol= symbol gets completely empty
02e93a22 1351 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1352 -A symbol=value append " "value to symbol
02e93a22
JH
1353 -A append:symbol=value append value to symbol
1354 -A define:symbol=value define symbol to have value
02e93a22
JH
1355 -A clear:symbol define symbol to be ''
1356 -A define:symbol define symbol to be 'define'
1357 -A eval:symbol=value define symbol to be eval of value
1358 -A prepend:symbol=value prepend value to symbol
1359 -A undef:symbol define symbol to be 'undef'
1360 -A undef:symbol= define symbol to be ''
2304df62
AD
1361 -V : print version number and exit (with a zero status).
1362EOM
1363 exit 1
1364 ;;
1365esac
1366
dfe9444c
AD
1367: Sanity checks
1368case "$fastread$alldone" in
1369yescont|yesexit) ;;
1370*)
aaeb8e51
GS
1371 case "$extractsh" in
1372 true) ;;
1373 *)
1374 if test ! -t 0; then
1375 echo "Say 'sh Configure', not 'sh <Configure'"
1376 exit 1
1377 fi
1378 ;;
1379 esac
dfe9444c
AD
1380 ;;
1381esac
1382
2304df62
AD
1383exec 4>&1
1384case "$silent" in
1385true) exec 1>/dev/null;;
1386esac
1387
ecfc5424 1388: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1389touch optdef.sh
1390. ./optdef.sh
02e93a22
JH
1391: create the posthint manipulation script and leave the file out there...
1392touch posthint.sh
a0d0e21e 1393
2304df62 1394: set package name
85e6fe83 1395package=perl5
b4eb6b3d
JH
1396first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1397last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1398case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1399ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1400*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1401esac
2304df62 1402
2304df62
AD
1403: Some greps do not return status, grrr.
1404echo "grimblepritz" >grimble
1405if grep blurfldyick grimble >/dev/null 2>&1 ; then
1406 contains=contains
1407elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1408 contains=grep
1409else
1410 contains=contains
1411fi
1412rm -f grimble
1413: the following should work in any shell
1414case "$contains" in
1415contains*)
1416 echo " "
1417 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1418 cat >contains <<'EOSS'
1419grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1420EOSS
1421chmod +x contains
1422esac
1423
dfe9444c
AD
1424: Find the path to the source tree
1425case "$src" in
1426'') case "$0" in
b233458b
JH
1427 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1428 case "$src" in
1429 /*) ;;
1430 *) src=`cd ../$src && pwd` ;;
1431 esac
1432 ;;
dfe9444c
AD
1433 *) src='.';;
1434 esac;;
1435esac
1436case "$src" in
1437'') src=/
1438 rsrc=/
1439 ;;
1440/*) rsrc="$src";;
1441*) rsrc="../$src";;
1442esac
1443if test -f $rsrc/Configure && \
1444 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1445then
1446 : found it, so we are ok.
1447else
1448 rsrc=''
1449 for src in . .. ../.. ../../.. ../../../..; do
1450 if test -f ../$src/Configure && \
1451 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1452 then
1453 rsrc=../$src
1454 break
1455 fi
1456 done
1457fi
1458case "$rsrc" in
1459'')
1460 cat <<EOM >&4
1461
1462Sorry, I can't seem to locate the source dir for $package. Please start
1463Configure with an explicit path -- i.e. /some/path/Configure.
1464
1465EOM
1466 exit 1
1467 ;;
1468../.) rsrc='..';;
1469*)
1470 echo " "
1471 echo "Sources for $package found in \"$src\"." >&4
1472 ;;
1473esac
1474
1475: script used to extract .SH files with variable substitutions
1476cat >extract <<'EOS'
2000072c 1477CONFIGDOTSH=true
dfe9444c
AD
1478echo "Doing variable substitutions on .SH files..."
1479if test -f $src/MANIFEST; then
f7ab18e9 1480 set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
dfe9444c
AD
1481else
1482 echo "(Looking for .SH files under the source directory.)"
1483 set x `(cd $src; find . -name "*.SH" -print)`
1484fi
1485shift
1486case $# in
14870) set x `(cd $src; echo *.SH)`; shift;;
1488esac
1489if test ! -f $src/$1; then
1490 shift
1491fi
1492mkdir_p='
1493name=$1;
1494create="";
1495while test $name; do
1496 if test ! -d "$name"; then
1497 create="$name $create";
1498 name=`echo $name | sed -e "s|^[^/]*$||"`;
1499 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1500 else
1501 name="";
1502 fi;
1503done;
1504for file in $create; do
1505 mkdir $file;
1506done
1507'
1508for file in $*; do
1509 case "$src" in
1510 ".")
1511 case "$file" in
1512 */*)
1513 dir=`expr X$file : 'X\(.*\)/'`
1514 file=`expr X$file : 'X.*/\(.*\)'`
1515 (cd $dir && . ./$file)
1516 ;;
1517 *)
1518 . ./$file
1519 ;;
1520 esac
1521 ;;
1522 *)
1523 case "$file" in
1524 */*)
1525 dir=`expr X$file : 'X\(.*\)/'`
1526 file=`expr X$file : 'X.*/\(.*\)'`
1527 (set x $dir; shift; eval $mkdir_p)
1528 sh <$src/$dir/$file
1529 ;;
1530 *)
1531 sh <$src/$file
1532 ;;
1533 esac
1534 ;;
1535 esac
1536done
1537if test -f $src/config_h.SH; then
1538 if test ! -f config.h; then
1539 : oops, they left it out of MANIFEST, probably, so do it anyway.
1540 . $src/config_h.SH
1541 fi
1542fi
1543EOS
1544
1545: extract files and exit if asked to do so
1546case "$extractsh" in
1547true)
1548 case "$realsilent" in
1549 true) ;;
1550 *) exec 1>&4;;
1551 esac
1552 case "$config_sh" in
1553 '') config_sh='config.sh';;
1554 esac
1555 echo " "
1556 echo "Fetching answers from $config_sh..."
1557 cd ..
1558 . $config_sh
1559 test "$override" && . ./optdef.sh
1560 echo " "
1561 . UU/extract
1562 rm -rf UU
1563 echo "Done."
1564 exit 0
1565 ;;
1566esac
1567
1568: Eunice requires " " instead of "", can you believe it
1569echo " "
1570: Here we go...
1571echo "Beginning of configuration questions for $package."
1572
1573trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1574
2304df62
AD
1575: first determine how to suppress newline on echo command
1576echo " "
1577echo "Checking echo to see how to suppress newlines..."
1578(echo "hi there\c" ; echo " ") >.echotmp
1579if $contains c .echotmp >/dev/null 2>&1 ; then
1580 echo "...using -n."
1581 n='-n'
1582 c=''
1583else
1584 cat <<'EOM'
1585...using \c
1586EOM
1587 n=''
1588 c='\c'
1589fi
1590echo $n "The star should be here-->$c"
1591echo '*'
1592rm -f .echotmp
1593
1594: Now test for existence of everything in MANIFEST
1595echo " "
dfe9444c 1596if test -f $rsrc/MANIFEST; then
2304df62 1597 echo "First let's make sure your kit is complete. Checking..." >&4
dfe9444c 1598 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
2304df62 1599 rm -f missing
dfe9444c 1600 tmppwd=`pwd`
2304df62 1601 for filelist in x??; do
dfe9444c 1602 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
2304df62
AD
1603 done
1604 if test -s missing; then
1605 cat missing >&4
1606 cat >&4 <<'EOM'
1607
1608THIS PACKAGE SEEMS TO BE INCOMPLETE.
1609
1610You have the option of continuing the configuration process, despite the
1611distinct possibility that your kit is damaged, by typing 'y'es. If you
1612do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1613and contact the author (perlbug@perl.org).
2304df62
AD
1614
1615EOM
1616 echo $n "Continue? [n] $c" >&4
1617 read ans
1618 case "$ans" in
1619 y*)
1620 echo "Continuing..." >&4
1621 rm -f missing
1622 ;;
1623 *)
1624 echo "ABORTING..." >&4
1625 kill $$
1626 ;;
1627 esac
1628 else
dfe9444c 1629 echo "Looks good..."
2304df62
AD
1630 fi
1631else
1632 echo "There is no MANIFEST file. I hope your kit is complete !"
1633fi
1634rm -f missing x??
1635
5ff3f7a4
GS
1636echo " "
1637: Find the appropriate value for a newline for tr
1638if test -n "$DJGPP"; then
1639 trnl='\012'
1640fi
1641if test X"$trnl" = X; then
1642 case "`echo foo|tr '\n' x 2>/dev/null`" in
1643 foox) trnl='\n' ;;
1644 esac
1645fi
1646if test X"$trnl" = X; then
1647 case "`echo foo|tr '\012' x 2>/dev/null`" in
1648 foox) trnl='\012' ;;
1649 esac
1650fi
1651if test X"$trnl" = X; then
1652 cat <<EOM >&2
1653
1654$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1655
1656EOM
1657 exit 1
1658fi
1659
2304df62
AD
1660: compute the number of columns on the terminal for proper question formatting
1661case "$COLUMNS" in
1662'') COLUMNS='80';;
1663esac
1664
1665: set up the echo used in my read
1666myecho="case \"\$xxxm\" in
1667'') echo $n \"\$rp $c\" >&4;;
1668*) case \"\$rp\" in
1669 '') echo $n \"[\$xxxm] $c\";;
1670 *)
1671 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1672 echo \"\$rp\" >&4
1673 echo $n \"[\$xxxm] $c\" >&4
1674 else
1675 echo $n \"\$rp [\$xxxm] $c\" >&4
1676 fi
1677 ;;
1678 esac;;
1679esac"
1680
1681: now set up to do reads with possible shell escape and default assignment
1682cat <<EOSC >myread
28757baa 1683$startsh
2304df62
AD
1684xxxm=\$dflt
1685$myecho
1686ans='!'
1687case "\$fastread" in
1688yes) case "\$dflt" in
1689 '') ;;
1690 *) ans='';
1691 case "\$silent-\$rp" in
1692 true-) ;;
1693 *) echo " " >&4;;
1694 esac;;
1695 esac;;
1696*) case "\$silent" in
1697 true) case "\$rp" in
1698 '') ans='';;
1699 esac;;
1700 esac;;
1701esac
1702while expr "X\$ans" : "X!" >/dev/null; do
1703 read answ
1704 set x \$xxxm
1705 shift
dfe9444c 1706 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1707 case "\$answ" in
dfe9444c
AD
1708 "!")
1709 sh 1>&4
1710 echo " "
1711 $myecho
1712 ;;
1713 !*)
1714 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1715 shift
1716 sh 1>&4 -c "\$*"
1717 echo " "
1718 $myecho
1719 ;;
2304df62
AD
1720 "\$ans")
1721 case "\$ans" in
ecfc5424
AD
1722 \\&*)
1723 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1724 shift
1725 case "\$1" in
1726 -d)
1727 fastread=yes
40a7a20a 1728 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1729 ;;
1730 -*)
40a7a20a 1731 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1732 ;;
1733 esac
1734 $myecho
1735 ans=!
1736 ;;
2304df62
AD
1737 esac;;
1738 *)
1739 case "\$aok" in
1740 y)
1741 echo "*** Substitution done -- please confirm."
1742 xxxm="\$ans"
c9795ab7 1743 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1744 xxxm="\$ans"
1745 ans=!
1746 ;;
1747 *)
1748 echo "*** Error -- try again."
1749 ans=!
1750 ;;
1751 esac
1752 $myecho
1753 ;;
1754 esac
1755 case "\$ans\$xxxm\$nostick" in
1756 '')
1757 ans=!
1758 $myecho
1759 ;;
1760 esac
1761done
1762case "\$ans" in
1763'') ans="\$xxxm";;
1764esac
1765EOSC
1766
1767: create .config dir to save info across Configure sessions
1768test -d ../.config || mkdir ../.config
1769cat >../.config/README <<EOF
1770This directory created by Configure to save information that should
dfe9444c 1771persist across sessions for $package.
2304df62
AD
1772
1773You may safely delete it if you wish.
1774EOF
1775
9507cadf 1776xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 1777case "$usedevel" in
0107c034 1778$define|true|[yY]*) ;;
9507cadf 1779*) case "$xversion" in
0107c034
JH
1780 *[13579])
1781 cat >&4 <<EOH
1782*** WHOA THERE!!! ***
1783
1784 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
1785 The version of this $package distribution is $xversion, that is, odd,
1786 (as opposed to even) and that signifies a development release.
3d5d58b1 1787 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
1788
1789 Do ***NOT*** install this into production use.
1790 Data corruption and crashes are possible.
1791
1792 It is most seriously suggested that you do not continue any further
1793 unless you want to help in developing and debugging Perl.
1794
1795EOH
1796 rp='Do you really want to continue?'
1797 dflt='n'
1798 . ./myread
1799 case "$ans" in
1800 [yY]) echo >&4 "Okay, continuing." ;;
1801 *) echo >&4 "Okay, bye."
1802 exit 1
1803 ;;
1804 esac
1805 ;;
1806 esac
1807 ;;
1808esac
1809
2304df62
AD
1810: general instructions
1811needman=true
1812firsttime=true
760ac839 1813user=`(logname) 2>/dev/null`
dfe9444c
AD
1814case "$user" in
1815'') user=`whoami 2>&1`;;
760ac839 1816esac
2304df62
AD
1817if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1818 firsttime=false
1819 echo " "
1820 rp='Would you like to see the instructions?'
1821 dflt=n
1822 . ./myread
1823 case "$ans" in
1824 [yY]*) ;;
1825 *) needman=false;;
1826 esac
1827fi
1828if $needman; then
1829 cat <<EOH
4e2a5f63 1830
2304df62 1831This installation shell script will examine your system and ask you questions
a0d0e21e 1832to determine how the perl5 package should be installed. If you get
2304df62
AD
1833stuck on a question, you may use a ! shell escape to start a subshell or
1834execute a command. Many of the questions will have default answers in square
1835brackets; typing carriage return will give you the default.
1836
1837On some of the questions which ask for file or directory names you are allowed
1838to use the ~name construct to specify the login directory belonging to "name",
1839even if you don't have a shell which knows about that. Questions where this is
1840allowed will be marked "(~name ok)".
1841
1842EOH
1843 rp=''
1844 dflt='Type carriage return to continue'
1845 . ./myread
1846 cat <<'EOH'
1847
1848The prompter used in this script allows you to use shell variables and
1849backticks in your answers. You may use $1, $2, etc... to refer to the words
1850in the default answer, as if the default line was a set of arguments given to a
1851script shell. This means you may also use $* to repeat the whole default line,
1852so you do not have to re-type everything to add something to the default.
1853
1854Everytime there is a substitution, you will have to confirm. If there is an
1855error (e.g. an unmatched backtick), the default answer will remain unchanged
1856and you will be prompted again.
1857
1858If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1859the questions and use the computed defaults (or the previous answers if there
1860was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1861You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1862on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1863
1864EOH
1865 . ./myread
1866 cat <<EOH
1867
1868Much effort has been expended to ensure that this shell script will run on any
1869Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1870Configure and run it again. If you can't run Configure for some reason,
1871you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 1872have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
1873
1874This installation script affects things in two ways:
1875
18761) it may do direct variable substitutions on some of the files included
1877 in this kit.
18782) it builds a config.h file for inclusion in C programs. You may edit
1879 any of these files as the need arises after running this script.
1880
1881If you make a mistake on a question, there is no easy way to back up to it
1882currently. The easiest thing to do is to edit config.sh and rerun all the SH
1883files. Configure will offer to let you do this before it runs the SH files.
1884
1885EOH
1886 dflt='Type carriage return to continue'
1887 . ./myread
1888 case "$firsttime" in
1889 true) echo $user >>../.config/instruct;;
1890 esac
1891fi
1892
2304df62
AD
1893: find out where common programs are
1894echo " "
1895echo "Locating common programs..." >&4
1896cat <<EOSC >loc
1897$startsh
1898case \$# in
18990) exit 1;;
1900esac
1901thing=\$1
1902shift
1903dflt=\$1
1904shift
1905for dir in \$*; do
1906 case "\$thing" in
1907 .)
1908 if test -d \$dir/\$thing; then
1909 echo \$dir
1910 exit 0
1911 fi
1912 ;;
1913 *)
a0d0e21e 1914 for thisthing in \$dir/\$thing; do
ecfc5424 1915 : just loop through to pick last item
a0d0e21e 1916 done
25f94b33 1917 if test -f \$thisthing; then
a0d0e21e 1918 echo \$thisthing
2304df62
AD
1919 exit 0
1920 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
1921 if test -n "$DJGPP"; then
1922 echo \$dir/\$thing.exe
1923 else
1924 : on Eunice apparently
1925 echo \$dir/\$thing
1926 fi
2304df62
AD
1927 exit 0
1928 fi
1929 ;;
1930 esac
1931done
1932echo \$dflt
1933exit 1
1934EOSC
1935chmod +x loc
1936$eunicefix loc
1937loclist="
1938awk
1939cat
b4eb6b3d
JH
1940comm
1941cp
2304df62
AD
1942echo
1943expr
1944grep
a0d0e21e 1945ls
dfe9444c 1946make
b4eb6b3d 1947mkdir
2304df62
AD
1948rm
1949sed
b4eb6b3d 1950sort
85e6fe83 1951touch
2304df62 1952tr
b4eb6b3d 1953uniq
2304df62
AD
1954"
1955trylist="
1956Mcc
dfe9444c 1957ar
b4eb6b3d 1958byacc
2304df62 1959cpp
b4eb6b3d 1960csh
2304df62
AD
1961date
1962egrep
8ff267be 1963gzip
b4eb6b3d 1964less
8ff267be 1965ln
b4eb6b3d 1966more
693762b4 1967nm
b4eb6b3d
JH
1968nroff
1969pg
2304df62
AD
1970test
1971uname
8ff267be 1972zip
2304df62 1973"
8e07c86e 1974pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
1975pth="$pth /lib /usr/lib"
1976for file in $loclist; do
dfe9444c
AD
1977 eval xxx=\$$file
1978 case "$xxx" in
1979 /*|?:[\\/]*)
1980 if test -f "$xxx"; then
1981 : ok
1982 else
1983 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1984 xxx=`./loc $file $file $pth`
1985 fi
1986 ;;
1987 '') xxx=`./loc $file $file $pth`;;
1988 *) xxx=`./loc $xxx $xxx $pth`;;
1989 esac
2304df62
AD
1990 eval $file=$xxx
1991 eval _$file=$xxx
1992 case "$xxx" in
1993 /*)
1994 echo $file is in $xxx.
1995 ;;
8e07c86e
AD
1996 ?:[\\/]*)
1997 echo $file is in $xxx.
1998 ;;
2304df62 1999 *)
25f94b33
AD
2000 echo "I don't know where '$file' is, and my life depends on it." >&4
2001 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2002 exit 1
2304df62
AD
2003 ;;
2004 esac
2005done
2006echo " "
2007echo "Don't worry if any of the following aren't found..."
2008say=offhand
2009for file in $trylist; do
dfe9444c
AD
2010 eval xxx=\$$file
2011 case "$xxx" in
2012 /*|?:[\\/]*)
2013 if test -f "$xxx"; then
2014 : ok
2015 else
2016 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2017 xxx=`./loc $file $file $pth`
2018 fi
2019 ;;
2020 '') xxx=`./loc $file $file $pth`;;
2021 *) xxx=`./loc $xxx $xxx $pth`;;
2022 esac
2304df62
AD
2023 eval $file=$xxx
2024 eval _$file=$xxx
2025 case "$xxx" in
2026 /*)
2027 echo $file is in $xxx.
2028 ;;
8e07c86e
AD
2029 ?:[\\/]*)
2030 echo $file is in $xxx.
2031 ;;
2304df62
AD
2032 *)
2033 echo "I don't see $file out there, $say."
2034 say=either
2035 ;;
2036 esac
2037done
2038case "$egrep" in
2039egrep)
2040 echo "Substituting grep for egrep."
2041 egrep=$grep
2042 ;;
2043esac
8ff267be 2044case "$ln" in
2045ln)
2046 echo "Substituting cp for ln."
2047 ln=$cp
2048 ;;
2049esac
2304df62
AD
2050case "$test" in
2051test)
2052 echo "Hopefully test is built into your sh."
2053 ;;
2054*)
ecfc5424 2055 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2304df62
AD
2056 echo "Using the test built into your sh."
2057 test=test
2058 _test=test
2059 fi
2060 ;;
2061esac
2062case "$echo" in
2063echo)
2064 echo "Hopefully echo is built into your sh."
2065 ;;
2066'') ;;
2067*)
2068 echo " "
2069echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2070 $echo $n "hi there$c" >foo1
2071 echo $n "hi there$c" >foo2
2072 if cmp foo1 foo2 >/dev/null 2>&1; then
2073 echo "They are compatible. In fact, they may be identical."
2074 else
2075 case "$n" in
2076 '-n') n='' c='\c';;
2077 *) n='-n' c='';;
2078 esac
2079 cat <<FOO
2080They are not compatible! You are probably running ksh on a non-USG system.
2081I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2082have echo built in and we may have to run some Bourne shell scripts. That
2083means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2084
2085FOO
2086 $echo $n "The star should be here-->$c"
2087 $echo "*"
2088 fi
2089 $rm -f foo1 foo2
2090 ;;
2091esac
2092
2573c5f9
JH
2093cat <<EOS >checkcc
2094$startsh
2095EOS
2096cat <<'EOSC' >>checkcc
2097case "$cc" in
2098'') ;;
2099*) $rm -f try try.*
2100 $cat >try.c <<EOM
2101int main(int argc, char *argv[]) {
2102 return 0;
2103}
2104EOM
7a282f6d 2105 if $cc -o try $ccflags try.c; then
2573c5f9
JH
2106 :
2107 else
2108 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2109 despair=yes
2110 trygcc=yes
2111 case "$cc" in
2112 *gcc*) trygcc=no ;;
2113 esac
2114 case "`$cc -v -c try.c 2>&1`" in
2115 *gcc*) trygcc=no ;;
2116 esac
2117 if $test X"$trygcc" = Xyes; then
2118 if gcc -o try -c try.c; then
2119 echo " "
2120 echo "You seem to have a working gcc, though." >&4
2121 rp="Would you like to use it?"
2122 dflt=y
2123 if $test -f myread; then
2124 . ./myread
2125 else
2126 if $test -f UU/myread; then
2127 . ./UU/myread
2128 else
2129 echo "Cannot find myread, sorry. Aborting." >&2
2130 exit 1
2131 fi
2132 fi
2133 case "$ans" in
e723fc21 2134 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2573c5f9
JH
2135 esac
2136 fi
2137 fi
2138 if $test X"$despair" = Xyes; then
5dd4fbdf
MB
2139 $cat >&4 <<EOM
2140You need to find a working C compiler.
2141Either (purchase and) install the C compiler supplied by your OS vendor,
2142or for a free C compiler try http://gcc.gnu.org/
2143I cannot continue any further, aborting.
2144EOM
2573c5f9
JH
2145 exit 1
2146 fi
2147 fi
2148 $rm -f try try.*
2149 ;;
2150esac
2151EOSC
2152
a0d0e21e
LW
2153: determine whether symbolic links are supported
2154echo " "
2155$touch blurfl
2156if $ln -s blurfl sym > /dev/null 2>&1 ; then
2157 echo "Symbolic links are supported." >&4
2158 lns="$ln -s"
2159else
2160 echo "Symbolic links are NOT supported." >&4
2161 lns="$ln"
2162fi
2163$rm -f blurfl sym
2164
ecfc5424
AD
2165: see whether [:lower:] and [:upper:] are supported character classes
2166echo " "
ecfc5424
AD
2167case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2168ABYZ)
2169 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2170 up='[:upper:]'
2171 low='[:lower:]'
2172 ;;
28e8609d
JH
2173*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2174 # (0xc9 and 0xd1), therefore that is a nice testing point.
2175 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2176 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2177 ij) up='[A-Z]'
2178 low='[a-z]'
2179 ;;
2180 esac
2181 fi
2182 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2183 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2184 ij) up='A-Z'
2185 low='a-z'
2186 ;;
2187 esac
2188 fi
2189 if test "X$up" = X -o "X$low" = X; then
2190 case "`echo IJ | od -x 2>/dev/null`" in
2191 *C9D1*|*c9d1*)
2192 echo "Hey, this might be EBCDIC." >&4
2193 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2194 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2195 ij) up='[A-IJ-RS-Z]'
2196 low='[a-ij-rs-z]'
2197 ;;
2198 esac
2199 fi
2200 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2201 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2202 ij) up='A-IJ-RS-Z'
2203 low='a-ij-rs-z'
2204 ;;
2205 esac
2206 fi
2207 ;;
2208 esac
2209 fi
2210esac
3eaeeeae 2211case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2212ij)
2213 echo "Using $up and $low to convert case." >&4
2214 ;;
ecfc5424 2215*)
28e8609d
JH
2216 echo "I don't know how to translate letters from upper to lower case." >&4
2217 echo "Your tr is not acting any way I know of." >&4
2218 exit 1
2219 ;;
ecfc5424
AD
2220esac
2221: set up the translation script tr, must be called with ./tr of course
2222cat >tr <<EOSC
2223$startsh
2224case "\$1\$2" in
2225'[A-Z][a-z]') exec $tr '$up' '$low';;
2226'[a-z][A-Z]') exec $tr '$low' '$up';;
2227esac
2228exec $tr "\$@"
2229EOSC
2230chmod +x tr
2231$eunicefix tr
2232
2304df62
AD
2233: Try to determine whether config.sh was made on this system
2234case "$config_sh" in
2235'')
43999f95
JH
2236myuname=`$uname -a 2>/dev/null`
2237$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2238# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2239# because the A-Z/a-z are not consecutive.
a0d0e21e 2240myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2241 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2242newmyuname="$myuname"
2304df62 2243dflt=n
16d20bd9
AD
2244case "$knowitall" in
2245'')
2246 if test -f ../config.sh; then
2247 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2248 eval "`grep myuname= ../config.sh`"
2249 fi
2250 if test "X$myuname" = "X$newmyuname"; then
2251 dflt=y
2252 fi
2304df62 2253 fi
16d20bd9
AD
2254 ;;
2255*) dflt=y;;
2256esac
2304df62
AD
2257
2258: Get old answers from old config file if Configure was run on the
2259: same system, otherwise use the hints.
2260hint=default
2261cd ..
2262if test -f config.sh; then
16d20bd9
AD
2263 echo " "
2264 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2265 . UU/myread
2266 case "$ans" in
f83701cd
AD
2267 n*|N*) echo "OK, I'll ignore it."
2268 mv config.sh config.sh.old
2269 myuname="$newmyuname"
2270 ;;
2304df62 2271 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2272 tmp_n="$n"
2273 tmp_c="$c"
85cad39c 2274 tmp_sh="$sh"
2304df62
AD
2275 . ./config.sh
2276 cp config.sh UU
ecfc5424
AD
2277 n="$tmp_n"
2278 c="$tmp_c"
85cad39c 2279 : Older versions did not always set $sh. Catch re-use of such
2280 : an old config.sh.
2281 case "$sh" in
2282 '') sh="$tmp_sh" ;;
2283 esac
2304df62
AD
2284 hint=previous
2285 ;;
2286 esac
2287fi
2573c5f9 2288. ./UU/checkcc
2304df62
AD
2289if test ! -f config.sh; then
2290 $cat <<EOM
2291
4e2a5f63
AD
2292First time through, eh? I have some defaults handy for some systems
2293that need some extra help getting the Configure answers right:
2304df62
AD
2294
2295EOM
dfe9444c 2296 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2297 dflt=''
2298 : Half the following guesses are probably wrong... If you have better
7f2de2d2 2299 : tests or hints, please send them to perlbug@perl.org
2304df62 2300 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2301 $test -f /irix && osname=irix
85e6fe83
LW
2302 $test -f /xenix && osname=sco_xenix
2303 $test -f /dynix && osname=dynix
2304 $test -f /dnix && osname=dnix
5f05dabc 2305 $test -f /lynx.os && osname=lynxos
2306 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2307 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2308 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2309 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2310 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2311 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2312 $test -d /usr/apollo/bin && osname=apollo
2313 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2314 $test -d /usr/include/minix && osname=minix
e060872b 2315 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2316 osname=machten
4633a7c4 2317 if $test -x /sbin/version; then
dfe9444c 2318 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2319 $sed -e 's/[A-Za-z]$//'`
2320 elif $test -x /usr/etc/version; then
dfe9444c 2321 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2322 $sed -e 's/[A-Za-z]$//'`
2323 else
2324 osvers="$2.$3"
2325 fi
2326 fi
aaacdc8b
GS
2327
2328 $test -f /sys/posix.dll &&
2329 $test -f /usr/bin/what &&
2330 set X `/usr/bin/what /sys/posix.dll` &&
2331 $test "$3" = UWIN &&
2332 osname=uwin &&
2333 osvers="$5"
2334
2304df62
AD
2335 if $test -f $uname; then
2336 set X $myuname
2337 shift
2338
2304df62 2339 case "$5" in
85e6fe83 2340 fps*) osname=fps ;;
2304df62
AD
2341 mips*)
2342 case "$4" in
85e6fe83
LW
2343 umips) osname=umips ;;
2344 *) osname=mips ;;
2304df62 2345 esac;;
85e6fe83
LW
2346 [23]100) osname=mips ;;
2347 next*) osname=next ;;
ecfc5424 2348 i386*)
c6912327
JH
2349 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2350 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2351 osname='sco'
2352 osvers=$tmp
2353 elif $test -f /etc/kconfig; then
ecfc5424 2354 osname=isc
bd628c73 2355 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2356 osvers=4
2357 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2358 osvers=3
2304df62 2359 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2360 osvers=2
ecfc5424
AD
2361 fi
2362 fi
2000072c 2363 tmp=''
ecfc5424 2364 ;;
c4f23d77
AD
2365 pc*)
2366 if test -n "$DJGPP"; then
2367 osname=dos
2368 osvers=djgpp
2369 fi
2370 ;;
2304df62
AD
2371 esac
2372
2373 case "$1" in
a0d0e21e
LW
2374 aix) osname=aix
2375 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2376 case "$tmp" in
1aef975c 2377 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2378 '<3240'|'<>3240') osvers=3.2.0 ;;
2379 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2380 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2381 *) osvers=$tmp;;
a0d0e21e
LW
2382 esac
2383 ;;
aaacdc8b
GS
2384 bsd386) osname=bsd386
2385 osvers=`$uname -r`
2386 ;;
2387 cygwin*) osname=cygwin
2388 osvers="$3"
2389 ;;
23f87696
SZ
2390 *dc.osx) osname=dcosx
2391 osvers="$3"
2392 ;;
a0d0e21e
LW
2393 dnix) osname=dnix
2394 osvers="$3"
2395 ;;
2396 domainos) osname=apollo
2397 osvers="$3"
2398 ;;
2399 dgux) osname=dgux
2400 osvers="$3"
2401 ;;
760ac839 2402 dynixptx*) osname=dynixptx
e58e581d 2403 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2404 ;;
a0d0e21e
LW
2405 freebsd) osname=freebsd
2406 osvers="$3" ;;
2407 genix) osname=genix ;;
2408 hp*) osname=hpux
bfb7748a 2409 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2410 ;;
a78b0d02 2411 irix*) osname=irix
a0d0e21e
LW
2412 case "$3" in
2413 4*) osvers=4 ;;
2414 5*) osvers=5 ;;
ecfc5424 2415 *) osvers="$3" ;;
a0d0e21e
LW
2416 esac
2417 ;;
2418 linux) osname=linux
2419 case "$3" in
a0d0e21e
LW
2420 *) osvers="$3" ;;
2421 esac
2422 ;;
28e8609d
JH
2423 MiNT) osname=mint
2424 ;;
2425 netbsd*) osname=netbsd
ecfc5424
AD
2426 osvers="$3"
2427 ;;
4e81affe
MM
2428 news-os) osvers="$3"
2429 case "$3" in
2430 4*) osname=newsos4 ;;
2431 *) osname=newsos ;;
2432 esac
2433 ;;
aaacdc8b 2434 next*) osname=next ;;
28bb1e2c 2435 nonstop-ux) osname=nonstopux ;;
aaacdc8b
GS
2436 POSIX-BC | posix-bc ) osname=posix-bc
2437 osvers="$3"
a0d0e21e 2438 ;;
ae3afa4e
TH
2439 powerux | power_ux | powermax_os | powermaxos | \
2440 powerunix | power_unix) osname=powerux
2441 osvers="$3"
2442 ;;
aaacdc8b
GS
2443 qnx) osname=qnx
2444 osvers="$4"
2445 ;;
a0d0e21e
LW
2446 solaris) osname=solaris
2447 case "$3" in
2448 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2449 *) osvers="$3" ;;
a0d0e21e
LW
2450 esac
2451 ;;
85e6fe83
LW
2452 sunos) osname=sunos
2453 case "$3" in
85e6fe83
LW
2454 5*) osname=solaris
2455 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2456 *) osvers="$3" ;;
2304df62
AD
2457 esac
2458 ;;
a0d0e21e 2459 titanos) osname=titanos
85e6fe83 2460 case "$3" in
a0d0e21e
LW
2461 1*) osvers=1 ;;
2462 2*) osvers=2 ;;
2463 3*) osvers=3 ;;
2464 4*) osvers=4 ;;
ecfc5424 2465 *) osvers="$3" ;;
2304df62
AD
2466 esac
2467 ;;
85e6fe83 2468 ultrix) osname=ultrix
ecfc5424 2469 osvers="$3"
2304df62 2470 ;;
28757baa 2471 osf1|mls+) case "$5" in
fed7345c
AD
2472 alpha)
2473 osname=dec_osf
2aa76180
JH
2474 osvers=`sizer -v | awk '{print $3}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2475 case "$osvers" in
2476 [1-9].[0-9]*) ;;
2477 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2478 esac
ecfc5424
AD
2479 ;;
2480 hp*) osname=hp_osf1 ;;
2481 mips) osname=mips_osf1 ;;
85e6fe83
LW
2482 esac
2483 ;;
0337d152
BG
2484 unixware) osname=svr5
2485 osvers="$4"
2486 ;;
2487 uts) osname=uts
a0d0e21e
LW
2488 osvers="$3"
2489 ;;
85e6fe83 2490 $2) case "$osname" in
2304df62 2491 *isc*) ;;
a0d0e21e 2492 *freebsd*) ;;
5f05dabc 2493 svr*)
a0d0e21e
LW
2494 : svr4.x or possibly later
2495 case "svr$3" in
2496 ${osname}*)
2497 osname=svr$3
2498 osvers=$4
2499 ;;
2500 esac
2501 case "$osname" in
2502 svr4.0)
2503 : Check for ESIX
2504 if test -f /stand/boot ; then
2505 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2506 if test -n "$INITPROG" -a -f "$INITPROG"; then
2507 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2508 if test -n "$isesix"; then
a0d0e21e
LW
2509 osname=esix4
2510 fi
2511 fi
2512 fi
2513 ;;
2514 esac
2515 ;;
2304df62 2516 *) if test -f /etc/systemid; then
a0d0e21e
LW
2517 osname=sco
2518 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2519 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2520 osvers=$1.$2.$3
c4f23d77 2521 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2522 osvers=$1.$2
c4f23d77 2523 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2524 osvers=$1
2304df62 2525 fi
a0d0e21e
LW
2526 else
2527 case "$osname" in
2528 '') : Still unknown. Probably a generic Sys V.
2529 osname="sysv"
2530 osvers="$3"
2531 ;;
2532 esac
2304df62
AD
2533 fi
2534 ;;
2535 esac
2536 ;;
a0d0e21e
LW
2537 *) case "$osname" in
2538 '') : Still unknown. Probably a generic BSD.
2539 osname="$1"
2540 osvers="$3"
2541 ;;
2542 esac
2543 ;;
2304df62
AD
2544 esac
2545 else
dfe9444c
AD
2546 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2547 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2548 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2549 osname=news_os
2304df62 2550 fi
dfe9444c 2551 $rm -f UU/kernel.what
8e07c86e
AD
2552 elif test -d c:/.; then
2553 set X $myuname
2554 osname=os2
2555 osvers="$5"
2304df62
AD
2556 fi
2557 fi
85e6fe83 2558
a0d0e21e
LW
2559 : Now look for a hint file osname_osvers, unless one has been
2560 : specified already.
2561 case "$hintfile" in
2562 ''|' ')
1e127011 2563 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 2564 : Also try without trailing minor version numbers.
1e127011
DD
2565 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2566 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2567 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2568 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
2569 case "$file" in
2570 '') dflt=none ;;
2571 *) case "$osvers" in
2572 '') dflt=$file
2573 ;;
dfe9444c 2574 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 2575 dflt=$file
dfe9444c 2576 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 2577 dflt=$xfile
dfe9444c 2578 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 2579 dflt=$xxfile
dfe9444c 2580 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 2581 dflt=$xxxfile
dfe9444c 2582 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 2583 dflt=$xxxxfile
dfe9444c 2584 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
2585 dflt="${osname}"
2586 else
2587 dflt=none
2588 fi
2589 ;;
2590 esac
85e6fe83
LW
2591 ;;
2592 esac
4e2a5f63
AD
2593 if $test -f Policy.sh ; then
2594 case "$dflt" in
2595 *Policy*) ;;
2596 none) dflt="Policy" ;;
2597 *) dflt="Policy $dflt" ;;
2598 esac
2599 fi
85e6fe83 2600 ;;
a0d0e21e 2601 *)
ecfc5424 2602 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 2603 ;;
2304df62 2604 esac
1aef975c 2605
4e2a5f63
AD
2606 if $test -f Policy.sh ; then
2607 $cat <<EOM
2608
2609There's also a Policy hint file available, which should make the
2610site-specific (policy) questions easier to answer.
2611EOM
2612
2613 fi
2614
2304df62
AD
2615 $cat <<EOM
2616
2617You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 2618A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 2619is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
2620
2621EOM
4e2a5f63 2622
2304df62 2623 rp="Which of these apply, if any?"
dfe9444c 2624 . UU/myread
85e6fe83
LW
2625 tans=$ans
2626 for file in $tans; do
4e2a5f63
AD
2627 if $test X$file = XPolicy -a -f Policy.sh; then
2628 . Policy.sh
2629 $cat Policy.sh >> UU/config.sh
2630 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
2631 . $src/hints/$file.sh
2632 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83 2633 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
2634 : nothing
2635 else
85e6fe83
LW
2636 : Give one chance to correct a possible typo.
2637 echo "$file.sh does not exist"
2638 dflt=$file
2639 rp="hint to use instead?"
dfe9444c 2640 . UU/myread
85e6fe83 2641 for file in $ans; do
dfe9444c
AD
2642 if $test -f "$src/hints/$file.sh"; then
2643 . $src/hints/$file.sh
2644 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
2645 elif $test X$ans = X -o X$ans = Xnone ; then
2646 : nothing
2647 else
2648 echo "$file.sh does not exist -- ignored."
2649 fi
2650 done
2304df62
AD
2651 fi
2652 done
85e6fe83 2653
2304df62 2654 hint=recommended
85e6fe83 2655 : Remember our hint file for later.
dfe9444c 2656 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 2657 hintfile="$file"
85e6fe83 2658 else
a0d0e21e 2659 hintfile=''
85e6fe83 2660 fi
2304df62
AD
2661fi
2662cd UU
2663;;
2664*)
2665 echo " "
2666 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
2667 tmp_n="$n"
2668 tmp_c="$c"
2304df62
AD
2669 cd ..
2670 cp $config_sh config.sh 2>/dev/null
a78b0d02 2671 chmod +w config.sh
2304df62
AD
2672 . ./config.sh
2673 cd UU
2674 cp ../config.sh .
ecfc5424
AD
2675 n="$tmp_n"
2676 c="$tmp_c"
2304df62
AD
2677 hint=previous
2678 ;;
2679esac
1aef975c 2680test "$override" && . ./optdef.sh
2304df62
AD
2681
2682: Restore computed paths
2683for file in $loclist $trylist; do
2684 eval $file="\$_$file"
2685done
2686
85e6fe83 2687cat << EOM
a0d0e21e 2688
85e6fe83 2689Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
2690The default value is probably right if the name rings a bell. Otherwise,
2691since spelling matters for me, either accept the default or answer "none"
2692to leave it blank.
a0d0e21e 2693
85e6fe83 2694EOM
85e6fe83 2695case "$osname" in
a0d0e21e 2696 ''|' ')
85e6fe83 2697 case "$hintfile" in
a0d0e21e 2698 ''|' '|none) dflt=none ;;
ecfc5424 2699 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
2700 esac
2701 ;;
2702 *) dflt="$osname" ;;
2703esac
2704rp="Operating system name?"
2705. ./myread
2706case "$ans" in
ecfc5424
AD
2707none) osname='' ;;
2708*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 2709esac
8ff267be 2710echo " "
2711case "$osvers" in
2712 ''|' ')
2713 case "$hintfile" in
2714 ''|' '|none) dflt=none ;;
2715 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2716 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2717 case "$dflt" in
2718 ''|' ') dflt=none ;;
2719 esac
2720 ;;
2721 esac
2722 ;;
2723 *) dflt="$osvers" ;;
2724esac
2725rp="Operating system version?"
2726. ./myread
2727case "$ans" in
2728none) osvers='' ;;
2729*) osvers="$ans" ;;
2730esac
2731
02e93a22
JH
2732
2733. ./posthint.sh
2734
2304df62 2735: who configured the system
59b83a6f 2736cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 2737cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
2738case "$cf_by" in
2739"")
8ff267be 2740 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
2741 case "$cf_by" in
2742 "") cf_by=unknown ;;
8ff267be 2743 esac ;;
2744esac
2304df62 2745
b4eb6b3d
JH
2746: set up the script used to warn in case of inconsistency
2747cat <<EOS >whoa
2748$startsh
2749EOS
2750cat <<'EOSC' >>whoa
2751dflt=y
2752echo " "
2753echo "*** WHOA THERE!!! ***" >&4
2754echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2755rp=" Keep the $hint value?"
2756. ./myread
2757case "$ans" in
2758y) td=$was; tu=$was;;
2759esac
2760EOSC
2761
2762: function used to set $1 to $val
2763setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2764case "$val$was" in
2765$define$undef) . ./whoa; eval "$var=\$td";;
2766$undef$define) . ./whoa; eval "$var=\$tu";;
2767*) eval "$var=$val";;
2768esac'
2769
2770case "$usethreads" in
2771$define|true|[yY]*) dflt='y';;
2772*) dflt='n';;
2773esac
2774cat <<EOM
2775
2776Perl can be built to take advantage of threads on some systems.
2777To do so, Configure can be run with -Dusethreads.
2778
2779Note that threading is a highly experimental feature, and
2780some known race conditions still remain. If you choose to try
2781it, be very sure to not actually deploy it for production
2782purposes. README.threads has more details, and is required
2783reading if you enable threads.
2784
2785If this doesn't make any sense to you, just accept the default '$dflt'.
2786EOM
2787rp='Build a threading Perl?'
2788. ./myread
2789case "$ans" in
2790y|Y) val="$define" ;;
2791*) val="$undef" ;;
2792esac
2793set usethreads
2794eval $setvar
2795
2796case "$usethreads" in
2797$define)
2798 $cat <<EOM
2799
2800As of 5.5.640, Perl has two different internal threading implementations,
2801the 5.005 version (5005threads) and an interpreter-based version
2802(ithreads) that has one interpreter per thread. Both are very
2803experimental. This arrangement exists to help developers work out
2804which one is better.
2805
2806If you're a casual user, you probably don't want interpreter-threads
2807at this time. There doesn't yet exist a way to create threads from
2808within Perl in this model, i.e., "use Thread;" will NOT work.
2809EOM
2810 : Default to ithreads unless overridden on command line or with
2811 : old config.sh
2812 dflt='y'
2813 case "$use5005threads" in
2814 $define|true|[yY]*) dflt='n';;
2815 esac
2816 case "$useithreads" in
2817 $undef|false|[nN]*) dflt='n';;
2818 esac
2819 rp='Use interpreter-based ithreads?'
2820 . ./myread
2821 case "$ans" in
2822 y|Y) val="$define" ;;
2823 *) val="$undef" ;;
2824 esac
2825 set useithreads
2826 eval $setvar
2827 : Now set use5005threads to the opposite value.
2828 case "$useithreads" in
2829 $define) val="$undef" ;;
2830 *) val="$define" ;;
2831 esac
2832 set use5005threads
2833 eval $setvar
2834 ;;
2835*)
2836 useithreads="$undef"
2837 use5005threads="$undef"
2838 ;;
2839esac
2840
2841case "$d_oldpthreads" in
2842'') : Configure tests would be welcome here. For now, assume undef.
2843 val="$undef" ;;
2844*) val="$d_oldpthreads" ;;
2845esac
2846set d_oldpthreads
2847eval $setvar
2848
2849
2850case "$usethreads" in
2851"$define"|true|[yY]*)
2852: Look for a hint-file generated 'call-back-unit'. If the
2853: user has specified that a threading perl is to be built,
2854: we may need to set or change some other defaults.
2855 if $test -f usethreads.cbu; then
2856 echo "Your platform has some specific hints for threaded builds, using them..."
2857 . ./usethreads.cbu
2858 else
2859 $cat <<EOM
2860(Your platform doesn't have any specific hints for threaded builds.
2861 Assuming POSIX threads, then.)
2862EOM
2863 fi
2864 ;;
2865esac
2866
2867cat <<EOM
2868
2869Perl can be built so that multiple Perl interpreters can coexist
2870within the same Perl executable.
2871EOM
2872
2873case "$useithreads" in
2874$define)
2875 cat <<EOM
2876This multiple interpreter support is required for interpreter-based threads.
2877EOM
2878 val="$define"
2879 ;;
2880*) case "$usemultiplicity" in
2881 $define|true|[yY]*) dflt='y';;
2882 *) dflt='n';;
2883 esac
2884 echo " "
2885 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2886 rp='Build Perl for multiplicity?'
2887 . ./myread
2888 case "$ans" in
2889 y|Y) val="$define" ;;
2890 *) val="$undef" ;;
2891 esac
2892 ;;
2893esac
2894set usemultiplicity
2895eval $setvar
2896
e5e20432
JH
2897: make some quick guesses about what we are up against
2898echo " "
2899$echo $n "Hmm... $c"
2900echo exit 1 >bsd
2901echo exit 1 >usg
2902echo exit 1 >v7
2903echo exit 1 >osf1
2904echo exit 1 >eunice
2905echo exit 1 >xenix
2906echo exit 1 >venix
2907echo exit 1 >os2
2908d_bsd="$undef"
2909$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2910if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2911then
2912 echo "Looks kind of like an OSF/1 system, but we'll see..."
2913 echo exit 0 >osf1
381aa1ff 2914elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
2915 xxx=`./loc addbib blurfl $pth`
2916 if $test -f $xxx; then
2917 echo "Looks kind of like a USG system with BSD features, but we'll see..."
2918 echo exit 0 >bsd
2919 echo exit 0 >usg
2920 else
2921 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2922 echo "Looks kind of like an extended USG system, but we'll see..."
2923 else
2924 echo "Looks kind of like a USG system, but we'll see..."
2925 fi
2926 echo exit 0 >usg
2927 fi
2928elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2929 echo "Looks kind of like a BSD system, but we'll see..."
2930 d_bsd="$define"
2931 echo exit 0 >bsd
2932else
2933 echo "Looks kind of like a Version 7 system, but we'll see..."
2934 echo exit 0 >v7
2935fi
2936case "$eunicefix" in
2937*unixtovms*)
2938 $cat <<'EOI'
2939There is, however, a strange, musty smell in the air that reminds me of
2940something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2941EOI
2942 echo exit 0 >eunice
2943 d_eunice="$define"
2944: it so happens the Eunice I know will not run shell scripts in Unix format
2945 ;;
2946*)
2947 echo " "
2948 echo "Congratulations. You aren't running Eunice."
2949 d_eunice="$undef"
2950 ;;
2951esac
2952: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
2953: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
2954: semicolon as a patch separator
e5e20432
JH
2955case "$p_" in
2956:) ;;
2957*)
2958 $cat <<'EOI'
2959I have the feeling something is not exactly right, however...don't tell me...
2960lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 2961(Or you may be running DOS with DJGPP.)
e5e20432
JH
2962EOI
2963 echo exit 0 >os2
2964 ;;
2965esac
2966if test -f /xenix; then
2967 echo "Actually, this looks more like a XENIX system..."
2968 echo exit 0 >xenix
2969 d_xenix="$define"
2970else
2971 echo " "
2972 echo "It's not Xenix..."
2973 d_xenix="$undef"
2974fi
2975chmod +x xenix
2976$eunicefix xenix
2977if test -f /venix; then
2978 echo "Actually, this looks more like a VENIX system..."
2979 echo exit 0 >venix
2980else
2981 echo " "
2982 if ./xenix; then
2983 : null
2984 else
2985 echo "Nor is it Venix..."
2986 fi
2987fi
2988chmod +x bsd usg v7 osf1 eunice xenix venix os2
2989$eunicefix bsd usg v7 osf1 eunice xenix venix os2
2990$rm -f foo
2991
5869b1f1
JH
2992case "$cc" in
2993'') dflt=cc;;
2994*) dflt="$cc";;
2995esac
2996rp="Use which C compiler?"
2997. ./myread
2998cc="$ans"
e5e20432
JH
2999: Look for a hint-file generated 'call-back-unit'. Now that the
3000: user has specified the compiler, we may need to set or change some
3001: other defaults.
3002if $test -f cc.cbu; then
3003 . ./cc.cbu
3004fi
2573c5f9 3005. ./checkcc
8a27cf78 3006
e5e20432
JH
3007echo " "
3008echo "Checking for GNU cc in disguise and/or its version number..." >&4
3009$cat >gccvers.c <<EOM
3010#include <stdio.h>
3011int main() {
3012#ifdef __GNUC__
3013#ifdef __VERSION__
3014 printf("%s\n", __VERSION__);
3015#else
3016 printf("%s\n", "1");
3017#endif
3018#endif
3019 exit(0);
3020}
3021EOM
7a282f6d 3022if $cc -o gccvers $ldflags gccvers.c; then
e5e20432
JH
3023 gccversion=`./gccvers`
3024 case "$gccversion" in
3025 '') echo "You are not using GNU cc." ;;
fc68435e 3026 *) echo "You are using GNU cc $gccversion."
e723fc21 3027 ccname=gcc
fc68435e 3028 ;;
e5e20432
JH
3029 esac
3030else
3031 echo " "
3032 echo "*** WHOA THERE!!! ***" >&4
3033 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3034 case "$knowitall" in
3035 '')
3036 echo " You'd better start hunting for one and let me know about it." >&4
3037 exit 1
3038 ;;
3039 esac
3040fi
3041$rm -f gccvers*
3042case "$gccversion" in
30431*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3044esac
5b463ca7
KS
3045case "$gccversion" in
3046'') gccosandvers='' ;;
10b4ebb5
JH
3047*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3048 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3049 gccshortvers=''
5b463ca7 3050 case "$gccosandvers" in
02903077
JH
3051 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3052 $osname$osvers) ;; # looking good
5b463ca7
KS
3053 $osname*) cat <<EOM >&4
3054
3055*** WHOA THERE!!! ***
3056
3057 Your gcc has not been compiled for the exact release of
3058 your operating system ($gccosandvers versus $osname$osvers).
3059
3060 In general it is a good idea to keep gcc synchronized with
3061 the operating system because otherwise serious problems
3062 may ensue when trying to compile software, like Perl.
3063
3064 I'm trying to be optimistic here, though, and will continue.
3065 If later during the configuration and build icky compilation
02903077
JH
3066 problems appear (headerfile conflicts being the most common
3067 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3068 your operating system release.
3069
3070EOM
3071 ;;
81575342 3072 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3073 esac
3074 ;;
3075esac
e723fc21
JH
3076case "$ccname" in
3077'') ccname="$cc" ;;
3078esac
e5e20432 3079
8a27cf78
JH
3080: see how we invoke the C preprocessor
3081echo " "
3082echo "Now, how can we feed standard input to your C preprocessor..." >&4
3083cat <<'EOT' >testcpp.c
3084#define ABC abc
3085#define XYZ xyz
3086ABC.XYZ
3087EOT
3088cd ..
3089if test ! -f cppstdin; then
3090 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3091 # AIX cc -E doesn't show the absolute headerfile
3092 # locations but we'll cheat by using the -M flag.
3093 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
3094 else
3095 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3096 fi
3097else
3098 echo "Keeping your $hint cppstdin wrapper."
3099fi
3100chmod 755 cppstdin
3101wrapper=`pwd`/cppstdin
3102ok='false'
3103cd UU
3104
3105if $test "X$cppstdin" != "X" && \
3106 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3107 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3108then
3109 echo "You used to use $cppstdin $cppminus so we'll use that again."
3110 case "$cpprun" in
3111 '') echo "But let's see if we can live without a wrapper..." ;;
3112 *)
3113 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3114 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3115 then
3116 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3117 ok='true'
3118 else
3119 echo "(However, $cpprun $cpplast does not work, let's see...)"
3120 fi
3121 ;;
3122 esac
3123else
3124 case "$cppstdin" in
3125 '') ;;
3126 *)
3127 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3128 ;;
3129 esac
3130fi
3131
3132if $ok; then
3133 : nothing
3134elif echo 'Maybe "'"$cc"' -E" will work...'; \
3135 $cc -E <testcpp.c >testcpp.out 2>&1; \
3136 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3137 echo "Yup, it does."
3138 x_cpp="$cc -E"
3139 x_minus='';
3140elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3141 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3142 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3143 echo "Yup, it does."
3144 x_cpp="$cc -E"
3145 x_minus='-';
3146elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3147 $cc -P <testcpp.c >testcpp.out 2>&1; \
3148 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3149 echo "Yipee, that works!"
3150 x_cpp="$cc -P"
3151 x_minus='';
3152elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3153 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3154 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3155 echo "At long last!"
3156 x_cpp="$cc -P"
3157 x_minus='-';
3158elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3159 $cpp <testcpp.c >testcpp.out 2>&1; \
3160 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3161 echo "It works!"
3162 x_cpp="$cpp"
3163 x_minus='';
3164elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3165 $cpp - <testcpp.c >testcpp.out 2>&1; \
3166 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3167 echo "Hooray, it works! I was beginning to wonder."
3168 x_cpp="$cpp"
3169 x_minus='-';
3170elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3171 $wrapper <testcpp.c >testcpp.out 2>&1; \
3172 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3173 x_cpp="$wrapper"
3174 x_minus=''
3175 echo "Eureka!"
3176else
3177 dflt=''
3178 rp="No dice. I can't find a C preprocessor. Name one:"
3179 . ./myread
3180 x_cpp="$ans"
3181 x_minus=''
3182 $x_cpp <testcpp.c >testcpp.out 2>&1
3183 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3184 echo "OK, that will do." >&4
3185 else
3186echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3187 exit 1
3188 fi
3189fi
3190
3191case "$ok" in
3192false)
3193 cppstdin="$x_cpp"
3194 cppminus="$x_minus"
3195 cpprun="$x_cpp"
3196 cpplast="$x_minus"
3197 set X $x_cpp
3198 shift
3199 case "$1" in
3200 "$cpp")
3201 echo "Perhaps can we force $cc -E using a wrapper..."
3202 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3203 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3204 then
3205 echo "Yup, we can."
3206 cppstdin="$wrapper"
3207 cppminus='';
3208 else
3209 echo "Nope, we'll have to live without it..."
3210 fi
3211 ;;
3212 esac
3213 case "$cpprun" in
3214 "$wrapper")
3215 cpprun=''
3216 cpplast=''
3217 ;;
3218 esac
3219 ;;
3220esac
3221
3222case "$cppstdin" in
3223"$wrapper"|'cppstdin') ;;
3224*) $rm -f $wrapper;;
3225esac
3226$rm -f testcpp.c testcpp.out
3227
bd9b35c9
JH
3228: decide how portable to be. Allow command line overrides.
3229case "$d_portable" in
3230"$undef") ;;
3231*) d_portable="$define" ;;
104d25b7 3232esac
85ab1d1d 3233
bd9b35c9
JH
3234: set up shell script to do ~ expansion
3235cat >filexp <<EOSS
3236$startsh
3237: expand filename
3238case "\$1" in
3239 ~/*|~)
3240 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3241 ;;
3242 ~*)
3243 if $test -f /bin/csh; then
3244 /bin/csh -f -c "glob \$1"
3245 failed=\$?
3246 echo ""
3247 exit \$failed
e5e20432 3248 else
bd9b35c9
JH
3249 name=\`$expr x\$1 : '..\([^/]*\)'\`
3250 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3251 if $test ! -d "\$dir"; then
3252 me=\`basename \$0\`
3253 echo "\$me: can't locate home directory for: \$name" >&2
3254 exit 1
3255 fi
3256 case "\$1" in
3257 */*)
3258 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3259 ;;
3260 *)
3261 echo \$dir
e5e20432
JH
3262 ;;
3263 esac
3264 fi
b691c02f 3265 ;;
4633a7c4 3266*)
bd9b35c9 3267 echo \$1
2304df62
AD
3268 ;;
3269esac
4633a7c4
LW
3270EOSS
3271chmod +x filexp
3272$eunicefix filexp
2304df62
AD
3273
3274: now set up to get a file name
28757baa 3275cat <<EOS >getfile
3276$startsh
3277EOS
3278cat <<'EOSC' >>getfile
2304df62
AD
3279tilde=''
3280fullpath=''
3281already=''
3282skip=''
3283none_ok=''
3284exp_file=''
a0d0e21e 3285nopath_ok=''
2304df62
AD
3286orig_rp="$rp"
3287orig_dflt="$dflt"
b233458b
JH
3288case "$gfpth" in
3289'') gfpth='.' ;;
3290esac
2304df62
AD
3291
3292case "$fn" in
ecfc5424 3293*\(*)
381aa1ff 3294 expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
3295 fn=`echo $fn | sed 's/(.*)//'`
3296 ;;
3297esac
3298
3299case "$fn" in
a0d0e21e
LW
3300*:*)
3301 loc_file=`expr $fn : '.*:\(.*\)'`
3302 fn=`expr $fn : '\(.*\):.*'`
3303 ;;
3304esac
3305
3306case "$fn" in
2304df62
AD
3307*~*) tilde=true;;
3308esac
3309case "$fn" in
3310*/*) fullpath=true;;
3311esac
3312case "$fn" in
3313*+*) skip=true;;
3314esac
3315case "$fn" in
3316*n*) none_ok=true;;
3317esac
3318case "$fn" in
3319*e*) exp_file=true;;
3320esac
a0d0e21e
LW
3321case "$fn" in
3322*p*) nopath_ok=true;;
3323esac
2304df62
AD
3324
3325case "$fn" in
3326*f*) type='File';;
3327*d*) type='Directory';;
a0d0e21e 3328*l*) type='Locate';;
2304df62
AD
3329esac
3330
3331what="$type"
3332case "$what" in
3333Locate) what='File';;
3334esac
3335
3336case "$exp_file" in
3337'')
3338 case "$d_portable" in
3339 "$define") ;;
3340 *) exp_file=true;;
3341 esac
3342 ;;
3343esac
3344
3345cd ..
3346while test "$type"; do
3347 redo=''
3348 rp="$orig_rp"
3349 dflt="$orig_dflt"
3350 case "$tilde" in
3351 true) rp="$rp (~name ok)";;
3352 esac
3353 . UU/myread
ecfc5424
AD
3354 if test -f UU/getfile.ok && \
3355 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3356 then
3357 value="$ans"
3358 ansexp="$ans"
3359 break
3360 fi
2304df62
AD
3361 case "$ans" in
3362 none)
3363 value=''
3364 ansexp=''
3365 case "$none_ok" in
3366 true) type='';;
3367 esac
3368 ;;
3369 *)
3370 case "$tilde" in
3371 '') value="$ans"
3372 ansexp="$ans";;
3373 *)
3374 value=`UU/filexp $ans`
3375 case $? in
3376 0)
3377 if test "$ans" != "$value"; then
ecfc5424 3378 echo "(That expands to $value on this system.)"
2304df62
AD
3379 fi
3380 ;;
3381 *) value="$ans";;
3382 esac
3383 ansexp="$value"
3384 case "$exp_file" in
3385 '') value="$ans";;
3386 esac
3387 ;;
3388 esac
3389 case "$fullpath" in
3390 true)
3391 case "$ansexp" in
3392 /*) value="$ansexp" ;;
23da6c43 3393 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
3394 *)
3395 redo=true
3396 case "$already" in
3397 true)
3398 echo "I shall only accept a full path name, as in /bin/ls." >&4
3399 echo "Use a ! shell escape if you wish to check pathnames." >&4
3400 ;;
3401 *)
3402 echo "Please give a full path name, starting with slash." >&4
3403 case "$tilde" in
3404 true)
3405 echo "Note that using ~name is ok provided it expands well." >&4
3406 already=true
3407 ;;
3408 esac
3409 esac
3410 ;;
3411 esac
3412 ;;
3413 esac
3414 case "$redo" in
3415 '')
3416 case "$type" in
3417 File)
b233458b
JH
3418 for fp in $gfpth; do
3419 if test "X$fp" = X.; then
3420 pf="$ansexp"
3421 else
3422 pf="$fp/$ansexp"
3423 fi
3424 if test -f "$pf"; then
3425 type=''
3426 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3427 then
3428 echo "($value is not a plain file, but that's ok.)"
3429 type=''
3430 fi
3431 if test X"$type" = X; then
3432 value="$pf"
3433 break
3434 fi
3435 done
2304df62
AD
3436 ;;
3437 Directory)
b233458b
JH
3438 for fp in $gfpth; do
3439 if test "X$fp" = X.; then
f78bfc9c
JH
3440 dir="$ans"
3441 direxp="$ansexp"
b233458b 3442 else
dd858076 3443 dir="$fp/$ansexp"
f78bfc9c 3444 direxp="$fp/$ansexp"
b233458b 3445 fi
f78bfc9c 3446 if test -d "$direxp"; then
b233458b 3447 type=''
f78bfc9c 3448 value="$dir"
b233458b
JH
3449 break
3450 fi
3451 done
2304df62
AD
3452 ;;
3453 Locate)
40000a8c 3454 if test -d "$ansexp"; then
a0d0e21e
LW
3455 echo "(Looking for $loc_file in directory $value.)"
3456 value="$value/$loc_file"
40000a8c 3457 ansexp="$ansexp/$loc_file"
2304df62 3458 fi
40000a8c 3459 if test -f "$ansexp"; then
2304df62
AD
3460 type=''
3461 fi
a0d0e21e
LW
3462 case "$nopath_ok" in
3463 true) case "$value" in
3464 */*) ;;
3465 *) echo "Assuming $value will be in people's path."
3466 type=''
3467 ;;
3468 esac
3469 ;;
3470 esac
2304df62
AD
3471 ;;
3472 esac
3473
3474 case "$skip" in
3475 true) type='';
3476 esac
3477
3478 case "$type" in
3479 '') ;;
3480 *)
3481 if test "$fastread" = yes; then
3482 dflt=y
3483 else
3484 dflt=n
3485 fi
3486 rp="$what $value doesn't exist. Use that name anyway?"
3487 . UU/myread
3488 dflt=''
3489 case "$ans" in
3490 y*) type='';;
3491 *) echo " ";;
3492 esac
3493 ;;
3494 esac
3495 ;;
3496 esac
3497 ;;
3498 esac
3499done
3500cd UU
3501ans="$value"
3502rp="$orig_rp"
3503dflt="$orig_dflt"
ecfc5424 3504rm -f getfile.ok
b233458b 3505test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3506EOSC
3507
bd9b35c9
JH
3508: What should the include directory be ?
3509echo " "
3510$echo $n "Hmm... $c"
3511dflt='/usr/include'
3512incpath=''
3513mips_type=''
3514if $test -f /bin/mips && /bin/mips; then
3515 echo "Looks like a MIPS system..."
3516 $cat >usr.c <<'EOCP'
3517#ifdef SYSTYPE_BSD43
3518/bsd43
3519#endif
3520EOCP
8a27cf78 3521 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
3522 dflt='/bsd43/usr/include'
3523 incpath='/bsd43'
3524 mips_type='BSD 4.3'
3525 else
3526 mips_type='System V'
3527 fi
3528 $rm -f usr.c usr.out
3529 echo "and you're compiling with the $mips_type compiler and libraries."
3530 xxx_prompt=y
3531 echo "exit 0" >mips
3532else
3533 echo "Doesn't look like a MIPS system."
3534 xxx_prompt=n
3535 echo "exit 1" >mips
3536fi
3537chmod +x mips
3538$eunicefix mips
3539case "$usrinc" in
3540'') ;;
3541*) dflt="$usrinc";;
3542esac
3543case "$xxx_prompt" in
3544y) fn=d/
3545 echo " "
3546 rp='Where are the include files you want to use?'
3547 . ./getfile
3548 usrinc="$ans"
8e07c86e 3549 ;;
bd9b35c9 3550*) usrinc="$dflt"
8e07c86e
AD
3551 ;;
3552esac
2304df62 3553
bd9b35c9
JH
3554: Set private lib path
3555case "$plibpth" in
3556'') if ./mips; then
3557 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3558 fi;;
3559esac
3560case "$libpth" in
3561' ') dlist='';;
3562'') dlist="$loclibpth $plibpth $glibpth";;
3563*) dlist="$libpth";;
3564esac
3565
3566: Now check and see which directories actually exist, avoiding duplicates
3567libpth=''
3568for xxx in $dlist
3569do
3570 if $test -d $xxx; then
3571 case " $libpth " in
3572 *" $xxx "*) ;;
3573 *) libpth="$libpth $xxx";;
3574 esac
3575 fi
3576done
3577$cat <<'EOM'
3578
3579Some systems have incompatible or broken versions of libraries. Among
3580the directories listed in the question below, please remove any you
3581know not to be holding relevant libraries, and add any that are needed.
3582Say "none" for none.
8e07c86e
AD
3583
3584EOM
bd9b35c9
JH
3585case "$libpth" in
3586'') dflt='none';;
8e07c86e 3587*)
bd9b35c9
JH
3588 set X $libpth
3589 shift
3590 dflt=${1+"$@"}
8e07c86e 3591 ;;
a0d0e21e 3592esac
bd9b35c9
JH
3593rp="Directories to use for library searches?"
3594. ./myread
3595case "$ans" in
3596none) libpth=' ';;
3597*) libpth="$ans";;
3598esac
a0d0e21e 3599
bd9b35c9
JH
3600: compute shared library extension
3601case "$so" in
3602'')
3603 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3604 dflt='sl'
dd4e71fd 3605 else
bd9b35c9 3606 dflt='so'
dd4e71fd
JH
3607 fi
3608 ;;
bd9b35c9 3609*) dflt="$so";;
dd4e71fd 3610esac
dd4e71fd
JH
3611$cat <<EOM
3612
bd9b35c9 3613On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 3614you want to suppress searching of shared libraries for the remainder
bd9b35c9 3615of this configuration.
dd4e71fd
JH
3616
3617EOM
bd9b35c9
JH
3618rp='What is the file extension used for shared libraries?'
3619. ./myread
3620so="$ans"
dd4e71fd 3621
bd9b35c9
JH
3622: Define several unixisms.
3623: Hints files or command line option can be used to override them.
3624: The convoluted testing is in case hints files set either the old
3625: or the new name.
3626case "$_exe" in
3627'') case "$exe_ext" in
3628 '') ;;
3629 *) _exe="$exe_ext" ;;
dd4e71fd 3630 esac
bd9b35c9 3631 ;;
bfb7748a 3632esac
bd9b35c9
JH
3633case "$_a" in
3634'') case "$lib_ext" in
3635 '') _a='.a';;
3636 *) _a="$lib_ext" ;;
dd4e71fd
JH
3637 esac
3638 ;;
dd4e71fd 3639esac
bd9b35c9
JH
3640case "$_o" in
3641'') case "$obj_ext" in
3642 '') _o='.o';;
3643 *) _o="$obj_ext";;
3644 esac
3645 ;;
3646esac
3647case "$p_" in
3648'') case "$path_sep" in
3649 '') p_=':';;
3650 *) p_="$path_sep";;
3651 esac
3652 ;;
3653esac
3654exe_ext=$_exe
3655lib_ext=$_a
3656obj_ext=$_o
3657path_sep=$p_
dd4e71fd 3658
b4eb6b3d
JH
3659: Which makefile gets called first. This is used by make depend.
3660case "$firstmakefile" in
3661'') firstmakefile='makefile';;
4633a7c4 3662esac
4633a7c4 3663
0f0995ae
JH
3664case "$usesocks" in
3665$define|true|[yY]*) dflt='y';;
3666*) dflt='n';;
3667esac
bd9b35c9 3668cat <<EOM
4633a7c4 3669
bd9b35c9
JH
3670Perl can be built to use the SOCKS proxy protocol library. To do so,
3671Configure must be run with -Dusesocks.
4633a7c4 3672
0f0995ae 3673If this doesn't make any sense to you, just accept the default '$dflt'.
bd9b35c9 3674EOM
bd9b35c9
JH
3675rp='Build Perl for SOCKS?'
3676. ./myread
3677case "$ans" in
3678y|Y) val="$define" ;;
3679*) val="$undef" ;;
3680esac
3681set usesocks
3682eval $setvar
3683
3684: Looking for optional libraries
3685echo " "
3686echo "Checking for optional libraries..." >&4
3687case "$libs" in
3688' '|'') dflt='';;
3689*) dflt="$libs";;
3690esac
3691case "$libswanted" in
3692'') libswanted='c_s';;
3693esac
3694case "$usesocks" in
923fc586 3695"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 3696esac
68435ea7
JH
3697libsfound=''
3698libsfiles=''
3699libsdirs=''
13b3f787
JH
3700libspath=''
3701for thisdir in $libpth $xlibpth; do
3702 test -d $thisdir && libspath="$libspath $thisdir"
3703done
bd9b35c9 3704for thislib in $libswanted; do
13b3f787 3705 for thisdir in $libspath; do
f7dd4e7f
JH
3706 xxx=''
3707 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3708 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3709 $test -f "$xxx" && eval $libscheck
3710 $test -f "$xxx" && libstyle=shared
3711 fi
3712 if test ! -f "$xxx"; then
3713 xxx=$thisdir/lib$thislib.$so
3714 $test -f "$xxx" && eval $libscheck
3715 $test -f "$xxx" && libstyle=shared
3716 fi
3717 if test ! -f "$xxx"; then
3718 xxx=$thisdir/lib$thislib$_a
3719 $test -f "$xxx" && eval $libscheck
3720 $test -f "$xxx" && libstyle=static
3721 fi
3722 if test ! -f "$xxx"; then
3723 xxx=$thisdir/$thislib$_a
3724 $test -f "$xxx" && eval $libscheck
3725 $test -f "$xxx" && libstyle=static
3726 fi
3727 if test ! -f "$xxx"; then
3728 xxx=$thisdir/lib${thislib}_s$_a
3729 $test -f "$xxx" && eval $libscheck
3730 $test -f "$xxx" && libstyle=static
09ea5ba9 3731 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
3732 fi
3733 if test ! -f "$xxx"; then
3734 xxx=$thisdir/Slib$thislib$_a
3735 $test -f "$xxx" && eval $libscheck
3736 $test -f "$xxx" && libstyle=static
3737 fi
3738 if $test -f "$xxx"; then
43999f95 3739 case "$libstyle" in
f7dd4e7f
JH
3740 shared) echo "Found -l$thislib (shared)." ;;
3741 static) echo "Found -l$thislib." ;;
3742 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 3743 esac
bd9b35c9
JH
3744 case " $dflt " in
3745 *"-l$thislib "*);;
f7dd4e7f 3746 *) dflt="$dflt -l$thislib"
43999f95
JH
3747 libsfound="$libsfound $xxx"
3748 yyy=`basename $xxx`
3749 libsfiles="$libsfiles $yyy"
1e127011 3750 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
3751 case " $libsdirs " in
3752 *" $yyy "*) ;;
3753 *) libsdirs="$libsdirs $yyy" ;;
3754 esac
3755 ;;
bd9b35c9 3756 esac
f7dd4e7f
JH
3757 break
3758 fi
3759 done
3760 if $test ! -f "$xxx"; then
3761 echo "No -l$thislib."
bd9b35c9
JH
3762 fi
3763done
3764set X $dflt
3765shift
3766dflt="$*"
3767case "$libs" in
3768'') dflt="$dflt";;
3769*) dflt="$libs";;
3770esac
3771case "$dflt" in
3772' '|'') dflt='none';;
3773esac
4633a7c4 3774
bd9b35c9 3775$cat <<EOM
4633a7c4 3776
bd9b35c9
JH
3777In order to compile $package on your machine, a number of libraries
3778are usually needed. Include any other special libraries here as well.
3779Say "none" for none. The default list is almost always right.
8e07c86e 3780EOM
8e07c86e 3781
bd9b35c9
JH
3782echo " "
3783rp="What libraries to use?"
3784. ./myread
3785case "$ans" in
3786none) libs=' ';;
3787*) libs="$ans";;
3788esac
d71b2b6b 3789
bd9b35c9
JH
3790: determine optimization, if desired, or use for debug flag also
3791case "$optimize" in
3792' '|$undef) dflt='none';;
3793'') dflt='-O';;
3794*) dflt="$optimize";;
3795esac
3796$cat <<EOH
d71b2b6b 3797
bd9b35c9
JH
3798By default, $package compiles with the -O flag to use the optimizer.
3799Alternately, you might want to use the symbolic debugger, which uses
3800the -g flag (on traditional Unix systems). Either flag can be
3801specified here. To use neither flag, specify the word "none".
d71b2b6b 3802
bd9b35c9
JH
3803EOH
3804rp="What optimizer/debugger flag should be used?"
3805. ./myread
3806optimize="$ans"
3807case "$optimize" in
3808'none') optimize=" ";;
3809esac
3810
3811dflt=''
3812: We will not override a previous value, but we might want to
3813: augment a hint file
3814case "$hint" in
3815default|recommended)
3816 case "$gccversion" in
3817 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 3818 esac
bd9b35c9
JH
3819 case "$optimize" in
3820 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 3821 esac
bd9b35c9
JH
3822 case "$gccversion" in
3823 2*) if test -d /etc/conf/kconfig.d &&
3824 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3825 then
3826 dflt="$dflt -posix"
3827 fi
f0d04425 3828 ;;
bd9b35c9
JH
3829 esac
3830 case "$gccversion" in
3831 1*) ;;
3832 2.[0-8]*) ;;
3833 ?*) echo " "
3834 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3835 echo 'int main(void) { return 0; }' > gcctest.c
3836 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3837 echo "Yes, it does." 2>&1
3838 case "$ccflags" in
3839 *strict-aliasing*)
3840 echo "Leaving current flags $ccflags alone." 2>&1
3841 ;;
3842 *) dflt="$dflt -fno-strict-aliasing" ;;
3843 esac
3844 else
3845 echo "Nope, it doesn't, but that's ok." 2>&1
3846 fi
f0d04425 3847 ;;
e5e20432
JH
3848 esac
3849 ;;
3850esac
3851
bd9b35c9
JH
3852case "$mips_type" in
3853*BSD*|'') inclwanted="$locincpth $usrinc";;
3854*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3855esac
3856for thisincl in $inclwanted; do
3857 if $test -d $thisincl; then
3858 if $test x$thisincl != x$usrinc; then
3859 case "$dflt" in
422af00a
LC
3860 *" -I$thisincl "*);;
3861 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
3862 esac
3863 fi
3864 fi
3865done
40a7a20a 3866
bd9b35c9
JH
3867inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3868 xxx=true;
3869elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3870 xxx=true;
3871else
3872 xxx=false;
3873fi;
3874if $xxx; then
3875 case "$dflt" in
3876 *$2*);;
3877 *) dflt="$dflt -D$2";;
3878 esac;
3879fi'
40a7a20a 3880
bd9b35c9 3881set signal.h LANGUAGE_C; eval $inctest
40a7a20a 3882
bd9b35c9
JH
3883case "$usesocks" in
3884$define)
3885 ccflags="$ccflags -DSOCKS"
3886 ;;
3887esac
40a7a20a 3888
bd9b35c9
JH
3889case "$hint" in
3890default|recommended) dflt="$ccflags $dflt" ;;
3891*) dflt="$ccflags";;
3892esac
40a7a20a 3893
bd9b35c9
JH
3894case "$dflt" in
3895''|' ') dflt=none;;
3896esac
422af00a 3897
bd9b35c9 3898$cat <<EOH
40a7a20a 3899
bd9b35c9
JH
3900Your C compiler may want other flags. For this question you should include
3901-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3902but you should NOT include libraries or ld flags like -lwhatever. If you
3903want $package to honor its debug switch, you should include -DDEBUGGING here.
3904Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 3905
bd9b35c9 3906To use no flags, specify the word "none".
40a7a20a 3907
bd9b35c9
JH
3908EOH
3909set X $dflt
3910shift
3911dflt=${1+"$@"}
3912rp="Any additional cc flags?"
3913. ./myread
3914case "$ans" in
3915none) ccflags='';;
3916*) ccflags="$ans";;
3917esac
8e07c86e 3918
bd9b35c9
JH
3919: the following weeds options from ccflags that are of no interest to cpp
3920cppflags="$ccflags"
3921case "$gccversion" in
39221*) cppflags="$cppflags -D__GNUC__"
4633a7c4 3923esac
bd9b35c9
JH
3924case "$mips_type" in
3925'');;
3926*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3927esac
3928case "$cppflags" in
3929'');;
3930*)
3931 echo " "
3932 echo "Let me guess what the preprocessor flags are..." >&4
3933 set X $cppflags
3934 shift
3935 cppflags=''
3936 $cat >cpp.c <<'EOM'
3937#define BLURFL foo
8e07c86e 3938
bd9b35c9
JH
3939BLURFL xx LFRULB
3940EOM
3941 previous=''
3942 for flag in $*
3943 do
3944 case "$flag" in
3945 -*) ftry="$flag";;
3946 *) ftry="$previous $flag";;
3947 esac
3948 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3949 >cpp1.out 2>/dev/null && \
3950 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3951 >cpp2.out 2>/dev/null && \
3952 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3953 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3954 then
3955 cppflags="$cppflags $ftry"
3956 previous=''
3957 else
3958 previous="$flag"
3959 fi
3960 done
3961 set X $cppflags
3962 shift
3963 cppflags=${1+"$@"}
3964 case "$cppflags" in
3965 *-*) echo "They appear to be: $cppflags";;
3966 esac
3967 $rm -f cpp.c cpp?.out
2afac517 3968 ;;
3969esac
8e07c86e 3970
bd9b35c9
JH
3971: flags used in final linking phase
3972case "$ldflags" in
3973'') if ./venix; then
3974 dflt='-i -z'
10a23457 3975 else
bd9b35c9 3976 dflt=''
10a23457 3977 fi
bd9b35c9
JH
3978 case "$ccflags" in
3979 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 3980 esac
bd9b35c9
JH
3981 ;;
3982*) dflt="$ldflags";;
3983esac
3984
3985: Try to guess additional flags to pick up local libraries.
3986for thislibdir in $libpth; do
3987 case " $loclibpth " in
3988 *" $thislibdir "*)
3989 case "$dflt " in
3990 *"-L$thislibdir "*) ;;
3991 *) dflt="$dflt -L$thislibdir" ;;
3992 esac
c4f23d77
AD
3993 ;;
3994 esac
bd9b35c9 3995done
c4f23d77 3996
bd9b35c9
JH
3997case "$dflt" in
3998'') dflt='none' ;;
3999esac
c4f23d77 4000
bd9b35c9
JH
4001$cat <<EOH
4002
4003Your C linker may need flags. For this question you should
4004include -L/whatever and any other flags used by the C linker, but you
4005should NOT include libraries like -lwhatever.
4006
4007Make sure you include the appropriate -L/path flags if your C linker
4008does not normally search all of the directories you specified above,
4009namely
4010 $libpth
4011To use no flags, specify the word "none".
4012
4013EOH
4014
4015rp="Any additional ld flags (NOT including libraries)?"
4016. ./myread
4017case "$ans" in
4018none) ldflags='';;
4019*) ldflags="$ans";;
4020esac
4021rmlist="$rmlist pdp11"
4022
4023: coherency check
4024echo " "
4025echo "Checking your choice of C compiler and flags for coherency..." >&4
4026$cat > try.c <<'EOF'
4027#include <stdio.h>
4028int main() { printf("Ok\n"); exit(0); }
4029EOF
7a282f6d 4030set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
4031shift
4032$cat >try.msg <<'EOM'
4033I've tried to compile and run the following simple program:
4034
4035EOM
4036$cat try.c >> try.msg
4037
4038$cat >> try.msg <<EOM
4039
4040I used the command:
4041
4042 $*
4043 ./try
4044
4045and I got the following output:
4046
4047EOM
4048dflt=y
7a282f6d 4049if sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
bd9b35c9
JH
4050 if sh -c './try' >>try.msg 2>&1; then
4051 xxx=`./try`
4052 case "$xxx" in
4053 "Ok") dflt=n ;;
4054 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4055 case " $libs " in
4056 *" -lsfio "*)
4057 cat >> try.msg <<'EOQS'
4058If $libs contains -lsfio, and sfio is mis-configured, then it
4059sometimes (apparently) runs and exits with a 0 status, but with no
4060output! It may have to do with sfio's use of _exit vs. exit.
4061
4062EOQS
4063 rp="You have a big problem. Shall I abort Configure"
4064 dflt=y
4065 ;;
4066 esac
4067 ;;
4068 esac
4069 else
4070 echo "The program compiled OK, but exited with status $?." >>try.msg
4071 rp="You have a problem. Shall I abort Configure"
4072 dflt=y
4073 fi
4074else
4075 echo "I can't compile the test program." >>try.msg
4076 rp="You have a BIG problem. Shall I abort Configure"
4077 dflt=y
4078fi
4079case "$dflt" in
4080y)
4081 $cat try.msg >&4
4082 case "$knowitall" in
4083 '')
4084 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 4085 ;;
bd9b35c9 4086 *) dflt=n;;
c4f23d77 4087 esac
bd9b35c9
JH
4088 echo " "
4089 . ./myread
4090 case "$ans" in
4091 n*|N*) ;;
4092 *) echo "Ok. Stopping Configure." >&4
4093 exit 1
c4f23d77
AD
4094 ;;
4095 esac
4096 ;;
bd9b35c9 4097n) echo "OK, that should do.";;
c4f23d77 4098esac
bd9b35c9 4099$rm -f try try.* core
c4f23d77 4100
b4eb6b3d
JH
4101: define an is-a-typedef? function
4102typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4103case "$inclist" in
4104"") inclist="sys/types.h";;
4105esac;
4106eval "varval=\$$var";
4107case "$varval" in
4108"")
4109 $rm -f temp.c;
4110 for inc in $inclist; do
4111 echo "#include <$inc>" >>temp.c;
4112 done;
4113 echo "#ifdef $type" >> temp.c;
4114 echo "printf(\"We have $type\");" >> temp.c;
4115 echo "#endif" >> temp.c;
4116 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4117 if $contains $type temp.E >/dev/null 2>&1; then
4118 eval "$var=\$type";
4119 else
4120 eval "$var=\$def";
4121 fi;
4122 $rm -f temp.?;;
4123*) eval "$var=\$varval";;
4124esac'
4125
4126: define an is-a-typedef? function that prompts if the type is not available.
4127typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4128case "$inclist" in
4129"") inclist="sys/types.h";;
4130esac;
4131eval "varval=\$$var";
4132case "$varval" in
4133"")
4134 $rm -f temp.c;
4135 for inc in $inclist; do
4136 echo "#include <$inc>" >>temp.c;
4137 done;
4138 echo "#ifdef $type" >> temp.c;
4139 echo "printf(\"We have $type\");" >> temp.c;
4140 echo "#endif" >> temp.c;
4141 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4142 echo " " ;
4143 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4144 if $contains $type temp.E >/dev/null 2>&1; then
4145 echo "$type found." >&4;
4146 eval "$var=\$type";
4147 else
4148 echo "$type NOT found." >&4;
4149 dflt="$def";
4150 . ./myread ;
4151 eval "$var=\$ans";
4152 fi;
4153 $rm -f temp.?;;
4154*) eval "$var=\$varval";;
4155esac'
4156
bd9b35c9
JH
4157: define a shorthand compile call
4158compile='
4159mc_file=$1;
4160shift;
08413ebc 4161$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
4162: define a shorthand compile call for compilations that should be ok.
4163compile_ok='
4164mc_file=$1;
4165shift;
7a282f6d 4166$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 4167
b4eb6b3d 4168: check for lengths of integral types
bd9b35c9 4169echo " "
b4eb6b3d
JH
4170case "$intsize" in
4171'')
4172 echo "Checking to see how big your integers are..." >&4
4173 $cat >intsize.c <<'EOCP'
bd9b35c9
JH
4174#include <stdio.h>
4175int main()
4176{
b4eb6b3d
JH
4177 printf("intsize=%d;\n", (int)sizeof(int));
4178 printf("longsize=%d;\n", (int)sizeof(long));
4179 printf("shortsize=%d;\n", (int)sizeof(short));
4180 exit(0);
bd9b35c9 4181}
b4eb6b3d
JH
4182EOCP
4183 set intsize
4184 if eval $compile_ok && ./intsize > /dev/null; then
4185 eval `./intsize`
4186 echo "Your integers are $intsize bytes long."
4187 echo "Your long integers are $longsize bytes long."
4188 echo "Your short integers are $shortsize bytes long."
4189 else
4190 $cat >&4 <<EOM
4191!
4192Help! I can't compile and run the intsize test program: please enlighten me!
4193(This is probably a misconfiguration in your system or libraries, and
4194you really ought to fix it. Still, I'll try anyway.)
4195!
bd9b35c9 4196EOM
b4eb6b3d
JH
4197 dflt=4
4198 rp="What is the size of an integer (in bytes)?"
4199 . ./myread
4200 intsize="$ans"
4201 dflt=$intsize
4202 rp="What is the size of a long integer (in bytes)?"
4203 . ./myread
4204 longsize="$ans"
4205 dflt=2
4206 rp="What is the size of a short integer (in bytes)?"
4207 . ./myread
4208 shortsize="$ans"
4209 fi
4210 ;;
4211esac
4212$rm -f intsize intsize.*
c1a7f87b 4213
b4eb6b3d
JH
4214: see what type lseek is declared as in the kernel
4215rp="What is the type used for lseek's offset on this system?"
4216set off_t lseektype long stdio.h sys/types.h
4217eval $typedef_ask
4218
4219echo " "
4220echo "Checking to see how big your file offsets are..." >&4
4221$cat >try.c <<EOCP
4222#include <sys/types.h>
4223#include <stdio.h>
4224int main()
4225{
4226 printf("%d\n", (int)sizeof($lseektype));
4227 return(0);
4228}
4229EOCP
4230set try
4231if eval $compile_ok; then
4232 lseeksize=`./try`
4233 echo "Your file offsets are $lseeksize bytes long."
4234else
4235 dflt=$longsize
4236 echo " "
4237 echo "(I can't seem to compile the test program. Guessing...)"
4238 rp="What is the size of your file offsets (in bytes)?"
4239 . ./myread
4240 lseeksize="$ans"
4241fi
4242$rm -f try.c try
4243
4244: see what type file positions are declared as in the library
4245rp="What is the type for file position used by fsetpos()?"
4246set fpos_t fpostype long stdio.h sys/types.h
4247eval $typedef_ask
4248
4249echo " "
4250case "$fpostype" in
4251*_t) zzz="$fpostype" ;;
4252*) zzz="fpos_t" ;;
4253esac
4254echo "Checking the size of $zzz..." >&4
4255cat > try.c <<EOCP
4256#include <sys/types.h>
4257#include <stdio.h>
4258int main() {
4259 printf("%d\n", (int)sizeof($fpostype));
4260 exit(0);
4261}
4262EOCP
4263set try
4264if eval $compile_ok; then
4265 yyy=`./try`
4266 case "$yyy" in
4267 '') fpossize=4
4268 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4269 ;;
4270 *) fpossize=$yyy
4271 echo "Your $zzz is $fpossize bytes long."
4272 ;;
4273 esac
4274else
4275 dflt="$longsize"
4276 echo " " >&4
4277 echo "(I can't compile the test program. Guessing...)" >&4
4278 rp="What is the size of your file positions (in bytes)?"
4279 . ./myread
4280 fpossize="$ans"
4281fi
4282
4283
4284
4285# Backward compatibility (uselfs is deprecated).
4286case "$uselfs" in
4287"$define"|true|[yY]*)
4288 cat <<EOM >&4
4289
4290*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4291EOM
4292 uselargefiles="$define"
4293 ;;
4294esac
4295
4296case "$lseeksize:$fpossize" in
42978:8) cat <<EOM
4298
4299You can have files larger than 2 gigabytes.
4300EOM
4301 val="$define" ;;
4302*) case "$uselargefiles" in
4303 "$undef"|false|[nN]*) dflt='n' ;;
4304 *) dflt='y' ;;
4305 esac
4306 cat <<EOM
4307
4308Perl can be built to understand large files (files larger than 2 gigabytes)
4309on some systems. To do so, Configure can be run with -Duselargefiles.
4310
4311If this doesn't make any sense to you, just accept the default '$dflt'.
4312EOM
4313 rp='Try to understand large files, if available?'
4314 . ./myread
4315 case "$ans" in
4316 y|Y) val="$define" ;;
4317 *) val="$undef" ;;
4318 esac
4319 ;;
4320esac
4321set uselargefiles
4322eval $setvar
4323case "$uselargefiles" in
4324"$define")
4325: Look for a hint-file generated 'call-back-unit'. If the
4326: user has specified that a large files perl is to be built,
4327: we may need to set or change some other defaults.
4328 if $test -f uselargefiles.cbu; then
4329 echo "Your platform has some specific hints for large file builds, using them..."
4330 . ./uselargefiles.cbu
4331 echo " "
4332 echo "Rechecking to see how big your file offsets are..." >&4
4333 $cat >try.c <<EOCP
4334#include <sys/types.h>
4335#include <stdio.h>
4336int main()
4337{
4338 printf("%d\n", (int)sizeof($lseektype));
4339 return(0);
4340}
4341EOCP
4342 set try
4343 if eval $compile_ok; then
4344 lseeksize=`./try`
4345 $echo "Your file offsets are now $lseeksize bytes long."
4346 else
4347 dflt="$lseeksize"
4348 echo " "
4349 echo "(I can't seem to compile the test program. Guessing...)"
4350 rp="What is the size of your file offsets (in bytes)?"
4351 . ./myread
4352 lseeksize="$ans"
4353 fi
4354 case "$fpostype" in
4355 *_t) zzz="$fpostype" ;;
4356 *) zzz="fpos_t" ;;
4357 esac
4358 $echo $n "Rechecking the size of $zzz...$c" >&4
4359 $cat > try.c <<EOCP
4360#include <sys/types.h>
4361#include <stdio.h>
4362int main() {
4363 printf("%d\n", (int)sizeof($fpostype));
4364 exit(0);
4365}
4366EOCP
4367 set try
4368 if eval $compile_ok; then
4369 yyy=`./try`
4370 dflt="$lseeksize"
4371 case "$yyy" in
4372 '') echo " "
4373 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4374 ;;
4375 *) fpossize=$yyy
4376 echo " $fpossize bytes." >&4
4377 ;;
4378 esac
4379 else
4380 dflt="$fpossize"
4381 echo " "
4382 echo "(I can't compile the test program. Guessing...)" >&4
4383 rp="What is the size of your file positions (in bytes)?"
4384 . ./myread
4385 fpossize="$ans"
4386 fi
4387 $rm -f try.c try
4388 fi
4389 ;;
4390esac
4391
4392
4393case "$usemorebits" in
4394"$define"|true|[yY]*)
4395 use64bitint="$define"
4396 uselongdouble="$define"
4397 usemorebits="$define"
4398 ;;
4399*) usemorebits="$undef"
4400 ;;
4401esac
4402
4403
4404case "$uselonglong" in
4405"$define"|true|[yY]*)
4406 cat <<EOM >&4
4407
4408*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4409EOM
4410 use64bitint="$define"
4411 ;;
4412esac
4413case "$use64bits" in
4414"$define"|true|[yY]*)
4415 cat <<EOM >&4
4416
4417*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4418EOM
4419 use64bitint="$define"
4420 ;;
4421esac
4422case "$use64bitints" in
4423"$define"|true|[yY]*)
4424 cat <<EOM >&4
4425
4426*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4427EOM
4428 use64bitint="$define"
4429 ;;
4430esac
4431case "$use64bitsint" in
4432"$define"|true|[yY]*)
4433 cat <<EOM >&4
4434
4435*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4436EOM
4437 use64bitint="$define"
4438 ;;
4439esac
4440case "$uselonglongs" in
4441"$define"|true|[yY]*)
4442 cat <<EOM >&4
4443
4444*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4445EOM
4446 use64bitint="$define"
4447 ;;
4448esac
4449case "$use64bitsall" in
4450"$define"|true|[yY]*)
4451 cat <<EOM >&4
4452
4453*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4454EOM
4455 use64bitall="$define"
4456 ;;
4457esac
4458
4459case "$ccflags" in
4460*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4461esac
4462case "$use64bitall" in
4463"$define"|true|[yY]*) use64bitint="$define" ;;
4464esac
4465
4466case "$longsize" in
44678) cat <<EOM
4468
4469You have natively 64-bit long integers.
4470EOM
4471 val="$define"
4472 ;;
4473*) case "$use64bitint" in
4474 "$define"|true|[yY]*) dflt='y';;
4475 *) dflt='n';;
4476 esac
4477 cat <<EOM
4478
4479Perl can be built to take advantage of 64-bit integer types
4480on some systems. To do so, Configure can be run with -Duse64bitint.
4481Choosing this option will most probably introduce binary incompatibilities.
4482
4483If this doesn't make any sense to you, just accept the default '$dflt'.
4484EOM
4485 rp='Try to use 64-bit integers, if available?'
4486 . ./myread
4487 case "$ans" in
4488 [yY]*) val="$define" ;;
4489 *) val="$undef" ;;
4490 esac
4491 ;;
4492esac
4493set use64bitint
4494eval $setvar
4495
4496case "$use64bitall" in
4497"$define"|true|[yY]*) dflt='y' ;;
4498*) case "$longsize" in
4499 8) dflt='y' ;;
4500 *) dflt='n' ;;
4501 esac
4502 ;;
4503esac
4504cat <<EOM
4505
4506You may also choose to try maximal 64-bitness. It means using as much
450764-bitness as possible on the platform. This in turn means even more
4508binary incompatibilities. On the other hand, your platform may not
4509have any more 64-bitness available than what you already have chosen.
4510
4511If this doesn't make any sense to you, just accept the default '$dflt'.
4512EOM
4513rp='Try to use maximal 64-bit support, if available?'
4514. ./myread
4515case "$ans" in
4516[yY]*) val="$define" ;;
4517*) val="$undef" ;;
4518esac
4519set use64bitall
4520eval $setvar
4521case "$use64bitall" in
4522"$define")
4523 case "$use64bitint" in
4524 "$undef")
4525 cat <<EOM
4526
4527Since you have chosen a maximally 64-bit build, I'm also turning on
4528the use of 64-bit integers.
4529EOM
4530 use64bitint="$define" ;;
4531 esac
4532 ;;
4533esac
4534
4535case "$use64bitint" in
4536"$define"|true|[yY]*)
4537: Look for a hint-file generated 'call-back-unit'. If the
4538: user has specified that a 64-bit perl is to be built,
4539: we may need to set or change some other defaults.
4540 if $test -f use64bitint.cbu; then
4541 echo "Your platform has some specific hints for 64-bit integers, using them..."
4542 . ./use64bitint.cbu
4543 fi
4544 case "$longsize" in
4545 4) case "$archname64" in
4546 '') archname64=64int ;;
4547 esac
4548 ;;
4549 esac
4550 ;;
4551esac
4552
4553case "$use64bitall" in
4554"$define"|true|[yY]*)
4555: Look for a hint-file generated 'call-back-unit'. If the
4556: user has specified that a maximally 64-bit perl is to be built,
4557: we may need to set or change some other defaults.
4558 if $test -f use64bitall.cbu; then
4559 echo "Your platform has some specific hints for 64-bit builds, using them..."
4560 . ./use64bitall.cbu
4561 fi
4562 case "$longsize" in
4563 4) case "$archname64" in
4564 ''|64int) archname64=64all ;;
4565 esac
4566 ;;
4567 esac
4568 ;;
4569esac
4570
4571echo " "
4572echo "Checking for GNU C Library..." >&4
4573cat >gnulibc.c <<EOM
4574#include <stdio.h>
4575int main()
4576{
4577#ifdef __GLIBC__
4578 exit(0);
4579#else
4580 exit(1);
4581#endif
4582}
4583EOM
4584set gnulibc
4585if eval $compile_ok && ./gnulibc; then
4586 val="$define"
4587 echo "You are using the GNU C Library"
4588else
4589 val="$undef"
4590 echo "You are not using the GNU C Library"
4591fi
4592$rm -f gnulibc*
4593set d_gnulibc
4594eval $setvar
4595
4596: see if nm is to be used to determine whether a symbol is defined or not
4597case "$usenm" in
4598'')
4599 dflt=''
c1a7f87b
JH
4600 case "$d_gnulibc" in
4601 "$define")
4602 echo " "
4603 echo "nm probably won't work on the GNU C Library." >&4
4604 dflt=n
bd9b35c9 4605 ;;
c1a7f87b
JH
4606 esac
4607 case "$dflt" in
4608 '')
4609 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4610 echo " "
4611 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
4612 echo "'nm' won't be sufficient on this sytem." >&4
4613 dflt=n
4614 fi
4615 ;;
4616 esac
4617 case "$dflt" in
4618 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4619 if $test $dflt -gt 20; then
4620 dflt=y
4621 else
4622 dflt=n
4623 fi
bd9b35c9
JH
4624 ;;
4625 esac
bd9b35c9
JH
4626 ;;
4627*)
c1a7f87b
JH
4628 case "$usenm" in
4629 true|$define) dflt=y;;
4630 *) dflt=n;;
4631 esac
bd9b35c9
JH
4632 ;;
4633esac
4634$cat <<EOM
4635
c1a7f87b
JH
4636I can use $nm to extract the symbols from your C libraries. This
4637is a time consuming task which may generate huge output on the disk (up
4638to 3 megabytes) but that should make the symbols extraction faster. The
4639alternative is to skip the 'nm' extraction part and to compile a small
4640test program instead to determine whether each symbol is present. If
4641you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4642this may be the best solution.
4643
4644You probably shouldn't let me use 'nm' if you are using the GNU C Library.
bd9b35c9
JH
4645
4646EOM
c1a7f87b
JH
4647rp="Shall I use $nm to extract C symbols from the libraries?"
4648. ./myread
4649case "$ans" in
4650[Nn]*) usenm=false;;
4651*) usenm=true;;
bd9b35c9 4652esac
bd9b35c9 4653
c1a7f87b
JH
4654runnm=$usenm
4655case "$reuseval" in
4656true) runnm=false;;
8e07c86e 4657esac
29209bc5 4658
c1a7f87b
JH
4659: nm options which may be necessary
4660case "$nm_opt" in
4661'') if $test -f /mach_boot; then
4662 nm_opt='' # Mach
4663 elif $test -d /usr/ccs/lib; then
4664 nm_opt='-p' # Solaris (and SunOS?)
4665 elif $test -f /dgux; then
4666 nm_opt='-p' # DG-UX
4667 elif $test -f /lib64/rld; then
4668 nm_opt='-p' # 64-bit Irix
4669 else
4670 nm_opt=''
4671 fi;;
4672esac
bd9b35c9 4673
c1a7f87b
JH
4674: nm options which may be necessary for shared libraries but illegal
4675: for archive libraries. Thank you, Linux.
4676case "$nm_so_opt" in
4677'') case "$myuname" in
4678 *linux*)
4679 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4680 nm_so_opt='--dynamic'
4681 fi
4682 ;;
bd9b35c9 4683 esac
c1a7f87b
JH
4684 ;;
4685esac
8e07c86e 4686
c1a7f87b
JH
4687case "$runnm" in
4688true)
4689: get list of predefined functions in a handy place
4690echo " "
4691case "$libc" in
4692'') libc=unknown
4693 case "$libs" in
4694 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
bd9b35c9 4695 esac
ff935051
JH
4696 ;;
4697esac
c1a7f87b
JH
4698libnames='';
4699case "$libs" in
4700'') ;;
4701*) for thislib in $libs; do
4702 case "$thislib" in
4703 -lc|-lc_s)
4704 : Handle C library specially below.
4705 ;;
4706 -l*)
4707 thislib=`echo $thislib | $sed -e 's/^-l//'`
4708 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4709 :
4710 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4711 :
4712 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4713 :
4714 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4715 :
4716 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4717 :
4718 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4719 :
4720 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4721 :
4722 else
4723 try=''
4724 fi
4725 libnames="$libnames $try"
4726 ;;
4727 *) libnames="$libnames $thislib" ;;
34d1710f 4728 esac
c1a7f87b 4729 done
4633a7c4
LW
4730 ;;
4731esac
c1a7f87b
JH
4732xxx=normal
4733case "$libc" in
4734unknown)
4735 set /lib/libc.$so
4736 for xxx in $libpth; do
4737 $test -r $1 || set $xxx/libc.$so
4738 : The messy sed command sorts on library version numbers.
4739 $test -r $1 || \
4740 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4741 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4742 h
4743 s/[0-9][0-9]*/0000&/g
4744 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4745 G
4746 s/\n/ /' | \
381aa1ff 4747 $sort | $sed -e 's/^.* //'`
c1a7f87b
JH
4748 eval set \$$#
4749 done
4750 $test -r $1 || set /usr/ccs/lib/libc.$so
4751 $test -r $1 || set /lib/libsys_s$_a
4752 ;;
4753*)
4754 set blurfl
4755 ;;
a4f3eea9 4756esac
c1a7f87b
JH
4757if $test -r "$1"; then
4758 echo "Your (shared) C library seems to be in $1."
4759 libc="$1"
4760elif $test -r /lib/libc && $test -r /lib/clib; then
4761 echo "Your C library seems to be in both /lib/clib and /lib/libc."
4762 xxx=apollo
4763 libc='/lib/clib /lib/libc'
4764 if $test -r /lib/syslib; then
4765 echo "(Your math library is in /lib/syslib.)"
4766 libc="$libc /lib/syslib"
4767 fi
4768elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4769 echo "Your C library seems to be in $libc, as you said before."
4770elif $test -r $incpath/usr/lib/libc$_a; then
4771 libc=$incpath/usr/lib/libc$_a;
4772 echo "Your C library seems to be in $libc. That's fine."
4773elif $test -r /lib/libc$_a; then
4774 libc=/lib/libc$_a;
4775 echo "Your C library seems to be in $libc. You're normal."
4776else
4777 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4778 :
4779 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4780 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4781 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4782 :
4783 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4784 :
4785 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4786 :
4787 else
4788 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4789 fi
4790 if $test -r "$tans"; then
4791 echo "Your C library seems to be in $tans, of all places."
4792 libc=$tans
4793 else
4794 libc='blurfl'
4795 fi
4796fi
4797if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4798 dflt="$libc"
4799 cat <<EOM
a4f3eea9 4800
c1a7f87b
JH
4801If the guess above is wrong (which it might be if you're using a strange
4802compiler, or your machine supports multiple models), you can override it here.
bd9b35c9
JH
4803
4804EOM
a4f3eea9 4805else
c1a7f87b 4806 dflt=''
381aa1ff 4807 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
c1a7f87b
JH
4808 cat >&4 <<EOM
4809I can't seem to find your C library. I've looked in the following places:
a4f3eea9 4810
c1a7f87b
JH
4811EOM
4812 $sed 's/^/ /' libpath
4813 cat <<EOM
29209bc5 4814
c1a7f87b 4815None of these seems to contain your C library. I need to get its name...
a4f3eea9 4816
bd9b35c9 4817EOM
bd9b35c9 4818fi
c1a7f87b
JH
4819fn=f
4820rp='Where is your C library?'
4821. ./getfile
4822libc="$ans"
a4f3eea9 4823
c1a7f87b 4824echo " "
381aa1ff 4825echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
c1a7f87b
JH
4826set X `cat libnames`
4827shift
4828xxx=files
4829case $# in 1) xxx=file; esac
4830echo "Extracting names from the following $xxx for later perusal:" >&4
4831echo " "
4832$sed 's/^/ /' libnames >&4
4833echo " "
4834$echo $n "This may take a while...$c" >&4
a4f3eea9 4835
c1a7f87b
JH
4836for file in $*; do
4837 case $file in
4838 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4839 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 4840 esac
c1a7f87b 4841done >libc.tmp
a4f3eea9 4842
c1a7f87b
JH
4843$echo $n ".$c"
4844$grep fprintf libc.tmp > libc.ptf
4845xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4846xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4847xxx='[ADTSIW]'
4848if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
4849 eval $xscan;\
4850 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4851 eval $xrun
4852elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4853 eval $xscan;\
4854 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4855 eval $xrun
4856elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4857 eval $xscan;\
4858 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4859 eval $xrun
4860elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4861 eval $xscan;\
4862 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4863 eval $xrun
4864elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4865 eval $xscan;\
4866 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4867 eval $xrun
4868elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4869 eval $xscan;\
4870 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4871 eval $xrun
4872elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4873 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
4874 eval $xscan;\
4875 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4876 eval $xrun
4877elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4878 eval $xscan;\
4879 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4880 eval $xrun
4881elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4882 eval $xscan;\
4883 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4884 eval $xrun
4885elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4886 eval $xscan;\
4887 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4888 eval $xrun
4889elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4890 eval $xscan;\
4891 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4892 eval $xrun
4893elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4894 eval $xscan;\
4895 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4896 eval $xrun
4897elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4898 eval $xscan;\
4899 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4900 eval $xrun
4901elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
4902 eval $xscan;\
4903 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4904 eval $xrun
4905else
4906 $nm -p $* 2>/dev/null >libc.tmp
4907 $grep fprintf libc.tmp > libc.ptf
4908 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4909 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4910 then
4911 nm_opt='-p'
4912 eval $xrun
bd9b35c9 4913 else
c1a7f87b
JH
4914 echo " "
4915 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
4916 com=''
4917 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
4918 for thisname in $libnames $libc; do
4919 $ar t $thisname >>libc.tmp
4920 done
4921 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
4922 echo "Ok." >&4
4923 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
4924 # Repeat libc to extract forwarders to DLL entries too
4925 for thisname in $libnames $libc; do
4926 $ar tv $thisname >>libc.tmp
4927 # Revision 50 of EMX has bug in $ar.
4928 # it will not extract forwarders to DLL entries
4929 # Use emximp which will extract exactly them.
4930 emximp -o tmp.imp $thisname \
4931 2>/dev/null && \
4932 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
4933 < tmp.imp >>libc.tmp
4934 $rm tmp.imp
4935 done
4936 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
4937 echo "Ok." >&4
4938 else
4939 echo "$ar didn't seem to work right." >&4
4940 echo "Maybe this is a Cray...trying bld instead..." >&4
4941 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
4942 then
4943 for thisname in $libnames; do
4944 bld t $libnames | \
4945 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
4946 $ar t $thisname >>libc.tmp
4947 done
4948 echo "Ok." >&4
bd9b35c9 4949 else
c1a7f87b
JH
4950 echo "That didn't work either. Giving up." >&4
4951 exit 1
bd9b35c9 4952 fi
c1a7f87b 4953 fi
a4f3eea9 4954 fi
a4f3eea9 4955fi
c1a7f87b
JH
4956nm_extract="$com"
4957if $test -f /lib/syscalls.exp; then
4958 echo " "
4959 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4960 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
4961fi
4962;;
4963esac
4964$rm -f libnames libpath
bd9b35c9 4965
c1a7f87b
JH
4966: is a C symbol defined?
4967csym='tlook=$1;
4968case "$3" in
4969-v) tf=libc.tmp; tc=""; tdc="";;
4970-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
4971*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4972esac;
4973tx=yes;
4974case "$reuseval-$4" in
4975true-) ;;
4976true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4977esac;
4978case "$tx" in
4979yes)
4980 case "$runnm" in
4981 true)
4982 if $contains $tlook $tf >/dev/null 2>&1;
4983 then tval=true;
4984 else tval=false;
4985 fi;;
4986 *)
4987 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
7a282f6d 4988 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
c1a7f87b
JH
4989 then tval=true;
4990 else tval=false;
4991 fi;
4992 $rm -f t t.c;;
4993 esac;;
4994*)
4995 case "$tval" in
4996 $define) tval=true;;
4997 *) tval=false;;
4998 esac;;
4999esac;
5000eval "$2=$tval"'
bd9b35c9 5001
c1a7f87b
JH
5002: define an is-in-libc? function
5003inlibc='echo " "; td=$define; tu=$undef;
5004sym=$1; var=$2; eval "was=\$$2";
5005tx=yes;
5006case "$reuseval$was" in
5007true) ;;
5008true*) tx=no;;
5009esac;
5010case "$tx" in
5011yes)
5012 set $sym tres -f;
5013 eval $csym;
5014 case "$tres" in
5015 true)
5016 echo "$sym() found." >&4;
5017 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5018 *)
5019 echo "$sym() NOT found." >&4;
5020 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5021 esac;;
bd9b35c9 5022*)
c1a7f87b
JH
5023 case "$was" in
5024 $define) echo "$sym() found." >&4;;
5025 *) echo "$sym() NOT found." >&4;;
5026 esac;;
5027esac'
5028
b4eb6b3d
JH
5029: see if sqrtl exists
5030set sqrtl d_sqrtl
c1a7f87b
JH
5031eval $inlibc
5032
b4eb6b3d
JH
5033case "$ccflags" in
5034*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
c1a7f87b 5035esac
b4eb6b3d
JH
5036
5037case "$uselongdouble" in
5038$define|true|[yY]*) dflt='y';;
5039*) dflt='n';;
5040esac
5041cat <<EOM
5042
5043Perl can be built to take advantage of long doubles which
5044(if available) may give more accuracy and range for floating point numbers.
5045
5046If this doesn't make any sense to you, just accept the default '$dflt'.
5047EOM
5048rp='Try to use long doubles if available?'
c1a7f87b
JH
5049. ./myread
5050case "$ans" in
b4eb6b3d
JH
5051y|Y) val="$define" ;;
5052*) val="$undef" ;;
5053esac
5054set uselongdouble
5055eval $setvar
bfb7748a 5056
b4eb6b3d
JH
5057case "$uselongdouble" in
5058true|[yY]*) uselongdouble="$define" ;;
5059esac
bfb7748a 5060
b4eb6b3d
JH
5061case "$uselongdouble" in
5062$define)
5063: Look for a hint-file generated 'call-back-unit'. If the
5064: user has specified that long doubles should be used,
5065: we may need to set or change some other defaults.
5066 if $test -f uselongdouble.cbu; then
5067 echo "Your platform has some specific hints for long doubles, using them..."
5068 . ./uselongdouble.cbu
5069 else
5070 $cat <<EOM
5071(Your platform doesn't have any specific hints for long doubles.)
c1a7f87b 5072EOM
b4eb6b3d
JH
5073 fi
5074 ;;
5075esac
5076
5077case "$uselongdouble:$d_sqrtl" in
5078$define:$undef)
5079 $cat <<EOM >&4
5080
5081*** You requested the use of long doubles but you do not seem to have
5082*** the mathematic functions for long doubles. I'm disabling the use
5083*** of long doubles.
5084
5085EOM
5086 uselongdouble=$undef
5087 ;;
5088esac
5089
5090: check for length of double
5091echo " "
5092case "$doublesize" in
5093'')
5094 echo "Checking to see how big your double precision numbers are..." >&4
5095 $cat >try.c <<'EOCP'
5096#include <stdio.h>
5097int main()
5098{
5099 printf("%d\n", (int)sizeof(double));
5100 exit(0);
5101}
5102EOCP
5103 set try
5104 if eval $compile_ok; then
5105 doublesize=`./try`
5106 echo "Your double is $doublesize bytes long."
5107 else
5108 dflt='8'
5109 echo "(I can't seem to compile the test program. Guessing...)"
5110 rp="What is the size of a double precision number (in bytes)?"
5111 . ./myread
5112 doublesize="$ans"
5113 fi
5114 ;;
5115esac
5116$rm -f try.c try
5117
5118: check for long doubles
5119echo " "
5120echo "Checking to see if you have long double..." >&4
5121echo 'int main() { long double x = 7.0; }' > try.c
5122set try
5123if eval $compile; then
5124 val="$define"
5125 echo "You have long double."
5126else
5127 val="$undef"
5128 echo "You do not have long double."
5129fi
5130$rm try.*
5131set d_longdbl
5132eval $setvar
5133
5134: check for length of long double
5135case "${d_longdbl}${longdblsize}" in
5136$define)
5137 echo " "
5138 echo "Checking to see how big your long doubles are..." >&4
5139 $cat >try.c <<'EOCP'
5140#include <stdio.h>
5141int main()
5142{
5143 printf("%d\n", sizeof(long double));
5144}
5145EOCP
5146 set try
5147 set try
5148 if eval $compile; then
5149 longdblsize=`./try$exe_ext`
5150 echo "Your long doubles are $longdblsize bytes long."
5151 else
5152 dflt='8'
5153 echo " "
5154 echo "(I can't seem to compile the test program. Guessing...)" >&4
5155 rp="What is the size of a long double (in bytes)?"
5156 . ./myread
5157 longdblsize="$ans"
5158 fi
5159 if $test "X$doublesize" = "X$longdblsize"; then
5160 echo "(That isn't any different from an ordinary double.)"
5161 fi
5162 ;;
5163esac
5164$rm -f try.* try
5165
5166: determine the architecture name
5167echo " "
5168if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5169 tarch=`arch`"-$osname"
5170elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5171 if uname -m > tmparch 2>&1 ; then
5172 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5173 -e 's/$/'"-$osname/" tmparch`
5174 else
5175 tarch="$osname"
5176 fi
5177 $rm -f tmparch
5178else
5179 tarch="$osname"
5180fi
5181case "$myarchname" in
5182''|"$tarch") ;;
5183*)
5184 echo "(Your architecture name used to be $myarchname.)"
5185 archname=''
5186 ;;
5187esac
5188myarchname="$tarch"
5189case "$archname" in
5190'') dflt="$tarch";;
5191*) dflt="$archname";;
5192esac
5193rp='What is your architecture name'
5194. ./myread
5195archname="$ans"
5196case "$usethreads" in
5197$define)
5198 echo "Threads selected." >&4
5199 case "$archname" in
5200 *-thread*) echo "...and architecture name already has -thread." >&4
5201 ;;
5202 *) archname="$archname-thread"
5203 echo "...setting architecture name to $archname." >&4
5204 ;;
5205 esac
5206 ;;
5207esac
5208case "$usemultiplicity" in
5209$define)
5210 echo "Multiplicity selected." >&4
5211 case "$archname" in
5212 *-multi*) echo "...and architecture name already has -multi." >&4
5213 ;;
5214 *) archname="$archname-multi"
5215 echo "...setting architecture name to $archname." >&4
5216 ;;
5217 esac
5218 ;;
5219esac
5220case "$use64bitint$use64bitall" in
5221*"$define"*)
5222 case "$archname64" in
5223 '')
5224 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5225 ;;
5226 *)
5227 case "$use64bitint" in
5228 "$define") echo "64 bit integers selected." >&4 ;;
5229 esac
5230 case "$use64bitall" in
5231 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5232 esac
5233 case "$archname" in
5234 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5235 ;;
5236 *) archname="$archname-$archname64"
5237 echo "...setting architecture name to $archname." >&4
5238 ;;
5239 esac
5240 ;;
5241 esac
5242esac
5243case "$uselongdouble" in
5244$define)
5245 echo "Long doubles selected." >&4
5246 case "$longdblsize" in
5247 $doublesize)
5248 "...but long doubles are equal to doubles, not changing architecture name." >&4
5249 ;;
5250 *)
5251 case "$archname" in
5252 *-ld*) echo "...and architecture name already has -ld." >&4
5253 ;;
5254 *) archname="$archname-ld"
5255 echo "...setting architecture name to $archname." >&4
5256 ;;
5257 esac
5258 ;;
5259 esac
5260 ;;
5261esac
5262
5263: determine root of directory hierarchy where package will be installed.
5264case "$prefix" in
5265'')
5266 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5267 ;;
5268*)
5269 dflt="$prefix"
5270 ;;
5271esac
5272$cat <<EOM
5273
5274By default, $package will be installed in $dflt/bin, manual pages
5275under $dflt/man, etc..., i.e. with $dflt as prefix for all
5276installation directories. Typically this is something like /usr/local.
5277If you wish to have binaries under /usr/bin but other parts of the
5278installation under /usr/local, that's ok: you will be prompted
5279separately for each of the installation directories, the prefix being
5280only used to set the defaults.
5281
5282EOM
5283fn=d~
5284rp='Installation prefix to use?'
5285. ./getfile
5286oldprefix=''
5287case "$prefix" in
5288'') ;;
5289*)
5290 case "$ans" in
5291 "$prefix") ;;
5292 *) oldprefix="$prefix";;
5293 esac
5294 ;;
5295esac
5296prefix="$ans"
5297prefixexp="$ansexp"
5298
5299: is AFS running?
5300echo " "
5301case "$afs" in
5302$define|true) afs=true ;;
5303$undef|false) afs=false ;;
5304*) if test -d /afs; then
5305 afs=true
5306 else
5307 afs=false
5308 fi
5309 ;;
5310esac
5311if $afs; then
5312 echo "AFS may be running... I'll be extra cautious then..." >&4
5313else
5314 echo "AFS does not seem to be running..." >&4
5315fi
5316
5317: determine installation prefix for where package is to be installed.
5318if $afs; then
5319$cat <<EOM
5320
5321Since you are running AFS, I need to distinguish the directory in which
5322files will reside from the directory in which they are installed (and from
5323which they are presumably copied to the former directory by occult means).
5324
5325EOM
5326 case "$installprefix" in
5327 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5328 *) dflt="$installprefix";;
5329 esac
5330else
5331$cat <<EOM
5332
5333In some special cases, particularly when building $package for distribution,
5334it is convenient to distinguish between the directory in which files should
5335be installed from the directory ($prefix) in which they
5336will eventually reside. For most users, these two directories are the same.
5337
5338EOM
5339 case "$installprefix" in
5340 '') dflt=$prefix ;;
5341 *) dflt=$installprefix;;
5342 esac
5343fi
5344fn=d~
5345rp='What installation prefix should I use for installing files?'
5346. ./getfile
5347installprefix="$ans"
5348installprefixexp="$ansexp"
5349
5350: set the prefixit variable, to compute a suitable default value
5351prefixit='case "$3" in
5352""|none)
5353 case "$oldprefix" in
5354 "") eval "$1=\"\$$2\"";;
5355 *)
5356 case "$3" in
5357 "") eval "$1=";;
5358 none)
5359 eval "tp=\"\$$2\"";
5360 case "$tp" in
5361 ""|" ") eval "$1=\"\$$2\"";;
5362 *) eval "$1=";;
5363 esac;;
5364 esac;;
5365 esac;;
5366*)
5367 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5368 case "$tp" in
5369 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5370 /*-$oldprefix/*|\~*-$oldprefix/*)
5371 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5372 *) eval "$1=\"\$$2\"";;
5373 esac;;
5374esac'
5375
5376
5377: get the patchlevel
5378echo " "
5379echo "Getting the current patchlevel..." >&4
5380if $test -r $rsrc/patchlevel.h;then
5381 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5382 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5383 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5384 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5385 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5386 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5387else
5388 revision=0
5389 patchlevel=0
5390 subversion=0
5391 api_revision=0
5392 api_version=0
5393 api_subversion=0
5394fi
5395$echo "(You have $package version $patchlevel subversion $subversion.)"
5396case "$osname" in
5397dos|vms)
5398 : XXX Should be a Configure test for double-dots in filenames.
5399 version=`echo $revision $patchlevel $subversion | \
5400 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5401 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5402 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5403 ;;
5404*)
5405 version=`echo $revision $patchlevel $subversion | \
5406 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5407 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5408 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5409 ;;
5410esac
5411: Special case the 5.005_xx maintenance series, which used 5.005
5412: without any subversion label as a subdirectory in $sitelib
5413if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5414 api_versionstring='5.005'
5415fi
5416
5417: determine installation style
5418: For now, try to deduce it from prefix unless it is already set.
5419: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5420case "$installstyle" in
5421'') case "$prefix" in
5422 *perl*) dflt='lib';;
5423 *) dflt='lib/perl5' ;;
5424 esac
5425 ;;
5426*) dflt="$installstyle" ;;
5427esac
5428: Probably not worth prompting for this since we prompt for all
5429: the directories individually, and the prompt would be too long and
5430: confusing anyway.
5431installstyle=$dflt
5432
5433: determine where private library files go
5434: Usual default is /usr/local/lib/perl5/$version.
5435: Also allow things like /opt/perl/lib/$version, since
5436: /opt/perl/lib/perl5... would be redundant.
5437: The default "style" setting is made in installstyle.U
5438case "$installstyle" in
5439*lib/perl5*) set dflt privlib lib/$package/$version ;;
5440*) set dflt privlib lib/$version ;;
5441esac
5442eval $prefixit
5443$cat <<EOM
5444
5445There are some auxiliary files for $package that need to be put into a
5446private library directory that is accessible by everyone.
5447
5448EOM
5449fn=d~+
5450rp='Pathname where the private library files will reside?'
5451. ./getfile
5452privlib="$ans"
5453privlibexp="$ansexp"
5454: Change installation prefix, if necessary.
5455if $test X"$prefix" != X"$installprefix"; then
5456 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5457else
5458 installprivlib="$privlibexp"
5459fi
5460
5461: set the prefixup variable, to restore leading tilda escape
5462prefixup='case "$prefixexp" in
5463"$prefix") ;;
5464*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5465esac'
5466
5467: determine where public architecture dependent libraries go
5468set archlib archlib
5469eval $prefixit
5470: privlib default is /usr/local/lib/$package/$version
5471: archlib default is /usr/local/lib/$package/$version/$archname
5472: privlib may have an optional trailing /share.
5473tdflt=`echo $privlib | $sed 's,/share$,,'`
5474tdflt=$tdflt/$archname
5475case "$archlib" in
5476'') dflt=$tdflt
5477 ;;
5478*) dflt="$archlib"
5479 ;;
5480esac
5481$cat <<EOM
5482
5483$spackage contains architecture-dependent library files. If you are
5484sharing libraries in a heterogeneous environment, you might store
5485these files in a separate location. Otherwise, you can just include
5486them with the rest of the public library files.
5487
5488EOM
5489fn=d+~
5490rp='Where do you want to put the public architecture-dependent libraries?'
5491. ./getfile
5492archlib="$ans"
5493archlibexp="$ansexp"
5494if $test X"$archlib" = X"$privlib"; then
5495 d_archlib="$undef"
5496else
5497 d_archlib="$define"
5498fi
5499: Change installation prefix, if necessary.
5500if $test X"$prefix" != X"$installprefix"; then
5501 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5502else
5503 installarchlib="$archlibexp"
5504fi
5505
5506
5507: Binary compatibility with 5.005 is not possible for builds
5508: with advanced features
5509case "$usethreads$usemultiplicity" in
5510*define*)
5511 bincompat5005="$undef"
5512 d_bincompat5005="$undef"
5513 ;;
5514*) $cat <<EOM
5515
5516This version of Perl can be compiled for binary compatibility with 5.005.
5517If you decide to do so, you will be able to continue using most of the
5518extensions that were compiled for Perl 5.005.
5519
5520EOM
5521 case "$bincompat5005$d_bincompat5005" in
5522 *"$undef"*) dflt=n ;;
5523 *) dflt=y ;;
5524 esac
5525 rp='Binary compatibility with Perl 5.005?'
5526 . ./myread
5527 case "$ans" in
5528 y*) val="$define" ;;
5529 *) val="$undef" ;;
5530 esac
5531 set d_bincompat5005
5532 eval $setvar
5533 case "$d_bincompat5005" in
5534 "$define")
5535 bincompat5005="$define"
5536 ;;
5537 *) bincompat5005="$undef"
5538 d_bincompat5005="$undef"
5539 ;;
5540 esac
5541 ;;
5542esac
5543
5544
5545: see if setuid scripts can be secure
5546$cat <<EOM
5547
5548Some kernels have a bug that prevents setuid #! scripts from being
5549secure. Some sites have disabled setuid #! scripts because of this.
5550
5551First let's decide if your kernel supports secure setuid #! scripts.
5552(If setuid #! scripts would be secure but have been disabled anyway,
5553don't say that they are secure if asked.)
5554
5555EOM
5556
5557val="$undef"
5558if $test -d /dev/fd; then
5559 echo "#!$ls" >reflect
5560 chmod +x,u+s reflect
5561 ./reflect >flect 2>&1
5562 if $contains "/dev/fd" flect >/dev/null; then
5563 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5564 val="$define"
5565 else
5566 $cat <<EOM
5567If you are not sure if they are secure, I can check but I'll need a
5568username and password different from the one you are using right now.
5569If you don't have such a username or don't want me to test, simply
5570enter 'none'.
5571
5572EOM
5573 rp='Other username to test security of setuid scripts with?'
5574 dflt='none'
5575 . ./myread
5576 case "$ans" in
5577 n|none)
5578 case "$d_suidsafe" in
5579 '') echo "I'll assume setuid scripts are *not* secure." >&4
5580 dflt=n;;
5581 "$undef")
5582 echo "Well, the $hint value is *not* secure." >&4
5583 dflt=n;;
5584 *) echo "Well, the $hint value *is* secure." >&4
5585 dflt=y;;
5586 esac
c1a7f87b 5587 ;;
b4eb6b3d
JH
5588 *)
5589 $rm -f reflect flect
5590 echo "#!$ls" >reflect
5591 chmod +x,u+s reflect
5592 echo >flect
5593 chmod a+w flect
5594 echo '"su" will (probably) prompt you for '"$ans's password."
5595 su $ans -c './reflect >flect'
5596 if $contains "/dev/fd" flect >/dev/null; then
5597 echo "Okay, it looks like setuid scripts are secure." >&4
5598 dflt=y
5599 else
5600 echo "I don't think setuid scripts are secure." >&4
5601 dflt=n
5602 fi
5603 ;;
5604 esac
5605 rp='Does your kernel have *secure* setuid scripts?'
5606 . ./myread
5607 case "$ans" in
5608 [yY]*) val="$define";;
5609 *) val="$undef";;
5610 esac
5611 fi
5612else
5613 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5614 echo "(That's for file descriptors, not floppy disks.)"
5615 val="$undef"
5616fi
5617set d_suidsafe
5618eval $setvar
5619
5620$rm -f reflect flect
5621
5622: now see if they want to do setuid emulation
5623echo " "
5624val="$undef"
5625case "$d_suidsafe" in
5626"$define")
5627 val="$undef"
5628 echo "No need to emulate SUID scripts since they are secure here." >& 4
5629 ;;
5630*)
5631 $cat <<EOM
5632Some systems have disabled setuid scripts, especially systems where
5633setuid scripts cannot be secure. On systems where setuid scripts have
5634been disabled, the setuid/setgid bits on scripts are currently
5635useless. It is possible for $package to detect those bits and emulate
5636setuid/setgid in a secure fashion. This emulation will only work if
5637setuid scripts have been disabled in your kernel.
5638
5639EOM
5640 case "$d_dosuid" in
5641 "$define") dflt=y ;;
5642 *) dflt=n ;;
5643 esac
5644 rp="Do you want to do setuid/setgid emulation?"
5645 . ./myread
5646 case "$ans" in
5647 [yY]*) val="$define";;
5648 *) val="$undef";;
5649 esac
5650 ;;
5651esac
5652set d_dosuid
5653eval $setvar
5654
5655: determine filename position in cpp output
5656echo " "
5657echo "Computing filename position in cpp output for #include directives..." >&4
5658echo '#include <stdio.h>' > foo.c
5659$cat >fieldn <<EOF
5660$startsh
5661$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5662$grep '^[ ]*#.*stdio\.h' | \
5663while read cline; do
5664 pos=1
5665 set \$cline
5666 while $test \$# -gt 0; do
5667 if $test -r \`echo \$1 | $tr -d '"'\`; then
5668 echo "\$pos"
5669 exit 0
5670 fi
5671 shift
5672 pos=\`expr \$pos + 1\`
5673 done
5674done
5675EOF
5676chmod +x fieldn
5677fieldn=`./fieldn`
5678$rm -f foo.c fieldn
5679case $fieldn in
5680'') pos='???';;
56811) pos=first;;
56822) pos=second;;
56833) pos=third;;
5684*) pos="${fieldn}th";;
5685esac
5686echo "Your cpp writes the filename in the $pos field of the line."
5687
5688: locate header file
5689$cat >findhdr <<EOF
5690$startsh
5691wanted=\$1
5692name=''
5693for usrincdir in $usrinc
5694do
5695 if test -f \$usrincdir/\$wanted; then
5696 echo "\$usrincdir/\$wanted"
5697 exit 0
5698 fi
5699done
5700awkprg='{ print \$$fieldn }'
5701echo "#include <\$wanted>" > foo\$\$.c
5702$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5703$grep "^[ ]*#.*\$wanted" | \
5704while read cline; do
5705 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5706 case "\$name" in
5707 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5708 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5709 *) exit 2;;
5710 esac;
5711done;
5712#
5713# status = 0: grep returned 0 lines, case statement not executed
5714# status = 1: headerfile found
5715# status = 2: while loop executed, no headerfile found
5716#
5717status=\$?
5718$rm -f foo\$\$.c;
5719if test \$status -eq 1; then
5720 exit 0;
5721fi
5722exit 1
5723EOF
5724chmod +x findhdr
5725
5726: define an alternate in-header-list? function
5727inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5728cont=true; xxf="echo \"<\$1> found.\" >&4";
5729case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5730*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5731esac;
5732case $# in 4) instead=instead;; *) instead="at last";; esac;
5733while $test "$cont"; do
5734 xxx=`./findhdr $1`
5735 var=$2; eval "was=\$$2";
5736 if $test "$xxx" && $test -r "$xxx";
5737 then eval $xxf;
5738 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5739 cont="";
5740 else eval $xxnf;
5741 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5742 set $yyy; shift; shift; yyy=$@;
5743 case $# in 0) cont="";;
5744 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5745 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5746 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5747 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5748 esac;
5749done;
5750while $test "$yyy";
5751do set $yyy; var=$2; eval "was=\$$2";
5752 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5753 set $yyy; shift; shift; yyy=$@;
5754done'
5755
5756: see if this is a malloc.h system
5757set malloc.h i_malloc
5758eval $inhdr
5759
5760: see if stdlib is available
5761set stdlib.h i_stdlib
5762eval $inhdr
5763
5764: determine which malloc to compile in
5765echo " "
5766case "$usemymalloc" in
5767''|[yY]*|true|$define) dflt='y' ;;
5768*) dflt='n' ;;
5769esac
5770rp="Do you wish to attempt to use the malloc that comes with $package?"
5771. ./myread
5772usemymalloc="$ans"
5773case "$ans" in
5774y*|true)
5775 usemymalloc='y'
5776 mallocsrc='malloc.c'
5777 mallocobj="malloc$_o"
5778 d_mymalloc="$define"
5779 case "$libs" in
5780 *-lmalloc*)
5781 : Remove malloc from list of libraries to use
5782 echo "Removing unneeded -lmalloc from library list" >&4
5783 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5784 shift
5785 libs="$*"
5786 echo "libs = $libs" >&4
5787 ;;
5788 esac
5789 ;;
5790*)
5791 usemymalloc='n'
5792 mallocsrc=''
5793 mallocobj=''
5794 d_mymalloc="$undef"
5795 ;;
5796esac
5797
5798: compute the return types of malloc and free
5799echo " "
5800$cat >malloc.c <<END
5801#$i_malloc I_MALLOC
5802#$i_stdlib I_STDLIB
5803#include <stdio.h>
5804#include <sys/types.h>
5805#ifdef I_MALLOC
5806#include <malloc.h>
5807#endif
5808#ifdef I_STDLIB
5809#include <stdlib.h>
5810#endif
5811#ifdef TRY_MALLOC
5812void *malloc();
5813#endif
5814#ifdef TRY_FREE
5815void free();
5816#endif
5817END
5818case "$malloctype" in
5819'')
5820 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5821 malloctype='void *'
5822 else
5823 malloctype='char *'
5824 fi
5825 ;;
5826esac
5827echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5828
5829case "$freetype" in
5830'')
5831 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5832 freetype='void'
5833 else
5834 freetype='int'
5835 fi
5836 ;;
5837esac
5838echo "Your system uses $freetype free(), it would seem." >&4
5839$rm -f malloc.[co]
5840$cat <<EOM
5841
5842After $package is installed, you may wish to install various
5843add-on modules and utilities. Typically, these add-ons will
5844be installed under $prefix with the rest
5845of this package. However, you may wish to install such add-ons
5846elsewhere under a different prefix.
5847
5848If you do not wish to put everything under a single prefix, that's
5849ok. You will be prompted for the individual locations; this siteprefix
5850is only used to suggest the defaults.
5851
5852The default should be fine for most people.
5853
5854EOM
5855fn=d~+
5856rp='Installation prefix to use for add-on modules and utilities?'
5857: XXX Here might be another good place for an installstyle setting.
5858case "$siteprefix" in
5859'') dflt=$prefix ;;
5860*) dflt=$siteprefix ;;
5861esac
5862. ./getfile
5863: XXX Prefixit unit does not yet support siteprefix and vendorprefix
5864oldsiteprefix=''
5865case "$siteprefix" in
5866'') ;;
5867*) case "$ans" in
5868 "$prefix") ;;
5869 *) oldsiteprefix="$prefix";;
5870 esac
5871 ;;
5872esac
5873siteprefix="$ans"
5874siteprefixexp="$ansexp"
5875
5876: determine where site specific libraries go.
5877: Usual default is /usr/local/lib/perl5/site_perl/$version
5878: The default "style" setting is made in installstyle.U
5879: XXX No longer works with Prefixit stuff.
5880prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5881case "$sitelib" in
5882'') case "$installstyle" in
5883 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5884 *) dflt=$siteprefix/lib/site_$prog/$version ;;
5885 esac
5886 ;;
5887*) dflt="$sitelib"
5888 ;;
5889esac
5890$cat <<EOM
5891
5892The installation process will create a directory for
5893site-specific extensions and modules. Most users find it convenient
5894to place all site-specific files in this directory rather than in the
5895main distribution directory.
5896
5897EOM
5898fn=d~+
5899rp='Pathname for the site-specific library files?'
5900. ./getfile
5901sitelib="$ans"
5902sitelibexp="$ansexp"
5903sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5904: Change installation prefix, if necessary.
5905if $test X"$prefix" != X"$installprefix"; then
5906 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5907else
5908 installsitelib="$sitelibexp"
5909fi
5910
5911: determine where site specific architecture-dependent libraries go.
5912: sitelib default is /usr/local/lib/perl5/site_perl/$version
5913: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5914: sitelib may have an optional trailing /share.
5915case "$sitearch" in
5916'') dflt=`echo $sitelib | $sed 's,/share$,,'`
5917 dflt="$dflt/$archname"
5918 ;;
5919*) dflt="$sitearch"
5920 ;;
5921esac
5922set sitearch sitearch none
5923eval $prefixit
5924$cat <<EOM
5925
5926The installation process will also create a directory for
5927architecture-dependent site-specific extensions and modules.
5928
5929EOM
5930fn=d~+
5931rp='Pathname for the site-specific architecture-dependent library files?'
5932. ./getfile
5933sitearch="$ans"
5934sitearchexp="$ansexp"
5935: Change installation prefix, if necessary.
5936if $test X"$prefix" != X"$installprefix"; then
5937 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5938else
5939 installsitearch="$sitearchexp"
5940fi
5941
5942$cat <<EOM
5943
5944The installation process will also create a directory for
5945vendor-supplied add-ons. Vendors who supply perl with their system
5946may find it convenient to place all vendor-supplied files in this
5947directory rather than in the main distribution directory. This will
5948ease upgrades between binary-compatible maintenance versions of perl.
5949
5950Of course you may also use these directories in whatever way you see
5951fit. For example, you might use them to access modules shared over a
5952company-wide network.
5953
5954The default answer should be fine for most people.
5955This causes further questions about vendor add-ons to be skipped
5956and no vendor-specific directories will be configured for perl.
5957
5958EOM
5959rp='Do you want to configure vendor-specific add-on directories?'
5960case "$usevendorprefix" in
5961define|true|[yY]*) dflt=y ;;
5962*) : User may have set vendorprefix directly on Configure command line.
5963 case "$vendorprefix" in
5964 ''|' ') dflt=n ;;
5965 *) dflt=y ;;
5966 esac
5967 ;;
5968esac
5969. ./myread
5970case "$ans" in
5971[yY]*) fn=d~+
5972 rp='Installation prefix to use for vendor-supplied add-ons?'
5973 case "$vendorprefix" in
5974 '') dflt='' ;;
5975 *) dflt=$vendorprefix ;;
5976 esac
5977 . ./getfile
5978 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5979 oldvendorprefix=''
5980 case "$vendorprefix" in
5981 '') ;;
5982 *) case "$ans" in
5983 "$prefix") ;;
5984 *) oldvendorprefix="$prefix";;
5985 esac
5986 ;;
5987 esac
5988 usevendorprefix="$define"
5989 vendorprefix="$ans"
5990 vendorprefixexp="$ansexp"
5991 ;;
5992*) usevendorprefix="$undef"
5993 vendorprefix=''
5994 vendorprefixexp=''
5995 ;;
5996esac
5997
5998case "$vendorprefix" in
5999'') d_vendorlib="$undef"
6000 vendorlib=''
6001 vendorlibexp=''
6002 ;;
6003*) d_vendorlib="$define"
6004 : determine where vendor-supplied modules go.
6005 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6006 case "$vendorlib" in
6007 '')
6008 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6009 case "$installstyle" in
6010 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6011 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6012 esac
6013 ;;
6014 *) dflt="$vendorlib"
6015 ;;
6016 esac
6017 fn=d~+
6018 rp='Pathname for the vendor-supplied library files?'
6019 . ./getfile
6020 vendorlib="$ans"
6021 vendorlibexp="$ansexp"
6022 ;;
6023esac
6024vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6025: Change installation prefix, if necessary.
6026if $test X"$prefix" != X"$installprefix"; then
6027 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6028else
6029 installvendorlib="$vendorlibexp"
6030fi
6031
6032case "$vendorprefix" in
6033'') d_vendorarch="$undef"
6034 vendorarch=''
6035 vendorarchexp=''
6036 ;;
6037*) d_vendorarch="$define"
6038 : determine where vendor-supplied architecture-dependent libraries go.
6039 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6040 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6041 : vendorlib may have an optional trailing /share.
6042 case "$vendorarch" in
6043 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6044 dflt="$dflt/$archname"
6045 ;;
6046 *) dflt="$vendorarch" ;;
6047 esac
6048 fn=d~+
6049 rp='Pathname for vendor-supplied architecture-dependent files?'
6050 . ./getfile
6051 vendorarch="$ans"
6052 vendorarchexp="$ansexp"
6053 ;;
6054esac
6055: Change installation prefix, if necessary.
6056if $test X"$prefix" != X"$installprefix"; then
6057 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6058else
6059 installvendorarch="$vendorarchexp"
6060fi
6061
6062: Final catch-all directories to search
6063$cat <<EOM
6064
6065Lastly, you can have perl look in other directories for extensions and
6066modules in addition to those already specified.
6067These directories will be searched after
6068 $sitearch
6069 $sitelib
6070EOM
6071test X"$vendorlib" != "X" && echo ' ' $vendorlib
6072test X"$vendorarch" != "X" && echo ' ' $vendorarch
6073echo ' '
6074case "$otherlibdirs" in
6075''|' ') dflt='none' ;;
6076*) dflt="$otherlibdirs" ;;
6077esac
6078$cat <<EOM
6079Enter a colon-separated set of extra paths to include in perl's @INC
6080search path, or enter 'none' for no extra paths.
6081
6082EOM
6083
6084rp='Colon-separated list of additional directories for perl to search?'
6085. ./myread
6086case "$ans" in
6087' '|''|none) otherlibdirs=' ' ;;
6088*) otherlibdirs="$ans" ;;
6089esac
6090case "$otherlibdirs" in
6091' ') val=$undef ;;
6092*) val=$define ;;
6093esac
6094set d_perl_otherlibdirs
6095eval $setvar
6096
6097: Cruising for prototypes
6098echo " "
6099echo "Checking out function prototypes..." >&4
6100$cat >prototype.c <<'EOCP'
6101int main(int argc, char *argv[]) {
6102 exit(0);}
6103EOCP
6104if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6105 echo "Your C compiler appears to support function prototypes."
6106 val="$define"
6107else
6108 echo "Your C compiler doesn't seem to understand function prototypes."
6109 val="$undef"
6110fi
6111set prototype
6112eval $setvar
6113$rm -f prototype*
6114
6115case "$prototype" in
6116"$define") ;;
6117*) ansi2knr='ansi2knr'
6118 echo " "
6119 cat <<EOM >&4
6120
6121$me: FATAL ERROR:
6122This version of $package can only be compiled by a compiler that
6123understands function prototypes. Unfortunately, your C compiler
6124 $cc $ccflags
6125doesn't seem to understand them. Sorry about that.
6126
6127If GNU cc is available for your system, perhaps you could try that instead.
6128
6129Eventually, we hope to support building Perl with pre-ANSI compilers.
6130If you would like to help in that effort, please contact <perlbug@perl.org>.
6131
6132Aborting Configure now.
6133EOM
6134 exit 2
6135 ;;
6136esac
6137
6138: determine where public executables go
6139echo " "
6140set dflt bin bin
6141eval $prefixit
6142fn=d~
6143rp='Pathname where the public executables will reside?'
6144. ./getfile
6145if $test "X$ansexp" != "X$binexp"; then
6146 installbin=''
6147fi
6148bin="$ans"
6149binexp="$ansexp"
6150: Change installation prefix, if necessary.
6151: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6152if $test X"$prefix" != X"$installprefix"; then
6153 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6154else
6155 installbin="$binexp"
6156fi
6157
6158: Find perl5.005 or later.
6159echo "Looking for a previously installed perl5.005 or later... "
6160case "$perl5" in
6161'') for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6162 : Check if this perl is recent and can load a simple module
6163 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6164 perl5=$tdir/perl
6165 break;
6166 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6167 perl5=$tdir/perl
6168 break;
6169 fi
6170 done
6171 ;;
6172*) perl5="$perl5"
6173 ;;
6174esac
6175case "$perl5" in
6176'') echo "None found. That's ok.";;
6177*) echo "Using $perl5." ;;
6178esac
6179
6180: Determine list of previous versions to include in @INC
6181$cat > getverlist <<EOPL
6182#!$perl5 -w
6183use File::Basename;
6184\$api_versionstring = "$api_versionstring";
6185\$version = "$version";
6186\$stem = "$sitelib_stem";
6187\$archname = "$archname";
6188EOPL
6189 $cat >> getverlist <<'EOPL'
6190# Can't have leading @ because metaconfig interprets it as a command!
6191;@inc_version_list=();
6192# XXX Redo to do opendir/readdir?
6193if (-d $stem) {
6194 chdir($stem);
6195 ;@candidates = glob("5.*");
6196}
6197else {
6198 ;@candidates = ();
6199}
6200
6201# XXX ToDo: These comparisons must be reworked when two-digit
6202# subversions come along, so that 5.7.10 compares as greater than
6203# 5.7.3! By that time, hope that 5.6.x is sufficiently
6204# widespread that we can use the built-in version vectors rather
6205# than reinventing them here. For 5.6.0, however, we must
6206# assume this script will likely be run by 5.005_0x. --AD 1/2000.
6207foreach $d (@candidates) {
6208 if ($d lt $version) {
6209 if ($d ge $api_versionstring) {
6210 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6211 }
6212 elsif ($d ge "5.005") {
6213 unshift(@inc_version_list, grep { -d } $d);
6214 }
6215 }
6216 else {
6217 # Skip newer version. I.e. don't look in
6218 # 5.7.0 if we're installing 5.6.1.
6219 }
6220}
6221
6222if (@inc_version_list) {
6223 print join(' ', @inc_version_list);
6224}
6225else {
6226 # Blank space to preserve value for next Configure run.
6227 print " ";
6228}
6229EOPL
6230chmod +x getverlist
6231case "$inc_version_list" in
6232'') if test -x "$perl5"; then
6233 dflt=`$perl5 getverlist`
6234 else
6235 dflt='none'
6236 fi
6237 ;;
6238$undef) dflt='none' ;;
6239*) dflt="$inc_version_list" ;;
6240esac
6241case "$dflt" in
6242''|' ') dflt=none ;;
6243esac
6244case "$dflt" in
62455.005) case "$bincompat5005" in
6246 $define|true|[yY]*) ;;
6247 *) dflt=none ;;
6248 esac
6249 ;;
6250esac
6251$cat <<'EOM'
6252
6253In order to ease the process of upgrading, this version of perl
6254can be configured to use modules built and installed with earlier
6255versions of perl that were installed under $prefix. Specify here
6256the list of earlier versions that this version of perl should check.
6257If Configure detected no earlier versions of perl installed under
6258$prefix, then the list will be empty. Answer 'none' to tell perl
6259to not search earlier versions.
6260
6261The default should almost always be sensible, so if you're not sure,
6262just accept the default.
6263EOM
6264
6265rp='List of earlier versions to include in @INC?'
6266. ./myread
6267case "$ans" in
6268[Nn]one|''|' ') inc_version_list=' ' ;;
6269*) inc_version_list="$ans" ;;
6270esac
6271case "$inc_version_list" in
6272''|' ')
6273 inc_version_list_init='0';;
6274*) inc_version_list_init=`echo $inc_version_list |
6275 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6276 ;;
6277esac
6278$rm -f getverlist
6279
6280: determine whether to install perl also as /usr/bin/perl
6281
6282echo " "
6283if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6284 $cat <<EOM
6285Many scripts expect perl to be installed as /usr/bin/perl.
6286I can install the perl you are about to compile also as /usr/bin/perl
6287(in addition to $installbin/perl).
6288EOM
6289 case "$installusrbinperl" in
6290 "$undef"|[nN]*) dflt='n';;
6291 *) dflt='y';;
6292 esac
6293 rp="Do you want to install perl as /usr/bin/perl?"
6294 . ./myread
6295 case "$ans" in
6296 [yY]*) val="$define";;
6297 *) val="$undef" ;;
6298 esac
6299else
6300 val="$undef"
6301fi
6302set installusrbinperl
6303eval $setvar
6304
6305: see if dld is available
6306set dld.h i_dld
6307eval $inhdr
6308
6309: see if dlopen exists
6310xxx_runnm="$runnm"
6311runnm=false
6312set dlopen d_dlopen
6313eval $inlibc
6314runnm="$xxx_runnm"
6315
6316: determine which dynamic loading, if any, to compile in
6317echo " "
6318dldir="ext/DynaLoader"
6319case "$usedl" in
6320$define|y|true)
6321 dflt='y'
6322 usedl="$define"
6323 ;;
6324$undef|n|false)
6325 dflt='n'
6326 usedl="$undef"
6327 ;;
6328*)
6329 dflt='n'
6330 case "$d_dlopen" in
6331 $define) dflt='y' ;;
6332 esac
6333 case "$i_dld" in
6334 $define) dflt='y' ;;
6335 esac
6336 : Does a dl_xxx.xs file exist for this operating system
6337 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6338 ;;
6339esac
6340rp="Do you wish to use dynamic loading?"
6341. ./myread
6342usedl="$ans"
6343case "$ans" in
6344y*) usedl="$define"
6345 case "$dlsrc" in
6346 '')
6347 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6348 dflt="$dldir/dl_${osname}.xs"
6349 elif $test "$d_dlopen" = "$define" ; then
6350 dflt="$dldir/dl_dlopen.xs"
6351 elif $test "$i_dld" = "$define" ; then
6352 dflt="$dldir/dl_dld.xs"
6353 else
6354 dflt=''
6355 fi
6356 ;;
6357 *) dflt="$dldir/$dlsrc"
6358 ;;
6359 esac
6360 echo "The following dynamic loading files are available:"
6361 : Can not go over to $dldir because getfile has path hard-coded in.
6362 tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6363 rp="Source file to use for dynamic loading"
6364 fn="fne"
6365 gfpth="$src"
6366 . ./getfile
6367 usedl="$define"
6368 : emulate basename
6369 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6370
6371 $cat << EOM
6372
6373Some systems may require passing special flags to $cc -c to
6374compile modules that will be used to create a shared library.
6375To use no flags, say "none".
6376
6377EOM
6378 case "$cccdlflags" in
6379 '') case "$gccversion" in
6380 '') case "$osname" in
6381 hpux) dflt='+z' ;;
6382 next) dflt='none' ;;
6383 irix*) dflt='-KPIC' ;;
48bcfe03 6384 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
6385 sunos) dflt='-pic' ;;
6386 *) dflt='none' ;;
6387 esac
6388 ;;
6389 *) case "$osname" in
48bcfe03 6390 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
6391 *) dflt='-fpic' ;;
6392 esac ;;
6393 esac ;;
6394 ' ') dflt='none' ;;
6395 *) dflt="$cccdlflags" ;;
6396 esac
6397 rp="Any special flags to pass to $cc -c to compile shared library modules?"
6398 . ./myread
6399 case "$ans" in
6400 none) cccdlflags=' ' ;;
6401 *) cccdlflags="$ans" ;;
6402 esac
6403
6404 cat << EOM
6405
6406Some systems use ld to create libraries that can be dynamically loaded,
6407while other systems (such as those using ELF) use $cc.
6408
6409EOM
6410 case "$ld" in
6411 '') $cat >try.c <<'EOM'
6412/* Test for whether ELF binaries are produced */
6413#include <fcntl.h>
6414#include <stdlib.h>
6415int main() {
6416 char b[4];
6417 int i = open("a.out",O_RDONLY);
6418 if(i == -1)
6419 exit(1); /* fail */
6420 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6421 exit(0); /* succeed (yes, it's ELF) */
6422 else
6423 exit(1); /* fail */
6424}
6425EOM
6426 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6427 cat <<EOM
6428You appear to have ELF support. I'll use $cc to build dynamic libraries.
6429EOM
6430 dflt="$cc"
6431 else
6432 echo "I'll use ld to build dynamic libraries."
6433 dflt='ld'
6434 fi
6435 rm -f try.c a.out
6436 ;;
6437 *) dflt="$ld"
6438 ;;
6439 esac
6440
6441 rp="What command should be used to create dynamic libraries?"
6442 . ./myread
6443 ld="$ans"
6444
6445 cat << EOM
6446
6447Some systems may require passing special flags to $ld to create a
6448library that can be dynamically loaded. If your ld flags include
6449-L/other/path options to locate libraries outside your loader's normal
6450search path, you may need to specify those -L options here as well. To
6451use no flags, say "none".
6452
6453EOM
6454 case "$lddlflags" in
6455 '') case "$osname" in
6456 beos) dflt='-nostart' ;;
6457 hpux) dflt='-b';
6458 case "$gccversion" in
6459 '') dflt="$dflt +vnocompatwarnings" ;;
6460 esac
6461 ;;
6462 linux|irix*) dflt='-shared' ;;
6463 next) dflt='none' ;;
6464 solaris) dflt='-G' ;;
6465 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 6466 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
6467 *) dflt='none' ;;
6468 esac
6469 ;;
6470 *) dflt="$lddlflags" ;;
6471 esac
6472
6473 : Try to guess additional flags to pick up local libraries.
6474 : Be careful not to append to a plain 'none'
6475 case "$dflt" in
6476 none) dflt='' ;;
6477 esac
6478 for thisflag in $ldflags; do
6479 case "$thisflag" in
6480 -L*|-R*)
6481 case " $dflt " in
6482 *" $thisflag "*) ;;
6483 *) dflt="$dflt $thisflag" ;;
6484 esac
6485 ;;
6486 esac
6487 done
6488
6489 case "$dflt" in
6490 ''|' ') dflt='none' ;;
6491 esac
6492
6493 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6494 . ./myread
6495 case "$ans" in
6496 none) lddlflags=' ' ;;
6497 *) lddlflags="$ans" ;;
6498 esac
6499
6500 cat <<EOM
6501
6502Some systems may require passing special flags to $cc to indicate that
6503the resulting executable will use dynamic linking. To use no flags,
6504say "none".
6505
6506EOM
6507 case "$ccdlflags" in
6508 '') case "$osname" in
6509 hpux) dflt='-Wl,-E' ;;
6510 linux) dflt='-rdynamic' ;;
6511 next) dflt='none' ;;
6512 sunos) dflt='none' ;;
6513 *) dflt='none' ;;
6514 esac ;;
6515 ' ') dflt='none' ;;
6516 *) dflt="$ccdlflags" ;;
6517 esac
6518 rp="Any special flags to pass to $cc to use dynamic linking?"
6519 . ./myread
6520 case "$ans" in
6521 none) ccdlflags=' ' ;;
6522 *) ccdlflags="$ans" ;;
6523 esac
6524 ;;
6525*) usedl="$undef"
6526 ld='ld'
6527 dlsrc='dl_none.xs'
6528 lddlflags=''
6529 ccdlflags=''
6530 ;;
6531esac
6532
6533also=''
6534case "$usedl" in
6535$undef)
6536 # No dynamic loading being used, so don't bother even to prompt.
6537 useshrplib='false'
6538 ;;
6539*) case "$useshrplib" in
6540 '') case "$osname" in
48bcfe03 6541 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
6542 dflt=y
6543 also='Building a shared libperl is required for dynamic loading to work on your system.'
6544 ;;
6545 next*)
6546 case "$osvers" in
6547 4*) dflt=y
6548 also='Building a shared libperl is needed for MAB support.'
6549 ;;
6550 *) dflt=n
6551 ;;
6552 esac
6553 ;;
6554 *) dflt=n
6555 ;;
6556 esac
6557 ;;
6558 $define|true|[Yy]*)
6559 dflt=y
6560 ;;
6561 *) dflt=n
6562 ;;
6563 esac
6564 $cat << EOM
6565
6566The perl executable is normally obtained by linking perlmain.c with
6567libperl${_a}, any static extensions (usually just DynaLoader), and
6568any other libraries needed on this system (such as -lm, etc.). Since
6569your system supports dynamic loading, it is probably possible to build
6570a shared libperl.$so. If you will have more than one executable linked
6571to libperl.$so, this will significantly reduce the size of each
6572executable, but it may have a noticeable affect on performance. The
6573default is probably sensible for your system.
6574$also
6575
6576EOM
6577 rp="Build a shared libperl.$so (y/n)"
6578 . ./myread
6579 case "$ans" in
6580 true|$define|[Yy]*)
6581 useshrplib='true' ;;
6582 *) useshrplib='false' ;;
6583 esac
6584 ;;
6585esac
6586
6587case "$useshrplib" in
6588true)
6589 case "$libperl" in
6590 '')
6591 # Figure out a good name for libperl.so. Since it gets stored in
6592 # a version-specific architecture-dependent library, the version
6593 # number isn't really that important, except for making cc/ld happy.
6594 #
6595 # A name such as libperl.so.3.1
6596 majmin="libperl.$so.$patchlevel.$subversion"
6597 # A name such as libperl.so.301
6598 majonly=`echo $patchlevel $subversion |
6599 $awk '{printf "%d%02d", $1, $2}'`
6600 majonly=libperl.$so.$majonly
6601 # I'd prefer to keep the os-specific stuff here to a minimum, and
6602 # rely on figuring it out from the naming of libc.
6603 case "${osname}${osvers}" in
6604 next4*)
6605 dflt=libperl.5.$so
6606 # XXX How handle the --version stuff for MAB?
6607 ;;
6608 linux*) # ld won't link with a bare -lperl otherwise.
6609 dflt=libperl.$so
6610 ;;
6611 cygwin*) # include version
6612 dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6613 ;;
6614 *) # Try to guess based on whether libc has major.minor.
6615 case "$libc" in
6616 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6617 *libc.$so.[0-9]*) dflt=$majonly ;;
6618 *) dflt=libperl.$so ;;
6619 esac
6620 ;;
6621 esac
6622 ;;
6623 *) dflt=$libperl
6624 ;;
6625 esac
6626 cat << EOM
6627
6628I need to select a good name for the shared libperl. If your system uses
6629library names with major and minor numbers, then you might want something
6630like $majmin. Alternatively, if your system uses a single version
6631number for shared libraries, then you might want to use $majonly.
6632Or, your system might be quite happy with a simple libperl.$so.
6633
6634Since the shared libperl will get installed into a version-specific
6635architecture-dependent directory, the version number of the shared perl
6636library probably isn't important, so the default should be o.k.
6637
6638EOM
6639 rp='What name do you want to give to the shared libperl?'
6640 . ./myread
6641 libperl=$ans
6642 echo "Ok, I'll use $libperl"
6643 ;;
6644*)
6645 libperl="libperl${_a}"
6646 ;;
6647esac
6648
6649# Detect old use of shrpdir via undocumented Configure -Dshrpdir
6650case "$shrpdir" in
6651'') ;;
6652*) $cat >&4 <<EOM
6653WARNING: Use of the shrpdir variable for the installation location of
6654the shared $libperl is not supported. It was never documented and
6655will not work in this version. Let me (perlbug@perl.org)
6656know of any problems this may cause.
6657
6658EOM
6659 case "$shrpdir" in
6660 "$archlibexp/CORE")
6661 $cat >&4 <<EOM
6662But your current setting of $shrpdir is
6663the default anyway, so it's harmless.
6664EOM
6665 ;;
6666 *)
6667 $cat >&4 <<EOM
6668Further, your current attempted setting of $shrpdir
6669conflicts with the value of $archlibexp/CORE
6670that installperl will use.
6671EOM
6672 ;;
6673 esac
6674 ;;
6675esac
6676
6677# How will the perl executable find the installed shared $libperl?
6678# Add $xxx to ccdlflags.
6679# If we can't figure out a command-line option, use $shrpenv to
6680# set env LD_RUN_PATH. The main perl makefile uses this.
6681shrpdir=$archlibexp/CORE
6682xxx=''
6683tmp_shrpenv=''
6684if "$useshrplib"; then
6685 case "$osname" in
6686 aix)
6687 # We'll set it in Makefile.SH...
6688 ;;
6689 solaris|netbsd)
6690 xxx="-R $shrpdir"
6691 ;;
6692 freebsd)
6693 xxx="-Wl,-R$shrpdir"
6694 ;;
6695 linux|irix*|dec_osf)
6696 xxx="-Wl,-rpath,$shrpdir"
6697 ;;
6698 next)
6699 # next doesn't like the default...
6700 ;;
6701 beos)
6702 # beos doesn't like the default, either.
6703 ;;
6704 hpux*)
6705 # hpux doesn't like the default, either.
6706 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6707 ;;
6708 *)
6709 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6710 ;;
6711 esac
6712 case "$xxx" in
6713 '') ;;
6714 *)
6715 # Only add $xxx if it isn't already in ccdlflags.
6716 case " $ccdlflags " in
6717 *" $xxx "*) ;;
6718 *) ccdlflags="$ccdlflags $xxx"
6719 cat <<EOM >&4
6720
6721Adding $xxx to the flags
6722passed to $ld so that the perl executable will find the
6723installed shared $libperl.
6724
6725EOM
6726 ;;
6727 esac
6728 ;;
6729 esac
6730fi
6731# Fix ccdlflags in AIX for building external extensions.
6732# (For building Perl itself bare -bE:perl.exp is needed,
6733# Makefile.SH takes care of this.)
6734case "$osname" in
6735aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6736esac
6737# Respect a hint or command-line value.
6738case "$shrpenv" in
6739'') shrpenv="$tmp_shrpenv" ;;
6740esac
6741case "$ldlibpthname" in
6742'') ldlibpthname=LD_LIBRARY_PATH ;;
6743none) ldlibpthname='' ;;
6744esac
6745
6746: determine where manual pages are on this system
6747echo " "
6748case "$sysman" in
6749'')
6750 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
6751 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
6752 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
6753 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6754 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
6755 sysman=`./loc . /usr/man/man1 $syspath`
6756 ;;
6757esac
6758if $test -d "$sysman"; then
6759 echo "System manual is in $sysman." >&4
6760else
6761 echo "Could not find manual pages in source form." >&4
6762fi
6763
6764: determine where manual pages go
6765set man1dir man1dir none
6766eval $prefixit
6767$cat <<EOM
6768
6769$spackage has manual pages available in source form.
6770EOM
6771case "$nroff" in
6772nroff)
6773 echo "However, you don't have nroff, so they're probably useless to you."
6774 case "$man1dir" in
6775 '') man1dir="none";;
6776 esac;;
6777esac
6778echo "If you don't want the manual sources installed, answer 'none'."
6779case "$man1dir" in
6780' ') dflt=none
6781 ;;
6782'')
6783 lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6784 lookpath="$lookpath $prefixexp/man/p_man/man1"
6785 lookpath="$lookpath $prefixexp/man/u_man/man1"
6786 lookpath="$lookpath $prefixexp/man/man.1"
6787 case "$sysman" in
6788 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6789 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6790 esac
6791 set dflt
6792 eval $prefixup
6793 ;;
6794*) dflt="$man1dir"
6795 ;;
6796esac
6797echo " "
6798fn=dn+~
6799rp="Where do the main $spackage manual pages (source) go?"
6800. ./getfile
6801if $test "X$man1direxp" != "X$ansexp"; then
6802 installman1dir=''
6803fi
6804man1dir="$ans"
6805man1direxp="$ansexp"
6806case "$man1dir" in
6807'') man1dir=' '
6808 installman1dir='';;
6809esac
6810
6811: Change installation prefix, if necessary.
6812if $test X"$prefix" != X"$installprefix"; then
6813 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6814else
6815 installman1dir="$man1direxp"
6816fi
6817
6818: What suffix to use on installed man pages
6819
6820case "$man1dir" in
6821' ')
6822 man1ext='0'
6823 ;;
6824*)
6825 rp="What suffix should be used for the main $spackage man pages?"
6826 case "$man1ext" in
6827 '') case "$man1dir" in
6828 *1) dflt=1 ;;
6829 *1p) dflt=1p ;;
6830 *1pm) dflt=1pm ;;
6831 *l) dflt=l;;
6832 *n) dflt=n;;
6833 *o) dflt=o;;
6834 *p) dflt=p;;
6835 *C) dflt=C;;
6836 *L) dflt=L;;
6837 *L1) dflt=L1;;
6838 *) dflt=1;;
6839 esac
6840 ;;
6841 *) dflt="$man1ext";;
6842 esac
6843 . ./myread
6844 man1ext="$ans"
6845 ;;
6846esac
6847
6848: see if we can have long filenames
6849echo " "
6850first=123456789abcdef
6851$rm -f $first
6852if (echo hi >$first) 2>/dev/null; then
6853 if $test -f 123456789abcde; then
6854 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
6855 val="$undef"
6856 else
6857 echo 'You can have filenames longer than 14 characters.'>&4
6858 val="$define"
6859 fi
6860else
6861 $cat <<'EOM'
6862You can't have filenames longer than 14 chars.
6863You can't even think about them!
6864EOM
6865 val="$undef"
6866fi
6867set d_flexfnam
6868eval $setvar
6869$rm -rf 123456789abcde*
6870
6871: determine where library module manual pages go
6872set man3dir man3dir none
6873eval $prefixit
6874$cat <<EOM
6875
6876$spackage has manual pages for many of the library modules.
6877EOM
6878
6879case "$nroff" in
6880nroff)
6881 $cat <<'EOM'
6882However, you don't have nroff, so they're probably useless to you.
6883EOM
6884 case "$man3dir" in
6885 '') man3dir="none";;
6886 esac;;
6887esac
6888
6889case "$d_flexfnam" in
6890undef)
6891 $cat <<'EOM'
6892However, your system can't handle the long file names like File::Basename.3.
6893EOM
6894 case "$man3dir" in
6895 '') man3dir="none";;
6896 esac;;
6897esac
6898
6899echo "If you don't want the manual sources installed, answer 'none'."
6900prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6901case "$man3dir" in
6902'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6903 if $test -d "$privlib/man/man3"; then
6904 cat <<EOM >&4
6905
6906WARNING: Previous versions of perl installed man3 pages into
6907$privlib/man/man3. This version will suggest a
6908new default of $dflt.
6909EOM
6910 tdflt=$dflt
6911 dflt='n'
6912 rp='Do you wish to preserve the old behavior?(y/n)'
6913 . ./myread
6914 case "$ans" in
6915 y*) dflt="$privlib/man/man3" ;;
6916 *) dflt=$tdflt ;;
6917 esac
6918 fi
6919 ;;
6920*) dflt="$man3dir" ;;
6921esac
6922case "$dflt" in
6923' ') dflt=none ;;
6924esac
6925echo " "
6926fn=dn+~
6927rp="Where do the $package library man pages (source) go?"
6928. ./getfile
6929man3dir="$ans"
6930man3direxp="$ansexp"
6931case "$man3dir" in
6932'') man3dir=' '
6933 installman3dir='';;
6934esac
6935
6936: Change installation prefix, if necessary.
6937if $test X"$prefix" != X"$installprefix"; then
6938 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6939else
6940 installman3dir="$man3direxp"
6941fi
6942
6943: What suffix to use on installed man pages
6944case "$man3dir" in
6945' ')
6946 man3ext='0'
6947 ;;
6948*)
6949 rp="What suffix should be used for the $package library man pages?"
6950 case "$man3ext" in
6951 '') case "$man3dir" in
6952 *3) dflt=3 ;;
6953 *3p) dflt=3p ;;
6954 *3pm) dflt=3pm ;;
6955 *l) dflt=l;;
6956 *n) dflt=n;;
6957 *o) dflt=o;;
6958 *p) dflt=p;;
6959 *C) dflt=C;;
6960 *L) dflt=L;;
6961 *L3) dflt=L3;;
6962 *) dflt=3;;
6963 esac
6964 ;;
6965 *) dflt="$man3ext";;
6966 esac
6967 . ./myread
6968 man3ext="$ans"
6969 ;;
6970esac
6971
6972: see if we have to deal with yellow pages, now NIS.
6973if $test -d /usr/etc/yp || $test -d /etc/yp; then
6974 if $test -f /usr/etc/nibindd; then
6975 echo " "
6976 echo "I'm fairly confident you're on a NeXT."
6977 echo " "
6978 rp='Do you get the hosts file via NetInfo?'
6979 dflt=y
6980 case "$hostcat" in
6981 nidump*) ;;
6982 '') ;;
6983 *) dflt=n;;
6984 esac
6985 . ./myread
6986 case "$ans" in
6987 y*) hostcat='nidump hosts .';;
6988 *) case "$hostcat" in
6989 nidump*) hostcat='';;
6990 esac
6991 ;;
6992 esac
6993 fi
6994 case "$hostcat" in
6995 nidump*) ;;
6996 *)
6997 case "$hostcat" in
6998 *ypcat*) dflt=y;;
6999 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7000 dflt=y
7001 else
7002 dflt=n
7003 fi;;
7004 *) dflt=n;;
7005 esac
7006 echo " "
7007 rp='Are you getting the hosts file via yellow pages?'
7008 . ./myread
7009 case "$ans" in
7010 y*) hostcat='ypcat hosts';;
7011 *) hostcat='cat /etc/hosts';;
7012 esac
7013 ;;
7014 esac
7015fi
7016case "$hostcat" in
7017'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7018esac
7019case "$groupcat" in
7020'') test -f /etc/group && groupcat='cat /etc/group';;
7021esac
7022case "$passcat" in
7023'') test -f /etc/passwd && passcat='cat /etc/passwd';;
7024esac
7025
7026: now get the host name
7027echo " "
7028echo "Figuring out host name..." >&4
7029case "$myhostname" in
7030'') cont=true
7031 echo 'Maybe "hostname" will work...'
7032 if tans=`sh -c hostname 2>&1` ; then
7033 myhostname=$tans
7034 phostname=hostname
7035 cont=''
7036 fi
7037 ;;
7038*) cont='';;
7039esac
7040if $test "$cont"; then
7041 if ./xenix; then
7042 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
7043 if tans=`cat /etc/systemid 2>&1` ; then
7044 myhostname=$tans
7045 phostname='cat /etc/systemid'
7046 echo "Whadyaknow. Xenix always was a bit strange..."
7047 cont=''
7048 fi
7049 elif $test -r /etc/systemid; then
7050 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7051 fi
7052fi
7053if $test "$cont"; then
7054 echo 'No, maybe "uuname -l" will work...'
7055 if tans=`sh -c 'uuname -l' 2>&1` ; then
7056 myhostname=$tans
7057 phostname='uuname -l'
7058 else
7059 echo 'Strange. Maybe "uname -n" will work...'
7060 if tans=`sh -c 'uname -n' 2>&1` ; then
7061 myhostname=$tans
7062 phostname='uname -n'
7063 else
7064 echo 'Oh well, maybe I can mine it out of whoami.h...'
7065 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7066 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7067 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7068 else
7069 case "$myhostname" in
7070 '') echo "Does this machine have an identity crisis or something?"
7071 phostname='';;
7072 *)
7073 echo "Well, you said $myhostname before..."
7074 phostname='echo $myhostname';;
7075 esac
7076 fi
7077 fi
7078 fi
7079fi
7080: you do not want to know about this
7081set $myhostname
7082myhostname=$1
7083
7084: verify guess
7085if $test "$myhostname" ; then
7086 dflt=y
7087 rp='Your host name appears to be "'$myhostname'".'" Right?"
7088 . ./myread
7089 case "$ans" in
7090 y*) ;;
7091 *) myhostname='';;
7092 esac
7093fi
7094
7095: bad guess or no guess
7096while $test "X$myhostname" = X ; do
7097 dflt=''
7098 rp="Please type the (one word) name of your host:"
7099 . ./myread
7100 myhostname="$ans"
7101done
7102
7103: translate upper to lower if necessary
7104case "$myhostname" in
7105*[A-Z]*)
7106 echo "(Normalizing case in your host name)"
7107 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7108 ;;
7109esac
7110
7111case "$myhostname" in
7112*.*)
7113 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7114 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7115 echo "(Trimming domain name from host name--host name is now $myhostname)"
7116 ;;
7117*) case "$mydomain" in
7118 '')
7119 {
7120 test "X$hostcat" = "Xypcat hosts" &&
7121 ypmatch "$myhostname" hosts 2>/dev/null |\
7122 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
7123 $test -s hosts
7124 } || {
7125 test "X$hostcat" != "X" &&
7126 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
7127 /[ ]$myhostname[ . ]/p" > hosts
7128 }
7129 tmp_re="[ . ]"
f08cbdd1
PP
7130 if $test -f hosts; then
7131 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 7132 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
7133 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7134 hosts | $sort | $uniq | \
7135 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7136 case `$echo X$dflt` in
7137 X*\ *) echo "(Several hosts in the database matched hostname)"
7138 dflt=.
7139 ;;
7140 X.) echo "(You do not have fully-qualified names in the hosts database)"
7141 ;;
7142 esac
7143 else
7144 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 7145 dflt=.
f08cbdd1 7146 fi
b4eb6b3d
JH
7147 case "$dflt" in
7148 .)
7149 tans=`./loc resolv.conf X /etc /usr/etc`
7150 if $test -f "$tans"; then
7151 echo "(Attempting domain name extraction from $tans)"
7152 dflt=.`$sed -n -e 's/ / /g' \
7153 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
7154 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7155 case "$dflt" in
7156 .) dflt=.`$sed -n -e 's/ / /g' \
7157 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
7158 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7159 ;;
7160 esac
7161 fi
7162 ;;
7163 esac
7164 case "$dflt" in
7165 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7166 dflt=.`sh -c domainname 2>/dev/null`
7167 case "$dflt" in
7168 '') dflt='.';;
7169 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7170 esac
7171 ;;
7172 esac
7173 case "$dflt" in
7174 .) echo "(Lost all hope -- silly guess then)"
7175 dflt='.uucp'
7176 ;;
7177 esac
7178 $rm -f hosts
7179 ;;
7180 *) dflt="$mydomain";;
7181 esac;;
7182esac
7183echo " "
7184rp="What is your domain name?"
7185. ./myread
7186tans="$ans"
7187case "$ans" in
7188'') ;;
7189.*) ;;
7190*) tans=".$tans";;
7191esac
7192mydomain="$tans"
7193
7194: translate upper to lower if necessary
7195case "$mydomain" in
7196*[A-Z]*)
7197 echo "(Normalizing case in your domain name)"
7198 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7199 ;;
7200esac
7201
7202: a little sanity check here
7203case "$phostname" in
7204'') ;;
7205*)
7206 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7207 $myhostname$mydomain|$myhostname) ;;
7208 *)
7209 case "$phostname" in
7210 sed*)
7211 echo "(That doesn't agree with your whoami.h file, by the way.)"
7212 ;;
7213 *)
7214 echo "(That doesn't agree with your $phostname command, by the way.)"
7215 ;;
7216 esac
7217 ;;
7218 esac
7219 ;;
7220esac
7221
7222$cat <<EOM
7223
7224I need to get your e-mail address in Internet format if possible, i.e.
7225something like user@host.domain. Please answer accurately since I have
7226no easy means to double check it. The default value provided below
7227is most probably close to reality but may not be valid from outside
7228your organization...
7229
7230EOM
7231cont=x
7232while test "$cont"; do
7233 case "$cf_email" in
7234 '') dflt="$cf_by@$myhostname$mydomain";;
7235 *) dflt="$cf_email";;
7236 esac
7237 rp='What is your e-mail address?'
7238 . ./myread
7239 cf_email="$ans"
7240 case "$cf_email" in
7241 *@*.*) cont='' ;;
7242 *)
7243 rp='Address does not look like an Internet one. Use it anyway?'
7244 case "$fastread" in
7245 yes) dflt=y ;;
7246 *) dflt=n ;;
7247 esac
7248 . ./myread
7249 case "$ans" in
7250 y*) cont='' ;;
7251 *) echo " " ;;
7252 esac
7253 ;;
7254 esac
7255done
7256
7257$cat <<EOM
7258
7259If you or somebody else will be maintaining perl at your site, please
7260fill in the correct e-mail address here so that they may be contacted
7261if necessary. Currently, the "perlbug" program included with perl
7262will send mail to this address in addition to perlbug@perl.org. You may
7263enter "none" for no administrator.
7264
7265EOM
7266case "$perladmin" in
7267'') dflt="$cf_email";;
7268*) dflt="$perladmin";;
7269esac
7270rp='Perl administrator e-mail address'
7271. ./myread
7272perladmin="$ans"
7273
674912d7
RB
7274: determine whether to only install version-specific parts.
7275echo " "
7276$cat <<EOM
7277Do you want to install only the version-specific parts of the perl
7278distribution? Usually you do *not* want to do this.
7279EOM
7280case "$versiononly" in
7281"$define"|[Yy]*|true) dflt='y' ;;
7282*) dflt='n';
7283esac
7284rp="Do you want to install only the version-specific parts of perl?"
7285. ./myread
7286case "$ans" in
7287[yY]*) val="$define";;
7288*) val="$undef" ;;
7289esac
7290set versiononly
7291eval $setvar
7292
b4eb6b3d
JH
7293: figure out how to guarantee perl startup
7294case "$startperl" in
7295'')
7296 case "$sharpbang" in
7297 *!)
7298 $cat <<EOH
7299
7300I can use the #! construct to start perl on your system. This will
7301make startup of perl scripts faster, but may cause problems if you
7302want to share those scripts and perl is not in a standard place
7303($binexp/perl) on all your platforms. The alternative is to force
7304a shell by starting the script with a single ':' character.
7305
7306EOH
674912d7
RB
7307 case "$versiononly" in
7308 "$define") dflt="$binexp/perl$version";;
7309 *) dflt="$binexp/perl";;
7310 esac
b4eb6b3d
JH
7311 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7312 . ./myread
7313 case "$ans" in
7314 none) startperl=": # use perl";;
7315 *) startperl="#!$ans"
7316 if $test 30 -lt `echo "$ans" | wc -c`; then
7317 $cat >&4 <<EOM
7318
7319WARNING: Some systems limit the #! command to 32 characters.
7320If you experience difficulty running Perl scripts with #!, try
7321installing Perl in a directory with a shorter pathname.
7322
7323EOM
7324 fi ;;
7325 esac
7326 ;;
7327 *) startperl=": # use perl"
7328 ;;
7329 esac
7330 ;;
7331esac
7332echo "I'll use $startperl to start perl scripts."
7333
7334: figure best path for perl in scripts
7335case "$perlpath" in
7336'')
7337 perlpath="$binexp/perl"
7338 case "$startperl" in
7339 *!*) ;;
7340 *)
7341 $cat <<EOH
7342
7343I will use the "eval 'exec'" idiom to start Perl on your system.
7344I can use the full path of your Perl binary for this purpose, but
7345doing so may cause problems if you want to share those scripts and
7346Perl is not always in a standard place ($binexp/perl).
7347
7348EOH
7349 dflt="$binexp/perl"
7350 rp="What path shall I use in \"eval 'exec'\"?"
7351 . ./myread
7352 perlpath="$ans"
7353 ;;
7354 esac
7355 ;;
7356esac
7357case "$startperl" in
7358*!*) ;;
7359*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7360esac
7361
7362: determine where public executable scripts go
7363set scriptdir scriptdir
7364eval $prefixit
7365case "$scriptdir" in
7366'')
7367 dflt="$bin"
7368 : guess some guesses
7369 $test -d /usr/share/scripts && dflt=/usr/share/scripts
7370 $test -d /usr/share/bin && dflt=/usr/share/bin
7371 $test -d /usr/local/script && dflt=/usr/local/script
7372 $test -d /usr/local/scripts && dflt=/usr/local/scripts
7373 $test -d $prefixexp/script && dflt=$prefixexp/script
7374 set dflt
7375 eval $prefixup
7376 ;;
7377*) dflt="$scriptdir"
7378 ;;
7379esac
7380$cat <<EOM
7381
7382Some installations have a separate directory just for executable scripts so
7383that they can mount it across multiple architectures but keep the scripts in
7384one spot. You might, for example, have a subdirectory of /usr/share for this.
7385Or you might just lump your scripts in with all your other executables.
7386
7387EOM
7388fn=d~
7389rp='Where do you keep publicly executable scripts?'
7390. ./getfile
7391if $test "X$ansexp" != "X$scriptdirexp"; then
7392 installscript=''
7393fi
7394scriptdir="$ans"
7395scriptdirexp="$ansexp"
7396: Change installation prefix, if necessary.
7397if $test X"$prefix" != X"$installprefix"; then
7398 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7399else
7400 installscript="$scriptdirexp"
7401fi
7402
7403: determine where add-on public executables go
7404case "$sitebin" in
7405'') dflt=$siteprefix/bin ;;
7406*) dflt=$sitebin ;;
7407esac
7408fn=d~
7409rp='Pathname where the add-on public executables should be installed?'
7410. ./getfile
7411sitebin="$ans"
7412sitebinexp="$ansexp"
7413: Change installation prefix, if necessary.
7414if $test X"$prefix" != X"$installprefix"; then
7415 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7416else
7417 installsitebin="$sitebinexp"
7418fi
7419
7420case "$useperlio" in
7421$define|true|[yY]*) dflt='y';;
7422*) dflt='n';;
7423esac
7424cat <<EOM
7425
7426Previous version of $package used the standard IO mechanisms as defined
7427in <stdio.h>. Versions 5.003_02 and later of perl allow alternate IO
7428mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7429the default. This abstraction layer can use AT&T's sfio (if you already
7430have sfio installed) or regular stdio. Using PerlIO with sfio may cause
7431problems with some extension modules. Using PerlIO with stdio is safe,
7432but it is slower than plain stdio and therefore is not the default.
7433
7434If this doesn't make any sense to you, just accept the default '$dflt'.
7435EOM
7436rp='Use the experimental PerlIO abstraction layer?'
7437. ./myread
7438case "$ans" in
7439y|Y)
7440 val="$define"
7441 ;;
7442*)
7443 echo "Ok, doing things the stdio way"
7444 val="$undef"
7445 ;;
7446esac
7447set useperlio
7448eval $setvar
7449
7450case "$vendorprefix" in
7451'') d_vendorbin="$undef"
7452 vendorbin=''
7453 vendorbinexp=''
7454 ;;
7455*) d_vendorbin="$define"
7456 : determine where vendor-supplied executables go.
7457 case "$vendorbin" in
7458 '') dflt=$vendorprefix/bin ;;
7459 *) dflt="$vendorbin" ;;
7460 esac
7461 fn=d~+
7462 rp='Pathname for the vendor-supplied executables directory?'
7463 . ./getfile
7464 vendorbin="$ans"
7465 vendorbinexp="$ansexp"
7466 ;;
7467esac
7468: Change installation prefix, if necessary.
7469if $test X"$prefix" != X"$installprefix"; then
7470 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7471else
7472 installvendorbin="$vendorbinexp"
7473fi
7474
7475: see if qgcvt exists
7476set qgcvt d_qgcvt
7477eval $inlibc
7478
7479echo " "
7480
7481if $test X"$d_longdbl" = X"$define"; then
7482
7483echo "Checking how to print long doubles..." >&4
7484
7485if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7486 $cat >try.c <<'EOCP'
7487#include <sys/types.h>
7488#include <stdio.h>
7489int main() {
7490 double d = 123.456;
7491 printf("%.3f\n", d);
7492}
7493EOCP
7494 set try
7495 if eval $compile; then
7496 yyy=`./try$exe_ext`
7497 case "$yyy" in
7498 123.456)
7499 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7500 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7501 echo "We will use %f."
7502 ;;
7503 esac
7504 fi
7505fi
7506
7507if $test X"$sPRIfldbl" = X; then
7508 $cat >try.c <<'EOCP'
7509#include <sys/types.h>
7510#include <stdio.h>
7511int main() {
7512 long double d = 123.456;
7513 printf("%.3llf\n", d);
7514}
7515EOCP
7516 set try
7517 if eval $compile; then
7518 yyy=`./try$exe_ext`
7519 case "$yyy" in
7520 123.456)
7521 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7522 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7523 echo "We will use %llf."
7524 ;;
7525 esac
7526 fi
7527fi
7528
7529if $test X"$sPRIfldbl" = X; then
7530 $cat >try.c <<'EOCP'
7531#include <sys/types.h>
7532#include <stdio.h>
7533int main() {
7534 long double d = 123.456;
7535 printf("%.3Lf\n", d);
7536}
7537EOCP
7538 set try
7539 if eval $compile; then
7540 yyy=`./try$exe_ext`
7541 case "$yyy" in
7542 123.456)
7543 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7544 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7545 echo "We will use %Lf."
7546 ;;
7547 esac
7548 fi
7549fi
7550
7551if $test X"$sPRIfldbl" = X; then
7552 $cat >try.c <<'EOCP'
7553#include <sys/types.h>
7554#include <stdio.h>
7555int main() {
7556 long double d = 123.456;
7557 printf("%.3lf\n", d);
7558}
7559EOCP
7560 set try
7561 if eval $compile; then
7562 yyy=`./try$exe_ext`
7563 case "$yyy" in
7564 123.456)
7565 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7566 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7567 echo "We will use %lf."
7568 ;;
7569 esac
7570 fi
7571fi
7572
7573if $test X"$sPRIfldbl" = X; then
7574 echo "Cannot figure out how to print long doubles." >&4
7575else
7576 sSCNfldbl=$sPRIfldbl # expect consistency
7577fi
7578
7579$rm -f try try.*
7580
7581fi # d_longdbl
7582
7583case "$sPRIfldbl" in
7584'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
7585 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
7586 d_SCNfldbl="$undef";
7587 ;;
7588*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
7589 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
7590 d_SCNfldbl="$define";
7591 ;;
7592esac
7593
7594: Check how to convert floats to strings.
7595echo " "
7596echo "Checking for an efficient way to convert floats to strings."
7597echo " " > try.c
7598case "$uselongdouble" in
7599"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7600esac
7601case "$d_longdbl" in
7602"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7603esac
7604case "$d_PRIgldbl" in
7605"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
7606esac
7607$cat >>try.c <<EOP
7608#ifdef TRY_gconvert
7609#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7610char *myname = "gconvert";
7611#endif
7612#ifdef TRY_gcvt
7613#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7614char *myname = "gcvt";
7615#endif
7616#ifdef TRY_qgcvt
7617#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7618char *myname = "qgcvt";
7619#define DOUBLETYPE long double
7620#endif
7621#ifdef TRY_sprintf
7622#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7623#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7624#else
7625#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7626#endif
7627char *myname = "sprintf";
7628#endif
7629
7630#ifndef DOUBLETYPE
7631#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7632#define DOUBLETYPE long double
7633#else
7634#define DOUBLETYPE double
7635#endif
7636#endif
7637
7638#include <stdio.h>
7639
7640#define I_STDLIB $i_stdlib
7641#ifdef I_STDLIB
7642#include <stdlib.h>
7643#endif
7644
7645int
7646checkit(expect, got)
7647char *expect;
7648char *got;
7649{
7650 if (strcmp(expect, got)) {
7651 printf("%s oddity: Expected %s, got %s\n",
7652 myname, expect, got);
7653 exit(1);
7654 }
7655}
7656
7657int main()
7658{
7659 char buf[64];
7660 buf[63] = '\0';
7661
7662 /* This must be 1st test on (which?) platform */
7663 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7664 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7665 checkit("0.1", buf);
7666
7667 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
7668 checkit("1", buf);
7669
7670 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
7671 checkit("1.1", buf);
7672
7673 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
7674 checkit("1.01", buf);
7675
7676 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
7677 checkit("1.001", buf);
7678
7679 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
7680 checkit("1.0001", buf);
7681
7682 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
7683 checkit("1.00001", buf);
7684
7685 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
7686 checkit("1.000001", buf);
7687
7688 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
7689 checkit("0", buf);
7690
7691 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
7692 checkit("-1", buf);
7693
7694 /* Some Linux gcvt's give 1.e+5 here. */
7695 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
7696 checkit("100000", buf);
7697
7698 /* Some Linux gcvt's give -1.e+5 here. */
7699 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
7700 checkit("-100000", buf);
7701
7702 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
7703 checkit("123.456", buf);
7704
7705 exit(0);
7706}
7707EOP
7708case "$d_Gconvert" in
7709gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7710gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7711sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7712*) xxx_list='gconvert gcvt sprintf' ;;
7713esac
7714
7715case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7716"$define$define$define")
7717 # for long doubles prefer first qgcvt, then sprintf
7718 xxx_list="`echo $xxx_list|sed s/sprintf//`"
7719 xxx_list="sprintf $xxx_list"
7720 case "$d_qgcvt" in
7721 "$define") xxx_list="qgcvt $xxx_list" ;;
7722 esac
7723 ;;
7724esac
7725
7726for xxx_convert in $xxx_list; do
7727 echo "Trying $xxx_convert..."
7728 $rm -f try try$_o
7729 set try -DTRY_$xxx_convert
7730 if eval $compile; then
7731 echo "$xxx_convert() found." >&4
7732 if ./try; then
7733 echo "I'll use $xxx_convert to convert floats into a string." >&4
7734 break;
7735 else
7736 echo "...But $xxx_convert didn't work as I expected."
7737 fi
7738 else
7739 echo "$xxx_convert NOT found." >&4
7740 fi
7741done
7742
7743case "$xxx_convert" in
7744gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7745gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7746qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7747*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7748 "$define$define$define")
7749 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7750 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7751 esac
7752 ;;
7753esac
7754
7755: Initialize h_fcntl
7756h_fcntl=false
7757
7758: Initialize h_sysfile
7759h_sysfile=false
7760
7761: access call always available on UNIX
7762set access d_access
7763eval $inlibc
7764
7765: locate the flags for 'access()'
7766case "$d_access" in
7767"$define")
7768 echo " "
7769 $cat >access.c <<'EOCP'
7770#include <sys/types.h>
7771#ifdef I_FCNTL
7772#include <fcntl.h>
7773#endif
7774#ifdef I_SYS_FILE
7775#include <sys/file.h>
7776#endif
7777#ifdef I_UNISTD
7778#include <unistd.h>
7779#endif
7780int main() {
7781 exit(R_OK);
7782}
7783EOCP
7784 : check sys/file.h first, no particular reason here
7785 if $test `./findhdr sys/file.h` && \
7a282f6d 7786 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
7787 h_sysfile=true;
7788 echo "<sys/file.h> defines the *_OK access constants." >&4
7789 elif $test `./findhdr fcntl.h` && \
7a282f6d 7790 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
7791 h_fcntl=true;
7792 echo "<fcntl.h> defines the *_OK access constants." >&4
7793 elif $test `./findhdr unistd.h` && \
7a282f6d 7794 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
7795 echo "<unistd.h> defines the *_OK access constants." >&4
7796 else
7797 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7798 fi
7799 ;;
7800esac
7801$rm -f access*
7802
7803: see if accessx exists
7804set accessx d_accessx
7805eval $inlibc
7806
7807: see if alarm exists
7808set alarm d_alarm
7809eval $inlibc
7810
7811: see if atolf exists
7812set atolf d_atolf
7813eval $inlibc
7814
7815: see if atoll exists
7816set atoll d_atoll
7817eval $inlibc
7818
7819: Look for GNU-cc style attribute checking
7820echo " "
7821echo "Checking whether your compiler can handle __attribute__ ..." >&4
7822$cat >attrib.c <<'EOCP'
7823#include <stdio.h>
7824void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7825EOCP
7826if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7827 if $contains 'warning' attrib.out >/dev/null 2>&1; then
7828 echo "Your C compiler doesn't fully support __attribute__."
7829 val="$undef"
7830 else
7831 echo "Your C compiler supports __attribute__."
7832 val="$define"
7833 fi
7834else
7835 echo "Your C compiler doesn't seem to understand __attribute__ at all."
7836 val="$undef"
7837fi
7838set d_attribut
7839eval $setvar
7840$rm -f attrib*
7841
7842: see if bcmp exists
7843set bcmp d_bcmp
7844eval $inlibc
7845
7846: see if bcopy exists
7847set bcopy d_bcopy
7848eval $inlibc
7849
7850: see if this is a unistd.h system
7851set unistd.h i_unistd
7852eval $inhdr
7853
7854: see if getpgrp exists
7855set getpgrp d_getpgrp
7856eval $inlibc
7857
7858case "$d_getpgrp" in
7859"$define")
7860 echo " "
7861 echo "Checking to see which flavor of getpgrp is in use..."
7862 $cat >set.c <<EOP
7863#$i_unistd I_UNISTD
7864#include <sys/types.h>
7865#ifdef I_UNISTD
7866# include <unistd.h>
7867#endif
7868int main()
7869{
7870 if (getuid() == 0) {
7871 printf("(I see you are running Configure as super-user...)\n");
7872 setuid(1);
7873 }
7874#ifdef TRY_BSD_PGRP
7875 if (getpgrp(1) == 0)
7876 exit(0);
7877#else
7878 if (getpgrp() > 0)
7879 exit(0);
7880#endif
7881 exit(1);
7882}
7883EOP
7a282f6d 7884 if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
7885 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7886 val="$define"
7a282f6d 7887 elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
7888 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7889 val="$undef"
7890 else
7891 echo "I can't seem to compile and run the test program."
7892 if ./usg; then
7893 xxx="a USG one, i.e. you use getpgrp()."
7894 else
7895 # SVR4 systems can appear rather BSD-ish.
7896 case "$i_unistd" in
7897 $undef)
7898 xxx="a BSD one, i.e. you use getpgrp(pid)."
7899 val="$define"
7900 ;;
7901 $define)
7902 xxx="probably a USG one, i.e. you use getpgrp()."
7903 val="$undef"
7904 ;;
7905 esac
7906 fi
7907 echo "Assuming your getpgrp is $xxx" >&4
7908 fi
7909 ;;
7910*) val="$undef";;
7911esac
7912set d_bsdgetpgrp
7913eval $setvar
7914$rm -f set set.c
7915
7916: see if setpgrp exists
7917set setpgrp d_setpgrp
7918eval $inlibc
7919
7920case "$d_setpgrp" in
7921"$define")
7922 echo " "
7923 echo "Checking to see which flavor of setpgrp is in use..."
7924 $cat >set.c <<EOP
7925#$i_unistd I_UNISTD
7926#include <sys/types.h>
7927#ifdef I_UNISTD
7928# include <unistd.h>
7929#endif
7930int main()
7931{
7932 if (getuid() == 0) {
7933 printf("(I see you are running Configure as super-user...)\n");
7934 setuid(1);
7935 }
7936#ifdef TRY_BSD_PGRP
7937 if (-1 == setpgrp(1, 1))
7938 exit(0);
7939#else
7940 if (setpgrp() != -1)
7941 exit(0);
7942#endif
7943 exit(1);
7944}
7945EOP
7a282f6d 7946 if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
7947 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7948 val="$define"
7a282f6d 7949 elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
b4eb6b3d
JH
7950 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7951 val="$undef"
7952 else
7953 echo "(I can't seem to compile and run the test program.)"
7954 if ./usg; then
7955 xxx="a USG one, i.e. you use setpgrp()."
7956 else
7957 # SVR4 systems can appear rather BSD-ish.
7958 case "$i_unistd" in
7959 $undef)
7960 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7961 val="$define"
7962 ;;
7963 $define)
7964 xxx="probably a USG one, i.e. you use setpgrp()."
7965 val="$undef"
7966 ;;
7967 esac
7968 fi
7969 echo "Assuming your setpgrp is $xxx" >&4
7970 fi
7971 ;;
7972*) val="$undef";;
7973esac
7974set d_bsdsetpgrp
7975eval $setvar
7976$rm -f set set.c
7977: see if bzero exists
7978set bzero d_bzero
7979eval $inlibc
7980
7981: see if signal is declared as pointer to function returning int or void
7982echo " "
7983xxx=`./findhdr signal.h`
7984$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7985if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
7986 echo "You have int (*signal())() instead of void." >&4
7987 val="$undef"
7988elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
7989 echo "You have void (*signal())()." >&4
7990 val="$define"
7991elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7992 echo "You have int (*signal())() instead of void." >&4
7993 val="$undef"
7994elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7995 echo "You have void (*signal())()." >&4
7996 val="$define"
7997else
7998 case "$d_voidsig" in
7999 '')
8000 echo "I can't determine whether signal handler returns void or int..." >&4
8001 dflt=void
8002 rp="What type does your signal handler return?"
8003 . ./myread
8004 case "$ans" in
8005 v*) val="$define";;
8006 *) val="$undef";;
8007 esac;;
8008 "$define")
8009 echo "As you already told me, signal handler returns void." >&4
8010 val="$define"
8011 ;;
8012 *) echo "As you already told me, signal handler returns int." >&4
8013 val="$undef"
8014 ;;
8015 esac
8016fi
8017set d_voidsig
8018eval $setvar
8019case "$d_voidsig" in
8020"$define") signal_t="void";;
8021*) signal_t="int";;
8022esac
8023$rm -f $$.tmp
8024
8025: check for ability to cast large floats to 32-bit ints.
8026echo " "
8027echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8028if $test "$intsize" -ge 4; then
8029 xxx=int
8030else
8031 xxx=long
8032fi
8033$cat >try.c <<EOCP
8034#include <stdio.h>
8035#include <sys/types.h>
8036#include <signal.h>
8037$signal_t blech(s) int s; { exit(3); }
8038int main()
8039{
8040 $xxx i32;
8041 double f, g;
8042 int result = 0;
8043 char str[16];
8044 signal(SIGFPE, blech);
8045
8046 /* Don't let compiler optimize the test away. Store the number
8047 in a writable string for gcc to pass to sscanf under HP/UX.
8048 */
8049 sprintf(str, "2147483647");
8050 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8051 g = 10 * f;
8052 i32 = ($xxx) g;
8053
8054 /* x86 processors will probably give 0x8000 0000, which is a
8055 sign change. We don't want that. We want to mimic SPARC
8056 behavior here, which is to preserve the sign and give
8057 back 0x7fff ffff.
8058 */
8059 if (i32 != ($xxx) f)
8060 result |= 1;
8061 exit(result);
8062}
8063EOCP
8064set try
8065if eval $compile_ok; then
8066 ./try
8067 yyy=$?
8068else
8069 echo "(I can't seem to compile the test program--assuming it can't)"
8070 yyy=1
8071fi
8072case "$yyy" in
80730) val="$define"
8074 echo "Yup, it can."
8075 ;;
8076*) val="$undef"
8077 echo "Nope, it can't."
8078 ;;
8079esac
8080set d_casti32
8081eval $setvar
8082$rm -f try try.*
8083
8084: check for ability to cast negative floats to unsigned
8085echo " "
8086echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8087$cat >try.c <<EOCP
8088#include <stdio.h>
8089#include <sys/types.h>
8090#include <signal.h>
8091$signal_t blech(s) int s; { exit(7); }
8092$signal_t blech_in_list(s) int s; { exit(4); }
8093unsigned long dummy_long(p) unsigned long p; { return p; }
8094unsigned int dummy_int(p) unsigned int p; { return p; }
8095unsigned short dummy_short(p) unsigned short p; { return p; }
8096int main()
8097{
8098 double f;
8099 unsigned long along;
8100 unsigned int aint;
8101 unsigned short ashort;
8102 int result = 0;
8103 char str[16];
8104
8105 /* Frustrate gcc-2.7.2's optimizer which failed this test with
8106 a direct f = -123. assignment. gcc-2.8.0 reportedly
8107 optimized the whole file away
8108 */
8109 /* Store the number in a writable string for gcc to pass to
8110 sscanf under HP/UX.
8111 */
8112 sprintf(str, "-123");
8113 sscanf(str, "%lf", &f); /* f = -123.; */
8114
8115 signal(SIGFPE, blech);
8116 along = (unsigned long)f;
8117 aint = (unsigned int)f;
8118 ashort = (unsigned short)f;
8119 if (along != (unsigned long)-123)
8120 result |= 1;
8121 if (aint != (unsigned int)-123)
8122 result |= 1;
8123 if (ashort != (unsigned short)-123)
8124 result |= 1;
8125 sprintf(str, "1073741824.");
8126 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8127 f = f + f;
8128 along = 0;
8129 along = (unsigned long)f;
8130 if (along != 0x80000000)
8131 result |= 2;
8132 f -= 1.;
8133 along = 0;
8134 along = (unsigned long)f;
8135 if (along != 0x7fffffff)
8136 result |= 1;
8137 f += 2.;
8138 along = 0;
8139 along = (unsigned long)f;
8140 if (along != 0x80000001)
8141 result |= 2;
8142 if (result)
8143 exit(result);
8144 signal(SIGFPE, blech_in_list);
8145 sprintf(str, "123.");
8146 sscanf(str, "%lf", &f); /* f = 123.; */
8147 along = dummy_long((unsigned long)f);
8148 aint = dummy_int((unsigned int)f);
8149 ashort = dummy_short((unsigned short)f);
8150 if (along != (unsigned long)123)
8151 result |= 4;
8152 if (aint != (unsigned int)123)
8153 result |= 4;
8154 if (ashort != (unsigned short)123)
8155 result |= 4;
8156 exit(result);
8157
8158}
8159EOCP
8160set try
8161if eval $compile_ok; then
8162 ./try
8163 castflags=$?
8164else
8165 echo "(I can't seem to compile the test program--assuming it can't)"
8166 castflags=7
8167fi
8168case "$castflags" in
81690) val="$define"
8170 echo "Yup, it can."
8171 ;;
8172*) val="$undef"
8173 echo "Nope, it can't."
8174 ;;
8175esac
8176set d_castneg
8177eval $setvar
8178$rm -f try.*
8179
8180: see if vprintf exists
8181echo " "
8182if set vprintf val -f d_vprintf; eval $csym; $val; then
8183 echo 'vprintf() found.' >&4
8184 val="$define"
8185 $cat >vprintf.c <<'EOF'
8186#include <varargs.h>
8187
8188int main() { xxx("foo"); }
8189
8190xxx(va_alist)
8191va_dcl
8192{
8193 va_list args;
8194 char buf[10];
8195
8196 va_start(args);
8197 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8198}
8199EOF
8200 set vprintf
8201 if eval $compile && ./vprintf; then
8202 echo "Your vsprintf() returns (int)." >&4
8203 val2="$undef"
8204 else
8205 echo "Your vsprintf() returns (char*)." >&4
8206 val2="$define"
8207 fi
8208else
8209 echo 'vprintf() NOT found.' >&4
8210 val="$undef"
8211 val2="$undef"
8212fi
8213set d_vprintf
8214eval $setvar
8215val=$val2
8216set d_charvspr
8217eval $setvar
8218
8219: see if chown exists
8220set chown d_chown
8221eval $inlibc
8222
8223: see if chroot exists
8224set chroot d_chroot
8225eval $inlibc
8226
8227: see if chsize exists
8228set chsize d_chsize
8229eval $inlibc
8230
8231: check for const keyword
8232echo " "
8233echo 'Checking to see if your C compiler knows about "const"...' >&4
8234$cat >const.c <<'EOCP'
8235typedef struct spug { int drokk; } spug;
8236int main()
8237{
8238 const char *foo;
8239 const spug y;
8240}
8241EOCP
8242if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8243 val="$define"
8244 echo "Yup, it does."
8245else
8246 val="$undef"
8247 echo "Nope, it doesn't."
8248fi
8249set d_const
8250eval $setvar
8251
8252: see if crypt exists
8253echo " "
8254if set crypt val -f d_crypt; eval $csym; $val; then
8255 echo 'crypt() found.' >&4
8256 val="$define"
8257 cryptlib=''
8258else
8259 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8260 if $test -z "$cryptlib"; then
8261 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8262 else
8263 cryptlib=-lcrypt
8264 fi
8265 if $test -z "$cryptlib"; then
8266 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8267 else
8268 cryptlib=-lcrypt
8269 fi
8270 if $test -z "$cryptlib"; then
8271 cryptlib=`./loc libcrypt$_a "" $libpth`
8272 else
8273 cryptlib=-lcrypt
8274 fi
8275 if $test -z "$cryptlib"; then
8276 echo 'crypt() NOT found.' >&4
8277 val="$undef"
8278 else
8279 val="$define"
8280 fi
8281fi
8282set d_crypt
8283eval $setvar
8284
8285: get csh whereabouts
8286case "$csh" in
8287'csh') val="$undef" ;;
8288*) val="$define" ;;
8289esac
8290set d_csh
8291eval $setvar
8292: Respect a hint or command line value for full_csh.
8293case "$full_csh" in
8294'') full_csh=$csh ;;
8295esac
8296
8297: see if cuserid exists
8298set cuserid d_cuserid
8299eval $inlibc
8300
8301: see if this is a limits.h system
8302set limits.h i_limits
8303eval $inhdr
8304
8305: see if this is a float.h system
8306set float.h i_float
8307eval $inhdr
8308
8309: See if number of significant digits in a double precision number is known
8310echo " "
8311$cat >dbl_dig.c <<EOM
8312#$i_limits I_LIMITS
8313#$i_float I_FLOAT
8314#ifdef I_LIMITS
8315#include <limits.h>
8316#endif
8317#ifdef I_FLOAT
8318#include <float.h>
8319#endif
8320#ifdef DBL_DIG
8321printf("Contains DBL_DIG");
8322#endif
8323EOM
8324$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8325if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8326 echo "DBL_DIG found." >&4
8327 val="$define"
8328else
8329 echo "DBL_DIG NOT found." >&4
8330 val="$undef"
8331fi
8332$rm -f dbl_dig.?
8333set d_dbl_dig
8334eval $setvar
8335
8336: see if difftime exists
8337set difftime d_difftime
8338eval $inlibc
8339
8340: see if this is a dirent system
8341echo " "
8342if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8343 val="$define"
8344 echo "<dirent.h> found." >&4
8345else
8346 val="$undef"
8347 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8348 echo "<sys/dir.h> found." >&4
8349 echo " "
8350 else
8351 xinc=`./findhdr sys/ndir.h`
8352 fi
8353 echo "<dirent.h> NOT found." >&4
8354fi
8355set i_dirent
8356eval $setvar
8357
8358: Look for type of directory structure.
8359echo " "
8360$cppstdin $cppflags $cppminus < "$xinc" > try.c
8361
8362case "$direntrytype" in
8363''|' ')
8364 case "$i_dirent" in
8365 $define) guess1='struct dirent' ;;
8366 *) guess1='struct direct' ;;
8367 esac
8368 ;;
8369*) guess1="$direntrytype"
8370 ;;
8371esac
8372
8373case "$guess1" in
8374'struct dirent') guess2='struct direct' ;;
8375*) guess2='struct dirent' ;;
8376esac
8377
8378if $contains "$guess1" try.c >/dev/null 2>&1; then
8379 direntrytype="$guess1"
8380 echo "Your directory entries are $direntrytype." >&4
8381elif $contains "$guess2" try.c >/dev/null 2>&1; then
8382 direntrytype="$guess2"
8383 echo "Your directory entries seem to be $direntrytype." >&4
8384else
8385 echo "I don't recognize your system's directory entries." >&4
8386 rp="What type is used for directory entries on this system?"
8387 dflt="$guess1"
8388 . ./myread
8389 direntrytype="$ans"
8390fi
8391$rm -f try.c
8392
8393
8394: see if the directory entry stores field length
8395echo " "
8396$cppstdin $cppflags $cppminus < "$xinc" > try.c
8397if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8398 echo "Good, your directory entry keeps length information in d_namlen." >&4
8399 val="$define"
8400else
8401 echo "Your directory entry does not know about the d_namlen field." >&4
8402 val="$undef"
8403fi
8404set d_dirnamlen
8405eval $setvar
8406$rm -f try.c
8407
8408: see if dlerror exists
8409xxx_runnm="$runnm"
8410runnm=false
8411set dlerror d_dlerror
8412eval $inlibc
8413runnm="$xxx_runnm"
8414
8415: see if dlfcn is available
8416set dlfcn.h i_dlfcn
8417eval $inhdr
8418
8419case "$usedl" in
8420$define|y|true)
8421 $cat << EOM
8422
8423On a few systems, the dynamically loaded modules that perl generates and uses
8424will need a different extension than shared libs. The default will probably
8425be appropriate.
8426
8427EOM
8428 case "$dlext" in
8429 '') dflt="$so" ;;
8430 *) dflt="$dlext" ;;
8431 esac
8432 rp='What is the extension of dynamically loaded modules'
8433 . ./myread
8434 dlext="$ans"
8435 ;;
8436*)
8437 dlext="none"
8438 ;;
8439esac
8440
8441: Check if dlsym need a leading underscore
8442echo " "
8443val="$undef"
8444
8445case "$dlsrc" in
8446dl_dlopen.xs)
8447 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8448 $cat >dyna.c <<'EOM'
8449fred () { }
8450EOM
8451
8452$cat >fred.c<<EOM
8453
8454#include <stdio.h>
8455#$i_dlfcn I_DLFCN
8456#ifdef I_DLFCN
8457#include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
8458#else
8459#include <sys/types.h>
8460#include <nlist.h>
8461#include <link.h>
8462#endif
8463
8464extern int fred() ;
8465
8466int main()
8467{
8468 void * handle ;
8469 void * symbol ;
8470#ifndef RTLD_LAZY
8471 int mode = 1 ;
8472#else
8473 int mode = RTLD_LAZY ;
8474#endif
8475 handle = dlopen("./dyna.$dlext", mode) ;
8476 if (handle == NULL) {
8477 printf ("1\n") ;
8478 fflush (stdout) ;
8479 exit(0);
8480 }
8481 symbol = dlsym(handle, "fred") ;
8482 if (symbol == NULL) {
8483 /* try putting a leading underscore */
8484 symbol = dlsym(handle, "_fred") ;
8485 if (symbol == NULL) {
8486 printf ("2\n") ;
8487 fflush (stdout) ;
8488 exit(0);
8489 }
8490 printf ("3\n") ;
8491 }
8492 else
8493 printf ("4\n") ;
8494 fflush (stdout) ;
8495 exit(0);
8496}
8497EOM
8498 : Call the object file tmp-dyna.o in case dlext=o.
8499 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
8500 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
7a282f6d
JH
8501 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
8502 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
b4eb6b3d
JH
8503 xxx=`./fred`
8504 case $xxx in
8505 1) echo "Test program failed using dlopen." >&4
8506 echo "Perhaps you should not use dynamic loading." >&4;;
8507 2) echo "Test program failed using dlsym." >&4
8508 echo "Perhaps you should not use dynamic loading." >&4;;
8509 3) echo "dlsym needs a leading underscore" >&4
8510 val="$define" ;;
8511 4) echo "dlsym doesn't need a leading underscore." >&4;;
8512 esac
8513 else
8514 echo "I can't compile and run the test program." >&4
8515 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8516 fi
8517 ;;
8518esac
8519
8520$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8521
8522set d_dlsymun
8523eval $setvar
8524
8525hasproto='varname=$1; func=$2; shift; shift;
8526while $test $# -ge 2; do
8527 case "$1" in
8528 $define) echo "#include <$2>";;
8529 esac ;
8530 shift 2;
8531done > try.c;
8532$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8533if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8534 echo "$func() prototype found.";
8535 val="$define";
8536else
8537 echo "$func() prototype NOT found.";
8538 val="$undef";
8539fi;
8540set $varname;
8541eval $setvar;
8542$rm -f try.c tryout.c'
8543
8544: see if prototype for drand48 is available
8545echo " "
8546set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8547eval $hasproto
8548
8549: see if dup2 exists
8550set dup2 d_dup2
8551eval $inlibc
8552
8553: see if eaccess exists
8554set eaccess d_eaccess
8555eval $inlibc
8556
8557: see if endgrent exists
8558set endgrent d_endgrent
8559eval $inlibc
8560
8561: see if endhostent exists
8562set endhostent d_endhent
8563eval $inlibc
8564
8565: see if endnetent exists
8566set endnetent d_endnent
8567eval $inlibc
8568
8569: see if endprotoent exists
8570set endprotoent d_endpent
8571eval $inlibc
8572
8573: see if endpwent exists
8574set endpwent d_endpwent
8575eval $inlibc
8576
8577: see if endservent exists
8578set endservent d_endsent
8579eval $inlibc
8580
8581: Locate the flags for 'open()'
8582echo " "
8583$cat >open3.c <<'EOCP'
8584#include <sys/types.h>
8585#ifdef I_FCNTL
8586#include <fcntl.h>
8587#endif
8588#ifdef I_SYS_FILE
8589#include <sys/file.h>
8590#endif
8591int main() {
8592 if(O_RDONLY);
8593#ifdef O_TRUNC
8594 exit(0);
8595#else
8596 exit(1);
8597#endif
8598}
8599EOCP
8600: check sys/file.h first to get FREAD on Sun
8601if $test `./findhdr sys/file.h` && \
8602 set open3 -DI_SYS_FILE && eval $compile; then
8603 h_sysfile=true;
8604 echo "<sys/file.h> defines the O_* constants..." >&4
8605 if ./open3; then
8606 echo "and you have the 3 argument form of open()." >&4
8607 val="$define"
8608 else
8609 echo "but not the 3 argument form of open(). Oh, well." >&4
8610 val="$undef"
8611 fi
8612elif $test `./findhdr fcntl.h` && \
8613 set open3 -DI_FCNTL && eval $compile; then
8614 h_fcntl=true;
8615 echo "<fcntl.h> defines the O_* constants..." >&4
8616 if ./open3; then
8617 echo "and you have the 3 argument form of open()." >&4
8618 val="$define"
8619 else
8620 echo "but not the 3 argument form of open(). Oh, well." >&4
8621 val="$undef"
8622 fi
8623else
8624 val="$undef"
8625 echo "I can't find the O_* constant definitions! You got problems." >&4
8626fi
8627set d_open3
8628eval $setvar
8629$rm -f open3*
8630
8631: see which of string.h or strings.h is needed
8632echo " "
8633strings=`./findhdr string.h`
8634if $test "$strings" && $test -r "$strings"; then
8635 echo "Using <string.h> instead of <strings.h>." >&4
8636 val="$define"
8637else
8638 val="$undef"
8639 strings=`./findhdr strings.h`
8640 if $test "$strings" && $test -r "$strings"; then
8641 echo "Using <strings.h> instead of <string.h>." >&4
8642 else
8643 echo "No string header found -- You'll surely have problems." >&4
8644 fi
8645fi
8646set i_string
8647eval $setvar
8648case "$i_string" in
8649"$undef") strings=`./findhdr strings.h`;;
8650*) strings=`./findhdr string.h`;;
8651esac
8652
8653: check for non-blocking I/O stuff
8654case "$h_sysfile" in
8655true) echo "#include <sys/file.h>" > head.c;;
8656*)
8657 case "$h_fcntl" in
8658 true) echo "#include <fcntl.h>" > head.c;;
8659 *) echo "#include <sys/fcntl.h>" > head.c;;
8660 esac
8661 ;;
8662esac
8663echo " "
8664echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8665case "$o_nonblock" in
8666'')
8667 $cat head.c > try.c
8668 $cat >>try.c <<'EOCP'
8669#include <stdio.h>
8670int main() {
8671#ifdef O_NONBLOCK
8672 printf("O_NONBLOCK\n");
8673 exit(0);
8674#endif
8675#ifdef O_NDELAY
8676 printf("O_NDELAY\n");
8677 exit(0);
8678#endif
8679#ifdef FNDELAY
8680 printf("FNDELAY\n");
8681 exit(0);
8682#endif
8683 exit(0);
8684}
8685EOCP
8686 set try
8687 if eval $compile_ok; then
8688 o_nonblock=`./try`
8689 case "$o_nonblock" in
8690 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8691 *) echo "Seems like we can use $o_nonblock.";;
8692 esac
8693 else
8694 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8695 fi
8696 ;;
8697*) echo "Using $hint value $o_nonblock.";;
8698esac
8699$rm -f try try.* .out core
8700
8701echo " "
8702echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8703case "$eagain" in
8704'')
8705 $cat head.c > try.c
8706 $cat >>try.c <<EOCP
8707#include <errno.h>
8708#include <sys/types.h>
8709#include <signal.h>
8710#include <stdio.h>
8711#define MY_O_NONBLOCK $o_nonblock
8712#ifndef errno /* XXX need better Configure test */
8713extern int errno;
8714#endif
8715#$i_unistd I_UNISTD
8716#ifdef I_UNISTD
8717#include <unistd.h>
8718#endif
8719#$i_string I_STRING
8720#ifdef I_STRING
8721#include <string.h>
8722#else
8723#include <strings.h>
8724#endif
8725$signal_t blech(x) int x; { exit(3); }
8726EOCP
8727 $cat >> try.c <<'EOCP'
8728int main()
8729{
8730 int pd[2];
8731 int pu[2];
8732 char buf[1];
8733 char string[100];
8734
8735 pipe(pd); /* Down: child -> parent */
8736 pipe(pu); /* Up: parent -> child */
8737 if (0 != fork()) {
8738 int ret;
8739 close(pd[1]); /* Parent reads from pd[0] */
8740 close(pu[0]); /* Parent writes (blocking) to pu[1] */
8741 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8742 exit(1);
8743 signal(SIGALRM, blech);
8744 alarm(5);
8745 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
8746 exit(2);
8747 sprintf(string, "%d\n", ret);
8748 write(2, string, strlen(string));
8749 alarm(0);
8750#ifdef EAGAIN
8751 if (errno == EAGAIN) {
8752 printf("EAGAIN\n");
8753 goto ok;
8754 }
8755#endif
8756#ifdef EWOULDBLOCK
8757 if (errno == EWOULDBLOCK)
8758 printf("EWOULDBLOCK\n");
8759#endif
8760 ok:
8761 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
8762 sleep(2); /* Give it time to close our pipe */
8763 alarm(5);
8764 ret = read(pd[0], buf, 1); /* Should read EOF */
8765 alarm(0);
8766 sprintf(string, "%d\n", ret);
8767 write(3, string, strlen(string));
8768 exit(0);
8769 }
8770
8771 close(pd[0]); /* We write to pd[1] */
8772 close(pu[1]); /* We read from pu[0] */
8773 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
8774 close(pd[1]); /* Pipe pd is now fully closed! */
8775 exit(0); /* Bye bye, thank you for playing! */
8776}
8777EOCP
8778 set try
8779 if eval $compile_ok; then
8780 echo "$startsh" >mtry
8781 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8782 chmod +x mtry
8783 ./mtry >/dev/null 2>&1
8784 case $? in
8785 0) eagain=`$cat try.out`;;
8786 1) echo "Could not perform non-blocking setting!";;
8787 2) echo "I did a successful read() for something that was not there!";;
8788 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8789 *) echo "Something terribly wrong happened during testing.";;
8790 esac
8791 rd_nodata=`$cat try.ret`
8792 echo "A read() system call with no data present returns $rd_nodata."
8793 case "$rd_nodata" in
8794 0|-1) ;;
8795 *)
8796 echo "(That's peculiar, fixing that to be -1.)"
8797 rd_nodata=-1
8798 ;;
8799 esac
8800 case "$eagain" in
8801 '')
8802 echo "Forcing errno EAGAIN on read() with no data available."
8803 eagain=EAGAIN
8804 ;;
8805 *)
8806 echo "Your read() sets errno to $eagain when no data is available."
8807 ;;
8808 esac
8809 status=`$cat try.err`
8810 case "$status" in
8811 0) echo "And it correctly returns 0 to signal EOF.";;
8812 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8813 *) echo "However, your read() returns '$status' on EOF??";;
8814 esac
8815 val="$define"
8816 if test "$status" = "$rd_nodata"; then
8817 echo "WARNING: you can't distinguish between EOF and no data!"
8818 val="$undef"
8819 fi
8820 else
8821 echo "I can't compile the test program--assuming errno EAGAIN will do."
8822 eagain=EAGAIN
8823 fi
8824 set d_eofnblk
8825 eval $setvar
8826 ;;
8827*)
8828 echo "Using $hint value $eagain."
8829 echo "Your read() returns $rd_nodata when no data is present."
8830 case "$d_eofnblk" in
8831 "$define") echo "And you can see EOF because read() returns 0.";;
8832 "$undef") echo "But you can't see EOF status from read() returned value.";;
8833 *)
8834 echo "(Assuming you can't see EOF status from read anyway.)"
8835 d_eofnblk=$undef
8836 ;;
8837 esac
8838 ;;
8839esac
8840$rm -f try try.* .out core head.c mtry
8841
8842: see if fchmod exists
8843set fchmod d_fchmod
8844eval $inlibc
8845
8846: see if fchown exists
8847set fchown d_fchown
8848eval $inlibc
8849
8850: see if this is an fcntl system
8851set fcntl d_fcntl
8852eval $inlibc
8853
9d9004a9
AD
8854echo " "
8855: See if fcntl-based locking works.
8856$cat >try.c <<'EOCP'
8857#include <stdlib.h>
8858#include <unistd.h>
8859#include <fcntl.h>
8860int main() {
8861#if defined(F_SETLK) && defined(F_SETLKW)
8862 struct flock flock;
8863 int retval, fd;
8864 fd = open("try.c", O_RDONLY);
8865 flock.l_type = F_RDLCK;
8866 flock.l_whence = SEEK_SET;
8867 flock.l_start = flock.l_len = 0;
8868 retval = fcntl(fd, F_SETLK, &flock);
8869 close(fd);
8870 (retval < 0 ? exit(2) : exit(0));
8871#else
8872 exit(2);
8873#endif
8874}
8875EOCP
8876echo "Checking if fcntl-based file locking works... "
8877case "$d_fcntl" in
8878"$define")
8879 set try
8880 if eval $compile_ok; then
8881 if ./try; then
8882 echo "Yes, it seems to work."
8883 val="$define"
8884 else
8885 echo "Nope, it didn't work."
8886 val="$undef"
8887 fi
8888 else
8889 echo "I'm unable to compile the test program, so I'll assume not."
8890 val="$undef"
8891 fi
8892 ;;
8893*) val="$undef";
8894 echo "Nope, since you don't even have fcntl()."
8895 ;;
8896esac
8897set d_fcntl_can_lock
8898eval $setvar
8899$rm -f try*
8900
8901
b4eb6b3d
JH
8902hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8903while $test $# -ge 2; do
8904 case "$1" in
8905 $define) echo "#include <$2>";;
8906 esac ;
8907 shift 2;
8908done > try.c;
8909echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8910set try;
8911if eval $compile; then
8912 val="$define";
8913else
8914 val="$undef";
8915fi;
8916set $varname;
8917eval $setvar;
8918$rm -f try.c try.o'
8919
8920socketlib=''
8921sockethdr=''
8922: see whether socket exists
8923echo " "
8924$echo $n "Hmm... $c" >&4
8925if set socket val -f d_socket; eval $csym; $val; then
8926 echo "Looks like you have Berkeley networking support." >&4
8927 d_socket="$define"
8928 if set setsockopt val -f; eval $csym; $val; then
8929 d_oldsock="$undef"
8930 else
8931 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8932 d_oldsock="$define"
8933 fi
8934else
8935 if $contains socklib libc.list >/dev/null 2>&1; then
8936 echo "Looks like you have Berkeley networking support." >&4
8937 d_socket="$define"
8938 : we will have to assume that it supports the 4.2 BSD interface
8939 d_oldsock="$undef"
8940 else
8941 echo "You don't have Berkeley networking in libc$_a..." >&4
8942 if test "X$d_socket" = "X$define"; then
8943 echo "...but you seem to believe that you have sockets." >&4
8944 else
8945 for net in net socket
8946 do
8947 if test -f /usr/lib/lib$net$_a; then
8948 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
8949 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8950 if $contains socket libc.list >/dev/null 2>&1; then
8951 d_socket="$define"
8952 socketlib="-l$net"
8953 case "$net" in
8954 net)
8955 echo "...but the Wollongong group seems to have hacked it in." >&4
8956 sockethdr="-I/usr/netinclude"
8957 ;;
8958 esac
8959 echo "Found Berkeley sockets interface in lib$net." >& 4
8960 if $contains setsockopt libc.list >/dev/null 2>&1; then
8961 d_oldsock="$undef"
8962 else
8963 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8964 d_oldsock="$define"
8965 fi
8966 break
8967 fi
8968 fi
8969 done
8970 if test "X$d_socket" != "X$define"; then
8971 echo "or anywhere else I see." >&4
8972 d_socket="$undef"
8973 d_oldsock="$undef"
8974 fi
8975 fi
8976 fi
8977fi
8978
8979: see if socketpair exists
8980set socketpair d_sockpair
8981eval $inlibc
8982
8983
8984echo " "
8985echo "Checking the availability of certain socket constants..." >& 4
8986for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8987 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8988 $cat >try.c <<EOF
8989#include <sys/types.h>
8990#include <sys/socket.h>
8991int main() {
8992 int i = $ENUM;
8993}
8994EOF
8995 val="$undef"
8996 set try; if eval $compile; then
8997 val="$define"
8998 fi
8999 set d_${enum}; eval $setvar
9000 $rm -f try.c try
9001done
9002
9003: see if sys/select.h has to be included
9004set sys/select.h i_sysselct
9005eval $inhdr
9006
9007: see if we should include time.h, sys/time.h, or both
9008echo " "
9009if test "X$timeincl" = X; then
9010 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9011 $echo $n "I'm now running the test program...$c"
9012 $cat >try.c <<'EOCP'
9013#include <sys/types.h>
9014#ifdef I_TIME
9015#include <time.h>
9016#endif
9017#ifdef I_SYSTIME
9018#ifdef SYSTIMEKERNEL
9019#define KERNEL
9020#endif
9021#include <sys/time.h>
9022#endif
9023#ifdef I_SYSSELECT
9024#include <sys/select.h>
9025#endif
9026int main()
9027{
9028 struct tm foo;
9029#ifdef S_TIMEVAL
9030 struct timeval bar;
9031#endif
9032#ifdef S_TIMEZONE
9033 struct timezone tzp;
9034#endif
9035 if (foo.tm_sec == foo.tm_sec)
9036 exit(0);
9037#ifdef S_TIMEVAL
9038 if (bar.tv_sec == bar.tv_sec)
9039 exit(0);
9040#endif
9041 exit(1);
9042}
9043EOCP
9044 flags=''
9045 for s_timezone in '-DS_TIMEZONE' ''; do
9046 sysselect=''
9047 for s_timeval in '-DS_TIMEVAL' ''; do
9048 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9049 for i_time in '' '-DI_TIME'; do
9050 for i_systime in '-DI_SYSTIME' ''; do
9051 case "$flags" in
9052 '') $echo $n ".$c"
9053 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9054 if eval $compile; then
9055 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9056 shift
9057 flags="$*"
9058 echo " "
9059 $echo $n "Succeeded with $flags$c"
9060 fi
9061 ;;
9062 esac
9063 done
9064 done
9065 done
9066 done
9067 done
9068 timeincl=''
9069 echo " "
9070 case "$flags" in
9071 *SYSTIMEKERNEL*) i_systimek="$define"
9072 timeincl=`./findhdr sys/time.h`
9073 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9074 *) i_systimek="$undef";;
9075 esac
9076 case "$flags" in
9077 *I_TIME*) i_time="$define"
9078 timeincl=`./findhdr time.h`" $timeincl"
9079 echo "We'll include <time.h>." >&4;;
9080 *) i_time="$undef";;
9081 esac
9082 case "$flags" in
9083 *I_SYSTIME*) i_systime="$define"
9084 timeincl=`./findhdr sys/time.h`" $timeincl"
9085 echo "We'll include <sys/time.h>." >&4;;
9086 *) i_systime="$undef";;
9087 esac
9088 $rm -f try.c try
9089fi
9090
9091: check for fd_set items
9092$cat <<EOM
9093
9094Checking to see how well your C compiler handles fd_set and friends ...
9095EOM
9096$cat >fd_set.c <<EOCP
9097#$i_systime I_SYS_TIME
9098#$i_sysselct I_SYS_SELECT
9099#$d_socket HAS_SOCKET
9100#include <sys/types.h>
9101#ifdef HAS_SOCKET
9102#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9103#endif
9104#ifdef I_SYS_TIME
9105#include <sys/time.h>
9106#endif
9107#ifdef I_SYS_SELECT
9108#include <sys/select.h>
9109#endif
9110int main() {
9111 fd_set fds;
9112
9113#ifdef TRYBITS
9114 if(fds.fds_bits);
9115#endif
9116
9117#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9118 exit(0);
9119#else
9120 exit(1);
9121#endif
9122}
9123EOCP
9124set fd_set -DTRYBITS
9125if eval $compile; then
9126 d_fds_bits="$define"
9127 d_fd_set="$define"
9128 echo "Well, your system knows about the normal fd_set typedef..." >&4
9129 if ./fd_set; then
9130 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9131 d_fd_macros="$define"
9132 else
9133 $cat >&4 <<'EOM'
9134but not the normal fd_set macros! Gaaack! I'll have to cover for you.
9135EOM
9136 d_fd_macros="$undef"
9137 fi
9138else
9139 $cat <<'EOM'
9140Hmm, your compiler has some difficulty with fd_set. Checking further...
9141EOM
9142 set fd_set
9143 if eval $compile; then
9144 d_fds_bits="$undef"
9145 d_fd_set="$define"
9146 echo "Well, your system has some sort of fd_set available..." >&4
9147 if ./fd_set; then
9148 echo "and you have the normal fd_set macros." >&4
9149 d_fd_macros="$define"
9150 else
9151 $cat <<'EOM'
9152but not the normal fd_set macros! Gross! More work for me...
9153EOM
9154 d_fd_macros="$undef"
9155 fi
9156 else
9157 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
9158 d_fd_set="$undef"
9159 d_fds_bits="$undef"
9160 d_fd_macros="$undef"
9161 fi
9162fi
9163$rm -f fd_set*
9164
9165: see if fgetpos exists
9166set fgetpos d_fgetpos
9167eval $inlibc
9168
9169: see if flock exists
9170set flock d_flock
9171eval $inlibc
9172
9173: see if fork exists
9174set fork d_fork
9175eval $inlibc
9176
9177: see if pathconf exists
9178set pathconf d_pathconf
9179eval $inlibc
9180
9181: see if fpathconf exists
9182set fpathconf d_fpathconf
9183eval $inlibc
9184
9185
9186: check for fpos64_t
9187echo " "
9188echo "Checking to see if you have fpos64_t..." >&4
9189$cat >try.c <<EOCP
9190#include <stdio.h>
9191int main() { fpos64_t x = 7; }
9192EOCP
9193set try
9194if eval $compile; then
9195 val="$define"
9196 echo "You have fpos64_t."
9197else
9198 val="$undef"
9199 echo "You do not have fpos64_t."
9200 case "$fpossize" in
9201 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9202 esac
9203fi
9204$rm -f try.* try
9205set d_fpos64_t
9206eval $setvar
9207
9208: see if frexpl exists
9209set frexpl d_frexpl
9210eval $inlibc
9211
9212hasstruct='varname=$1; struct=$2; shift; shift;
9213while $test $# -ge 2; do
9214 case "$1" in
9215 $define) echo "#include <$2>";;
9216 esac ;
9217 shift 2;
9218done > try.c;
9219echo "int main () { struct $struct foo; }" >> try.c;
9220set try;
9221if eval $compile; then
9222 val="$define";
9223else
9224 val="$undef";
9225fi;
9226set $varname;
9227eval $setvar;
9228$rm -f try.c try.o'
9229
9230: see if this is a sys/param system
9231set sys/param.h i_sysparam
9232eval $inhdr
9233
9234: see if this is a sys/mount.h system
9235set sys/mount.h i_sysmount
9236eval $inhdr
9237
9238: see if sys/types.h has to be included
9239set sys/types.h i_systypes
9240eval $inhdr
9241
9242
9243echo " "
9244echo "Checking to see if your system supports struct fs_data..." >&4
9245set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9246eval $hasstruct
9247case "$d_fs_data_s" in
9248"$define") echo "Yes, it does." ;;
9249*) echo "No, it doesn't." ;;
9250esac
9251
9252: see if fseeko exists
9253set fseeko d_fseeko
9254eval $inlibc
9255case "$longsize" in
92568) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9257esac
9258
9259: see if fsetpos exists
9260set fsetpos d_fsetpos
9261eval $inlibc
9262
9263
9264: see if fstatfs exists
9265set fstatfs d_fstatfs
9266eval $inlibc
9267
9268
9269: see if statvfs exists
9270set statvfs d_statvfs
9271eval $inlibc
9272
9273: see if fstatvfs exists
9274set fstatvfs d_fstatvfs
9275eval $inlibc
9276
9277
9278: see if ftello exists
9279set ftello d_ftello
9280eval $inlibc
9281case "$longsize" in
92828) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9283esac
9284
9285: see if getcwd exists
9286set getcwd d_getcwd
9287eval $inlibc
9288
9289: see if getespwnam exists
9290set getespwnam d_getespwnam
9291eval $inlibc
9292
9293
9294: see if getfsstat exists
9295set getfsstat d_getfsstat
9296eval $inlibc
9297
9298: see if getgrent exists
9299set getgrent d_getgrent
9300eval $inlibc
9301
9302: see if gethostbyaddr exists
9303set gethostbyaddr d_gethbyaddr
9304eval $inlibc
9305
9306: see if gethostbyname exists
9307set gethostbyname d_gethbyname
9308eval $inlibc
9309
9310: see if gethostent exists
9311set gethostent d_gethent
9312eval $inlibc
9313
9314: see how we will look up host name
9315echo " "
9316call=''
9317if set gethostname val -f d_gethname; eval $csym; $val; then
9318 echo 'gethostname() found.' >&4
9319 d_gethname="$define"
9320 call=gethostname
9321fi
9322if set uname val -f d_uname; eval $csym; $val; then
9323 if ./xenix; then
9324 $cat <<'EOM'
9325uname() was found, but you're running xenix, and older versions of xenix
9326have a broken uname(). If you don't really know whether your xenix is old
9327enough to have a broken system call, use the default answer.
9328
9329EOM
9330 dflt=y
9331 case "$d_uname" in
9332 "$define") dflt=n;;
9333 esac
9334 rp='Is your uname() broken?'
9335 . ./myread
9336 case "$ans" in
9337 n*) d_uname="$define"; call=uname;;
9338 esac
9339 else
9340 echo 'uname() found.' >&4
9341 d_uname="$define"
9342 case "$call" in
9343 '') call=uname ;;
9344 esac
9345 fi
9346fi
9347case "$d_gethname" in
9348'') d_gethname="$undef";;
9349esac
9350case "$d_uname" in
9351'') d_uname="$undef";;
9352esac
9353case "$d_uname$d_gethname" in
9354*define*)
9355 dflt=n
9356 cat <<EOM
9357
9358Every now and then someone has a $call() that lies about the hostname
9359but can't be fixed for political or economic reasons. If you wish, I can
9360pretend $call() isn't there and maybe compute hostname at run-time
9361thanks to the '$phostname' command.
9362
9363EOM
9364 rp="Shall I ignore $call() from now on?"
9365 . ./myread
9366 case "$ans" in
9367 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9368 esac;;
9369esac
9370case "$phostname" in
9371'') aphostname='';;
9372*) case "$aphostname" in
9373 /*) ;;
9374 *) set X $phostname
9375 shift
9376 file=$1
9377 shift
9378 file=`./loc $file $file $pth`
9379 aphostname=`echo $file $*`
9380 ;;
9381 esac
9382 ;;
9383esac
9384case "$d_uname$d_gethname" in
9385*define*) ;;
9386*)
9387 case "$phostname" in
9388 '')
9389 echo "There will be no way for $package to get your hostname." >&4;;
9390 *)
9391 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9392 ;;
9393 esac;;
9394esac
9395case "$d_phostname" in
9396'') d_phostname="$undef";;
9397esac
9398
9399: see if this is a netdb.h system
9400set netdb.h i_netdb
9401eval $inhdr
9402
9403: see if prototypes for various gethostxxx netdb.h functions are available
9404echo " "
9405set d_gethostprotos gethostent $i_netdb netdb.h
9406eval $hasproto
9407
9408: see if getlogin exists
9409set getlogin d_getlogin
9410eval $inlibc
9411
9412: see if getmnt exists
9413set getmnt d_getmnt
9414eval $inlibc
9415
9416: see if getmntent exists
9417set getmntent d_getmntent
9418eval $inlibc
9419
9420: see if getnetbyaddr exists
9421set getnetbyaddr d_getnbyaddr
9422eval $inlibc
9423
9424: see if getnetbyname exists
9425set getnetbyname d_getnbyname
9426eval $inlibc
9427
9428: see if getnetent exists
9429set getnetent d_getnent
9430eval $inlibc
9431
9432: see if prototypes for various getnetxxx netdb.h functions are available
9433echo " "
9434set d_getnetprotos getnetent $i_netdb netdb.h
9435eval $hasproto
9436
9437
9438: see if getprotobyname exists
9439set getprotobyname d_getpbyname
9440eval $inlibc
9441
9442: see if getprotobynumber exists
9443set getprotobynumber d_getpbynumber
9444eval $inlibc
9445
9446: see if getprotoent exists
9447set getprotoent d_getpent
9448eval $inlibc
9449
9450: see if getpgid exists
9451set getpgid d_getpgid
9452eval $inlibc
9453
9454: see if getpgrp2 exists
9455set getpgrp2 d_getpgrp2
9456eval $inlibc
9457
9458: see if getppid exists
9459set getppid d_getppid
9460eval $inlibc
9461
9462: see if getpriority exists
9463set getpriority d_getprior
9464eval $inlibc
9465
9466: see if prototypes for various getprotoxxx netdb.h functions are available
9467echo " "
9468set d_getprotoprotos getprotoent $i_netdb netdb.h
9469eval $hasproto
9470
9471: see if getprpwnam exists
9472set getprpwnam d_getprpwnam
9473eval $inlibc
9474
9475: see if getpwent exists
9476set getpwent d_getpwent
9477eval $inlibc
9478
9479
9480: see if getservbyname exists
9481set getservbyname d_getsbyname
9482eval $inlibc
9483
9484: see if getservbyport exists
9485set getservbyport d_getsbyport
9486eval $inlibc
9487
9488: see if getservent exists
9489set getservent d_getsent
9490eval $inlibc
9491
9492: see if prototypes for various getservxxx netdb.h functions are available
9493echo " "
9494set d_getservprotos getservent $i_netdb netdb.h
9495eval $hasproto
9496
9497: see if getspnam exists
9498set getspnam d_getspnam
9499eval $inlibc
9500
9501: see if gettimeofday or ftime exists
9502set gettimeofday d_gettimeod
9503eval $inlibc
9504case "$d_gettimeod" in
9505"$undef")
9506 set ftime d_ftime
9507 eval $inlibc
9508 ;;
9509*)
9510 val="$undef"; set d_ftime; eval $setvar
9511 ;;
9512esac
9513case "$d_gettimeod$d_ftime" in
9514"$undef$undef")
9515 echo " "
9516 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9517 ;;
9518esac
9519
9520: see if this is an grp system
9521set grp.h i_grp
9522eval $inhdr
9523
9524case "$i_grp" in
9525$define)
9526 xxx=`./findhdr grp.h`
9527 $cppstdin $cppflags $cppminus < $xxx >$$.h
9528
9529 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9530 val="$define"
9531 else
9532 val="$undef"
9533 fi
9534 set d_grpasswd
9535 eval $setvar
9536
9537 $rm -f $$.h
9538 ;;
9539*)
9540 val="$undef";
9541 set d_grpasswd; eval $setvar
9542 ;;
9543esac
9544
9545: see if hasmntopt exists
9546set hasmntopt d_hasmntopt
9547eval $inlibc
9548
9549: see if this is a netinet/in.h or sys/in.h system
9550set netinet/in.h i_niin sys/in.h i_sysin
9551eval $inhdr
9552
9553: see if arpa/inet.h has to be included
9554set arpa/inet.h i_arpainet
9555eval $inhdr
9556
9557: see if htonl --and friends-- exists
9558val=''
9559set htonl val
9560eval $inlibc
9561
9562: Maybe they are macros.
9563case "$val" in
9564$undef)
9565 $cat >htonl.c <<EOM
9566#include <stdio.h>
9567#include <sys/types.h>
9568#$i_niin I_NETINET_IN
9569#$i_sysin I_SYS_IN
9570#$i_arpainet I_ARPA_INET
9571#ifdef I_NETINET_IN
9572#include <netinet/in.h>
9573#endif
9574#ifdef I_SYS_IN
9575#include <sys/in.h>
9576#endif
9577#ifdef I_ARPA_INET
9578#include <arpa/inet.h>
9579#endif
9580#ifdef htonl
9581printf("Defined as a macro.");
9582#endif
9583EOM
9584 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9585 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9586 val="$define"
9587 echo "But it seems to be defined as a macro." >&4
9588 fi
9589 $rm -f htonl.?
9590 ;;
9591esac
9592set d_htonl
9593eval $setvar
9594
9595: see if iconv exists
9596set iconv d_iconv
9597eval $inlibc
9598
9599: index or strchr
9600echo " "
9601if set index val -f; eval $csym; $val; then
9602 if set strchr val -f d_strchr; eval $csym; $val; then
9603 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9604 val="$define"
9605 vali="$undef"
9606 echo "strchr() found." >&4
9607 else
9608 val="$undef"
9609 vali="$define"
9610 echo "index() found." >&4
9611 fi
9612 else
9613 val="$undef"
9614 vali="$define"
9615 echo "index() found." >&4
9616 fi
9617else
9618 if set strchr val -f d_strchr; eval $csym; $val; then
9619 val="$define"
9620 vali="$undef"
9621 echo "strchr() found." >&4
9622 else
9623 echo "No index() or strchr() found!" >&4
9624 val="$undef"
9625 vali="$undef"
9626 fi
9627fi
9628set d_strchr; eval $setvar
9629val="$vali"
9630set d_index; eval $setvar
9631
9632: check whether inet_aton exists
9633set inet_aton d_inetaton
9634eval $inlibc
9635
9636: see if inttypes.h is available
9637: we want a real compile instead of Inhdr because some systems
9638: have an inttypes.h which includes non-existent headers
9639echo " "
9640$cat >try.c <<EOCP
9641#include <inttypes.h>
9642int main() {
9643 static int32_t foo32 = 0x12345678;
9644}
9645EOCP
9646set try
9647if eval $compile; then
9648 echo "<inttypes.h> found." >&4
9649 val="$define"
9650else
9651 echo "<inttypes.h> NOT found." >&4
9652 val="$undef"
9653fi
9654$rm -f try.c try
9655set i_inttypes
9656eval $setvar
9657
9658: check for int64_t
9659echo " "
9660echo "Checking to see if you have int64_t..." >&4
9661$cat >try.c <<EOCP
9662#include <sys/types.h>
9663#$i_inttypes I_INTTYPES
9664#ifdef I_INTTYPES
9665#include <inttypes.h>
9666#endif
9667int main() { int64_t x = 7; }
9668EOCP
9669set try
9670if eval $compile; then
9671 val="$define"
9672 echo "You have int64_t."
9673else
9674 val="$undef"
9675 echo "You do not have int64_t."
9676fi
9677$rm -f try try.*
9678set d_int64_t
9679eval $setvar
9680
9681: Look for isascii
9682echo " "
9683$cat >isascii.c <<'EOCP'
9684#include <stdio.h>
9685#include <ctype.h>
9686int main() {
9687 int c = 'A';
9688 if (isascii(c))
9689 exit(0);
9690 else
9691 exit(1);
9692}
9693EOCP
9694set isascii
9695if eval $compile; then
9696 echo "isascii() found." >&4
9697 val="$define"
9698else
9699 echo "isascii() NOT found." >&4
9700 val="$undef"
9701fi
9702set d_isascii
9703eval $setvar
9704$rm -f isascii*
9705
9706: see if isnan exists
9707set isnan d_isnan
9708eval $inlibc
9709
9710: see if isnanl exists
9711set isnanl d_isnanl
9712eval $inlibc
9713
9714: see if killpg exists
9715set killpg d_killpg
9716eval $inlibc
9717
9718: see if lchown exists
9719echo " "
9720$cat > try.c <<'EOCP'
9721/* System header to define __stub macros and hopefully few prototypes,
9722 which can conflict with char lchown(); below. */
9723#include <assert.h>
9724/* Override any gcc2 internal prototype to avoid an error. */
9725/* We use char because int might match the return type of a gcc2
9726 builtin and then its argument prototype would still apply. */
9727char lchown();
9728int main() {
9729 /* The GNU C library defines this for functions which it implements
9730 to always fail with ENOSYS. Some functions are actually named
9731 something starting with __ and the normal name is an alias. */
9732#if defined (__stub_lchown) || defined (__stub___lchown)
9733choke me
9734#else
9735lchown();
9736#endif
9737; return 0; }
9738EOCP
9739set try
9740if eval $compile; then
9741 $echo "lchown() found." >&4
9742 val="$define"
9743else
9744 $echo "lchown() NOT found." >&4
9745 val="$undef"
9746fi
9747set d_lchown
9748eval $setvar
9749
9750: See if number of significant digits in a double precision number is known
9751echo " "
9752$cat >ldbl_dig.c <<EOM
9753#$i_limits I_LIMITS
9754#$i_float I_FLOAT
9755#ifdef I_LIMITS
9756#include <limits.h>
9757#endif
9758#ifdef I_FLOAT
9759#include <float.h>
9760#endif
9761#ifdef LDBL_DIG
9762printf("Contains LDBL_DIG");
9763#endif
9764EOM
9765$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9766if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9767 echo "LDBL_DIG found." >&4
9768 val="$define"
9769else
9770 echo "LDBL_DIG NOT found." >&4
9771 val="$undef"
9772fi
9773$rm -f ldbl_dig.?
9774set d_ldbl_dig
9775eval $setvar
9776
9777: see if link exists
9778set link d_link
9779eval $inlibc
9780
9781: see if localeconv exists
9782set localeconv d_locconv
9783eval $inlibc
9784
9785: see if lockf exists
9786set lockf d_lockf
9787eval $inlibc
9788
9789: check for long long
9790echo " "
9791echo "Checking to see if you have long long..." >&4
9792echo 'int main() { long long x = 7; return 0; }' > try.c
9793set try
9794if eval $compile; then
9795 val="$define"
9796 echo "You have long long."
9797else
9798 val="$undef"
9799 echo "You do not have long long."
9800fi
9801$rm try.*
9802set d_longlong
9803eval $setvar
9804
9805: check for length of long long
9806case "${d_longlong}${longlongsize}" in
9807$define)
9808 echo " "
9809 echo "Checking to see how big your long longs are..." >&4
9810 $cat >try.c <<'EOCP'
9811#include <stdio.h>
9812int main()
9813{
9814 printf("%d\n", (int)sizeof(long long));
9815 return(0);
9816}
9817EOCP
9818 set try
9819 if eval $compile_ok; then
9820 longlongsize=`./try$exe_ext`
9821 echo "Your long longs are $longlongsize bytes long."
9822 else
9823 dflt='8'
9824 echo " "
9825 echo "(I can't seem to compile the test program. Guessing...)"
9826 rp="What is the size of a long long (in bytes)?"
9827 . ./myread
9828 longlongsize="$ans"
9829 fi
9830 if $test "X$longsize" = "X$longlongsize"; then
9831 echo "(That isn't any different from an ordinary long.)"
9832 fi
9833 ;;
9834esac
9835$rm -f try.* try
9836
9837: see if prototype for lseek is available
9838echo " "
9839set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9840eval $hasproto
9841
9842: see if lstat exists
9843set lstat d_lstat
9844eval $inlibc
9845
9846: see if madvise exists
9847set madvise d_madvise
9848eval $inlibc
9849
9850: see if mblen exists
9851set mblen d_mblen
9852eval $inlibc
9853
9854: see if mbstowcs exists
9855set mbstowcs d_mbstowcs
9856eval $inlibc
9857
9858: see if mbtowc exists
9859set mbtowc d_mbtowc
9860eval $inlibc
9861
9862: see if memchr exists
9863set memchr d_memchr
9864eval $inlibc
9865
9866: see if memcmp exists
9867set memcmp d_memcmp
9868eval $inlibc
9869
9870: see if memcpy exists
9871set memcpy d_memcpy
9872eval $inlibc
9873
9874: see if memmove exists
9875set memmove d_memmove
9876eval $inlibc
9877
9878: see if memset exists
9879set memset d_memset
9880eval $inlibc
9881
9882: see if mkdir exists
9883set mkdir d_mkdir
9884eval $inlibc
9885
9886: see if mkdtemp exists
9887set mkdtemp d_mkdtemp
9888eval $inlibc
9889
9890: see if mkfifo exists
9891set mkfifo d_mkfifo
9892eval $inlibc
9893
9894: see if mkstemp exists
9895set mkstemp d_mkstemp
9896eval $inlibc
9897
9898: see if mkstemps exists
9899set mkstemps d_mkstemps
9900eval $inlibc
9901
9902: see if mktime exists
9903set mktime d_mktime
9904eval $inlibc
9905
9906: see if this is a sys/mman.h system
9907set sys/mman.h i_sysmman
9908eval $inhdr
9909
9910: see if mmap exists
9911set mmap d_mmap
9912eval $inlibc
9913: see what shmat returns
9914: default to something harmless
9915mmaptype='void *'
9916case "$i_sysmman$d_mmap" in
9917"$define$define")
9918 $cat >mmap.c <<'END'
9919#include <sys/mman.h>
9920void *mmap();
9921END
9922 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9923 mmaptype='void *'
9924 else
9925 mmaptype='caddr_t'
9926 fi
9927 echo "and it returns ($mmaptype)." >&4
9928 ;;
9929esac
9930
9931
9932
9933: see if modfl exists
9934set modfl d_modfl
9935eval $inlibc
9936
9937: see if mprotect exists
9938set mprotect d_mprotect
9939eval $inlibc
9940
9941: see if msgctl exists
9942set msgctl d_msgctl
9943eval $inlibc
9944
9945: see if msgget exists
9946set msgget d_msgget
9947eval $inlibc
9948
9949: see if msgsnd exists
9950set msgsnd d_msgsnd
9951eval $inlibc
9952
9953: see if msgrcv exists
9954set msgrcv d_msgrcv
9955eval $inlibc
9956
9957: see how much of the 'msg*(2)' library is present.
9958h_msg=true
9959echo " "
9960case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9961*"$undef"*) h_msg=false;;
9962esac
9963case "$osname" in
9964freebsd)
9965 case "`ipcs 2>&1`" in
9966 "SVID messages"*"not configured"*)
9967 echo "Your $osname does not have the msg*(2) configured." >&4
9968 h_msg=false
9969 val="$undef"
9970 set msgctl d_msgctl
9971 eval $setvar
9972 set msgget d_msgget
9973 eval $setvar
9974 set msgsnd d_msgsnd
9975 eval $setvar
9976 set msgrcv d_msgrcv
9977 eval $setvar
9978 ;;
9979 esac
9980 ;;
9981esac
9982: we could also check for sys/ipc.h ...
9983if $h_msg && $test `./findhdr sys/msg.h`; then
9984 echo "You have the full msg*(2) library." >&4
9985 val="$define"
9986else
9987 echo "You don't have the full msg*(2) library." >&4
9988 val="$undef"
9989fi
9990set d_msg
9991eval $setvar
9992
9993: see if msync exists
9994set msync d_msync
9995eval $inlibc
9996
9997: see if munmap exists
9998set munmap d_munmap
9999eval $inlibc
10000
10001: see if nice exists
10002set nice d_nice
10003eval $inlibc
10004
10005
10006echo " "
10007echo "Checking which 64-bit integer type we could use..." >&4
10008
10009case "$intsize" in
100108) val=int
10011 set quadtype
10012 eval $setvar
10013 val='"unsigned int"'
10014 set uquadtype
10015 eval $setvar
10016 quadkind=1
10017 ;;
10018*) case "$longsize" in
10019 8) val=long
10020 set quadtype
10021 eval $setvar
10022 val='"unsigned long"'
10023 set uquadtype
10024 eval $setvar
10025 quadkind=2
10026 ;;
10027 *) case "$d_longlong:$longlongsize" in
10028 define:8)
10029 val='"long long"'
10030 set quadtype
10031 eval $setvar
10032 val='"unsigned long long"'
10033 set uquadtype
10034 eval $setvar
10035 quadkind=3
10036 ;;
10037 *) case "$d_int64_t" in
10038 define)
10039 val=int64_t
10040 set quadtype
10041 eval $setvar
10042 val=uint64_t
10043 set uquadtype
10044 eval $setvar
10045 quadkind=4
10046 ;;
10047 esac
10048 ;;
10049 esac
10050 ;;
10051 esac
10052 ;;
10053esac
10054
10055case "$quadtype" in
10056'') echo "Alas, no 64-bit integer types in sight." >&4
10057 d_quad="$undef"
10058 ;;
10059*) if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10060 verb="will"
10061 else
10062 verb="could"
10063 fi
10064 echo "We $verb use '$quadtype' for 64-bit integers." >&4
10065 d_quad="$define"
10066 ;;
10067esac
10068
10069: check for length of character
10070echo " "
10071case "$charsize" in
10072'')
10073 echo "Checking to see how big your characters are (hey, you never know)..." >&4
10074 $cat >try.c <<'EOCP'
10075#include <stdio.h>
10076int main()
10077{
10078 printf("%d\n", (int)sizeof(char));
10079 exit(0);
10080}
10081EOCP
10082 set try
10083 if eval $compile_ok; then
10084 dflt=`./try`
10085 else
10086 dflt='1'
10087 echo "(I can't seem to compile the test program. Guessing...)"
10088 fi
10089 ;;
10090*)
10091 dflt="$charsize"
10092 ;;
10093esac
10094rp="What is the size of a character (in bytes)?"
10095. ./myread
10096charsize="$ans"
10097$rm -f try.c try
10098
1d1be0dc
NC
10099: check for volatile keyword
10100echo " "
10101echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10102$cat >try.c <<'EOCP'
10103int main()
10104{
10105 typedef struct _goo_struct goo_struct;
10106 goo_struct * volatile goo = ((goo_struct *)0);
10107 struct _goo_struct {
10108 long long_int;
10109 int reg_int;
10110 char char_var;
10111 };
10112 typedef unsigned short foo_t;
10113 char *volatile foo;
10114 volatile int bar;
10115 volatile foo_t blech;
10116 foo = foo;
10117}
10118EOCP
10119if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10120 val="$define"
10121 echo "Yup, it does."
10122else
10123 val="$undef"
10124 echo "Nope, it doesn't."
10125fi
10126set d_volatile
10127eval $setvar
10128$rm -f try.*
10129
b4eb6b3d
JH
10130
10131echo " "
10132$echo "Choosing the C types to be used for Perl's internal types..." >&4
10133
10134case "$use64bitint:$d_quad:$quadtype" in
10135define:define:?*)
10136 ivtype="$quadtype"
10137 uvtype="$uquadtype"
10138 ivsize=8
10139 uvsize=8
10140 ;;
10141*) ivtype="long"
10142 uvtype="unsigned long"
10143 ivsize=$longsize
10144 uvsize=$longsize
10145 ;;
10146esac
10147
10148case "$uselongdouble:$d_longdbl" in
10149define:define)
10150 nvtype="long double"
10151 nvsize=$longdblsize
10152 ;;
10153*) nvtype=double
10154 nvsize=$doublesize
10155 ;;
10156esac
10157
10158$echo "(IV will be "$ivtype", $ivsize bytes)"
10159$echo "(UV will be "$uvtype", $uvsize bytes)"
10160$echo "(NV will be "$nvtype", $nvsize bytes)"
10161
10162$cat >try.c <<EOCP
10163#$i_inttypes I_INTTYPES
10164#ifdef I_INTTYPES
10165#include <inttypes.h>
10166#endif
10167#include <stdio.h>
10168int main() {
10169#ifdef INT8
10170 int8_t i = INT8_MAX;
10171 uint8_t u = UINT8_MAX;
10172 printf("int8_t\n");
10173#endif
10174#ifdef INT16
10175 int16_t i = INT16_MAX;
10176 uint16_t i = UINT16_MAX;
10177 printf("int16_t\n");
10178#endif
10179#ifdef INT32
10180 int32_t i = INT32_MAX;
10181 uint32_t u = UINT32_MAX;
10182 printf("int32_t\n");
10183#endif
10184}
10185EOCP
10186
10187case "$i8type" in
10188'') case "$charsize" in
10189 1) i8type=char
10190 u8type="unsigned char"
10191 i8size=$charsize
10192 u8size=$charsize
10193 ;;
10194 esac
10195 ;;
10196esac
10197case "$i8type" in
10198'') set try -DINT8
10199 if eval $compile; then
10200 case "`./try$exe_ext`" in
10201 int8_t) i8type=int8_t
10202 u8type=uint8_t
10203 i8size=1
10204 u8size=1
10205 ;;
10206 esac
10207 fi
10208 ;;
10209esac
10210case "$i8type" in
10211'') if $test $charsize -ge 1; then
10212 i8type=char
10213 u8type="unsigned char"
10214 i8size=$charsize
10215 u8size=$charsize
10216 fi
10217 ;;
10218esac
10219
10220case "$i16type" in
10221'') case "$shortsize" in
10222 2) i16type=short
10223 u16type="unsigned short"
10224 i16size=$shortsize
10225 u16size=$shortsize
10226 ;;
10227 esac
10228 ;;
10229esac
10230case "$i16type" in
10231'') set try -DINT16
10232 if eval $compile; then
10233 case "`./try$exe_ext`" in
10234 int16_t)
10235 i16type=int16_t
10236 u16type=uint16_t
10237 i16size=2
10238 u16size=2
10239 ;;
10240 esac
10241 fi
10242 ;;
10243esac
10244case "$i16type" in
10245'') if $test $shortsize -ge 2; then
10246 i16type=short
10247 u16type="unsigned short"
10248 i16size=$shortsize
10249 u16size=$shortsize
10250 fi
10251 ;;
10252esac
10253
10254case "$i32type" in
10255'') case "$longsize" in
10256 4) i32type=long
10257 u32type="unsigned long"
10258 i32size=$longsize
10259 u32size=$longsize
10260 ;;
10261 *) case "$intsize" in
10262 4) i32type=int
10263 u32type="unsigned int"
10264 i32size=$intsize
10265 u32size=$intsize
10266 ;;
10267 esac
10268 ;;
10269 esac
10270 ;;
10271esac
10272case "$i32type" in
10273'') set try -DINT32
10274 if eval $compile; then
10275 case "`./try$exe_ext`" in
10276 int32_t)
10277 i32type=int32_t
10278 u32type=uint32_t
10279 i32size=4
10280 u32size=4
10281 ;;
10282 esac
10283 fi
10284 ;;
10285esac
10286case "$i32type" in
10287'') if $test $intsize -ge 4; then
10288 i32type=int
10289 u32type="unsigned int"
10290 i32size=$intsize
10291 u32size=$intsize
10292 fi
10293 ;;
10294esac
10295
10296case "$i64type" in
10297'') case "$d_quad:$quadtype" in
10298 define:?*)
10299 i64type="$quadtype"
10300 u64type="$uquadtype"
10301 i64size=8
10302 u64size=8
10303 ;;
10304 esac
10305 ;;
10306esac
10307
1d1be0dc
NC
10308$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10309: volatile so that the compiler has to store it out to memory.
10310if test X"$d_volatile" = X"$define"; then
10311 volatile=volatile
10312fi
b4eb6b3d
JH
10313$cat <<EOP >try.c
10314#include <stdio.h>
1d1be0dc
NC
10315#include <sys/types.h>
10316#include <signal.h>
10317#ifdef SIGFPE
10318$volatile int bletched = 0;
10319$signal_t blech(s) int s; { bletched = 1; }
10320#endif
b4eb6b3d
JH
10321int main() {
10322 $uvtype u = 0;
1d1be0dc 10323 $nvtype d;
b4eb6b3d
JH
10324 int n = 8 * $uvsize;
10325 int i;
1d1be0dc
NC
10326#ifdef SIGFPE
10327 signal(SIGFPE, blech);
10328#endif
10329
b4eb6b3d
JH
10330 for (i = 0; i < n; i++) {
10331 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
10332 d = ($nvtype)u;
10333 if (($uvtype)d != u)
b4eb6b3d 10334 break;
1d1be0dc
NC
10335 if (d <= 0)
10336 break;
10337 d = ($nvtype)(u - 1);
10338 if (($uvtype)d != (u - 1))
10339 break;
10340#ifdef SIGFPE
10341 if (bletched) {
10342 break;
10343#endif
10344 }
b4eb6b3d 10345 }
1d1be0dc 10346 printf("%d\n", ((i == n) ? -n : i), u);
b4eb6b3d
JH
10347 exit(0);
10348}
10349EOP
1d1be0dc
NC
10350set try
10351
10352d_nv_preserves_uv="$undef"
10353if eval $compile; then
10354 d_nv_preserves_uv_bits="`./try$exe_ext`"
10355fi
10356case "$d_nv_preserves_uv_bits" in
10357\-[1-9]*)
10358 d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10359 $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs." 2>&1
10360 d_nv_preserves_uv="$define"
b4eb6b3d 10361 ;;
1d1be0dc
NC
10362[1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs." 2>&1
10363 d_nv_preserves_uv="$undef" ;;
10364*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
10365 d_nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
10366esac
10367
1d1be0dc
NC
10368$rm -f try.* try
10369
b4eb6b3d
JH
10370
10371: check for off64_t
10372echo " "
10373echo "Checking to see if you have off64_t..." >&4
10374$cat >try.c <<EOCP
10375#include <sys/types.h>
10376#include <unistd.h>
10377int main() { off64_t x = 7; }
10378EOCP
10379set try
10380if eval $compile; then
10381 val="$define"
10382 echo "You have off64_t."
10383else
10384 val="$undef"
10385 echo "You do not have off64_t."
10386 case "$lseeksize" in
10387 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10388 esac
10389fi
10390$rm -f try.* try
10391set d_off64_t
10392eval $setvar
10393
10394: see if POSIX threads are available
10395set pthread.h i_pthread
10396eval $inhdr
10397
10398
10399
10400
10401: how to create joinable pthreads
10402if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10403 echo " "
10404 echo "Checking what constant to use for creating joinable pthreads..." >&4
10405 $cat >try.c <<'EOCP'
10406#include <pthread.h>
10407int main() {
10408 int detachstate = JOINABLE;
10409}
10410EOCP
10411 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10412 if eval $compile; then
10413 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10414 val="$undef" # Yes, undef.
10415 set d_old_pthread_create_joinable
10416 eval $setvar
10417 val=""
10418 set old_pthread_create_joinable
10419 eval $setvar
10420 else
10421 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10422 if eval $compile; then
10423 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10424 val="$define"
10425 set d_old_pthread_create_joinable
10426 eval $setvar
10427 val=PTHREAD_CREATE_UNDETACHED
10428 set old_pthread_create_joinable
10429 eval $setvar
10430 else
10431 set try -DJOINABLE=__UNDETACHED
10432 if eval $compile; then
10433 echo "You seem to use __UNDETACHED." >&4
10434 val="$define"
10435 set d_old_pthread_create_joinable
10436 eval $setvar
10437 val=__UNDETACHED
10438 set old_pthread_create_joinable
10439 eval $setvar
10440 else
10441 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
10442 val="$define"
10443 set d_old_pthread_create_joinable
10444 eval $setvar
10445 val=0
10446 set old_pthread_create_joinable
10447 eval $setvar
10448 fi
10449 fi
10450 fi
10451 $rm -f try try.*
10452else
10453 d_old_pthread_create_joinable="$undef"
10454 old_pthread_create_joinable=""
10455fi
10456
10457: see if pause exists
10458set pause d_pause
10459eval $inlibc
10460
10461: see if pipe exists
10462set pipe d_pipe
10463eval $inlibc
10464
10465: see if poll exists
10466set poll d_poll
10467eval $inlibc
10468
10469
10470: see whether the various POSIXish _yields exist
10471$cat >try.c <<EOP
10472#include <pthread.h>
10473#include <stdio.h>
10474int main() {
10475#ifdef SCHED_YIELD
10476 sched_yield();
10477#else
10478#ifdef PTHREAD_YIELD
10479 pthread_yield();
10480#else
10481#ifdef PTHREAD_YIELD_NULL
10482 pthread_yield(NULL);
10483#endif
10484#endif
10485#endif
10486}
10487EOP
10488: see if sched_yield exists
10489set try -DSCHED_YIELD
10490if eval $compile; then
10491 val="$define"
10492 sched_yield='sched_yield()'
10493else
10494 val="$undef"
10495fi
10496case "$usethreads" in
10497$define)
10498 case "$val" in
10499 $define) echo 'sched_yield() found.' >&4 ;;
10500 *) echo 'sched_yield() NOT found.' >&4 ;;
10501 esac
10502esac
10503set d_sched_yield
10504eval $setvar
10505
10506: see if pthread_yield exists
10507set try -DPTHREAD_YIELD
10508if eval $compile; then
10509 val="$define"
10510 case "$sched_yield" in
10511 '') sched_yield='pthread_yield()' ;;
10512 esac
10513else
10514 set try -DPTHREAD_YIELD_NULL
10515 if eval $compile; then
10516 val="$define"
10517 case "$sched_yield" in
10518 '') sched_yield='pthread_yield(NULL)' ;;
10519 esac
10520 else
10521 val="$undef"
10522 fi
10523fi
10524case "$usethreads" in
10525$define)
10526 case "$val" in
10527 $define) echo 'pthread_yield() found.' >&4 ;;
10528 *) echo 'pthread_yield() NOT found.' >&4 ;;
10529 esac
10530 ;;
10531esac
10532set d_pthread_yield
10533eval $setvar
10534
10535case "$sched_yield" in
10536'') sched_yield=undef ;;
10537esac
10538
10539$rm -f try try.*
10540
10541: see if this is a pwd.h system
10542set pwd.h i_pwd
10543eval $inhdr
10544
10545case "$i_pwd" in
10546$define)
10547 xxx=`./findhdr pwd.h`
10548 $cppstdin $cppflags $cppminus < $xxx >$$.h
10549
10550 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10551 val="$define"
10552 else
10553 val="$undef"
10554 fi
10555 set d_pwquota
10556 eval $setvar
10557
10558 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10559 val="$define"
10560 else
10561 val="$undef"
10562 fi
10563 set d_pwage
10564 eval $setvar
10565
10566 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10567 val="$define"
10568 else
10569 val="$undef"
10570 fi
10571 set d_pwchange
10572 eval $setvar
10573
10574 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10575 val="$define"
10576 else
10577 val="$undef"
10578 fi
10579 set d_pwclass
10580 eval $setvar
10581
10582 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10583 val="$define"
10584 else
10585 val="$undef"
10586 fi
10587 set d_pwexpire
10588 eval $setvar
10589
10590 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10591 val="$define"
10592 else
10593 val="$undef"
10594 fi
10595 set d_pwcomment
10596 eval $setvar
10597
10598 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10599 val="$define"
10600 else
10601 val="$undef"
10602 fi
10603 set d_pwgecos
10604 eval $setvar
10605
10606 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10607 val="$define"
10608 else
10609 val="$undef"
10610 fi
10611 set d_pwpasswd
10612 eval $setvar
10613
10614 $rm -f $$.h
10615 ;;
10616*)
10617 val="$undef";
10618 set d_pwquota; eval $setvar
10619 set d_pwage; eval $setvar
10620 set d_pwchange; eval $setvar
10621 set d_pwclass; eval $setvar
10622 set d_pwexpire; eval $setvar
10623 set d_pwcomment; eval $setvar
10624 set d_pwgecos; eval $setvar
10625 set d_pwpasswd; eval $setvar
10626 ;;
10627esac
10628
10629: see if readdir and friends exist
10630set readdir d_readdir
10631eval $inlibc
10632set seekdir d_seekdir
10633eval $inlibc
10634set telldir d_telldir
10635eval $inlibc
10636set rewinddir d_rewinddir
10637eval $inlibc
10638
10639: see if readlink exists
10640set readlink d_readlink
10641eval $inlibc
10642
10643: see if rename exists
10644set rename d_rename
10645eval $inlibc
10646
10647: see if rmdir exists
10648set rmdir d_rmdir
10649eval $inlibc
10650
10651: see if memory.h is available.
10652val=''
10653set memory.h val
10654eval $inhdr
10655
10656: See if it conflicts with string.h
10657case "$val" in
10658$define)
10659 case "$strings" in
10660 '') ;;
10661 *)
10662 $cppstdin $cppflags $cppminus < $strings > mem.h
10663 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10664 echo " "
10665 echo "We won't be including <memory.h>."
10666 val="$undef"
10667 fi
10668 $rm -f mem.h
10669 ;;
10670 esac
10671esac
10672set i_memory
10673eval $setvar
10674
10675: can bcopy handle overlapping blocks?
10676val="$undef"
10677case "$d_bcopy" in
10678"$define")
10679 echo " "
10680 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10681 $cat >try.c <<EOCP
10682#$i_memory I_MEMORY
10683#$i_stdlib I_STDLIB
10684#$i_string I_STRING
10685#$i_unistd I_UNISTD
10686EOCP
10687 $cat >>try.c <<'EOCP'
10688#include <stdio.h>
10689#ifdef I_MEMORY
10690# include <memory.h>
10691#endif
10692#ifdef I_STDLIB
10693# include <stdlib.h>
10694#endif
10695#ifdef I_STRING
10696# include <string.h>
10697#else
10698# include <strings.h>
10699#endif
10700#ifdef I_UNISTD
10701# include <unistd.h> /* Needed for NetBSD */
10702#endif
10703int main()
10704{
10705char buf[128], abc[128];
10706char *b;
10707int len;
10708int off;
10709int align;
10710
10711bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10712
10713for (align = 7; align >= 0; align--) {
10714 for (len = 36; len; len--) {
10715 b = buf+align;
10716 bcopy(abc, b, len);
10717 for (off = 1; off <= len; off++) {
10718 bcopy(b, b+off, len);
10719 bcopy(b+off, b, len);
10720 if (bcmp(b, abc, len))
10721 exit(1);
10722 }
10723 }
10724}
10725exit(0);
10726}
10727EOCP
10728 set try
10729 if eval $compile_ok; then
10730 if ./try 2>/dev/null; then
10731 echo "Yes, it can."
10732 val="$define"
10733 else
10734 echo "It can't, sorry."
10735 case "$d_memmove" in
10736 "$define") echo "But that's Ok since you have memmove()." ;;
10737 esac
10738 fi
10739 else
10740 echo "(I can't compile the test program, so we'll assume not...)"
10741 case "$d_memmove" in
10742 "$define") echo "But that's Ok since you have memmove()." ;;
10743 esac
10744 fi
10745 ;;
10746esac
10747$rm -f try.* try core
10748set d_safebcpy
10749eval $setvar
10750
10751: can memcpy handle overlapping blocks?
10752val="$undef"
10753case "$d_memcpy" in
10754"$define")
10755 echo " "
10756 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10757 $cat >try.c <<EOCP
10758#$i_memory I_MEMORY
10759#$i_stdlib I_STDLIB
10760#$i_string I_STRING
10761#$i_unistd I_UNISTD
10762EOCP
10763 $cat >>try.c <<'EOCP'
10764#include <stdio.h>
10765#ifdef I_MEMORY
10766# include <memory.h>
10767#endif
10768#ifdef I_STDLIB
10769# include <stdlib.h>
10770#endif
10771#ifdef I_STRING
10772# include <string.h>
10773#else
10774# include <strings.h>
10775#endif
10776#ifdef I_UNISTD
10777# include <unistd.h> /* Needed for NetBSD */
10778#endif
10779int main()
10780{
10781char buf[128], abc[128];
10782char *b;
10783int len;
10784int off;
10785int align;
10786
10787/* Copy "abcde..." string to char abc[] so that gcc doesn't
10788 try to store the string in read-only memory. */
10789memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10790
10791for (align = 7; align >= 0; align--) {
10792 for (len = 36; len; len--) {
10793 b = buf+align;
10794 memcpy(b, abc, len);
10795 for (off = 1; off <= len; off++) {
10796 memcpy(b+off, b, len);
10797 memcpy(b, b+off, len);
10798 if (memcmp(b, abc, len))
10799 exit(1);
10800 }
10801 }
10802}
10803exit(0);
10804}
10805EOCP
10806 set try
10807 if eval $compile_ok; then
10808 if ./try 2>/dev/null; then
10809 echo "Yes, it can."
10810 val="$define"
10811 else
10812 echo "It can't, sorry."
10813 case "$d_memmove" in
10814 "$define") echo "But that's Ok since you have memmove()." ;;
10815 esac
10816 fi
10817 else
10818 echo "(I can't compile the test program, so we'll assume not...)"
10819 case "$d_memmove" in
10820 "$define") echo "But that's Ok since you have memmove()." ;;
10821 esac
10822 fi
10823 ;;
10824esac
10825$rm -f try.* try core
10826set d_safemcpy
10827eval $setvar
10828
10829: can memcmp be trusted to compare relative magnitude?
10830val="$undef"
10831case "$d_memcmp" in
10832"$define")
10833 echo " "
10834 echo "Checking if your memcmp() can compare relative magnitude..." >&4
10835 $cat >try.c <<EOCP
10836#$i_memory I_MEMORY
10837#$i_stdlib I_STDLIB
10838#$i_string I_STRING
10839#$i_unistd I_UNISTD
10840EOCP
10841 $cat >>try.c <<'EOCP'
10842#include <stdio.h>
10843#ifdef I_MEMORY
10844# include <memory.h>
10845#endif
10846#ifdef I_STDLIB
10847# include <stdlib.h>
10848#endif
10849#ifdef I_STRING
10850# include <string.h>
10851#else
10852# include <strings.h>
10853#endif
10854#ifdef I_UNISTD
10855# include <unistd.h> /* Needed for NetBSD */
10856#endif
10857int main()
10858{
10859char a = -1;
10860char b = 0;
10861if ((a < b) && memcmp(&a, &b, 1) < 0)
10862 exit(1);
10863exit(0);
10864}
10865EOCP
10866 set try
10867 if eval $compile_ok; then
10868 if ./try 2>/dev/null; then
10869 echo "Yes, it can."
10870 val="$define"
10871 else
10872 echo "No, it can't (it uses signed chars)."
10873 fi
10874 else
10875 echo "(I can't compile the test program, so we'll assume not...)"
10876 fi
10877 ;;
10878esac
10879$rm -f try.* try core
10880set d_sanemcmp
10881eval $setvar
10882
10883: see if select exists
10884set select d_select
10885eval $inlibc
10886
10887: see if semctl exists
10888set semctl d_semctl
10889eval $inlibc
10890
10891: see if semget exists
10892set semget d_semget
10893eval $inlibc
10894
10895: see if semop exists
10896set semop d_semop
10897eval $inlibc
10898
10899: see how much of the 'sem*(2)' library is present.
10900h_sem=true
10901echo " "
10902case "$d_semctl$d_semget$d_semop" in
10903*"$undef"*) h_sem=false;;
10904esac
10905case "$osname" in
10906freebsd)
10907 case "`ipcs 2>&1`" in
10908 "SVID messages"*"not configured"*)
10909 echo "Your $osname does not have the sem*(2) configured." >&4
10910 h_sem=false
10911 val="$undef"
10912 set semctl d_semctl
10913 eval $setvar
10914 set semget d_semget
10915 eval $setvar
10916 set semop d_semop
10917 eval $setvar
10918 ;;
10919 esac
10920 ;;
10921esac
10922: we could also check for sys/ipc.h ...
10923if $h_sem && $test `./findhdr sys/sem.h`; then
10924 echo "You have the full sem*(2) library." >&4
10925 val="$define"
10926else
10927 echo "You don't have the full sem*(2) library." >&4
10928 val="$undef"
10929fi
10930set d_sem
10931eval $setvar
10932
10933: see whether sys/sem.h defines union semun
10934echo " "
10935$cat > try.c <<'END'
10936#include <sys/types.h>
10937#include <sys/ipc.h>
10938#include <sys/sem.h>
10939int main () { union semun semun; semun.buf = 0; }
10940END
10941set try
10942if eval $compile; then
10943 echo "You have union semun in <sys/sem.h>." >&4
10944 val="$define"
10945else
10946 echo "You do not have union semun in <sys/sem.h>." >&4
10947 val="$undef"
10948fi
10949$rm -f try try.c try.h
10950set d_union_semun
10951eval $setvar
10952
10953: see how to do semctl IPC_STAT
10954case "$d_sem" in
10955$define)
10956 : see whether semctl IPC_STAT can use union semun
10957 echo " "
10958 $cat > try.h <<END
10959#ifndef S_IRUSR
10960# ifdef S_IREAD
10961# define S_IRUSR S_IREAD
10962# define S_IWUSR S_IWRITE
10963# define S_IXUSR S_IEXEC
10964# else
10965# define S_IRUSR 0400
10966# define S_IWUSR 0200
10967# define S_IXUSR 0100
10968# endif
10969# define S_IRGRP (S_IRUSR>>3)
10970# define S_IWGRP (S_IWUSR>>3)
10971# define S_IXGRP (S_IXUSR>>3)
10972# define S_IROTH (S_IRUSR>>6)
10973# define S_IWOTH (S_IWUSR>>6)
10974# define S_IXOTH (S_IXUSR>>6)
10975#endif
10976#ifndef S_IRWXU
10977# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10978# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10979# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10980#endif
10981END
10982
10983 $cat > try.c <<END
10984#include <sys/types.h>
10985#include <sys/ipc.h>
10986#include <sys/sem.h>
10987#include <sys/stat.h>
10988#include <stdio.h>
10989#include <errno.h>
10990#include "try.h"
10991#ifndef errno
10992extern int errno;
10993#endif
10994#$d_union_semun HAS_UNION_SEMUN
10995int main() {
10996 union semun
10997#ifndef HAS_UNION_SEMUN
10998 {
10999 int val;
11000 struct semid_ds *buf;
11001 unsigned short *array;
11002 }
11003#endif
11004 arg;
11005 int sem, st;
11006
11007#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11008 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11009 if (sem > -1) {
11010 struct semid_ds argbuf;
11011 arg.buf = &argbuf;
11012# ifdef IPC_STAT
11013 st = semctl(sem, 0, IPC_STAT, arg);
11014 if (st == 0)
11015 printf("semun\n");
11016 else
11017# endif /* IPC_STAT */
11018 printf("semctl IPC_STAT failed: errno = %d\n", errno);
11019# ifdef IPC_RMID
11020 if (semctl(sem, 0, IPC_RMID, arg) != 0)
11021# endif /* IPC_RMID */
11022 printf("semctl IPC_RMID failed: errno = %d\n", errno);
11023 } else
11024#endif /* IPC_PRIVATE && ... */
11025 printf("semget failed: errno = %d\n", errno);
11026 return 0;
11027}
11028END
11029 val="$undef"
11030 set try
11031 if eval $compile; then
11032 xxx=`./try`
11033 case "$xxx" in
11034 semun) val="$define" ;;
11035 esac
11036 fi
11037 $rm -f try try.c
11038 set d_semctl_semun
11039 eval $setvar
11040 case "$d_semctl_semun" in
11041 $define)
11042 echo "You can use union semun for semctl IPC_STAT." >&4
11043 also='also'
11044 ;;
11045 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
11046 also=''
11047 ;;
11048 esac
11049
11050 : see whether semctl IPC_STAT can use struct semid_ds pointer
11051 $cat > try.c <<'END'
11052#include <sys/types.h>
11053#include <sys/ipc.h>
11054#include <sys/sem.h>
11055#include <sys/stat.h>
11056#include "try.h"
11057#include <stdio.h>
11058#include <errno.h>
11059#ifndef errno
11060extern int errno;
11061#endif
11062int main() {
11063 struct semid_ds arg;
11064 int sem, st;
11065
11066#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11067 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11068 if (sem > -1) {
11069# ifdef IPC_STAT
11070 st = semctl(sem, 0, IPC_STAT, &arg);
11071 if (st == 0)
11072 printf("semid_ds\n");
11073 else
11074# endif /* IPC_STAT */
11075 printf("semctl IPC_STAT failed: errno = %d\n", errno);
11076# ifdef IPC_RMID
11077 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11078# endif /* IPC_RMID */
11079 printf("semctl IPC_RMID failed: errno = %d\n", errno);
11080 } else
11081#endif /* IPC_PRIVATE && ... */
11082 printf("semget failed: errno = %d\n", errno);
11083
11084 return 0;
11085}
11086END
11087 val="$undef"
11088 set try
11089 if eval $compile; then
11090 xxx=`./try`
11091 case "$xxx" in
11092 semid_ds) val="$define" ;;
11093 esac
11094 fi
11095 $rm -f try try.c
11096 set d_semctl_semid_ds
11097 eval $setvar
11098 case "$d_semctl_semid_ds" in
11099 $define)
11100 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11101 ;;
11102 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11103 ;;
11104 esac
11105 $rm -f try.h
11106 ;;
11107*) val="$undef"
11108
11109 # We do not have the full sem*(2) library, so assume we can not
11110 # use either.
11111
11112 set d_semctl_semun
11113 eval $setvar
11114
11115 set d_semctl_semid_ds
11116 eval $setvar
11117 ;;
11118esac
11119
11120: see if setegid exists
11121set setegid d_setegid
11122eval $inlibc
11123
11124: see if seteuid exists
11125set seteuid d_seteuid
11126eval $inlibc
11127
11128: see if setgrent exists
11129set setgrent d_setgrent
11130eval $inlibc
11131
11132: see if sethostent exists
11133set sethostent d_sethent
11134eval $inlibc
11135
11136: see if setlinebuf exists
11137set setlinebuf d_setlinebuf
11138eval $inlibc
11139
11140: see if setlocale exists
11141set setlocale d_setlocale
11142eval $inlibc
11143
11144: see if setnetent exists
11145set setnetent d_setnent
11146eval $inlibc
11147
11148: see if setprotoent exists
11149set setprotoent d_setpent
11150eval $inlibc
11151
11152: see if setpgid exists
11153set setpgid d_setpgid
11154eval $inlibc
11155
11156: see if setpgrp2 exists
11157set setpgrp2 d_setpgrp2
11158eval $inlibc
11159
11160: see if setpriority exists
11161set setpriority d_setprior
11162eval $inlibc
11163
11164: see if setproctitle exists
11165set setproctitle d_setproctitle
11166eval $inlibc
11167
11168: see if setpwent exists
11169set setpwent d_setpwent
11170eval $inlibc
11171
11172: see if setregid exists
11173set setregid d_setregid
11174eval $inlibc
11175set setresgid d_setresgid
11176eval $inlibc
11177
11178: see if setreuid exists
11179set setreuid d_setreuid
11180eval $inlibc
11181set setresuid d_setresuid
11182eval $inlibc
11183
11184: see if setrgid exists
11185set setrgid d_setrgid
11186eval $inlibc
11187
11188: see if setruid exists
11189set setruid d_setruid
11190eval $inlibc
11191
11192: see if setservent exists
11193set setservent d_setsent
11194eval $inlibc
11195
11196: see if setsid exists
11197set setsid d_setsid
11198eval $inlibc
11199
11200: see if setvbuf exists
11201set setvbuf d_setvbuf
11202eval $inlibc
11203
11204: see if sfio.h is available
11205set sfio.h i_sfio
11206eval $inhdr
11207
11208
11209: see if sfio library is available
11210case "$i_sfio" in
11211$define)
11212 val=''
11213 set sfreserve val
11214 eval $inlibc
11215 ;;
11216*)
11217 val="$undef"
11218 ;;
11219esac
11220: Ok, but do we want to use it.
11221case "$val" in
11222$define)
11223 case "$usesfio" in
11224 true|$define|[yY]*) dflt='y';;
11225 *) dflt='n';;
11226 esac
11227 echo "$package can use the sfio library, but it is experimental."
11228 case "$useperlio" in
11229 "$undef")
11230 echo "For sfio also the PerlIO abstraction layer is needed."
11231 echo "Earlier you said you wouldn't want that."
11232 ;;
11233 esac
11234 rp="You seem to have sfio available, do you want to try using it?"
11235 . ./myread
11236 case "$ans" in
11237 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
11238 useperlio="$define"
11239 val="$define"
11240 ;;
11241 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
11242 val="$undef"
11243 : Remove sfio from list of libraries to use
11244 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11245 shift
11246 libs="$*"
11247 echo "libs = $libs" >&4
11248 ;;
11249 esac
11250 ;;
11251*) case "$usesfio" in
11252 true|$define|[yY]*)
11253 echo "Sorry, cannot find sfio on this machine." >&4
11254 echo "Ignoring your setting of usesfio=$usesfio." >&4
11255 val="$undef"
11256 ;;
11257 esac
11258 ;;
11259esac
11260set d_sfio
11261eval $setvar
11262case "$d_sfio" in
11263$define) usesfio='true';;
11264*) usesfio='false';;
11265esac
11266
11267: see if shmctl exists
11268set shmctl d_shmctl
11269eval $inlibc
11270
11271: see if shmget exists
11272set shmget d_shmget
11273eval $inlibc
11274
11275: see if shmat exists
11276set shmat d_shmat
11277eval $inlibc
11278: see what shmat returns
11279case "$d_shmat" in
11280"$define")
11281 $cat >shmat.c <<'END'
11282#include <sys/shm.h>
11283void *shmat();
11284END
11285 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11286 shmattype='void *'
11287 else
11288 shmattype='char *'
11289 fi
11290 echo "and it returns ($shmattype)." >&4
11291 : see if a prototype for shmat is available
11292 xxx=`./findhdr sys/shm.h`
11293 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11294 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11295 val="$define"
11296 else
11297 val="$undef"
11298 fi
11299 $rm -f shmat.[co]
11300 ;;
11301*)
11302 val="$undef"
11303 ;;
11304esac
11305set d_shmatprototype
11306eval $setvar
11307
11308: see if shmdt exists
11309set shmdt d_shmdt
11310eval $inlibc
11311
11312: see how much of the 'shm*(2)' library is present.
11313h_shm=true
11314echo " "
11315case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11316*"$undef"*) h_shm=false;;
11317esac
11318case "$osname" in
11319freebsd)
11320 case "`ipcs 2>&1`" in
11321 "SVID shared memory"*"not configured"*)
11322 echo "Your $osname does not have the shm*(2) configured." >&4
11323 h_shm=false
11324 val="$undef"
11325 set shmctl d_shmctl
11326 evat $setvar
11327 set shmget d_shmget
11328 evat $setvar
11329 set shmat d_shmat
11330 evat $setvar
11331 set shmdt d_shmdt
11332 evat $setvar
11333 ;;
11334 esac
11335 ;;
11336esac
11337: we could also check for sys/ipc.h ...
11338if $h_shm && $test `./findhdr sys/shm.h`; then
11339 echo "You have the full shm*(2) library." >&4
11340 val="$define"
11341else
11342 echo "You don't have the full shm*(2) library." >&4
11343 val="$undef"
11344fi
11345set d_shm
11346eval $setvar
11347
11348echo " "
11349: see if we have sigaction
11350if set sigaction val -f d_sigaction; eval $csym; $val; then
11351 echo 'sigaction() found.' >&4
11352 $cat > try.c <<'EOP'
11353#include <stdio.h>
11354#include <sys/types.h>
11355#include <signal.h>
11356int main()
11357{
11358 struct sigaction act, oact;
11359 act.sa_flags = 0;
11360 oact.sa_handler = 0;
11361 /* so that act and oact are used */
11362 exit(act.sa_flags == 0 && oact.sa_handler == 0);
11363}
11364EOP
11365 set try
11366 if eval $compile_ok; then
11367 val="$define"
11368 else
11369 echo "But you don't seem to have a useable struct sigaction." >&4
11370 val="$undef"
11371 fi
11372else
11373 echo 'sigaction NOT found.' >&4
11374 val="$undef"
11375fi
11376set d_sigaction; eval $setvar
11377$rm -f try try$_o try.c
11378
11379: see if sigsetjmp exists
11380echo " "
11381case "$d_sigsetjmp" in
11382'')
11383 $cat >try.c <<'EOP'
11384#include <setjmp.h>
11385sigjmp_buf env;
11386int set = 1;
11387int main()
11388{
11389 if (sigsetjmp(env,1))
11390 exit(set);
11391 set = 0;
11392 siglongjmp(env, 1);
11393 exit(1);
11394}
11395EOP
11396 set try
11397 if eval $compile; then
11398 if ./try >/dev/null 2>&1; then
11399 echo "POSIX sigsetjmp found." >&4
11400 val="$define"
11401 else
11402 $cat >&4 <<EOM
11403Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11404I'll ignore them.
11405EOM
11406 val="$undef"
11407 fi
11408 else
11409 echo "sigsetjmp not found." >&4
11410 val="$undef"
11411 fi
11412 ;;
11413*) val="$d_sigsetjmp"
11414 case "$d_sigsetjmp" in
11415 $define) echo "POSIX sigsetjmp found." >&4;;
11416 $undef) echo "sigsetjmp not found." >&4;;
11417 esac
11418 ;;
11419esac
11420set d_sigsetjmp
11421eval $setvar
11422$rm -f try.c try
11423
11424: see if socks5_init exists
11425set socks5_init d_socks5_init
11426eval $inlibc
11427
11428: see if sys/stat.h is available
11429set sys/stat.h i_sysstat
11430eval $inhdr
11431
11432
11433: see if stat knows about block sizes
11434echo " "
11435echo "Checking to see if your struct stat has st_blocks field..." >&4
11436set d_statblks stat st_blocks $i_sysstat sys/stat.h
11437eval $hasfield
11438
11439
11440: see if this is a sys/vfs.h system
11441set sys/vfs.h i_sysvfs
11442eval $inhdr
11443
11444
11445: see if this is a sys/statfs.h system
11446set sys/statfs.h i_sysstatfs
11447eval $inhdr
11448
11449
11450echo " "
11451echo "Checking to see if your system supports struct statfs..." >&4
11452set 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
11453eval $hasstruct
11454case "$d_statfs_s" in
11455"$define") echo "Yes, it does." ;;
11456*) echo "No, it doesn't." ;;
11457esac
11458
11459
11460
11461: see if struct statfs knows about f_flags
11462case "$d_statfs_s" in
11463define)
11464 echo " "
11465 echo "Checking to see if your struct statfs has f_flags field..." >&4
11466 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
11467 eval $hasfield
11468 ;;
11469*) val="$undef"
11470 set d_statfs_f_flags
11471 eval $setvar
11472 ;;
11473esac
11474case "$d_statfs_f_flags" in
11475"$define") echo "Yes, it does." ;;
11476*) echo "No, it doesn't." ;;
11477esac
11478
11479: see if _ptr and _cnt from stdio act std
11480echo " "
80f36755
NC
11481
11482if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11483 echo "(Looks like you have stdio.h from BSD.)"
11484 case "$stdio_ptr" in
11485 '') stdio_ptr='((fp)->_p)'
11486 ptr_lval=$define
11487 ;;
11488 *) ptr_lval=$d_stdio_ptr_lval;;
11489 esac
11490 case "$stdio_cnt" in
11491 '') stdio_cnt='((fp)->_r)'
11492 cnt_lval=$define
11493 ;;
11494 *) cnt_lval=$d_stdio_cnt_lval;;
11495 esac
11496 case "$stdio_base" in
11497 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11498 esac
11499 case "$stdio_bufsiz" in
11500 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11501 esac
11502elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
b4eb6b3d
JH
11503 echo "(Looks like you have stdio.h from Linux.)"
11504 case "$stdio_ptr" in
11505 '') stdio_ptr='((fp)->_IO_read_ptr)'
11506 ptr_lval=$define
11507 ;;
11508 *) ptr_lval=$d_stdio_ptr_lval;;
11509 esac
11510 case "$stdio_cnt" in
11511 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11512 cnt_lval=$undef
11513 ;;
11514 *) cnt_lval=$d_stdio_cnt_lval;;
11515 esac
11516 case "$stdio_base" in
11517 '') stdio_base='((fp)->_IO_read_base)';;
11518 esac
11519 case "$stdio_bufsiz" in
11520 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11521 esac
11522else
11523 case "$stdio_ptr" in
11524 '') stdio_ptr='((fp)->_ptr)'
11525 ptr_lval=$define
11526 ;;
11527 *) ptr_lval=$d_stdio_ptr_lval;;
11528 esac
11529 case "$stdio_cnt" in
11530 '') stdio_cnt='((fp)->_cnt)'
11531 cnt_lval=$define
11532 ;;
11533 *) cnt_lval=$d_stdio_cnt_lval;;
11534 esac
11535 case "$stdio_base" in
11536 '') stdio_base='((fp)->_base)';;
11537 esac
11538 case "$stdio_bufsiz" in
11539 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11540 esac
11541fi
80f36755 11542
b4eb6b3d
JH
11543: test whether _ptr and _cnt really work
11544echo "Checking how std your stdio is..." >&4
11545$cat >try.c <<EOP
11546#include <stdio.h>
11547#define FILE_ptr(fp) $stdio_ptr
11548#define FILE_cnt(fp) $stdio_cnt
11549int main() {
11550 FILE *fp = fopen("try.c", "r");
11551 char c = getc(fp);
11552 if (
11553 18 <= FILE_cnt(fp) &&
11554 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11555 )
11556 exit(0);
11557 exit(1);
11558}
11559EOP
11560val="$undef"
11561set try
11562if eval $compile; then
11563 if ./try; then
11564 echo "Your stdio acts pretty std."
11565 val="$define"
11566 else
11567 echo "Your stdio isn't very std."
11568 fi
11569else
11570 echo "Your stdio doesn't appear very std."
11571fi
11572$rm -f try.c try
11573set d_stdstdio
11574eval $setvar
11575
11576: Can _ptr be used as an lvalue?
11577case "$d_stdstdio$ptr_lval" in
11578$define$define) val=$define ;;
11579*) val=$undef ;;
11580esac
11581set d_stdio_ptr_lval
11582eval $setvar
11583
11584: Can _cnt be used as an lvalue?
11585case "$d_stdstdio$cnt_lval" in
11586$define$define) val=$define ;;
11587*) val=$undef ;;
11588esac
11589set d_stdio_cnt_lval
11590eval $setvar
11591
a7ffa9b9
NC
11592
11593: test whether setting _ptr sets _cnt as a side effect
11594d_stdio_ptr_lval_sets_cnt="$undef"
11595d_stdio_ptr_lval_nochange_cnt="$undef"
11596case "$d_stdio_ptr_lval$d_stdstdio" in
11597$define$define)
11598 echo "Checking to see what happens if we set the stdio ptr..." >&4
11599$cat >try.c <<EOP
11600#include <stdio.h>
11601/* Can we scream? */
11602/* Eat dust sed :-) */
c1d9e6fa 11603/* In the buffer space, no one can hear you scream. */
0bbfc344
JH
11604#define FILE_ptr(fp) $stdio_ptr
11605#define FILE_cnt(fp) $stdio_cnt
c1d9e6fa 11606#include <sys/types.h>
a7ffa9b9
NC
11607int main() {
11608 FILE *fp = fopen("try.c", "r");
c1d9e6fa 11609 int c;
a7ffa9b9
NC
11610 char *ptr;
11611 size_t cnt;
c1d9e6fa
JH
11612 if (!fp) {
11613 puts("Fail even to read");
11614 exit(1);
11615 }
11616 c = getc(fp); /* Read away the first # */
11617 if (c == EOF) {
11618 puts("Fail even to read");
11619 exit(1);
11620 }
a7ffa9b9
NC
11621 if (!(
11622 18 <= FILE_cnt(fp) &&
11623 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11624 )) {
11625 puts("Fail even to read");
11626 exit (1);
11627 }
c1d9e6fa
JH
11628 ptr = (char*) FILE_ptr(fp);
11629 cnt = (size_t)FILE_cnt(fp);
a7ffa9b9 11630
c1d9e6fa 11631 FILE_ptr(fp) += 42;
a7ffa9b9 11632
c1d9e6fa 11633 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
a7ffa9b9
NC
11634 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11635 exit (1);
11636 }
11637 if (FILE_cnt(fp) <= 20) {
11638 printf ("Fail (<20 chars to test)");
11639 exit (1);
11640 }
11641 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11642 puts("Fail compare");
11643 exit (1);
11644 }
11645 if (cnt == FILE_cnt(fp)) {
11646 puts("Pass_unchanged");
11647 exit (0);
11648 }
11649 if (FILE_cnt(fp) == (cnt - 42)) {
11650 puts("Pass_changed");
11651 exit (0);
11652 }
11653 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11654 return 1;
11655
11656}
11657EOP
11658 set try
11659 if eval $compile; then
11660 case `./try$exe_ext` in
11661 Pass_changed)
2e32dcfe 11662 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
a7ffa9b9
NC
11663 d_stdio_ptr_lval_sets_cnt="$define" ;;
11664 Pass_unchanged)
11665 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
11666 d_stdio_ptr_lval_nochange_cnt="$define" ;;
11667 Fail*)
11668 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
11669 *)
11670 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11671 esac
11672 else
11673 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
11674 fi
11675 $rm -f try.c try
11676 ;;
11677esac
11678
b4eb6b3d
JH
11679: see if _base is also standard
11680val="$undef"
11681case "$d_stdstdio" in
11682$define)
11683 $cat >try.c <<EOP
11684#include <stdio.h>
11685#define FILE_base(fp) $stdio_base
11686#define FILE_bufsiz(fp) $stdio_bufsiz
11687int main() {
11688 FILE *fp = fopen("try.c", "r");
11689 char c = getc(fp);
11690 if (
11691 19 <= FILE_bufsiz(fp) &&
11692 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11693 )
11694 exit(0);
11695 exit(1);
11696}
11697EOP
11698 set try
11699 if eval $compile; then
11700 if ./try; then
11701 echo "And its _base field acts std."
11702 val="$define"
11703 else
11704 echo "But its _base field isn't std."
11705 fi
11706 else
11707 echo "However, it seems to be lacking the _base field."
11708 fi
11709 $rm -f try.c try
11710 ;;
11711esac
11712set d_stdiobase
11713eval $setvar
11714
11715$cat >&4 <<EOM
11716Checking how to access stdio streams by file descriptor number...
11717EOM
11718case "$stdio_stream_array" in
11719'') $cat >try.c <<EOCP
11720#include <stdio.h>
11721int main() {
11722 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11723 printf("yes\n");
11724}
11725EOCP
11726 for s in _iob __iob __sF
11727 do
11728 set try -DSTDIO_STREAM_ARRAY=$s
11729 if eval $compile; then
11730 case "`./try$exe_ext`" in
11731 yes) stdio_stream_array=$s; break ;;
11732 esac
11733 fi
11734 done
11735 $rm -f try.* try$exe_ext
11736esac
11737case "$stdio_stream_array" in
11738'') $cat >&4 <<EOM
11739I can't figure out how to access stdio streams by file descriptor number.
11740EOM
11741 d_stdio_stream_array="$undef"
11742 ;;
11743*) $cat >&4 <<EOM
11744You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11745EOM
11746 d_stdio_stream_array="$define"
11747 ;;
11748esac
11749
11750: see if strcoll exists
11751set strcoll d_strcoll
11752eval $inlibc
11753
11754: check for structure copying
11755echo " "
11756echo "Checking to see if your C compiler can copy structs..." >&4
11757$cat >try.c <<'EOCP'
11758int main()
11759{
11760 struct blurfl {
11761 int dyick;
11762 } foo, bar;
11763
11764 foo = bar;
11765}
11766EOCP
11767if $cc -c try.c >/dev/null 2>&1 ; then
11768 val="$define"
11769 echo "Yup, it can."
11770else
11771 val="$undef"
11772 echo "Nope, it can't."
11773fi
11774set d_strctcpy
11775eval $setvar
11776$rm -f try.*
11777
11778: see if strerror and/or sys_errlist[] exist
11779echo " "
11780if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11781 if set strerror val -f d_strerror; eval $csym; $val; then
11782 echo 'strerror() found.' >&4
11783 d_strerror="$define"
11784 d_strerrm='strerror(e)'
11785 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11786 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
11787 d_syserrlst="$define"
11788 else
11789 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11790 d_syserrlst="$undef"
11791 fi
11792 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11793 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11794 echo 'strerror() found in string header.' >&4
11795 d_strerror="$define"
11796 d_strerrm='strerror(e)'
11797 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11798 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11799 d_syserrlst="$define"
11800 else
11801 echo "(You don't appear to have any sys_errlist[], how can this be?)"
11802 d_syserrlst="$undef"
11803 fi
11804 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11805 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11806 d_strerror="$undef"
11807 d_syserrlst="$define"
11808 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11809 else
11810 echo 'strerror() and sys_errlist[] NOT found.' >&4
11811 d_strerror="$undef"
11812 d_syserrlst="$undef"
11813 d_strerrm='"unknown"'
11814 fi
11815fi
11816
11817: see if strtod exists
11818set strtod d_strtod
11819eval $inlibc
11820
11821: see if strtol exists
11822set strtol d_strtol
11823eval $inlibc
11824
11825: see if strtold exists
11826set strtold d_strtold
11827eval $inlibc
11828
11829: see if strtoll exists
11830set strtoll d_strtoll
11831eval $inlibc
11832
11833case "$d_longlong-$d_strtoll" in
11834"$define-$define")
11835 $cat <<EOM
11836Checking whether your strtoll() works okay...
11837EOM
11838 $cat >try.c <<'EOCP'
11839#include <errno.h>
11840#ifdef __hpux
11841#define strtoll __strtoll
11842#endif
e75931a7
YST
11843#ifdef __EMX__
11844#define strtoll _strtoll
11845#endif
b4eb6b3d
JH
11846#include <stdio.h>
11847extern long long int strtoll(char *s, char **, int);
11848static int bad = 0;
11849int check(char *s, long long ell, int een) {
11850 long long gll;
11851 errno = 0;
11852 gll = strtoll(s, 0, 10);
11853 if (!((gll == ell) && (errno == een)))
11854 bad++;
11855}
11856int main() {
11857 check(" 1", 1LL, 0);
11858 check(" 0", 0LL, 0);
11859 check("-1", -1LL, 0);
11860 check("-9223372036854775808", -9223372036854775808LL, 0);
11861 check("-9223372036854775808", -9223372036854775808LL, 0);
11862 check(" 9223372036854775807", 9223372036854775807LL, 0);
11863 check("-9223372036854775808", -9223372036854775808LL, 0);
11864 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
11865 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11866 if (!bad)
11867 printf("ok\n");
11868}
11869EOCP
11870 set try
11871 if eval $compile; then
e75931a7
YST
11872 yyy=`./try`
11873 case "$yyy" in
b4eb6b3d
JH
11874 ok) echo "Your strtoll() seems to be working okay." ;;
11875 *) cat <<EOM >&4
11876Your strtoll() doesn't seem to be working okay.
11877EOM
11878 d_strtoll="$undef"
11879 ;;
69eadf66 11880 esac
e75931a7
YST
11881 else
11882 echo "(I can't seem to compile the test program--assuming it doesn't)"
11883 d_strtoll="$undef"
b4eb6b3d
JH
11884 fi
11885 ;;
11886esac
11887
11888: see if strtoul exists
11889set strtoul d_strtoul
11890eval $inlibc
11891
11892: see if strtoull exists
11893set strtoull d_strtoull
11894eval $inlibc
11895
11896case "$d_longlong-$d_strtoull" in
11897"$define-$define")
11898 $cat <<EOM
11899Checking whether your strtoull() works okay...
11900EOM
11901 $cat >try.c <<'EOCP'
11902#include <errno.h>
11903#ifdef __hpux
11904#define strtoull __strtoull
11905#endif
11906#include <stdio.h>
11907extern unsigned long long int strtoull(char *s, char **, int);
11908static int bad = 0;
11909int check(char *s, long long eull, int een) {
11910 long long gull;
11911 errno = 0;
11912 gull = strtoull(s, 0, 10);
11913 if (!((gull == eull) && (errno == een)))
11914 bad++;
11915}
11916int main() {
11917 check(" 1", 1LL, 0);
11918 check(" 0", 0LL, 0);
11919 check("18446744073709551615", 18446744073709551615ULL, 0);
11920 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11921 if (!bad)
11922 printf("ok\n");
11923}
11924EOCP
11925 set try
11926 if eval $compile; then
11927 case "`./try`" in
11928 ok) echo "Your strtoull() seems to be working okay." ;;
11929 *) cat <<EOM >&4
11930Your strtoull() doesn't seem to be working okay.
11931EOM
11932 d_strtoull="$undef"
11933 ;;
11934 esac
11935 fi
11936 ;;
11937esac
11938
11939: see if strtouq exists
11940set strtouq d_strtouq
11941eval $inlibc
11942
11943: see if strxfrm exists
11944set strxfrm d_strxfrm
11945eval $inlibc
11946
11947: see if symlink exists
11948set symlink d_symlink
11949eval $inlibc
11950
11951: see if syscall exists
11952set syscall d_syscall
11953eval $inlibc
11954
11955: see if sysconf exists
11956set sysconf d_sysconf
11957eval $inlibc
11958
11959: see if system exists
11960set system d_system
11961eval $inlibc
11962
11963: see if tcgetpgrp exists
11964set tcgetpgrp d_tcgetpgrp
11965eval $inlibc
11966
11967: see if tcsetpgrp exists
11968set tcsetpgrp d_tcsetpgrp
11969eval $inlibc
11970
11971: see if prototype for telldir is available
11972echo " "
11973set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11974eval $hasproto
11975
11976: see if this is a sys/times.h system
11977set sys/times.h i_systimes
11978eval $inhdr
11979
11980: see if times exists
11981echo " "
11982if set times val -f d_times; eval $csym; $val; then
11983 echo 'times() found.' >&4
11984 d_times="$define"
11985 inc=''
11986 case "$i_systimes" in
11987 "$define") inc='sys/times.h';;
11988 esac
11989 rp="What is the type returned by times() on this system?"
11990 set clock_t clocktype long stdio.h sys/types.h $inc
11991 eval $typedef_ask
11992else
11993 echo 'times() NOT found, hope that will do.' >&4
11994 d_times="$undef"
11995 clocktype='int'
11996fi
11997
11998: see if truncate exists
11999set truncate d_truncate
12000eval $inlibc
12001
12002: see if tzname[] exists
12003echo " "
12004if set tzname val -a d_tzname; eval $csym; $val; then
12005 val="$define"
12006 echo 'tzname[] found.' >&4
12007else
12008 val="$undef"
12009 echo 'tzname[] NOT found.' >&4
12010fi
12011set d_tzname
12012eval $setvar
12013
12014: see if umask exists
12015set umask d_umask
12016eval $inlibc
12017
12018: see if ustat exists
12019set ustat d_ustat
12020eval $inlibc
12021
12022: backward compatibility for d_hvfork
12023if test X$d_hvfork != X; then
12024 d_vfork="$d_hvfork"
12025 d_hvfork=''
12026fi
12027: see if there is a vfork
12028val=''
12029set vfork val
12030eval $inlibc
12031
12032: Ok, but do we want to use it. vfork is reportedly unreliable in
12033: perl on Solaris 2.x, and probably elsewhere.
12034case "$val" in
12035$define)
12036 echo " "
12037 case "$usevfork" in
12038 false) dflt='n';;
12039 *) dflt='y';;
12040 esac
12041 cat <<'EOM'
12042
12043Perl can only use a vfork() that doesn't suffer from strict
12044restrictions on calling functions or modifying global data in
12045the child. For example, glibc-2.1 contains such a vfork()
12046that is unsuitable. If your system provides a proper fork()
12047call, chances are that you do NOT want perl to use vfork().
12048
12049EOM
12050 rp="Do you still want to use vfork()?"
12051 . ./myread
12052 case "$ans" in
12053 y|Y) ;;
12054 *)
12055 echo "Ok, we won't use vfork()."
12056 val="$undef"
12057 ;;
12058 esac
12059 ;;
12060esac
12061set d_vfork
12062eval $setvar
12063case "$d_vfork" in
12064$define) usevfork='true';;
12065*) usevfork='false';;
12066esac
12067
12068: see if this is an sysdir system
12069set sys/dir.h i_sysdir
12070eval $inhdr
12071
12072: see if this is an sysndir system
12073set sys/ndir.h i_sysndir
12074eval $inhdr
12075
12076: see if closedir exists
12077set closedir d_closedir
12078eval $inlibc
12079
12080case "$d_closedir" in
12081"$define")
12082 echo " "
12083 echo "Checking whether closedir() returns a status..." >&4
12084 cat > closedir.c <<EOM
12085#$i_dirent I_DIRENT /**/
12086#$i_sysdir I_SYS_DIR /**/
12087#$i_sysndir I_SYS_NDIR /**/
12088#$i_systypes I_SYS_TYPES /**/
12089
12090#if defined(I_SYS_TYPES)
12091#include <sys/types.h>
12092#endif
12093#if defined(I_DIRENT)
12094#include <dirent.h>
12095#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12096#include <sys/dir.h>
12097#endif
12098#else
12099#ifdef I_SYS_NDIR
12100#include <sys/ndir.h>
12101#else
12102#ifdef I_SYS_DIR
12103#ifdef hp9000s500
12104#include <ndir.h> /* may be wrong in the future */
12105#else
12106#include <sys/dir.h>
12107#endif
12108#endif
12109#endif
12110#endif
12111int main() { return closedir(opendir(".")); }
12112EOM
12113 set closedir
12114 if eval $compile_ok; then
12115 if ./closedir > /dev/null 2>&1 ; then
12116 echo "Yes, it does."
12117 val="$undef"
12118 else
12119 echo "No, it doesn't."
12120 val="$define"
12121 fi
12122 else
12123 echo "(I can't seem to compile the test program--assuming it doesn't)"
12124 val="$define"
12125 fi
12126 ;;
12127*)
12128 val="$undef";
12129 ;;
12130esac
12131set d_void_closedir
12132eval $setvar
12133$rm -f closedir*
b4eb6b3d
JH
12134: see if there is a wait4
12135set wait4 d_wait4
12136eval $inlibc
12137
12138: see if waitpid exists
12139set waitpid d_waitpid
12140eval $inlibc
12141
12142: see if wcstombs exists
12143set wcstombs d_wcstombs
12144eval $inlibc
12145
12146: see if wctomb exists
12147set wctomb d_wctomb
12148eval $inlibc
12149
12150: preserve RCS keywords in files with variable substitution, grrr
12151Date='$Date'
12152Id='$Id'
12153Log='$Log'
12154RCSfile='$RCSfile'
12155Revision='$Revision'
12156
12157case "$crosscompile" in
12158''|[nN]*) crosscompile="$undef" ;;
12159esac
12160
12161case "$osname" in
12162next|rhapsody|darwin) multiarch="$define" ;;
12163esac
12164case "$multiarch" in
12165''|[nN]*) multiarch="$undef" ;;
12166esac
12167
12168: check for alignment requirements
12169echo " "
12170case "$crosscompile$multiarch" in
12171*$define*)
12172 $cat <<EOM
12173You seem to be either cross-compiling or doing a multiarchitecture build,
12174skipping the memory alignment check.
12175
12176EOM
12177 case "$alignbytes" in
12178 '') alignbytes=8 ;;
12179 esac
12180 ;;
12181*)
12182 case "$alignbytes" in
12183 '') echo "Checking alignment constraints..." >&4
12184 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12185 $cat >try.c <<'EOCP'
12186typedef long double NV;
12187EOCP
12188 else
12189 $cat >try.c <<'EOCP'
12190typedef double NV;
12191EOCP
12192 fi
12193 $cat >>try.c <<'EOCP'
12194#include <stdio.h>
12195struct foobar {
12196 char foo;
12197 NV bar;
12198} try_algn;
12199int main()
12200{
12201 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12202 return(0);
12203}
12204EOCP
12205 set try
12206 if eval $compile_ok; then
12207 dflt=`./try`
12208 else
12209 dflt='8'
12210 echo "(I can't seem to compile the test program...)"
12211 fi
12212 ;;
12213 *) dflt="$alignbytes"
12214 ;;
12215 esac
12216 rp="Doubles must be aligned on a how-many-byte boundary?"
12217 . ./myread
12218 alignbytes="$ans"
12219 $rm -f try.c try
12220 ;;
12221esac
12222
12223
12224: set the base revision
12225baserev=5.0
12226
12227: check for ordering of bytes in a long
12228echo " "
12229case "$crosscompile$multiarch" in
12230*$define*)
12231 $cat <<EOM
12232You seem to be either cross-compiling or doing a multiarchitecture build,
12233skipping the byteorder check.
12234
12235EOM
12236 byteorder='0xffff'
12237 ;;
12238*)
12239 case "$byteorder" in
12240 '')
12241 $cat <<'EOM'
12242In the following, larger digits indicate more significance. A big-endian
12243machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12244little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12245machines may have weird orders like 3412. A Cray will report 87654321,
12246an Alpha will report 12345678. If the test program works the default is
12247probably right.
12248I'm now running the test program...
12249EOM
12250 $cat >try.c <<'EOCP'
12251#include <stdio.h>
12252int main()
12253{
12254 int i;
12255 union {
12256 unsigned long l;
12257 char c[sizeof(long)];
12258 } u;
12259
12260 if (sizeof(long) > 4)
12261 u.l = (0x08070605L << 32) | 0x04030201L;
12262 else
12263 u.l = 0x04030201L;
12264 for (i = 0; i < sizeof(long); i++)
12265 printf("%c", u.c[i]+'0');
12266 printf("\n");
12267 exit(0);
12268}
12269EOCP
12270 xxx_prompt=y
12271 set try
12272 if eval $compile && ./try > /dev/null; then
12273 dflt=`./try`
12274 case "$dflt" in
12275 [1-4][1-4][1-4][1-4]|12345678|87654321)
12276 echo "(The test program ran ok.)"
12277 echo "byteorder=$dflt"
12278 xxx_prompt=n
12279 ;;
12280 ????|????????) echo "(The test program ran ok.)" ;;
12281 *) echo "(The test program didn't run right for some reason.)" ;;
12282 esac
12283 else
12284 dflt='4321'
12285 cat <<'EOM'
12286(I can't seem to compile the test program. Guessing big-endian...)
12287EOM
12288 fi
12289 case "$xxx_prompt" in
12290 y)
12291 rp="What is the order of bytes in a long?"
12292 . ./myread
12293 byteorder="$ans"
12294 ;;
12295 *) byteorder=$dflt
12296 ;;
12297 esac
12298 ;;
12299 esac
12300 $rm -f try.c try
12301 ;;
12302esac
12303
12304
12305: how do we catenate cpp tokens here?
12306echo " "
12307echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12308$cat >cpp_stuff.c <<'EOCP'
12309#define RCAT(a,b)a/**/b
12310#define ACAT(a,b)a ## b
12311RCAT(Rei,ser)
12312ACAT(Cir,cus)
12313EOCP
12314$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12315if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12316 echo "Oh! Smells like ANSI's been here." >&4
12317 echo "We can catify or stringify, separately or together!"
12318 cpp_stuff=42
12319elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12320 echo "Ah, yes! The good old days!" >&4
12321 echo "However, in the good old days we don't know how to stringify and"
12322 echo "catify at the same time."
12323 cpp_stuff=1
12324else
12325 $cat >&4 <<EOM
12326Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
12327to have to edit the values of CAT[2-5] in config.h...
12328EOM
12329 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12330fi
12331$rm -f cpp_stuff.*
12332
12333: see if this is a db.h system
12334set db.h i_db
12335eval $inhdr
12336
12337case "$i_db" in
12338$define)
12339 : Check db version.
12340 echo " "
12341 echo "Checking Berkeley DB version ..." >&4
12342 $cat >try.c <<EOCP
12343#$d_const HASCONST
12344#ifndef HASCONST
12345#define const
12346#endif
12347#include <sys/types.h>
12348#include <stdio.h>
12349#include <db.h>
12350int main()
12351{
12352#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12353 int Major, Minor, Patch ;
12354 unsigned long Version ;
12355 (void)db_version(&Major, &Minor, &Patch) ;
12356 printf("You have Berkeley DB Version 2 or greater\n");
12357
12358 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12359 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12360 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12361 Major, Minor, Patch) ;
12362
12363 /* check that db.h & libdb are compatible */
12364 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12365 printf("db.h and libdb are incompatible\n") ;
12366 exit(3);
12367 }
12368
12369 printf("db.h and libdb are compatible\n") ;
12370
12371 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12372 + DB_VERSION_PATCH ;
12373
12374 /* needs to be >= 2.3.4 */
12375 if (Version < 2003004) {
12376 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12377 printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12378 exit(2);
12379 }
12380
12381 exit(0);
12382#else
12383#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12384 printf("You have Berkeley DB Version 1\n");
12385 exit(0); /* DB version < 2: the coast is clear. */
12386#else
12387 exit(1); /* <db.h> not Berkeley DB? */
12388#endif
12389#endif
12390}
12391EOCP
12392 set try
12393 if eval $compile_ok && ./try; then
12394 echo 'Looks OK.' >&4
12395 else
12396 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
12397 i_db=$undef
12398 case " $libs " in
12399 *"-ldb "*)
12400 : Remove db from list of libraries to use
12401 echo "Removing unusable -ldb from library list" >&4
12402 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12403 shift
12404 libs="$*"
12405 echo "libs = $libs" >&4
12406 ;;
12407 esac
12408 fi
12409 $rm -f try.*
12410 ;;
12411esac
12412
12413case "$i_db" in
12414define)
12415 : Check the return type needed for hash
12416 echo " "
12417 echo "Checking return type needed for hash for Berkeley DB ..." >&4
12418 $cat >try.c <<EOCP
12419#$d_const HASCONST
12420#ifndef HASCONST
12421#define const
12422#endif
12423#include <sys/types.h>
12424#include <db.h>
12425
12426#ifndef DB_VERSION_MAJOR
12427u_int32_t hash_cb (ptr, size)
12428const void *ptr;
12429size_t size;
12430{
12431}
12432HASHINFO info;
12433int main()
12434{
12435 info.hash = hash_cb;
12436}
12437#endif
12438EOCP
12439 if $cc $ccflags -c try.c >try.out 2>&1 ; then
12440 if $contains warning try.out >>/dev/null 2>&1 ; then
12441 db_hashtype='int'
12442 else
12443 db_hashtype='u_int32_t'
12444 fi
12445 else
12446 : XXX Maybe we should just give up here.
12447 db_hashtype=u_int32_t
12448 $cat try.out >&4
12449 echo "Help: I can't seem to compile the db test program." >&4
12450 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12451 fi
12452 $rm -f try.*
12453 echo "Your version of Berkeley DB uses $db_hashtype for hash."
12454 ;;
12455*) db_hashtype=u_int32_t
12456 ;;
12457esac
12458case "$i_db" in
12459define)
12460 : Check the return type needed for prefix
12461 echo " "
12462 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12463 cat >try.c <<EOCP
12464#$d_const HASCONST
12465#ifndef HASCONST
12466#define const
12467#endif
12468#include <sys/types.h>
12469#include <db.h>
12470
12471#ifndef DB_VERSION_MAJOR
12472size_t prefix_cb (key1, key2)
12473const DBT *key1;
12474const DBT *key2;
12475{
12476}
12477BTREEINFO info;
12478int main()
12479{
12480 info.prefix = prefix_cb;
12481}
12482#endif
12483EOCP
12484 if $cc $ccflags -c try.c >try.out 2>&1 ; then
12485 if $contains warning try.out >>/dev/null 2>&1 ; then
12486 db_prefixtype='int'
12487 else
12488 db_prefixtype='size_t'
12489 fi
12490 else
12491 db_prefixtype='size_t'
12492 : XXX Maybe we should just give up here.
12493 $cat try.out >&4
12494 echo "Help: I can't seem to compile the db test program." >&4
12495 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12496 fi
12497 $rm -f try.*
12498 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12499 ;;
12500*) db_prefixtype='size_t'
12501 ;;
12502esac
12503
12504: check for void type
12505echo " "
12506echo "Checking to see how well your C compiler groks the void type..." >&4
12507case "$voidflags" in
12508'')
12509 $cat >try.c <<'EOCP'
12510#if TRY & 1
12511void sub() {
12512#else
12513sub() {
12514#endif
12515 extern void moo(); /* function returning void */
12516 void (*goo)(); /* ptr to func returning void */
12517#if TRY & 8
12518 void *hue; /* generic ptr */
12519#endif
12520#if TRY & 2
12521 void (*foo[10])();
12522#endif
12523
12524#if TRY & 4
12525 if(goo == moo) {
12526 exit(0);
12527 }
12528#endif
12529 exit(0);
12530}
12531int main() { sub(); }
12532EOCP
12533 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12534 voidflags=$defvoidused
12535 echo "Good. It appears to support void to the level $package wants.">&4
12536 if $contains warning .out >/dev/null 2>&1; then
12537 echo "However, you might get some warnings that look like this:"
12538 $cat .out
12539 fi
12540 else
12541echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12542 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12543 echo "It supports 1..."
12544 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12545 echo "It also supports 2..."
12546 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12547 voidflags=7
12548 echo "And it supports 4 but not 8 definitely."
12549 else
12550 echo "It doesn't support 4..."
12551 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12552 voidflags=11
12553 echo "But it supports 8."
12554 else
12555 voidflags=3
12556 echo "Neither does it support 8."
12557 fi
12558 fi
12559 else
12560 echo "It does not support 2..."
12561 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12562 voidflags=13
12563 echo "But it supports 4 and 8."
12564 else
12565 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12566 voidflags=5
12567 echo "And it supports 4 but has not heard about 8."
12568 else
12569 echo "However it supports 8 but not 4."
12570 fi
12571 fi
12572 fi
12573 else
12574 echo "There is no support at all for void."
12575 voidflags=0
12576 fi
12577 fi
12578esac
12579case "$voidflags" in
12580"$defvoidused") ;;
12581*) $cat >&4 <<'EOM'
12582 Support flag bits are:
12583 1: basic void declarations.
12584 2: arrays of pointers to functions returning void.
12585 4: operations between pointers to and addresses of void functions.
12586 8: generic void pointers.
12587EOM
12588 dflt="$voidflags";
12589 rp="Your void support flags add up to what?"
12590 . ./myread
12591 voidflags="$ans"
12592 ;;
12593esac
12594$rm -f try.* .out
12595
12596
12597: How can we generate normalized random numbers ?
12598echo " "
12599echo "Looking for a random number function..." >&4
12600case "$randfunc" in
12601'')
12602 if set drand48 val -f; eval $csym; $val; then
12603 dflt="drand48"
12604 echo "Good, found drand48()." >&4
12605 elif set random val -f; eval $csym; $val; then
12606 dflt="random"
12607 echo "OK, found random()." >&4
12608 else
12609 dflt="rand"
12610 echo "Yick, looks like I have to use rand()." >&4
12611 fi
12612 echo " "
12613 ;;
12614*)
12615 dflt="$randfunc"
12616 ;;
12617esac
12618cont=true
12619
12620case "$ccflags" in
12621*-Dmy_rand=*|*-Dmy_srand=*)
12622 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12623 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12624 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12625 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12626 ;;
12627esac
12628
12629while $test "$cont"; do
12630 rp="Use which function to generate random numbers?"
12631 . ./myread
12632 if $test "$ans" = "$dflt"; then
12633 : null
12634 else
12635 randbits=''
12636 fi
12637 randfunc="$ans"
12638 if set $ans val -f; eval $csym; $val; then
12639 cont=''
12640 else
12641 dflt=y
12642 rp="I cannot find function $ans. Use that name anyway?"
12643 . ./myread
12644 dflt=rand
12645 case "$ans" in
12646 [yY]*) cont='';;
12647 esac
12648 fi
12649 case "$cont" in
12650 '')
12651 case "$randfunc" in
12652 drand48)
12653 drand01="drand48()"
12654 seedfunc="srand48"
12655 randbits=48
12656 randseedtype=long
12657 ;;
12658 rand|random)
12659 case "$randbits" in
12660 '')
12661echo "Checking to see how many bits your $randfunc() function produces..." >&4
12662 $cat >try.c <<EOCP
12663#$i_unistd I_UNISTD
12664#$i_stdlib I_STDLIB
12665#include <stdio.h>
12666#ifdef I_UNISTD
12667# include <unistd.h>
12668#endif
12669#ifdef I_STDLIB
12670# include <stdlib.h>
12671#endif
12672int main()
12673{
12674 register int i;
12675 register unsigned long tmp;
12676 register unsigned long max = 0L;
12677
12678 for (i = 1000; i; i--) {
12679 tmp = (unsigned long) $randfunc();
12680 if (tmp > max) max = tmp;
12681 }
12682 for (i = 0; max; i++)
12683 max /= 2;
12684 printf("%d\n",i);
12685}
12686EOCP
12687 set try
12688 if eval $compile_ok; then
12689 dflt=`try`
12690 else
12691 dflt='?'
12692 echo "(I can't seem to compile the test program...)"
12693 fi
12694 ;;
12695 *)
12696 dflt="$randbits"
12697 ;;
12698 esac
12699 rp="How many bits does your $randfunc() function produce?"
12700 . ./myread
12701 randbits="$ans"
12702 $rm -f try.c try
12703 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12704 seedfunc="s$randfunc"
12705 randseedtype=unsigned
12706 ;;
12707 *)
12708 dflt="31"
12709 rp="How many bits does your $randfunc() function produce?"
12710 . ./myread
12711 randbits="$ans"
12712 seedfunc="s$randfunc"
12713 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12714 if set $seedfunc val -f; eval $csym; $val; then
12715 echo "(Using $seedfunc() to seed random generator)"
12716 else
12717 echo "(Warning: no $seedfunc() to seed random generator)"
12718 seedfunc=rand
12719 fi
12720 randseedtype=unsigned
12721 ;;
12722 esac
12723 ;;
12724 esac
12725done
12726
12727echo " "
12728echo "Determining whether or not we are on an EBCDIC system..." >&4
12729$cat >tebcdic.c <<'EOM'
12730int main()
12731{
12732 if ('M'==0xd4) return 0;
12733 return 1;
12734}
12735EOM
12736
12737val=$undef
12738set tebcdic
12739if eval $compile_ok; then
12740 if ./tebcdic; then
12741 echo "You seem to speak EBCDIC." >&4
12742 val="$define"
12743 else
12744 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
12745 fi
12746else
12747 echo "I'm unable to compile the test program." >&4
12748 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
12749fi
12750$rm -f tebcdic.c tebcdic
12751set ebcdic
12752eval $setvar
12753
12754echo " "
12755$cat >&4 <<EOM
12756Checking how to flush all pending stdio output...
12757EOM
12758# I only know how to find the first 32 possibly open files on SunOS.
12759# See also hints/sunos_4_1.sh and util.c --AD
12760case "$osname" in
12761sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12762esac
12763$cat >>try.c <<EOCP
12764#include <stdio.h>
12765#$i_unistd I_UNISTD
12766#ifdef I_UNISTD
12767# include <unistd.h>
12768#endif
12769#$d_sysconf HAS_SYSCONF
12770#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12771#ifdef HAS_STDIO_STREAM_ARRAY
12772# define STDIO_STREAM_ARRAY $stdio_stream_array
12773#endif
12774int main() {
12775 FILE* p = fopen("try.out", "w");
12776#ifdef TRY_FPUTC
12777 fputc('x', p);
12778#else
12779# ifdef TRY_FPRINTF
12780 fprintf(p, "x");
12781# endif
12782#endif
12783#ifdef TRY_FFLUSH_NULL
12784 fflush(NULL);
12785#endif
12786#ifdef TRY_FFLUSH_ALL
12787 {
12788 long open_max = -1;
12789# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12790 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12791# else
12792# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12793 open_max = sysconf(_SC_OPEN_MAX);
12794# else
12795# ifdef FOPEN_MAX
12796 open_max = FOPEN_MAX;
12797# else
12798# ifdef OPEN_MAX
12799 open_max = OPEN_MAX;
12800# else
12801# ifdef _NFILE
12802 open_max = _NFILE;
12803# endif
12804# endif
12805# endif
12806# endif
12807# endif
12808# ifdef HAS_STDIO_STREAM_ARRAY
12809 if (open_max > 0) {
12810 long i;
12811 for (i = 0; i < open_max; i++)
12812 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12813 STDIO_STREAM_ARRAY[i]._file < open_max &&
12814 STDIO_STREAM_ARRAY[i]._flag)
12815 fflush(&STDIO_STREAM_ARRAY[i]);
12816 }
12817 }
12818# endif
12819#endif
12820 _exit(42);
12821}
12822EOCP
12823: first we have to find out how _not_ to flush
12824if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12825 output=''
12826 set try -DTRY_FPUTC
12827 if eval $compile; then
12828 $rm -f try.out
12829 ./try$exe_ext 2>/dev/null
12830 if $test ! -s try.out -a "X$?" = X42; then
12831 output=-DTRY_FPUTC
12832 fi
12833 fi
12834 case "$output" in
12835 '')
12836 set try -DTRY_FPRINTF
12837 $rm -f try.out
12838 if eval $compile; then
12839 $rm -f try.out
12840 ./try$exe_ext 2>/dev/null
12841 if $test ! -s try.out -a "X$?" = X42; then
12842 output=-DTRY_FPRINTF
12843 fi
12844 fi
12845 ;;
12846 esac
12847fi
12848: check for fflush NULL behaviour
12849case "$fflushNULL" in
12850'') set try -DTRY_FFLUSH_NULL $output
12851 if eval $compile; then
12852 $rm -f try.out
12853 ./try$exe_ext 2>/dev/null
12854 code="$?"
12855 if $test -s try.out -a "X$code" = X42; then
12856 fflushNULL="`$cat try.out`"
12857 else
12858 if $test "X$code" != X42; then
12859 $cat >&4 <<EOM
12860(If this test failed, don't worry, we'll try another method shortly.)
12861EOM
12862 fi
12863 fi
12864 fi
12865 $rm -f core try.core core.try.*
12866 case "$fflushNULL" in
12867 x) $cat >&4 <<EOM
12868Your fflush(NULL) works okay for output streams.
12869Let's see if it clobbers input pipes...
12870EOM
12871# As of mid-March 2000 all versions of Solaris appear to have a stdio
12872# bug that improperly flushes the input end of pipes. So we avoid the
12873# autoflush on fork/system/exec support for now. :-(
12874$cat >tryp.c <<EOCP
12875#include <stdio.h>
12876int
12877main(int argc, char **argv)
12878{
12879 char buf[1024];
12880 int i;
12881 char *bp = buf;
12882 while (1) {
12883 while ((i = getc(stdin)) != -1
12884 && (*bp++ = i) != '\n'
12885 && bp < &buf[1024])
12886 /* DO NOTHING */ ;
12887 *bp = '\0';
12888 fprintf(stdout, "%s", buf);
12889 fflush(NULL);
12890 if (i == -1)
12891 return 0;
12892 bp = buf;
12893 }
12894}
12895EOCP
12896 fflushNULL="$define"
12897 set tryp
12898 if eval $compile; then
12899 $rm -f tryp.out
12900 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12901 if cmp tryp.c tryp.out >/dev/null 2>&1; then
12902 $cat >&4 <<EOM
12903fflush(NULL) seems to behave okay with input streams.
12904EOM
12905 fflushNULL="$define"
12906 else
12907 $cat >&4 <<EOM
12908Ouch, fflush(NULL) clobbers input pipes! We will not use it.
12909EOM
12910 fflushNULL="$undef"
12911 fi
12912 fi
12913 $rm -f core tryp.c tryp.core core.tryp.*
12914 ;;
12915 '') $cat >&4 <<EOM
12916Your fflush(NULL) isn't working (contrary to ANSI C).
12917EOM
12918 fflushNULL="$undef"
12919 ;;
12920 *) $cat >&4 <<EOM
12921Cannot figure out whether your fflush(NULL) works or not.
12922I'm assuming it doesn't (contrary to ANSI C).
12923EOM
12924 fflushNULL="$undef"
12925 ;;
12926 esac
12927 ;;
12928$define|true|[yY]*)
12929 fflushNULL="$define"
12930 ;;
12931*)
12932 fflushNULL="$undef"
12933 ;;
12934esac
12935: check explicit looping only if NULL did not work, and if the pipe
12936: bug does not show up on an explicit flush too
12937case "$fflushNULL" in
12938"$undef")
12939 $cat >tryp.c <<EOCP
12940#include <stdio.h>
12941int
12942main(int argc, char **argv)
12943{
12944 char buf[1024];
12945 int i;
12946 char *bp = buf;
12947 while (1) {
12948 while ((i = getc(stdin)) != -1
12949 && (*bp++ = i) != '\n'
12950 && bp < &buf[1024])
12951 /* DO NOTHING */ ;
12952 *bp = '\0';
12953 fprintf(stdout, "%s", buf);
12954 fflush(stdin);
12955 if (i == -1)
12956 return 0;
12957 bp = buf;
12958 }
12959}
12960EOCP
12961 set tryp
12962 if eval $compile; then
12963 $rm -f tryp.out
12964 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12965 if cmp tryp.c tryp.out >/dev/null 2>&1; then
12966 $cat >&4 <<EOM
12967Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12968EOM
12969 : now check for fflushall behaviour
12970 case "$fflushall" in
12971 '') set try -DTRY_FFLUSH_ALL $output
12972 if eval $compile; then
12973 $cat >&4 <<EOM
12974(Now testing the other method--but note that this also may fail.)
12975EOM
12976 $rm -f try.out
12977 ./try$exe_ext 2>/dev/null
12978 if $test -s try.out -a "X$?" = X42; then
12979 fflushall="`$cat try.out`"
12980 fi
12981 fi
12982 $rm -f core try.core core.try.*
12983 case "$fflushall" in
12984 x) $cat >&4 <<EOM
12985Whew. Flushing explicitly all the stdio streams works.
12986EOM
12987 fflushall="$define"
12988 ;;
12989 '') $cat >&4 <<EOM
12990Sigh. Flushing explicitly all the stdio streams doesn't work.
12991EOM
12992 fflushall="$undef"
12993 ;;
12994 *) $cat >&4 <<EOM
12995Cannot figure out whether flushing stdio streams explicitly works or not.
12996I'm assuming it doesn't.
12997EOM
12998 fflushall="$undef"
12999 ;;
13000 esac
13001 ;;
13002 "$define"|true|[yY]*)
13003 fflushall="$define"
13004 ;;
13005 *)
13006 fflushall="$undef"
13007 ;;
13008 esac
13009 else
13010 $cat >&4 <<EOM
13011All is futile. Even fflush(stdin) clobbers input pipes!
13012EOM
13013 fflushall="$undef"
13014 fi
13015 else
13016 fflushall="$undef"
13017 fi
13018 $rm -f core tryp.c tryp.core core.tryp.*
13019 ;;
13020*) fflushall="$undef"
13021 ;;
13022esac
13023
13024case "$fflushNULL$fflushall" in
13025undefundef)
13026 $cat <<EOM
13027OK, I give up. I cannot figure out how to flush pending stdio output.
13028We won't be flushing handles at all before fork/exec/popen.
13029EOM
13030 ;;
13031esac
13032$rm -f try.* try$exe_ext
13033
13034: Store the full pathname to the ar program for use in the C program
13035: Respect a hint or command line value for full_ar.
13036case "$full_ar" in
13037'') full_ar=$ar ;;
13038esac
13039
13040: Store the full pathname to the sed program for use in the C program
13041full_sed=$sed
13042
13043: see what type gids are declared as in the kernel
13044echo " "
13045echo "Looking for the type for group ids returned by getgid()."
13046set gid_t gidtype xxx stdio.h sys/types.h
13047eval $typedef
13048case "$gidtype" in
13049xxx)
13050 xxx=`./findhdr sys/user.h`
13051 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13052 case $1 in
13053 unsigned) dflt="$1 $2" ;;
13054 *) dflt="$1" ;;
13055 esac
13056 ;;
13057*) dflt="$gidtype";;
13058esac
13059case "$gidtype" in
13060gid_t) echo "gid_t found." ;;
13061*) rp="What is the type for group ids returned by getgid()?"
13062 . ./myread
13063 gidtype="$ans"
13064 ;;
13065esac
13066
13067echo " "
13068case "$gidtype" in
13069*_t) zzz="$gidtype" ;;
13070*) zzz="gid" ;;
13071esac
13072echo "Checking the size of $zzz..." >&4
13073cat > try.c <<EOCP
13074#include <sys/types.h>
13075#include <stdio.h>
13076int main() {
13077 printf("%d\n", (int)sizeof($gidtype));
13078 exit(0);
13079}
13080EOCP
13081set try
13082if eval $compile_ok; then
13083 yyy=`./try`
13084 case "$yyy" in
13085 '') gidsize=4
13086 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13087 ;;
13088 *) gidsize=$yyy
13089 echo "Your $zzz is $gidsize bytes long."
13090 ;;
13091 esac
13092else
13093 gidsize=4
13094 echo "(I can't compile the test program--guessing $gidsize.)" >&4
13095fi
13096
13097
13098echo " "
13099case "$gidtype" in
13100*_t) zzz="$gidtype" ;;
13101*) zzz="gid" ;;
13102esac
13103echo "Checking the sign of $zzz..." >&4
13104cat > try.c <<EOCP
13105#include <sys/types.h>
13106#include <stdio.h>
13107int main() {
13108 $gidtype foo = -1;
13109 if (foo < 0)
13110 printf("-1\n");
13111 else
13112 printf("1\n");
13113}
13114EOCP
13115set try
13116if eval $compile; then
13117 yyy=`./try`
13118 case "$yyy" in
13119 '') gidsign=1
13120 echo "(I can't execute the test program--guessing unsigned.)" >&4
13121 ;;
13122 *) gidsign=$yyy
13123 case "$gidsign" in
13124 1) echo "Your $zzz is unsigned." ;;
13125 -1) echo "Your $zzz is signed." ;;
13126 esac
13127 ;;
13128 esac
13129else
13130 gidsign=1
13131 echo "(I can't compile the test program--guessing unsigned.)" >&4
13132fi
13133
13134
13135echo " "
13136
13137if $test X"$quadtype" != X; then
13138
13139echo "Checking how to print 64-bit integers..." >&4
13140
13141if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13142 $cat >try.c <<'EOCP'
13143#include <sys/types.h>
13144#include <stdio.h>
13145int main() {
13146 int q = 12345678901;
13147 printf("%ld\n", q);
13148}
13149EOCP
13150 set try
13151 if eval $compile; then
13152 yyy=`./try$exe_ext`
13153 case "$yyy" in
13154 12345678901)
13155 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13156 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13157 echo "We will use %d."
13158 ;;
13159 esac
13160 fi
13161fi
13162
13163if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13164 $cat >try.c <<'EOCP'
13165#include <sys/types.h>
13166#include <stdio.h>
13167int main() {
13168 long q = 12345678901;
13169 printf("%ld\n", q);
13170}
13171EOCP
13172 set try
13173 if eval $compile; then
13174 yyy=`./try$exe_ext`
13175 case "$yyy" in
13176 12345678901)
13177 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13178 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13179 echo "We will use %ld."
13180 ;;
13181 esac
13182 fi
13183fi
13184
13185if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13186 $cat >try.c <<'EOCP'
13187#include <sys/types.h>
13188#include <inttypes.h>
13189#include <stdio.h>
13190int main() {
13191 int64_t q = 12345678901;
13192 printf("%" PRId64 "\n", q);
13193}
13194EOCP
13195 set try
13196 if eval $compile; then
13197 yyy=`./try$exe_ext`
13198 case "$yyy" in
13199 12345678901)
13200 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13201 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13202 echo "We will use the C9X style."
13203 ;;
13204 esac
13205 fi
13206fi
13207
13208if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13209 $cat >try.c <<'EOCP'
13210#include <sys/types.h>
13211#include <stdio.h>
13212int main() {
13213 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13214 printf("%lld\n", q);
13215}
13216EOCP
13217 set try
13218 if eval $compile; then
13219 yyy=`./try$exe_ext`
13220 case "$yyy" in
13221 12345678901)
13222 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13223 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13224 echo "We will use the %lld style."
13225 ;;
13226 esac
13227 fi
13228fi
13229
13230if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13231 $cat >try.c <<EOCP
13232#include <sys/types.h>
13233#include <stdio.h>
13234int main() {
13235 $quadtype q = 12345678901;
13236 printf("%Ld\n", q);
13237}
13238EOCP
13239 set try
13240 if eval $compile; then
13241 yyy=`./try$exe_ext`
13242 case "$yyy" in
13243 12345678901)
13244 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13245 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13246 echo "We will use %Ld."
13247 ;;
13248 esac
13249 fi
13250fi
13251
13252if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13253 $cat >try.c <<EOCP
13254#include <sys/types.h>
13255#include <stdio.h>
13256int main() {
13257 $quadtype q = 12345678901;
13258 printf("%qd\n", q);
13259}
13260EOCP
13261 set try
13262 if eval $compile; then
13263 yyy=`./try$exe_ext`
13264 case "$yyy" in
13265 12345678901)
13266 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13267 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13268 echo "We will use %qd."
13269 ;;
13270 esac
13271 fi
13272fi
13273
13274if $test X"$sPRId64" = X; then
13275 echo "Cannot figure out how to print 64-bit integers." >&4
13276fi
13277
13278$rm -f try try.*
13279
13280fi
13281
13282case "$sPRId64" in
13283'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
13284 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
13285 ;;
13286*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
13287 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
13288 ;;
13289esac
13290
13291
13292echo " "
13293$echo "Checking the format strings to be used for Perl's internal types..." >&4
13294
13295if $test X"$ivsize" = X8; then
13296 ivdformat="$sPRId64"
13297 uvuformat="$sPRIu64"
13298 uvoformat="$sPRIo64"
13299 uvxformat="$sPRIx64"
13300 uvXUformat="$sPRIXU64"
13301else
13302 if $test X"$ivsize" = X"$longsize"; then
13303 ivdformat='"ld"'
13304 uvuformat='"lu"'
13305 uvoformat='"lo"'
13306 uvxformat='"lx"'
13307 uvXUformat='"lX"'
13308 else
13309 if $test X"$ivsize" = X"$intsize"; then
13310 ivdformat='"d"'
13311 uvuformat='"u"'
13312 uvoformat='"o"'
13313 uvxformat='"x"'
13314 uvXUformat='"X"'
13315 else
13316 : far out
13317 if $test X"$ivsize" = X"$shortsize"; then
13318 ivdformat='"hd"'
13319 uvuformat='"hu"'
13320 uvoformat='"ho"'
13321 uvxformat='"hx"'
13322 uvXUformat='"hX"'
13323 fi
13324 fi
13325 fi
13326fi
13327
13328if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13329 nveformat="$sPRIeldbl"
13330 nvfformat="$sPRIfldbl"
13331 nvgformat="$sPRIgldbl"
13332 nvEUformat="$sPRIEUldbl"
13333 nvFUformat="$sPRIFUldbl"
13334 nvGUformat="$sPRIGUldbl"
13335else
13336 nveformat='"e"'
13337 nvfformat='"f"'
13338 nvgformat='"g"'
13339 nvEUformat='"E"'
13340 nvFUformat='"F"'
13341 nvGUformat='"G"'
13342fi
13343
13344case "$ivdformat" in
13345'') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13346 exit 1
13347 ;;
13348esac
13349
13350
13351echo " "
13352$echo "Checking the format string to be used for gids..." >&4
13353
13354case "$gidsign" in
13355-1) if $test X"$gidsize" = X"$ivsize"; then
13356 gidformat="$ivdformat"
13357 else
13358 if $test X"$gidsize" = X"$longsize"; then
13359 gidformat='"ld"'
13360 else
13361 if $test X"$gidsize" = X"$intsize"; then
13362 gidformat='"d"'
13363 else
13364 if $test X"$gidsize" = X"$shortsize"; then
13365 gidformat='"hd"'
13366 fi
13367 fi
13368 fi
13369 fi
13370 ;;
13371*) if $test X"$gidsize" = X"$uvsize"; then
13372 gidformat="$uvuformat"
13373 else
13374 if $test X"$gidsize" = X"$longsize"; then
13375 gidformat='"lu"'
13376 else
13377 if $test X"$gidsize" = X"$intsize"; then
13378 gidformat='"u"'
13379 else
13380 if $test X"$gidsize" = X"$shortsize"; then
13381 gidformat='"hu"'
13382 fi
13383 fi
13384 fi
13385 fi
13386 ;;
13387esac
13388
13389: see if getgroups exists
13390set getgroups d_getgrps
13391eval $inlibc
13392
13393: see if setgroups exists
13394set setgroups d_setgrps
13395eval $inlibc
13396
13397
13398: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13399echo " "
13400case "$d_getgrps$d_setgrps" in
13401*define*)
13402 case "$groupstype" in
13403 '') dflt="$gidtype" ;;
13404 *) dflt="$groupstype" ;;
13405 esac
13406 $cat <<EOM
13407What type of pointer is the second argument to getgroups() and setgroups()?
13408Usually this is the same as group ids, $gidtype, but not always.
13409
13410EOM
13411 rp='What type pointer is the second argument to getgroups() and setgroups()?'
13412 . ./myread
13413 groupstype="$ans"
13414 ;;
13415*) groupstype="$gidtype";;
13416esac
13417
13418echo " "
13419echo "Checking if your $make program sets \$(MAKE)..." >&4
13420case "$make_set_make" in
13421'')
13422 $sed 's/^X //' > testmake.mak << 'EOF'
13423Xall:
13424X @echo 'maketemp="$(MAKE)"'
13425EOF
13426 case "`$make -f testmake.mak 2>/dev/null`" in
13427 *maketemp=*) make_set_make='#' ;;
13428 *) make_set_make="MAKE=$make" ;;
13429 esac
13430 $rm -f testmake.mak
13431 ;;
13432esac
13433case "$make_set_make" in
13434'#') echo "Yup, it does.";;
13435*) echo "Nope, it doesn't.";;
13436esac
13437
13438: see what type is used for mode_t
13439rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13440set mode_t modetype int stdio.h sys/types.h
13441eval $typedef_ask
13442
13443: define a fucntion to check prototypes
13444$cat > protochk <<EOSH
13445$startsh
13446cc="$cc"
13447optimize="$optimize"
13448ccflags="$ccflags"
13449prototype="$prototype"
13450define="$define"
13451rm=$rm
13452EOSH
13453
13454$cat >> protochk <<'EOSH'
13455
13456$rm -f try.c
13457foo="$1"
13458shift
13459while test $# -ge 2; do
13460 case "$1" in
13461 $define) echo "#include <$2>" >> try.c ;;
13462 literal) echo "$2" >> try.c ;;
13463 esac
13464 shift 2
13465done
13466test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
13467cat >> try.c <<'EOCP'
13468#ifdef CAN_PROTOTYPE
13469#define _(args) args
13470#else
13471#define _(args) ()
13472#endif
13473EOCP
13474echo "$foo" >> try.c
13475echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13476$cc $optimize $ccflags -c try.c > /dev/null 2>&1
13477status=$?
13478$rm -f try.[co]
13479exit $status
13480EOSH
13481chmod +x protochk
13482$eunicefix protochk
13483
13484: see what type is used for size_t
13485rp="What is the type used for the length parameter for string functions?"
13486set size_t sizetype 'unsigned int' stdio.h sys/types.h
13487eval $typedef_ask
13488
13489: check for type of arguments to gethostbyaddr.
13490if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13491 case "$d_gethbyaddr" in
13492 $define)
13493 $cat <<EOM
13494
13495Checking to see what type of arguments are accepted by gethostbyaddr().
13496EOM
13497 hdrs="$define sys/types.h
13498 $d_socket sys/socket.h
13499 $i_niin netinet/in.h
13500 $i_netdb netdb.h
13501 $i_unistd unistd.h"
13502 : The first arg can 'char *' or 'void *'
13503 : The second arg is some of integral type
13504 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13505 for yyy in size_t long int; do
13506 case "$netdb_host_type" in
13507 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13508 if ./protochk "$try" $hdrs; then
13509 echo "Your system accepts $xxx for the first arg."
13510 echo "...and $yyy for the second arg."
13511 netdb_host_type="$xxx"
13512 netdb_hlen_type="$yyy"
13513 fi
13514 ;;
13515 esac
13516 done
13517 done
13518 : In case none of those worked, prompt the user.
13519 case "$netdb_host_type" in
13520 '') rp='What is the type for the 1st argument to gethostbyaddr?'
13521 dflt='char *'
13522 . ./myread
13523 netdb_host_type=$ans
13524 rp='What is the type for the 2nd argument to gethostbyaddr?'
13525 dflt="$sizetype"
13526 . ./myread
13527 netdb_hlen_type=$ans
13528 ;;
13529 esac
13530 ;;
13531 *) : no gethostbyaddr, so pick harmless defaults
13532 netdb_host_type='char *'
13533 netdb_hlen_type="$sizetype"
13534 ;;
13535 esac
13536 # Remove the "const" if needed. -- but then we'll have a
13537 # prototype clash!
13538 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13539fi
13540
13541: check for type of argument to gethostbyname.
13542if test "X$netdb_name_type" = X ; then
13543 case "$d_gethbyname" in
13544 $define)
13545 $cat <<EOM
13546
13547Checking to see what type of argument is accepted by gethostbyname().
13548EOM
13549 hdrs="$define sys/types.h
13550 $d_socket sys/socket.h
13551 $i_niin netinet/in.h
13552 $i_netdb netdb.h
13553 $i_unistd unistd.h"
13554 for xxx in "const char *" "char *"; do
13555 case "$netdb_name_type" in
13556 '') try="extern struct hostent *gethostbyname($xxx);"
13557 if ./protochk "$try" $hdrs; then
13558 echo "Your system accepts $xxx."
13559 netdb_name_type="$xxx"
13560 fi
13561 ;;
13562 esac
13563 done
13564 : In case none of those worked, prompt the user.
13565 case "$netdb_name_type" in
13566 '') rp='What is the type for the 1st argument to gethostbyname?'
13567 dflt='char *'
13568 . ./myread
13569 netdb_name_type=$ans
13570 ;;
13571 esac
13572 ;;
13573 *) : no gethostbyname, so pick harmless default
13574 netdb_name_type='char *'
13575 ;;
13576 esac
13577fi
13578
13579: check for type of 1st argument to getnetbyaddr.
13580if test "X$netdb_net_type" = X ; then
13581 case "$d_getnbyaddr" in
13582 $define)
13583 $cat <<EOM
13584
13585Checking to see what type of 1st argument is accepted by getnetbyaddr().
13586EOM
13587 hdrs="$define sys/types.h
13588 $d_socket sys/socket.h
13589 $i_niin netinet/in.h
13590 $i_netdb netdb.h
13591 $i_unistd unistd.h"
13592 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13593 case "$netdb_net_type" in
13594 '') try="extern struct netent *getnetbyaddr($xxx, int);"
13595 if ./protochk "$try" $hdrs; then
13596 echo "Your system accepts $xxx."
13597 netdb_net_type="$xxx"
13598 fi
13599 ;;
13600 esac
13601 done
13602 : In case none of those worked, prompt the user.
13603 case "$netdb_net_type" in
13604 '') rp='What is the type for the 1st argument to getnetbyaddr?'
13605 dflt='long'
13606 . ./myread
13607 netdb_net_type=$ans
13608 ;;
13609 esac
13610 ;;
13611 *) : no getnetbyaddr, so pick harmless default
13612 netdb_net_type='long'
13613 ;;
13614 esac
13615fi
13616: locate the preferred pager for this system
13617case "$pager" in
13618'')
13619 dflt=''
13620 case "$pg" in
13621 /*) dflt=$pg;;
13622 [a-zA-Z]:/*) dflt=$pg;;
13623 esac
13624 case "$more" in
13625 /*) dflt=$more;;
13626 [a-zA-Z]:/*) dflt=$more;;
13627 esac
13628 case "$less" in
13629 /*) dflt=$less;;
13630 [a-zA-Z]:/*) dflt=$less;;
13631 esac
13632 case "$dflt" in
13633 '') dflt=/usr/ucb/more;;
13634 esac
13635 ;;
13636*) dflt="$pager";;
13637esac
13638echo " "
13639fn=f/
13640rp='What pager is used on your system?'
13641. ./getfile
13642pager="$ans"
13643
13644: see what type pids are declared as in the kernel
13645rp="What is the type of process ids on this system?"
13646set pid_t pidtype int stdio.h sys/types.h
13647eval $typedef_ask
13648
13649: Find earliest binary compatible site_perl subdirectory perl can use.
13650case "$bincompat5005" in
13651"$define") xs_apiversion='5.005' ;;
13652*) xs_apiversion=$version ;; # The current site_perl version.
13653esac
13654: Find earliest pure perl site_perl subdirectory perl can use.
13655: The versioned directories started at 5.005.
13656pm_apiversion='5.005'
13657
13658: check for length of pointer
13659echo " "
13660case "$ptrsize" in
13661'')
13662 echo "Checking to see how big your pointers are..." >&4
13663 if test "$voidflags" -gt 7; then
13664 echo '#define VOID_PTR char *' > try.c
13665 else
13666 echo '#define VOID_PTR void *' > try.c
13667 fi
13668 $cat >>try.c <<'EOCP'
13669#include <stdio.h>
13670int main()
13671{
13672 printf("%d\n", (int)sizeof(VOID_PTR));
13673 exit(0);
13674}
13675EOCP
13676 set try
13677 if eval $compile_ok; then
13678 ptrsize=`./try`
13679 echo "Your pointers are $ptrsize bytes long."
13680 else
13681 dflt='4'
13682 echo "(I can't seem to compile the test program. Guessing...)" >&4
13683 rp="What is the size of a pointer (in bytes)?"
13684 . ./myread
13685 ptrsize="$ans"
13686 fi
13687 ;;
13688esac
13689$rm -f try.c try
13690
13691: see if ar generates random libraries by itself
13692echo " "
13693echo "Checking how to generate random libraries on your machine..." >&4
13694echo 'int bar1() { return bar2(); }' > bar1.c
13695echo 'int bar2() { return 2; }' > bar2.c
13696$cat > foo.c <<'EOP'
13697int main() { printf("%d\n", bar1()); exit(0); }
13698EOP
13699$cc $ccflags -c bar1.c >/dev/null 2>&1
13700$cc $ccflags -c bar2.c >/dev/null 2>&1
13701$cc $ccflags -c foo.c >/dev/null 2>&1
13702$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 13703if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
b4eb6b3d
JH
13704 ./foobar >/dev/null 2>&1; then
13705 echo "$ar appears to generate random libraries itself."
13706 orderlib=false
13707 ranlib=":"
13708elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 13709 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
b4eb6b3d
JH
13710 ./foobar >/dev/null 2>&1; then
13711 echo "a table of contents needs to be added with '$ar ts'."
13712 orderlib=false
13713 ranlib="$ar ts"
13714else
13715 case "$ranlib" in
13716 :) ranlib='';;
13717 '')
13718 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13719 $test -f $ranlib || ranlib=''
13720 ;;
13721 esac
13722 if $test -n "$ranlib"; then
13723 echo "your system has '$ranlib'; we'll use that."
13724 orderlib=false
13725 else
13726 echo "your system doesn't seem to support random libraries"
13727 echo "so we'll use lorder and tsort to order the libraries."
13728 orderlib=true
13729 ranlib=":"
13730 fi
13731fi
13732$rm -f foo* bar*
13733
13734: check for type of arguments to select.
13735case "$selecttype" in
13736'') case "$d_select" in
13737 $define)
13738 echo " "
13739 $cat <<EOM
13740Checking to see what type of arguments are accepted by select().
13741EOM
13742 hdrs="$define sys/types.h
13743 $i_systime sys/time.h
13744 $i_sysselct sys/select.h
13745 $d_socket sys/socket.h"
13746 : The first arg can be int, unsigned, or size_t
13747 : The last arg may or may not be 'const'
13748 val=''
13749 : void pointer has been seen but using that
13750 : breaks the selectminbits test
13751 for xxx in 'fd_set *' 'int *'; do
13752 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13753 for tmo in 'struct timeval *' 'const struct timeval *'; do
13754 case "$val" in
13755 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13756 if ./protochk "$try" $hdrs; then
13757 echo "Your system accepts $xxx."
13758 val="$xxx"
13759 fi
13760 ;;
13761 esac
13762 done
13763 done
13764 done
13765 case "$val" in
13766 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13767 case "$d_fd_set" in
13768 $define) dflt="fd_set *" ;;
13769 *) dflt="int *" ;;
13770 esac
13771 . ./myread
13772 val=$ans
13773 ;;
13774 esac
13775 selecttype="$val"
13776 ;;
13777 *) : no select, so pick a harmless default
13778 selecttype='int *'
13779 ;;
13780 esac
13781 ;;
13782esac
13783
13784: check for the select 'width'
13785case "$selectminbits" in
13786'') case "$d_select" in
13787 $define)
13788 $cat <<EOM
13789
13790Checking to see on how many bits at a time your select() operates...
13791EOM
13792 $cat >try.c <<EOCP
13793#include <sys/types.h>
13794#$i_time I_TIME
13795#$i_systime I_SYS_TIME
13796#$i_systimek I_SYS_TIME_KERNEL
13797#ifdef I_TIME
13798# include <time.h>
13799#endif
13800#ifdef I_SYS_TIME
13801# ifdef I_SYS_TIME_KERNEL
13802# define KERNEL
13803# endif
13804# include <sys/time.h>
13805# ifdef I_SYS_TIME_KERNEL
13806# undef KERNEL
13807# endif
13808#endif
13809#$i_sysselct I_SYS_SELECT
13810#ifdef I_SYS_SELECT
13811#include <sys/select.h>
13812#endif
13813#$d_socket HAS_SOCKET
13814#ifdef HAS_SOCKET
13815# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13816#endif
13817#include <stdio.h>
13818$selecttype b;
13819#define S sizeof(*(b))
13820#define MINBITS 64
13821#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13822#define NBITS (NBYTES * 8)
13823int main() {
13824 char s[NBYTES];
13825 struct timeval t;
13826 int i;
13827 FILE* fp;
13828 int fd;
13829
13830 fclose(stdin);
13831 fp = fopen("try.c", "r");
13832 if (fp == 0)
13833 exit(1);
13834 fd = fileno(fp);
13835 if (fd < 0)
13836 exit(2);
13837 b = ($selecttype)s;
13838 for (i = 0; i < NBITS; i++)
13839 FD_SET(i, b);
13840 t.tv_sec = 0;
13841 t.tv_usec = 0;
13842 select(fd + 1, b, 0, 0, &t);
13843 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13844 printf("%d\n", i + 1);
13845 return 0;
13846}
13847EOCP
13848 set try
13849 if eval $compile_ok; then
13850 selectminbits=`./try`
13851 case "$selectminbits" in
13852 '') cat >&4 <<EOM
13853Cannot figure out on how many bits at a time your select() operates.
13854I'll play safe and guess it is 32 bits.
13855EOM
13856 selectminbits=32
13857 bits="32 bits"
13858 ;;
13859 1) bits="1 bit" ;;
13860 *) bits="$selectminbits bits" ;;
13861 esac
13862 echo "Your select() operates on $bits at a time." >&4
13863 else
13864 rp='What is the minimum number of bits your select() operates on?'
13865 case "$byteorder" in
13866 1234|12345678) dflt=32 ;;
13867 *) dflt=1 ;;
13868 esac
13869 . ./myread
13870 val=$ans
13871 selectminbits="$val"
13872 fi
13873 $rm -f try.* try
13874 ;;
13875 *) : no select, so pick a harmless default
13876 selectminbits='32'
13877 ;;
13878 esac
13879 ;;
13880esac
13881
13882: Trace out the files included by signal.h, then look for SIGxxx names.
13883: Remove SIGARRAYSIZE used by HPUX.
13884: Remove SIGSTKSIZE used by Linux.
13885: Remove SIGSTKSZ used by Posix.
13886: Remove SIGTYP void lines used by OS2.
13887: Some cpps, like os390, dont give the file name anywhere
13888if [ "X$fieldn" = X ]; then
13889 : Just make some guesses. We check them later.
13890 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13891else
13892 xxx=`echo '#include <signal.h>' |
13893 $cppstdin $cppminus $cppflags 2>/dev/null |
13894 $grep '^[ ]*#.*include' |
13895 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13896fi
13897: Check this list of files to be sure we have parsed the cpp output ok.
13898: This will also avoid potentially non-existent files, such
13899: as ../foo/bar.h
13900xxxfiles=''
13901for xx in $xxx /dev/null ; do
13902 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13903done
13904: If we have found no files, at least try signal.h
13905case "$xxxfiles" in
13906'') xxxfiles=`./findhdr signal.h` ;;
13907esac
13908xxx=`awk '
13909$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13910 print substr($2, 4, 20)
13911}
13912$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13913 print substr($3, 4, 20)
13914}' $xxxfiles`
13915: Append some common names just in case the awk scan failed.
13916xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13917xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13918xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13919xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13920xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13921
13922: generate a few handy files for later
13923$cat > signal.c <<'EOCP'
13924#include <sys/types.h>
13925#include <signal.h>
13926#include <stdio.h>
13927int main() {
13928
13929/* Strange style to avoid deeply-nested #if/#else/#endif */
13930#ifndef NSIG
13931# ifdef _NSIG
13932# define NSIG (_NSIG)
13933# endif
13934#endif
13935
13936#ifndef NSIG
13937# ifdef SIGMAX
13938# define NSIG (SIGMAX+1)
13939# endif
13940#endif
13941
13942#ifndef NSIG
13943# ifdef SIG_MAX
13944# define NSIG (SIG_MAX+1)
13945# endif
13946#endif
13947
13948#ifndef NSIG
13949# ifdef MAXSIG
13950# define NSIG (MAXSIG+1)
13951# endif
13952#endif
13953
13954#ifndef NSIG
13955# ifdef MAX_SIG
13956# define NSIG (MAX_SIG+1)
13957# endif
13958#endif
13959
13960#ifndef NSIG
13961# ifdef SIGARRAYSIZE
13962# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13963# endif
13964#endif
13965
13966#ifndef NSIG
13967# ifdef _sys_nsig
13968# define NSIG (_sys_nsig) /* Solaris 2.5 */
13969# endif
13970#endif
13971
13972/* Default to some arbitrary number that's big enough to get most
13973 of the common signals.
13974*/
13975#ifndef NSIG
13976# define NSIG 50
13977#endif
13978
13979printf("NSIG %d\n", NSIG);
13980
13981#ifndef JUST_NSIG
13982
13983EOCP
13984
13985echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13986{
13987 printf "#ifdef SIG"; printf $1; printf "\n"
13988 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13989 printf $1; printf ");\n"
13990 printf "#endif\n"
13991}
13992END {
13993 printf "#endif /* JUST_NSIG */\n";
13994 printf "exit(0);\n}\n";
13995}
13996' >>signal.c
13997$cat >signal.awk <<'EOP'
13998BEGIN { ndups = 0 }
13999$1 ~ /^NSIG$/ { nsig = $2 }
14000($1 !~ /^NSIG$/) && (NF == 2) {
14001 if ($2 > maxsig) { maxsig = $2 }
14002 if (sig_name[$2]) {
14003 dup_name[ndups] = $1
14004 dup_num[ndups] = $2
14005 ndups++
14006 }
14007 else {
14008 sig_name[$2] = $1
14009 sig_num[$2] = $2
14010 }
14011}
14012END {
14013 if (nsig == 0) {
14014 nsig = maxsig + 1
14015 }
14016 printf("NSIG %d\n", nsig);
14017 for (n = 1; n < nsig; n++) {
14018 if (sig_name[n]) {
14019 printf("%s %d\n", sig_name[n], sig_num[n])
14020 }
14021 else {
14022 printf("NUM%d %d\n", n, n)
14023 }
14024 }
14025 for (n = 0; n < ndups; n++) {
14026 printf("%s %d\n", dup_name[n], dup_num[n])
14027 }
14028}
14029EOP
14030$cat >signal_cmd <<EOS
14031$startsh
14032if $test -s signal.lst; then
14033 echo "Using your existing signal.lst file"
14034 exit 0
14035fi
14036xxx="$xxx"
14037EOS
14038$cat >>signal_cmd <<'EOS'
14039
14040set signal
14041if eval $compile_ok; then
14042 ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14043else
14044 echo "(I can't seem be able to compile the whole test program)" >&4
14045 echo "(I'll try it in little pieces.)" >&4
14046 set signal -DJUST_NSIG
14047 if eval $compile_ok; then
14048 ./signal$_exe > signal.nsg
14049 $cat signal.nsg
14050 else
14051 echo "I can't seem to figure out how many signals you have." >&4
14052 echo "Guessing 50." >&4
14053 echo 'NSIG 50' > signal.nsg
14054 fi
14055 : Now look at all the signal names, one at a time.
14056 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14057 $cat > signal.c <<EOCP
14058#include <sys/types.h>
14059#include <signal.h>
14060#include <stdio.h>
14061int main() {
14062printf("$xx %d\n", SIG${xx});
14063return 0;
14064}
14065EOCP
14066 set signal
14067 if eval $compile; then
14068 echo "SIG${xx} found."
14069 ./signal$_exe >> signal.ls1
14070 else
14071 echo "SIG${xx} NOT found."
14072 fi
14073 done
14074 if $test -s signal.ls1; then
14075 $cat signal.nsg signal.ls1 |
14076 $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14077 fi
14078
14079fi
14080if $test -s signal.lst; then
14081 :
14082else
14083 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14084 echo 'kill -l' >signal
14085 set X `csh -f <signal`
14086 $rm -f signal
14087 shift
14088 case $# in
14089 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14090 esac
14091 echo $@ | $tr ' ' $trnl | \
14092 $awk '{ printf "%s %d\n", $1, ++s; }
14093 END { printf "NSIG %d\n", ++s }' >signal.lst
14094fi
14095$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14096EOS
14097chmod a+x signal_cmd
14098$eunicefix signal_cmd
14099
14100: generate list of signal names
14101echo " "
14102case "$sig_name_init" in
14103'') doinit=yes ;;
14104*) case "$sig_num_init" in
14105 ''|*,*) doinit=yes ;;
14106 esac ;;
14107esac
14108case "$doinit" in
14109yes)
14110 echo "Generating a list of signal names and numbers..." >&4
14111 . ./signal_cmd
14112 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14113 sig_name=`$awk 'BEGIN { printf "ZERO " }
14114 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14115 sig_num=`$awk 'BEGIN { printf "0 " }
14116 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14117 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
14118 !/^NSIG/ { printf "\"%s\", ", $1 }
14119 END { printf "0\n" }' signal.lst`
14120 sig_num_init=`$awk 'BEGIN { printf "0, " }
14121 !/^NSIG/ { printf "%d, ", $2}
14122 END { printf "0\n"}' signal.lst`
14123 ;;
14124esac
14125echo "The following $sig_count signals are available:"
14126echo " "
14127echo $sig_name | $awk \
14128'BEGIN { linelen = 0 }
14129{
14130 for (i = 1; i <= NF; i++) {
14131 name = "SIG" $i " "
14132 linelen = linelen + length(name)
14133 if (linelen > 70) {
14134 printf "\n"
14135 linelen = length(name)
14136 }
14137 printf "%s", name
14138 }
14139 printf "\n"
14140}'
14141$rm -f signal signal.c signal.awk signal.lst signal_cmd
14142
14143echo " "
14144case "$sizetype" in
14145*_t) zzz="$sizetype" ;;
14146*) zzz="filesize" ;;
14147esac
14148echo "Checking the size of $zzz..." >&4
14149cat > try.c <<EOCP
14150#include <sys/types.h>
14151#include <stdio.h>
14152int main() {
14153 printf("%d\n", (int)sizeof($sizetype));
14154 exit(0);
14155}
14156EOCP
14157set try
14158if eval $compile_ok; then
14159 yyy=`./try`
14160 case "$yyy" in
14161 '') sizesize=4
14162 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14163 ;;
14164 *) sizesize=$yyy
14165 echo "Your $zzz size is $sizesize bytes."
14166 ;;
14167 esac
14168else
14169 sizesize=4
14170 echo "(I can't compile the test program--guessing $sizesize.)" >&4
14171fi
14172
14173
14174: check for socklen_t
14175echo " "
14176echo "Checking to see if you have socklen_t..." >&4
14177$cat >try.c <<EOCP
14178#include <sys/types.h>
14179#$d_socket HAS_SOCKET
14180#ifdef HAS_SOCKET
14181#include <sys/socket.h>
14182#endif
14183int main() { socklen_t x = 16; }
14184EOCP
14185set try
14186if eval $compile; then
14187 val="$define"
14188 echo "You have socklen_t."
14189else
14190 val="$undef"
14191 echo "You do not have socklen_t."
14192 case "$sizetype" in
14193 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14194 esac
14195fi
14196$rm -f try try.*
14197set d_socklen_t
14198eval $setvar
14199
14200: check for type of the size argument to socket calls
14201case "$d_socket" in
14202"$define")
14203 $cat <<EOM
14204
14205Checking to see what type is the last argument of accept().
14206EOM
14207 hdrs="$define sys/types.h $d_socket sys/socket.h"
14208 yyy=''
14209 case "$d_socklen_t" in
14210 "$define") yyy="$yyy socklen_t"
14211 esac
14212 yyy="$yyy $sizetype int long unsigned"
14213 for xxx in $yyy; do
14214 case "$socksizetype" in
14215 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
14216 if ./protochk "$try" $hdrs; then
14217 echo "Your system accepts '$xxx *' for the last argument of accept()."
14218 socksizetype="$xxx"
14219 fi
14220 ;;
14221 esac
14222 done
14223: In case none of those worked, prompt the user.
14224 case "$socksizetype" in
14225 '') rp='What is the type for socket address structure sizes?'
14226 dflt='int'
14227 . ./myread
14228 socksizetype=$ans
14229 ;;
14230 esac
14231 ;;
14232*) : no sockets, so pick relatively harmless default
14233 socksizetype='int'
14234 ;;
14235esac
14236
14237: see what type is used for signed size_t
14238set ssize_t ssizetype int stdio.h sys/types.h
14239eval $typedef
14240dflt="$ssizetype"
14241$cat > ssize.c <<EOM
14242#include <stdio.h>
14243#include <sys/types.h>
14244#define Size_t $sizetype
14245#define SSize_t $dflt
14246int main()
14247{
14248 if (sizeof(Size_t) == sizeof(SSize_t))
14249 printf("$dflt\n");
14250 else if (sizeof(Size_t) == sizeof(int))
14251 printf("int\n");
14252 else
14253 printf("long\n");
14254 exit(0);
14255}
14256EOM
14257echo " "
14258set ssize
14259if eval $compile_ok && ./ssize > /dev/null; then
14260 ssizetype=`./ssize`
14261 echo "I'll be using $ssizetype for functions returning a byte count." >&4
14262else
14263 $cat >&4 <<EOM
14264Help! I can't compile and run the ssize_t test program: please enlighten me!
14265(This is probably a misconfiguration in your system or libraries, and
14266you really ought to fix it. Still, I'll try anyway.)
14267
14268I need a type that is the same size as $sizetype, but is guaranteed to
14269be signed. Common values are ssize_t, int and long.
14270
14271EOM
14272 rp="What signed type is the same size as $sizetype?"
14273 . ./myread
14274 ssizetype="$ans"
14275fi
14276$rm -f ssize ssize.*
14277
14278: see what type of char stdio uses.
14279echo " "
14280if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
14281 echo "Your stdio uses unsigned chars." >&4
14282 stdchar="unsigned char"
14283else
14284 echo "Your stdio uses signed chars." >&4
14285 stdchar="char"
14286fi
14287
14288: see if time exists
14289echo " "
14290if test "X$d_time" = X -o X"$timetype" = X; then
14291 if set time val -f d_time; eval $csym; $val; then
14292 echo 'time() found.' >&4
14293 val="$define"
14294 rp="What is the type returned by time() on this system?"
14295 set time_t timetype long stdio.h sys/types.h
14296 eval $typedef_ask
14297 else
14298 echo 'time() not found, hope that will do.' >&4
14299 val="$undef"
14300 timetype='int';
14301 fi
14302 set d_time
14303 eval $setvar
14304fi
14305
14306: see what type uids are declared as in the kernel
14307echo " "
14308echo "Looking for the type for user ids returned by getuid()."
14309set uid_t uidtype xxx stdio.h sys/types.h
14310eval $typedef
14311case "$uidtype" in
14312xxx)
14313 xxx=`./findhdr sys/user.h`
14314 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14315 case $1 in
14316 unsigned) dflt="$1 $2" ;;
14317 *) dflt="$1" ;;
14318 esac
14319 ;;
14320*) dflt="$uidtype";;
14321esac
14322case "$uidtype" in
14323uid_t) echo "uid_t found." ;;
14324*) rp="What is the type for user ids returned by getuid()?"
14325 . ./myread
14326 uidtype="$ans"
14327 ;;
14328esac
14329
14330echo " "
14331case "$uidtype" in
14332*_t) zzz="$uidtype" ;;
14333*) zzz="uid" ;;
14334esac
14335echo "Checking the size of $zzz..." >&4
14336cat > try.c <<EOCP
14337#include <sys/types.h>
14338#include <stdio.h>
14339int main() {
14340 printf("%d\n", (int)sizeof($uidtype));
14341 exit(0);
14342}
14343EOCP
14344set try
14345if eval $compile_ok; then
14346 yyy=`./try`
14347 case "$yyy" in
14348 '') uidsize=4
14349 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14350 ;;
14351 *) uidsize=$yyy
14352 echo "Your $zzz is $uidsize bytes long."
14353 ;;
14354 esac
14355else
14356 uidsize=4
14357 echo "(I can't compile the test program--guessing $uidsize.)" >&4
14358fi
14359
14360echo " "
14361case "$uidtype" in
14362*_t) zzz="$uidtype" ;;
14363*) zzz="uid" ;;
14364esac
14365echo "Checking the sign of $zzz..." >&4
14366cat > try.c <<EOCP
14367#include <sys/types.h>
14368#include <stdio.h>
14369int main() {
14370 $uidtype foo = -1;
14371 if (foo < 0)
14372 printf("-1\n");
14373 else
14374 printf("1\n");
14375}
14376EOCP
14377set try
14378if eval $compile; then
14379 yyy=`./try`
14380 case "$yyy" in
14381 '') uidsign=1
14382 echo "(I can't execute the test program--guessing unsigned.)" >&4
14383 ;;
14384 *) uidsign=$yyy
14385 case "$uidsign" in
14386 1) echo "Your $zzz is unsigned." ;;
14387 -1) echo "Your $zzz is signed." ;;
14388 esac
14389 ;;
14390 esac
14391else
14392 uidsign=1
14393 echo "(I can't compile the test program--guessing unsigned.)" >&4
14394fi
14395
14396
14397
14398echo " "
14399$echo "Checking the format string to be used for uids..." >&4
14400
14401case "$uidsign" in
14402-1) if $test X"$uidsize" = X"$ivsize"; then
14403 uidformat="$ivdformat"
14404 else
14405 if $test X"$uidsize" = X"$longsize"; then
14406 uidformat='"ld"'
14407 else
14408 if $test X"$uidsize" = X"$intsize"; then
14409 uidformat='"d"'
14410 else
14411 if $test X"$uidsize" = X"$shortsize"; then
14412 uidformat='"hd"'
14413 fi
14414 fi
14415 fi
14416 fi
14417 ;;
14418*) if $test X"$uidsize" = X"$uvsize"; then
14419 uidformat="$uvuformat"
14420 else
14421 if $test X"$uidsize" = X"$longsize"; then
14422 uidformat='"lu"'
14423 else
14424 if $test X"$uidsize" = X"$intsize"; then
14425 uidformat='"u"'
14426 else
14427 if $test X"$uidsize" = X"$shortsize"; then
14428 uidformat='"hu"'
14429 fi
14430 fi
14431 fi
14432 fi
14433 ;;
14434esac
14435
14436: see if dbm.h is available
14437: see if dbmclose exists
14438set dbmclose d_dbmclose
14439eval $inlibc
14440
14441case "$d_dbmclose" in
14442$define)
14443 set dbm.h i_dbm
14444 eval $inhdr
14445 case "$i_dbm" in
14446 $define)
14447 val="$undef"
14448 set i_rpcsvcdbm
14449 eval $setvar
14450 ;;
14451 *) set rpcsvc/dbm.h i_rpcsvcdbm
14452 eval $inhdr
14453 ;;
14454 esac
14455 ;;
14456*) echo "We won't be including <dbm.h>"
14457 val="$undef"
14458 set i_dbm
14459 eval $setvar
14460 val="$undef"
14461 set i_rpcsvcdbm
14462 eval $setvar
14463 ;;
14464esac
14465
14466: see if this is a sys/file.h system
14467val=''
14468set sys/file.h val
14469eval $inhdr
14470
14471: do we need to include sys/file.h ?
14472case "$val" in
14473"$define")
14474 echo " "
14475 if $h_sysfile; then
14476 val="$define"
14477 echo "We'll be including <sys/file.h>." >&4
14478 else
14479 val="$undef"
14480 echo "We won't be including <sys/file.h>." >&4
14481 fi
14482 ;;
14483*)
14484 h_sysfile=false
14485 ;;
14486esac
14487set i_sysfile
14488eval $setvar
14489
14490: see if fcntl.h is there
14491val=''
14492set fcntl.h val
14493eval $inhdr
14494
14495: see if we can include fcntl.h
14496case "$val" in
14497"$define")
14498 echo " "
14499 if $h_fcntl; then
14500 val="$define"
14501 echo "We'll be including <fcntl.h>." >&4
14502 else
14503 val="$undef"
14504 if $h_sysfile; then
14505 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14506 else
14507 echo "We won't be including <fcntl.h>." >&4
14508 fi
14509 fi
14510 ;;
14511*)
14512 h_fcntl=false
14513 val="$undef"
14514 ;;
14515esac
14516set i_fcntl
14517eval $setvar
14518
14519: see if this is a iconv.h system
14520set iconv.h i_iconv
14521eval $inhdr
14522
14523: see if this is a ieeefp.h system
14524set ieeefp.h i_ieeefp
14525eval $inhdr
14526
14527: see if this is a libutil.h system
14528set libutil.h i_libutil
14529eval $inhdr
14530
14531: see if locale.h is available
14532set locale.h i_locale
14533eval $inhdr
14534
14535: see if mach cthreads are available
14536if test "X$usethreads" = "X$define"; then
14537 set mach/cthreads.h i_machcthr
14538 eval $inhdr
14539else
14540 i_machcthr="$undef"
14541fi
14542
14543
14544
14545: see if this is a math.h system
14546set math.h i_math
14547eval $inhdr
14548
14549: see if this is a mntent.h system
14550set mntent.h i_mntent
14551eval $inhdr
14552
14553: see if ndbm.h is available
14554set ndbm.h t_ndbm
14555eval $inhdr
14556case "$t_ndbm" in
14557$define)
14558 : see if dbm_open exists
14559 set dbm_open d_dbm_open
14560 eval $inlibc
14561 case "$d_dbm_open" in
14562 $undef)
14563 t_ndbm="$undef"
14564 echo "We won't be including <ndbm.h>"
14565 ;;
14566 esac
14567 ;;
14568esac
14569val="$t_ndbm"
14570set i_ndbm
14571eval $setvar
14572
14573: see if net/errno.h is available
14574val=''
14575set net/errno.h val
14576eval $inhdr
14577
14578: Unfortunately, it causes problems on some systems. Arrgh.
14579case "$val" in
14580$define)
14581 cat > try.c <<'EOM'
14582#include <stdio.h>
14583#include <errno.h>
14584#include <net/errno.h>
14585int func()
14586{
14587 return ENOTSOCK;
14588}
14589EOM
14590 if $cc $ccflags -c try.c >/dev/null 2>&1; then
14591 echo "We'll be including <net/errno.h>." >&4
14592 else
14593 echo "We won't be including <net/errno.h>." >&4
14594 val="$undef"
14595 fi
14596 $rm -f try.* try
14597 ;;
14598esac
14599set i_neterrno
14600eval $setvar
14601
14602: see if netinet/tcp.h is available
14603set netinet/tcp.h i_netinettcp
14604eval $inhdr
14605
14606: see if this is a poll.h system
14607set poll.h i_poll
14608eval $inhdr
14609
14610: see if this is a prot.h system
14611set prot.h i_prot
14612eval $inhdr
14613
14614echo " "
14615$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
14616$cat <<'EOSH' > Cppsym.know
14617a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14618AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14619alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14620ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14621BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14622BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14623bull c cadmus clipper CMU COFF COMPILER_VERSION
14624concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14625CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14626Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14627FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14628GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14629H3050R H3050RX hbullx20 hcx host_mips
14630hp200 hp300 hp700 HP700 hp800 hp9000
14631hp9000s200 hp9000s300 hp9000s400 hp9000s500
14632hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14633i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14634iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14635INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14636LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14637LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14638Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14639LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14640M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14641M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14642M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14643MATH_HAS_NO_SIDE_EFFECTS
14644mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14645mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14646mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14647MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14648mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14649NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 14650news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
14651ns32016 ns32332 ns32k nsc32000
14652OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14653pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14654pc532 pdp11 PGC PIC plexus PORTAR posix
14655POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14656POSIX_C_SOURCE POSIX_SOURCE POWER
14657PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14658riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14659SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14660sony sony_news sonyrisc sparc sparclite spectrum
14661stardent stdc STDC_EXT stratos sun sun3 sun386
14662Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14663SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14664SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14665sysV68 sysV88 Tek4132 Tek4300 titan
14666tower tower32 tower32_200 tower32_600 tower32_700
14667tower32_800 tower32_850 tss
14668u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14669ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14670unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14671Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14672XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14673XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14674z8000
14675EOSH
14676# Maybe put other stuff here too.
14677cat <<EOSH >>Cppsym.know
14678$osname
14679EOSH
14680./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14681./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14682$cat Cppsym.know > Cppsym.c
381aa1ff 14683$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
14684$rm -f Cppsym.a Cppsym.b Cppsym.c
14685cat <<EOSH > Cppsym
14686$startsh
14687if $test \$# -gt 0; then
14688 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14689 if $test -s Cppsym.got; then
14690 $rm -f Cppsym.got
14691 exit 0
14692 fi
14693 $rm -f Cppsym.got
14694 exit 1
14695else
14696 $tr " " "$trnl" | ./Cppsym.try
14697 exit 0
14698fi
14699EOSH
14700chmod +x Cppsym
14701$eunicefix Cppsym
14702cat <<EOSH > Cppsym.try
14703$startsh
14704cat <<'EOCP' > try.c
14705#include <stdio.h>
14706int main() {
14707EOCP
14708$awk \\
14709EOSH
14710cat <<'EOSH' >> Cppsym.try
14711'length($1) > 0 {
14712 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
14713 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
14714 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
14715 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
14716}' >> try.c
14717echo '}' >> try.c
14718EOSH
14719cat <<EOSH >> Cppsym.try
14720ccflags="$ccflags"
14721case "$osname-$gccversion" in
14722irix-) ccflags="\$ccflags -woff 1178" ;;
14723os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
14724esac
7a282f6d 14725$cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
b4eb6b3d
JH
14726EOSH
14727chmod +x Cppsym.try
14728$eunicefix Cppsym.try
14729./Cppsym < Cppsym.know > Cppsym.true
14730: now check the C compiler for additional symbols
14731postprocess_cc_v=''
14732case "$osname" in
14733aix) postprocess_cc_v="|$tr , ' '" ;;
14734esac
14735$cat >ccsym <<EOS
14736$startsh
14737$cat >tmp.c <<EOF
14738extern int foo;
14739EOF
14740for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14741do
14742 case "\$i" in
14743 -D*) echo "\$i" | $sed 's/^-D//';;
14744 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14745 esac
14746done
14747$rm -f try.c
14748EOS
14749postprocess_cc_v=''
14750chmod +x ccsym
14751$eunicefix ccsym
14752./ccsym > ccsym1.raw
14753if $test -s ccsym1.raw; then
14754 $sort ccsym1.raw | $uniq >ccsym.raw
14755else
14756 mv ccsym1.raw ccsym.raw
14757fi
14758
14759$awk '/\=/ { print $0; next }
14760 { print $0"=1" }' ccsym.raw >ccsym.list
14761$awk '/\=/ { print $0; next }
14762 { print $0"=1" }' Cppsym.true >ccsym.true
14763$comm -13 ccsym.true ccsym.list >ccsym.own
14764$comm -12 ccsym.true ccsym.list >ccsym.com
14765$comm -23 ccsym.true ccsym.list >ccsym.cpp
14766also=''
14767if $test -z ccsym.raw; then
14768 echo "Your C compiler doesn't seem to define any symbols!" >&4
14769 echo " "
14770 echo "However, your C preprocessor defines the following symbols:"
14771 $cat Cppsym.true
14772 ccsymbols=''
14773 cppsymbols=`$cat Cppsym.true`
14774 cppsymbols=`echo $cppsymbols`
14775 cppccsymbols="$cppsymbols"
14776else
14777 if $test -s ccsym.com; then
14778 echo "Your C compiler and pre-processor define these symbols:"
14779 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
14780 also='also '
14781 symbols='ones'
14782 cppccsymbols=`$cat ccsym.com`
14783 cppccsymbols=`echo $cppccsymbols`
14784 $test "$silent" || sleep 1
14785 fi
14786 if $test -s ccsym.cpp; then
14787 $test "$also" && echo " "
14788 echo "Your C pre-processor ${also}defines the following symbols:"
14789 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
14790 also='further '
14791 cppsymbols=`$cat ccsym.cpp`
14792 cppsymbols=`echo $cppsymbols`
14793 $test "$silent" || sleep 1
14794 fi
14795 if $test -s ccsym.own; then
14796 $test "$also" && echo " "
14797 echo "Your C compiler ${also}defines the following cpp symbols:"
14798 $sed -e 's/\(..*\)=1/\1/' ccsym.own
14799 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14800 ccsymbols=`$cat ccsym.own`
14801 ccsymbols=`echo $ccsymbols`
14802 $test "$silent" || sleep 1
14803 fi
14804fi
14805$rm -f ccsym* Cppsym.*
14806
14807: see if this is a termio system
14808val="$undef"
14809val2="$undef"
14810val3="$undef"
14811if $test `./findhdr termios.h`; then
14812 set tcsetattr i_termios
14813 eval $inlibc
14814 val3="$i_termios"
14815fi
14816echo " "
14817case "$val3" in
14818"$define") echo "You have POSIX termios.h... good!" >&4;;
14819*) if ./Cppsym pyr; then
14820 case "`/bin/universe`" in
14821 ucb) if $test `./findhdr sgtty.h`; then
14822 val2="$define"
14823 echo "<sgtty.h> found." >&4
14824 else
14825 echo "System is pyramid with BSD universe."
14826 echo "<sgtty.h> not found--you could have problems." >&4
14827 fi;;
14828 *) if $test `./findhdr termio.h`; then
14829 val="$define"
14830 echo "<termio.h> found." >&4
14831 else
14832 echo "System is pyramid with USG universe."
14833 echo "<termio.h> not found--you could have problems." >&4
14834 fi;;
14835 esac
14836 elif ./usg; then
14837 if $test `./findhdr termio.h`; then
14838 echo "<termio.h> found." >&4
14839 val="$define"
14840 elif $test `./findhdr sgtty.h`; then
14841 echo "<sgtty.h> found." >&4
14842 val2="$define"
14843 else
14844echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14845 fi
14846 else
14847 if $test `./findhdr sgtty.h`; then
14848 echo "<sgtty.h> found." >&4
14849 val2="$define"
14850 elif $test `./findhdr termio.h`; then
14851 echo "<termio.h> found." >&4
14852 val="$define"
14853 else
14854echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14855 fi
14856 fi;;
14857esac
14858set i_termio; eval $setvar
14859val=$val2; set i_sgtty; eval $setvar
14860val=$val3; set i_termios; eval $setvar
14861
14862: see if this is a shadow.h system
14863set shadow.h i_shadow
14864eval $inhdr
14865
14866: see if this is a socks.h system
14867set socks.h i_socks
14868eval $inhdr
14869
14870: see if stdarg is available
14871echo " "
14872if $test `./findhdr stdarg.h`; then
14873 echo "<stdarg.h> found." >&4
14874 valstd="$define"
14875else
14876 echo "<stdarg.h> NOT found." >&4
14877 valstd="$undef"
14878fi
14879
14880: see if varags is available
14881echo " "
14882if $test `./findhdr varargs.h`; then
14883 echo "<varargs.h> found." >&4
14884else
14885 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14886fi
14887
14888: set up the varargs testing programs
14889$cat > varargs.c <<EOP
14890#ifdef I_STDARG
14891#include <stdarg.h>
14892#endif
14893#ifdef I_VARARGS
14894#include <varargs.h>
14895#endif
14896
14897#ifdef I_STDARG
14898int f(char *p, ...)
14899#else
14900int f(va_alist)
14901va_dcl
14902#endif
14903{
14904 va_list ap;
14905#ifndef I_STDARG
14906 char *p;
14907#endif
14908#ifdef I_STDARG
14909 va_start(ap,p);
14910#else
14911 va_start(ap);
14912 p = va_arg(ap, char *);
14913#endif
14914 va_end(ap);
14915}
14916EOP
14917$cat > varargs <<EOP
14918$startsh
14919if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14920 echo "true"
14921else
14922 echo "false"
14923fi
14924$rm -f varargs$_o
14925EOP
14926chmod +x varargs
14927
14928: now check which varargs header should be included
14929echo " "
14930i_varhdr=''
14931case "$valstd" in
14932"$define")
14933 if `./varargs I_STDARG`; then
14934 val='stdarg.h'
14935 elif `./varargs I_VARARGS`; then
14936 val='varargs.h'
14937 fi
14938 ;;
14939*)
14940 if `./varargs I_VARARGS`; then
14941 val='varargs.h'
14942 fi
14943 ;;
14944esac
14945case "$val" in
14946'')
14947echo "I could not find the definition for va_dcl... You have problems..." >&4
14948 val="$undef"; set i_stdarg; eval $setvar
14949 val="$undef"; set i_varargs; eval $setvar
14950 ;;
14951*)
14952 set i_varhdr
14953 eval $setvar
14954 case "$i_varhdr" in
14955 stdarg.h)
14956 val="$define"; set i_stdarg; eval $setvar
14957 val="$undef"; set i_varargs; eval $setvar
14958 ;;
14959 varargs.h)
14960 val="$undef"; set i_stdarg; eval $setvar
14961 val="$define"; set i_varargs; eval $setvar
14962 ;;
14963 esac
14964 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14965esac
14966$rm -f varargs*
5f80c64f 14967
b4eb6b3d
JH
14968: see if stddef is available
14969set stddef.h i_stddef
14970eval $inhdr
923fc586 14971
b4eb6b3d
JH
14972: see if this is a sunmath.h system
14973set sunmath.h i_sunmath
14974eval $inhdr
5f80c64f 14975
b4eb6b3d
JH
14976: see if sys/access.h is available
14977set sys/access.h i_sysaccess
14978eval $inhdr
14979
14980: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14981set sys/filio.h i_sysfilio
14982eval $inhdr
14983echo " "
14984if $test `./findhdr sys/ioctl.h`; then
14985 val="$define"
14986 echo '<sys/ioctl.h> found.' >&4
14987else
14988 val="$undef"
14989 if $test $i_sysfilio = "$define"; then
14990 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 14991 else
b4eb6b3d
JH
14992 $test $i_sgtty = "$define" && xxx="sgtty.h"
14993 $test $i_termio = "$define" && xxx="termio.h"
14994 $test $i_termios = "$define" && xxx="termios.h"
14995echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14996 fi
14997fi
14998set i_sysioctl
14999eval $setvar
15000
15001
15002: see if this is a syslog.h system
15003set syslog.h i_syslog
15004eval $inhdr
15005
15006
15007: see if this is a sys/mode.h system
15008set sys/mode.h i_sysmode
15009eval $inhdr
15010
15011: see if sys/resource.h has to be included
15012set sys/resource.h i_sysresrc
15013eval $inhdr
15014
15015: see if sys/security.h is available
15016set sys/security.h i_syssecrt
15017eval $inhdr
15018
15019: see if this is a sys/statvfs.h system
15020set sys/statvfs.h i_sysstatvfs
15021eval $inhdr
15022
15023: see if this is a sys/uio.h system
15024set sys/uio.h i_sysuio
15025eval $inhdr
15026
15027: see if this is a sys/un.h system
15028set sys/un.h i_sysun
15029eval $inhdr
15030
15031
15032: see if this is a sys/utsname.h system
15033set sys/utsname.h i_sysutsname
15034eval $inhdr
15035
15036: see if this is a syswait system
15037set sys/wait.h i_syswait
15038eval $inhdr
15039
15040: see if this is a ustat.h system
15041set ustat.h i_ustat
15042eval $inhdr
15043
15044: see if this is an utime system
15045set utime.h i_utime
15046eval $inhdr
15047
15048: see if this is a values.h system
15049set values.h i_values
15050eval $inhdr
15051
15052: see if this is a vfork system
15053case "$d_vfork" in
15054"$define")
15055 set vfork.h i_vfork
15056 eval $inhdr
15057 ;;
15058*)
15059 i_vfork="$undef"
15060 ;;
15061esac
15062
15063: see if gdbm.h is available
15064set gdbm.h t_gdbm
15065eval $inhdr
15066case "$t_gdbm" in
15067$define)
15068 : see if gdbm_open exists
15069 set gdbm_open d_gdbm_open
15070 eval $inlibc
15071 case "$d_gdbm_open" in
15072 $undef)
15073 t_gdbm="$undef"
15074 echo "We won't be including <gdbm.h>"
5f80c64f 15075 ;;
b4eb6b3d
JH
15076 esac
15077 ;;
15078esac
15079val="$t_gdbm"
15080set i_gdbm
15081eval $setvar
15082
15083echo " "
15084echo "Looking for extensions..." >&4
15085: If we are using the old config.sh, known_extensions may contain
15086: old or inaccurate or duplicate values.
15087known_extensions=''
15088nonxs_extensions=''
15089: We do not use find because it might not be available.
15090: We do not just use MANIFEST because the user may have dropped
15091: some additional extensions into the source tree and expect them
15092: to be built.
15093
15094: Function to recursively find available extensions, ignoring DynaLoader
15095: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15096find_extensions='
15097 for xxx in *; do
15098 case "$xxx" in
15099 DynaLoader|dynaload) ;;
15100 *)
15101 if $test -f $xxx/$xxx.xs; then
15102 known_extensions="$known_extensions $1$xxx";
15103 elif $test -f $xxx/Makefile.PL; then
15104 nonxs_extensions="$nonxs_extensions $1$xxx";
15105 else
15106 if $test -d $xxx -a $# -lt 10; then
15107 set $1$xxx/ $*;
15108 cd $xxx;
15109 eval $find_extensions;
15110 cd ..;
15111 shift;
15112 fi;
15113 fi
15114 ;;
15115 esac;
15116 done'
15117tdir=`pwd`
15118cd $rsrc/ext
15119set X
15120shift
15121eval $find_extensions
15122set X $nonxs_extensions
15123shift
15124nonxs_extensions="$*"
15125set X $known_extensions
15126shift
15127known_extensions="$*"
15128cd $tdir
15129
15130: Now see which are supported on this system.
15131avail_ext=''
15132for xxx in $known_extensions ; do
15133 case "$xxx" in
15134 DB_File|db_file)
15135 case "$i_db" in
15136 $define) avail_ext="$avail_ext $xxx" ;;
15137 esac
15138 ;;
15139 GDBM_File|gdbm_fil)
15140 case "$i_gdbm" in
15141 $define) avail_ext="$avail_ext $xxx" ;;
15142 esac
15143 ;;
15144 NDBM_File|ndbm_fil)
15145 case "$i_ndbm" in
15146 $define)
15147 case "$osname-$use64bitint" in
15148 hpux-define)
15149 case "$libs" in
15150 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15151 esac
15152 ;;
15153 *) avail_ext="$avail_ext $xxx" ;;
15154 esac
15155 ;;
15156 esac
15157 ;;
15158 ODBM_File|odbm_fil)
15159 case "${i_dbm}${i_rpcsvcdbm}" in
15160 *"${define}"*)
15161 case "$osname-$use64bitint" in
15162 hpux-define)
15163 case "$libs" in
15164 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15165 esac
15166 ;;
15167 *) avail_ext="$avail_ext $xxx" ;;
15168 esac
15169 ;;
15170 esac
15171 ;;
15172 POSIX|posix)
15173 case "$useposix" in
15174 true|define|y) avail_ext="$avail_ext $xxx" ;;
15175 esac
15176 ;;
15177 Opcode|opcode)
15178 case "$useopcode" in
15179 true|define|y) avail_ext="$avail_ext $xxx" ;;
15180 esac
15181 ;;
15182 Socket|socket)
15183 case "$d_socket" in
15184 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15185 esac
15186 ;;
15187 Sys/Syslog|sys/syslog)
15188 : XXX syslog requires socket
15189 case "$d_socket" in
15190 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15191 esac
15192 ;;
15193 Thread|thread)
15194 case "$usethreads" in
15195 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15196 esac
15197 ;;
15198 IPC/SysV|ipc/sysv)
15199 : XXX Do we need a useipcsysv variable here
15200 case "${d_msg}${d_sem}${d_shm}" in
15201 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15202 esac
15203 ;;
15204 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
15205 ;;
15206 esac
b4eb6b3d 15207done
5f80c64f 15208
b4eb6b3d
JH
15209set X $avail_ext
15210shift
15211avail_ext="$*"
5f80c64f 15212
b4eb6b3d
JH
15213: Now see which nonxs extensions are supported on this system.
15214: For now assume all are.
15215nonxs_ext=''
15216for xxx in $nonxs_extensions ; do
15217 case "$xxx" in
15218 *) nonxs_ext="$nonxs_ext $xxx"
15219 ;;
15220 esac
15221done
5f80c64f 15222
b4eb6b3d
JH
15223set X $nonxs_ext
15224shift
15225nonxs_ext="$*"
15226
15227case $usedl in
15228$define)
15229 $cat <<EOM
15230A number of extensions are supplied with $package. You may choose to
15231compile these extensions for dynamic loading (the default), compile
15232them into the $package executable (static loading), or not include
15233them at all. Answer "none" to include no extensions.
15234Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
15235
15236EOM
b4eb6b3d
JH
15237 case "$dynamic_ext" in
15238 '') dflt="$avail_ext" ;;
15239 *) dflt="$dynamic_ext"
15240 # Perhaps we are reusing an old out-of-date config.sh.
15241 case "$hint" in
15242 previous)
15243 if test X"$dynamic_ext" != X"$avail_ext"; then
15244 $cat <<EOM
15245NOTICE: Your previous config.sh list may be incorrect.
15246The extensions now available to you are
15247 ${avail_ext}
15248but the default list from your previous config.sh is
15249 ${dynamic_ext}
9c839522 15250
b4eb6b3d
JH
15251EOM
15252 fi
9c839522
PM
15253 ;;
15254 esac
b4eb6b3d
JH
15255 ;;
15256 esac
5f80c64f 15257 case "$dflt" in
b4eb6b3d
JH
15258 '') dflt=none;;
15259 esac
15260 rp="What extensions do you wish to load dynamically?"
15261 . ./myread
15262 case "$ans" in
15263 none) dynamic_ext=' ' ;;
15264 *) dynamic_ext="$ans" ;;
5f80c64f 15265 esac
5f80c64f 15266
b4eb6b3d
JH
15267 case "$static_ext" in
15268 '')
15269 : Exclude those already listed in dynamic linking
15270 dflt=''
15271 for xxx in $avail_ext; do
15272 case " $dynamic_ext " in
15273 *" $xxx "*) ;;
15274 *) dflt="$dflt $xxx" ;;
15275 esac
15276 done
15277 set X $dflt
15278 shift
15279 dflt="$*"
15280 ;;
15281 *) dflt="$static_ext"
15282 ;;
15283 esac
9c839522 15284
b4eb6b3d
JH
15285 case "$dflt" in
15286 '') dflt=none;;
15287 esac
15288 rp="What extensions do you wish to load statically?"
15289 . ./myread
15290 case "$ans" in
15291 none) static_ext=' ' ;;
15292 *) static_ext="$ans" ;;
15293 esac
15294 ;;
15295*)
15296 $cat <<EOM
15297A number of extensions are supplied with $package. Answer "none"
15298to include no extensions.
15299Note that DynaLoader is always built and need not be mentioned here.
9c839522 15300
b4eb6b3d
JH
15301EOM
15302 case "$static_ext" in
15303 '') dflt="$avail_ext" ;;
15304 *) dflt="$static_ext"
15305 # Perhaps we are reusing an old out-of-date config.sh.
15306 case "$hint" in
15307 previous)
15308 if test X"$static_ext" != X"$avail_ext"; then
15309 $cat <<EOM
15310NOTICE: Your previous config.sh list may be incorrect.
15311The extensions now available to you are
15312 ${avail_ext}
15313but the default list from your previous config.sh is
15314 ${static_ext}
5f80c64f
JH
15315
15316EOM
b4eb6b3d
JH
15317 fi
15318 ;;
15319 esac
15320 ;;
15321 esac
15322 : Exclude those that are not xs extensions
15323 case "$dflt" in
15324 '') dflt=none;;
15325 esac
15326 rp="What extensions do you wish to include?"
15327 . ./myread
15328 case "$ans" in
15329 none) static_ext=' ' ;;
15330 *) static_ext="$ans" ;;
15331 esac
15332 ;;
5f80c64f
JH
15333esac
15334
b4eb6b3d
JH
15335set X $dynamic_ext $static_ext $nonxs_ext
15336shift
15337extensions="$*"
15338
9c839522
PM
15339: Remove libraries needed only for extensions
15340: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
15341: The exception is SunOS 4.x, which needs them.
15342case "${osname}X${osvers}" in
15343sunos*X4*)
15344 perllibs="$libs"
15345 ;;
15346*) case "$usedl" in
15347 $define|true|[yY]*)
15348 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
15349 shift
15350 perllibs="$*"
15351 ;;
15352 *) perllibs="$libs"
15353 ;;
15354 esac
15355 ;;
9c839522 15356esac
5f80c64f
JH
15357
15358: Remove build directory name from cppstdin so it can be used from
15359: either the present location or the final installed location.
15360echo " "
15361: Get out of the UU directory to get correct path name.
15362cd ..
15363case "$cppstdin" in
15364`pwd`/cppstdin)
15365 echo "Stripping down cppstdin path name"
15366 cppstdin=cppstdin
15367 ;;
15368esac
15369cd UU
15370
15371: end of configuration questions
15372echo " "
15373echo "End of configuration questions."
15374echo " "
15375
15376: back to where it started
15377if test -d ../UU; then
15378 cd ..
15379fi
15380
15381: configuration may be patched via a 'config.over' file
15382if $test -f config.over; then
15383 echo " "
15384 dflt=y
15385 rp='I see a config.over file. Do you wish to load it?'
15386 . UU/myread
15387 case "$ans" in
15388 n*) echo "OK, I'll ignore it.";;
15389 *) . ./config.over
15390 echo "Configuration override changes have been loaded."
15391 ;;
15392 esac
15393fi
15394
15395: in case they want portability, strip down executable paths
15396case "$d_portable" in
15397"$define")
15398 echo " "
15399 echo "Stripping down executable paths..." >&4
15400 for file in $loclist $trylist; do
534ac15a
JH
15401 eval temp=\$$file
15402 eval $file=`basename $temp`
5f80c64f
JH
15403 done
15404 ;;
15405esac
15406
15407: create config.sh file
15408echo " "
15409echo "Creating config.sh..." >&4
15410$spitshell <<EOT >config.sh
15411$startsh
15412#
15413# This file was produced by running the Configure script. It holds all the
15414# definitions figured out by Configure. Should you modify one of these values,
15415# do not forget to propagate your changes by running "Configure -der". You may
15416# instead choose to run each of the .SH files by yourself, or "Configure -S".
15417#
15418
15419# Package name : $package
15420# Source directory : $src
15421# Configuration time: $cf_time
15422# Configured by : $cf_by
15423# Target system : $myuname
15424
15425Author='$Author'
15426Date='$Date'
15427Header='$Header'
15428Id='$Id'
15429Locker='$Locker'
15430Log='$Log'
15431Mcc='$Mcc'
15432RCSfile='$RCSfile'
15433Revision='$Revision'
15434Source='$Source'
15435State='$State'
15436_a='$_a'
15437_exe='$_exe'
15438_o='$_o'
b4eb6b3d
JH
15439afs='$afs'
15440alignbytes='$alignbytes'
15441ansi2knr='$ansi2knr'
15442aphostname='$aphostname'
15443api_revision='$api_revision'
15444api_subversion='$api_subversion'
15445api_version='$api_version'
15446api_versionstring='$api_versionstring'
5f80c64f 15447ar='$ar'
b4eb6b3d
JH
15448archlib='$archlib'
15449archlibexp='$archlibexp'
15450archname64='$archname64'
15451archname='$archname'
5f80c64f
JH
15452archobjs='$archobjs'
15453awk='$awk'
b4eb6b3d 15454baserev='$baserev'
5f80c64f 15455bash='$bash'
b4eb6b3d
JH
15456bin='$bin'
15457bincompat5005='$bincompat5005'
15458binexp='$binexp'
5f80c64f
JH
15459bison='$bison'
15460byacc='$byacc'
b4eb6b3d 15461byteorder='$byteorder'
5f80c64f 15462c='$c'
b4eb6b3d 15463castflags='$castflags'
5f80c64f
JH
15464cat='$cat'
15465cc='$cc'
15466cccdlflags='$cccdlflags'
15467ccdlflags='$ccdlflags'
15468ccflags='$ccflags'
b4eb6b3d 15469ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 15470ccname='$ccname'
b4eb6b3d 15471ccsymbols='$ccsymbols'
6b356c8e 15472ccversion='$ccversion'
5f80c64f 15473cf_by='$cf_by'
b4eb6b3d 15474cf_email='$cf_email'
5f80c64f 15475cf_time='$cf_time'
b4eb6b3d 15476charsize='$charsize'
5f80c64f
JH
15477chgrp='$chgrp'
15478chmod='$chmod'
15479chown='$chown'
b4eb6b3d 15480clocktype='$clocktype'
5f80c64f
JH
15481comm='$comm'
15482compress='$compress'
15483contains='$contains'
15484cp='$cp'
15485cpio='$cpio'
15486cpp='$cpp'
b4eb6b3d
JH
15487cpp_stuff='$cpp_stuff'
15488cppccsymbols='$cppccsymbols'
5f80c64f
JH
15489cppflags='$cppflags'
15490cpplast='$cpplast'
15491cppminus='$cppminus'
15492cpprun='$cpprun'
15493cppstdin='$cppstdin'
b4eb6b3d
JH
15494cppsymbols='$cppsymbols'
15495crosscompile='$crosscompile'
15496cryptlib='$cryptlib'
5f80c64f 15497csh='$csh'
b4eb6b3d
JH
15498d_Gconvert='$d_Gconvert'
15499d_PRIEUldbl='$d_PRIEUldbl'
15500d_PRIFUldbl='$d_PRIFUldbl'
15501d_PRIGUldbl='$d_PRIGUldbl'
15502d_PRIXU64='$d_PRIXU64'
15503d_PRId64='$d_PRId64'
15504d_PRIeldbl='$d_PRIeldbl'
15505d_PRIfldbl='$d_PRIfldbl'
15506d_PRIgldbl='$d_PRIgldbl'
15507d_PRIi64='$d_PRIi64'
15508d_PRIo64='$d_PRIo64'
15509d_PRIu64='$d_PRIu64'
15510d_PRIx64='$d_PRIx64'
15511d_SCNfldbl='$d_SCNfldbl'
15512d_access='$d_access'
15513d_accessx='$d_accessx'
15514d_alarm='$d_alarm'
15515d_archlib='$d_archlib'
15516d_atolf='$d_atolf'
15517d_atoll='$d_atoll'
15518d_attribut='$d_attribut'
15519d_bcmp='$d_bcmp'
15520d_bcopy='$d_bcopy'
15521d_bincompat5005='$d_bincompat5005'
5f80c64f 15522d_bsd='$d_bsd'
b4eb6b3d
JH
15523d_bsdgetpgrp='$d_bsdgetpgrp'
15524d_bsdsetpgrp='$d_bsdsetpgrp'
15525d_bzero='$d_bzero'
15526d_casti32='$d_casti32'
15527d_castneg='$d_castneg'
15528d_charvspr='$d_charvspr'
15529d_chown='$d_chown'
15530d_chroot='$d_chroot'
15531d_chsize='$d_chsize'
15532d_closedir='$d_closedir'
15533d_const='$d_const'
15534d_crypt='$d_crypt'
15535d_csh='$d_csh'
15536d_cuserid='$d_cuserid'
15537d_dbl_dig='$d_dbl_dig'
15538d_difftime='$d_difftime'
15539d_dirnamlen='$d_dirnamlen'
15540d_dlerror='$d_dlerror'
5f80c64f 15541d_dlopen='$d_dlopen'
b4eb6b3d
JH
15542d_dlsymun='$d_dlsymun'
15543d_dosuid='$d_dosuid'
15544d_drand48proto='$d_drand48proto'
15545d_dup2='$d_dup2'
15546d_eaccess='$d_eaccess'
15547d_endgrent='$d_endgrent'
15548d_endhent='$d_endhent'
15549d_endnent='$d_endnent'
15550d_endpent='$d_endpent'
15551d_endpwent='$d_endpwent'
15552d_endsent='$d_endsent'
15553d_eofnblk='$d_eofnblk'
5f80c64f 15554d_eunice='$d_eunice'
b4eb6b3d
JH
15555d_fchmod='$d_fchmod'
15556d_fchown='$d_fchown'
15557d_fcntl='$d_fcntl'
9d9004a9 15558d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
15559d_fd_macros='$d_fd_macros'
15560d_fd_set='$d_fd_set'
15561d_fds_bits='$d_fds_bits'
15562d_fgetpos='$d_fgetpos'
15563d_flexfnam='$d_flexfnam'
15564d_flock='$d_flock'
15565d_fork='$d_fork'
15566d_fpathconf='$d_fpathconf'
15567d_fpos64_t='$d_fpos64_t'
15568d_frexpl='$d_frexpl'
15569d_fs_data_s='$d_fs_data_s'
15570d_fseeko='$d_fseeko'
15571d_fsetpos='$d_fsetpos'
15572d_fstatfs='$d_fstatfs'
15573d_fstatvfs='$d_fstatvfs'
15574d_ftello='$d_ftello'
15575d_ftime='$d_ftime'
15576d_getcwd='$d_getcwd'
15577d_getespwnam='$d_getespwnam'
15578d_getfsstat='$d_getfsstat'
15579d_getgrent='$d_getgrent'
15580d_getgrps='$d_getgrps'
15581d_gethbyaddr='$d_gethbyaddr'
15582d_gethbyname='$d_gethbyname'
15583d_gethent='$d_gethent'
15584d_gethname='$d_gethname'
15585d_gethostprotos='$d_gethostprotos'
15586d_getlogin='$d_getlogin'
15587d_getmnt='$d_getmnt'
15588d_getmntent='$d_getmntent'
15589d_getnbyaddr='$d_getnbyaddr'
15590d_getnbyname='$d_getnbyname'
15591d_getnent='$d_getnent'
15592d_getnetprotos='$d_getnetprotos'
15593d_getpbyname='$d_getpbyname'
15594d_getpbynumber='$d_getpbynumber'
15595d_getpent='$d_getpent'
15596d_getpgid='$d_getpgid'
15597d_getpgrp2='$d_getpgrp2'
15598d_getpgrp='$d_getpgrp'
15599d_getppid='$d_getppid'
15600d_getprior='$d_getprior'
15601d_getprotoprotos='$d_getprotoprotos'
15602d_getprpwnam='$d_getprpwnam'
15603d_getpwent='$d_getpwent'
15604d_getsbyname='$d_getsbyname'
15605d_getsbyport='$d_getsbyport'
15606d_getsent='$d_getsent'
15607d_getservprotos='$d_getservprotos'
15608d_getspnam='$d_getspnam'
15609d_gettimeod='$d_gettimeod'
5f80c64f 15610d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
15611d_grpasswd='$d_grpasswd'
15612d_hasmntopt='$d_hasmntopt'
15613d_htonl='$d_htonl'
15614d_iconv='$d_iconv'
15615d_index='$d_index'
15616d_inetaton='$d_inetaton'
15617d_int64_t='$d_int64_t'
15618d_isascii='$d_isascii'
15619d_isnan='$d_isnan'
15620d_isnanl='$d_isnanl'
15621d_killpg='$d_killpg'
15622d_lchown='$d_lchown'
15623d_ldbl_dig='$d_ldbl_dig'
15624d_link='$d_link'
15625d_locconv='$d_locconv'
15626d_lockf='$d_lockf'
15627d_longdbl='$d_longdbl'
15628d_longlong='$d_longlong'
15629d_lseekproto='$d_lseekproto'
15630d_lstat='$d_lstat'
15631d_madvise='$d_madvise'
15632d_mblen='$d_mblen'
15633d_mbstowcs='$d_mbstowcs'
15634d_mbtowc='$d_mbtowc'
15635d_memchr='$d_memchr'
15636d_memcmp='$d_memcmp'
15637d_memcpy='$d_memcpy'
15638d_memmove='$d_memmove'
15639d_memset='$d_memset'
15640d_mkdir='$d_mkdir'
15641d_mkdtemp='$d_mkdtemp'
15642d_mkfifo='$d_mkfifo'
15643d_mkstemp='$d_mkstemp'
15644d_mkstemps='$d_mkstemps'
15645d_mktime='$d_mktime'
15646d_mmap='$d_mmap'
15647d_modfl='$d_modfl'
15648d_mprotect='$d_mprotect'
15649d_msg='$d_msg'
15650d_msg_ctrunc='$d_msg_ctrunc'
15651d_msg_dontroute='$d_msg_dontroute'
15652d_msg_oob='$d_msg_oob'
15653d_msg_peek='$d_msg_peek'
15654d_msg_proxy='$d_msg_proxy'
15655d_msgctl='$d_msgctl'
15656d_msgget='$d_msgget'
15657d_msgrcv='$d_msgrcv'
15658d_msgsnd='$d_msgsnd'
15659d_msync='$d_msync'
15660d_munmap='$d_munmap'
15661d_mymalloc='$d_mymalloc'
15662d_nice='$d_nice'
15663d_nv_preserves_uv='$d_nv_preserves_uv'
15664d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15665d_off64_t='$d_off64_t'
15666d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15667d_oldpthreads='$d_oldpthreads'
15668d_oldsock='$d_oldsock'
15669d_open3='$d_open3'
15670d_pathconf='$d_pathconf'
15671d_pause='$d_pause'
15672d_perl_otherlibdirs='$d_perl_otherlibdirs'
15673d_phostname='$d_phostname'
15674d_pipe='$d_pipe'
15675d_poll='$d_poll'
5f80c64f 15676d_portable='$d_portable'
b4eb6b3d
JH
15677d_pthread_yield='$d_pthread_yield'
15678d_pwage='$d_pwage'
15679d_pwchange='$d_pwchange'
15680d_pwclass='$d_pwclass'
15681d_pwcomment='$d_pwcomment'
15682d_pwexpire='$d_pwexpire'
15683d_pwgecos='$d_pwgecos'
15684d_pwpasswd='$d_pwpasswd'
15685d_pwquota='$d_pwquota'
15686d_qgcvt='$d_qgcvt'
15687d_quad='$d_quad'
15688d_readdir='$d_readdir'
15689d_readlink='$d_readlink'
15690d_rename='$d_rename'
15691d_rewinddir='$d_rewinddir'
15692d_rmdir='$d_rmdir'
15693d_safebcpy='$d_safebcpy'
15694d_safemcpy='$d_safemcpy'
15695d_sanemcmp='$d_sanemcmp'
15696d_sched_yield='$d_sched_yield'
15697d_scm_rights='$d_scm_rights'
15698d_seekdir='$d_seekdir'
15699d_select='$d_select'
15700d_sem='$d_sem'
15701d_semctl='$d_semctl'
15702d_semctl_semid_ds='$d_semctl_semid_ds'
15703d_semctl_semun='$d_semctl_semun'
15704d_semget='$d_semget'
15705d_semop='$d_semop'
15706d_setegid='$d_setegid'
15707d_seteuid='$d_seteuid'
15708d_setgrent='$d_setgrent'
15709d_setgrps='$d_setgrps'
15710d_sethent='$d_sethent'
15711d_setlinebuf='$d_setlinebuf'
15712d_setlocale='$d_setlocale'
15713d_setnent='$d_setnent'
15714d_setpent='$d_setpent'
15715d_setpgid='$d_setpgid'
15716d_setpgrp2='$d_setpgrp2'
15717d_setpgrp='$d_setpgrp'
15718d_setprior='$d_setprior'
15719d_setproctitle='$d_setproctitle'
15720d_setpwent='$d_setpwent'
15721d_setregid='$d_setregid'
15722d_setresgid='$d_setresgid'
15723d_setresuid='$d_setresuid'
15724d_setreuid='$d_setreuid'
15725d_setrgid='$d_setrgid'
15726d_setruid='$d_setruid'
15727d_setsent='$d_setsent'
15728d_setsid='$d_setsid'
15729d_setvbuf='$d_setvbuf'
15730d_sfio='$d_sfio'
15731d_shm='$d_shm'
15732d_shmat='$d_shmat'
15733d_shmatprototype='$d_shmatprototype'
15734d_shmctl='$d_shmctl'
15735d_shmdt='$d_shmdt'
15736d_shmget='$d_shmget'
15737d_sigaction='$d_sigaction'
15738d_sigsetjmp='$d_sigsetjmp'
15739d_socket='$d_socket'
15740d_socklen_t='$d_socklen_t'
15741d_sockpair='$d_sockpair'
15742d_socks5_init='$d_socks5_init'
15743d_sqrtl='$d_sqrtl'
15744d_statblks='$d_statblks'
15745d_statfs_f_flags='$d_statfs_f_flags'
15746d_statfs_s='$d_statfs_s'
15747d_statvfs='$d_statvfs'
15748d_stdio_cnt_lval='$d_stdio_cnt_lval'
15749d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
15750d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
15751d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
15752d_stdio_stream_array='$d_stdio_stream_array'
15753d_stdiobase='$d_stdiobase'
15754d_stdstdio='$d_stdstdio'
15755d_strchr='$d_strchr'
15756d_strcoll='$d_strcoll'
15757d_strctcpy='$d_strctcpy'
15758d_strerrm='$d_strerrm'
15759d_strerror='$d_strerror'
15760d_strtod='$d_strtod'
15761d_strtol='$d_strtol'
15762d_strtold='$d_strtold'
15763d_strtoll='$d_strtoll'
15764d_strtoul='$d_strtoul'
15765d_strtoull='$d_strtoull'
15766d_strtouq='$d_strtouq'
15767d_strxfrm='$d_strxfrm'
15768d_suidsafe='$d_suidsafe'
15769d_symlink='$d_symlink'
15770d_syscall='$d_syscall'
15771d_sysconf='$d_sysconf'
15772d_sysernlst='$d_sysernlst'
15773d_syserrlst='$d_syserrlst'
15774d_system='$d_system'
15775d_tcgetpgrp='$d_tcgetpgrp'
15776d_tcsetpgrp='$d_tcsetpgrp'
15777d_telldir='$d_telldir'
15778d_telldirproto='$d_telldirproto'
15779d_time='$d_time'
15780d_times='$d_times'
15781d_truncate='$d_truncate'
15782d_tzname='$d_tzname'
15783d_umask='$d_umask'
15784d_uname='$d_uname'
15785d_union_semun='$d_union_semun'
15786d_ustat='$d_ustat'
15787d_vendorarch='$d_vendorarch'
15788d_vendorbin='$d_vendorbin'
15789d_vendorlib='$d_vendorlib'
15790d_vfork='$d_vfork'
15791d_void_closedir='$d_void_closedir'
15792d_voidsig='$d_voidsig'
15793d_voidtty='$d_voidtty'
15794d_volatile='$d_volatile'
15795d_vprintf='$d_vprintf'
15796d_wait4='$d_wait4'
15797d_waitpid='$d_waitpid'
15798d_wcstombs='$d_wcstombs'
15799d_wctomb='$d_wctomb'
5f80c64f
JH
15800d_xenix='$d_xenix'
15801date='$date'
b4eb6b3d
JH
15802db_hashtype='$db_hashtype'
15803db_prefixtype='$db_prefixtype'
15804defvoidused='$defvoidused'
15805direntrytype='$direntrytype'
15806dlext='$dlext'
5f80c64f 15807dlsrc='$dlsrc'
b4eb6b3d
JH
15808doublesize='$doublesize'
15809drand01='$drand01'
15810dynamic_ext='$dynamic_ext'
15811eagain='$eagain'
15812ebcdic='$ebcdic'
5f80c64f
JH
15813echo='$echo'
15814egrep='$egrep'
15815emacs='$emacs'
15816eunicefix='$eunicefix'
15817exe_ext='$exe_ext'
15818expr='$expr'
b4eb6b3d
JH
15819extensions='$extensions'
15820fflushNULL='$fflushNULL'
15821fflushall='$fflushall'
5f80c64f
JH
15822find='$find'
15823firstmakefile='$firstmakefile'
15824flex='$flex'
b4eb6b3d
JH
15825fpossize='$fpossize'
15826fpostype='$fpostype'
15827freetype='$freetype'
15828full_ar='$full_ar'
15829full_csh='$full_csh'
15830full_sed='$full_sed'
5b463ca7 15831gccosandvers='$gccosandvers'
5f80c64f 15832gccversion='$gccversion'
b4eb6b3d
JH
15833gidformat='$gidformat'
15834gidsign='$gidsign'
15835gidsize='$gidsize'
15836gidtype='$gidtype'
5f80c64f
JH
15837glibpth='$glibpth'
15838grep='$grep'
b4eb6b3d
JH
15839groupcat='$groupcat'
15840groupstype='$groupstype'
5f80c64f 15841gzip='$gzip'
b4eb6b3d
JH
15842h_fcntl='$h_fcntl'
15843h_sysfile='$h_sysfile'
5f80c64f 15844hint='$hint'
b4eb6b3d
JH
15845hostcat='$hostcat'
15846i16size='$i16size'
15847i16type='$i16type'
15848i32size='$i32size'
15849i32type='$i32type'
15850i64size='$i64size'
15851i64type='$i64type'
15852i8size='$i8size'
15853i8type='$i8type'
15854i_arpainet='$i_arpainet'
15855i_bsdioctl='$i_bsdioctl'
15856i_db='$i_db'
15857i_dbm='$i_dbm'
15858i_dirent='$i_dirent'
5f80c64f 15859i_dld='$i_dld'
b4eb6b3d
JH
15860i_dlfcn='$i_dlfcn'
15861i_fcntl='$i_fcntl'
15862i_float='$i_float'
15863i_gdbm='$i_gdbm'
15864i_grp='$i_grp'
15865i_iconv='$i_iconv'
15866i_ieeefp='$i_ieeefp'
15867i_inttypes='$i_inttypes'
15868i_libutil='$i_libutil'
15869i_limits='$i_limits'
15870i_locale='$i_locale'
15871i_machcthr='$i_machcthr'
15872i_malloc='$i_malloc'
15873i_math='$i_math'
15874i_memory='$i_memory'
15875i_mntent='$i_mntent'
15876i_ndbm='$i_ndbm'
15877i_netdb='$i_netdb'
15878i_neterrno='$i_neterrno'
15879i_netinettcp='$i_netinettcp'
15880i_niin='$i_niin'
15881i_poll='$i_poll'
15882i_prot='$i_prot'
15883i_pthread='$i_pthread'
15884i_pwd='$i_pwd'
15885i_rpcsvcdbm='$i_rpcsvcdbm'
15886i_sfio='$i_sfio'
15887i_sgtty='$i_sgtty'
15888i_shadow='$i_shadow'
15889i_socks='$i_socks'
15890i_stdarg='$i_stdarg'
15891i_stddef='$i_stddef'
15892i_stdlib='$i_stdlib'
15893i_string='$i_string'
15894i_sunmath='$i_sunmath'
15895i_sysaccess='$i_sysaccess'
15896i_sysdir='$i_sysdir'
15897i_sysfile='$i_sysfile'
15898i_sysfilio='$i_sysfilio'
15899i_sysin='$i_sysin'
15900i_sysioctl='$i_sysioctl'
15901i_syslog='$i_syslog'
15902i_sysmman='$i_sysmman'
15903i_sysmode='$i_sysmode'
15904i_sysmount='$i_sysmount'
15905i_sysndir='$i_sysndir'
15906i_sysparam='$i_sysparam'
15907i_sysresrc='$i_sysresrc'
15908i_syssecrt='$i_syssecrt'
15909i_sysselct='$i_sysselct'
15910i_syssockio='$i_syssockio'
15911i_sysstat='$i_sysstat'
15912i_sysstatfs='$i_sysstatfs'
15913i_sysstatvfs='$i_sysstatvfs'
15914i_systime='$i_systime'
15915i_systimek='$i_systimek'
15916i_systimes='$i_systimes'
15917i_systypes='$i_systypes'
15918i_sysuio='$i_sysuio'
15919i_sysun='$i_sysun'
15920i_sysutsname='$i_sysutsname'
15921i_sysvfs='$i_sysvfs'
15922i_syswait='$i_syswait'
15923i_termio='$i_termio'
15924i_termios='$i_termios'
15925i_time='$i_time'
15926i_unistd='$i_unistd'
15927i_ustat='$i_ustat'
15928i_utime='$i_utime'
15929i_values='$i_values'
15930i_varargs='$i_varargs'
15931i_varhdr='$i_varhdr'
15932i_vfork='$i_vfork'
5f80c64f 15933ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
15934inc_version_list='$inc_version_list'
15935inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
15936incpath='$incpath'
15937inews='$inews'
b4eb6b3d
JH
15938installarchlib='$installarchlib'
15939installbin='$installbin'
15940installman1dir='$installman1dir'
15941installman3dir='$installman3dir'
15942installprefix='$installprefix'
15943installprefixexp='$installprefixexp'
15944installprivlib='$installprivlib'
15945installscript='$installscript'
15946installsitearch='$installsitearch'
15947installsitebin='$installsitebin'
15948installsitelib='$installsitelib'
15949installstyle='$installstyle'
15950installusrbinperl='$installusrbinperl'
15951installvendorarch='$installvendorarch'
15952installvendorbin='$installvendorbin'
15953installvendorlib='$installvendorlib'
15954intsize='$intsize'
15955ivdformat='$ivdformat'
15956ivsize='$ivsize'
15957ivtype='$ivtype'
15958known_extensions='$known_extensions'
5f80c64f 15959ksh='$ksh'
5f80c64f
JH
15960ld='$ld'
15961lddlflags='$lddlflags'
15962ldflags='$ldflags'
b4eb6b3d
JH
15963ldflags_uselargefiles='$ldflags_uselargefiles'
15964ldlibpthname='$ldlibpthname'
5f80c64f
JH
15965less='$less'
15966lib_ext='$lib_ext'
15967libc='$libc'
b4eb6b3d 15968libperl='$libperl'
5f80c64f
JH
15969libpth='$libpth'
15970libs='$libs'
43999f95
JH
15971libsdirs='$libsdirs'
15972libsfiles='$libsfiles'
15973libsfound='$libsfound'
13b3f787 15974libspath='$libspath'
5f80c64f 15975libswanted='$libswanted'
b4eb6b3d 15976libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
15977line='$line'
15978lint='$lint'
15979lkflags='$lkflags'
15980ln='$ln'
15981lns='$lns'
15982locincpth='$locincpth'
15983loclibpth='$loclibpth'
b4eb6b3d
JH
15984longdblsize='$longdblsize'
15985longlongsize='$longlongsize'
15986longsize='$longsize'
5f80c64f
JH
15987lp='$lp'
15988lpr='$lpr'
15989ls='$ls'
b4eb6b3d
JH
15990lseeksize='$lseeksize'
15991lseektype='$lseektype'
5f80c64f
JH
15992mail='$mail'
15993mailx='$mailx'
15994make='$make'
15995make_set_make='$make_set_make'
b4eb6b3d
JH
15996mallocobj='$mallocobj'
15997mallocsrc='$mallocsrc'
15998malloctype='$malloctype'
15999man1dir='$man1dir'
16000man1direxp='$man1direxp'
16001man1ext='$man1ext'
16002man3dir='$man3dir'
16003man3direxp='$man3direxp'
16004man3ext='$man3ext'
5f80c64f
JH
16005mips_type='$mips_type'
16006mkdir='$mkdir'
b4eb6b3d
JH
16007mmaptype='$mmaptype'
16008modetype='$modetype'
5f80c64f 16009more='$more'
b4eb6b3d 16010multiarch='$multiarch'
5f80c64f 16011mv='$mv'
b4eb6b3d
JH
16012myarchname='$myarchname'
16013mydomain='$mydomain'
16014myhostname='$myhostname'
5f80c64f
JH
16015myuname='$myuname'
16016n='$n'
b4eb6b3d
JH
16017netdb_hlen_type='$netdb_hlen_type'
16018netdb_host_type='$netdb_host_type'
16019netdb_name_type='$netdb_name_type'
16020netdb_net_type='$netdb_net_type'
5f80c64f
JH
16021nm='$nm'
16022nm_opt='$nm_opt'
16023nm_so_opt='$nm_so_opt'
b4eb6b3d 16024nonxs_ext='$nonxs_ext'
5f80c64f 16025nroff='$nroff'
b4eb6b3d
JH
16026nvEUformat='$nvEUformat'
16027nvFUformat='$nvFUformat'
16028nvGUformat='$nvGUformat'
16029nveformat='$nveformat'
16030nvfformat='$nvfformat'
16031nvgformat='$nvgformat'
16032nvsize='$nvsize'
16033nvtype='$nvtype'
16034o_nonblock='$o_nonblock'
5f80c64f 16035obj_ext='$obj_ext'
b4eb6b3d 16036old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 16037optimize='$optimize'
b4eb6b3d 16038orderlib='$orderlib'
5f80c64f
JH
16039osname='$osname'
16040osvers='$osvers'
b4eb6b3d 16041otherlibdirs='$otherlibdirs'
5f80c64f 16042package='$package'
b4eb6b3d
JH
16043pager='$pager'
16044passcat='$passcat'
16045patchlevel='$patchlevel'
5f80c64f 16046path_sep='$path_sep'
b4eb6b3d 16047perl5='$perl5'
5f80c64f 16048perl='$perl'
b4eb6b3d 16049perladmin='$perladmin'
9c839522 16050perllibs='$perllibs'
b4eb6b3d 16051perlpath='$perlpath'
5f80c64f 16052pg='$pg'
b4eb6b3d
JH
16053phostname='$phostname'
16054pidtype='$pidtype'
5f80c64f 16055plibpth='$plibpth'
b4eb6b3d 16056pm_apiversion='$pm_apiversion'
5f80c64f
JH
16057pmake='$pmake'
16058pr='$pr'
b4eb6b3d
JH
16059prefix='$prefix'
16060prefixexp='$prefixexp'
16061privlib='$privlib'
16062privlibexp='$privlibexp'
16063prototype='$prototype'
16064ptrsize='$ptrsize'
16065quadkind='$quadkind'
16066quadtype='$quadtype'
16067randbits='$randbits'
16068randfunc='$randfunc'
16069randseedtype='$randseedtype'
16070ranlib='$ranlib'
16071rd_nodata='$rd_nodata'
16072revision='$revision'
5f80c64f
JH
16073rm='$rm'
16074rmail='$rmail'
16075runnm='$runnm'
b4eb6b3d
JH
16076sPRIEUldbl='$sPRIEUldbl'
16077sPRIFUldbl='$sPRIFUldbl'
16078sPRIGUldbl='$sPRIGUldbl'
16079sPRIXU64='$sPRIXU64'
16080sPRId64='$sPRId64'
16081sPRIeldbl='$sPRIeldbl'
16082sPRIfldbl='$sPRIfldbl'
16083sPRIgldbl='$sPRIgldbl'
16084sPRIi64='$sPRIi64'
16085sPRIo64='$sPRIo64'
16086sPRIu64='$sPRIu64'
16087sPRIx64='$sPRIx64'
16088sSCNfldbl='$sSCNfldbl'
16089sched_yield='$sched_yield'
16090scriptdir='$scriptdir'
16091scriptdirexp='$scriptdirexp'
5f80c64f 16092sed='$sed'
b4eb6b3d
JH
16093seedfunc='$seedfunc'
16094selectminbits='$selectminbits'
16095selecttype='$selecttype'
5f80c64f
JH
16096sendmail='$sendmail'
16097sh='$sh'
16098shar='$shar'
16099sharpbang='$sharpbang'
b4eb6b3d
JH
16100shmattype='$shmattype'
16101shortsize='$shortsize'
16102shrpenv='$shrpenv'
5f80c64f 16103shsharp='$shsharp'
b4eb6b3d
JH
16104sig_count='$sig_count'
16105sig_name='$sig_name'
16106sig_name_init='$sig_name_init'
16107sig_num='$sig_num'
16108sig_num_init='$sig_num_init'
16109signal_t='$signal_t'
16110sitearch='$sitearch'
16111sitearchexp='$sitearchexp'
16112sitebin='$sitebin'
16113sitebinexp='$sitebinexp'
16114sitelib='$sitelib'
16115sitelib_stem='$sitelib_stem'
16116sitelibexp='$sitelibexp'
16117siteprefix='$siteprefix'
16118siteprefixexp='$siteprefixexp'
16119sizesize='$sizesize'
16120sizetype='$sizetype'
5f80c64f
JH
16121sleep='$sleep'
16122smail='$smail'
5f80c64f 16123so='$so'
b4eb6b3d
JH
16124sockethdr='$sockethdr'
16125socketlib='$socketlib'
16126socksizetype='$socksizetype'
5f80c64f
JH
16127sort='$sort'
16128spackage='$spackage'
16129spitshell='$spitshell'
5f80c64f 16130src='$src'
b4eb6b3d
JH
16131ssizetype='$ssizetype'
16132startperl='$startperl'
5f80c64f 16133startsh='$startsh'
b4eb6b3d
JH
16134static_ext='$static_ext'
16135stdchar='$stdchar'
16136stdio_base='$stdio_base'
16137stdio_bufsiz='$stdio_bufsiz'
16138stdio_cnt='$stdio_cnt'
16139stdio_filbuf='$stdio_filbuf'
16140stdio_ptr='$stdio_ptr'
16141stdio_stream_array='$stdio_stream_array'
16142strings='$strings'
5f80c64f 16143submit='$submit'
b4eb6b3d
JH
16144subversion='$subversion'
16145sysman='$sysman'
5f80c64f
JH
16146tail='$tail'
16147tar='$tar'
16148tbl='$tbl'
16149tee='$tee'
16150test='$test'
b4eb6b3d
JH
16151timeincl='$timeincl'
16152timetype='$timetype'
5f80c64f
JH
16153touch='$touch'
16154tr='$tr'
16155trnl='$trnl'
16156troff='$troff'
b4eb6b3d
JH
16157u16size='$u16size'
16158u16type='$u16type'
16159u32size='$u32size'
16160u32type='$u32type'
16161u64size='$u64size'
16162u64type='$u64type'
16163u8size='$u8size'
16164u8type='$u8type'
16165uidformat='$uidformat'
16166uidsign='$uidsign'
16167uidsize='$uidsize'
16168uidtype='$uidtype'
5f80c64f
JH
16169uname='$uname'
16170uniq='$uniq'
b4eb6b3d
JH
16171uquadtype='$uquadtype'
16172use5005threads='$use5005threads'
16173use64bitall='$use64bitall'
16174use64bitint='$use64bitint'
5f80c64f 16175usedl='$usedl'
b4eb6b3d
JH
16176useithreads='$useithreads'
16177uselargefiles='$uselargefiles'
16178uselongdouble='$uselongdouble'
16179usemorebits='$usemorebits'
16180usemultiplicity='$usemultiplicity'
16181usemymalloc='$usemymalloc'
5f80c64f 16182usenm='$usenm'
b4eb6b3d
JH
16183useopcode='$useopcode'
16184useperlio='$useperlio'
16185useposix='$useposix'
16186usesfio='$usesfio'
16187useshrplib='$useshrplib'
29209bc5 16188usesocks='$usesocks'
b4eb6b3d
JH
16189usethreads='$usethreads'
16190usevendorprefix='$usevendorprefix'
16191usevfork='$usevfork'
5f80c64f
JH
16192usrinc='$usrinc'
16193uuname='$uuname'
b4eb6b3d
JH
16194uvXUformat='$uvXUformat'
16195uvoformat='$uvoformat'
16196uvsize='$uvsize'
16197uvtype='$uvtype'
16198uvuformat='$uvuformat'
16199uvxformat='$uvxformat'
16200vendorarch='$vendorarch'
16201vendorarchexp='$vendorarchexp'
16202vendorbin='$vendorbin'
16203vendorbinexp='$vendorbinexp'
16204vendorlib='$vendorlib'
16205vendorlib_stem='$vendorlib_stem'
16206vendorlibexp='$vendorlibexp'
16207vendorprefix='$vendorprefix'
16208vendorprefixexp='$vendorprefixexp'
16209version='$version'
d56c5707 16210versiononly='$versiononly'
5f80c64f 16211vi='$vi'
b4eb6b3d 16212voidflags='$voidflags'
5f80c64f 16213xlibpth='$xlibpth'
b4eb6b3d 16214xs_apiversion='$xs_apiversion'
5f80c64f
JH
16215zcat='$zcat'
16216zip='$zip'
16217EOT
16218
16219: Add in command line options if available
16220$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16221
16222: add special variables
16223$test -f $src/patchlevel.h && \
d00b958f 16224awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
2000072c 16225echo "CONFIGDOTSH=true" >>config.sh
5f80c64f
JH
16226
16227: propagate old symbols
16228if $test -f UU/config.sh; then
381aa1ff 16229 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 16230 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 16231 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
16232 set X `cat UU/oldsyms`
16233 shift
16234 case $# in
16235 0) ;;
16236 *)
16237 cat <<EOM
16238Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16239EOM
16240 echo "# Variables propagated from previous config.sh file." >>config.sh
16241 for sym in `cat UU/oldsyms`; do
16242 echo " Propagating $hint variable "'$'"$sym..."
16243 eval 'tmp="$'"${sym}"'"'
16244 echo "$tmp" | \
16245 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16246 done
16247 ;;
16248 esac
16249fi
16250
16251: Finish up by extracting the .SH files
16252case "$alldone" in
16253exit)
16254 $rm -rf UU
16255 echo "Done."
16256 exit 0
16257 ;;
16258cont)
16259 ;;
16260'')
16261 dflt=''
16262 nostick=true
16263 $cat <<EOM
16264
16265If you'd like to make any changes to the config.sh file before I begin
16266to configure things, do it as a shell escape now (e.g. !vi config.sh).
16267
16268EOM
16269 rp="Press return or use a shell escape to edit config.sh:"
16270 . UU/myread
16271 nostick=''
16272 case "$ans" in
16273 '') ;;
16274 *) : in case they cannot read
16275 sh 1>&4 -c "$ans";;
16276 esac
16277 ;;
16278esac
16279
16280: if this fails, just run all the .SH files by hand
16281. ./config.sh
16282
16283echo " "
16284exec 1>&4
16285. ./UU/extract
16286
16287if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16288 dflt=y
16289 case "$silent" in
16290 true) ;;
16291 *)
16292 $cat <<EOM
16293
16294Now you need to generate make dependencies by running "$make depend".
16295You might prefer to run it in background: "$make depend > makedepend.out &"
16296It can take a while, so you might not want to run it right now.
16297
16298EOM
16299 ;;
16300 esac
16301 rp="Run $make depend now?"
16302 . UU/myread
16303 case "$ans" in
16304 y*)
3d5d58b1 16305 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
16306 ;;
16307 *)
16308 echo "You must run '$make depend' then '$make'."
16309 ;;
16310 esac
16311elif test -f [Mm]akefile; then
16312 echo " "
16313 echo "Now you must run a $make."
16314else
16315 echo "Done."
16316fi
16317
16318if $test -f Policy.sh; then
16319 $cat <<EOM
16320
16321If you compile $package on a different machine or from a different object
16322directory, copy the Policy.sh file from this object directory to the
16323new one before you run Configure -- this will help you with most of
16324the policy defaults.
16325
16326EOM
16327fi
16328if $test -f config.msg; then
16329 echo "Hmm. I also noted the following information while running:"
16330 echo " "
16331 $cat config.msg >&4
16332 $rm -f config.msg
16333fi
16334$rm -f kit*isdone ark*isdone
16335$rm -rf UU
16336
16337: End of Configure
16338