This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Updated for 5.003_05.
[perl5.git] / Configure
... / ...
CommitLineData
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
17# comp.sources.misc so you may fetch it yourself from your nearest
18# archive site. Check with Archie if you don't know where that can be.)
19#
20
21# $Id: Head.U,v 3.0.1.8 1995/07/25 13:40:02 ram Exp $
22#
23# Generated on Fri Aug 30 11:30:25 EDT 1996 [metaconfig 3.0 PL60]
24
25cat >/tmp/c1$$ <<EOF
26ARGGGHHHH!!!!!
27
28SCO csh still thinks true is false. Write to SCO today and tell them that next
29year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
30
31(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
32we'd have to do is go in and swap the && and || tokens, wherever they are.)
33
34[End of diatribe. We now return you to your regularly scheduled programming...]
35EOF
36cat >/tmp/c2$$ <<EOF
37
38OOPS! You naughty creature! You didn't run Configure with sh!
39I will attempt to remedy the situation by running sh for you...
40EOF
41
42true || cat /tmp/c1$$ /tmp/c2$$
43true || exec sh $0 $argv:q
44
45(exit $?0) || cat /tmp/c2$$
46(exit $?0) || exec sh $0 $argv:q
47rm -f /tmp/c1$$ /tmp/c2$$
48
49: compute my invocation name
50me=$0
51case "$0" in
52*/*)
53 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
54 test "$me" || me=$0
55 ;;
56esac
57
58: Proper PATH separator
59p_=:
60: On OS/2 this directory should exist if this is not floppy only system :-]
61if test -d c:/.; then
62 p_=\;
63 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
64 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
65fi
66
67: Proper PATH setting
68paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
69paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
70paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
71paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
72paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
73paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
74paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
75paths="$paths /sbin /usr/sbin /usr/libexec"
76
77for p in $paths
78do
79 case "$p_$PATH$p_" in
80 *$p_$p$p_*) ;;
81 *) test -d $p && PATH=$PATH$p_$p ;;
82 esac
83done
84
85PATH=.$p_$PATH
86export PATH
87
88: Sanity checks
89if test ! -t 0; then
90 echo "Say 'sh $me', not 'sh <$me'"
91 exit 1
92fi
93
94: On HP-UX, large Configure scripts may exercise a bug in /bin/sh
95if test -f /hp-ux -a -f /bin/ksh; then
96 if (PATH=.; alias -x) >/dev/null 2>&1; then
97 : already under /bin/ksh
98 else
99 cat <<'EOM'
100(Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.)
101EOM
102 unset ENV
103 exec /bin/ksh $0 "$@"
104 fi
105else
106 : Warn them if they use ksh on other systems
107 (PATH=.; alias -x) >/dev/null 2>&1 && \
108 cat <<EOM
109(I see you are using the Korn shell. Some ksh's blow up on $me,
110especially on older exotic systems. If yours does, try the Bourne
111shell instead.)
112EOM
113fi
114
115: Configure runs within the UU subdirectory
116test -d UU || mkdir UU
117cd UU && rm -f ./*
118
119dynamic_ext=''
120extensions=''
121known_extensions=''
122static_ext=''
123useopcode=''
124useposix=''
125d_bsd=''
126d_eunice=''
127d_xenix=''
128eunicefix=''
129Mcc=''
130awk=''
131bash=''
132bison=''
133byacc=''
134cat=''
135chgrp=''
136chmod=''
137chown=''
138comm=''
139compress=''
140cp=''
141cpio=''
142cpp=''
143csh=''
144date=''
145echo=''
146egrep=''
147emacs=''
148expr=''
149find=''
150flex=''
151gcc=''
152grep=''
153gzip=''
154inews=''
155ksh=''
156less=''
157line=''
158lint=''
159ln=''
160lp=''
161lpr=''
162ls=''
163mail=''
164mailx=''
165mkdir=''
166more=''
167mv=''
168nroff=''
169perl=''
170pg=''
171pmake=''
172pr=''
173rm=''
174rmail=''
175sed=''
176sendmail=''
177shar=''
178sleep=''
179smail=''
180sort=''
181submit=''
182tail=''
183tar=''
184tbl=''
185test=''
186touch=''
187tr=''
188troff=''
189uname=''
190uniq=''
191uuname=''
192vi=''
193zcat=''
194zip=''
195full_sed=''
196libswanted=''
197hint=''
198myuname=''
199osname=''
200osvers=''
201Author=''
202Date=''
203Header=''
204Id=''
205Locker=''
206Log=''
207RCSfile=''
208Revision=''
209Source=''
210State=''
211ar=''
212archobjs=''
213exe_ext=''
214firstmakefile=''
215lib_ext=''
216obj_ext=''
217path_sep=''
218afs=''
219alignbytes=''
220archlib=''
221archlibexp=''
222d_archlib=''
223installarchlib=''
224archname=''
225myarchname=''
226baserev=''
227bin=''
228binexp=''
229installbin=''
230byteorder=''
231cc=''
232gccversion=''
233ccflags=''
234cppflags=''
235ldflags=''
236lkflags=''
237locincpth=''
238optimize=''
239cf_email=''
240cf_by=''
241cf_time=''
242contains=''
243cpp_stuff=''
244cpplast=''
245cppminus=''
246cpprun=''
247cppstdin=''
248d_access=''
249d_alarm=''
250d_attribut=''
251d_bcmp=''
252d_bcopy=''
253d_bzero=''
254d_casti32=''
255castflags=''
256d_castneg=''
257d_chown=''
258d_chroot=''
259d_chsize=''
260d_closedir=''
261d_void_closedir=''
262d_const=''
263cryptlib=''
264d_crypt=''
265d_csh=''
266full_csh=''
267d_cuserid=''
268d_dbl_dig=''
269d_difftime=''
270d_dlerror=''
271d_dlopen=''
272d_dlsymun=''
273d_dosuid=''
274d_suidsafe=''
275d_dup2=''
276d_fchmod=''
277d_fchown=''
278d_fcntl=''
279d_fd_macros=''
280d_fd_set=''
281d_fds_bits=''
282d_fgetpos=''
283d_flexfnam=''
284d_flock=''
285d_fork=''
286d_fsetpos=''
287d_Gconvert=''
288d_getgrps=''
289d_gethent=''
290aphostname=''
291d_gethname=''
292d_phostname=''
293d_uname=''
294d_getlogin=''
295d_getpgrp2=''
296d_getpgrp=''
297d_getppid=''
298d_getprior=''
299d_htonl=''
300d_isascii=''
301d_killpg=''
302d_link=''
303d_locconv=''
304d_lockf=''
305d_lstat=''
306d_mblen=''
307d_mbstowcs=''
308d_mbtowc=''
309d_memcmp=''
310d_memcpy=''
311d_memmove=''
312d_memset=''
313d_mkdir=''
314d_mkfifo=''
315d_mktime=''
316d_msg=''
317d_msgctl=''
318d_msgget=''
319d_msgrcv=''
320d_msgsnd=''
321d_nice=''
322d_open3=''
323d_fpathconf=''
324d_pathconf=''
325d_pause=''
326d_pipe=''
327d_poll=''
328d_portable=''
329d_readdir=''
330d_rewinddir=''
331d_seekdir=''
332d_telldir=''
333d_readlink=''
334d_rename=''
335d_rmdir=''
336d_safebcpy=''
337d_safemcpy=''
338d_select=''
339d_sem=''
340d_semctl=''
341d_semget=''
342d_semop=''
343d_setegid=''
344d_seteuid=''
345d_setlinebuf=''
346d_setlocale=''
347d_setpgid=''
348d_setpgrp2=''
349d_bsdpgrp=''
350d_setpgrp=''
351d_setprior=''
352d_setregid=''
353d_setresgid=''
354d_setresuid=''
355d_setreuid=''
356d_setrgid=''
357d_setruid=''
358d_setsid=''
359d_sfio=''
360usesfio=''
361d_shm=''
362d_shmat=''
363d_shmatprototype=''
364shmattype=''
365d_shmctl=''
366d_shmdt=''
367d_shmget=''
368d_sigaction=''
369d_sigsetjmp=''
370d_oldsock=''
371d_socket=''
372d_sockpair=''
373sockethdr=''
374socketlib=''
375d_statblks=''
376d_stdio_cnt_lval=''
377d_stdio_ptr_lval=''
378d_stdiobase=''
379d_stdstdio=''
380stdio_base=''
381stdio_bufsiz=''
382stdio_cnt=''
383stdio_filbuf=''
384stdio_ptr=''
385d_index=''
386d_strchr=''
387d_strcoll=''
388d_strctcpy=''
389d_strerrm=''
390d_strerror=''
391d_sysernlst=''
392d_syserrlst=''
393d_strxfrm=''
394d_symlink=''
395d_syscall=''
396d_sysconf=''
397d_system=''
398d_tcgetpgrp=''
399d_tcsetpgrp=''
400d_time=''
401timetype=''
402clocktype=''
403d_times=''
404d_truncate=''
405d_tzname=''
406d_umask=''
407d_vfork=''
408usevfork=''
409d_voidsig=''
410signal_t=''
411d_volatile=''
412d_charvspr=''
413d_vprintf=''
414d_wait4=''
415d_waitpid=''
416d_wcstombs=''
417d_wctomb=''
418dlext=''
419cccdlflags=''
420ccdlflags=''
421dlsrc=''
422ld=''
423lddlflags=''
424usedl=''
425fpostype=''
426gidtype=''
427groupstype=''
428h_fcntl=''
429h_sysfile=''
430db_hashtype=''
431db_prefixtype=''
432i_db=''
433i_dbm=''
434i_rpcsvcdbm=''
435d_dirnamlen=''
436direntrytype=''
437i_dirent=''
438i_dld=''
439i_dlfcn=''
440i_fcntl=''
441i_float=''
442i_gdbm=''
443i_grp=''
444i_limits=''
445i_locale=''
446i_malloc=''
447i_math=''
448i_memory=''
449i_ndbm=''
450i_neterrno=''
451i_niin=''
452i_sysin=''
453d_pwage=''
454d_pwchange=''
455d_pwclass=''
456d_pwcomment=''
457d_pwexpire=''
458d_pwquota=''
459i_pwd=''
460i_sfio=''
461i_stddef=''
462i_stdlib=''
463i_string=''
464strings=''
465i_sysdir=''
466i_sysfile=''
467d_voidtty=''
468i_bsdioctl=''
469i_sysfilio=''
470i_sysioctl=''
471i_syssockio=''
472i_sysndir=''
473i_sysparam=''
474i_sysresrc=''
475i_sysselct=''
476i_sysstat=''
477i_systimes=''
478i_systypes=''
479i_sysun=''
480i_syswait=''
481i_sgtty=''
482i_termio=''
483i_termios=''
484i_systime=''
485i_systimek=''
486i_time=''
487timeincl=''
488i_unistd=''
489i_utime=''
490i_values=''
491i_stdarg=''
492i_varargs=''
493i_varhdr=''
494i_vfork=''
495intsize=''
496libc=''
497libperl=''
498useshrplib=''
499glibpth=''
500libpth=''
501loclibpth=''
502plibpth=''
503xlibpth=''
504libs=''
505lns=''
506lseektype=''
507make=''
508make_set_make=''
509d_mymalloc=''
510freetype=''
511mallocobj=''
512mallocsrc=''
513malloctype=''
514usemymalloc=''
515installman1dir=''
516man1dir=''
517man1direxp=''
518man1ext=''
519installman3dir=''
520man3dir=''
521man3direxp=''
522man3ext=''
523huge=''
524large=''
525medium=''
526models=''
527small=''
528split=''
529modetype=''
530mydomain=''
531myhostname=''
532phostname=''
533c=''
534n=''
535d_eofnblk=''
536eagain=''
537o_nonblock=''
538rd_nodata=''
539groupcat=''
540hostcat=''
541passcat=''
542d_oldarchlib=''
543oldarchlib=''
544oldarchlibexp=''
545orderlib=''
546ranlib=''
547package=''
548spackage=''
549pager=''
550patchlevel=''
551subversion=''
552perladmin=''
553perlpath=''
554prefix=''
555prefixexp=''
556installprivlib=''
557privlib=''
558privlibexp=''
559prototype=''
560randbits=''
561installscript=''
562scriptdir=''
563scriptdirexp=''
564selecttype=''
565sh=''
566sig_name=''
567sig_num=''
568installsitearch=''
569sitearch=''
570sitearchexp=''
571installsitelib=''
572sitelib=''
573sitelibexp=''
574sizetype=''
575so=''
576sharpbang=''
577shsharp=''
578spitshell=''
579ssizetype=''
580startperl=''
581startsh=''
582stdchar=''
583sysman=''
584uidtype=''
585nm_opt=''
586nm_so_opt=''
587runnm=''
588usenm=''
589useperlio=''
590incpath=''
591mips=''
592mips_type=''
593usrinc=''
594defvoidused=''
595voidflags=''
596CONFIG=''
597
598define='define'
599undef='undef'
600smallmach='pdp11 i8086 z8000 i80286 iAPX286'
601rmlist=''
602
603: We must find out about Eunice early
604eunicefix=':'
605if test -f /etc/unixtovms; then
606 eunicefix=/etc/unixtovms
607fi
608if test -f /etc/unixtovms.exe; then
609 eunicefix=/etc/unixtovms.exe
610fi
611
612: list of known cpp symbols, sorted alphabetically
613al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
614al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
615al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
616al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
617al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
618al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
619al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
620al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
621al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
622al="$al VMS Xenix286"
623al="$al _AIX _AIX32 _AIX370 _AM29000 _COFF _CRAY _CX_UX _EPI"
624al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET"
625al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
626al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
627al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
628al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
629al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
630al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
631al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
632al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
633al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
634al="$al __SVR4_2__ __UMAXV__"
635al="$al ____386BSD____ __alpha __alpha__ __amiga"
636al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
637al="$al __host_mips__"
638al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
639al="$al __hp9000s500 __hp9000s700 __hp9000s800"
640al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
641al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
642al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
643al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
644al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
645al="$al __mc88100 __mc88100__ __mips __mips__"
646al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
647al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
648al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
649al="$al _host_mips _mips _unix"
650al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
651al="$al apollo ardent att386 att3b"
652al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
653al="$al cadmus clipper concurrent convex cray ctix"
654al="$al dmert encore gcos gcx gimpel gould"
655al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
656al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
657al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
658al="$al i186 i286 i386 i486 i8086"
659al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
660al="$al ksr1 linux luna luna88k m68k m88100 m88k"
661al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
662al="$al mc68040 mc68060 mc68k mc68k32 mc700"
663al="$al mc88000 mc88100 merlin mert mips mvs n16"
664al="$al ncl_el ncl_mr"
665al="$al news1500 news1700 news1800 news1900 news3700"
666al="$al news700 news800 news900 ns16000 ns32000"
667al="$al ns32016 ns32332 ns32k nsc32000 os osf"
668al="$al parisc pc532 pdp11 plexus posix pyr"
669al="$al riscix riscos scs sequent sgi sinix sony sony_news"
670al="$al sonyrisc sparc sparclite spectrum stardent stratos"
671al="$al sun sun3 sun386 svr4 sysV68 sysV88"
672al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
673al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
674al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
675al="$al xenix z8000"
676
677groupstype=''
678i_whoami=''
679: default library list
680libswanted=''
681: set useposix=false in your hint file to disable the POSIX extension.
682useposix=true
683: set useopcode=false in your hint file to disable the Opcode extension.
684useopcode=true
685: Define several unixisms. These can be used in hint files.
686exe_ext=''
687: Extra object files, if any, needed on this platform.
688archobjs=''
689: Possible local include directories to search.
690: Set locincpth to "" in a hint file to defeat local include searches.
691locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
692locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
693:
694: no include file wanted by default
695inclwanted=''
696
697: change the next line if compiling for Xenix/286 on Xenix/386
698xlibpth='/usr/lib/386 /lib/386'
699
700: Possible local library directories to search.
701loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
702loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
703
704: general looking path for locating libraries
705glibpth="/lib/pa1.1 /usr/shlib /usr/lib/large /lib /usr/lib"
706glibpth="$glibpth $xlibpth /lib/large /usr/lib/small /lib/small"
707glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/shlib"
708
709: Private path used by Configure to find libraries. Its value
710: is prepended to libpth. This variable takes care of special
711: machines, like the mips. Usually, it should be empty.
712plibpth=''
713
714: full support for void wanted by default
715defvoidused=15
716
717: List of libraries we want.
718libswanted='sfio net socket inet nsl nm ndbm gdbm dbm db malloc dl'
719libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt"
720libswanted="$libswanted ucb bsd BSD PW x"
721: We probably want to search /usr/shlib before most other libraries.
722: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
723glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
724glibpth="/usr/shlib $glibpth"
725: Do not use vfork unless overridden by a hint file.
726usevfork=false
727
728: Find the basic shell for Bourne shell scripts
729case "$sh" in
730'')
731 : SYSTYPE is for some older MIPS systems.
732 : I do not know if it is still needed.
733 case "$SYSTYPE" in
734 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
735 *) xxx='/bin/sh';;
736 esac
737 if test -f "$xxx"; then
738 sh="$xxx"
739 else
740 : Build up a list and do a single loop so we can 'break' out.
741 pth=`echo $PATH | sed -e "s/$p_/ /g"`
742 for xxx in sh bash ksh pdksh ash; do
743 for p in $pth; do
744 try="$try ${p}/${xxx}"
745 done
746 done
747 for xxx in $try; do
748 if test -f "$xxx"; then
749 sh="$xxx";
750 echo "Your Bourne shell appears to be in $sh."
751 break
752 elif test -f "$xxx.exe"; then
753 sh="$xxx";
754 echo "Hmm. Your Bourne shell appears to be in $sh."
755 break
756 fi
757 done
758 fi
759 ;;
760esac
761
762case "$sh" in
763'') cat <<EOM >&2
764$me: Fatal Error: I can't find a Bourne Shell anywhere.
765Usually it's in /bin/sh. How did you even get this far?
766Please contact me (Andy Dougherty) at doughera@lafcol.lafayette.edu and
767we'll try to straigten this all out.
768EOM
769 exit 1
770 ;;
771esac
772
773: see if sh knows # comments
774if `$sh -c '#' >/dev/null 2>&1`; then
775 shsharp=true
776 spitshell=cat
777 echo " "
778 xcat=/bin/cat
779 test -f $xcat || xcat=/usr/bin/cat
780 echo "#!$xcat" >try
781 $eunicefix try
782 chmod +x try
783 ./try > today
784 if test -s today; then
785 sharpbang='#!'
786 else
787 echo "#! $xcat" > try
788 $eunicefix try
789 chmod +x try
790 ./try > today
791 if test -s today; then
792 sharpbang='#! '
793 else
794 echo "Okay, let's see if #! works on this system..."
795 echo "It's just a comment."
796 sharpbang=': use '
797 fi
798 fi
799else
800 echo "Your $sh doesn't grok # comments--I will strip them later on."
801 shsharp=false
802 cd ..
803 echo "exec grep -v '^[ ]*#'" >spitshell
804 chmod +x spitshell
805 $eunicefix spitshell
806 spitshell=`pwd`/spitshell
807 cd UU
808 echo "I presume that if # doesn't work, #! won't work either!"
809 sharpbang=': use '
810fi
811rm -f try today
812
813: figure out how to guarantee sh startup
814case "$startsh" in
815'') startsh=${sharpbang}${sh} ;;
816*)
817esac
818cat >try <<EOSS
819$startsh
820set abc
821test "$?abc" != 1
822EOSS
823
824chmod +x try
825$eunicefix try
826if ./try; then
827 : echo "Yup, it does."
828else
829 echo "Hmm. '$startsh' didn't work."
830 echo "You may have to fix up the shell scripts to make sure sh runs them."
831fi
832rm -f try
833
834: script used to extract .SH files with variable substitutions
835cat >extract <<EOS
836$startsh
837EOS
838cat >>extract <<'EOS'
839CONFIG=true
840echo "Doing variable substitutions on .SH files..."
841if test -f MANIFEST; then
842 shlist=`awk '{print $1}' <MANIFEST | grep '\.SH'`
843 : Pick up possible extension manifests.
844 for dir in ext/* ; do
845 if test -f $dir/MANIFEST; then
846 xxx=`awk '{print $1}' < $dir/MANIFEST |
847 sed -n "/\.SH$/ s@^@$dir/@p"`
848 shlist="$shlist $xxx"
849 fi
850 done
851 set x $shlist
852else
853 echo "(Looking for .SH files under the current directory.)"
854 set x `find . -name "*.SH" -print`
855fi
856shift
857case $# in
8580) set x *.SH; shift;;
859esac
860if test ! -f $1; then
861 shift
862fi
863for file in $*; do
864 case "$file" in
865 */*)
866 dir=`expr X$file : 'X\(.*\)/'`
867 file=`expr X$file : 'X.*/\(.*\)'`
868 (cd $dir && . ./$file)
869 ;;
870 *)
871 . ./$file
872 ;;
873 esac
874done
875if test -f config_h.SH; then
876 if test ! -f config.h; then
877 : oops, they left it out of MANIFEST, probably, so do it anyway.
878 . ./config_h.SH
879 fi
880fi
881EOS
882
883: produce awk script to parse command line options
884cat >options.awk <<'EOF'
885BEGIN {
886 optstr = "dD:eEf:hKOrsSU:V"; # getopt-style specification
887
888 len = length(optstr);
889 for (i = 1; i <= len; i++) {
890 c = substr(optstr, i, 1);
891 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
892 if (a == ":") {
893 arg[c] = 1;
894 i++;
895 }
896 opt[c] = 1;
897 }
898}
899{
900 expect = 0;
901 str = $0;
902 if (substr(str, 1, 1) != "-") {
903 printf("'%s'\n", str);
904 next;
905 }
906 len = length($0);
907 for (i = 2; i <= len; i++) {
908 c = substr(str, i, 1);
909 if (!opt[c]) {
910 printf("-%s\n", substr(str, i));
911 next;
912 }
913 printf("-%s\n", c);
914 if (arg[c]) {
915 if (i < len)
916 printf("'%s'\n", substr(str, i + 1));
917 else
918 expect = 1;
919 next;
920 }
921 }
922}
923END {
924 if (expect)
925 print "?";
926}
927EOF
928
929: process the command line options
930set X `for arg in "$@"; do echo "X$arg"; done |
931 sed -e s/X// | awk -f options.awk`
932eval "set $*"
933shift
934rm -f options.awk
935
936: set up default values
937fastread=''
938reuseval=false
939config_sh=''
940alldone=''
941error=''
942silent=''
943extractsh=''
944override=''
945knowitall=''
946rm -f optdef.sh
947
948: option parsing
949while test $# -gt 0; do
950 case "$1" in
951 -d) shift; fastread=yes;;
952 -e) shift; alldone=cont;;
953 -f)
954 shift
955 cd ..
956 if test -r "$1"; then
957 config_sh="$1"
958 else
959 echo "$me: cannot read config file $1." >&2
960 error=true
961 fi
962 cd UU
963 shift;;
964 -h) shift; error=true;;
965 -r) shift; reuseval=true;;
966 -s) shift; silent=true;;
967 -E) shift; alldone=exit;;
968 -K) shift; knowitall=true;;
969 -O) shift; override=true;;
970 -S) shift; extractsh=true;;
971 -D)
972 shift
973 case "$1" in
974 *=)
975 echo "$me: use '-U symbol=', not '-D symbol='." >&2
976 echo "$me: ignoring -D $1" >&2
977 ;;
978 *=*) echo "$1" | \
979 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
980 *) echo "$1='define'" >> optdef.sh;;
981 esac
982 shift
983 ;;
984 -U)
985 shift
986 case "$1" in
987 *=) echo "$1" >> optdef.sh;;
988 *=*)
989 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
990 echo "$me: ignoring -U $1" >&2
991 ;;
992 *) echo "$1='undef'" >> optdef.sh;;
993 esac
994 shift
995 ;;
996 -V) echo "$me generated by metaconfig 3.0 PL60." >&2
997 exit 0;;
998 --) break;;
999 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1000 *) break;;
1001 esac
1002done
1003
1004case "$error" in
1005true)
1006 cat >&2 <<EOM
1007Usage: $me [-dehrEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1008 [-U symbol] [-U symbol=]
1009 -d : use defaults for all answers.
1010 -e : go on without questioning past the production of config.sh.
1011 -f : specify an alternate default configuration file.
1012 -h : print this help message and exit (with an error status).
1013 -r : reuse C symbols value if possible (skips costly nm extraction).
1014 -s : silent mode, only echoes questions and essential information.
1015 -D : define symbol to have some value:
1016 -D symbol symbol gets the value 'define'
1017 -D symbol=value symbol gets the value 'value'
1018 -E : stop at the end of questions, after having produced config.sh.
1019 -K : do not use unless you know what you are doing.
1020 -O : let -D and -U override definitions from loaded configuration file.
1021 -S : perform variable substitutions on all .SH files (can mix with -f)
1022 -U : undefine symbol:
1023 -U symbol symbol gets the value 'undef'
1024 -U symbol= symbol gets completely empty
1025 -V : print version number and exit (with a zero status).
1026EOM
1027 exit 1
1028 ;;
1029esac
1030
1031exec 4>&1
1032case "$silent" in
1033true) exec 1>/dev/null;;
1034esac
1035
1036: run the defines and the undefines, if any, but leave the file out there...
1037touch optdef.sh
1038. ./optdef.sh
1039
1040case "$extractsh" in
1041true)
1042 case "$config_sh" in
1043 '') config_sh='config.sh'; config='./config.sh';;
1044 /*) config="$config_sh";;
1045 *) config="./$config_sh";;
1046 esac
1047 echo " "
1048 echo "Fetching answers from $config_sh..."
1049 cd ..
1050 . $config
1051 test "$override" && . ./optdef.sh
1052 echo " "
1053 . ./UU/extract
1054 rm -rf UU
1055 echo "Done."
1056 exit 0
1057 ;;
1058esac
1059
1060: set package name
1061package=perl5
1062first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1063last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1064case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1065ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1066*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1067esac
1068
1069: Eunice requires " " instead of "", can you believe it
1070echo " "
1071: Here we go...
1072echo "Beginning of configuration questions for $package."
1073
1074trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1075
1076: Some greps do not return status, grrr.
1077echo "grimblepritz" >grimble
1078if grep blurfldyick grimble >/dev/null 2>&1 ; then
1079 contains=contains
1080elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1081 contains=grep
1082else
1083 contains=contains
1084fi
1085rm -f grimble
1086: the following should work in any shell
1087case "$contains" in
1088contains*)
1089 echo " "
1090 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1091 cat >contains <<'EOSS'
1092grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1093EOSS
1094chmod +x contains
1095esac
1096
1097: first determine how to suppress newline on echo command
1098echo " "
1099echo "Checking echo to see how to suppress newlines..."
1100(echo "hi there\c" ; echo " ") >.echotmp
1101if $contains c .echotmp >/dev/null 2>&1 ; then
1102 echo "...using -n."
1103 n='-n'
1104 c=''
1105else
1106 cat <<'EOM'
1107...using \c
1108EOM
1109 n=''
1110 c='\c'
1111fi
1112echo $n "The star should be here-->$c"
1113echo '*'
1114rm -f .echotmp
1115
1116: Now test for existence of everything in MANIFEST
1117echo " "
1118if test -f ../MANIFEST; then
1119 echo "First let's make sure your kit is complete. Checking..." >&4
1120 awk '$1 !~ /PACK[A-Z]+/ {print $1}' ../MANIFEST | split -50
1121 rm -f missing
1122 for filelist in x??; do
1123 (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing)
1124 done
1125 if test -s missing; then
1126 cat missing >&4
1127 cat >&4 <<'EOM'
1128
1129THIS PACKAGE SEEMS TO BE INCOMPLETE.
1130
1131You have the option of continuing the configuration process, despite the
1132distinct possibility that your kit is damaged, by typing 'y'es. If you
1133do, don't blame me if something goes wrong. I advise you to type 'n'o
1134and contact the author (doughera@lafcol.lafayette.edu).
1135
1136EOM
1137 echo $n "Continue? [n] $c" >&4
1138 read ans
1139 case "$ans" in
1140 y*)
1141 echo "Continuing..." >&4
1142 rm -f missing
1143 ;;
1144 *)
1145 echo "ABORTING..." >&4
1146 kill $$
1147 ;;
1148 esac
1149 else
1150 echo "Looks good..." >&4
1151 fi
1152else
1153 echo "There is no MANIFEST file. I hope your kit is complete !"
1154fi
1155rm -f missing x??
1156
1157: compute the number of columns on the terminal for proper question formatting
1158case "$COLUMNS" in
1159'') COLUMNS='80';;
1160esac
1161
1162: set up the echo used in my read
1163myecho="case \"\$xxxm\" in
1164'') echo $n \"\$rp $c\" >&4;;
1165*) case \"\$rp\" in
1166 '') echo $n \"[\$xxxm] $c\";;
1167 *)
1168 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1169 echo \"\$rp\" >&4
1170 echo $n \"[\$xxxm] $c\" >&4
1171 else
1172 echo $n \"\$rp [\$xxxm] $c\" >&4
1173 fi
1174 ;;
1175 esac;;
1176esac"
1177
1178: now set up to do reads with possible shell escape and default assignment
1179cat <<EOSC >myread
1180xxxm=\$dflt
1181$myecho
1182ans='!'
1183case "\$fastread" in
1184yes) case "\$dflt" in
1185 '') ;;
1186 *) ans='';
1187 case "\$silent-\$rp" in
1188 true-) ;;
1189 *) echo " " >&4;;
1190 esac;;
1191 esac;;
1192*) case "\$silent" in
1193 true) case "\$rp" in
1194 '') ans='';;
1195 esac;;
1196 esac;;
1197esac
1198while expr "X\$ans" : "X!" >/dev/null; do
1199 read answ
1200 set x \$xxxm
1201 shift
1202 aok=''; eval "ans=\"\$answ\"" && aok=y
1203 case "\$answ" in
1204 "\$ans")
1205 case "\$ans" in
1206 \\&*)
1207 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1208 shift
1209 case "\$1" in
1210 -d)
1211 fastread=yes
1212 echo "(OK, I'll run with -d after this question.)" >&4
1213 ;;
1214 -*)
1215 echo "*** Sorry, \$1 not supported yet." >&4
1216 ;;
1217 esac
1218 $myecho
1219 ans=!
1220 ;;
1221 "!")
1222 sh 1>&4
1223 echo " "
1224 $myecho
1225 ;;
1226 !*)
1227 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1228 shift
1229 sh 1>&4 -c "\$*"
1230 echo " "
1231 $myecho
1232 ;;
1233 esac;;
1234 *)
1235 case "\$aok" in
1236 y)
1237 echo "*** Substitution done -- please confirm."
1238 xxxm="\$ans"
1239 ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
1240 xxxm="\$ans"
1241 ans=!
1242 ;;
1243 *)
1244 echo "*** Error -- try again."
1245 ans=!
1246 ;;
1247 esac
1248 $myecho
1249 ;;
1250 esac
1251 case "\$ans\$xxxm\$nostick" in
1252 '')
1253 ans=!
1254 $myecho
1255 ;;
1256 esac
1257done
1258case "\$ans" in
1259'') ans="\$xxxm";;
1260esac
1261EOSC
1262
1263: create .config dir to save info across Configure sessions
1264test -d ../.config || mkdir ../.config
1265cat >../.config/README <<EOF
1266This directory created by Configure to save information that should
1267persist across sessions.
1268
1269You may safely delete it if you wish.
1270EOF
1271
1272: general instructions
1273needman=true
1274firsttime=true
1275user=`(logname) 2>/dev/null`
1276case "$user" in "")
1277 user=`whoami 2>&1` ;;
1278esac
1279if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1280 firsttime=false
1281 echo " "
1282 rp='Would you like to see the instructions?'
1283 dflt=n
1284 . ./myread
1285 case "$ans" in
1286 [yY]*) ;;
1287 *) needman=false;;
1288 esac
1289fi
1290if $needman; then
1291 cat <<EOH
1292
1293This installation shell script will examine your system and ask you questions
1294to determine how the perl5 package should be installed. If you get
1295stuck on a question, you may use a ! shell escape to start a subshell or
1296execute a command. Many of the questions will have default answers in square
1297brackets; typing carriage return will give you the default.
1298
1299On some of the questions which ask for file or directory names you are allowed
1300to use the ~name construct to specify the login directory belonging to "name",
1301even if you don't have a shell which knows about that. Questions where this is
1302allowed will be marked "(~name ok)".
1303
1304EOH
1305 rp=''
1306 dflt='Type carriage return to continue'
1307 . ./myread
1308 cat <<'EOH'
1309
1310The prompter used in this script allows you to use shell variables and
1311backticks in your answers. You may use $1, $2, etc... to refer to the words
1312in the default answer, as if the default line was a set of arguments given to a
1313script shell. This means you may also use $* to repeat the whole default line,
1314so you do not have to re-type everything to add something to the default.
1315
1316Everytime there is a substitution, you will have to confirm. If there is an
1317error (e.g. an unmatched backtick), the default answer will remain unchanged
1318and you will be prompted again.
1319
1320If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1321the questions and use the computed defaults (or the previous answers if there
1322was already a config.sh file). Type 'Configure -h' for a list of options.
1323You may also start interactively and then answer '& -d' at any prompt to turn
1324on the non-interactive behaviour for the remaining of the execution.
1325
1326EOH
1327 . ./myread
1328 cat <<EOH
1329
1330Much effort has been expended to ensure that this shell script will run on any
1331Unix system. If despite that it blows up on yours, your best bet is to edit
1332Configure and run it again. If you can't run Configure for some reason,
1333you'll have to generate a config.sh file by hand. Whatever problems you
1334have, let me (doughera@lafcol.lafayette.edu) know how I blew it.
1335
1336This installation script affects things in two ways:
1337
13381) it may do direct variable substitutions on some of the files included
1339 in this kit.
13402) it builds a config.h file for inclusion in C programs. You may edit
1341 any of these files as the need arises after running this script.
1342
1343If you make a mistake on a question, there is no easy way to back up to it
1344currently. The easiest thing to do is to edit config.sh and rerun all the SH
1345files. Configure will offer to let you do this before it runs the SH files.
1346
1347EOH
1348 dflt='Type carriage return to continue'
1349 . ./myread
1350 case "$firsttime" in
1351 true) echo $user >>../.config/instruct;;
1352 esac
1353fi
1354
1355: find out where common programs are
1356echo " "
1357echo "Locating common programs..." >&4
1358cat <<EOSC >loc
1359$startsh
1360case \$# in
13610) exit 1;;
1362esac
1363thing=\$1
1364shift
1365dflt=\$1
1366shift
1367for dir in \$*; do
1368 case "\$thing" in
1369 .)
1370 if test -d \$dir/\$thing; then
1371 echo \$dir
1372 exit 0
1373 fi
1374 ;;
1375 *)
1376 for thisthing in \$dir/\$thing; do
1377 : just loop through to pick last item
1378 done
1379 if test -f \$thisthing; then
1380 echo \$thisthing
1381 exit 0
1382 elif test -f \$dir/\$thing.exe; then
1383 : on Eunice apparently
1384 echo \$dir/\$thing
1385 exit 0
1386 fi
1387 ;;
1388 esac
1389done
1390echo \$dflt
1391exit 1
1392EOSC
1393chmod +x loc
1394$eunicefix loc
1395loclist="
1396awk
1397cat
1398comm
1399cp
1400echo
1401expr
1402find
1403grep
1404ls
1405mkdir
1406rm
1407sed
1408sort
1409touch
1410tr
1411uniq
1412"
1413trylist="
1414Mcc
1415byacc
1416cpp
1417csh
1418date
1419egrep
1420gzip
1421less
1422line
1423ln
1424more
1425nroff
1426perl
1427pg
1428sendmail
1429test
1430uname
1431zip
1432"
1433pth=`echo $PATH | sed -e "s/$p_/ /g"`
1434pth="$pth /lib /usr/lib"
1435for file in $loclist; do
1436 xxx=`./loc $file $file $pth`
1437 eval $file=$xxx
1438 eval _$file=$xxx
1439 case "$xxx" in
1440 /*)
1441 echo $file is in $xxx.
1442 ;;
1443 ?:[\\/]*)
1444 echo $file is in $xxx.
1445 ;;
1446 *)
1447 echo "I don't know where '$file' is, and my life depends on it." >&4
1448 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1449 exit 1
1450 ;;
1451 esac
1452done
1453echo " "
1454echo "Don't worry if any of the following aren't found..."
1455say=offhand
1456for file in $trylist; do
1457 xxx=`./loc $file $file $pth`
1458 eval $file=$xxx
1459 eval _$file=$xxx
1460 case "$xxx" in
1461 /*)
1462 echo $file is in $xxx.
1463 ;;
1464 ?:[\\/]*)
1465 echo $file is in $xxx.
1466 ;;
1467 *)
1468 echo "I don't see $file out there, $say."
1469 say=either
1470 ;;
1471 esac
1472done
1473case "$egrep" in
1474egrep)
1475 echo "Substituting grep for egrep."
1476 egrep=$grep
1477 ;;
1478esac
1479case "$ln" in
1480ln)
1481 echo "Substituting cp for ln."
1482 ln=$cp
1483 ;;
1484esac
1485case "$test" in
1486test)
1487 echo "Hopefully test is built into your sh."
1488 ;;
1489*)
1490 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1491 echo "Using the test built into your sh."
1492 test=test
1493 _test=test
1494 fi
1495 ;;
1496esac
1497case "$echo" in
1498echo)
1499 echo "Hopefully echo is built into your sh."
1500 ;;
1501'') ;;
1502*)
1503 echo " "
1504echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1505 $echo $n "hi there$c" >foo1
1506 echo $n "hi there$c" >foo2
1507 if cmp foo1 foo2 >/dev/null 2>&1; then
1508 echo "They are compatible. In fact, they may be identical."
1509 else
1510 case "$n" in
1511 '-n') n='' c='\c';;
1512 *) n='-n' c='';;
1513 esac
1514 cat <<FOO
1515They are not compatible! You are probably running ksh on a non-USG system.
1516I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1517have echo built in and we may have to run some Bourne shell scripts. That
1518means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
1519
1520FOO
1521 $echo $n "The star should be here-->$c"
1522 $echo "*"
1523 fi
1524 $rm -f foo1 foo2
1525 ;;
1526esac
1527
1528: determine whether symbolic links are supported
1529echo " "
1530$touch blurfl
1531if $ln -s blurfl sym > /dev/null 2>&1 ; then
1532 echo "Symbolic links are supported." >&4
1533 lns="$ln -s"
1534else
1535 echo "Symbolic links are NOT supported." >&4
1536 lns="$ln"
1537fi
1538$rm -f blurfl sym
1539
1540: see whether [:lower:] and [:upper:] are supported character classes
1541echo " "
1542up='[A-Z]'
1543low='[a-z]'
1544case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1545ABYZ)
1546 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1547 up='[:upper:]'
1548 low='[:lower:]'
1549 ;;
1550*)
1551 echo "Your tr only supports [a-z] and [A-Z] to convert case." >&4
1552 ;;
1553esac
1554: set up the translation script tr, must be called with ./tr of course
1555cat >tr <<EOSC
1556$startsh
1557case "\$1\$2" in
1558'[A-Z][a-z]') exec $tr '$up' '$low';;
1559'[a-z][A-Z]') exec $tr '$low' '$up';;
1560esac
1561exec $tr "\$@"
1562EOSC
1563chmod +x tr
1564$eunicefix tr
1565
1566: Try to determine whether config.sh was made on this system
1567case "$config_sh" in
1568'')
1569myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
1570myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
1571 ./tr '[A-Z]' '[a-z]' | tr '\012' ' '`
1572newmyuname="$myuname"
1573dflt=n
1574case "$knowitall" in
1575'')
1576 if test -f ../config.sh; then
1577 if $contains myuname= ../config.sh >/dev/null 2>&1; then
1578 eval "`grep myuname= ../config.sh`"
1579 fi
1580 if test "X$myuname" = "X$newmyuname"; then
1581 dflt=y
1582 fi
1583 fi
1584 ;;
1585*) dflt=y;;
1586esac
1587
1588: Get old answers from old config file if Configure was run on the
1589: same system, otherwise use the hints.
1590hint=default
1591cd ..
1592if test -f config.sh; then
1593 echo " "
1594 rp="I see a config.sh file. Shall I use it to set the defaults?"
1595 . UU/myread
1596 case "$ans" in
1597 n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
1598 *) echo "Fetching default answers from your old config.sh file..." >&4
1599 tmp_n="$n"
1600 tmp_c="$c"
1601 tmp_sh="$sh"
1602 . ./config.sh
1603 cp config.sh UU
1604 n="$tmp_n"
1605 c="$tmp_c"
1606 : Older versions did not always set $sh. Catch re-use of such
1607 : an old config.sh.
1608 case "$sh" in
1609 '') sh="$tmp_sh" ;;
1610 esac
1611 hint=previous
1612 ;;
1613 esac
1614fi
1615if test ! -f config.sh; then
1616 $cat <<EOM
1617
1618First time through, eh? I have some defaults handy for the following systems:
1619
1620EOM
1621 cd hints; ls -C *.sh | $sed 's/\.sh/ /g' >&4
1622 dflt=''
1623 : Half the following guesses are probably wrong... If you have better
1624 : tests or hints, please send them to doughera@lafcol.lafayette.edu
1625 : The metaconfig authors would also appreciate a copy...
1626 $test -f /irix && osname=irix
1627 $test -f /xenix && osname=sco_xenix
1628 $test -f /dynix && osname=dynix
1629 $test -f /dnix && osname=dnix
1630 $test -f /unicos && osname=unicos && osvers=`$uname -r`
1631 $test -f /bin/mips && /bin/mips && osname=mips
1632 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
1633 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
1634 $test -d /usr/apollo/bin && osname=apollo
1635 $test -f /etc/saf/_sactab && osname=svr4
1636 $test -d /usr/include/minix && osname=minix
1637 if $test -d /MachTen; then
1638 osname=machten
1639 if $test -x /sbin/version; then
1640 osvers=`/sbin/version | $awk '{print $2}' |
1641 $sed -e 's/[A-Za-z]$//'`
1642 elif $test -x /usr/etc/version; then
1643 osvers=`/usr/etc/version | $awk '{print $2}' |
1644 $sed -e 's/[A-Za-z]$//'`
1645 else
1646 osvers="$2.$3"
1647 fi
1648 fi
1649 if $test -f $uname; then
1650 set X $myuname
1651 shift
1652
1653 case "$5" in
1654 fps*) osname=fps ;;
1655 mips*)
1656 case "$4" in
1657 umips) osname=umips ;;
1658 *) osname=mips ;;
1659 esac;;
1660 [23]100) osname=mips ;;
1661 next*) osname=next ;;
1662 news*) osname=news ;;
1663 i386*)
1664 if $test -f /etc/kconfig; then
1665 osname=isc
1666 if test "$lns" = "ln -s"; then
1667 osvers=4
1668 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
1669 osvers=3
1670 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
1671 osvers=2
1672 fi
1673 fi
1674 ;;
1675 esac
1676
1677 case "$1" in
1678 aix) osname=aix
1679 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
1680 case "$tmp" in
1681 'not found') osvers="$4"."$3" ;;
1682 '<3240'|'<>3240') osvers=3.2.0 ;;
1683 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
1684 '=3250'|'>3250') osvers=3.2.5 ;;
1685 *) osvers=$tmp;;
1686 esac
1687 ;;
1688 dnix) osname=dnix
1689 osvers="$3"
1690 ;;
1691 domainos) osname=apollo
1692 osvers="$3"
1693 ;;
1694 dgux) osname=dgux
1695 osvers="$3"
1696 ;;
1697 dynixptx*) osname=dynixptx
1698 osvers="$3"
1699 ;;
1700 freebsd) osname=freebsd
1701 osvers="$3" ;;
1702 genix) osname=genix ;;
1703 hp*) osname=hpux
1704 case "$3" in
1705 *.08.*) osvers=9 ;;
1706 *.09.*) osvers=9 ;;
1707 *.10.*) osvers=10 ;;
1708 *) osvers="$3" ;;
1709 esac
1710 ;;
1711 irix*) osname=irix
1712 case "$3" in
1713 4*) osvers=4 ;;
1714 5*) osvers=5 ;;
1715 *) osvers="$3" ;;
1716 esac
1717 ;;
1718 linux) osname=linux
1719 case "$3" in
1720 1*) osvers=1 ;;
1721 *) osvers="$3" ;;
1722 esac
1723 ;;
1724 netbsd*) osname=netbsd
1725 osvers="$3"
1726 ;;
1727 bsd386) osname=bsd386
1728 osvers=`$uname -r`
1729 ;;
1730 next*) osname=next ;;
1731 solaris) osname=solaris
1732 case "$3" in
1733 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
1734 *) osvers="$3" ;;
1735 esac
1736 ;;
1737 sunos) osname=sunos
1738 case "$3" in
1739 5*) osname=solaris
1740 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
1741 *) osvers="$3" ;;
1742 esac
1743 ;;
1744 titanos) osname=titanos
1745 case "$3" in
1746 1*) osvers=1 ;;
1747 2*) osvers=2 ;;
1748 3*) osvers=3 ;;
1749 4*) osvers=4 ;;
1750 *) osvers="$3" ;;
1751 esac
1752 ;;
1753 ultrix) osname=ultrix
1754 osvers="$3"
1755 ;;
1756 osf1) case "$5" in
1757 alpha)
1758 osname=dec_osf
1759 osvers=`echo "$3" | sed 's/^[vt]//'`
1760 ;;
1761 hp*) osname=hp_osf1 ;;
1762 mips) osname=mips_osf1 ;;
1763 esac
1764 ;;
1765 uts) osname=uts
1766 osvers="$3"
1767 ;;
1768 $2) case "$osname" in
1769 *isc*) ;;
1770 *freebsd*) ;;
1771 svr*)
1772 : svr4.x or possibly later
1773 case "svr$3" in
1774 ${osname}*)
1775 osname=svr$3
1776 osvers=$4
1777 ;;
1778 esac
1779 case "$osname" in
1780 svr4.0)
1781 : Check for ESIX
1782 if test -f /stand/boot ; then
1783 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
1784 if test -n "$INITPROG" -a -f "$INITPROG"; then
1785 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
1786 if test -n "$isesix"; then
1787 osname=esix4
1788 fi
1789 fi
1790 fi
1791 ;;
1792 esac
1793 ;;
1794 *) if test -f /etc/systemid; then
1795 osname=sco
1796 set `echo $3 | $sed 's/\./ /g'` $4
1797 if $test -f sco_$1_$2_$3.sh; then
1798 osvers=$1.$2.$3
1799 elif $test -f sco_$1_$2.sh; then
1800 osvers=$1.$2
1801 elif $test -f sco_$1.sh; then
1802 osvers=$1
1803 fi
1804 else
1805 case "$osname" in
1806 '') : Still unknown. Probably a generic Sys V.
1807 osname="sysv"
1808 osvers="$3"
1809 ;;
1810 esac
1811 fi
1812 ;;
1813 esac
1814 ;;
1815 *) case "$osname" in
1816 '') : Still unknown. Probably a generic BSD.
1817 osname="$1"
1818 osvers="$3"
1819 ;;
1820 esac
1821 ;;
1822 esac
1823 else
1824 if test -f /vmunix -a -f news_os.sh; then
1825 (what /vmunix | ../UU/tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1
1826 if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then
1827 osname=news_os
1828 fi
1829 $rm -f ../UU/kernel.what
1830 elif test -d c:/.; then
1831 set X $myuname
1832 osname=os2
1833 osvers="$5"
1834 fi
1835 fi
1836
1837 : Now look for a hint file osname_osvers, unless one has been
1838 : specified already.
1839 case "$hintfile" in
1840 ''|' ')
1841 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
1842 : Also try without trailing minor version numbers.
1843 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
1844 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
1845 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
1846 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
1847 case "$file" in
1848 '') dflt=none ;;
1849 *) case "$osvers" in
1850 '') dflt=$file
1851 ;;
1852 *) if $test -f $file.sh ; then
1853 dflt=$file
1854 elif $test -f $xfile.sh ; then
1855 dflt=$xfile
1856 elif $test -f $xxfile.sh ; then
1857 dflt=$xxfile
1858 elif $test -f $xxxfile.sh ; then
1859 dflt=$xxxfile
1860 elif $test -f $xxxxfile.sh ; then
1861 dflt=$xxxxfile
1862 elif $test -f "${osname}.sh" ; then
1863 dflt="${osname}"
1864 else
1865 dflt=none
1866 fi
1867 ;;
1868 esac
1869 ;;
1870 esac
1871 ;;
1872 *)
1873 dflt=`echo $hintfile | $sed 's/\.sh$//'`
1874 ;;
1875 esac
1876
1877 $cat <<EOM
1878
1879You may give one or more space-separated answers, or "none" if appropriate.
1880If your OS version has no hints, DO NOT give a wrong version -- say "none".
1881
1882EOM
1883 rp="Which of these apply, if any?"
1884 . ../UU/myread
1885 tans=$ans
1886 for file in $tans; do
1887 if $test -f $file.sh; then
1888 . ./$file.sh
1889 $cat $file.sh >> ../UU/config.sh
1890 elif $test X$tans = X -o X$tans = Xnone ; then
1891 : nothing
1892 else
1893 : Give one chance to correct a possible typo.
1894 echo "$file.sh does not exist"
1895 dflt=$file
1896 rp="hint to use instead?"
1897 . ../UU/myread
1898 for file in $ans; do
1899 if $test -f "$file.sh"; then
1900 . ./$file.sh
1901 $cat $file.sh >> ../UU/config.sh
1902 elif $test X$ans = X -o X$ans = Xnone ; then
1903 : nothing
1904 else
1905 echo "$file.sh does not exist -- ignored."
1906 fi
1907 done
1908 fi
1909 done
1910
1911 hint=recommended
1912 : Remember our hint file for later.
1913 if $test -f "$file.sh" ; then
1914 hintfile="$file"
1915 else
1916 hintfile=''
1917 fi
1918
1919 cd ..
1920fi
1921cd UU
1922;;
1923*)
1924 echo " "
1925 echo "Fetching default answers from $config_sh..." >&4
1926 tmp_n="$n"
1927 tmp_c="$c"
1928 cd ..
1929 cp $config_sh config.sh 2>/dev/null
1930 chmod +w config.sh
1931 . ./config.sh
1932 cd UU
1933 cp ../config.sh .
1934 n="$tmp_n"
1935 c="$tmp_c"
1936 hint=previous
1937 ;;
1938esac
1939test "$override" && . ./optdef.sh
1940myuname="$newmyuname"
1941
1942: Restore computed paths
1943for file in $loclist $trylist; do
1944 eval $file="\$_$file"
1945done
1946
1947cat << EOM
1948
1949Configure uses the operating system name and version to set some defaults.
1950The default value is probably right if the name rings a bell. Otherwise,
1951since spelling matters for me, either accept the default or answer "none"
1952to leave it blank.
1953
1954EOM
1955case "$osname" in
1956 ''|' ')
1957 case "$hintfile" in
1958 ''|' '|none) dflt=none ;;
1959 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
1960 esac
1961 ;;
1962 *) dflt="$osname" ;;
1963esac
1964rp="Operating system name?"
1965. ./myread
1966case "$ans" in
1967none) osname='' ;;
1968*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
1969esac
1970echo " "
1971case "$osvers" in
1972 ''|' ')
1973 case "$hintfile" in
1974 ''|' '|none) dflt=none ;;
1975 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
1976 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
1977 case "$dflt" in
1978 ''|' ') dflt=none ;;
1979 esac
1980 ;;
1981 esac
1982 ;;
1983 *) dflt="$osvers" ;;
1984esac
1985rp="Operating system version?"
1986. ./myread
1987case "$ans" in
1988none) osvers='' ;;
1989*) osvers="$ans" ;;
1990esac
1991
1992
1993
1994: who configured the system
1995cf_time=`$date 2>&1`
1996cf_by=`(logname) 2>/dev/null`
1997case "$cf_by" in "")
1998 cf_by=`(whoami) 2>/dev/null`
1999 case "$cf_by" in "")
2000 cf_by=unknown ;;
2001 esac ;;
2002esac
2003
2004: determine the architecture name
2005echo " "
2006if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
2007 tarch=`arch`"-$osname"
2008elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
2009 if uname -m > tmparch 2>&1 ; then
2010 tarch=`$sed -e 's/ /_/g' -e 's/$/'"-$osname/" tmparch`
2011 else
2012 tarch="$osname"
2013 fi
2014 $rm -f tmparch
2015else
2016 tarch="$osname"
2017fi
2018case "$myarchname" in
2019''|"$tarch") ;;
2020*)
2021 echo "(Your architecture name used to be $myarchname.)"
2022 archname=''
2023 ;;
2024esac
2025case "$archname" in
2026'') dflt="$tarch";;
2027*) dflt="$archname";;
2028esac
2029rp='What is your architecture name'
2030. ./myread
2031archname="$ans"
2032myarchname="$tarch"
2033
2034: is AFS running?
2035echo " "
2036if test -d /afs; then
2037 echo "AFS may be running... I'll be extra cautious then..." >&4
2038 afs=true
2039else
2040 echo "AFS does not seem to be running..." >&4
2041 afs=false
2042fi
2043
2044: decide how portable to be. Allow command line overrides.
2045case "$d_portable" in
2046"$undef") ;;
2047*) d_portable="$define" ;;
2048esac
2049
2050: set up shell script to do ~ expansion
2051cat >filexp <<EOSS
2052$startsh
2053: expand filename
2054case "\$1" in
2055 ~/*|~)
2056 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2057 ;;
2058 ~*)
2059 if $test -f /bin/csh; then
2060 /bin/csh -f -c "glob \$1"
2061 failed=\$?
2062 echo ""
2063 exit \$failed
2064 else
2065 name=\`$expr x\$1 : '..\([^/]*\)'\`
2066 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2067 if $test ! -d "\$dir"; then
2068 me=\`basename \$0\`
2069 echo "\$me: can't locate home directory for: \$name" >&2
2070 exit 1
2071 fi
2072 case "\$1" in
2073 */*)
2074 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2075 ;;
2076 *)
2077 echo \$dir
2078 ;;
2079 esac
2080 fi
2081 ;;
2082*)
2083 echo \$1
2084 ;;
2085esac
2086EOSS
2087chmod +x filexp
2088$eunicefix filexp
2089
2090: now set up to get a file name
2091cat <<'EOSC' >getfile
2092tilde=''
2093fullpath=''
2094already=''
2095skip=''
2096none_ok=''
2097exp_file=''
2098nopath_ok=''
2099orig_rp="$rp"
2100orig_dflt="$dflt"
2101
2102case "$fn" in
2103*\(*)
2104 expr $fn : '.*(\(.*\)).*' | tr ',' '\012' >getfile.ok
2105 fn=`echo $fn | sed 's/(.*)//'`
2106 ;;
2107esac
2108
2109case "$fn" in
2110*:*)
2111 loc_file=`expr $fn : '.*:\(.*\)'`
2112 fn=`expr $fn : '\(.*\):.*'`
2113 ;;
2114esac
2115
2116case "$fn" in
2117*~*) tilde=true;;
2118esac
2119case "$fn" in
2120*/*) fullpath=true;;
2121esac
2122case "$fn" in
2123*+*) skip=true;;
2124esac
2125case "$fn" in
2126*n*) none_ok=true;;
2127esac
2128case "$fn" in
2129*e*) exp_file=true;;
2130esac
2131case "$fn" in
2132*p*) nopath_ok=true;;
2133esac
2134
2135case "$fn" in
2136*f*) type='File';;
2137*d*) type='Directory';;
2138*l*) type='Locate';;
2139esac
2140
2141what="$type"
2142case "$what" in
2143Locate) what='File';;
2144esac
2145
2146case "$exp_file" in
2147'')
2148 case "$d_portable" in
2149 "$define") ;;
2150 *) exp_file=true;;
2151 esac
2152 ;;
2153esac
2154
2155cd ..
2156while test "$type"; do
2157 redo=''
2158 rp="$orig_rp"
2159 dflt="$orig_dflt"
2160 case "$tilde" in
2161 true) rp="$rp (~name ok)";;
2162 esac
2163 . UU/myread
2164 if test -f UU/getfile.ok && \
2165 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
2166 then
2167 value="$ans"
2168 ansexp="$ans"
2169 break
2170 fi
2171 case "$ans" in
2172 none)
2173 value=''
2174 ansexp=''
2175 case "$none_ok" in
2176 true) type='';;
2177 esac
2178 ;;
2179 *)
2180 case "$tilde" in
2181 '') value="$ans"
2182 ansexp="$ans";;
2183 *)
2184 value=`UU/filexp $ans`
2185 case $? in
2186 0)
2187 if test "$ans" != "$value"; then
2188 echo "(That expands to $value on this system.)"
2189 fi
2190 ;;
2191 *) value="$ans";;
2192 esac
2193 ansexp="$value"
2194 case "$exp_file" in
2195 '') value="$ans";;
2196 esac
2197 ;;
2198 esac
2199 case "$fullpath" in
2200 true)
2201 case "$ansexp" in
2202 /*) value="$ansexp" ;;
2203 *)
2204 redo=true
2205 case "$already" in
2206 true)
2207 echo "I shall only accept a full path name, as in /bin/ls." >&4
2208 echo "Use a ! shell escape if you wish to check pathnames." >&4
2209 ;;
2210 *)
2211 echo "Please give a full path name, starting with slash." >&4
2212 case "$tilde" in
2213 true)
2214 echo "Note that using ~name is ok provided it expands well." >&4
2215 already=true
2216 ;;
2217 esac
2218 esac
2219 ;;
2220 esac
2221 ;;
2222 esac
2223 case "$redo" in
2224 '')
2225 case "$type" in
2226 File)
2227 if test -f "$ansexp"; then
2228 type=''
2229 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2230 then
2231 echo "($value is not a plain file, but that's ok.)"
2232 type=''
2233 fi
2234 ;;
2235 Directory)
2236 if test -d "$ansexp"; then
2237 type=''
2238 fi
2239 ;;
2240 Locate)
2241 if test -d "$ansexp"; then
2242 echo "(Looking for $loc_file in directory $value.)"
2243 value="$value/$loc_file"
2244 ansexp="$ansexp/$loc_file"
2245 fi
2246 if test -f "$ansexp"; then
2247 type=''
2248 fi
2249 case "$nopath_ok" in
2250 true) case "$value" in
2251 */*) ;;
2252 *) echo "Assuming $value will be in people's path."
2253 type=''
2254 ;;
2255 esac
2256 ;;
2257 esac
2258 ;;
2259 esac
2260
2261 case "$skip" in
2262 true) type='';
2263 esac
2264
2265 case "$type" in
2266 '') ;;
2267 *)
2268 if test "$fastread" = yes; then
2269 dflt=y
2270 else
2271 dflt=n
2272 fi
2273 rp="$what $value doesn't exist. Use that name anyway?"
2274 . UU/myread
2275 dflt=''
2276 case "$ans" in
2277 y*) type='';;
2278 *) echo " ";;
2279 esac
2280 ;;
2281 esac
2282 ;;
2283 esac
2284 ;;
2285 esac
2286done
2287cd UU
2288ans="$value"
2289rp="$orig_rp"
2290dflt="$orig_dflt"
2291rm -f getfile.ok
2292EOSC
2293
2294: determine root of directory hierarchy where package will be installed.
2295case "$prefix" in
2296'')
2297 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
2298 ;;
2299*)
2300 dflt="$prefix"
2301 ;;
2302esac
2303$cat <<EOM
2304
2305By default, $package will be installed in $dflt/bin, manual
2306pages under $dflt/man, etc..., i.e. with $dflt as prefix for
2307all installation directories. Typically set to /usr/local, but you
2308may choose /usr if you wish to install $package among your system
2309binaries. If you wish to have binaries under /bin but manual pages
2310under /usr/local/man, that's ok: you will be prompted separately
2311for each of the installation directories, the prefix being only used
2312to set the defaults.
2313
2314EOM
2315fn=d~
2316rp='Installation prefix to use?'
2317. ./getfile
2318oldprefix=''
2319case "$prefix" in
2320'') ;;
2321*)
2322 case "$ans" in
2323 "$prefix") ;;
2324 *) oldprefix="$prefix";;
2325 esac
2326 ;;
2327esac
2328prefix="$ans"
2329prefixexp="$ansexp"
2330
2331: set the prefixit variable, to compute a suitable default value
2332prefixit='case "$3" in
2333""|none)
2334 case "$oldprefix" in
2335 "") eval "$1=\"\$$2\"";;
2336 *)
2337 case "$3" in
2338 "") eval "$1=";;
2339 none)
2340 eval "tp=\"\$$2\"";
2341 case "$tp" in
2342 ""|" ") eval "$1=\"\$$2\"";;
2343 *) eval "$1=";;
2344 esac;;
2345 esac;;
2346 esac;;
2347*)
2348 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
2349 case "$tp" in
2350 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
2351 /*-$oldprefix/*|\~*-$oldprefix/*)
2352 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
2353 *) eval "$1=\"\$$2\"";;
2354 esac;;
2355esac'
2356
2357: determine where private library files go
2358: Usual default is /usr/local/lib/perl5. Also allow things like
2359: /opt/perl/lib, since /opt/perl/lib/perl5 would be redundant.
2360case "$prefix" in
2361*perl*) set dflt privlib lib ;;
2362*) set dflt privlib lib/$package ;;
2363esac
2364eval $prefixit
2365$cat <<EOM
2366
2367There are some auxiliary files for $package that need to be put into a
2368private library directory that is accessible by everyone.
2369
2370EOM
2371fn=d~+
2372rp='Pathname where the private library files will reside?'
2373. ./getfile
2374if $test "X$privlibexp" != "X$ansexp"; then
2375 installprivlib=''
2376fi
2377privlib="$ans"
2378privlibexp="$ansexp"
2379if $afs; then
2380 $cat <<EOM
2381
2382Since you are running AFS, I need to distinguish the directory in which
2383private files reside from the directory in which they are installed (and from
2384which they are presumably copied to the former directory by occult means).
2385
2386EOM
2387 case "$installprivlib" in
2388 '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
2389 *) dflt="$installprivlib";;
2390 esac
2391 fn=de~
2392 rp='Where will private files be installed?'
2393 . ./getfile
2394 installprivlib="$ans"
2395else
2396 installprivlib="$privlibexp"
2397fi
2398
2399: set the base revision
2400baserev=5.0
2401
2402: get the patchlevel
2403echo " "
2404echo "Getting the current patchlevel..." >&4
2405if $test -r ../patchlevel.h;then
2406 patchlevel=`awk '/PATCHLEVEL/ {print $3}' ../patchlevel.h`
2407 subversion=`awk '/SUBVERSION/ {print $3}' ../patchlevel.h`
2408else
2409 patchlevel=0
2410 subversion=0
2411fi
2412echo "(You have $package $baserev patchlevel $patchlevel subversion $subversion.)"
2413
2414: set the prefixup variable, to restore leading tilda escape
2415prefixup='case "$prefixexp" in
2416"$prefix") ;;
2417*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
2418esac'
2419
2420: determine where public architecture dependent libraries go
2421set archlib archlib
2422eval $prefixit
2423case "$archlib" in
2424'')
2425 case "$privlib" in
2426 '') dflt=`./loc . "." $prefixexp/lib /usr/local/lib /usr/lib /lib`
2427 set dflt
2428 eval $prefixup
2429 ;;
2430 *) version=`LC_ALL=C;export LC_ALL;\
2431 echo $baserev $patchlevel $subversion | \
2432 $awk '{print $1 + $2/1000.0 + $3/100000.0}'`
2433 dflt="$privlib/$archname/$version"
2434 ;;
2435 esac
2436 ;;
2437*) dflt="$archlib";;
2438esac
2439cat <<EOM
2440
2441$spackage contains architecture-dependent library files. If you are
2442sharing libraries in a heterogeneous environment, you might store
2443these files in a separate location. Otherwise, you can just include
2444them with the rest of the public library files.
2445
2446EOM
2447fn=d+~
2448rp='Where do you want to put the public architecture-dependent libraries?'
2449. ./getfile
2450archlib="$ans"
2451archlibexp="$ansexp"
2452
2453if $afs; then
2454 $cat <<EOM
2455
2456Since you are running AFS, I need to distinguish the directory in which
2457private files reside from the directory in which they are installed (and from
2458which they are presumably copied to the former directory by occult means).
2459
2460EOM
2461 case "$installarchlib" in
2462 '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
2463 *) dflt="$installarchlib";;
2464 esac
2465 fn=de~
2466 rp='Where will architecture-dependent library files be installed?'
2467 . ./getfile
2468 installarchlib="$ans"
2469else
2470 installarchlib="$archlibexp"
2471fi
2472if $test X"$archlib" = X"$privlib"; then
2473 d_archlib="$undef"
2474else
2475 d_archlib="$define"
2476fi
2477
2478: set up the script used to warn in case of inconsistency
2479cat <<'EOSC' >whoa
2480dflt=y
2481echo " "
2482echo "*** WHOA THERE!!! ***" >&4
2483echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2484rp=" Keep the $hint value?"
2485. ./myread
2486case "$ans" in
2487y) td=$was; tu=$was;;
2488esac
2489EOSC
2490
2491: function used to set $1 to $val
2492setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2493case "$val$was" in
2494$define$undef) . ./whoa; eval "$var=\$td";;
2495$undef$define) . ./whoa; eval "$var=\$tu";;
2496*) eval "$var=$val";;
2497esac'
2498
2499: make some quick guesses about what we are up against
2500echo " "
2501$echo $n "Hmm... $c"
2502echo exit 1 >bsd
2503echo exit 1 >usg
2504echo exit 1 >v7
2505echo exit 1 >osf1
2506echo exit 1 >eunice
2507echo exit 1 >xenix
2508echo exit 1 >venix
2509echo exit 1 >os2
2510d_bsd="$undef"
2511$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2512if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2513then
2514 echo "Looks kind of like an OSF/1 system, but we'll see..."
2515 echo exit 0 >osf1
2516elif test `echo abc | tr a-z A-Z` = Abc ; then
2517 xxx=`./loc addbib blurfl $pth`
2518 if $test -f $xxx; then
2519 echo "Looks kind of like a USG system with BSD features, but we'll see..."
2520 echo exit 0 >bsd
2521 echo exit 0 >usg
2522 else
2523 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2524 echo "Looks kind of like an extended USG system, but we'll see..."
2525 else
2526 echo "Looks kind of like a USG system, but we'll see..."
2527 fi
2528 echo exit 0 >usg
2529 fi
2530elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2531 echo "Looks kind of like a BSD system, but we'll see..."
2532 d_bsd="$define"
2533 echo exit 0 >bsd
2534else
2535 echo "Looks kind of like a Version 7 system, but we'll see..."
2536 echo exit 0 >v7
2537fi
2538case "$eunicefix" in
2539*unixtovms*)
2540 $cat <<'EOI'
2541There is, however, a strange, musty smell in the air that reminds me of
2542something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2543EOI
2544 echo exit 0 >eunice
2545 d_eunice="$define"
2546: it so happens the Eunice I know will not run shell scripts in Unix format
2547 ;;
2548*)
2549 echo " "
2550 echo "Congratulations. You aren't running Eunice."
2551 d_eunice="$undef"
2552 ;;
2553esac
2554: Detect OS2. The p_ variable is set above in the Head.U unit.
2555case "$p_" in
2556:) ;;
2557*)
2558 $cat <<'EOI'
2559I have the feeling something is not exactly right, however...don't tell me...
2560lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2561EOI
2562 echo exit 0 >os2
2563 ;;
2564esac
2565if test -f /xenix; then
2566 echo "Actually, this looks more like a XENIX system..."
2567 echo exit 0 >xenix
2568 d_xenix="$define"
2569else
2570 echo " "
2571 echo "It's not Xenix..."
2572 d_xenix="$undef"
2573fi
2574chmod +x xenix
2575$eunicefix xenix
2576if test -f /venix; then
2577 echo "Actually, this looks more like a VENIX system..."
2578 echo exit 0 >venix
2579else
2580 echo " "
2581 if ./xenix; then
2582 : null
2583 else
2584 echo "Nor is it Venix..."
2585 fi
2586fi
2587chmod +x bsd usg v7 osf1 eunice xenix venix os2
2588$eunicefix bsd usg v7 osf1 eunice xenix venix os2
2589$rm -f foo
2590
2591: see if setuid scripts can be secure
2592$cat <<EOM
2593
2594Some kernels have a bug that prevents setuid #! scripts from being
2595secure. Some sites have disabled setuid #! scripts because of this.
2596
2597First let's decide if your kernel supports secure setuid #! scripts.
2598(If setuid #! scripts would be secure but have been disabled anyway,
2599don't say that they are secure if asked.)
2600
2601EOM
2602
2603val="$undef"
2604if $test -d /dev/fd; then
2605 echo "#!$ls" >reflect
2606 chmod +x,u+s reflect
2607 ./reflect >flect 2>&1
2608 if $contains "/dev/fd" flect >/dev/null; then
2609 echo "Congratulations, your kernel has secure setuid scripts!" >&4
2610 val="$define"
2611 else
2612 $cat <<EOM
2613If you are not sure if they are secure, I can check but I'll need a
2614username and password different from the one you are using right now.
2615If you don't have such a username or don't want me to test, simply
2616enter 'none'.
2617
2618EOM
2619 rp='Other username to test security of setuid scripts with?'
2620 dflt='none'
2621 . ./myread
2622 case "$ans" in
2623 n|none)
2624 case "$d_suidsafe" in
2625 '') echo "I'll assume setuid scripts are *not* secure." >&4
2626 dflt=n;;
2627 "$undef")
2628 echo "Well, the $hint value is *not* secure." >&4
2629 dflt=n;;
2630 *) echo "Well, the $hint value *is* secure." >&4
2631 dflt=y;;
2632 esac
2633 ;;
2634 *)
2635 $rm -f reflect flect
2636 echo "#!$ls" >reflect
2637 chmod +x,u+s reflect
2638 echo >flect
2639 chmod a+w flect
2640 echo '"su" will (probably) prompt you for '"$ans's password."
2641 su $ans -c './reflect >flect'
2642 if $contains "/dev/fd" flect >/dev/null; then
2643 echo "Okay, it looks like setuid scripts are secure." >&4
2644 dflt=y
2645 else
2646 echo "I don't think setuid scripts are secure." >&4
2647 dflt=n
2648 fi
2649 ;;
2650 esac
2651 rp='Does your kernel have *secure* setuid scripts?'
2652 . ./myread
2653 case "$ans" in
2654 [yY]*) val="$define";;
2655 *) val="$undef";;
2656 esac
2657 fi
2658else
2659 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
2660 echo "(That's for file descriptors, not floppy disks.)"
2661 val="$undef"
2662fi
2663set d_suidsafe
2664eval $setvar
2665
2666$rm -f reflect flect
2667
2668: now see if they want to do setuid emulation
2669echo " "
2670val="$undef"
2671case "$d_suidsafe" in
2672"$define")
2673 val="$undef"
2674 echo "No need to emulate SUID scripts since they are secure here." >& 4
2675 ;;
2676*)
2677 $cat <<EOM
2678Some systems have disabled setuid scripts, especially systems where
2679setuid scripts cannot be secure. On systems where setuid scripts have
2680been disabled, the setuid/setgid bits on scripts are currently
2681useless. It is possible for $package to detect those bits and emulate
2682setuid/setgid in a secure fashion. This emulation will only work if
2683setuid scripts have been disabled in your kernel.
2684
2685EOM
2686 case "$d_dosuid" in
2687 "$define") dflt=y ;;
2688 *) dflt=n ;;
2689 esac
2690 rp="Do you want to do setuid/setgid emulation?"
2691 . ./myread
2692 case "$ans" in
2693 [yY]*) val="$define";;
2694 *) val="$undef";;
2695 esac
2696 ;;
2697esac
2698set d_dosuid
2699eval $setvar
2700
2701: determine where site specific libraries go.
2702set sitelib sitelib
2703eval $prefixit
2704case "$sitelib" in
2705'') dflt="$privlib/site_perl" ;;
2706*) dflt="$sitelib" ;;
2707esac
2708$cat <<EOM
2709
2710The installation process will also create a directory for
2711site-specific extensions and modules. Some users find it convenient
2712to place all local files in this directory rather than in the main
2713distribution directory.
2714
2715EOM
2716fn=d~+
2717rp='Pathname for the site-specific library files?'
2718. ./getfile
2719if $test "X$sitelibexp" != "X$ansexp"; then
2720 installsitelib=''
2721fi
2722sitelib="$ans"
2723sitelibexp="$ansexp"
2724if $afs; then
2725 $cat <<EOM
2726
2727Since you are running AFS, I need to distinguish the directory in which
2728private files reside from the directory in which they are installed (and from
2729which they are presumably copied to the former directory by occult means).
2730
2731EOM
2732 case "$installsitelib" in
2733 '') dflt=`echo $sitelibexp | sed 's#^/afs/#/afs/.#'`;;
2734 *) dflt="$installsitelib";;
2735 esac
2736 fn=de~
2737 rp='Where will private files be installed?'
2738 . ./getfile
2739 installsitelib="$ans"
2740else
2741 installsitelib="$sitelibexp"
2742fi
2743
2744: determine where site specific architecture-dependent libraries go.
2745xxx=`echo $sitelib/$archname | sed 's!^$prefix!!'`
2746: xxx is usuually lib/site_perl/archname.
2747set sitearch sitearch none
2748eval $prefixit
2749case "$sitearch" in
2750'') dflt="$sitelib/$archname" ;;
2751*) dflt="$sitearch" ;;
2752esac
2753$cat <<EOM
2754
2755The installation process will also create a directory for
2756architecture-dependent site-specific extensions and modules.
2757
2758EOM
2759fn=nd~+
2760rp='Pathname for the site-specific architecture-dependent library files?'
2761. ./getfile
2762if $test "X$sitearchexp" != "X$ansexp"; then
2763 installsitearch=''
2764fi
2765sitearch="$ans"
2766sitearchexp="$ansexp"
2767if $afs; then
2768 $cat <<EOM
2769
2770Since you are running AFS, I need to distinguish the directory in which
2771private files reside from the directory in which they are installed (and from
2772which they are presumably copied to the former directory by occult means).
2773
2774EOM
2775 case "$installsitearch" in
2776 '') dflt=`echo $sitearchexp | sed 's#^/afs/#/afs/.#'`;;
2777 *) dflt="$installsitearch";;
2778 esac
2779 fn=de~
2780 rp='Where will private files be installed?'
2781 . ./getfile
2782 installsitearch="$ans"
2783else
2784 installsitearch="$sitearchexp"
2785fi
2786
2787: determine where old public architecture dependent libraries might be
2788case "$oldarchlib" in
2789'') case "$privlib" in
2790 '') ;;
2791 *) dflt="$privlib/$archname"
2792 ;;
2793 esac
2794 ;;
2795*) dflt="$oldarchlib"
2796 ;;
2797esac
2798if $test ! -d "$dflt/auto"; then
2799 dflt=none
2800fi
2801cat <<EOM
2802
2803In 5.001, Perl stored architecture-dependent library files in a directory
2804with a name such as $privlib/$archname,
2805and this directory contained files from the standard extensions and
2806files from any additional extensions you might have added. Starting
2807with version 5.002, all the architecture-dependent standard extensions
2808will go into a version-specific directory such as
2809$archlib,
2810while locally-added extensions will go into
2811$sitearch.
2812
2813If you wish Perl to continue to search the old architecture-dependent
2814library for your local extensions, give the path to that directory.
2815If you do not wish to use your old architecture-dependent library
2816files, answer 'none'.
2817
2818EOM
2819fn=dn~
2820rp='Directory for your old 5.001 architecture-dependent libraries?'
2821. ./getfile
2822oldarchlib="$ans"
2823oldarchlibexp="$ansexp"
2824case "$oldarchlib" in
2825''|' ') val="$undef" ;;
2826*) val="$define" ;;
2827esac
2828set d_oldarchlib
2829eval $setvar
2830
2831: determine where public executables go
2832echo " "
2833set dflt bin bin
2834eval $prefixit
2835fn=d~
2836rp='Pathname where the public executables will reside?'
2837. ./getfile
2838if $test "X$ansexp" != "X$binexp"; then
2839 installbin=''
2840fi
2841bin="$ans"
2842binexp="$ansexp"
2843if $afs; then
2844 $cat <<EOM
2845
2846Since you are running AFS, I need to distinguish the directory in which
2847executables reside from the directory in which they are installed (and from
2848which they are presumably copied to the former directory by occult means).
2849
2850EOM
2851 case "$installbin" in
2852 '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
2853 *) dflt="$installbin";;
2854 esac
2855 fn=de~
2856 rp='Where will public executables be installed?'
2857 . ./getfile
2858 installbin="$ans"
2859else
2860 installbin="$binexp"
2861fi
2862
2863: determine where manual pages are on this system
2864echo " "
2865case "$sysman" in
2866'')
2867 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2868 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2869 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2870 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2871 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2872 sysman=`./loc . /usr/man/man1 $syspath`
2873 ;;
2874esac
2875if $test -d "$sysman"; then
2876 echo "System manual is in $sysman." >&4
2877else
2878 echo "Could not find manual pages in source form." >&4
2879fi
2880
2881: determine where manual pages go
2882set man1dir man1dir none
2883eval $prefixit
2884$cat <<EOM
2885
2886$spackage has manual pages available in source form.
2887EOM
2888case "$nroff" in
2889nroff)
2890 echo "However, you don't have nroff, so they're probably useless to you."
2891 case "$man1dir" in
2892 '') man1dir="none";;
2893 esac;;
2894esac
2895echo "If you don't want the manual sources installed, answer 'none'."
2896case "$man1dir" in
2897' ') dflt=none
2898 ;;
2899'')
2900 lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
2901 lookpath="$lookpath $prefixexp/man/p_man/man1"
2902 lookpath="$lookpath $prefixexp/man/u_man/man1"
2903 lookpath="$lookpath $prefixexp/man/man.1"
2904 : If prefix contains 'perl' then we want to keep the man pages
2905 : under the prefix directory. Otherwise, look in a variety of
2906 : other possible places. This is debatable, but probably a
2907 : good compromise. Well, apparently not.
2908 : Experience has shown people expect man1dir to be under prefix,
2909 : so we now always put it there. Users who want other behavior
2910 : can answer interactively or use a command line option.
2911 : Does user have System V-style man paths.
2912 case "$sysman" in
2913 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
2914 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
2915 esac
2916 set dflt
2917 eval $prefixup
2918 ;;
2919*) dflt="$man1dir"
2920 ;;
2921esac
2922echo " "
2923fn=dn+~
2924rp="Where do the main $spackage manual pages (source) go?"
2925. ./getfile
2926if $test "X$man1direxp" != "X$ansexp"; then
2927 installman1dir=''
2928fi
2929man1dir="$ans"
2930man1direxp="$ansexp"
2931case "$man1dir" in
2932'') man1dir=' '
2933 installman1dir='';;
2934esac
2935if $afs; then
2936 $cat <<EOM
2937
2938Since you are running AFS, I need to distinguish the directory in which
2939manual pages reside from the directory in which they are installed (and from
2940which they are presumably copied to the former directory by occult means).
2941
2942EOM
2943 case "$installman1dir" in
2944 '') dflt=`echo $man1direxp | sed 's#^/afs/#/afs/.#'`;;
2945 *) dflt="$installman1dir";;
2946 esac
2947 fn=de~
2948 rp='Where will man pages be installed?'
2949 . ./getfile
2950 installman1dir="$ans"
2951else
2952 installman1dir="$man1direxp"
2953fi
2954
2955: What suffix to use on installed man pages
2956
2957case "$man1dir" in
2958' ')
2959 man1ext='0'
2960 ;;
2961*)
2962 rp="What suffix should be used for the main $spackage man pages?"
2963 case "$man1ext" in
2964 '') case "$man1dir" in
2965 *1) dflt=1 ;;
2966 *1p) dflt=1p ;;
2967 *1pm) dflt=1pm ;;
2968 *l) dflt=l;;
2969 *n) dflt=n;;
2970 *o) dflt=o;;
2971 *p) dflt=p;;
2972 *C) dflt=C;;
2973 *L) dflt=L;;
2974 *L1) dflt=L1;;
2975 *) dflt=1;;
2976 esac
2977 ;;
2978 *) dflt="$man1ext";;
2979 esac
2980 . ./myread
2981 man1ext="$ans"
2982 ;;
2983esac
2984
2985: see if we can have long filenames
2986echo " "
2987rmlist="$rmlist /tmp/cf$$"
2988$test -d /tmp/cf$$ || mkdir /tmp/cf$$
2989first=123456789abcdef
2990second=/tmp/cf$$/$first
2991$rm -f $first $second
2992if (echo hi >$first) 2>/dev/null; then
2993 if $test -f 123456789abcde; then
2994 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
2995 val="$undef"
2996 else
2997 if (echo hi >$second) 2>/dev/null; then
2998 if $test -f /tmp/cf$$/123456789abcde; then
2999 $cat <<'EOM'
3000That's peculiar... You can have filenames longer than 14 characters, but only
3001on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems
3002I shall consider your system cannot support long filenames at all.
3003EOM
3004 val="$undef"
3005 else
3006 echo 'You can have filenames longer than 14 characters.' >&4
3007 val="$define"
3008 fi
3009 else
3010 $cat <<'EOM'
3011How confusing! Some of your filesystems are sane enough to allow filenames
3012longer than 14 characters but some others like /tmp can't even think about them.
3013So, for now on, I shall assume your kernel does not allow them at all.
3014EOM
3015 val="$undef"
3016 fi
3017 fi
3018else
3019 $cat <<'EOM'
3020You can't have filenames longer than 14 chars. You can't even think about them!
3021EOM
3022 val="$undef"
3023fi
3024set d_flexfnam
3025eval $setvar
3026$rm -rf /tmp/cf$$ 123456789abcde*
3027
3028: determine where library module manual pages go
3029set man3dir man3dir none
3030eval $prefixit
3031$cat <<EOM
3032
3033$spackage has manual pages for many of the library modules.
3034EOM
3035
3036case "$nroff" in
3037nroff)
3038 $cat <<'EOM'
3039However, you don't have nroff, so they're probably useless to you.
3040You can use the supplied perldoc script instead.
3041EOM
3042 case "$man3dir" in
3043 '') man3dir="none";;
3044 esac;;
3045esac
3046
3047case "$d_flexfnam" in
3048undef)
3049 $cat <<'EOM'
3050However, your system can't handle the long file names like File::Basename.3.
3051You can use the supplied perldoc script instead.
3052EOM
3053 case "$man3dir" in
3054 '') man3dir="none";;
3055 esac;;
3056esac
3057
3058echo "If you don't want the manual sources installed, answer 'none'."
3059: We dont use /usr/local/man/man3 because some man programs will
3060: only show the /usr/local/man/man3 contents, and not the system ones,
3061: thus man less will show the perl module less.pm, but not the system
3062: less command. We might also conflict with TCL man pages.
3063: However, something like /opt/perl/man/man3 is fine.
3064case "$man3dir" in
3065'') case "$prefix" in
3066 *perl*) dflt=`echo $man1dir |
3067 $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'` ;;
3068 *) dflt="$privlib/man/man3" ;;
3069 esac
3070 ;;
3071' ') dflt=none;;
3072*) dflt="$man3dir" ;;
3073esac
3074echo " "
3075
3076fn=dn+~
3077rp="Where do the $spackage library man pages (source) go?"
3078. ./getfile
3079if test "X$man3direxp" != "X$ansexp"; then
3080 installman3dir=''
3081fi
3082
3083man3dir="$ans"
3084man3direxp="$ansexp"
3085case "$man3dir" in
3086'') man3dir=' '
3087 installman3dir='';;
3088esac
3089if $afs; then
3090 $cat <<EOM
3091
3092Since you are running AFS, I need to distinguish the directory in which
3093manual pages reside from the directory in which they are installed (and from
3094which they are presumably copied to the former directory by occult means).
3095
3096EOM
3097 case "$installman3dir" in
3098 '') dflt=`echo $man3direxp | sed 's#^/afs/#/afs/.#'`;;
3099 *) dflt="$installman3dir";;
3100 esac
3101 fn=de~
3102 rp='Where will man pages be installed?'
3103 . ./getfile
3104 installman3dir="$ans"
3105else
3106 installman3dir="$man3direxp"
3107fi
3108
3109: What suffix to use on installed man pages
3110
3111case "$man3dir" in
3112' ')
3113 man3ext='0'
3114 ;;
3115*)
3116 rp="What suffix should be used for the $spackage library man pages?"
3117 case "$man3ext" in
3118 '') case "$man3dir" in
3119 *3) dflt=3 ;;
3120 *3p) dflt=3p ;;
3121 *3pm) dflt=3pm ;;
3122 *l) dflt=l;;
3123 *n) dflt=n;;
3124 *o) dflt=o;;
3125 *p) dflt=p;;
3126 *C) dflt=C;;
3127 *L) dflt=L;;
3128 *L3) dflt=L3;;
3129 *) dflt=3;;
3130 esac
3131 ;;
3132 *) dflt="$man3ext";;
3133 esac
3134 . ./myread
3135 man3ext="$ans"
3136 ;;
3137esac
3138
3139: see what memory models we can support
3140case "$models" in
3141'')
3142 $cat >pdp11.c <<'EOP'
3143main() {
3144#ifdef pdp11
3145 exit(0);
3146#else
3147 exit(1);
3148#endif
3149}
3150EOP
3151 cc -o pdp11 pdp11.c >/dev/null 2>&1
3152 if ./pdp11 2>/dev/null; then
3153 dflt='unsplit split'
3154 else
3155 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
3156 case "$tans" in
3157 X) dflt='none';;
3158 *) if $test -d /lib/small || $test -d /usr/lib/small; then
3159 dflt='small'
3160 else
3161 dflt=''
3162 fi
3163 if $test -d /lib/medium || $test -d /usr/lib/medium; then
3164 dflt="$dflt medium"
3165 fi
3166 if $test -d /lib/large || $test -d /usr/lib/large; then
3167 dflt="$dflt large"
3168 fi
3169 if $test -d /lib/huge || $test -d /usr/lib/huge; then
3170 dflt="$dflt huge"
3171 fi
3172 esac
3173 fi;;
3174*) dflt="$models";;
3175esac
3176$cat <<EOM
3177
3178Some systems have different model sizes. On most systems they are called
3179small, medium, large, and huge. On the PDP11 they are called unsplit and
3180split. If your system doesn't support different memory models, say "none".
3181If you wish to force everything to one memory model, say "none" here and
3182put the appropriate flags later when it asks you for other cc and ld flags.
3183Venix systems may wish to put "none" and let the compiler figure things out.
3184(In the following question multiple model names should be space separated.)
3185
3186EOM
3187rp="Which memory models are supported?"
3188. ./myread
3189models="$ans"
3190
3191case "$models" in
3192none)
3193 small=''
3194 medium=''
3195 large=''
3196 huge=''
3197 unsplit=''
3198 split=''
3199 ;;
3200*split)
3201 case "$split" in
3202 '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
3203 $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
3204 dflt='-i'
3205 else
3206 dflt='none'
3207 fi;;
3208 *) dflt="$split";;
3209 esac
3210 rp="What flag indicates separate I and D space?"
3211 . ./myread
3212 tans="$ans"
3213 case "$tans" in
3214 none) tans='';;
3215 esac
3216 split="$tans"
3217 unsplit='';;
3218*large*|*small*|*medium*|*huge*)
3219 case "$models" in
3220 *large*)
3221 case "$large" in
3222 '') dflt='-Ml';;
3223 *) dflt="$large";;
3224 esac
3225 rp="What flag indicates large model?"
3226 . ./myread
3227 tans="$ans"
3228 case "$tans" in
3229 none) tans='';
3230 esac
3231 large="$tans";;
3232 *) large='';;
3233 esac
3234 case "$models" in
3235 *huge*) case "$huge" in
3236 '') dflt='-Mh';;
3237 *) dflt="$huge";;
3238 esac
3239 rp="What flag indicates huge model?"
3240 . ./myread
3241 tans="$ans"
3242 case "$tans" in
3243 none) tans='';
3244 esac
3245 huge="$tans";;
3246 *) huge="$large";;
3247 esac
3248 case "$models" in
3249 *medium*) case "$medium" in
3250 '') dflt='-Mm';;
3251 *) dflt="$medium";;
3252 esac
3253 rp="What flag indicates medium model?"
3254 . ./myread
3255 tans="$ans"
3256 case "$tans" in
3257 none) tans='';
3258 esac
3259 medium="$tans";;
3260 *) medium="$large";;
3261 esac
3262 case "$models" in
3263 *small*) case "$small" in
3264 '') dflt='none';;
3265 *) dflt="$small";;
3266 esac
3267 rp="What flag indicates small model?"
3268 . ./myread
3269 tans="$ans"
3270 case "$tans" in
3271 none) tans='';
3272 esac
3273 small="$tans";;
3274 *) small='';;
3275 esac
3276 ;;
3277*)
3278 echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
3279 ;;
3280esac
3281
3282: see if we need a special compiler
3283echo " "
3284if ./usg; then
3285 case "$cc" in
3286 '') case "$Mcc" in
3287 /*) dflt='Mcc';;
3288 *) case "$large" in
3289 -M*) dflt='cc';;
3290 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3291 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3292 dflt='cc'
3293 else
3294 dflt='cc -M'
3295 fi
3296 else
3297 dflt='cc'
3298 fi;;
3299 esac;;
3300 esac;;
3301 *) dflt="$cc";;
3302 esac
3303 $cat <<'EOM'
3304On some systems the default C compiler will not resolve multiple global
3305references that happen to have the same name. On some such systems the "Mcc"
3306command may be used to force these to be resolved. On other systems a "cc -M"
3307command is required. (Note that the -M flag on other systems indicates a
3308memory model to use!) If you have the Gnu C compiler, you might wish to use
3309that instead.
3310
3311EOM
3312 rp="What command will force resolution on this system?"
3313 . ./myread
3314 cc="$ans"
3315else
3316 case "$cc" in
3317 '') dflt=cc;;
3318 *) dflt="$cc";;
3319 esac
3320 rp="Use which C compiler?"
3321 . ./myread
3322 cc="$ans"
3323fi
3324echo " "
3325echo "Checking for GNU cc in disguise and/or its version number..." >&4
3326$cat >gccvers.c <<EOM
3327#include <stdio.h>
3328int main() {
3329#ifdef __GNUC__
3330#ifdef __VERSION__
3331 printf("%s\n", __VERSION__);
3332#else
3333 printf("%s\n", "1");
3334#endif
3335#endif
3336 exit(0);
3337}
3338EOM
3339if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
3340 gccversion=`./gccvers`
3341 case "$gccversion" in
3342 '') echo "You are not using GNU cc." ;;
3343 *) echo "You are using GNU cc $gccversion." ;;
3344 esac
3345else
3346 echo " "
3347 echo "*** WHOA THERE!!! ***" >&4
3348 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3349 case "$knowitall" in
3350 '')
3351 echo " You'd better start hunting for one and let me know about it." >&4
3352 exit 1
3353 ;;
3354 esac
3355fi
3356$rm -f gccvers*
3357case "$gccversion" in
33581*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3359esac
3360
3361: What should the include directory be ?
3362echo " "
3363$echo $n "Hmm... $c"
3364dflt='/usr/include'
3365incpath=''
3366mips_type=''
3367if $test -f /bin/mips && /bin/mips; then
3368 echo "Looks like a MIPS system..."
3369 $cat >usr.c <<'EOCP'
3370#ifdef SYSTYPE_BSD43
3371/bsd43
3372#endif
3373EOCP
3374 if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3375 dflt='/bsd43/usr/include'
3376 incpath='/bsd43'
3377 mips_type='BSD 4.3'
3378 else
3379 mips_type='System V'
3380 fi
3381 $rm -f usr.c usr.out
3382 echo "and you're compiling with the $mips_type compiler and libraries."
3383 xxx_prompt=y
3384 echo "exit 0" >mips
3385else
3386 echo "Doesn't look like a MIPS system."
3387 xxx_prompt=n
3388 echo "exit 1" >mips
3389fi
3390chmod +x mips
3391$eunicefix mips
3392echo " "
3393case "$usrinc" in
3394'') ;;
3395*) dflt="$usrinc";;
3396esac
3397case "$xxx_prompt" in
3398y) fn=d/
3399 rp='Where are the include files you want to use?'
3400 . ./getfile
3401 usrinc="$ans"
3402 ;;
3403*) usrinc="$dflt"
3404 ;;
3405esac
3406
3407: see if we have to deal with yellow pages, now NIS.
3408if $test -d /usr/etc/yp || $test -d /etc/yp; then
3409 if $test -f /usr/etc/nibindd; then
3410 echo " "
3411 echo "I'm fairly confident you're on a NeXT."
3412 echo " "
3413 rp='Do you get the hosts file via NetInfo?'
3414 dflt=y
3415 case "$hostcat" in
3416 nidump*) ;;
3417 '') ;;
3418 *) dflt=n;;
3419 esac
3420 . ./myread
3421 case "$ans" in
3422 y*) hostcat='nidump hosts .';;
3423 *) case "$hostcat" in
3424 nidump*) hostcat='';;
3425 esac
3426 ;;
3427 esac
3428 fi
3429 case "$hostcat" in
3430 nidump*) ;;
3431 *)
3432 case "$hostcat" in
3433 *ypcat*) dflt=y;;
3434 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
3435 dflt=y
3436 else
3437 dflt=n
3438 fi;;
3439 *) dflt=n;;
3440 esac
3441 echo " "
3442 rp='Are you getting the hosts file via yellow pages?'
3443 . ./myread
3444 case "$ans" in
3445 y*) hostcat='ypcat hosts';;
3446 *) hostcat='cat /etc/hosts';;
3447 esac
3448 ;;
3449 esac
3450fi
3451
3452: now get the host name
3453echo " "
3454echo "Figuring out host name..." >&4
3455case "$myhostname" in
3456'') cont=true
3457 echo 'Maybe "hostname" will work...'
3458 if tans=`sh -c hostname 2>&1` ; then
3459 myhostname=$tans
3460 phostname=hostname
3461 cont=''
3462 fi
3463 ;;
3464*) cont='';;
3465esac
3466if $test "$cont"; then
3467 if ./xenix; then
3468 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
3469 if tans=`cat /etc/systemid 2>&1` ; then
3470 myhostname=$tans
3471 phostname='cat /etc/systemid'
3472 echo "Whadyaknow. Xenix always was a bit strange..."
3473 cont=''
3474 fi
3475 elif $test -r /etc/systemid; then
3476 echo "(What is a non-Xenix system doing with /etc/systemid?)"
3477 fi
3478fi
3479if $test "$cont"; then
3480 echo 'No, maybe "uuname -l" will work...'
3481 if tans=`sh -c 'uuname -l' 2>&1` ; then
3482 myhostname=$tans
3483 phostname='uuname -l'
3484 else
3485 echo 'Strange. Maybe "uname -n" will work...'
3486 if tans=`sh -c 'uname -n' 2>&1` ; then
3487 myhostname=$tans
3488 phostname='uname -n'
3489 else
3490 echo 'Oh well, maybe I can mine it out of whoami.h...'
3491 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
3492 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
3493 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
3494 else
3495 case "$myhostname" in
3496 '') echo "Does this machine have an identity crisis or something?"
3497 phostname='';;
3498 *)
3499 echo "Well, you said $myhostname before..."
3500 phostname='echo $myhostname';;
3501 esac
3502 fi
3503 fi
3504 fi
3505fi
3506: you do not want to know about this
3507set $myhostname
3508myhostname=$1
3509
3510: verify guess
3511if $test "$myhostname" ; then
3512 dflt=y
3513 rp='Your host name appears to be "'$myhostname'".'" Right?"
3514 . ./myread
3515 case "$ans" in
3516 y*) ;;
3517 *) myhostname='';;
3518 esac
3519fi
3520
3521: bad guess or no guess
3522while $test "X$myhostname" = X ; do
3523 dflt=''
3524 rp="Please type the (one word) name of your host:"
3525 . ./myread
3526 myhostname="$ans"
3527done
3528
3529: translate upper to lower if necessary
3530case "$myhostname" in
3531*[A-Z]*)
3532 echo "(Normalizing case in your host name)"
3533 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
3534 ;;
3535esac
3536
3537case "$myhostname" in
3538*.*)
3539 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
3540 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
3541 echo "(Trimming domain name from host name--host name is now $myhostname)"
3542 ;;
3543*) case "$mydomain" in
3544 '')
3545 {
3546 : If we use NIS, try ypmatch.
3547 : Is there some reason why this was not done before?
3548 test "X$hostcat" = "Xypcat hosts" &&
3549 ypmatch "$myhostname" hosts 2>/dev/null |\
3550 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
3551 $test -s hosts
3552 } || {
3553 : Extract only the relevant hosts, reducing file size,
3554 : remove comments, insert trailing space for later use.
3555 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
3556 /[ ]$myhostname[ . ]/p" > hosts
3557 }
3558 tmp_re="[ . ]"
3559 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
3560 END { print sum }" hosts` = x1 || tmp_re="[ ]"
3561 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
3562 hosts | $sort | $uniq | \
3563 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
3564 case `$echo X$dflt` in
3565 X*\ *) echo "(Several hosts in /etc/hosts matched hostname)"
3566 dflt=.
3567 ;;
3568 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
3569 ;;
3570 esac
3571 case "$dflt" in
3572 .)
3573 tans=`./loc resolv.conf X /etc /usr/etc`
3574 if $test -f "$tans"; then
3575 echo "(Attempting domain name extraction from $tans)"
3576 : Why was there an Egrep here, when Sed works?
3577 dflt=.`$sed -n -e 's/^domain[ ]*\(.*\)/\1/p' $tans \
3578 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
3579 fi
3580 ;;
3581 esac
3582 case "$dflt" in
3583 .) echo "(No help from resolv.conf either -- attempting clever guess)"
3584 dflt=.`sh -c domainname 2>/dev/null`
3585 case "$dflt" in
3586 '') dflt='.';;
3587 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
3588 esac
3589 ;;
3590 esac
3591 case "$dflt" in
3592 .) echo "(Lost all hope -- silly guess then)"
3593 dflt='.uucp'
3594 ;;
3595 esac
3596 $rm -f hosts
3597 ;;
3598 *) dflt="$mydomain";;
3599 esac;;
3600esac
3601echo " "
3602rp="What is your domain name?"
3603. ./myread
3604tans="$ans"
3605case "$ans" in
3606'') ;;
3607.*) ;;
3608*) tans=".$tans";;
3609esac
3610mydomain="$tans"
3611
3612: translate upper to lower if necessary
3613case "$mydomain" in
3614*[A-Z]*)
3615 echo "(Normalizing case in your domain name)"
3616 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
3617 ;;
3618esac
3619
3620: a little sanity check here
3621case "$phostname" in
3622'') ;;
3623*)
3624 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
3625 $myhostname$mydomain|$myhostname) ;;
3626 *)
3627 case "$phostname" in
3628 sed*)
3629 echo "(That doesn't agree with your whoami.h file, by the way.)"
3630 ;;
3631 *)
3632 echo "(That doesn't agree with your $phostname command, by the way.)"
3633 ;;
3634 esac
3635 ;;
3636 esac
3637 ;;
3638esac
3639
3640$cat <<EOM
3641
3642I need to get your e-mail address in Internet format if possible, i.e.
3643something like user@host.domain. Please answer accurately since I have
3644no easy means to double check it. The default value provided below
3645is most probably close to the reality but may not be valid from outside
3646your organization...
3647
3648EOM
3649cont=x
3650while test "$cont"; do
3651 case "$cf_email" in
3652 '') dflt="$cf_by@$myhostname$mydomain";;
3653 *) dflt="$cf_email";;
3654 esac
3655 rp='What is your e-mail address?'
3656 . ./myread
3657 cf_email="$ans"
3658 case "$cf_email" in
3659 *@*.*) cont='' ;;
3660 *)
3661 rp='Address does not look like an Internet one. Use it anyway?'
3662 case "$fastread" in
3663 yes) dflt=y ;;
3664 *) dflt=n ;;
3665 esac
3666 . ./myread
3667 case "$ans" in
3668 y*) cont='' ;;
3669 *) echo " " ;;
3670 esac
3671 ;;
3672 esac
3673done
3674
3675$cat <<EOM
3676
3677If you or somebody else will be maintaining perl at your site, please
3678fill in the correct e-mail address here so that they may be contacted
3679if necessary. Currently, the "perlbug" program included with perl
3680will send mail to this address in addition to perlbug@perl.com. You may
3681enter "none" for no administrator.
3682
3683EOM
3684case "$perladmin" in
3685'') dflt="$cf_email";;
3686*) dflt="$perladmin";;
3687esac
3688rp='Perl administrator e-mail address'
3689. ./myread
3690perladmin="$ans"
3691
3692: determine where public executable scripts go
3693set scriptdir scriptdir
3694eval $prefixit
3695case "$scriptdir" in
3696'')
3697 dflt="$bin"
3698 : guess some guesses
3699 $test -d /usr/share/scripts && dflt=/usr/share/scripts
3700 $test -d /usr/share/bin && dflt=/usr/share/bin
3701 $test -d /usr/local/script && dflt=/usr/local/script
3702 $test -d $prefixexp/script && dflt=$prefixexp/script
3703 set dflt
3704 eval $prefixup
3705 ;;
3706*) dflt="$scriptdir"
3707 ;;
3708esac
3709$cat <<EOM
3710
3711Some installations have a separate directory just for executable scripts so
3712that they can mount it across multiple architectures but keep the scripts in
3713one spot. You might, for example, have a subdirectory of /usr/share for this.
3714Or you might just lump your scripts in with all your other executables.
3715
3716EOM
3717fn=d~
3718rp='Where do you keep publicly executable scripts?'
3719. ./getfile
3720if $test "X$ansexp" != "X$scriptdirexp"; then
3721 installscript=''
3722fi
3723scriptdir="$ans"
3724scriptdirexp="$ansexp"
3725if $afs; then
3726 $cat <<EOM
3727
3728Since you are running AFS, I need to distinguish the directory in which
3729scripts reside from the directory in which they are installed (and from
3730which they are presumably copied to the former directory by occult means).
3731
3732EOM
3733 case "$installscript" in
3734 '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
3735 *) dflt="$installscript";;
3736 esac
3737 fn=de~
3738 rp='Where will public scripts be installed?'
3739 . ./getfile
3740 installscript="$ans"
3741else
3742 installscript="$scriptdirexp"
3743fi
3744
3745: determine perl absolute location
3746case "$perlpath" in
3747'') perlpath=$binexp/perl ;;
3748esac
3749
3750: figure out how to guarantee perl startup
3751case "$startperl" in
3752'')
3753 case "$sharpbang" in
3754 *!)
3755 $cat <<EOH
3756
3757I can use the #! construct to start perl on your system. This will
3758make startup of perl scripts faster, but may cause problems if you
3759want to share those scripts and perl is not in a standard place
3760($perlpath) on all your platforms. The alternative is to force
3761a shell by starting the script with a single ':' character.
3762
3763EOH
3764 dflt=$perlpath
3765 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
3766 . ./myread
3767 case "$ans" in
3768 none) startperl=": # use perl";;
3769 *) startperl="#!$ans";;
3770 esac
3771 ;;
3772 *) startperl=": # use perl"
3773 ;;
3774 esac
3775 ;;
3776esac
3777echo "I'll use $startperl to start perl scripts."
3778
3779cat <<EOM
3780
3781Previous version of $package used the standard IO mechanisms as defined in
3782<stdio.h>. Versions 5.003_02 and later of perl allow alternate IO
3783mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
3784the default and is the only supported mechanism. This abstraction
3785layer can use AT&T's sfio (if you already have sfio installed) or
3786fall back on standard IO. This PerlIO abstraction layer is
3787experimental and may cause problems with some extension modules.
3788
3789If this doesn't make any sense to you, just accept the default 'n'.
3790EOM
3791case "$useperlio" in
3792$define|true|[yY]*) dflt='y';;
3793*) dflt='n';;
3794esac
3795rp='Use the experimental PerlIO abstraction layer?'
3796. ./myread
3797case "$ans" in
3798y|Y)
3799 val="$define"
3800 ;;
3801*)
3802 echo "Ok, doing things the stdio way"
3803 val="$undef"
3804 ;;
3805esac
3806set useperlio
3807eval $setvar
3808
3809: see how we invoke the C preprocessor
3810echo " "
3811echo "Now, how can we feed standard input to your C preprocessor..." >&4
3812cat <<'EOT' >testcpp.c
3813#define ABC abc
3814#define XYZ xyz
3815ABC.XYZ
3816EOT
3817cd ..
3818echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3819chmod 755 cppstdin
3820wrapper=`pwd`/cppstdin
3821ok='false'
3822cd UU
3823
3824if $test "X$cppstdin" != "X" && \
3825 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3826 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3827then
3828 echo "You used to use $cppstdin $cppminus so we'll use that again."
3829 case "$cpprun" in
3830 '') echo "But let's see if we can live without a wrapper..." ;;
3831 *)
3832 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3833 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3834 then
3835 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3836 ok='true'
3837 else
3838 echo "(However, $cpprun $cpplast does not work, let's see...)"
3839 fi
3840 ;;
3841 esac
3842else
3843 case "$cppstdin" in
3844 '') ;;
3845 *)
3846 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3847 ;;
3848 esac
3849fi
3850
3851if $ok; then
3852 : nothing
3853elif echo 'Maybe "'"$cc"' -E" will work...'; \
3854 $cc -E <testcpp.c >testcpp.out 2>&1; \
3855 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3856 echo "Yup, it does."
3857 x_cpp="$cc -E"
3858 x_minus='';
3859elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3860 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3861 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3862 echo "Yup, it does."
3863 x_cpp="$cc -E"
3864 x_minus='-';
3865elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3866 $cc -P <testcpp.c >testcpp.out 2>&1; \
3867 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3868 echo "Yipee, that works!"
3869 x_cpp="$cc -P"
3870 x_minus='';
3871elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3872 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3873 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3874 echo "At long last!"
3875 x_cpp="$cc -P"
3876 x_minus='-';
3877elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3878 $cpp <testcpp.c >testcpp.out 2>&1; \
3879 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3880 echo "It works!"
3881 x_cpp="$cpp"
3882 x_minus='';
3883elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3884 $cpp - <testcpp.c >testcpp.out 2>&1; \
3885 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3886 echo "Hooray, it works! I was beginning to wonder."
3887 x_cpp="$cpp"
3888 x_minus='-';
3889elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3890 $wrapper <testcpp.c >testcpp.out 2>&1; \
3891 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3892 x_cpp="$wrapper"
3893 x_minus=''
3894 echo "Eureka!"
3895else
3896 dflt=''
3897 rp="No dice. I can't find a C preprocessor. Name one:"
3898 . ./myread
3899 x_cpp="$ans"
3900 x_minus=''
3901 $x_cpp <testcpp.c >testcpp.out 2>&1
3902 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3903 echo "OK, that will do." >&4
3904 else
3905echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3906 exit 1
3907 fi
3908fi
3909
3910case "$ok" in
3911false)
3912 cppstdin="$x_cpp"
3913 cppminus="$x_minus"
3914 cpprun="$x_cpp"
3915 cpplast="$x_minus"
3916 set X $x_cpp
3917 shift
3918 case "$1" in
3919 "$cpp")
3920 echo "Perhaps can we force $cc -E using a wrapper..."
3921 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3922 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3923 then
3924 echo "Yup, we can."
3925 cppstdin="$wrapper"
3926 cppminus='';
3927 else
3928 echo "Nope, we'll have to live without it..."
3929 fi
3930 ;;
3931 esac
3932 case "$cpprun" in
3933 "$wrapper")
3934 cpprun=''
3935 cpplast=''
3936 ;;
3937 esac
3938 ;;
3939esac
3940
3941case "$cppstdin" in
3942"$wrapper") ;;
3943*) $rm -f $wrapper;;
3944esac
3945$rm -f testcpp.c testcpp.out
3946
3947: Set private lib path
3948case "$plibpth" in
3949'') if ./mips; then
3950 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3951 fi;;
3952esac
3953case "$libpth" in
3954' ') dlist='';;
3955'') dlist="$loclibpth $plibpth $glibpth";;
3956*) dlist="$libpth";;
3957esac
3958
3959: Now check and see which directories actually exist, avoiding duplicates
3960libpth=''
3961for xxx in $dlist
3962do
3963 if $test -d $xxx; then
3964 case " $libpth " in
3965 *" $xxx "*) ;;
3966 *) libpth="$libpth $xxx";;
3967 esac
3968 fi
3969done
3970$cat <<'EOM'
3971
3972Some systems have incompatible or broken versions of libraries. Among
3973the directories listed in the question below, please remove any you
3974know not to be holding relevant libraries, and add any that are needed.
3975Say "none" for none.
3976
3977EOM
3978case "$libpth" in
3979'') dflt='none';;
3980*)
3981 set X $libpth
3982 shift
3983 dflt=${1+"$@"}
3984 ;;
3985esac
3986rp="Directories to use for library searches?"
3987. ./myread
3988case "$ans" in
3989none) libpth=' ';;
3990*) libpth="$ans";;
3991esac
3992
3993: determine optimize, if desired, or use for debug flag also
3994case "$optimize" in
3995' ') dflt='none';;
3996'') dflt='-O';;
3997*) dflt="$optimize";;
3998esac
3999$cat <<EOH
4000
4001Some C compilers have problems with their optimizers. By default, $package
4002compiles with the -O flag to use the optimizer. Alternately, you might want
4003to use the symbolic debugger, which uses the -g flag (on traditional Unix
4004systems). Either flag can be specified here. To use neither flag, specify
4005the word "none".
4006
4007EOH
4008rp="What optimizer/debugger flag should be used?"
4009. ./myread
4010optimize="$ans"
4011case "$optimize" in
4012'none') optimize=" ";;
4013esac
4014
4015dflt=''
4016: We will not override a previous value, but we might want to
4017: augment a hint file
4018case "$hint" in
4019none|recommended)
4020 case "$gccversion" in
4021 1*) dflt='-fpcc-struct-return' ;;
4022 esac
4023 case "$optimize" in
4024 *-g*) dflt="$dflt -DDEBUGGING";;
4025 esac
4026 case "$gccversion" in
4027 2*) if test -d /etc/conf/kconfig.d &&
4028 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4029 then
4030 dflt="$dflt -posix"
4031 fi
4032 ;;
4033 esac
4034 ;;
4035esac
4036
4037case "$mips_type" in
4038*BSD*|'') inclwanted="$locincpth $usrinc";;
4039*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4040esac
4041for thisincl in $inclwanted; do
4042 if $test -d $thisincl; then
4043 if $test x$thisincl != x$usrinc; then
4044 case "$dflt" in
4045 *$thisincl*);;
4046 *) dflt="$dflt -I$thisincl";;
4047 esac
4048 fi
4049 fi
4050done
4051
4052inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4053 xxx=true;
4054elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4055 xxx=true;
4056else
4057 xxx=false;
4058fi;
4059if $xxx; then
4060 case "$dflt" in
4061 *$2*);;
4062 *) dflt="$dflt -D$2";;
4063 esac;
4064fi'
4065
4066if ./osf1; then
4067 set signal.h __LANGUAGE_C__; eval $inctest
4068else
4069 set signal.h LANGUAGE_C; eval $inctest
4070fi
4071set signal.h NO_PROTOTYPE; eval $inctest
4072set signal.h _NO_PROTO; eval $inctest
4073
4074case "$hint" in
4075none|recommended) dflt="$ccflags $dflt" ;;
4076*) dflt="$ccflags";;
4077esac
4078
4079case "$dflt" in
4080''|' ') dflt=none;;
4081esac
4082$cat <<EOH
4083
4084Your C compiler may want other flags. For this question you should include
4085-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4086but you should NOT include libraries or ld flags like -lwhatever. If you
4087want $package to honor its debug switch, you should include -DDEBUGGING here.
4088Your C compiler might also need additional flags, such as -D_POSIX_SOURCE,
4089-DHIDEMYMALLOC or -DCRIPPLED_CC.
4090
4091To use no flags, specify the word "none".
4092
4093EOH
4094set X $dflt
4095shift
4096dflt=${1+"$@"}
4097rp="Any additional cc flags?"
4098. ./myread
4099case "$ans" in
4100none) ccflags='';;
4101*) ccflags="$ans";;
4102esac
4103
4104: the following weeds options from ccflags that are of no interest to cpp
4105cppflags="$ccflags"
4106case "$gccversion" in
41071*) cppflags="$cppflags -D__GNUC__"
4108esac
4109case "$mips_type" in
4110'');;
4111*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4112esac
4113case "$cppflags" in
4114'');;
4115*)
4116 echo " "
4117 echo "Let me guess what the preprocessor flags are..." >&4
4118 set X $cppflags
4119 shift
4120 cppflags=''
4121 $cat >cpp.c <<'EOM'
4122#define BLURFL foo
4123
4124BLURFL xx LFRULB
4125EOM
4126 previous=''
4127 for flag in $*
4128 do
4129 case "$flag" in
4130 -*) ftry="$flag";;
4131 *) ftry="$previous $flag";;
4132 esac
4133 if $cppstdin -DLFRULB=bar $ftry $cppminus <cpp.c \
4134 >cpp1.out 2>/dev/null && \
4135 $cpprun -DLFRULB=bar $ftry $cpplast <cpp.c \
4136 >cpp2.out 2>/dev/null && \
4137 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4138 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4139 then
4140 cppflags="$cppflags $ftry"
4141 previous=''
4142 else
4143 previous="$flag"
4144 fi
4145 done
4146 set X $cppflags
4147 shift
4148 cppflags=${1+"$@"}
4149 case "$cppflags" in
4150 *-*) echo "They appear to be: $cppflags";;
4151 esac
4152 $rm -f cpp.c cpp?.out
4153 ;;
4154esac
4155
4156: flags used in final linking phase
4157
4158case "$ldflags" in
4159'') if ./venix; then
4160 dflt='-i -z'
4161 else
4162 dflt=''
4163 fi
4164 case "$ccflags" in
4165 *-posix*) dflt="$dflt -posix" ;;
4166 esac
4167 ;;
4168*) dflt="$ldflags";;
4169esac
4170
4171: Try to guess additional flags to pick up local libraries.
4172for thislibdir in $libpth; do
4173 case " $loclibpth " in
4174 *" $thislibdir "*)
4175 case "$dflt " in
4176 *"-L$thislibdir "*) ;;
4177 *) dflt="$dflt -L$thislibdir" ;;
4178 esac
4179 ;;
4180 esac
4181done
4182
4183case "$dflt" in
4184'') dflt='none' ;;
4185esac
4186
4187$cat <<EOH
4188
4189Your C linker may need flags. For this question you should
4190include -L/whatever and any other flags used by the C linker, but you
4191should NOT include libraries like -lwhatever.
4192
4193Make sure you include the appropriate -L/path flags if your C linker
4194does not normally search all of the directories you specified above,
4195namely
4196 $libpth
4197To use no flags, specify the word "none".
4198
4199EOH
4200
4201rp="Any additional ld flags (NOT including libraries)?"
4202. ./myread
4203case "$ans" in
4204none) ldflags='';;
4205*) ldflags="$ans";;
4206esac
4207rmlist="$rmlist pdp11"
4208
4209: coherency check
4210echo " "
4211echo "Checking your choice of C compiler and flags for coherency..." >&4
4212set X $cc $optimize $ccflags $ldflags try.c -o try
4213shift
4214$cat >try.msg <<EOM
4215I've tried to compile and run a simple program with:
4216
4217 $*
4218 ./try
4219
4220and I got the following output:
4221
4222EOM
4223$cat > try.c <<'EOF'
4224#include <stdio.h>
4225main() { exit(0); }
4226EOF
4227dflt=y
4228if sh -c "$cc $optimize $ccflags try.c -o try $ldflags" >>try.msg 2>&1; then
4229 if sh -c './try' >>try.msg 2>&1; then
4230 dflt=n
4231 else
4232 echo "The program compiled OK, but exited with status $?." >>try.msg
4233 rp="You have a problem. Shall I abort Configure"
4234 dflt=y
4235 fi
4236else
4237 echo "I can't compile the test program." >>try.msg
4238 rp="You have a BIG problem. Shall I abort Configure"
4239 dflt=y
4240fi
4241case "$dflt" in
4242y)
4243 $cat try.msg
4244 case "$knowitall" in
4245 '')
4246 echo "(The supplied flags might be incorrect with this C compiler.)"
4247 ;;
4248 *) dflt=n;;
4249 esac
4250 echo " "
4251 . ./myread
4252 case "$ans" in
4253 n*|N*) ;;
4254 *) echo "Ok. Stopping Configure." >&4
4255 exit 1
4256 ;;
4257 esac
4258 ;;
4259n) echo "OK, that should do.";;
4260esac
4261$rm -f try try.* core
4262
4263: compute shared library extension
4264case "$so" in
4265'')
4266 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4267 dflt='sl'
4268 else
4269 dflt='so'
4270 fi
4271 ;;
4272*) dflt="$so";;
4273esac
4274$cat <<EOM
4275
4276On some systems, shared libraries may be available. Answer 'none' if
4277you want to suppress searching of shared libraries for the remaining
4278of this configuration.
4279
4280EOM
4281rp='What is the file extension used for shared libraries?'
4282. ./myread
4283so="$ans"
4284
4285: Looking for optional libraries
4286echo " "
4287echo "Checking for optional libraries..." >&4
4288case "$libs" in
4289' '|'') dflt='';;
4290*) dflt="$libs";;
4291esac
4292case "$libswanted" in
4293'') libswanted='c_s';;
4294esac
4295for thislib in $libswanted; do
4296
4297 if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then
4298 echo "Found -l$thislib (shared)."
4299 case " $dflt " in
4300 *"-l$thislib "*);;
4301 *) dflt="$dflt -l$thislib";;
4302 esac
4303 elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
4304 echo "Found -l$thislib (shared)."
4305 case " $dflt " in
4306 *"-l$thislib "*);;
4307 *) dflt="$dflt -l$thislib";;
4308 esac
4309 elif xxx=`./loc lib$thislib.a X $libpth`; $test -f "$xxx"; then
4310 echo "Found -l$thislib."
4311 case " $dflt " in
4312 *"-l$thislib "*);;
4313 *) dflt="$dflt -l$thislib";;
4314 esac
4315 elif xxx=`./loc $thislib.a X $libpth`; $test -f "$xxx"; then
4316 echo "Found -l$thislib."
4317 case " $dflt " in
4318 *"-l$thislib "*);;
4319 *) dflt="$dflt -l$thislib";;
4320 esac
4321 elif xxx=`./loc lib${thislib}_s.a X $libpth`; $test -f "$xxx"; then
4322 echo "Found -l${thislib}_s."
4323 case " $dflt " in
4324 *"-l$thislib "*);;
4325 *) dflt="$dflt -l${thislib}_s";;
4326 esac
4327 elif xxx=`./loc Slib$thislib.a X $xlibpth`; $test -f "$xxx"; then
4328 echo "Found -l$thislib."
4329 case " $dflt " in
4330 *"-l$thislib "*);;
4331 *) dflt="$dflt -l$thislib";;
4332 esac
4333 else
4334 echo "No -l$thislib."
4335 fi
4336done
4337set X $dflt
4338shift
4339dflt="$*"
4340case "$libs" in
4341'') dflt="$dflt";;
4342*) dflt="$libs";;
4343esac
4344case "$dflt" in
4345' '|'') dflt='none';;
4346esac
4347
4348$cat <<EOM
4349
4350Some versions of Unix support shared libraries, which make executables smaller
4351but make load time slightly longer.
4352
4353On some systems, mostly System V Release 3's, the shared library is included
4354by putting the option "-lc_s" as the last thing on the cc command line when
4355linking. Other systems use shared libraries by default. There may be other
4356libraries needed to compile $package on your machine as well. If your system
4357needs the "-lc_s" option, include it here. Include any other special libraries
4358here as well. Say "none" for none.
4359EOM
4360
4361echo " "
4362rp="Any additional libraries?"
4363. ./myread
4364case "$ans" in
4365none) libs=' ';;
4366*) libs="$ans";;
4367esac
4368
4369: see if nm is to be used to determine whether a symbol is defined or not
4370case "$usenm" in
4371'')
4372 dflt=`egrep 'inlibc|csym' ../Configure | wc -l 2>/dev/null`
4373 if $test $dflt -gt 20; then
4374 dflt=y
4375 else
4376 dflt=n
4377 fi
4378 ;;
4379*)
4380 case "$usenm" in
4381 true) dflt=y;;
4382 *) dflt=n;;
4383 esac
4384 ;;
4385esac
4386$cat <<EOM
4387
4388I can use 'nm' to extract the symbols from your C libraries. This is a time
4389consuming task which may generate huge output on the disk (up to 3 megabytes)
4390but that should make the symbols extraction faster. The alternative is to skip
4391the 'nm' extraction part and to compile a small test program instead to
4392determine whether each symbol is present. If you have a fast C compiler and/or
4393if your 'nm' output cannot be parsed, this may be the best solution.
4394
4395EOM
4396rp='Shall I use nm to extract C symbols from the libraries?'
4397. ./myread
4398case "$ans" in
4399n|N) usenm=false;;
4400*) usenm=true;;
4401esac
4402
4403runnm=$usenm
4404case "$reuseval" in
4405true) runnm=false;;
4406esac
4407
4408: nm options which may be necessary
4409case "$nm_opt" in
4410'') if $test -f /mach_boot; then
4411 nm_opt=''
4412 elif $test -d /usr/ccs/lib; then
4413 nm_opt='-p'
4414 elif $test -f /dgux; then
4415 nm_opt='-p'
4416 else
4417 nm_opt=''
4418 fi;;
4419esac
4420
4421: nm options which may be necessary for shared libraries but illegal
4422: for archive libraries. Thank you, Linux.
4423case "$nm_so_opt" in
4424'') case "$myuname" in
4425 *linux*)
4426 if nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4427 nm_so_opt='--dynamic'
4428 fi
4429 ;;
4430 esac
4431 ;;
4432esac
4433
4434case "$runnm" in
4435true)
4436: get list of predefined functions in a handy place
4437echo " "
4438case "$libc" in
4439'') libc=unknown
4440 case "$libs" in
4441 *-lc_s*) libc=`./loc libc_s.a $libc $libpth`
4442 esac
4443 ;;
4444esac
4445libnames='';
4446case "$libs" in
4447'') ;;
4448*) for thislib in $libs; do
4449 case "$thislib" in
4450 -lc|-lc_s)
4451 : Handle C library specially below.
4452 ;;
4453 -l*)
4454 thislib=`echo $thislib | $sed -e 's/^-l//'`
4455 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4456 :
4457 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4458 :
4459 elif try=`./loc lib$thislib.a X $libpth`; $test -f "$try"; then
4460 :
4461 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4462 :
4463 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4464 :
4465 elif try=`./loc Slib$thislib.a X $xlibpth`; $test -f "$try"; then
4466 :
4467 else
4468 try=''
4469 fi
4470 libnames="$libnames $try"
4471 ;;
4472 *) libnames="$libnames $thislib" ;;
4473 esac
4474 done
4475 ;;
4476esac
4477xxx=normal
4478case "$libc" in
4479unknown)
4480 set /lib/libc.$so
4481 for xxx in $libpth; do
4482 $test -r $1 || set $xxx/libc.$so
4483 : The messy sed command sorts on library version numbers.
4484 $test -r $1 || \
4485 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4486 tr ' ' '\012' | egrep -v '\.[A-Za-z]*$' | $sed -e '
4487 h
4488 s/[0-9][0-9]*/0000&/g
4489 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4490 G
4491 s/\n/ /' | \
4492 sort | $sed -e 's/^.* //'`
4493 eval set \$$#
4494 done
4495 $test -r $1 || set /usr/ccs/lib/libc.$so
4496 $test -r $1 || set /lib/libsys_s.a
4497 ;;
4498*)
4499 set blurfl
4500 ;;
4501esac
4502if $test -r "$1"; then
4503 echo "Your (shared) C library seems to be in $1."
4504 libc="$1"
4505elif $test -r /lib/libc && $test -r /lib/clib; then
4506 echo "Your C library seems to be in both /lib/clib and /lib/libc."
4507 xxx=apollo
4508 libc='/lib/clib /lib/libc'
4509 if $test -r /lib/syslib; then
4510 echo "(Your math library is in /lib/syslib.)"
4511 libc="$libc /lib/syslib"
4512 fi
4513elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4514 echo "Your C library seems to be in $libc, as you said before."
4515elif $test -r $incpath/usr/lib/libc.a; then
4516 libc=$incpath/usr/lib/libc.a;
4517 echo "Your C library seems to be in $libc. That's fine."
4518elif $test -r /lib/libc.a; then
4519 libc=/lib/libc.a;
4520 echo "Your C library seems to be in $libc. You're normal."
4521else
4522 if tans=`./loc libc.a blurfl/dyick $libpth`; $test -r "$tans"; then
4523 :
4524 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4525 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4526 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4527 :
4528 elif tans=`./loc Slibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4529 :
4530 elif tans=`./loc Mlibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4531 :
4532 else
4533 tans=`./loc Llibc.a blurfl/dyick $xlibpth`
4534 fi
4535 if $test -r "$tans"; then
4536 echo "Your C library seems to be in $tans, of all places."
4537 libc=$tans
4538 else
4539 libc='blurfl'
4540 fi
4541fi
4542if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4543 dflt="$libc"
4544 cat <<EOM
4545
4546If the guess above is wrong (which it might be if you're using a strange
4547compiler, or your machine supports multiple models), you can override it here.
4548
4549EOM
4550else
4551 dflt=''
4552 echo $libpth | tr ' ' '\012' | sort | uniq > libpath
4553 cat >&4 <<EOM
4554I can't seem to find your C library. I've looked in the following places:
4555
4556EOM
4557 $sed 's/^/ /' libpath
4558 cat <<EOM
4559
4560None of these seems to contain your C library. I need to get its name...
4561
4562EOM
4563fi
4564fn=f
4565rp='Where is your C library?'
4566. ./getfile
4567libc="$ans"
4568
4569echo " "
4570echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames
4571set X `cat libnames`
4572shift
4573xxx=files
4574case $# in 1) xxx=file; esac
4575echo "Extracting names from the following $xxx for later perusal:" >&4
4576echo " "
4577$sed 's/^/ /' libnames >&4
4578echo " "
4579$echo $n "This may take a while...$c" >&4
4580
4581: Linux may need the special Dynamic option to nm for shared libraries.
4582: In general, this is stored in the nm_so_opt variable.
4583: Unfortunately, that option may be fatal on non-shared libraries.
4584for nm_libs_ext in $*; do
4585 case $nm_libs_ext in
4586 *$so*) nm $nm_so_opt $nm_opt $nm_libs_ext 2>/dev/null ;;
4587 *) nm $nm_opt $nm_libs_ext 2>/dev/null ;;
4588 esac
4589done > libc.tmp
4590
4591$echo $n ".$c"
4592$grep fprintf libc.tmp > libc.ptf
4593xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4594xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4595xxx='[ADTSIW]'
4596if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx //p'";\
4597 eval $xscan;\
4598 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4599 eval $xrun
4600elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4601 eval $xscan;\
4602 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4603 eval $xrun
4604elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4605 eval $xscan;\
4606 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4607 eval $xrun
4608elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4609 eval $xscan;\
4610 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4611 eval $xrun
4612elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4613 eval $xscan;\
4614 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4615 eval $xrun
4616elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4617 eval $xscan;\
4618 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4619 eval $xrun
4620elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4621 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
4622 eval $xscan;\
4623 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4624 eval $xrun
4625elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4626 eval $xscan;\
4627 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4628 eval $xrun
4629elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4630 eval $xscan;\
4631 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4632 eval $xrun
4633elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4634 eval $xscan;\
4635 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4636 eval $xrun
4637elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4638 eval $xscan;\
4639 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4640 eval $xrun
4641else
4642 nm -p $* 2>/dev/null >libc.tmp
4643 $grep fprintf libc.tmp > libc.ptf
4644 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4645 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4646 then
4647 nm_opt='-p'
4648 eval $xrun
4649 else
4650 echo " "
4651 echo "nm didn't seem to work right. Trying ar instead..." >&4
4652 com=''
4653 if ar t $libc > libc.tmp; then
4654 for thisname in $libnames; do
4655 ar t $thisname >>libc.tmp
4656 done
4657 $sed -e 's/\.o$//' < libc.tmp > libc.list
4658 echo "Ok." >&4
4659 else
4660 echo "ar didn't seem to work right." >&4
4661 echo "Maybe this is a Cray...trying bld instead..." >&4
4662 if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list
4663 then
4664 for thisname in $libnames; do
4665 bld t $libnames | \
4666 $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
4667 ar t $thisname >>libc.tmp
4668 done
4669 echo "Ok." >&4
4670 else
4671 echo "That didn't work either. Giving up." >&4
4672 exit 1
4673 fi
4674 fi
4675 fi
4676fi
4677nm_extract="$com"
4678if $test -f /lib/syscalls.exp; then
4679 echo " "
4680 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4681 $sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
4682fi
4683;;
4684esac
4685$rm -f libnames libpath
4686
4687: is a C symbol defined?
4688csym='tlook=$1;
4689case "$3" in
4690-v) tf=libc.tmp; tc=""; tdc="";;
4691-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
4692*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4693esac;
4694tx=yes;
4695case "$reuseval-$4" in
4696true-) ;;
4697true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4698esac;
4699case "$tx" in
4700yes)
4701 case "$runnm" in
4702 true)
4703 if $contains $tlook $tf >/dev/null 2>&1;
4704 then tval=true;
4705 else tval=false;
4706 fi;;
4707 *)
4708 echo "main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
4709 if $cc $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
4710 then tval=true;
4711 else tval=false;
4712 fi;
4713 $rm -f t t.c;;
4714 esac;;
4715*)
4716 case "$tval" in
4717 $define) tval=true;;
4718 *) tval=false;;
4719 esac;;
4720esac;
4721eval "$2=$tval"'
4722
4723: define an is-in-libc? function
4724inlibc='echo " "; td=$define; tu=$undef;
4725sym=$1; var=$2; eval "was=\$$2";
4726tx=yes;
4727case "$reuseval$was" in
4728true) ;;
4729true*) tx=no;;
4730esac;
4731case "$tx" in
4732yes)
4733 set $sym tres -f;
4734 eval $csym;
4735 case "$tres" in
4736 true)
4737 echo "$sym() found." >&4;
4738 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
4739 *)
4740 echo "$sym() NOT found." >&4;
4741 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
4742 esac;;
4743*)
4744 case "$was" in
4745 $define) echo "$sym() found." >&4;;
4746 *) echo "$sym() NOT found." >&4;;
4747 esac;;
4748esac'
4749
4750: Check how to convert floats to strings.
4751echo " "
4752echo "Checking for an efficient way to convert floats to strings."
4753$cat >try.c <<'EOP'
4754#ifdef TRY_gconvert
4755#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
4756char *myname = "gconvert";
4757#endif
4758#ifdef TRY_gcvt
4759#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
4760char *myname = "gcvt";
4761#endif
4762#ifdef TRY_sprintf
4763#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
4764char *myname = "sprintf";
4765#endif
4766
4767#include <stdio.h>
4768
4769int
4770checkit(expect, got)
4771char *expect;
4772char *got;
4773{
4774 if (strcmp(expect, got)) {
4775 printf("%s oddity: Expected %s, got %s\n",
4776 myname, expect, got);
4777 exit(1);
4778 }
4779}
4780
4781int
4782main()
4783{
4784 char buf[64];
4785 buf[63] = '\0';
4786
4787 /* This must be 1st test on (which?) platform */
4788 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
4789 Gconvert(0.1, 8, 0, buf);
4790 checkit("0.1", buf);
4791
4792 Gconvert(1.0, 8, 0, buf);
4793 checkit("1", buf);
4794
4795 Gconvert(0.0, 8, 0, buf);
4796 checkit("0", buf);
4797
4798 Gconvert(-1.0, 8, 0, buf);
4799 checkit("-1", buf);
4800
4801 /* Some Linux gcvt's give 1.e+5 here. */
4802 Gconvert(100000.0, 8, 0, buf);
4803 checkit("100000", buf);
4804
4805 /* Some Linux gcvt's give -1.e+5 here. */
4806 Gconvert(-100000.0, 8, 0, buf);
4807 checkit("-100000", buf);
4808
4809 exit(0);
4810}
4811EOP
4812case "$d_Gconvert" in
4813gconvert*) xxx_list='gconvert gcvt sprintf' ;;
4814gcvt*) xxx_list='gcvt gconvert sprintf' ;;
4815sprintf*) xxx_list='sprintf gconvert gcvt' ;;
4816*) xxx_list='gconvert gcvt sprintf' ;;
4817esac
4818
4819for xxx_convert in $xxx_list; do
4820 echo "Trying $xxx_convert"
4821 $rm -f try try.o
4822 if $cc $ccflags -DTRY_$xxx_convert $ldflags -o try \
4823 try.c $libs > /dev/null 2>&1 ; then
4824 echo "$xxx_convert" found. >&4
4825 if ./try; then
4826 echo "I'll use $xxx_convert to convert floats into a string." >&4
4827 break;
4828 else
4829 echo "...But $xxx_convert didn't work as I expected."
4830 fi
4831 else
4832 echo "$xxx_convert NOT found." >&4
4833 fi
4834done
4835
4836case "$xxx_convert" in
4837gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
4838gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
4839*) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
4840esac
4841
4842: Initialize h_fcntl
4843h_fcntl=false
4844
4845: Initialize h_sysfile
4846h_sysfile=false
4847
4848: determine filename position in cpp output
4849echo " "
4850echo "Computing filename position in cpp output for #include directives..." >&4
4851echo '#include <stdio.h>' > foo.c
4852$cat >fieldn <<EOF
4853$startsh
4854$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4855$grep '^[ ]*#.*stdio\.h' | \
4856while read cline; do
4857 pos=1
4858 set \$cline
4859 while $test \$# -gt 0; do
4860 if $test -r \`echo \$1 | $tr -d '"'\`; then
4861 echo "\$pos"
4862 exit 0
4863 fi
4864 shift
4865 pos=\`expr \$pos + 1\`
4866 done
4867done
4868EOF
4869chmod +x fieldn
4870fieldn=`./fieldn`
4871$rm -f foo.c fieldn
4872case $fieldn in
4873'') pos='???';;
48741) pos=first;;
48752) pos=second;;
48763) pos=third;;
4877*) pos="${fieldn}th";;
4878esac
4879echo "Your cpp writes the filename in the $pos field of the line."
4880
4881: locate header file
4882$cat >findhdr <<EOF
4883$startsh
4884wanted=\$1
4885name=''
4886if test -f $usrinc/\$wanted; then
4887 echo "$usrinc/\$wanted"
4888 exit 0
4889fi
4890awkprg='{ print \$$fieldn }'
4891echo "#include <\$wanted>" > foo\$\$.c
4892$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4893$grep "^[ ]*#.*\$wanted" | \
4894while read cline; do
4895 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4896 case "\$name" in
4897 */\$wanted) echo "\$name"; exit 0;;
4898 *) name='';;
4899 esac;
4900done;
4901$rm -f foo\$\$.c;
4902case "\$name" in
4903'') exit 1;;
4904esac
4905EOF
4906chmod +x findhdr
4907
4908: access call always available on UNIX
4909set access d_access
4910eval $inlibc
4911
4912: locate the flags for 'access()'
4913case "$d_access" in
4914"$define")
4915 echo " "
4916 $cat >access.c <<'EOCP'
4917#include <sys/types.h>
4918#ifdef I_FCNTL
4919#include <fcntl.h>
4920#endif
4921#ifdef I_SYS_FILE
4922#include <sys/file.h>
4923#endif
4924#ifdef I_UNISTD
4925#include <unistd.h>
4926#endif
4927main() {
4928 exit(R_OK);
4929}
4930EOCP
4931 : check sys/file.h first, no particular reason here
4932 if $test `./findhdr sys/file.h` && \
4933 $cc $cppflags -DI_SYS_FILE access.c -o access >/dev/null 2>&1 ; then
4934 h_sysfile=true;
4935 echo "<sys/file.h> defines the *_OK access constants." >&4
4936 elif $test `./findhdr fcntl.h` && \
4937 $cc $cppflags -DI_FCNTL access.c -o access >/dev/null 2>&1 ; then
4938 h_fcntl=true;
4939 echo "<fcntl.h> defines the *_OK access constants." >&4
4940 elif $test `./findhdr unistd.h` && \
4941 $cc $cppflags -DI_UNISTD access.c -o access >/dev/null 2>&1 ; then
4942 echo "<unistd.h> defines the *_OK access constants." >&4
4943 else
4944 echo "I can't find the four *_OK access constants--I'll use mine." >&4
4945 fi
4946 ;;
4947esac
4948$rm -f access*
4949
4950: see if alarm exists
4951set alarm d_alarm
4952eval $inlibc
4953
4954: Look for GNU-cc style attribute checking
4955echo " "
4956echo "Checking whether your compiler can handle __attribute__ ..." >&4
4957$cat >attrib.c <<'EOCP'
4958#include <stdio.h>
4959void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
4960EOCP
4961if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
4962 if $contains 'warning' attrib.out >/dev/null 2>&1; then
4963 echo "Your C compiler doesn't fully support __attribute__."
4964 val="$undef"
4965 else
4966 echo "Your C compiler supports __attribute__."
4967 val="$define"
4968 fi
4969else
4970 echo "Your C compiler doesn't seem to understand __attribute__ at all."
4971 val="$undef"
4972fi
4973set d_attribut
4974eval $setvar
4975$rm -f attrib*
4976
4977: see if bcmp exists
4978set bcmp d_bcmp
4979eval $inlibc
4980
4981: see if bcopy exists
4982set bcopy d_bcopy
4983eval $inlibc
4984
4985: see if setpgrp exists
4986set setpgrp d_setpgrp
4987eval $inlibc
4988
4989: see which flavor of setpgrp is in use
4990case "$d_setpgrp" in
4991"$define")
4992 echo " "
4993 $cat >set.c <<EOP
4994main()
4995{
4996 if (getuid() == 0) {
4997 printf("(I see you are running Configure as super-user...)\n");
4998 setuid(1);
4999 }
5000 if (-1 == setpgrp(1, 1))
5001 exit(1);
5002 exit(0);
5003}
5004EOP
5005 if $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1; then
5006 ./set 2>/dev/null
5007 case $? in
5008 0) echo "You have to use setpgrp() instead of setpgrp(pid, pgrp)." >&4
5009 val="$undef";;
5010 *) echo "You have to use setpgrp(pid, pgrp) instead of setpgrp()." >&4
5011 val="$define";;
5012 esac
5013 else
5014 if ./usg; then
5015 xxx="USG one, i.e. you use setpgrp()."
5016 val="$undef"
5017 else
5018 xxx="BSD one, i.e. you use setpgrp(pid, pgrp)."
5019 val="$define"
5020 fi
5021 echo "Assuming your setpgrp is a $xxx" >&4
5022 fi
5023 ;;
5024*) val="$undef";;
5025esac
5026set d_bsdpgrp
5027eval $setvar
5028$rm -f set set.c
5029
5030: see if bzero exists
5031set bzero d_bzero
5032eval $inlibc
5033
5034: check for length of integer
5035echo " "
5036case "$intsize" in
5037'')
5038 echo "Checking to see how big your integers are..." >&4
5039 $cat >try.c <<'EOCP'
5040#include <stdio.h>
5041main()
5042{
5043 printf("%d\n", sizeof(int));
5044 exit(0);
5045}
5046EOCP
5047 if $cc $ccflags try.c -o try >/dev/null 2>&1 && ./try > /dev/null; then
5048 intsize=`./try`
5049 echo "Your integers are $intsize bytes long."
5050 else
5051 dflt='4'
5052 echo "(I can't seem to compile the test program. Guessing...)"
5053 rp="What is the size of an integer (in bytes)?"
5054 . ./myread
5055 intsize="$ans"
5056 fi
5057 ;;
5058esac
5059$rm -f try.c try
5060
5061: see if signal is declared as pointer to function returning int or void
5062echo " "
5063xxx=`./findhdr signal.h`
5064$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
5065if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
5066 echo "You have int (*signal())() instead of void." >&4
5067 val="$undef"
5068elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
5069 echo "You have void (*signal())() instead of int." >&4
5070 val="$define"
5071elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
5072 echo "You have int (*signal())() instead of void." >&4
5073 val="$undef"
5074else
5075 case "$d_voidsig" in
5076 '')
5077 echo "I can't determine whether signal handler returns void or int..." >&4
5078 dflt=void
5079 rp="What type does your signal handler return?"
5080 . ./myread
5081 case "$ans" in
5082 v*) val="$define";;
5083 *) val="$undef";;
5084 esac;;
5085 "$define")
5086 echo "As you already told me, signal handler returns void." >&4;;
5087 *)
5088 echo "As you already told me, signal handler returns int." >&4;;
5089 esac
5090fi
5091set d_voidsig
5092eval $setvar
5093case "$d_voidsig" in
5094"$define") signal_t="void";;
5095*) signal_t="int";;
5096esac
5097$rm -f $$.tmp
5098
5099: check for ability to cast large floats to 32-bit ints.
5100echo " "
5101echo 'Checking whether your C compiler can cast large floats to int32.' >&4
5102if $test "$intsize" -eq 4; then
5103 xxx=int
5104else
5105 xxx=long
5106fi
5107$cat >try.c <<EOCP
5108#include <sys/types.h>
5109#include <signal.h>
5110$signal_t blech() { exit(3); }
5111main()
5112{
5113 $xxx i32;
5114 double f;
5115 int result = 0;
5116 signal(SIGFPE, blech);
5117
5118 f = (double) 0x7fffffff;
5119 f = 10 * f;
5120 i32 = ($xxx) f;
5121
5122 if (i32 != ($xxx) f)
5123 result |= 1;
5124 exit(result);
5125}
5126EOCP
5127if $cc -o try $ccflags try.c >/dev/null 2>&1; then
5128 ./try
5129 yyy=$?
5130else
5131 echo "(I can't seem to compile the test program--assuming it can't)"
5132 yyy=1
5133fi
5134case "$yyy" in
51350) val="$define"
5136 echo "Yup, it can."
5137 ;;
5138*) val="$undef"
5139 echo "Nope, it can't."
5140 ;;
5141esac
5142set d_casti32
5143eval $setvar
5144$rm -f try try.*
5145
5146: check for ability to cast negative floats to unsigned
5147echo " "
5148echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
5149$cat >try.c <<EOCP
5150#include <sys/types.h>
5151#include <signal.h>
5152$signal_t blech() { exit(7); }
5153$signal_t blech_in_list() { exit(4); }
5154unsigned long dummy_long(p) unsigned long p; { return p; }
5155unsigned int dummy_int(p) unsigned int p; { return p; }
5156unsigned short dummy_short(p) unsigned short p; { return p; }
5157main()
5158{
5159 double f = -123.;
5160 unsigned long along;
5161 unsigned int aint;
5162 unsigned short ashort;
5163 int result = 0;
5164
5165 signal(SIGFPE, blech);
5166 along = (unsigned long)f;
5167 aint = (unsigned int)f;
5168 ashort = (unsigned short)f;
5169 if (along != (unsigned long)-123)
5170 result |= 1;
5171 if (aint != (unsigned int)-123)
5172 result |= 1;
5173 if (ashort != (unsigned short)-123)
5174 result |= 1;
5175 f = (double)0x40000000;
5176 f = f + f;
5177 along = 0;
5178 along = (unsigned long)f;
5179 if (along != 0x80000000)
5180 result |= 2;
5181 f -= 1.;
5182 along = 0;
5183 along = (unsigned long)f;
5184 if (along != 0x7fffffff)
5185 result |= 1;
5186 f += 2.;
5187 along = 0;
5188 along = (unsigned long)f;
5189 if (along != 0x80000001)
5190 result |= 2;
5191 if (result)
5192 exit(result);
5193 signal(SIGFPE, blech_in_list);
5194 f = 123.;
5195 along = dummy_long((unsigned long)f);
5196 aint = dummy_int((unsigned int)f);
5197 ashort = dummy_short((unsigned short)f);
5198 if (along != (unsigned long)123)
5199 result |= 4;
5200 if (aint != (unsigned int)123)
5201 result |= 4;
5202 if (ashort != (unsigned short)123)
5203 result |= 4;
5204 exit(result);
5205
5206}
5207EOCP
5208if $cc -o try $ccflags try.c >/dev/null 2>&1; then
5209 ./try
5210 castflags=$?
5211else
5212 echo "(I can't seem to compile the test program--assuming it can't)"
5213 castflags=7
5214fi
5215case "$castflags" in
52160) val="$define"
5217 echo "Yup, it can."
5218 ;;
5219*) val="$undef"
5220 echo "Nope, it can't."
5221 ;;
5222esac
5223set d_castneg
5224eval $setvar
5225$rm -f try.*
5226
5227: see if vprintf exists
5228echo " "
5229if set vprintf val -f d_vprintf; eval $csym; $val; then
5230 echo 'vprintf() found.' >&4
5231 val="$define"
5232 $cat >vprintf.c <<'EOF'
5233#include <varargs.h>
5234
5235main() { xxx("foo"); }
5236
5237xxx(va_alist)
5238va_dcl
5239{
5240 va_list args;
5241 char buf[10];
5242
5243 va_start(args);
5244 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
5245}
5246EOF
5247 if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then
5248 echo "Your vsprintf() returns (int)." >&4
5249 val2="$undef"
5250 else
5251 echo "Your vsprintf() returns (char*)." >&4
5252 val2="$define"
5253 fi
5254else
5255 echo 'vprintf() NOT found.' >&4
5256 val="$undef"
5257 val2="$undef"
5258fi
5259set d_vprintf
5260eval $setvar
5261val=$val2
5262set d_charvspr
5263eval $setvar
5264
5265: see if chown exists
5266set chown d_chown
5267eval $inlibc
5268
5269: see if chroot exists
5270set chroot d_chroot
5271eval $inlibc
5272
5273: see if chsize exists
5274set chsize d_chsize
5275eval $inlibc
5276
5277: check for const keyword
5278echo " "
5279echo 'Checking to see if your C compiler knows about "const"...' >&4
5280$cat >const.c <<'EOCP'
5281typedef struct spug { int drokk; } spug;
5282main()
5283{
5284 const char *foo;
5285 const spug y;
5286}
5287EOCP
5288if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
5289 val="$define"
5290 echo "Yup, it does."
5291else
5292 val="$undef"
5293 echo "Nope, it doesn't."
5294fi
5295set d_const
5296eval $setvar
5297
5298: see if crypt exists
5299echo " "
5300if set crypt val -f d_crypt; eval $csym; $val; then
5301 echo 'crypt() found.' >&4
5302 val="$define"
5303 cryptlib=''
5304else
5305 cryptlib=`./loc Slibcrypt.a "" $xlibpth`
5306 if $test -z "$cryptlib"; then
5307 cryptlib=`./loc Mlibcrypt.a "" $xlibpth`
5308 else
5309 cryptlib=-lcrypt
5310 fi
5311 if $test -z "$cryptlib"; then
5312 cryptlib=`./loc Llibcrypt.a "" $xlibpth`
5313 else
5314 cryptlib=-lcrypt
5315 fi
5316 if $test -z "$cryptlib"; then
5317 cryptlib=`./loc libcrypt.a "" $libpth`
5318 else
5319 cryptlib=-lcrypt
5320 fi
5321 if $test -z "$cryptlib"; then
5322 echo 'crypt() NOT found.' >&4
5323 val="$undef"
5324 else
5325 val="$define"
5326 fi
5327fi
5328set d_crypt
5329eval $setvar
5330
5331: get csh whereabouts
5332case "$csh" in
5333'csh') val="$undef" ;;
5334*) val="$define" ;;
5335esac
5336set d_csh
5337eval $setvar
5338full_csh=$csh
5339
5340: see if cuserid exists
5341set cuserid d_cuserid
5342eval $inlibc
5343
5344: define an alternate in-header-list? function
5345inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5346cont=true; xxf="echo \"<\$1> found.\" >&4";
5347case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5348*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5349esac;
5350case $# in 4) instead=instead;; *) instead="at last";; esac;
5351while $test "$cont"; do
5352 xxx=`./findhdr $1`
5353 var=$2; eval "was=\$$2";
5354 if $test "$xxx" && $test -r "$xxx";
5355 then eval $xxf;
5356 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5357 cont="";
5358 else eval $xxnf;
5359 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5360 set $yyy; shift; shift; yyy=$@;
5361 case $# in 0) cont="";;
5362 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5363 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5364 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5365 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5366 esac;
5367done;
5368while $test "$yyy";
5369do set $yyy; var=$2; eval "was=\$$2";
5370 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5371 set $yyy; shift; shift; yyy=$@;
5372done'
5373
5374: see if this is a limits.h system
5375set limits.h i_limits
5376eval $inhdr
5377
5378: see if this is a float.h system
5379set float.h i_float
5380eval $inhdr
5381
5382: See if number of significant digits in a double precision number is known
5383echo " "
5384$cat >dbl_dig.c <<EOM
5385#$i_limits I_LIMITS
5386#$i_float I_FLOAT
5387#ifdef I_LIMITS
5388#include <limits.h>
5389#endif
5390#ifdef I_FLOAT
5391#include <float.h>
5392#endif
5393#ifdef DBL_DIG
5394printf("Contains DBL_DIG");
5395#endif
5396EOM
5397$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
5398if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
5399 echo "DBL_DIG found." >&4
5400 val="$define"
5401else
5402 echo "DBL_DIG NOT found." >&4
5403 val="$undef"
5404fi
5405$rm -f dbl_dig.?
5406set d_dbl_dig
5407eval $setvar
5408
5409: see if difftime exists
5410set difftime d_difftime
5411eval $inlibc
5412
5413: see if this is a dirent system
5414echo " "
5415if xinc=`./findhdr dirent.h`; $test "$xinc"; then
5416 val="$define"
5417 echo "<dirent.h> found." >&4
5418else
5419 val="$undef"
5420 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
5421 echo "<sys/dir.h> found." >&4
5422 echo " "
5423 else
5424 xinc=`./findhdr sys/ndir.h`
5425 fi
5426 echo "<dirent.h> NOT found." >&4
5427fi
5428set i_dirent
5429eval $setvar
5430
5431: Look for type of directory structure.
5432echo " "
5433$cppstdin $cppflags $cppminus < "$xinc" > try.c
5434
5435case "$direntrytype" in
5436''|' ')
5437 case "$i_dirent" in
5438 $define) guess1='struct dirent' ;;
5439 *) guess1='struct direct' ;;
5440 esac
5441 ;;
5442*) guess1="$direntrytype"
5443 ;;
5444esac
5445
5446case "$guess1" in
5447'struct dirent') guess2='struct direct' ;;
5448*) guess2='struct dirent' ;;
5449esac
5450
5451if $contains "$guess1" try.c >/dev/null 2>&1; then
5452 direntrytype="$guess1"
5453 echo "Your directory entries are $direntrytype." >&4
5454elif $contains "$guess2" try.c >/dev/null 2>&1; then
5455 direntrytype="$guess2"
5456 echo "Your directory entries seem to be $direntrytype." >&4
5457else
5458 echo "I don't recognize your system's directory entries." >&4
5459 rp="What type is used for directory entries on this system?"
5460 dflt="$guess1"
5461 . ./myread
5462 direntrytype="$ans"
5463fi
5464$rm -f try.c
5465
5466
5467: see if the directory entry stores field length
5468echo " "
5469$cppstdin $cppflags $cppminus < "$xinc" > try.c
5470if $contains 'd_namlen' try.c >/dev/null 2>&1; then
5471 echo "Good, your directory entry keeps length information in d_namlen." >&4
5472 val="$define"
5473else
5474 echo "Your directory entry does not know about the d_namlen field." >&4
5475 val="$undef"
5476fi
5477set d_dirnamlen
5478eval $setvar
5479$rm -f try.c
5480
5481: see if dlerror exists
5482xxx_runnm="$runnm"
5483runnm=false
5484set dlerror d_dlerror
5485eval $inlibc
5486runnm="$xxx_runnm"
5487
5488: see if dld is available
5489set dld.h i_dld
5490eval $inhdr
5491
5492: see if dlopen exists
5493xxx_runnm="$runnm"
5494runnm=false
5495set dlopen d_dlopen
5496eval $inlibc
5497runnm="$xxx_runnm"
5498
5499: determine which dynamic loading, if any, to compile in
5500echo " "
5501dldir="ext/DynaLoader"
5502case "$usedl" in
5503$define|y|true)
5504 dflt='y'
5505 usedl="$define"
5506 ;;
5507$undef|n|false)
5508 dflt='n'
5509 usedl="$undef"
5510 ;;
5511*)
5512 dflt='n'
5513 case "$d_dlopen" in
5514 $define) dflt='y' ;;
5515 esac
5516 case "$i_dld" in
5517 $define) dflt='y' ;;
5518 esac
5519 : Does a dl_xxx.xs file exist for this operating system
5520 $test -f ../$dldir/dl_${osname}.xs && dflt='y'
5521 ;;
5522esac
5523rp="Do you wish to use dynamic loading?"
5524. ./myread
5525usedl="$ans"
5526case "$ans" in
5527y*) usedl="$define"
5528 case "$dlsrc" in
5529 '')
5530 if $test -f ../$dldir/dl_${osname}.xs ; then
5531 dflt="$dldir/dl_${osname}.xs"
5532 elif $test "$d_dlopen" = "$define" ; then
5533 dflt="$dldir/dl_dlopen.xs"
5534 elif $test "$i_dld" = "$define" ; then
5535 dflt="$dldir/dl_dld.xs"
5536 else
5537 dflt=''
5538 fi
5539 ;;
5540 *) dflt="$dldir/$dlsrc"
5541 ;;
5542 esac
5543 echo "The following dynamic loading files are available:"
5544 : Can not go over to $dldir because getfile has path hard-coded in.
5545 cd ..; ls -C $dldir/dl*.xs; cd UU
5546 rp="Source file to use for dynamic loading"
5547 fn="fne"
5548 . ./getfile
5549 usedl="$define"
5550 : emulate basename
5551 dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5552
5553 $cat << EOM
5554
5555Some systems may require passing special flags to $cc -c to
5556compile modules that will be used to create a shared library.
5557To use no flags, say "none".
5558
5559EOM
5560 case "$cccdlflags" in
5561 '') case "$gccversion" in
5562 '') case "$osname" in
5563 hpux) dflt='+z' ;;
5564 next) dflt='none' ;;
5565 solaris|svr4*|esix*) dflt='-Kpic' ;;
5566 irix*) dflt='-KPIC' ;;
5567 sunos) dflt='-pic' ;;
5568 *) dflt='none' ;;
5569 esac ;;
5570 *) dflt='-fpic' ;;
5571 esac ;;
5572 *) dflt="$cccdlflags" ;;
5573 esac
5574 rp="Any special flags to pass to $cc -c to compile shared library modules?"
5575 . ./myread
5576 case "$ans" in
5577 none) cccdlflags=' ' ;;
5578 *) cccdlflags="$ans" ;;
5579 esac
5580
5581 cat << EOM
5582
5583Some systems use ld to create libraries that can be dynamically loaded,
5584while other systems (such as those using ELF) use $cc.
5585
5586EOM
5587 case "$ld" in
5588 '') $cat >try.c <<'EOM'
5589/* Test for whether ELF binaries are produced */
5590#include <fcntl.h>
5591#include <stdlib.h>
5592main() {
5593 char b[4];
5594 int i = open("a.out",O_RDONLY);
5595 if(i == -1)
5596 exit(1); /* fail */
5597 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5598 exit(0); /* succeed (yes, it's ELF) */
5599 else
5600 exit(1); /* fail */
5601}
5602EOM
5603 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5604 cat <<EOM
5605You appear to have ELF support. I'll use $cc to build dynamic libraries.
5606EOM
5607 dflt="$cc"
5608 else
5609 echo "I'll use ld to build dynamic libraries."
5610 dflt='ld'
5611 fi
5612 rm -f try.c a.out
5613 ;;
5614 *) dflt="$ld"
5615 ;;
5616 esac
5617
5618 rp="What command should be used to create dynamic libraries?"
5619 . ./myread
5620 ld="$ans"
5621
5622 cat << EOM
5623
5624Some systems may require passing special flags to $ld to create a
5625library that can be dynamically loaded. If your ld flags include
5626-L/other/path options to locate libraries outside your loader's normal
5627search path, you may need to specify those -L options here as well. To
5628use no flags, say "none".
5629
5630EOM
5631 case "$lddlflags" in
5632 '') case "$osname" in
5633 hpux) dflt='-b' ;;
5634 linux|irix*) dflt='-shared' ;;
5635 next) dflt='none' ;;
5636 solaris) dflt='-G' ;;
5637 sunos) dflt='-assert nodefinitions' ;;
5638 svr4*|esix*) dflt="-G $ldflags" ;;
5639 *) dflt='none' ;;
5640 esac
5641 ;;
5642 *) dflt="$lddlflags" ;;
5643 esac
5644
5645: Try to guess additional flags to pick up local libraries.
5646for thisflag in $ldflags; do
5647 case "$thisflag" in
5648 -L*)
5649 case " $dflt " in
5650 *" $thisflag "*) ;;
5651 *) dflt="$dflt $thisflag" ;;
5652 esac
5653 ;;
5654 esac
5655done
5656
5657case "$dflt" in
5658'') dflt='none' ;;
5659esac
5660
5661 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5662 . ./myread
5663 case "$ans" in
5664 none) lddlflags=' ' ;;
5665 *) lddlflags="$ans" ;;
5666 esac
5667
5668 cat <<EOM
5669
5670Some systems may require passing special flags to $cc to indicate that
5671the resulting executable will use dynamic linking. To use no flags,
5672say "none".
5673
5674EOM
5675 case "$ccdlflags" in
5676 '') case "$osname" in
5677 hpux) dflt='-Wl,-E' ;;
5678 linux) dflt='-rdynamic' ;;
5679 next) dflt='none' ;;
5680 sunos) dflt='none' ;;
5681 *) dflt='none' ;;
5682 esac ;;
5683 *) dflt="$ccdlflags" ;;
5684 esac
5685 rp="Any special flags to pass to $cc to use dynamic loading?"
5686 . ./myread
5687 case "$ans" in
5688 none) ccdlflags=' ' ;;
5689 *) ccdlflags="$ans" ;;
5690 esac
5691 ;;
5692*) usedl="$undef"
5693 ld='ld'
5694 dlsrc='dl_none.xs'
5695 lddlflags=''
5696 ccdlflags=''
5697 ;;
5698esac
5699
5700: see if dlfcn is available
5701set dlfcn.h i_dlfcn
5702eval $inhdr
5703
5704case "$usedl" in
5705$define|y|true)
5706 $cat << EOM
5707
5708On a few systems, the dynamically loaded modules that perl generates and uses
5709will need a different extension then shared libs. The default will probably
5710be appropriate.
5711
5712EOM
5713 case "$dlext" in
5714 '') dflt="$so" ;;
5715 *) dflt="$dlext" ;;
5716 esac
5717 rp='What is the extension of dynamically loaded modules'
5718 . ./myread
5719 dlext="$ans"
5720 ;;
5721*)
5722 dlext="none"
5723 ;;
5724esac
5725
5726: Define several unixisms. Hints files or command line options
5727: can be used to override them.
5728case "$ar" in
5729'') ar='ar';;
5730esac
5731case "$lib_ext" in
5732'') lib_ext='.a';;
5733esac
5734case "$obj_ext" in
5735'') obj_ext='.o';;
5736esac
5737case "$path_sep" in
5738'') path_sep=':';;
5739esac
5740: Which makefile gets called first. This is used by make depend.
5741case "$firstmakefile" in
5742'') firstmakefile='makefile';;
5743esac
5744
5745: Check if dlsym need a leading underscore
5746echo " "
5747val="$undef"
5748
5749case "$dlsrc" in
5750dl_dlopen.xs)
5751 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
5752 $cat >dyna.c <<'EOM'
5753fred () { }
5754EOM
5755
5756$cat >fred.c<<EOM
5757
5758#include <stdio.h>
5759#$i_dlfcn I_DLFCN
5760#ifdef I_DLFCN
5761#include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
5762#else
5763#include <sys/types.h>
5764#include <nlist.h>
5765#include <link.h>
5766#endif
5767
5768extern int fred() ;
5769
5770main()
5771{
5772 void * handle ;
5773 void * symbol ;
5774#ifndef RTLD_LAZY
5775 int mode = 1 ;
5776#else
5777 int mode = RTLD_LAZY ;
5778#endif
5779 handle = dlopen("./dyna.$dlext", mode) ;
5780 if (handle == NULL) {
5781 printf ("1\n") ;
5782 exit(0);
5783 }
5784 symbol = dlsym(handle, "fred") ;
5785 if (symbol == NULL) {
5786 /* try putting a leading underscore */
5787 symbol = dlsym(handle, "_fred") ;
5788 if (symbol == NULL) {
5789 printf ("2\n") ;
5790 exit(0);
5791 }
5792 printf ("3\n") ;
5793 }
5794 else
5795 printf ("4\n") ;
5796 exit(0);
5797}
5798EOM
5799 : Call the object file tmp-dyna.o in case dlext=o.
5800 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
5801 mv dyna${obj_ext} tmp-dyna${obj_ext} > /dev/null 2>&1 &&
5802 $ld $lddlflags -o dyna.$dlext tmp-dyna${obj_ext} > /dev/null 2>&1 &&
5803 $cc $ccflags $ldflags $cccdlflags $ccdlflags fred.c -o fred $libs > /dev/null 2>&1; then
5804 xxx=`./fred`
5805 case $xxx in
5806 1) echo "Test program failed using dlopen." >&4
5807 echo "Perhaps you should not use dynamic loading." >&4;;
5808 2) echo "Test program failed using dlsym." >&4
5809 echo "Perhaps you should not use dynamic loading." >&4;;
5810 3) echo "dlsym needs a leading underscore" >&4
5811 val="$define" ;;
5812 4) echo "dlsym doesn't need a leading underscore." >&4;;
5813 esac
5814 else
5815 echo "I can't compile and run the test program." >&4
5816 fi
5817 ;;
5818esac
5819
5820$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
5821
5822set d_dlsymun
5823eval $setvar
5824
5825: see if dup2 exists
5826set dup2 d_dup2
5827eval $inlibc
5828
5829: Locate the flags for 'open()'
5830echo " "
5831$cat >open3.c <<'EOCP'
5832#include <sys/types.h>
5833#ifdef I_FCNTL
5834#include <fcntl.h>
5835#endif
5836#ifdef I_SYS_FILE
5837#include <sys/file.h>
5838#endif
5839main() {
5840 if(O_RDONLY);
5841#ifdef O_TRUNC
5842 exit(0);
5843#else
5844 exit(1);
5845#endif
5846}
5847EOCP
5848: check sys/file.h first to get FREAD on Sun
5849if $test `./findhdr sys/file.h` && \
5850 $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then
5851 h_sysfile=true;
5852 echo "<sys/file.h> defines the O_* constants..." >&4
5853 if ./open3; then
5854 echo "and you have the 3 argument form of open()." >&4
5855 val="$define"
5856 else
5857 echo "but not the 3 argument form of open(). Oh, well." >&4
5858 val="$undef"
5859 fi
5860elif $test `./findhdr fcntl.h` && \
5861 $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then
5862 h_fcntl=true;
5863 echo "<fcntl.h> defines the O_* constants..." >&4
5864 if ./open3; then
5865 echo "and you have the 3 argument form of open()." >&4
5866 val="$define"
5867 else
5868 echo "but not the 3 argument form of open(). Oh, well." >&4
5869 val="$undef"
5870 fi
5871else
5872 val="$undef"
5873 echo "I can't find the O_* constant definitions! You got problems." >&4
5874fi
5875set d_open3
5876eval $setvar
5877$rm -f open3*
5878
5879: check for non-blocking I/O stuff
5880case "$h_sysfile" in
5881true) echo "#include <sys/file.h>" > head.c;;
5882*)
5883 case "$h_fcntl" in
5884 true) echo "#include <fcntl.h>" > head.c;;
5885 *) echo "#include <sys/fcntl.h>" > head.c;;
5886 esac
5887 ;;
5888esac
5889echo " "
5890echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
5891case "$o_nonblock" in
5892'')
5893 $cat head.c > try.c
5894 $cat >>try.c <<'EOCP'
5895main() {
5896#ifdef O_NONBLOCK
5897 printf("O_NONBLOCK\n");
5898 exit(0);
5899#endif
5900#ifdef O_NDELAY
5901 printf("O_NDELAY\n");
5902 exit(0);
5903#endif
5904#ifdef FNDELAY
5905 printf("FNDELAY\n");
5906 exit(0);
5907#endif
5908 exit(0);
5909}
5910EOCP
5911 if $cc $ccflags $ldflags try.c -o try >/dev/null 2>&1; then
5912 o_nonblock=`./try`
5913 case "$o_nonblock" in
5914 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
5915 *) echo "Seems like we can use $o_nonblock.";;
5916 esac
5917 else
5918 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
5919 fi
5920 ;;
5921*) echo "Using $hint value $o_nonblock.";;
5922esac
5923$rm -f try try.* .out core
5924
5925echo " "
5926echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
5927case "$eagain" in
5928'')
5929 $cat head.c > try.c
5930 $cat >>try.c <<EOCP
5931#include <errno.h>
5932#include <sys/types.h>
5933#include <signal.h>
5934#define MY_O_NONBLOCK $o_nonblock
5935extern int errno;
5936$signal_t blech(x) int x; { exit(3); }
5937EOCP
5938 $cat >> try.c <<'EOCP'
5939main()
5940{
5941 int pd[2];
5942 int pu[2];
5943 char buf[1];
5944 char string[100];
5945
5946 pipe(pd); /* Down: child -> parent */
5947 pipe(pu); /* Up: parent -> child */
5948 if (0 != fork()) {
5949 int ret;
5950 close(pd[1]); /* Parent reads from pd[0] */
5951 close(pu[0]); /* Parent writes (blocking) to pu[1] */
5952 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
5953 exit(1);
5954 signal(SIGALRM, blech);
5955 alarm(5);
5956 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
5957 exit(2);
5958 sprintf(string, "%d\n", ret);
5959 write(2, string, strlen(string));
5960 alarm(0);
5961#ifdef EAGAIN
5962 if (errno == EAGAIN) {
5963 printf("EAGAIN\n");
5964 goto ok;
5965 }
5966#endif
5967#ifdef EWOULDBLOCK
5968 if (errno == EWOULDBLOCK)
5969 printf("EWOULDBLOCK\n");
5970#endif
5971 ok:
5972 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
5973 sleep(2); /* Give it time to close our pipe */
5974 alarm(5);
5975 ret = read(pd[0], buf, 1); /* Should read EOF */
5976 alarm(0);
5977 sprintf(string, "%d\n", ret);
5978 write(3, string, strlen(string));
5979 exit(0);
5980 }
5981
5982 close(pd[0]); /* We write to pd[1] */
5983 close(pu[1]); /* We read from pu[0] */
5984 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
5985 close(pd[1]); /* Pipe pd is now fully closed! */
5986 exit(0); /* Bye bye, thank you for playing! */
5987}
5988EOCP
5989 if $cc $ccflags $ldflags try.c -o try >/dev/null 2>&1; then
5990 echo "$startsh" >mtry
5991 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
5992 chmod +x mtry
5993 ./mtry >/dev/null 2>&1
5994 case $? in
5995 0) eagain=`$cat try.out`;;
5996 1) echo "Could not perform non-blocking setting!";;
5997 2) echo "I did a successful read() for something that was not there!";;
5998 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
5999 *) echo "Something terribly wrong happened during testing.";;
6000 esac
6001 rd_nodata=`$cat try.ret`
6002 echo "A read() system call with no data present returns $rd_nodata."
6003 case "$rd_nodata" in
6004 0|-1) ;;
6005 *)
6006 echo "(That's peculiar, fixing that to be -1.)"
6007 rd_nodata=-1
6008 ;;
6009 esac
6010 case "$eagain" in
6011 '')
6012 echo "Forcing errno EAGAIN on read() with no data available."
6013 eagain=EAGAIN
6014 ;;
6015 *)
6016 echo "Your read() sets errno to $eagain when no data is available."
6017 ;;
6018 esac
6019 status=`$cat try.err`
6020 case "$status" in
6021 0) echo "And it correctly returns 0 to signal EOF.";;
6022 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
6023 *) echo "However, your read() returns '$status' on EOF??";;
6024 esac
6025 val="$define"
6026 if test "$status" -eq "$rd_nodata"; then
6027 echo "WARNING: you can't distinguish between EOF and no data!"
6028 val="$undef"
6029 fi
6030 else
6031 echo "I can't compile the test program--assuming errno EAGAIN will do."
6032 eagain=EAGAIN
6033 fi
6034 set d_eofnblk
6035 eval $setvar
6036 ;;
6037*)
6038 echo "Using $hint value $eagain."
6039 echo "Your read() returns $rd_nodata when no data is present."
6040 case "$d_eofnblk" in
6041 "$define") echo "And you can see EOF because read() returns 0.";;
6042 "$undef") echo "But you can't see EOF status from read() returned value.";;
6043 *)
6044 echo "(Assuming you can't see EOF status from read anyway.)"
6045 d_eofnblk=$undef
6046 ;;
6047 esac
6048 ;;
6049esac
6050$rm -f try try.* .out core head.c mtry
6051
6052: see if fchmod exists
6053set fchmod d_fchmod
6054eval $inlibc
6055
6056: see if fchown exists
6057set fchown d_fchown
6058eval $inlibc
6059
6060: see if this is an fcntl system
6061set fcntl d_fcntl
6062eval $inlibc
6063
6064: see if fgetpos exists
6065set fgetpos d_fgetpos
6066eval $inlibc
6067
6068: see if flock exists
6069set flock d_flock
6070eval $inlibc
6071
6072: see if fork exists
6073set fork d_fork
6074eval $inlibc
6075
6076: see if pathconf exists
6077set pathconf d_pathconf
6078eval $inlibc
6079
6080: see if fpathconf exists
6081set fpathconf d_fpathconf
6082eval $inlibc
6083
6084: see if fsetpos exists
6085set fsetpos d_fsetpos
6086eval $inlibc
6087
6088: see if gethostent exists
6089set gethostent d_gethent
6090eval $inlibc
6091
6092: see if getlogin exists
6093set getlogin d_getlogin
6094eval $inlibc
6095
6096: see if getpgrp exists
6097set getpgrp d_getpgrp
6098eval $inlibc
6099
6100: see if getpgrp2 exists
6101set getpgrp2 d_getpgrp2
6102eval $inlibc
6103
6104: see if getppid exists
6105set getppid d_getppid
6106eval $inlibc
6107
6108: see if getpriority exists
6109set getpriority d_getprior
6110eval $inlibc
6111
6112: see if this is a netinet/in.h or sys/in.h system
6113set netinet/in.h i_niin sys/in.h i_sysin
6114eval $inhdr
6115
6116: see if htonl --and friends-- exists
6117val=''
6118set htonl val
6119eval $inlibc
6120
6121: Maybe they are macros.
6122case "$val" in
6123$undef)
6124 $cat >htonl.c <<EOM
6125#include <stdio.h>
6126#include <sys/types.h>
6127#$i_niin I_NETINET_IN
6128#$i_sysin I_SYS_IN
6129#ifdef I_NETINET_IN
6130#include <netinet/in.h>
6131#endif
6132#ifdef I_SYS_IN
6133#include <sys/in.h>
6134#endif
6135#ifdef htonl
6136printf("Defined as a macro.");
6137#endif
6138EOM
6139 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
6140 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
6141 val="$define"
6142 echo "But it seems to be defined as a macro." >&4
6143 fi
6144 $rm -f htonl.?
6145 ;;
6146esac
6147set d_htonl
6148eval $setvar
6149
6150: see which of string.h or strings.h is needed
6151echo " "
6152strings=`./findhdr string.h`
6153if $test "$strings" && $test -r "$strings"; then
6154 echo "Using <string.h> instead of <strings.h>." >&4
6155 val="$define"
6156else
6157 val="$undef"
6158 strings=`./findhdr strings.h`
6159 if $test "$strings" && $test -r "$strings"; then
6160 echo "Using <strings.h> instead of <string.h>." >&4
6161 else
6162 echo "No string header found -- You'll surely have problems." >&4
6163 fi
6164fi
6165set i_string
6166eval $setvar
6167case "$i_string" in
6168"$undef") strings=`./findhdr strings.h`;;
6169*) strings=`./findhdr string.h`;;
6170esac
6171
6172: index or strchr
6173echo " "
6174if set index val -f; eval $csym; $val; then
6175 if set strchr val -f d_strchr; eval $csym; $val; then
6176 if $contains strchr "$strings" >/dev/null 2>&1 ; then
6177 val="$define"
6178 vali="$undef"
6179 echo "strchr() found." >&4
6180 else
6181 val="$undef"
6182 vali="$define"
6183 echo "index() found." >&4
6184 fi
6185 else
6186 val="$undef"
6187 vali="$define"
6188 echo "index() found." >&4
6189 fi
6190else
6191 if set strchr val -f d_strchr; eval $csym; $val; then
6192 val="$define"
6193 vali="$undef"
6194 echo "strchr() found." >&4
6195 else
6196 echo "No index() or strchr() found!" >&4
6197 val="$undef"
6198 vali="$undef"
6199 fi
6200fi
6201set d_strchr; eval $setvar
6202val="$vali"
6203set d_index; eval $setvar
6204
6205: Look for isascii
6206echo " "
6207$cat >isascii.c <<'EOCP'
6208#include <stdio.h>
6209#include <ctype.h>
6210main() {
6211 int c = 'A';
6212 if (isascii(c))
6213 exit(0);
6214 else
6215 exit(1);
6216}
6217EOCP
6218if $cc $ccflags $ldflags -o isascii isascii.c $libs >/dev/null 2>&1 ; then
6219 echo "isascii() found." >&4
6220 val="$define"
6221else
6222 echo "isascii() NOT found." >&4
6223 val="$undef"
6224fi
6225set d_isascii
6226eval $setvar
6227$rm -f isascii*
6228
6229: see if killpg exists
6230set killpg d_killpg
6231eval $inlibc
6232
6233: see if link exists
6234set link d_link
6235eval $inlibc
6236
6237: see if localeconv exists
6238set localeconv d_locconv
6239eval $inlibc
6240
6241: see if lockf exists
6242set lockf d_lockf
6243eval $inlibc
6244
6245: see if lstat exists
6246set lstat d_lstat
6247eval $inlibc
6248
6249: see if mblen exists
6250set mblen d_mblen
6251eval $inlibc
6252
6253: see if mbstowcs exists
6254set mbstowcs d_mbstowcs
6255eval $inlibc
6256
6257: see if mbtowc exists
6258set mbtowc d_mbtowc
6259eval $inlibc
6260
6261: see if memcmp exists
6262set memcmp d_memcmp
6263eval $inlibc
6264
6265: see if memcpy exists
6266set memcpy d_memcpy
6267eval $inlibc
6268
6269: see if memmove exists
6270set memmove d_memmove
6271eval $inlibc
6272
6273: see if memset exists
6274set memset d_memset
6275eval $inlibc
6276
6277: see if mkdir exists
6278set mkdir d_mkdir
6279eval $inlibc
6280
6281: see if mkfifo exists
6282set mkfifo d_mkfifo
6283eval $inlibc
6284
6285: see if mktime exists
6286set mktime d_mktime
6287eval $inlibc
6288
6289: see if msgctl exists
6290set msgctl d_msgctl
6291eval $inlibc
6292
6293: see if msgget exists
6294set msgget d_msgget
6295eval $inlibc
6296
6297: see if msgsnd exists
6298set msgsnd d_msgsnd
6299eval $inlibc
6300
6301: see if msgrcv exists
6302set msgrcv d_msgrcv
6303eval $inlibc
6304
6305: see how much of the 'msg*(2)' library is present.
6306h_msg=true
6307echo " "
6308case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
6309*"$undef"*) h_msg=false;;
6310esac
6311: we could also check for sys/ipc.h ...
6312if $h_msg && $test `./findhdr sys/msg.h`; then
6313 echo "You have the full msg*(2) library." >&4
6314 val="$define"
6315else
6316 echo "You don't have the full msg*(2) library." >&4
6317 val="$undef"
6318fi
6319set d_msg
6320eval $setvar
6321
6322: see if this is a malloc.h system
6323set malloc.h i_malloc
6324eval $inhdr
6325
6326: see if stdlib is available
6327set stdlib.h i_stdlib
6328eval $inhdr
6329
6330: determine which malloc to compile in
6331echo " "
6332case "$usemymalloc" in
6333''|y*|true) dflt='y' ;;
6334n*|false) dflt='n' ;;
6335*) dflt="$usemymalloc" ;;
6336esac
6337rp="Do you wish to attempt to use the malloc that comes with $package?"
6338. ./myread
6339usemymalloc="$ans"
6340case "$ans" in
6341y*|true)
6342 usemymalloc='y'
6343 mallocsrc='malloc.c'
6344 mallocobj='malloc.o'
6345 d_mymalloc="$define"
6346 case "$libs" in
6347 *-lmalloc*)
6348 : Remove malloc from list of libraries to use
6349 echo "Removing unneeded -lmalloc from library list" >&4
6350 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6351 shift
6352 libs="$*"
6353 echo "libs = $libs" >&4
6354 ;;
6355 esac
6356 ;;
6357*)
6358 usemymalloc='n'
6359 mallocsrc=''
6360 mallocobj=''
6361 d_mymalloc="$undef"
6362 ;;
6363esac
6364
6365: compute the return types of malloc and free
6366echo " "
6367$cat >malloc.c <<END
6368#$i_malloc I_MALLOC
6369#$i_stdlib I_STDLIB
6370#include <stdio.h>
6371#include <sys/types.h>
6372#ifdef I_MALLOC
6373#include <malloc.h>
6374#endif
6375#ifdef I_STDLIB
6376#include <stdlib.h>
6377#endif
6378#ifdef TRY_MALLOC
6379void *malloc();
6380#endif
6381#ifdef TRY_FREE
6382void free();
6383#endif
6384END
6385case "$malloctype" in
6386'')
6387 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6388 malloctype='void *'
6389 else
6390 malloctype='char *'
6391 fi
6392 ;;
6393esac
6394echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6395
6396case "$freetype" in
6397'')
6398 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6399 freetype='void'
6400 else
6401 freetype='int'
6402 fi
6403 ;;
6404esac
6405echo "Your system uses $freetype free(), it would seem." >&4
6406$rm -f malloc.[co]
6407: see if nice exists
6408set nice d_nice
6409eval $inlibc
6410
6411: see if pause exists
6412set pause d_pause
6413eval $inlibc
6414
6415: see if pipe exists
6416set pipe d_pipe
6417eval $inlibc
6418
6419: see if poll exists
6420set poll d_poll
6421eval $inlibc
6422
6423: see if this is a pwd.h system
6424set pwd.h i_pwd
6425eval $inhdr
6426
6427case "$i_pwd" in
6428$define)
6429 xxx=`./findhdr pwd.h`
6430 $cppstdin $cppflags $cppminus < $xxx >$$.h
6431
6432 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
6433 val="$define"
6434 else
6435 val="$undef"
6436 fi
6437 set d_pwquota
6438 eval $setvar
6439
6440 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
6441 val="$define"
6442 else
6443 val="$undef"
6444 fi
6445 set d_pwage
6446 eval $setvar
6447
6448 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
6449 val="$define"
6450 else
6451 val="$undef"
6452 fi
6453 set d_pwchange
6454 eval $setvar
6455
6456 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
6457 val="$define"
6458 else
6459 val="$undef"
6460 fi
6461 set d_pwclass
6462 eval $setvar
6463
6464 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
6465 val="$define"
6466 else
6467 val="$undef"
6468 fi
6469 set d_pwexpire
6470 eval $setvar
6471
6472 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
6473 val="$define"
6474 else
6475 val="$undef"
6476 fi
6477 set d_pwcomment
6478 eval $setvar
6479
6480 $rm -f $$.h
6481 ;;
6482*)
6483 val="$undef";
6484 set d_pwquota; eval $setvar
6485 set d_pwage; eval $setvar
6486 set d_pwchange; eval $setvar
6487 set d_pwclass; eval $setvar
6488 set d_pwexpire; eval $setvar
6489 set d_pwcomment; eval $setvar
6490 ;;
6491esac
6492
6493: see if readdir and friends exist
6494set readdir d_readdir
6495eval $inlibc
6496set seekdir d_seekdir
6497eval $inlibc
6498set telldir d_telldir
6499eval $inlibc
6500set rewinddir d_rewinddir
6501eval $inlibc
6502
6503: see if readlink exists
6504set readlink d_readlink
6505eval $inlibc
6506
6507: see if rename exists
6508set rename d_rename
6509eval $inlibc
6510
6511: see if rmdir exists
6512set rmdir d_rmdir
6513eval $inlibc
6514
6515: see if memory.h is available.
6516val=''
6517set memory.h val
6518eval $inhdr
6519
6520: See if it conflicts with string.h
6521case "$val" in
6522$define)
6523 case "$strings" in
6524 '') ;;
6525 *)
6526 $cppstdin $cppflags $cppminus < $strings > mem.h
6527 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
6528 echo " "
6529 echo "We won't be including <memory.h>."
6530 val="$undef"
6531 fi
6532 $rm -f mem.h
6533 ;;
6534 esac
6535esac
6536set i_memory
6537eval $setvar
6538
6539: see if this is a unistd.h system
6540set unistd.h i_unistd
6541eval $inhdr
6542
6543: can bcopy handle overlapping blocks?
6544val="$undef"
6545case "$d_bcopy" in
6546"$define")
6547 echo " "
6548 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
6549 $cat >foo.c <<EOCP
6550#$i_memory I_MEMORY
6551#$i_stdlib I_STDLIB
6552#$i_string I_STRING
6553#$i_unistd I_UNISTD
6554EOCP
6555 $cat >>foo.c <<'EOCP'
6556#include <stdio.h>
6557
6558#ifdef I_MEMORY
6559# include <memory.h>
6560#endif
6561#ifdef I_STDLIB
6562# include <stdlib.h>
6563#endif
6564#ifdef I_STRING
6565# include <string.h>
6566#else
6567# include <strings.h>
6568#endif
6569#ifdef I_UNISTD
6570# include <unistd.h> /* Needed for NetBSD */
6571#endif
6572main()
6573{
6574char buf[128], abc[128];
6575char *b;
6576int len;
6577int off;
6578int align;
6579
6580/* Copy "abcde..." string to char abc[] so that gcc doesn't
6581 try to store the string in read-only memory. */
6582bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
6583
6584for (align = 7; align >= 0; align--) {
6585 for (len = 36; len; len--) {
6586 b = buf+align;
6587 bcopy(abc, b, len);
6588 for (off = 1; off <= len; off++) {
6589 bcopy(b, b+off, len);
6590 bcopy(b+off, b, len);
6591 if (bcmp(b, abc, len))
6592 exit(1);
6593 }
6594 }
6595}
6596exit(0);
6597}
6598EOCP
6599 if $cc $ccflags $ldflags foo.c -o safebcpy $libs >/dev/null 2>&1; then
6600 if ./safebcpy 2>/dev/null; then
6601 echo "Yes, it can."
6602 val="$define"
6603 else
6604 echo "It can't, sorry."
6605 case "$d_memmove" in
6606 "$define") echo "But that's Ok since you have memmove()." ;;
6607 esac
6608 fi
6609 else
6610 echo "(I can't compile the test program, so we'll assume not...)"
6611 case "$d_memmove" in
6612 "$define") echo "But that's Ok since you have memmove()." ;;
6613 esac
6614 fi
6615 ;;
6616esac
6617$rm -f foo.* safebcpy core
6618set d_safebcpy
6619eval $setvar
6620
6621: can memcpy handle overlapping blocks?
6622val="$undef"
6623case "$d_memcpy" in
6624"$define")
6625 echo " "
6626 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
6627 $cat >foo.c <<EOCP
6628#$i_memory I_MEMORY
6629#$i_stdlib I_STDLIB
6630#$i_string I_STRING
6631#$i_unistd I_UNISTD
6632EOCP
6633 $cat >>foo.c <<'EOCP'
6634#include <stdio.h>
6635
6636#ifdef I_MEMORY
6637# include <memory.h>
6638#endif
6639#ifdef I_STDLIB
6640# include <stdlib.h>
6641#endif
6642#ifdef I_STRING
6643# include <string.h>
6644#else
6645# include <strings.h>
6646#endif
6647#ifdef I_UNISTD
6648# include <unistd.h> /* Needed for NetBSD */
6649#endif
6650main()
6651{
6652char buf[128], abc[128];
6653char *b;
6654int len;
6655int off;
6656int align;
6657
6658/* Copy "abcde..." string to char abc[] so that gcc doesn't
6659 try to store the string in read-only memory. */
6660memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
6661
6662for (align = 7; align >= 0; align--) {
6663 for (len = 36; len; len--) {
6664 b = buf+align;
6665 memcpy(b, abc, len);
6666 for (off = 1; off <= len; off++) {
6667 memcpy(b+off, b, len);
6668 memcpy(b, b+off, len);
6669 if (memcmp(b, abc, len))
6670 exit(1);
6671 }
6672 }
6673}
6674exit(0);
6675}
6676EOCP
6677 if $cc $ccflags $ldflags foo.c -o safemcpy $libs >/dev/null 2>&1; then
6678 if ./safemcpy 2>/dev/null; then
6679 echo "Yes, it can."
6680 val="$define"
6681 else
6682 echo "It can't, sorry."
6683 case "$d_memmove" in
6684 "$define") echo "But that's Ok since you have memmove()." ;;
6685 esac
6686 fi
6687 else
6688 echo "(I can't compile the test program, so we'll assume not...)"
6689 case "$d_memmove" in
6690 "$define") echo "But that's Ok since you have memmove()." ;;
6691 esac
6692 fi
6693 ;;
6694esac
6695$rm -f foo.* safemcpy core
6696set d_safemcpy
6697eval $setvar
6698
6699: see if select exists
6700set select d_select
6701eval $inlibc
6702
6703: see if semctl exists
6704set semctl d_semctl
6705eval $inlibc
6706
6707: see if semget exists
6708set semget d_semget
6709eval $inlibc
6710
6711: see if semop exists
6712set semop d_semop
6713eval $inlibc
6714
6715: see how much of the 'sem*(2)' library is present.
6716h_sem=true
6717echo " "
6718case "$d_semctl$d_semget$d_semop" in
6719*"$undef"*) h_sem=false;;
6720esac
6721: we could also check for sys/ipc.h ...
6722if $h_sem && $test `./findhdr sys/sem.h`; then
6723 echo "You have the full sem*(2) library." >&4
6724 val="$define"
6725else
6726 echo "You don't have the full sem*(2) library." >&4
6727 val="$undef"
6728fi
6729set d_sem
6730eval $setvar
6731
6732: see if setegid exists
6733set setegid d_setegid
6734eval $inlibc
6735
6736: see if seteuid exists
6737set seteuid d_seteuid
6738eval $inlibc
6739
6740: see if setlinebuf exists
6741set setlinebuf d_setlinebuf
6742eval $inlibc
6743
6744: see if setlocale exists
6745set setlocale d_setlocale
6746eval $inlibc
6747
6748: see if setpgid exists
6749set setpgid d_setpgid
6750eval $inlibc
6751
6752: see if setpgrp2 exists
6753set setpgrp2 d_setpgrp2
6754eval $inlibc
6755
6756: see if setpriority exists
6757set setpriority d_setprior
6758eval $inlibc
6759
6760: see if setregid exists
6761set setregid d_setregid
6762eval $inlibc
6763set setresgid d_setresgid
6764eval $inlibc
6765
6766: see if setreuid exists
6767set setreuid d_setreuid
6768eval $inlibc
6769set setresuid d_setresuid
6770eval $inlibc
6771
6772: see if setrgid exists
6773set setrgid d_setrgid
6774eval $inlibc
6775
6776: see if setruid exists
6777set setruid d_setruid
6778eval $inlibc
6779
6780: see if setsid exists
6781set setsid d_setsid
6782eval $inlibc
6783
6784: see if sfio.h is available
6785set sfio.h i_sfio
6786eval $inhdr
6787
6788
6789: see if sfio library is available
6790case "$i_sfio" in
6791$define)
6792 val=''
6793 set sfreserve val
6794 eval $inlibc
6795 ;;
6796*)
6797 val="$undef"
6798 ;;
6799esac
6800: Ok, but do we want to use it.
6801case "$val" in
6802$define)
6803 case "$usesfio" in
6804 true|$define|[yY]*) dflt='y';;
6805 *) dflt='n';;
6806 esac
6807 echo "$package can use the sfio library, but it is experimental."
6808 rp="You seem to have sfio available, do you want to try using it?"
6809 . ./myread
6810 case "$ans" in
6811 y|Y) ;;
6812 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
6813 val="$undef"
6814 ;;
6815 esac
6816 ;;
6817*) case "$usesfio" in
6818 true|$define|[yY]*)
6819 echo "Sorry, cannot find sfio on this machine" >&4
6820 echo "Ignoring your setting of usesfio=$usesfio" >&4
6821 ;;
6822 esac
6823 ;;
6824esac
6825set d_sfio
6826eval $setvar
6827case "$d_sfio" in
6828$define) usesfio='true';;
6829*) usesfio='false';;
6830esac
6831
6832: see if shmctl exists
6833set shmctl d_shmctl
6834eval $inlibc
6835
6836: see if shmget exists
6837set shmget d_shmget
6838eval $inlibc
6839
6840: see if shmat exists
6841set shmat d_shmat
6842eval $inlibc
6843: see what shmat returns
6844case "$d_shmat" in
6845"$define")
6846 $cat >shmat.c <<'END'
6847#include <sys/shm.h>
6848void *shmat();
6849END
6850 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
6851 shmattype='void *'
6852 else
6853 shmattype='char *'
6854 fi
6855 echo "and it returns ($shmattype)." >&4
6856 : see if a prototype for shmat is available
6857 xxx=`./findhdr sys/shm.h`
6858 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
6859 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
6860 val="$define"
6861 else
6862 val="$undef"
6863 fi
6864 $rm -f shmat.[co]
6865 ;;
6866*)
6867 val="$undef"
6868 ;;
6869esac
6870set d_shmatprototype
6871eval $setvar
6872
6873: see if shmdt exists
6874set shmdt d_shmdt
6875eval $inlibc
6876
6877: see how much of the 'shm*(2)' library is present.
6878h_shm=true
6879echo " "
6880case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
6881*"$undef"*) h_shm=false;;
6882esac
6883: we could also check for sys/ipc.h ...
6884if $h_shm && $test `./findhdr sys/shm.h`; then
6885 echo "You have the full shm*(2) library." >&4
6886 val="$define"
6887else
6888 echo "You don't have the full shm*(2) library." >&4
6889 val="$undef"
6890fi
6891set d_shm
6892eval $setvar
6893
6894echo " "
6895: see if we have sigaction
6896if set sigaction val -f d_sigaction; eval $csym; $val; then
6897 echo 'sigaction() found.' >&4
6898 val="$define"
6899else
6900 echo 'sigaction NOT found.' >&4
6901 val="$undef"
6902fi
6903
6904$cat > set.c <<'EOP'
6905/* Solaris 2.5_x86 with SunWorks Pro C 3.0.1 doesn't have a complete
6906 sigaction structure if compiled with cc -Xc. This compile test
6907 will fail then. <doughera@lafcol.lafayette.edu>
6908*/
6909#include <stdio.h>
6910#include <sys/types.h>
6911#include <signal.h>
6912main()
6913{
6914 struct sigaction act, oact;
6915}
6916EOP
6917
6918if $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1; then
6919 :
6920else
6921 echo "But you don't seem to have a useable struct sigaction." >&4
6922 val="$undef"
6923fi
6924set d_sigaction; eval $setvar
6925$rm -f set set.o set.c
6926
6927: see if sigsetjmp exists
6928echo " "
6929case "$d_sigsetjmp" in
6930'')
6931 $cat >set.c <<'EOP'
6932#include <setjmp.h>
6933sigjmp_buf env;
6934int set = 1;
6935main()
6936{
6937 if (sigsetjmp(env,1))
6938 exit(set);
6939 set = 0;
6940 siglongjmp(env, 1);
6941 exit(1);
6942}
6943EOP
6944 if $cc $ccflags $ldflags -o set set.c $libs > /dev/null 2>&1 ; then
6945 if ./set >/dev/null 2>&1; then
6946 echo "POSIX sigsetjmp found." >&4
6947 val="$define"
6948 else
6949 $cat >&4 <<EOM
6950Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
6951I'll ignore them.
6952EOM
6953 val="$undef"
6954 fi
6955 else
6956 echo "sigsetjmp not found." >&4
6957 val="$undef"
6958 fi
6959 ;;
6960*) val="$d_sigsetjmp"
6961 case "$d_sigsetjmp" in
6962 $define) echo "POSIX sigsetjmp found." >&4;;
6963 $undef) echo "sigsetjmp not found." >&4;;
6964 esac
6965 ;;
6966esac
6967set d_sigsetjmp
6968eval $setvar
6969$rm -f set.c set
6970
6971socketlib=''
6972sockethdr=''
6973: see whether socket exists
6974echo " "
6975$echo $n "Hmm... $c" >&4
6976if set socket val -f d_socket; eval $csym; $val; then
6977 echo "Looks like you have Berkeley networking support." >&4
6978 d_socket="$define"
6979 if set setsockopt val -f; eval $csym; $val; then
6980 d_oldsock="$undef"
6981 else
6982 echo "...but it uses the old 4.1c interface, rather than 4.2" >&4
6983 d_oldsock="$define"
6984 fi
6985else
6986 if $contains socklib libc.list >/dev/null 2>&1; then
6987 echo "Looks like you have Berkeley networking support." >&4
6988 d_socket="$define"
6989 : we will have to assume that it supports the 4.2 BSD interface
6990 d_oldsock="$undef"
6991 else
6992 echo "You don't have Berkeley networking in libc.a..." >&4
6993 if test -f /usr/lib/libnet.a; then
6994 ( (nm $nm_opt /usr/lib/libnet.a | eval $nm_extract) || \
6995 ar t /usr/lib/libnet.a) 2>/dev/null >> libc.list
6996 if $contains socket libc.list >/dev/null 2>&1; then
6997 echo "...but the Wollongong group seems to have hacked it in." >&4
6998 socketlib="-lnet"
6999 sockethdr="-I/usr/netinclude"
7000 d_socket="$define"
7001 if $contains setsockopt libc.list >/dev/null 2>&1; then
7002 d_oldsock="$undef"
7003 else
7004 echo "...using the old 4.1c interface, rather than 4.2" >&4
7005 d_oldsock="$define"
7006 fi
7007 else
7008 echo "or even in libnet.a, which is peculiar." >&4
7009 d_socket="$undef"
7010 d_oldsock="$undef"
7011 fi
7012 else
7013 echo "or anywhere else I see." >&4
7014 d_socket="$undef"
7015 d_oldsock="$undef"
7016 fi
7017 fi
7018fi
7019
7020: see if socketpair exists
7021set socketpair d_sockpair
7022eval $inlibc
7023
7024: see if stat knows about block sizes
7025echo " "
7026xxx=`./findhdr sys/stat.h`
7027if $contains 'st_blocks;' "$xxx" >/dev/null 2>&1 ; then
7028 if $contains 'st_blksize;' "$xxx" >/dev/null 2>&1 ; then
7029 echo "Your stat() knows about block sizes." >&4
7030 val="$define"
7031 else
7032 echo "Your stat() doesn't know about block sizes." >&4
7033 val="$undef"
7034 fi
7035else
7036 echo "Your stat() doesn't know about block sizes." >&4
7037 val="$undef"
7038fi
7039set d_statblks
7040eval $setvar
7041
7042: see if _ptr and _cnt from stdio act std
7043echo " "
7044if $contains '_IO_fpos_t' `./findhdr stdio.h` >/dev/null 2>&1 ; then
7045 echo "(Looks like you have stdio.h from Linux.)"
7046 case "$stdio_ptr" in
7047 '') stdio_ptr='((fp)->_IO_read_ptr)'
7048 ptr_lval=$define
7049 ;;
7050 *) ptr_lval=$d_stdio_ptr_lval;;
7051 esac
7052 case "$stdio_cnt" in
7053 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
7054 cnt_lval=$undef
7055 ;;
7056 *) cnt_lval=$d_stdio_cnt_lval;;
7057 esac
7058 case "$stdio_base" in
7059 '') stdio_base='((fp)->_IO_read_base)';;
7060 esac
7061 case "$stdio_bufsiz" in
7062 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
7063 esac
7064else
7065 case "$stdio_ptr" in
7066 '') stdio_ptr='((fp)->_ptr)'
7067 ptr_lval=$define
7068 ;;
7069 *) ptr_lval=$d_stdio_ptr_lval;;
7070 esac
7071 case "$stdio_cnt" in
7072 '') stdio_cnt='((fp)->_cnt)'
7073 cnt_lval=$define
7074 ;;
7075 *) cnt_lval=$d_stdio_cnt_lval;;
7076 esac
7077 case "$stdio_base" in
7078 '') stdio_base='((fp)->_base)';;
7079 esac
7080 case "$stdio_bufsiz" in
7081 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
7082 esac
7083fi
7084: test whether _ptr and _cnt really work
7085echo "Checking how std your stdio is..." >&4
7086$cat >try.c <<EOP
7087#include <stdio.h>
7088#define FILE_ptr(fp) $stdio_ptr
7089#define FILE_cnt(fp) $stdio_cnt
7090main() {
7091 FILE *fp = fopen("try.c", "r");
7092 char c = getc(fp);
7093 if (
7094 18 <= FILE_cnt(fp) &&
7095 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
7096 )
7097 exit(0);
7098 exit(1);
7099}
7100EOP
7101val="$undef"
7102if $cc $ccflags $ldflags -o try try.c $libs >/dev/null 2>&1; then
7103 if ./try; then
7104 echo "Your stdio acts pretty std."
7105 val="$define"
7106 else
7107 echo "Your stdio isn't very std."
7108 fi
7109else
7110 echo "Your stdio doesn't appear very std."
7111fi
7112$rm -f try.c try
7113set d_stdstdio
7114eval $setvar
7115
7116: Can _ptr be used as an lvalue?
7117case "$d_stdstdio$ptr_lval" in
7118$define$define) val=$define ;;
7119*) val=$undef ;;
7120esac
7121set d_stdio_ptr_lval
7122eval $setvar
7123
7124: Can _cnt be used as an lvalue?
7125case "$d_stdstdio$cnt_lval" in
7126$define$define) val=$define ;;
7127*) val=$undef ;;
7128esac
7129set d_stdio_cnt_lval
7130eval $setvar
7131
7132: How to access the stdio _filbuf or __filbuf function.
7133: If this fails, check how the getc macro in stdio.h works.
7134case "${d_stdio_ptr_lval}${d_stdio_cnt_lval}" in
7135${define}${define})
7136 : Try $hint value, if any, then _filbuf, __filbuf, _fill, then punt.
7137 : _fill is for os/2.
7138 xxx='notok'
7139 for filbuf in $stdio_filbuf '_filbuf(fp)' '__filbuf(fp) ' '_fill(fp)' ; do
7140 $cat >try.c <<EOP
7141#include <stdio.h>
7142#define FILE_ptr(fp) $stdio_ptr
7143#define FILE_cnt(fp) $stdio_cnt
7144#define FILE_filbuf(fp) $filbuf
7145main() {
7146 FILE *fp = fopen("try.c", "r");
7147 int c;
7148 c = getc(fp);
7149 c = FILE_filbuf(fp); /* Just looking for linker errors.*/
7150 exit(0);
7151}
7152EOP
7153 if $cc $ccflags $ldflags -o try try.c $libs >/dev/null 2>&1 && ./try; then
7154 echo "Your stdio appears to use $filbuf"
7155 stdio_filbuf="$filbuf"
7156 xxx='ok'
7157 break
7158 else
7159 echo "Hmm. $filbuf doesn't seem to work."
7160 fi
7161 $rm -f try.c try
7162 done
7163 case "$xxx" in
7164 notok) echo "I can't figure out how to access _filbuf"
7165 echo "I'll just have to work around it."
7166 d_stdio_ptr_lval="$undef"
7167 d_stdio_cnt_lval="$undef"
7168 ;;
7169 esac
7170 ;;
7171esac
7172
7173
7174: see if _base is also standard
7175val="$undef"
7176case "$d_stdstdio" in
7177$define)
7178 $cat >try.c <<EOP
7179#include <stdio.h>
7180#define FILE_base(fp) $stdio_base
7181#define FILE_bufsiz(fp) $stdio_bufsiz
7182main() {
7183 FILE *fp = fopen("try.c", "r");
7184 char c = getc(fp);
7185 if (
7186 19 <= FILE_bufsiz(fp) &&
7187 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
7188 )
7189 exit(0);
7190 exit(1);
7191}
7192EOP
7193 if $cc $ccflags $ldflags -o try try.c $libs > /dev/null 2>&1; then
7194 if ./try; then
7195 echo "And its _base field acts std."
7196 val="$define"
7197 else
7198 echo "But its _base field isn't std."
7199 fi
7200 else
7201 echo "However, it seems to be lacking the _base field."
7202 fi
7203 $rm -f try.c try
7204 ;;
7205esac
7206set d_stdiobase
7207eval $setvar
7208
7209: see if strcoll exists
7210set strcoll d_strcoll
7211eval $inlibc
7212
7213: check for structure copying
7214echo " "
7215echo "Checking to see if your C compiler can copy structs..." >&4
7216$cat >try.c <<'EOCP'
7217main()
7218{
7219 struct blurfl {
7220 int dyick;
7221 } foo, bar;
7222
7223 foo = bar;
7224}
7225EOCP
7226if $cc -c try.c >/dev/null 2>&1 ; then
7227 val="$define"
7228 echo "Yup, it can."
7229else
7230 val="$undef"
7231 echo "Nope, it can't."
7232fi
7233set d_strctcpy
7234eval $setvar
7235$rm -f try.*
7236
7237: see if strerror and/or sys_errlist[] exist
7238echo " "
7239if set strerror val -f d_strerror; eval $csym; $val; then
7240 echo 'strerror() found.' >&4
7241 d_strerror="$define"
7242 d_strerrm='strerror(e)'
7243 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
7244 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
7245 d_syserrlst="$define"
7246 else
7247 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
7248 d_syserrlst="$undef"
7249 fi
7250elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
7251 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
7252 echo 'strerror() found in string header.' >&4
7253 d_strerror="$define"
7254 d_strerrm='strerror(e)'
7255 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
7256 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
7257 d_syserrlst="$define"
7258 else
7259 echo "(You don't appear to have any sys_errlist[], how can this be?)"
7260 d_syserrlst="$undef"
7261 fi
7262elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
7263echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
7264 d_strerror="$undef"
7265 d_syserrlst="$define"
7266 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
7267else
7268 echo 'strerror() and sys_errlist[] NOT found.' >&4
7269 d_strerror="$undef"
7270 d_syserrlst="$undef"
7271 d_strerrm='"unknown"'
7272fi
7273
7274: see if strxfrm exists
7275set strxfrm d_strxfrm
7276eval $inlibc
7277
7278: see if symlink exists
7279set symlink d_symlink
7280eval $inlibc
7281
7282: see if syscall exists
7283set syscall d_syscall
7284eval $inlibc
7285
7286: see if sysconf exists
7287set sysconf d_sysconf
7288eval $inlibc
7289
7290: see if system exists
7291set system d_system
7292eval $inlibc
7293
7294: see if tcgetpgrp exists
7295set tcgetpgrp d_tcgetpgrp
7296eval $inlibc
7297
7298: see if tcsetpgrp exists
7299set tcsetpgrp d_tcsetpgrp
7300eval $inlibc
7301
7302: define an is-a-typedef? function
7303typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
7304case "$inclist" in
7305"") inclist="sys/types.h";;
7306esac;
7307eval "varval=\$$var";
7308case "$varval" in
7309"")
7310 $rm -f temp.c;
7311 for inc in $inclist; do
7312 echo "#include <$inc>" >>temp.c;
7313 done;
7314 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
7315 if $contains $type temp.E >/dev/null 2>&1; then
7316 eval "$var=\$type";
7317 else
7318 eval "$var=\$def";
7319 fi;
7320 $rm -f temp.?;;
7321*) eval "$var=\$varval";;
7322esac'
7323
7324: see if this is a sys/times.h system
7325set sys/times.h i_systimes
7326eval $inhdr
7327
7328: see if times exists
7329echo " "
7330if set times val -f d_times; eval $csym; $val; then
7331 echo 'times() found.' >&4
7332 d_times="$define"
7333 inc=''
7334 case "$i_systimes" in
7335 "$define") inc='sys/times.h';;
7336 esac
7337 set clock_t clocktype long stdio.h sys/types.h $inc
7338 eval $typedef
7339 dflt="$clocktype"
7340 echo " "
7341 rp="What type is returned by times() on this system?"
7342 . ./myread
7343 clocktype="$ans"
7344else
7345 echo 'times() NOT found, hope that will do.' >&4
7346 d_times="$undef"
7347 clocktype='int'
7348fi
7349
7350: see if truncate exists
7351set truncate d_truncate
7352eval $inlibc
7353
7354: see if tzname[] exists
7355echo " "
7356if set tzname val -a d_tzname; eval $csym; $val; then
7357 val="$define"
7358 echo 'tzname[] found.' >&4
7359else
7360 val="$undef"
7361 echo 'tzname[] NOT found.' >&4
7362fi
7363set d_tzname
7364eval $setvar
7365
7366: see if umask exists
7367set umask d_umask
7368eval $inlibc
7369
7370: see how we will look up host name
7371echo " "
7372if false; then
7373 : dummy stub to allow use of elif
7374elif set uname val -f d_uname; eval $csym; $val; then
7375 if ./xenix; then
7376 $cat <<'EOM'
7377uname() was found, but you're running xenix, and older versions of xenix
7378have a broken uname(). If you don't really know whether your xenix is old
7379enough to have a broken system call, use the default answer.
7380
7381EOM
7382 dflt=y
7383 case "$d_uname" in
7384 "$define") dflt=n;;
7385 esac
7386 rp='Is your uname() broken?'
7387 . ./myread
7388 case "$ans" in
7389 n*) d_uname="$define"; call=uname;;
7390 esac
7391 else
7392 echo 'uname() found.' >&4
7393 d_uname="$define"
7394 call=uname
7395 fi
7396fi
7397case "$d_gethname" in
7398'') d_gethname="$undef";;
7399esac
7400case "$d_uname" in
7401'') d_uname="$undef";;
7402esac
7403case "$d_phostname" in
7404'') d_phostname="$undef";;
7405esac
7406
7407: backward compatibility for d_hvfork
7408if test X$d_hvfork != X; then
7409 d_vfork="$d_hvfork"
7410 d_hvfork=''
7411fi
7412: see if there is a vfork
7413val=''
7414set vfork val
7415eval $inlibc
7416
7417: Ok, but do we want to use it. vfork is reportedly unreliable in
7418: perl on Solaris 2.x, and probably elsewhere.
7419case "$val" in
7420$define)
7421 echo " "
7422 case "$usevfork" in
7423 false) dflt='n';;
7424 *) dflt='y';;
7425 esac
7426 rp="Some systems have problems with vfork(). Do you want to use it?"
7427 . ./myread
7428 case "$ans" in
7429 y|Y) ;;
7430 *)
7431 echo "Ok, we won't use vfork()."
7432 val="$undef"
7433 ;;
7434 esac
7435 ;;
7436esac
7437set d_vfork
7438eval $setvar
7439case "$d_vfork" in
7440$define) usevfork='true';;
7441*) usevfork='false';;
7442esac
7443
7444: see if this is an sysdir system
7445set sys/dir.h i_sysdir
7446eval $inhdr
7447
7448: see if this is an sysndir system
7449set sys/ndir.h i_sysndir
7450eval $inhdr
7451
7452: see if closedir exists
7453set closedir d_closedir
7454eval $inlibc
7455
7456case "$d_closedir" in
7457"$define")
7458 echo " "
7459 echo "Checking whether closedir() returns a status..." >&4
7460 cat > closedir.c <<EOM
7461#$i_dirent I_DIRENT /**/
7462#$i_sysdir I_SYS_DIR /**/
7463#$i_sysndir I_SYS_NDIR /**/
7464
7465#if defined(I_DIRENT)
7466#include <dirent.h>
7467#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
7468#include <sys/dir.h>
7469#endif
7470#else
7471#ifdef I_SYS_NDIR
7472#include <sys/ndir.h>
7473#else
7474#ifdef I_SYS_DIR
7475#ifdef hp9000s500
7476#include <ndir.h> /* may be wrong in the future */
7477#else
7478#include <sys/dir.h>
7479#endif
7480#endif
7481#endif
7482#endif
7483int main() { return closedir(opendir(".")); }
7484EOM
7485 if $cc $ccflags $ldflags -o closedir closedir.c $libs > /dev/null 2>&1; then
7486 if ./closedir > /dev/null 2>&1 ; then
7487 echo "Yes, it does."
7488 val="$undef"
7489 else
7490 echo "No, it doesn't."
7491 val="$define"
7492 fi
7493 else
7494 echo "(I can't seem to compile the test program--assuming it doesn't)"
7495 val="$define"
7496 fi
7497 ;;
7498*)
7499 val="$undef";
7500 ;;
7501esac
7502set d_void_closedir
7503eval $setvar
7504$rm -f closedir*
7505: check for volatile keyword
7506echo " "
7507echo 'Checking to see if your C compiler knows about "volatile"...' >&4
7508$cat >try.c <<'EOCP'
7509main()
7510{
7511 typedef struct _goo_struct goo_struct;
7512 goo_struct * volatile goo = ((goo_struct *)0);
7513 struct _goo_struct {
7514 long long_int;
7515 int reg_int;
7516 char char_var;
7517 };
7518 typedef unsigned short foo_t;
7519 char *volatile foo;
7520 volatile int bar;
7521 volatile foo_t blech;
7522 foo = foo;
7523}
7524EOCP
7525if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
7526 val="$define"
7527 echo "Yup, it does."
7528else
7529 val="$undef"
7530 echo "Nope, it doesn't."
7531fi
7532set d_volatile
7533eval $setvar
7534$rm -f try.*
7535
7536: see if there is a wait4
7537set wait4 d_wait4
7538eval $inlibc
7539
7540: see if waitpid exists
7541set waitpid d_waitpid
7542eval $inlibc
7543
7544: see if wcstombs exists
7545set wcstombs d_wcstombs
7546eval $inlibc
7547
7548: see if wctomb exists
7549set wctomb d_wctomb
7550eval $inlibc
7551
7552: preserve RCS keywords in files with variable substitution, grrr
7553Date='$Date'
7554Id='$Id'
7555Log='$Log'
7556RCSfile='$RCSfile'
7557Revision='$Revision'
7558
7559: check for alignment requirements
7560echo " "
7561case "$alignbytes" in
7562'') echo "Checking alignment constraints..." >&4
7563 $cat >try.c <<'EOCP'
7564struct foobar {
7565 char foo;
7566 double bar;
7567} try;
7568main()
7569{
7570 printf("%d\n", (char *)&try.bar - (char *)&try.foo);
7571}
7572EOCP
7573 if $cc $ccflags try.c -o try >/dev/null 2>&1; then
7574 dflt=`./try`
7575 else
7576 dflt='8'
7577 echo"(I can't seem to compile the test program...)"
7578 fi
7579 ;;
7580*) dflt="$alignbytes"
7581 ;;
7582esac
7583rp="Doubles must be aligned on a how-many-byte boundary?"
7584. ./myread
7585alignbytes="$ans"
7586$rm -f try.c try
7587
7588: check for ordering of bytes in a long
7589case "$byteorder" in
7590'')
7591 $cat <<'EOM'
7592
7593In the following, larger digits indicate more significance. A big-endian
7594machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
7595little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
7596machines may have weird orders like 3412. A Cray will report 87654321. If
7597the test program works the default is probably right.
7598I'm now running the test program...
7599EOM
7600 $cat >try.c <<'EOCP'
7601#include <stdio.h>
7602main()
7603{
7604 int i;
7605 union {
7606 unsigned long l;
7607 char c[sizeof(long)];
7608 } u;
7609
7610 if (sizeof(long) > 4)
7611 u.l = (0x08070605L << 32) | 0x04030201L;
7612 else
7613 u.l = 0x04030201L;
7614 for (i = 0; i < sizeof(long); i++)
7615 printf("%c", u.c[i]+'0');
7616 printf("\n");
7617 exit(0);
7618}
7619EOCP
7620 xxx_prompt=y
7621 if $cc $ccflags try.c -o try >/dev/null 2>&1 && ./try > /dev/null; then
7622 dflt=`./try`
7623 case "$dflt" in
7624 [1-4][1-4][1-4][1-4]|12345678|87654321)
7625 echo "(The test program ran ok.)"
7626 echo "byteorder=$dflt"
7627 xxx_prompt=n
7628 ;;
7629 ????|????????) echo "(The test program ran ok.)" ;;
7630 *) echo "(The test program didn't run right for some reason.)" ;;
7631 esac
7632 else
7633 dflt='4321'
7634 cat <<'EOM'
7635(I can't seem to compile the test program. Guessing big-endian...)
7636EOM
7637 fi
7638 case "$xxx_prompt" in
7639 y)
7640 rp="What is the order of bytes in a long?"
7641 . ./myread
7642 byteorder="$ans"
7643 ;;
7644 *) byteorder=$dflt
7645 ;;
7646 esac
7647 ;;
7648esac
7649$rm -f try.c try
7650
7651: how do we catenate cpp tokens here?
7652echo " "
7653echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
7654$cat >cpp_stuff.c <<'EOCP'
7655#define RCAT(a,b)a/**/b
7656#define ACAT(a,b)a ## b
7657RCAT(Rei,ser)
7658ACAT(Cir,cus)
7659EOCP
7660$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
7661if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
7662 echo "Oh! Smells like ANSI's been here."
7663 echo "We can catify or stringify, separately or together!"
7664 cpp_stuff=42
7665elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
7666 echo "Ah, yes! The good old days!"
7667 echo "However, in the good old days we don't know how to stringify and"
7668 echo "catify at the same time."
7669 cpp_stuff=1
7670else
7671 $cat >&4 <<EOM
7672Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
7673to have to edit the values of CAT[2-5] in config.h...
7674EOM
7675 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
7676fi
7677$rm -f cpp_stuff.*
7678
7679: see if this is a db.h system
7680set db.h i_db
7681eval $inhdr
7682
7683case "$i_db" in
7684define)
7685 : Check the return type needed for hash
7686 echo " "
7687 echo "Checking return type needed for hash for Berkeley DB ..." >&4
7688 $cat >try.c <<EOCP
7689#$d_const HASCONST
7690#ifndef HASCONST
7691#define const
7692#endif
7693#include <sys/types.h>
7694#include <db.h>
7695u_int32_t hash_cb (ptr, size)
7696const void *ptr;
7697size_t size;
7698{
7699}
7700HASHINFO info;
7701main()
7702{
7703 info.hash = hash_cb;
7704}
7705EOCP
7706 if $cc $ccflags -c try.c >try.out 2>&1 ; then
7707 if $contains warning try.out >>/dev/null 2>&1 ; then
7708 db_hashtype='int'
7709 else
7710 db_hashtype='u_int32_t'
7711 fi
7712 else
7713 echo "I can't seem to compile the test program." >&4
7714 db_hashtype=int
7715 fi
7716 $rm -f try.*
7717 echo "Your version of Berkeley DB uses $db_hashtype for hash."
7718 ;;
7719*) db_hashtype=int
7720 ;;
7721esac
7722
7723case "$i_db" in
7724define)
7725 : Check the return type needed for prefix
7726 echo " "
7727 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
7728 cat >try.c <<EOCP
7729#$d_const HASCONST
7730#ifndef HASCONST
7731#define const
7732#endif
7733#include <sys/types.h>
7734#include <db.h>
7735size_t prefix_cb (key1, key2)
7736const DBT *key1;
7737const DBT *key2;
7738{
7739}
7740BTREEINFO info;
7741main()
7742{
7743 info.prefix = prefix_cb;
7744}
7745EOCP
7746 if $cc $ccflags -c try.c >try.out 2>&1 ; then
7747 if $contains warning try.out >>/dev/null 2>&1 ; then
7748 db_prefixtype='int'
7749 else
7750 db_prefixtype='size_t'
7751 fi
7752 else
7753 echo "I can't seem to compile the test program." >&4
7754 db_prefixtype='int'
7755 fi
7756 $rm -f try.*
7757 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
7758 ;;
7759*) db_prefixtype='int'
7760 ;;
7761esac
7762
7763: check for void type
7764echo " "
7765echo "Checking to see how well your C compiler groks the void type..." >&4
7766echo " "
7767$cat >&4 <<EOM
7768 Support flag bits are:
7769 1: basic void declarations.
7770 2: arrays of pointers to functions returning void.
7771 4: operations between pointers to and addresses of void functions.
7772 8: generic void pointers.
7773EOM
7774echo " "
7775case "$voidflags" in
7776'')
7777 $cat >try.c <<'EOCP'
7778#if TRY & 1
7779void sub() {
7780#else
7781sub() {
7782#endif
7783 extern void moo(); /* function returning void */
7784 void (*goo)(); /* ptr to func returning void */
7785#if TRY & 8
7786 void *hue; /* generic ptr */
7787#endif
7788#if TRY & 2
7789 void (*foo[10])();
7790#endif
7791
7792#if TRY & 4
7793 if(goo == moo) {
7794 exit(0);
7795 }
7796#endif
7797 exit(0);
7798}
7799main() { sub(); }
7800EOCP
7801 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
7802 voidflags=$defvoidused
7803 echo "It appears to support void to the level $package wants ($defvoidused)."
7804 if $contains warning .out >/dev/null 2>&1; then
7805 echo "However, you might get some warnings that look like this:"
7806 $cat .out
7807 fi
7808 else
7809echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
7810 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
7811 echo "It supports 1..."
7812 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
7813 echo "It also supports 2..."
7814 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
7815 voidflags=7
7816 echo "And it supports 4 but not 8 definitely."
7817 else
7818 echo "It doesn't support 4..."
7819 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
7820 voidflags=11
7821 echo "But it supports 8."
7822 else
7823 voidflags=3
7824 echo "Neither does it support 8."
7825 fi
7826 fi
7827 else
7828 echo "It does not support 2..."
7829 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
7830 voidflags=13
7831 echo "But it supports 4 and 8."
7832 else
7833 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
7834 voidflags=5
7835 echo "And it supports 4 but has not heard about 8."
7836 else
7837 echo "However it supports 8 but not 4."
7838 fi
7839 fi
7840 fi
7841 else
7842 echo "There is no support at all for void."
7843 voidflags=0
7844 fi
7845 fi
7846esac
7847: Only prompt user if support does not match the level we want
7848case "$voidflags" in
7849"$defvoidused") ;;
7850*)
7851 dflt="$voidflags";
7852 rp="Your void support flags add up to what?"
7853 . ./myread
7854 voidflags="$ans"
7855 ;;
7856esac
7857$rm -f try.* .out
7858
7859: see what type file positions are declared as in the library
7860set fpos_t fpostype long stdio.h sys/types.h
7861eval $typedef
7862echo " "
7863dflt="$fpostype"
7864rp="What is the type for file position used by fsetpos()?"
7865. ./myread
7866fpostype="$ans"
7867
7868: Store the full pathname to the sed program for use in the C program
7869full_sed=$sed
7870
7871: see what type gids are declared as in the kernel
7872set gid_t gidtype xxx stdio.h sys/types.h
7873eval $typedef
7874case "$gidtype" in
7875xxx)
7876 xxx=`./findhdr sys/user.h`
7877 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
7878 case $1 in
7879 unsigned) dflt="$1 $2" ;;
7880 *) dflt="$1" ;;
7881 esac
7882 ;;
7883*) dflt="$gidtype";;
7884esac
7885echo " "
7886rp="What is the type for group ids returned by getgid()?"
7887. ./myread
7888gidtype="$ans"
7889
7890: see if getgroups exists
7891set getgroups d_getgrps
7892eval $inlibc
7893
7894: Find type of 2nd arg to getgroups
7895echo " "
7896case "$d_getgrps" in
7897'define')
7898 case "$groupstype" in
7899 '') dflt="$gidtype" ;;
7900 *) dflt="$groupstype" ;;
7901 esac
7902 $cat <<EOM
7903What is the type of the second argument to getgroups()? Usually this
7904is the same as group ids, $gidtype, but not always.
7905
7906EOM
7907 rp='What type is the second argument to getgroups()?'
7908 . ./myread
7909 groupstype="$ans"
7910 ;;
7911*) groupstype="$gidtype";;
7912esac
7913
7914also=''
7915case "$usedl" in
7916$undef)
7917 # No dynamic loading being used, so don't bother even to prompt.
7918 useshrplib='false'
7919 ;;
7920*) case "$useshrplib" in
7921 '') case "$osname" in
7922 svr4|dgux|dynixptx|esix|powerux)
7923 dflt='yes'
7924 also='Building a shared libperl is required for dynamic loading to work on your system.'
7925 ;;
7926 next*)
7927 case "$osvers" in
7928 4*) dflt='yes'
7929 also='Building a shared libperl is needed for MAB support.'
7930 ;;
7931 *) dflt='no'
7932 ;;
7933 esac
7934 ;;
7935 *) dflt='no'
7936 ;;
7937 esac
7938 ;;
7939 $define|true|[Yy]*)
7940 dflt='yes'
7941 ;;
7942 *) dflt='no'
7943 ;;
7944 esac
7945 $cat << EOM
7946
7947The perl executable is normally obtained by linking perlmain.c with
7948libperl${lib_ext}, any static extensions (usually just DynaLoader), and
7949any other libraries needed on this system (such as -lm, etc.). Since
7950your system supports dynamic loading, it is probably possible to build
7951a shared libperl.$so. If you will have more than one executable linked
7952to libperl.$so, this will significantly reduce the size of each
7953executable, but it may have a noticeable affect on performance. The
7954default is probably sensible for your system.
7955$also
7956EOM
7957 rp="Build a shared libperl.$so (y/n)"
7958 . ./myread
7959 case "$ans" in
7960 true|$define|[Yy]*)
7961 useshrplib='true'
7962 # Why does next4 have to be so different?
7963 case "${osname}${osvers}" in
7964 next4*) xxx='DYLD_LIBRARY_PATH' ;;
7965 *) xxx='LD_LIBRARY_PATH' ;;
7966 esac
7967 $cat <<EOM >&4
7968
7969To build perl, you must add the current working directory to your
7970$xxx environtment variable before running make. You can do
7971this with
7972 $xxx=\`pwd\`; export $xxx
7973for Bourne-style shells, or
7974 setenv $xxx \`pwd\`
7975for Csh-style shells. You *MUST* do this before running make.
7976
7977EOM
7978 ;;
7979 *) useshrplib='false' ;;
7980 esac
7981 ;;
7982esac
7983
7984case "$useshrplib" in
7985true)
7986 case "$libperl" in
7987 '')
7988 # Figure out a good name for libperl.so. Since it gets stored in
7989 # a version-specific architecture-dependent library, the version
7990 # number isn't really that important, except for making cc/ld happy.
7991 #
7992 # A name such as libperl.so.3.1
7993 majmin="libperl.$so.$patchlevel.$subversion"
7994 # A name such as libperl.so.301
7995 majonly=`echo $patchlevel $subversion |
7996 $awk '{printf "%d%02d", $1, $2}'`
7997 majonly=libperl.$so.$majonly
7998 # I'd prefer to keep the os-specific stuff here to a minimum, and
7999 # rely on figuring it out from the naming of libc.
8000 case "${osname}${osvers}" in
8001 next4*)
8002 dflt=libperl.5.$so
8003 # XXX How handle the --version stuff for MAB?
8004 ;;
8005 *) # Try to guess based on whether libc has major.minor.
8006 case "$libc" in
8007 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8008 *libc.$so.[0-9]*) dflt=$majonly ;;
8009 *) dflt=libperl.$so ;;
8010 esac
8011 ;;
8012 esac
8013 ;;
8014 *) dflt=$libperl
8015 ;;
8016 esac
8017 cat << EOM
8018
8019I need to select a good name for the shared libperl. If your system uses
8020library names with major and minor numbers, then you might want something
8021like $majmin. Alternatively, if your system uses a single version
8022number for shared libraries, then you might want to use $majonly.
8023Or, your system might be quite happy with a simple libperl.$so.
8024
8025Since the shared libperl will get installed into a version-specific
8026architecture-dependent directory, the version number of the shared perl
8027library probably isn't important, so the default should be o.k.
8028
8029EOM
8030 rp='What name do you want to give to the shared libperl?'
8031 . ./myread
8032 libperl=$ans
8033 echo "Ok, I'll use $libperl"
8034 ;;
8035*)
8036 libperl="libperl${lib_ext}"
8037 ;;
8038esac
8039
8040# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8041case "$shrpdir" in
8042'') ;;
8043*) $cat >&4 <<EOM
8044WARNING: Use of the shrpdir variable for the installation location of
8045the shared $libperl is not supported. It was never documented and
8046will not work in this version. Let me (doughera@lafcol.lafayette.edu)
8047know of any problems this may cause.
8048
8049EOM
8050 case "$shrpdir" in
8051 "$archlibexp/CORE")
8052 $cat >&4 <<EOM
8053But your current setting of $shrpdir is
8054the default anyway, so it's harmless.
8055EOM
8056 ;;
8057 *)
8058 $cat >&4 <<EOM
8059Further, your current attempted setting of $shrpdir
8060conflicts with the value of $archlibexp/CORE
8061that installperl will use.
8062EOM
8063 ;;
8064 esac
8065 ;;
8066esac
8067
8068: see what type lseek is declared as in the kernel
8069set off_t lseektype long stdio.h sys/types.h
8070eval $typedef
8071echo " "
8072dflt="$lseektype"
8073rp="What type is lseek's offset on this system declared as?"
8074. ./myread
8075lseektype="$ans"
8076
8077echo " "
8078case "$make" in
8079'')
8080 make=`./loc make make $pth`
8081 case "$make" in
8082 /*) echo make is in $make. ;;
8083 ?:[\\/]*) echo make is in $make. ;;
8084 *) echo "I don't know where 'make' is, and my life depends on it." >&4
8085 echo "Go find a make program or fix your PATH setting!" >&4
8086 exit 1
8087 ;;
8088 esac
8089 ;;
8090*) echo make is in $make. ;;
8091esac
8092
8093$echo $n "Checking if your $make program sets \$(MAKE)... $c" >&4
8094case "$make_set_make" in
8095'')
8096 $sed 's/^X //' > testmake.mak << 'EOF'
8097Xall:
8098X @echo 'ac_maketemp="$(MAKE)"'
8099EOF
8100 : GNU make sometimes prints "make[1]: Entering...", which would confuse us.
8101 case "`$make -f testmake.mak 2>/dev/null`" in
8102 *ac_maketemp=*) make_set_make='#' ;;
8103 *) make_set_make="MAKE=$make" ;;
8104 esac
8105 $rm -f testmake.mak
8106 ;;
8107esac
8108case "$make_set_make" in
8109'#') echo "Yup, it does." >&4 ;;
8110*) echo "Nope, it doesn't." >&4 ;;
8111esac
8112
8113: see what type is used for mode_t
8114set mode_t modetype int stdio.h sys/types.h
8115eval $typedef
8116dflt="$modetype"
8117echo " "
8118rp="What type is used for file modes?"
8119. ./myread
8120modetype="$ans"
8121
8122: locate the preferred pager for this system
8123case "$pager" in
8124'')
8125 dflt=''
8126 case "$pg" in
8127 /*) dflt=$pg;;
8128 esac
8129 case "$more" in
8130 /*) dflt=$more;;
8131 esac
8132 case "$less" in
8133 /*) dflt=$less;;
8134 esac
8135 case "$dflt" in
8136 '') dflt=/usr/ucb/more;;
8137 esac
8138 ;;
8139*) dflt="$pager";;
8140esac
8141echo " "
8142fn=f/
8143rp='What pager is used on your system?'
8144. ./getfile
8145pager="$ans"
8146
8147: Cruising for prototypes
8148echo " "
8149echo "Checking out function prototypes..." >&4
8150$cat >prototype.c <<'EOCP'
8151main(int argc, char *argv[]) {
8152 exit(0);}
8153EOCP
8154if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
8155 echo "Your C compiler appears to support function prototypes."
8156 val="$define"
8157else
8158 echo "Your C compiler doesn't seem to understand function prototypes."
8159 val="$undef"
8160fi
8161set prototype
8162eval $setvar
8163$rm -f prototype*
8164
8165: check for size of random number generator
8166echo " "
8167case "$randbits" in
8168'')
8169 echo "Checking to see how many bits your rand function produces..." >&4
8170 $cat >try.c <<EOCP
8171#$i_unistd I_UNISTD
8172#$i_stdlib I_STDLIB
8173#include <stdio.h>
8174#ifdef I_UNISTD
8175# include <unistd.h>
8176#endif
8177#ifdef I_STDLIB
8178# include <stdlib.h>
8179#endif
8180EOCP
8181 $cat >>try.c <<'EOCP'
8182main()
8183{
8184 register int i;
8185 register unsigned long tmp;
8186 register unsigned long max = 0L;
8187
8188 for (i = 1000; i; i--) {
8189 tmp = (unsigned long)rand();
8190 if (tmp > max) max = tmp;
8191 }
8192 for (i = 0; max; i++)
8193 max /= 2;
8194 printf("%d\n",i);
8195}
8196EOCP
8197 if $cc try.c -o try >/dev/null 2>&1 ; then
8198 dflt=`try`
8199 else
8200 dflt='?'
8201 echo "(I can't seem to compile the test program...)"
8202 fi
8203 ;;
8204*)
8205 dflt="$randbits"
8206 ;;
8207esac
8208rp='How many bits does your rand() function produce?'
8209. ./myread
8210randbits="$ans"
8211$rm -f try.c try
8212
8213: see if ar generates random libraries by itself
8214echo " "
8215echo "Checking how to generate random libraries on your machine..." >&4
8216echo 'int bar1() { return bar2(); }' > bar1.c
8217echo 'int bar2() { return 2; }' > bar2.c
8218$cat > foo.c <<'EOP'
8219main() { printf("%d\n", bar1()); exit(0); }
8220EOP
8221$cc $ccflags -c bar1.c >/dev/null 2>&1
8222$cc $ccflags -c bar2.c >/dev/null 2>&1
8223$cc $ccflags -c foo.c >/dev/null 2>&1
8224ar rc bar.a bar2.o bar1.o >/dev/null 2>&1
8225if $cc $ccflags $ldflags -o foobar foo.o bar.a $libs > /dev/null 2>&1 &&
8226 ./foobar >/dev/null 2>&1; then
8227 echo "ar appears to generate random libraries itself."
8228 orderlib=false
8229 ranlib=":"
8230elif ar ts bar.a >/dev/null 2>&1 &&
8231 $cc $ccflags $ldflags -o foobar foo.o bar.a $libs > /dev/null 2>&1 &&
8232 ./foobar >/dev/null 2>&1; then
8233 echo "a table of contents needs to be added with 'ar ts'."
8234 orderlib=false
8235 ranlib="ar ts"
8236else
8237 case "$ranlib" in
8238 :) ranlib='';;
8239 '')
8240 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
8241 $test -f $ranlib || ranlib=''
8242 ;;
8243 esac
8244 if $test -n "$ranlib"; then
8245 echo "your system has '$ranlib'; we'll use that."
8246 orderlib=false
8247 else
8248 echo "your system doesn't seem to support random libraries"
8249 echo "so we'll use lorder and tsort to order the libraries."
8250 orderlib=true
8251 ranlib=":"
8252 fi
8253fi
8254$rm -f foo* bar*
8255
8256: see if sys/select.h has to be included
8257set sys/select.h i_sysselct
8258eval $inhdr
8259
8260: see if we should include time.h, sys/time.h, or both
8261echo " "
8262echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8263$echo $n "I'm now running the test program...$c"
8264$cat >try.c <<'EOCP'
8265#include <sys/types.h>
8266#ifdef I_TIME
8267#include <time.h>
8268#endif
8269#ifdef I_SYSTIME
8270#ifdef SYSTIMEKERNEL
8271#define KERNEL
8272#endif
8273#include <sys/time.h>
8274#endif
8275#ifdef I_SYSSELECT
8276#include <sys/select.h>
8277#endif
8278main()
8279{
8280 struct tm foo;
8281#ifdef S_TIMEVAL
8282 struct timeval bar;
8283#endif
8284#ifdef S_TIMEZONE
8285 struct timezone tzp;
8286#endif
8287 if (foo.tm_sec == foo.tm_sec)
8288 exit(0);
8289#ifdef S_TIMEVAL
8290 if (bar.tv_sec == bar.tv_sec)
8291 exit(0);
8292#endif
8293 exit(1);
8294}
8295EOCP
8296flags=''
8297for s_timezone in '-DS_TIMEZONE' ''; do
8298sysselect=''
8299for s_timeval in '-DS_TIMEVAL' ''; do
8300for i_systimek in '' '-DSYSTIMEKERNEL'; do
8301for i_time in '' '-DI_TIME'; do
8302for i_systime in '-DI_SYSTIME' ''; do
8303 case "$flags" in
8304 '') $echo $n ".$c"
8305 if $cc $ccflags \
8306 $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone \
8307 try.c -o try >/dev/null 2>&1 ; then
8308 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8309 shift
8310 flags="$*"
8311 echo " "
8312 $echo $n "Succeeded with $flags$c"
8313 fi
8314 ;;
8315 esac
8316done
8317done
8318done
8319done
8320done
8321timeincl=''
8322echo " "
8323case "$flags" in
8324*SYSTIMEKERNEL*) i_systimek="$define"
8325 timeincl=`./findhdr sys/time.h`
8326 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8327*) i_systimek="$undef";;
8328esac
8329case "$flags" in
8330*I_TIME*) i_time="$define"
8331 timeincl=`./findhdr time.h`" $timeincl"
8332 echo "We'll include <time.h>." >&4;;
8333*) i_time="$undef";;
8334esac
8335case "$flags" in
8336*I_SYSTIME*) i_systime="$define"
8337 timeincl=`./findhdr sys/time.h`" $timeincl"
8338 echo "We'll include <sys/time.h>." >&4;;
8339*) i_systime="$undef";;
8340esac
8341$rm -f try.c try
8342
8343: check for fd_set items
8344$cat <<EOM
8345
8346Checking to see how well your C compiler handles fd_set and friends ...
8347EOM
8348$cat >fd_set.c <<EOCP
8349#$i_systime I_SYS_TIME
8350#$i_sysselct I_SYS_SELECT
8351#$d_socket HAS_SOCKET
8352#include <sys/types.h>
8353#ifdef HAS_SOCKET
8354#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8355#endif
8356#ifdef I_SYS_TIME
8357#include <sys/time.h>
8358#else
8359#ifdef I_SYS_SELECT
8360#include <sys/select.h>
8361#endif
8362#endif
8363main() {
8364 fd_set fds;
8365
8366#ifdef TRYBITS
8367 if(fds.fds_bits);
8368#endif
8369
8370#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8371 exit(0);
8372#else
8373 exit(1);
8374#endif
8375}
8376EOCP
8377if $cc $ccflags -DTRYBITS fd_set.c -o fd_set >fd_set.out 2>&1 ; then
8378 d_fds_bits="$define"
8379 d_fd_set="$define"
8380 echo "Well, your system knows about the normal fd_set typedef..." >&4
8381 if ./fd_set; then
8382 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8383 d_fd_macros="$define"
8384 else
8385 $cat >&4 <<'EOM'
8386but not the normal fd_set macros! Gaaack! I'll have to cover for you.
8387EOM
8388 d_fd_macros="$undef"
8389 fi
8390else
8391 $cat <<'EOM'
8392Hmm, your compiler has some difficulty with fd_set. Checking further...
8393EOM
8394 if $cc $ccflags fd_set.c -o fd_set >fd_set.out 2>&1 ; then
8395 d_fds_bits="$undef"
8396 d_fd_set="$define"
8397 echo "Well, your system has some sort of fd_set available..." >&4
8398 if ./fd_set; then
8399 echo "and you have the normal fd_set macros." >&4
8400 d_fd_macros="$define"
8401 else
8402 $cat <<'EOM'
8403but not the normal fd_set macros! Gross! More work for me...
8404EOM
8405 d_fd_macros="$undef"
8406 fi
8407 else
8408 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
8409 d_fd_set="$undef"
8410 d_fds_bits="$undef"
8411 d_fd_macros="$undef"
8412 fi
8413fi
8414$rm -f fd_set*
8415
8416
8417: check for type of arguments to select. This will only really
8418: work if the system supports prototypes and provides one for
8419: select.
8420case "$d_select" in
8421$define)
8422 : Make initial guess
8423 case "$selecttype" in
8424 ''|' ')
8425 case "$d_fd_set" in
8426 $define) xxx='fd_set *' ;;
8427 *) xxx='int *' ;;
8428 esac
8429 ;;
8430 *) xxx="$selecttype"
8431 ;;
8432 esac
8433 : backup guess
8434 case "$xxx" in
8435 'fd_set *') yyy='int *' ;;
8436 'int *') yyy='fd_set *' ;;
8437 esac
8438
8439 $cat <<EOM
8440
8441Checking to see what type of arguments are expected by select().
8442EOM
8443 $cat >try.c <<EOCP
8444#$i_systime I_SYS_TIME
8445#$i_sysselct I_SYS_SELECT
8446#$d_socket HAS_SOCKET
8447#include <sys/types.h>
8448#ifdef HAS_SOCKET
8449#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8450#endif
8451#ifdef I_SYS_TIME
8452#include <sys/time.h>
8453#endif
8454#ifdef I_SYS_SELECT
8455#include <sys/select.h>
8456#endif
8457main()
8458{
8459 int width;
8460 Select_fd_set_t readfds;
8461 Select_fd_set_t writefds;
8462 Select_fd_set_t exceptfds;
8463 struct timeval timeout;
8464 select(width, readfds, writefds, exceptfds, &timeout);
8465 exit(0);
8466}
8467EOCP
8468 if $cc $ccflags -c -DSelect_fd_set_t="$xxx" try.c >/dev/null 2>&1 ; then
8469 selecttype="$xxx"
8470 echo "Your system uses $xxx for the arguments to select." >&4
8471 elif $cc $ccflags -c -DSelect_fd_set_t="$yyy" try.c >/dev/null 2>&1 ; then
8472 selecttype="$yyy"
8473 echo "Your system uses $yyy for the arguments to select." >&4
8474 else
8475 rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
8476 dflt="$xxx"
8477 . ./myread
8478 selecttype="$ans"
8479 fi
8480 $rm -f try.[co]
8481 ;;
8482*) selecttype='int *'
8483 ;;
8484esac
8485
8486: Trace out the files included by signal.h, then look for SIGxxx names.
8487: Remove SIGARRAYSIZE used by HPUX.
8488: Remove SIGTYP void lines used by OS2.
8489xxx=`echo '#include <signal.h>' |
8490 $cppstdin $cppminus $cppflags 2>/dev/null |
8491 $grep '^[ ]*#.*include' |
8492 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
8493: Check this list of files to be sure we have parsed the cpp output ok.
8494: This will also avoid potentially non-existent files, such
8495: as ../foo/bar.h
8496xxxfiles=''
8497for xx in $xxx /dev/null ; do
8498 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
8499done
8500: If we have found no files, at least try signal.h
8501case "$xxxfiles" in
8502'') xxxfiles=`./findhdr signal.h` ;;
8503esac
8504xxx=`awk '
8505$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $3 !~ /void/ {
8506 print substr($2, 4, 20)
8507}
8508$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
8509 print substr($3, 4, 20)
8510}' $xxxfiles`
8511: Append some common names just in case the awk scan failed.
8512xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
8513xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
8514xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
8515xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
8516: generate a few handy files for later
8517$cat > signal.c <<'EOP'
8518#include <sys/types.h>
8519#include <signal.h>
8520int main() {
8521
8522/* Strange style to avoid deeply-nested #if/#else/#endif */
8523#ifndef NSIG
8524# ifdef _NSIG
8525# define NSIG (_NSIG)
8526# endif
8527#endif
8528
8529#ifndef NSIG
8530# ifdef SIGMAX
8531# define NSIG (SIGMAX+1)
8532# endif
8533#endif
8534
8535#ifndef NSIG
8536# ifdef SIG_MAX
8537# define NSIG (SIG_MAX+1)
8538# endif
8539#endif
8540
8541#ifndef NSIG
8542# ifdef MAXSIG
8543# define NSIG (MAXSIG+1)
8544# endif
8545#endif
8546
8547#ifndef NSIG
8548# ifdef MAX_SIG
8549# define NSIG (MAX_SIG+1)
8550# endif
8551#endif
8552
8553#ifndef NSIG
8554# ifdef SIGARRAYSIZE
8555# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
8556# endif
8557#endif
8558
8559#ifndef NSIG
8560# ifdef _sys_nsig
8561# define NSIG (_sys_nsig) /* Solaris 2.5 */
8562# endif
8563#endif
8564
8565/* Default to some arbitrary number that's big enough to get most
8566 of the common signals.
8567*/
8568#ifndef NSIG
8569# define NSIG 50
8570#endif
8571
8572printf("NSIG %d\n", NSIG);
8573
8574EOP
8575echo $xxx | $tr ' ' '\012' | $sort | $uniq | $awk '
8576{
8577 printf "#ifdef SIG"; printf $1; printf "\n"
8578 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
8579 printf $1; printf ");\n"
8580 printf "#endif\n"
8581}
8582END {
8583 printf "}\n";
8584}
8585' >>signal.c
8586$cat >signal.awk <<'EOP'
8587BEGIN { ndups = 0 }
8588$1 ~ /^NSIG$/ { nsig = $2 }
8589($1 !~ /^NSIG$/) && (NF == 2) {
8590 if ($2 > maxsig) { maxsig = $2 }
8591 if (sig_name[$2]) {
8592 dup_name[ndups] = $1
8593 dup_num[ndups] = $2
8594 ndups++
8595 }
8596 else {
8597 sig_name[$2] = $1
8598 sig_num[$2] = $2
8599 }
8600
8601}
8602END {
8603 if (nsig == 0) { nsig = maxsig + 1 }
8604 for (n = 1; n < nsig; n++) {
8605 if (sig_name[n]) {
8606 printf("%s %d\n", sig_name[n], sig_num[n])
8607 }
8608 else {
8609 printf("NUM%d %d\n", n, n)
8610 }
8611 }
8612 for (n = 0; n < ndups; n++) {
8613 printf("%s %d\n", dup_name[n], dup_num[n])
8614 }
8615}
8616EOP
8617$cat >signal_cmd <<EOS
8618$startsh
8619$test -s signal.lst && exit 0
8620if $cc $ccflags signal.c -o signal $ldflags >/dev/null 2>&1; then
8621 ./signal | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
8622else
8623 echo "(I can't seem be able to compile the test program -- Guessing)"
8624 echo 'kill -l' >signal
8625 set X \`csh -f <signal\`
8626 $rm -f signal
8627 shift
8628 case \$# in
8629 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
8630 esac
8631 echo \$@ | $tr ' ' '\012' | \
8632 $awk '{ printf $1; printf " %d\n", ++s; }' >signal.lst
8633fi
8634$rm -f signal.c signal signal.o
8635EOS
8636chmod a+x signal_cmd
8637$eunicefix signal_cmd
8638
8639: generate list of signal names
8640echo " "
8641case "$sig_name" in
8642'') sig_num='' ;;
8643esac
8644case "$sig_num" in
8645'') sig_name='' ;;
8646esac
8647case "$sig_name" in
8648'')
8649 echo "Generating a list of signal names and numbers..." >&4
8650 ./signal_cmd
8651 sig_name=`$awk '{printf "%s ", $1}' signal.lst`
8652 sig_name="ZERO $sig_name"
8653 sig_num=`$awk '{printf "%d ", $2}' signal.lst`
8654 sig_num="0 $sig_num"
8655 ;;
8656esac
8657echo "The following signals are available:"
8658echo " "
8659echo $sig_name | $awk \
8660'BEGIN { linelen = 0 }
8661{
8662 for (i = 1; i <= NF; i++) {
8663 name = "SIG" $i " "
8664 linelen = linelen + length(name)
8665 if (linelen > 70) {
8666 printf "\n"
8667 linelen = length(name)
8668 }
8669 printf "%s", name
8670 }
8671 printf "\n"
8672}'
8673$rm -f signal signal.c signal.awk signal.lst signal_cmd
8674
8675: see what type is used for size_t
8676set size_t sizetype 'unsigned int' stdio.h sys/types.h
8677eval $typedef
8678dflt="$sizetype"
8679echo " "
8680rp="What type is used for the length parameter for string functions?"
8681. ./myread
8682sizetype="$ans"
8683
8684: see what type is used for signed size_t
8685set ssize_t ssizetype int stdio.h sys/types.h
8686eval $typedef
8687dflt="$ssizetype"
8688$cat > ssize.c <<EOM
8689#include <stdio.h>
8690#include <sys/types.h>
8691#define Size_t $sizetype
8692#define SSize_t $dflt
8693main()
8694{
8695 if (sizeof(Size_t) == sizeof(SSize_t))
8696 printf("$dflt\n");
8697 else if (sizeof(Size_t) == sizeof(int))
8698 printf("int\n");
8699 else
8700 printf("long\n");
8701 exit(0);
8702}
8703EOM
8704echo " "
8705if $cc $ccflags $ldflags -o ssize ssize.c $libs > /dev/null 2>&1 &&
8706 ./ssize > /dev/null 2>&1 ; then
8707 ssizetype=`./ssize`
8708 echo "I'll be using $ssizetype for functions returning a byte count." >&4
8709else
8710 echo "(I can't compile and run the test program--please enlighten me!)"
8711 $cat <<EOM
8712
8713I need a type that is the same size as $sizetype, but is guaranteed to
8714be signed. Common values are int and long.
8715
8716EOM
8717 rp="What signed type is the same size as $sizetype?"
8718 . ./myread
8719 ssizetype="$ans"
8720fi
8721$rm -f ssize ssize.[co]
8722
8723: see what type of char stdio uses.
8724echo " "
8725if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
8726 echo "Your stdio uses unsigned chars." >&4
8727 stdchar="unsigned char"
8728else
8729 echo "Your stdio uses signed chars." >&4
8730 stdchar="char"
8731fi
8732
8733: see if time exists
8734echo " "
8735if set time val -f d_time; eval $csym; $val; then
8736 echo 'time() found.' >&4
8737 val="$define"
8738 set time_t timetype long stdio.h sys/types.h
8739 eval $typedef
8740 dflt="$timetype"
8741 echo " "
8742 rp="What type is returned by time() on this system?"
8743 . ./myread
8744 timetype="$ans"
8745else
8746 echo 'time() not found, hope that will do.' >&4
8747 val="$undef"
8748 timetype='int';
8749fi
8750set d_time
8751eval $setvar
8752
8753: see what type uids are declared as in the kernel
8754set uid_t uidtype xxx stdio.h sys/types.h
8755eval $typedef
8756case "$uidtype" in
8757xxx)
8758 xxx=`./findhdr sys/user.h`
8759 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
8760 case $1 in
8761 unsigned) dflt="$1 $2" ;;
8762 *) dflt="$1" ;;
8763 esac
8764 ;;
8765*) dflt="$uidtype";;
8766esac
8767echo " "
8768rp="What is the type for user ids returned by getuid()?"
8769. ./myread
8770uidtype="$ans"
8771
8772: see if dbm.h is available
8773: see if dbmclose exists
8774set dbmclose d_dbmclose
8775eval $inlibc
8776
8777case "$d_dbmclose" in
8778$define)
8779 set dbm.h i_dbm
8780 eval $inhdr
8781 case "$i_dbm" in
8782 $define)
8783 val="$undef"
8784 set i_rpcsvcdbm
8785 eval $setvar
8786 ;;
8787 *) set rpcsvc/dbm.h i_rpcsvcdbm
8788 eval $inhdr
8789 ;;
8790 esac
8791 ;;
8792*) echo "We won't be including <dbm.h>"
8793 val="$undef"
8794 set i_dbm
8795 eval $setvar
8796 val="$undef"
8797 set i_rpcsvcdbm
8798 eval $setvar
8799 ;;
8800esac
8801
8802: see if this is a sys/file.h system
8803val=''
8804set sys/file.h val
8805eval $inhdr
8806
8807: do we need to include sys/file.h ?
8808case "$val" in
8809"$define")
8810 echo " "
8811 if $h_sysfile; then
8812 val="$define"
8813 echo "We'll be including <sys/file.h>." >&4
8814 else
8815 val="$undef"
8816 echo "We won't be including <sys/file.h>." >&4
8817 fi
8818 ;;
8819*)
8820 h_sysfile=false
8821 ;;
8822esac
8823set i_sysfile
8824eval $setvar
8825
8826: see if fcntl.h is there
8827val=''
8828set fcntl.h val
8829eval $inhdr
8830
8831: see if we can include fcntl.h
8832case "$val" in
8833"$define")
8834 echo " "
8835 if $h_fcntl; then
8836 val="$define"
8837 echo "We'll be including <fcntl.h>." >&4
8838 else
8839 val="$undef"
8840 if $h_sysfile; then
8841 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
8842 else
8843 echo "We won't be including <fcntl.h>." >&4
8844 fi
8845 fi
8846 ;;
8847*)
8848 h_fcntl=false
8849 val="$undef"
8850 ;;
8851esac
8852set i_fcntl
8853eval $setvar
8854
8855: see if this is an grp system
8856set grp.h i_grp
8857eval $inhdr
8858
8859: see if locale.h is available
8860set locale.h i_locale
8861eval $inhdr
8862
8863: see if this is a math.h system
8864set math.h i_math
8865eval $inhdr
8866
8867: see if ndbm.h is available
8868set ndbm.h t_ndbm
8869eval $inhdr
8870case "$t_ndbm" in
8871$define)
8872 : see if dbm_open exists
8873 set dbm_open d_dbm_open
8874 eval $inlibc
8875 case "$d_dbm_open" in
8876 $undef)
8877 t_ndbm="$undef"
8878 echo "We won't be including <ndbm.h>"
8879 ;;
8880 esac
8881 ;;
8882esac
8883val="$t_ndbm"
8884set i_ndbm
8885eval $setvar
8886
8887: see if net/errno.h is available
8888val=''
8889set net/errno.h val
8890eval $inhdr
8891
8892: Unfortunately, it causes problems on some systems. Arrgh.
8893case "$val" in
8894$define)
8895 cat > try.c <<'EOM'
8896#include <stdio.h>
8897#include <errno.h>
8898#include <net/errno.h>
8899int func()
8900{
8901 return ENOTSOCK;
8902}
8903EOM
8904 if $cc $ccflags -c try.c >/dev/null 2>&1; then
8905 echo "We'll be including <net/errno.h>." >&4
8906 else
8907 echo "We won't be including <net/errno.h>." >&4
8908 val="$undef"
8909 fi
8910 $rm -f try.* try
8911 ;;
8912esac
8913set i_neterrno
8914eval $setvar
8915
8916: get C preprocessor symbols handy
8917echo " "
8918$echo $n "Hmm... $c"
8919echo $al | $tr ' ' '\012' >Cppsym.know
8920$cat <<EOSS >Cppsym
8921$startsh
8922case "\$1" in
8923-l) list=true
8924 shift
8925 ;;
8926esac
8927unknown=''
8928case "\$list\$#" in
89291|2)
8930 for sym do
8931 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
8932 exit 0
8933 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
8934 :
8935 else
8936 unknown="\$unknown \$sym"
8937 fi
8938 done
8939 set X \$unknown
8940 shift
8941 ;;
8942esac
8943case \$# in
89440) exit 1;;
8945esac
8946echo \$* | $tr ' ' '\012' | $sed -e 's/\(.*\)/\\
8947#ifdef \1\\
8948exit 0; _ _ _ _\1\\ \1\\
8949#endif\\
8950/' >Cppsym\$\$
8951echo "exit 1; _ _ _" >>Cppsym\$\$
8952$cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _' >Cppsym2\$\$
8953case "\$list" in
8954true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
8955*)
8956 sh Cppsym2\$\$
8957 status=\$?
8958 ;;
8959esac
8960$rm -f Cppsym\$\$ Cppsym2\$\$
8961exit \$status
8962EOSS
8963chmod +x Cppsym
8964$eunicefix Cppsym
8965./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
8966
8967: now check the C compiler for additional symbols
8968$cat >ccsym <<EOS
8969$startsh
8970$cat >tmp.c <<EOF
8971extern int foo;
8972EOF
8973for i in \`$cc -v -c tmp.c 2>&1\`
8974do
8975 case "\$i" in
8976 -D*) echo "\$i" | $sed 's/^-D//';;
8977 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
8978 esac
8979done
8980$rm -f try.c
8981EOS
8982chmod +x ccsym
8983$eunicefix ccsym
8984./ccsym | $sort | $uniq >ccsym.raw
8985$awk '/\=/ { print $0; next }
8986 { print $0"=1" }' ccsym.raw >ccsym.list
8987$awk '{ print $0"=1" }' Cppsym.true >ccsym.true
8988$comm -13 ccsym.true ccsym.list >ccsym.own
8989$comm -12 ccsym.true ccsym.list >ccsym.com
8990$comm -23 ccsym.true ccsym.list >ccsym.cpp
8991also=''
8992symbols='symbols'
8993if $test -z ccsym.raw; then
8994 echo "Your C compiler doesn't seem to define any symbol!" >&4
8995 echo " "
8996 echo "However, your C preprocessor defines the following ones:"
8997 $cat Cppsym.true
8998else
8999 if $test -s ccsym.com; then
9000 echo "Your C compiler and pre-processor define these symbols:"
9001 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
9002 also='also '
9003 symbols='ones'
9004 $test "$silent" || sleep 1
9005 fi
9006 if $test -s ccsym.cpp; then
9007 $test "$also" && echo " "
9008 echo "Your C pre-processor ${also}defines the following $symbols:"
9009 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
9010 also='further '
9011 $test "$silent" || sleep 1
9012 fi
9013 if $test -s ccsym.own; then
9014 $test "$also" && echo " "
9015 echo "Your C compiler ${also}defines the following cpp variables:"
9016 $sed -e 's/\(.*\)=1/\1/' ccsym.own
9017 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
9018 $test "$silent" || sleep 1
9019 fi
9020fi
9021$rm -f ccsym*
9022
9023: see if this is a termio system
9024val="$undef"
9025val2="$undef"
9026val3="$undef"
9027if $test `./findhdr termios.h`; then
9028 set tcsetattr i_termios
9029 eval $inlibc
9030 val3="$i_termios"
9031fi
9032echo " "
9033case "$val3" in
9034"$define") echo "You have POSIX termios.h... good!" >&4;;
9035*) if ./Cppsym pyr; then
9036 case "`/bin/universe`" in
9037 ucb) if $test `./findhdr sgtty.h`; then
9038 val2="$define"
9039 echo "<sgtty.h> found." >&4
9040 else
9041 echo "System is pyramid with BSD universe."
9042 echo "<sgtty.h> not found--you could have problems." >&4
9043 fi;;
9044 *) if $test `./findhdr termio.h`; then
9045 val="$define"
9046 echo "<termio.h> found." >&4
9047 else
9048 echo "System is pyramid with USG universe."
9049 echo "<termio.h> not found--you could have problems." >&4
9050 fi;;
9051 esac
9052 elif ./usg; then
9053 if $test `./findhdr termio.h`; then
9054 echo "<termio.h> found." >&4
9055 val="$define"
9056 elif $test `./findhdr sgtty.h`; then
9057 echo "<sgtty.h> found." >&4
9058 val2="$define"
9059 else
9060echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
9061 fi
9062 else
9063 if $test `./findhdr sgtty.h`; then
9064 echo "<sgtty.h> found." >&4
9065 val2="$define"
9066 elif $test `./findhdr termio.h`; then
9067 echo "<termio.h> found." >&4
9068 val="$define"
9069 else
9070echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
9071 fi
9072 fi;;
9073esac
9074set i_termio; eval $setvar
9075val=$val2; set i_sgtty; eval $setvar
9076val=$val3; set i_termios; eval $setvar
9077
9078: see if stdarg is available
9079echo " "
9080if $test `./findhdr stdarg.h`; then
9081 echo "<stdarg.h> found." >&4
9082 valstd="$define"
9083else
9084 echo "<stdarg.h> NOT found." >&4
9085 valstd="$undef"
9086fi
9087
9088: see if varags is available
9089echo " "
9090if $test `./findhdr varargs.h`; then
9091 echo "<varargs.h> found." >&4
9092else
9093 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
9094fi
9095
9096: set up the varargs testing programs
9097$cat > varargs.c <<EOP
9098#ifdef I_STDARG
9099#include <stdarg.h>
9100#endif
9101#ifdef I_VARARGS
9102#include <varargs.h>
9103#endif
9104
9105#ifdef I_STDARG
9106int f(char *p, ...)
9107#else
9108int f(va_alist)
9109va_dcl
9110#endif
9111{
9112 va_list ap;
9113#ifndef I_STDARG
9114 char *p;
9115#endif
9116#ifdef I_STDARG
9117 va_start(ap,p);
9118#else
9119 va_start(ap);
9120 p = va_arg(ap, char *);
9121#endif
9122 va_end(ap);
9123}
9124EOP
9125$cat > varargs <<EOP
9126$startsh
9127if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
9128 echo "true"
9129else
9130 echo "false"
9131fi
9132$rm -f varargs.o
9133EOP
9134chmod +x varargs
9135
9136: now check which varargs header should be included
9137echo " "
9138i_varhdr=''
9139case "$valstd" in
9140"$define")
9141 if `./varargs I_STDARG`; then
9142 val='stdarg.h'
9143 elif `./varargs I_VARARGS`; then
9144 val='varargs.h'
9145 fi
9146 ;;
9147*)
9148 if `./varargs I_VARARGS`; then
9149 val='varargs.h'
9150 fi
9151 ;;
9152esac
9153case "$val" in
9154'')
9155echo "I could not find the definition for va_dcl... You have problems..." >&4
9156 val="$undef"; set i_stdarg; eval $setvar
9157 val="$undef"; set i_varargs; eval $setvar
9158 ;;
9159*)
9160 set i_varhdr
9161 eval $setvar
9162 case "$i_varhdr" in
9163 stdarg.h)
9164 val="$define"; set i_stdarg; eval $setvar
9165 val="$undef"; set i_varargs; eval $setvar
9166 ;;
9167 varargs.h)
9168 val="$undef"; set i_stdarg; eval $setvar
9169 val="$define"; set i_varargs; eval $setvar
9170 ;;
9171 esac
9172 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
9173esac
9174$rm -f varargs*
9175
9176: see if stddef is available
9177set stddef.h i_stddef
9178eval $inhdr
9179
9180: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
9181set sys/filio.h i_sysfilio
9182eval $inhdr
9183echo " "
9184if $test `./findhdr sys/ioctl.h`; then
9185 val="$define"
9186 echo '<sys/ioctl.h> found.' >&4
9187else
9188 val="$undef"
9189 if $test $i_sysfilio = "$define"; then
9190 echo '<sys/ioctl.h> NOT found.' >&4
9191 else
9192 $test $i_sgtty = "$define" && xxx="sgtty.h"
9193 $test $i_termio = "$define" && xxx="termio.h"
9194 $test $i_termios = "$define" && xxx="termios.h"
9195echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
9196 fi
9197fi
9198set i_sysioctl
9199eval $setvar
9200
9201: see if this is a sys/param system
9202set sys/param.h i_sysparam
9203eval $inhdr
9204
9205: see if sys/resource.h has to be included
9206set sys/resource.h i_sysresrc
9207eval $inhdr
9208
9209: see if sys/stat.h is available
9210set sys/stat.h i_sysstat
9211eval $inhdr
9212
9213: see if sys/types.h has to be included
9214set sys/types.h i_systypes
9215eval $inhdr
9216
9217: see if this is a sys/un.h system
9218set sys/un.h i_sysun
9219eval $inhdr
9220
9221: see if this is a syswait system
9222set sys/wait.h i_syswait
9223eval $inhdr
9224
9225: see if this is an utime system
9226set utime.h i_utime
9227eval $inhdr
9228
9229: see if this is a values.h system
9230set values.h i_values
9231eval $inhdr
9232
9233: see if this is a vfork system
9234case "$d_vfork" in
9235"$define")
9236 set vfork.h i_vfork
9237 eval $inhdr
9238 ;;
9239*)
9240 i_vfork="$undef"
9241 ;;
9242esac
9243
9244: see if gdbm.h is available
9245set gdbm.h t_gdbm
9246eval $inhdr
9247case "$t_gdbm" in
9248$define)
9249 : see if gdbm_open exists
9250 set gdbm_open d_gdbm_open
9251 eval $inlibc
9252 case "$d_gdbm_open" in
9253 $undef)
9254 t_gdbm="$undef"
9255 echo "We won't be including <gdbm.h>"
9256 ;;
9257 esac
9258 ;;
9259esac
9260val="$t_gdbm"
9261set i_gdbm
9262eval $setvar
9263
9264echo " "
9265echo "Looking for extensions..." >&4
9266cd ../ext
9267: If we are using the old config.sh, known_extensions may contain
9268: old or inaccurate or duplicate values.
9269known_extensions=''
9270: We do not use find because it might not be available.
9271: We do not just use MANIFEST because the user may have dropped
9272: some additional extensions into the source tree and expect them
9273: to be built.
9274for xxx in * ; do
9275 if $test -f $xxx/$xxx.xs; then
9276 known_extensions="$known_extensions $xxx"
9277 else
9278 if $test -d $xxx; then
9279 cd $xxx
9280 for yyy in * ; do
9281 if $test -f $yyy/$yyy.xs; then
9282 known_extensions="$known_extensions $xxx/$yyy"
9283 fi
9284 done
9285 cd ..
9286 fi
9287 fi
9288done
9289set X $known_extensions
9290shift
9291known_extensions="$*"
9292cd ../UU
9293
9294: Now see which are supported on this system.
9295avail_ext=''
9296for xxx in $known_extensions ; do
9297 case "$xxx" in
9298 DB_File) case "$i_db" in
9299 $define) avail_ext="$avail_ext $xxx" ;;
9300 esac
9301 ;;
9302 GDBM_File) case "$i_gdbm" in
9303 $define) avail_ext="$avail_ext $xxx" ;;
9304 esac
9305 ;;
9306 NDBM_File) case "$i_ndbm" in
9307 $define) avail_ext="$avail_ext $xxx" ;;
9308 esac
9309 ;;
9310 ODBM_File) case "${i_dbm}${i_rpcsvcdbm}" in
9311 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
9312 esac
9313 ;;
9314 POSIX) case "$useposix" in
9315 true|define|y) avail_ext="$avail_ext $xxx" ;;
9316 esac
9317 ;;
9318 Opcode) case "$useopcode" in
9319 true|define|y) avail_ext="$avail_ext $xxx" ;;
9320 esac
9321 ;;
9322 Socket) case "$d_socket" in
9323 $define) avail_ext="$avail_ext $xxx" ;;
9324 esac
9325 ;;
9326 *) avail_ext="$avail_ext $xxx"
9327 ;;
9328 esac
9329done
9330
9331set X $avail_ext
9332shift
9333avail_ext="$*"
9334
9335case $usedl in
9336$define)
9337 $cat <<EOM
9338A number of extensions are supplied with $package. You may choose to
9339compile these extensions for dynamic loading (the default), compile
9340them into the $package executable (static loading), or not include
9341them at all. Answer "none" to include no extensions.
9342
9343EOM
9344 case "$dynamic_ext" in
9345 '') dflt="$avail_ext" ;;
9346 *) dflt="$dynamic_ext" ;;
9347 esac
9348 case "$dflt" in
9349 '') dflt=none;;
9350 esac
9351 rp="What extensions do you wish to load dynamically?"
9352 . ./myread
9353 case "$ans" in
9354 none) dynamic_ext=' ' ;;
9355 *) dynamic_ext="$ans" ;;
9356 esac
9357
9358 case "$static_ext" in
9359 '')
9360 : Exclude those already listed in dynamic linking
9361 dflt=''
9362 for xxx in $avail_ext; do
9363 case " $dynamic_ext " in
9364 *" $xxx "*) ;;
9365 *) dflt="$dflt $xxx" ;;
9366 esac
9367 done
9368 set X $dflt
9369 shift
9370 dflt="$*"
9371 ;;
9372 *) dflt="$static_ext"
9373 ;;
9374 esac
9375
9376 case "$dflt" in
9377 '') dflt=none;;
9378 esac
9379 rp="What extensions do you wish to load statically?"
9380 . ./myread
9381 case "$ans" in
9382 none) static_ext=' ' ;;
9383 *) static_ext="$ans" ;;
9384 esac
9385 ;;
9386*)
9387 $cat <<EOM
9388A number of extensions are supplied with $package. Answer "none"
9389to include no extensions.
9390
9391EOM
9392 case "$static_ext" in
9393 '') dflt="$avail_ext" ;;
9394 *) dflt="$static_ext" ;;
9395 esac
9396
9397 case "$dflt" in
9398 '') dflt=none;;
9399 esac
9400 rp="What extensions do you wish to include?"
9401 . ./myread
9402 case "$ans" in
9403 none) static_ext=' ' ;;
9404 *) static_ext="$ans" ;;
9405 esac
9406 ;;
9407esac
9408
9409set X $dynamic_ext $static_ext
9410shift
9411extensions="$*"
9412
9413: Remove build directory name from cppstdin so it can be used from
9414: either the present location or the final installed location.
9415echo " "
9416: Get out of the UU directory to get correct path name.
9417cd ..
9418case "$cppstdin" in
9419`pwd`/cppstdin)
9420 echo "Stripping down cppstdin path name"
9421 cppstdin=cppstdin
9422 ;;
9423esac
9424cd UU
9425
9426: end of configuration questions
9427echo " "
9428echo "End of configuration questions."
9429echo " "
9430
9431: back to where it started
9432if test -d ../UU; then
9433 cd ..
9434fi
9435
9436: configuration may be patched via a 'config.over' file
9437if $test -f config.over; then
9438 echo " "
9439 dflt=y
9440 rp='I see a config.over file. Do you wish to load it?'
9441 . UU/myread
9442 case "$ans" in
9443 n*) echo "OK, I'll ignore it.";;
9444 *) . ./config.over
9445 echo "Configuration override changes have been loaded."
9446 ;;
9447 esac
9448fi
9449
9450: in case they want portability, strip down executable paths
9451case "$d_portable" in
9452"$define")
9453 echo " "
9454 echo "Stripping down executable paths..." >&4
9455 for file in $loclist $trylist; do
9456 eval $file="\$file"
9457 done
9458 ;;
9459esac
9460
9461: create config.sh file
9462echo " "
9463echo "Creating config.sh..." >&4
9464$spitshell <<EOT >config.sh
9465$startsh
9466#
9467# This file was produced by running the Configure script. It holds all the
9468# definitions figured out by Configure. Should you modify one of these values,
9469# do not forget to propagate your changes by running "Configure -der". You may
9470# instead choose to run each of the .SH files by yourself, or "Configure -S".
9471#
9472
9473# Configuration time: $cf_time
9474# Configured by: $cf_by
9475# Target system: $myuname
9476
9477Author='$Author'
9478Date='$Date'
9479Header='$Header'
9480Id='$Id'
9481Locker='$Locker'
9482Log='$Log'
9483Mcc='$Mcc'
9484RCSfile='$RCSfile'
9485Revision='$Revision'
9486Source='$Source'
9487State='$State'
9488afs='$afs'
9489alignbytes='$alignbytes'
9490aphostname='$aphostname'
9491ar='$ar'
9492archlib='$archlib'
9493archlibexp='$archlibexp'
9494archname='$archname'
9495archobjs='$archobjs'
9496awk='$awk'
9497baserev='$baserev'
9498bash='$bash'
9499bin='$bin'
9500binexp='$binexp'
9501bison='$bison'
9502byacc='$byacc'
9503byteorder='$byteorder'
9504c='$c'
9505castflags='$castflags'
9506cat='$cat'
9507cc='$cc'
9508cccdlflags='$cccdlflags'
9509ccdlflags='$ccdlflags'
9510ccflags='$ccflags'
9511cf_by='$cf_by'
9512cf_email='$cf_email'
9513cf_time='$cf_time'
9514chgrp='$chgrp'
9515chmod='$chmod'
9516chown='$chown'
9517clocktype='$clocktype'
9518comm='$comm'
9519compress='$compress'
9520contains='$contains'
9521cp='$cp'
9522cpio='$cpio'
9523cpp='$cpp'
9524cpp_stuff='$cpp_stuff'
9525cppflags='$cppflags'
9526cpplast='$cpplast'
9527cppminus='$cppminus'
9528cpprun='$cpprun'
9529cppstdin='$cppstdin'
9530cryptlib='$cryptlib'
9531csh='$csh'
9532d_Gconvert='$d_Gconvert'
9533d_access='$d_access'
9534d_alarm='$d_alarm'
9535d_archlib='$d_archlib'
9536d_attribut='$d_attribut'
9537d_bcmp='$d_bcmp'
9538d_bcopy='$d_bcopy'
9539d_bsd='$d_bsd'
9540d_bsdpgrp='$d_bsdpgrp'
9541d_bzero='$d_bzero'
9542d_casti32='$d_casti32'
9543d_castneg='$d_castneg'
9544d_charvspr='$d_charvspr'
9545d_chown='$d_chown'
9546d_chroot='$d_chroot'
9547d_chsize='$d_chsize'
9548d_closedir='$d_closedir'
9549d_const='$d_const'
9550d_crypt='$d_crypt'
9551d_csh='$d_csh'
9552d_cuserid='$d_cuserid'
9553d_dbl_dig='$d_dbl_dig'
9554d_difftime='$d_difftime'
9555d_dirnamlen='$d_dirnamlen'
9556d_dlerror='$d_dlerror'
9557d_dlopen='$d_dlopen'
9558d_dlsymun='$d_dlsymun'
9559d_dosuid='$d_dosuid'
9560d_dup2='$d_dup2'
9561d_eofnblk='$d_eofnblk'
9562d_eunice='$d_eunice'
9563d_fchmod='$d_fchmod'
9564d_fchown='$d_fchown'
9565d_fcntl='$d_fcntl'
9566d_fd_macros='$d_fd_macros'
9567d_fd_set='$d_fd_set'
9568d_fds_bits='$d_fds_bits'
9569d_fgetpos='$d_fgetpos'
9570d_flexfnam='$d_flexfnam'
9571d_flock='$d_flock'
9572d_fork='$d_fork'
9573d_fpathconf='$d_fpathconf'
9574d_fsetpos='$d_fsetpos'
9575d_getgrps='$d_getgrps'
9576d_gethent='$d_gethent'
9577d_gethname='$d_gethname'
9578d_getlogin='$d_getlogin'
9579d_getpgrp2='$d_getpgrp2'
9580d_getpgrp='$d_getpgrp'
9581d_getppid='$d_getppid'
9582d_getprior='$d_getprior'
9583d_htonl='$d_htonl'
9584d_index='$d_index'
9585d_isascii='$d_isascii'
9586d_killpg='$d_killpg'
9587d_link='$d_link'
9588d_locconv='$d_locconv'
9589d_lockf='$d_lockf'
9590d_lstat='$d_lstat'
9591d_mblen='$d_mblen'
9592d_mbstowcs='$d_mbstowcs'
9593d_mbtowc='$d_mbtowc'
9594d_memcmp='$d_memcmp'
9595d_memcpy='$d_memcpy'
9596d_memmove='$d_memmove'
9597d_memset='$d_memset'
9598d_mkdir='$d_mkdir'
9599d_mkfifo='$d_mkfifo'
9600d_mktime='$d_mktime'
9601d_msg='$d_msg'
9602d_msgctl='$d_msgctl'
9603d_msgget='$d_msgget'
9604d_msgrcv='$d_msgrcv'
9605d_msgsnd='$d_msgsnd'
9606d_mymalloc='$d_mymalloc'
9607d_nice='$d_nice'
9608d_oldarchlib='$d_oldarchlib'
9609d_oldsock='$d_oldsock'
9610d_open3='$d_open3'
9611d_pathconf='$d_pathconf'
9612d_pause='$d_pause'
9613d_phostname='$d_phostname'
9614d_pipe='$d_pipe'
9615d_poll='$d_poll'
9616d_portable='$d_portable'
9617d_pwage='$d_pwage'
9618d_pwchange='$d_pwchange'
9619d_pwclass='$d_pwclass'
9620d_pwcomment='$d_pwcomment'
9621d_pwexpire='$d_pwexpire'
9622d_pwquota='$d_pwquota'
9623d_readdir='$d_readdir'
9624d_readlink='$d_readlink'
9625d_rename='$d_rename'
9626d_rewinddir='$d_rewinddir'
9627d_rmdir='$d_rmdir'
9628d_safebcpy='$d_safebcpy'
9629d_safemcpy='$d_safemcpy'
9630d_seekdir='$d_seekdir'
9631d_select='$d_select'
9632d_sem='$d_sem'
9633d_semctl='$d_semctl'
9634d_semget='$d_semget'
9635d_semop='$d_semop'
9636d_setegid='$d_setegid'
9637d_seteuid='$d_seteuid'
9638d_setlinebuf='$d_setlinebuf'
9639d_setlocale='$d_setlocale'
9640d_setpgid='$d_setpgid'
9641d_setpgrp2='$d_setpgrp2'
9642d_setpgrp='$d_setpgrp'
9643d_setprior='$d_setprior'
9644d_setregid='$d_setregid'
9645d_setresgid='$d_setresgid'
9646d_setresuid='$d_setresuid'
9647d_setreuid='$d_setreuid'
9648d_setrgid='$d_setrgid'
9649d_setruid='$d_setruid'
9650d_setsid='$d_setsid'
9651d_sfio='$d_sfio'
9652d_shm='$d_shm'
9653d_shmat='$d_shmat'
9654d_shmatprototype='$d_shmatprototype'
9655d_shmctl='$d_shmctl'
9656d_shmdt='$d_shmdt'
9657d_shmget='$d_shmget'
9658d_sigaction='$d_sigaction'
9659d_sigsetjmp='$d_sigsetjmp'
9660d_socket='$d_socket'
9661d_sockpair='$d_sockpair'
9662d_statblks='$d_statblks'
9663d_stdio_cnt_lval='$d_stdio_cnt_lval'
9664d_stdio_ptr_lval='$d_stdio_ptr_lval'
9665d_stdiobase='$d_stdiobase'
9666d_stdstdio='$d_stdstdio'
9667d_strchr='$d_strchr'
9668d_strcoll='$d_strcoll'
9669d_strctcpy='$d_strctcpy'
9670d_strerrm='$d_strerrm'
9671d_strerror='$d_strerror'
9672d_strxfrm='$d_strxfrm'
9673d_suidsafe='$d_suidsafe'
9674d_symlink='$d_symlink'
9675d_syscall='$d_syscall'
9676d_sysconf='$d_sysconf'
9677d_sysernlst='$d_sysernlst'
9678d_syserrlst='$d_syserrlst'
9679d_system='$d_system'
9680d_tcgetpgrp='$d_tcgetpgrp'
9681d_tcsetpgrp='$d_tcsetpgrp'
9682d_telldir='$d_telldir'
9683d_time='$d_time'
9684d_times='$d_times'
9685d_truncate='$d_truncate'
9686d_tzname='$d_tzname'
9687d_umask='$d_umask'
9688d_uname='$d_uname'
9689d_vfork='$d_vfork'
9690d_void_closedir='$d_void_closedir'
9691d_voidsig='$d_voidsig'
9692d_voidtty='$d_voidtty'
9693d_volatile='$d_volatile'
9694d_vprintf='$d_vprintf'
9695d_wait4='$d_wait4'
9696d_waitpid='$d_waitpid'
9697d_wcstombs='$d_wcstombs'
9698d_wctomb='$d_wctomb'
9699d_xenix='$d_xenix'
9700date='$date'
9701db_hashtype='$db_hashtype'
9702db_prefixtype='$db_prefixtype'
9703defvoidused='$defvoidused'
9704direntrytype='$direntrytype'
9705dlext='$dlext'
9706dlsrc='$dlsrc'
9707dynamic_ext='$dynamic_ext'
9708eagain='$eagain'
9709echo='$echo'
9710egrep='$egrep'
9711emacs='$emacs'
9712eunicefix='$eunicefix'
9713exe_ext='$exe_ext'
9714expr='$expr'
9715extensions='$extensions'
9716find='$find'
9717firstmakefile='$firstmakefile'
9718flex='$flex'
9719fpostype='$fpostype'
9720freetype='$freetype'
9721full_csh='$full_csh'
9722full_sed='$full_sed'
9723gcc='$gcc'
9724gccversion='$gccversion'
9725gidtype='$gidtype'
9726glibpth='$glibpth'
9727grep='$grep'
9728groupcat='$groupcat'
9729groupstype='$groupstype'
9730gzip='$gzip'
9731h_fcntl='$h_fcntl'
9732h_sysfile='$h_sysfile'
9733hint='$hint'
9734hostcat='$hostcat'
9735huge='$huge'
9736i_bsdioctl='$i_bsdioctl'
9737i_db='$i_db'
9738i_dbm='$i_dbm'
9739i_dirent='$i_dirent'
9740i_dld='$i_dld'
9741i_dlfcn='$i_dlfcn'
9742i_fcntl='$i_fcntl'
9743i_float='$i_float'
9744i_gdbm='$i_gdbm'
9745i_grp='$i_grp'
9746i_limits='$i_limits'
9747i_locale='$i_locale'
9748i_malloc='$i_malloc'
9749i_math='$i_math'
9750i_memory='$i_memory'
9751i_ndbm='$i_ndbm'
9752i_neterrno='$i_neterrno'
9753i_niin='$i_niin'
9754i_pwd='$i_pwd'
9755i_rpcsvcdbm='$i_rpcsvcdbm'
9756i_sfio='$i_sfio'
9757i_sgtty='$i_sgtty'
9758i_stdarg='$i_stdarg'
9759i_stddef='$i_stddef'
9760i_stdlib='$i_stdlib'
9761i_string='$i_string'
9762i_sysdir='$i_sysdir'
9763i_sysfile='$i_sysfile'
9764i_sysfilio='$i_sysfilio'
9765i_sysin='$i_sysin'
9766i_sysioctl='$i_sysioctl'
9767i_sysndir='$i_sysndir'
9768i_sysparam='$i_sysparam'
9769i_sysresrc='$i_sysresrc'
9770i_sysselct='$i_sysselct'
9771i_syssockio='$i_syssockio'
9772i_sysstat='$i_sysstat'
9773i_systime='$i_systime'
9774i_systimek='$i_systimek'
9775i_systimes='$i_systimes'
9776i_systypes='$i_systypes'
9777i_sysun='$i_sysun'
9778i_syswait='$i_syswait'
9779i_termio='$i_termio'
9780i_termios='$i_termios'
9781i_time='$i_time'
9782i_unistd='$i_unistd'
9783i_utime='$i_utime'
9784i_values='$i_values'
9785i_varargs='$i_varargs'
9786i_varhdr='$i_varhdr'
9787i_vfork='$i_vfork'
9788incpath='$incpath'
9789inews='$inews'
9790installarchlib='$installarchlib'
9791installbin='$installbin'
9792installman1dir='$installman1dir'
9793installman3dir='$installman3dir'
9794installprivlib='$installprivlib'
9795installscript='$installscript'
9796installsitearch='$installsitearch'
9797installsitelib='$installsitelib'
9798intsize='$intsize'
9799known_extensions='$known_extensions'
9800ksh='$ksh'
9801large='$large'
9802ld='$ld'
9803lddlflags='$lddlflags'
9804ldflags='$ldflags'
9805less='$less'
9806lib_ext='$lib_ext'
9807libc='$libc'
9808libperl='$libperl'
9809libpth='$libpth'
9810libs='$libs'
9811libswanted='$libswanted'
9812line='$line'
9813lint='$lint'
9814lkflags='$lkflags'
9815ln='$ln'
9816lns='$lns'
9817locincpth='$locincpth'
9818loclibpth='$loclibpth'
9819lp='$lp'
9820lpr='$lpr'
9821ls='$ls'
9822lseektype='$lseektype'
9823mail='$mail'
9824mailx='$mailx'
9825make='$make'
9826make_set_make='$make_set_make'
9827mallocobj='$mallocobj'
9828mallocsrc='$mallocsrc'
9829malloctype='$malloctype'
9830man1dir='$man1dir'
9831man1direxp='$man1direxp'
9832man1ext='$man1ext'
9833man3dir='$man3dir'
9834man3direxp='$man3direxp'
9835man3ext='$man3ext'
9836medium='$medium'
9837mips='$mips'
9838mips_type='$mips_type'
9839mkdir='$mkdir'
9840models='$models'
9841modetype='$modetype'
9842more='$more'
9843mv='$mv'
9844myarchname='$myarchname'
9845mydomain='$mydomain'
9846myhostname='$myhostname'
9847myuname='$myuname'
9848n='$n'
9849nm_opt='$nm_opt'
9850nm_so_opt='$nm_so_opt'
9851nroff='$nroff'
9852o_nonblock='$o_nonblock'
9853obj_ext='$obj_ext'
9854oldarchlib='$oldarchlib'
9855oldarchlibexp='$oldarchlibexp'
9856optimize='$optimize'
9857orderlib='$orderlib'
9858osname='$osname'
9859osvers='$osvers'
9860package='$package'
9861pager='$pager'
9862passcat='$passcat'
9863patchlevel='$patchlevel'
9864path_sep='$path_sep'
9865perl='$perl'
9866perladmin='$perladmin'
9867perlpath='$perlpath'
9868pg='$pg'
9869phostname='$phostname'
9870plibpth='$plibpth'
9871pmake='$pmake'
9872pr='$pr'
9873prefix='$prefix'
9874prefixexp='$prefixexp'
9875privlib='$privlib'
9876privlibexp='$privlibexp'
9877prototype='$prototype'
9878randbits='$randbits'
9879ranlib='$ranlib'
9880rd_nodata='$rd_nodata'
9881rm='$rm'
9882rmail='$rmail'
9883runnm='$runnm'
9884scriptdir='$scriptdir'
9885scriptdirexp='$scriptdirexp'
9886sed='$sed'
9887selecttype='$selecttype'
9888sendmail='$sendmail'
9889sh='$sh'
9890shar='$shar'
9891sharpbang='$sharpbang'
9892shmattype='$shmattype'
9893shsharp='$shsharp'
9894sig_name='$sig_name'
9895sig_num='$sig_num'
9896signal_t='$signal_t'
9897sitearch='$sitearch'
9898sitearchexp='$sitearchexp'
9899sitelib='$sitelib'
9900sitelibexp='$sitelibexp'
9901sizetype='$sizetype'
9902sleep='$sleep'
9903smail='$smail'
9904small='$small'
9905so='$so'
9906sockethdr='$sockethdr'
9907socketlib='$socketlib'
9908sort='$sort'
9909spackage='$spackage'
9910spitshell='$spitshell'
9911split='$split'
9912ssizetype='$ssizetype'
9913startperl='$startperl'
9914startsh='$startsh'
9915static_ext='$static_ext'
9916stdchar='$stdchar'
9917stdio_base='$stdio_base'
9918stdio_bufsiz='$stdio_bufsiz'
9919stdio_cnt='$stdio_cnt'
9920stdio_filbuf='$stdio_filbuf'
9921stdio_ptr='$stdio_ptr'
9922strings='$strings'
9923submit='$submit'
9924subversion='$subversion'
9925sysman='$sysman'
9926tail='$tail'
9927tar='$tar'
9928tbl='$tbl'
9929test='$test'
9930timeincl='$timeincl'
9931timetype='$timetype'
9932touch='$touch'
9933tr='$tr'
9934troff='$troff'
9935uidtype='$uidtype'
9936uname='$uname'
9937uniq='$uniq'
9938usedl='$usedl'
9939usemymalloc='$usemymalloc'
9940usenm='$usenm'
9941useopcode='$useopcode'
9942useperlio='$useperlio'
9943useposix='$useposix'
9944usesfio='$usesfio'
9945useshrplib='$useshrplib'
9946usevfork='$usevfork'
9947usrinc='$usrinc'
9948uuname='$uuname'
9949vi='$vi'
9950voidflags='$voidflags'
9951xlibpth='$xlibpth'
9952zcat='$zcat'
9953zip='$zip'
9954EOT
9955
9956: add special variables
9957$test -f patchlevel.h && \
9958awk '/^#define/ {printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
9959echo "CONFIG=true" >>config.sh
9960
9961: propagate old symbols
9962if $test -f UU/config.sh; then
9963 <UU/config.sh sort | uniq >UU/oldconfig.sh
9964 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
9965 sort | uniq -u >UU/oldsyms
9966 set X `cat UU/oldsyms`
9967 shift
9968 case $# in
9969 0) ;;
9970 *)
9971 cat <<EOM
9972Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
9973EOM
9974 echo "# Variables propagated from previous config.sh file." >>config.sh
9975 for sym in `cat UU/oldsyms`; do
9976 echo " Propagating $hint variable "'$'"$sym..."
9977 eval 'tmp="$'"${sym}"'"'
9978 echo "$tmp" | \
9979 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
9980 done
9981 ;;
9982 esac
9983fi
9984
9985: Finish up by extracting the .SH files
9986case "$alldone" in
9987exit)
9988 $rm -rf UU
9989 echo "Done."
9990 exit 0
9991 ;;
9992cont)
9993 ;;
9994'')
9995 dflt=''
9996 nostick=true
9997 $cat <<EOM
9998
9999If you'd like to make any changes to the config.sh file before I begin
10000to configure things, do it as a shell escape now (e.g. !vi config.sh).
10001
10002EOM
10003 rp="Press return or use a shell escape to edit config.sh:"
10004 . UU/myread
10005 nostick=''
10006 case "$ans" in
10007 '') ;;
10008 *) : in case they cannot read
10009 sh 1>&4 -c "$ans";;
10010 esac
10011 ;;
10012esac
10013
10014: if this fails, just run all the .SH files by hand
10015. ./config.sh
10016
10017echo " "
10018exec 1>&4
10019. ./UU/extract
10020
10021if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
10022 dflt=y
10023 case "$silent" in
10024 true) ;;
10025 *)
10026 $cat <<EOM
10027
10028Now you need to generate make dependencies by running "make depend".
10029You might prefer to run it in background: "make depend > makedepend.out &"
10030It can take a while, so you might not want to run it right now.
10031
10032EOM
10033 ;;
10034 esac
10035 rp="Run make depend now?"
10036 . UU/myread
10037 case "$ans" in
10038 y*)
10039 make depend && echo "Now you must run a make."
10040 ;;
10041 *)
10042 echo "You must run 'make depend' then 'make'."
10043 ;;
10044 esac
10045elif test -f [Mm]akefile; then
10046 echo " "
10047 echo "Now you must run a make."
10048else
10049 echo "Done."
10050fi
10051
10052$rm -f kit*isdone ark*isdone
10053$rm -rf UU
10054
10055: End of Configure
10056