This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
This is my patch patch.1m for perl5.001.
[perl5.git] / Configure
CommitLineData
2304df62
AD
1#! /bin/sh
2#
3# If these # comments don't work, trim them. Don't worry about any other
4# shell scripts, Configure will trim # comments from them for you.
5#
6# (If you are trying to port this package to a machine without sh,
7# I would suggest you have a look at the prototypical config_h.SH file
8# and edit it to reflect your system. Some packages may include samples
9# of config.h for certain machines, so you might look for one of those.)
10#
11# Yes, you may rip this off to use in other distribution packages. This
12# script belongs to the public domain and cannot be copyrighted.
13#
14# (Note: this Configure script was generated automatically. Rather than
15# working with this copy of Configure, you may wish to get metaconfig.
16# The dist-3.0 package (which contains metaconfig) was posted in
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
232e078e 21# $Id: Head.U,v 3.0.1.7 1995/03/21 08:46:15 ram Exp $
2304df62 22#
e50aee73 23# Generated on Thu Jun 22 10:38:35 EDT 1995 [metaconfig 3.0 PL55]
2304df62
AD
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
a0d0e21e
LW
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
59: Proper PATH setting
60paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 61paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 62paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 63paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e
AD
64paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
65paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
66paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
67paths="$paths /sbin /usr/sbin /usr/libexec"
a0d0e21e
LW
68
69for p in $paths
70do
71 case ":$PATH:" in
72 *:$p:*) ;;
73 *) test -d $p && PATH=$PATH:$p ;;
74 esac
75done
76
77PATH=.:$PATH
2304df62
AD
78export PATH
79
a0d0e21e 80: Sanity checks
2304df62 81if test ! -t 0; then
a0d0e21e 82 echo "Say 'sh $me', not 'sh <$me'"
2304df62
AD
83 exit 1
84fi
85
86: On HP-UX, large Configure scripts may exercise a bug in /bin/sh
87if test -f /hp-ux -a -f /bin/ksh; then
88 if (PATH=.; alias -x) >/dev/null 2>&1; then
89 : already under /bin/ksh
90 else
91 cat <<'EOM'
92(Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.)
93EOM
ecfc5424 94 unset ENV
2304df62
AD
95 exec /bin/ksh $0 "$@"
96 fi
97else
98 : Warn them if they use ksh on other systems
99 (PATH=.; alias -x) >/dev/null 2>&1 && \
a0d0e21e
LW
100 cat <<EOM
101(I see you are using the Korn shell. Some ksh's blow up on $me,
2304df62
AD
102especially on exotic machines. If yours does, try the Bourne shell instead.)
103EOM
104fi
105
106: Configure runs within the UU subdirectory
107test -d UU || mkdir UU
108cd UU && rm -f *
109
a0d0e21e 110dynamic_ext=''
2304df62 111extensions=''
a0d0e21e
LW
112known_extensions=''
113static_ext=''
114useposix=''
ecfc5424 115d_bsd=''
2304df62
AD
116d_eunice=''
117d_xenix=''
118eunicefix=''
119Mcc=''
120awk=''
121bash=''
122bison=''
123byacc=''
124cat=''
125chgrp=''
126chmod=''
127chown=''
ecfc5424 128comm=''
2304df62
AD
129compress=''
130cp=''
131cpio=''
132cpp=''
133csh=''
134date=''
135echo=''
136egrep=''
137emacs=''
138expr=''
139find=''
140flex=''
141gcc=''
142grep=''
143inews=''
144ksh=''
145less=''
146line=''
147lint=''
148ln=''
149lp=''
150lpr=''
151ls=''
152mail=''
153mailx=''
154make=''
155mkdir=''
156more=''
157mv=''
158nroff=''
159perl=''
160pg=''
161pmake=''
162pr=''
163rm=''
164rmail=''
165sed=''
166sendmail=''
167sh=''
168shar=''
169sleep=''
170smail=''
171sort=''
172submit=''
173tail=''
174tar=''
175tbl=''
176test=''
177touch=''
178tr=''
179troff=''
180uname=''
181uniq=''
182uuname=''
183vi=''
184zcat=''
1aef975c 185full_sed=''
a0d0e21e 186libswanted=''
2304df62
AD
187hint=''
188myuname=''
85e6fe83
LW
189osname=''
190osvers=''
2304df62
AD
191Author=''
192Date=''
193Header=''
194Id=''
195Locker=''
196Log=''
197RCSfile=''
198Revision=''
199Source=''
200State=''
201afs=''
a0d0e21e
LW
202alignbytes=''
203archlib=''
204archlibexp=''
a0d0e21e
LW
205d_archlib=''
206installarchlib=''
40000a8c
AD
207archname=''
208myarchname=''
ecfc5424 209baserev=''
2304df62
AD
210bin=''
211binexp=''
212installbin=''
213byteorder=''
214cc=''
215gccversion=''
216ccflags=''
217cppflags=''
218ldflags=''
219lkflags=''
220optimize=''
221cf_by=''
222cf_time=''
223contains=''
a0d0e21e 224cpp_stuff=''
2304df62
AD
225cpplast=''
226cppminus=''
227cpprun=''
228cppstdin=''
229d_access=''
a0d0e21e 230d_alarm=''
ecfc5424 231d_attribut=''
2304df62
AD
232d_bcmp=''
233d_bcopy=''
234d_bzero=''
235d_casti32=''
236castflags=''
237d_castneg=''
a0d0e21e
LW
238d_chown=''
239d_chroot=''
2304df62 240d_chsize=''
a0d0e21e
LW
241d_closedir=''
242d_void_closedir=''
2304df62
AD
243d_const=''
244cryptlib=''
245d_crypt=''
246d_csh=''
1aef975c 247full_csh=''
a0d0e21e
LW
248d_cuserid=''
249d_dbl_dig=''
250d_difftime=''
251d_dlerror=''
252d_dlopen=''
253d_dlsymun=''
2304df62 254d_dosuid=''
a0d0e21e 255d_suidsafe=''
2304df62
AD
256d_dup2=''
257d_fchmod=''
258d_fchown=''
259d_fcntl=''
a0d0e21e
LW
260d_fd_macros=''
261d_fd_set=''
262d_fds_bits=''
263d_fgetpos=''
2304df62
AD
264d_flexfnam=''
265d_flock=''
a0d0e21e
LW
266d_fork=''
267d_fsetpos=''
268d_Gconvert=''
2304df62
AD
269d_getgrps=''
270d_gethent=''
271aphostname=''
272d_gethname=''
273d_phostname=''
274d_uname=''
a0d0e21e 275d_getlogin=''
2304df62
AD
276d_getpgrp2=''
277d_getpgrp=''
a0d0e21e 278d_getppid=''
2304df62
AD
279d_getprior=''
280d_htonl=''
281d_isascii=''
282d_killpg=''
283d_link=''
a0d0e21e
LW
284d_locconv=''
285d_lockf=''
2304df62 286d_lstat=''
a0d0e21e
LW
287d_mblen=''
288d_mbstowcs=''
289d_mbtowc=''
2304df62
AD
290d_memcmp=''
291d_memcpy=''
292d_memmove=''
293d_memset=''
294d_mkdir=''
a0d0e21e
LW
295d_mkfifo=''
296d_mktime=''
2304df62
AD
297d_msg=''
298d_msgctl=''
299d_msgget=''
300d_msgrcv=''
301d_msgsnd=''
a0d0e21e 302d_nice=''
2304df62 303d_open3=''
a0d0e21e
LW
304d_fpathconf=''
305d_pathconf=''
306d_pause=''
307d_pipe=''
2304df62
AD
308d_portable=''
309d_readdir=''
85e6fe83
LW
310d_rewinddir=''
311d_seekdir=''
312d_telldir=''
a0d0e21e 313d_readlink=''
2304df62
AD
314d_rename=''
315d_rmdir=''
316d_safebcpy=''
317d_safemcpy=''
318d_select=''
319d_sem=''
320d_semctl=''
321d_semget=''
322d_semop=''
323d_setegid=''
324d_seteuid=''
a0d0e21e 325d_setlinebuf=''
2304df62
AD
326d_setlocale=''
327d_setpgid=''
328d_setpgrp2=''
329d_bsdpgrp=''
330d_setpgrp=''
331d_setprior=''
332d_setregid=''
333d_setresgid=''
334d_setresuid=''
335d_setreuid=''
336d_setrgid=''
337d_setruid=''
338d_setsid=''
339d_shm=''
340d_shmat=''
a0d0e21e
LW
341d_shmatprototype=''
342shmattype=''
2304df62
AD
343d_shmctl=''
344d_shmdt=''
345d_shmget=''
346d_oldsock=''
347d_socket=''
348d_sockpair=''
349sockethdr=''
350socketlib=''
351d_statblks=''
c2960299
AD
352d_stdio_cnt_lval=''
353d_stdio_ptr_lval=''
16d20bd9 354d_stdiobase=''
2304df62 355d_stdstdio=''
16d20bd9
AD
356stdio_base=''
357stdio_bufsiz=''
358stdio_cnt=''
359stdio_ptr=''
2304df62
AD
360d_index=''
361d_strchr=''
a0d0e21e 362d_strcoll=''
2304df62
AD
363d_strctcpy=''
364d_strerrm=''
365d_strerror=''
366d_sysernlst=''
367d_syserrlst=''
a0d0e21e 368d_strxfrm=''
2304df62
AD
369d_symlink=''
370d_syscall=''
a0d0e21e 371d_sysconf=''
2304df62 372d_system=''
a0d0e21e
LW
373d_tcgetpgrp=''
374d_tcsetpgrp=''
85e6fe83
LW
375d_time=''
376timetype=''
2304df62
AD
377clocktype=''
378d_times=''
379d_truncate=''
a0d0e21e
LW
380d_tzname=''
381d_umask=''
2304df62 382d_vfork=''
a0d0e21e 383usevfork=''
2304df62
AD
384d_voidsig=''
385signal_t=''
386d_volatile=''
387d_charvspr=''
388d_vprintf=''
389d_wait4=''
390d_waitpid=''
a0d0e21e
LW
391d_wcstombs=''
392d_wctomb=''
393dlext=''
85e6fe83
LW
394cccdlflags=''
395ccdlflags=''
ecfc5424 396d_shrplib=''
2304df62 397dlsrc=''
232e078e 398ld=''
85e6fe83 399lddlflags=''
ecfc5424 400shrpdir=''
2304df62 401usedl=''
a0d0e21e 402fpostype=''
2304df62
AD
403gidtype=''
404groupstype=''
405h_fcntl=''
406h_sysfile=''
ecfc5424
AD
407db_hashtype=''
408db_prefixtype=''
a0d0e21e 409i_db=''
2304df62
AD
410i_dbm=''
411d_dirnamlen=''
a0d0e21e 412direntrytype=''
2304df62 413i_dirent=''
a0d0e21e 414i_dld=''
2304df62
AD
415i_dlfcn=''
416i_fcntl=''
a0d0e21e 417i_float=''
2304df62
AD
418i_gdbm=''
419i_grp=''
a0d0e21e
LW
420i_limits=''
421i_malloc=''
422i_math=''
85e6fe83 423i_memory=''
2304df62 424i_ndbm=''
85e6fe83 425i_neterrno=''
2304df62
AD
426i_niin=''
427i_sysin=''
428d_pwage=''
429d_pwchange=''
430d_pwclass=''
431d_pwcomment=''
432d_pwexpire=''
433d_pwquota=''
434i_pwd=''
2304df62 435i_stddef=''
a0d0e21e 436i_stdlib=''
2304df62
AD
437i_string=''
438strings=''
439i_sysdir=''
440i_sysfile=''
441d_voidtty=''
442i_bsdioctl=''
a0d0e21e 443i_sysfilio=''
2304df62
AD
444i_sysioctl=''
445i_syssockio=''
446i_sysndir=''
a0d0e21e 447i_sysparam=''
2304df62 448i_sysselct=''
1aef975c 449i_sysstat=''
a0d0e21e 450i_systimes=''
fed7345c 451i_systypes=''
2304df62
AD
452i_sgtty=''
453i_termio=''
454i_termios=''
455i_systime=''
456i_systimek=''
457i_time=''
458timeincl=''
85e6fe83 459i_unistd=''
2304df62 460i_utime=''
a0d0e21e 461i_stdarg=''
2304df62
AD
462i_varargs=''
463i_varhdr=''
464i_vfork=''
465intsize=''
2304df62 466libc=''
a0d0e21e 467glibpth=''
2304df62
AD
468libpth=''
469plibpth=''
470xlibpth=''
471libs=''
85e6fe83
LW
472lns=''
473lseektype=''
474d_mymalloc=''
94b6baf5 475freetype=''
2304df62
AD
476mallocobj=''
477mallocsrc=''
478malloctype=''
479usemymalloc=''
16d20bd9
AD
480installman1dir=''
481man1dir=''
482man1direxp=''
483man1ext=''
484installman3dir=''
485man3dir=''
486man3direxp=''
487man3ext=''
2304df62
AD
488huge=''
489large=''
490medium=''
491models=''
492small=''
493split=''
a0d0e21e 494modetype=''
2304df62
AD
495mydomain=''
496myhostname=''
497phostname=''
498c=''
499n=''
500groupcat=''
501hostcat=''
502passcat=''
85e6fe83
LW
503orderlib=''
504ranlib=''
2304df62
AD
505package=''
506spackage=''
ecfc5424 507patchlevel=''
a0d0e21e 508prefix=''
1aef975c 509prefixexp=''
2304df62
AD
510installprivlib=''
511privlib=''
512privlibexp=''
513prototype=''
514randbits=''
515installscript=''
516scriptdir=''
517scriptdirexp=''
a0d0e21e 518selecttype=''
2304df62 519sig_name=''
16d20bd9
AD
520d_sitelib=''
521installsitelib=''
522sitelib=''
523sitelibexp=''
a0d0e21e
LW
524sizetype=''
525so=''
2304df62
AD
526sharpbang=''
527shsharp=''
528spitshell=''
a0d0e21e 529ssizetype=''
2304df62
AD
530startsh=''
531stdchar=''
532sysman=''
533uidtype=''
534nm_opt=''
535runnm=''
536usenm=''
537incpath=''
538mips=''
539mips_type=''
540usrinc=''
541defvoidused=''
542voidflags=''
2304df62
AD
543CONFIG=''
544
ecfc5424
AD
545define='define'
546undef='undef'
547smallmach='pdp11 i8086 z8000 i80286 iAPX286'
548rmlist=''
549
550: We must find out about Eunice early
551eunicefix=':'
552if test -f /etc/unixtovms; then
553 eunicefix=/etc/unixtovms
554fi
555if test -f /etc/unixtovms.exe; then
556 eunicefix=/etc/unixtovms.exe
557fi
558
559: list of known cpp symbols, sorted alphabetically
560al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
561al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
562al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
563al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
564al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
565al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
566al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
567al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
568al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
569al="$al VMS Xenix286"
570al="$al _AIX _AIX32 _AIX370 _AM29000 _COFF _CRAY _CX_UX _EPI"
571al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET"
572al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
573al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
574al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
575al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
576al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
577al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
578al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
579al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
580al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
581al="$al __SVR4_2__ __UMAXV__"
582al="$al ____386BSD____ __alpha __alpha__ __amiga"
583al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
584al="$al __host_mips__"
585al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
586al="$al __hp9000s500 __hp9000s700 __hp9000s800"
587al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
588al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
589al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
590al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
591al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
592al="$al __mc88100 __mc88100__ __mips __mips__"
593al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
594al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
595al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
596al="$al _host_mips _mips _unix"
597al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
598al="$al apollo ardent att386 att3b"
599al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
600al="$al cadmus clipper concurrent convex cray ctix"
601al="$al dmert encore gcos gcx gimpel gould"
602al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
603al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
604al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
605al="$al i186 i286 i386 i486 i8086"
606al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
607al="$al ksr1 linux luna luna88k m68k m88100 m88k"
608al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
609al="$al mc68040 mc68060 mc68k mc68k32 mc700"
610al="$al mc88000 mc88100 merlin mert mips mvs n16"
611al="$al ncl_el ncl_mr"
612al="$al news1500 news1700 news1800 news1900 news3700"
613al="$al news700 news800 news900 ns16000 ns32000"
614al="$al ns32016 ns32332 ns32k nsc32000 os osf"
615al="$al parisc pc532 pdp11 plexus posix pyr"
616al="$al riscix riscos scs sequent sgi sinix sony sony_news"
617al="$al sonyrisc sparc sparclite spectrum stardent stratos"
618al="$al sun sun3 sun386 svr4 sysV68 sysV88"
619al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
620al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
621al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
622al="$al xenix z8000"
623
ecfc5424
AD
624groupstype=''
625i_whoami=''
626: change the next line if compiling for Xenix/286 on Xenix/386
627xlibpth='/usr/lib/386 /lib/386'
628
629: general looking path for locating libraries
630glibpth="/lib/pa1.1 /usr/lib/large /lib /usr/lib $xlibpth"
631glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
632glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib /usr/shlib"
633
634: Private path used by Configure to find libraries. Its value
635: is prepended to libpth. This variable takes care of special
636: machines, like the mips. Usually, it should be empty.
637plibpth=''
638
639: default library list
640libswanted=''
641: full support for void wanted by default
642defvoidused=15
643
644: set useposix=false in your hint file to disable the POSIX extension.
645useposix=true
646: no include file wanted by default
647inclwanted=''
648
649: List of libraries we want.
650libswanted='net socket inet nsl nm ndbm gdbm dbm db malloc dl'
651libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt"
652libswanted="$libswanted ucb bsd BSD PW x"
1aef975c 653: We probably want to search /usr/shlib before most other libraries.
94b6baf5 654: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
655glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
656glibpth="/usr/shlib $glibpth"
657: Do not use vfork unless overridden by a hint file.
658usevfork=false
1aef975c
AD
659: We might as well always be portable. It makes no difference for
660: perl5, and makes people happy.
661d_portable=define
ecfc5424 662
2304df62
AD
663: script used to extract .SH files with variable substitutions
664cat >extract <<'EOS'
665CONFIG=true
666echo "Doing variable substitutions on .SH files..."
667if test -f MANIFEST; then
a0d0e21e
LW
668 shlist=`awk '{print $1}' <MANIFEST | grep '\.SH'`
669 : Pick up possible extension manifests.
670 for dir in ext/* ; do
671 if test -f $dir/MANIFEST; then
672 xxx=`awk '{print $1}' < $dir/MANIFEST |
673 sed -n "/\.SH$/ s@^@$dir/@p"`
674 shlist="$shlist $xxx"
675 fi
676 done
677 set x $shlist
2304df62
AD
678else
679 echo "(Looking for .SH files under the current directory.)"
680 set x `find . -name "*.SH" -print`
681fi
682shift
683case $# in
6840) set x *.SH; shift;;
685esac
686if test ! -f $1; then
687 shift
688fi
689for file in $*; do
690 case "$file" in
691 */*)
692 dir=`expr X$file : 'X\(.*\)/'`
693 file=`expr X$file : 'X.*/\(.*\)'`
694 (cd $dir && . ./$file)
695 ;;
696 *)
697 . ./$file
698 ;;
699 esac
700done
701if test -f config_h.SH; then
702 if test ! -f config.h; then
703 : oops, they left it out of MANIFEST, probably, so do it anyway.
704 . ./config_h.SH
705 fi
706fi
707EOS
708
709: produce awk script to parse command line options
710cat >options.awk <<'EOF'
711BEGIN {
16d20bd9 712 optstr = "dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
713
714 len = length(optstr);
715 for (i = 1; i <= len; i++) {
716 c = substr(optstr, i, 1);
717 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
718 if (a == ":") {
719 arg[c] = 1;
720 i++;
721 }
722 opt[c] = 1;
723 }
724}
725{
726 expect = 0;
727 str = $0;
728 if (substr(str, 1, 1) != "-") {
729 printf("'%s'\n", str);
730 next;
731 }
732 len = length($0);
733 for (i = 2; i <= len; i++) {
734 c = substr(str, i, 1);
735 if (!opt[c]) {
736 printf("-%s\n", substr(str, i));
737 next;
738 }
739 printf("-%s\n", c);
740 if (arg[c]) {
741 if (i < len)
742 printf("'%s'\n", substr(str, i + 1));
743 else
744 expect = 1;
745 next;
746 }
747 }
748}
749END {
750 if (expect)
751 print "?";
752}
753EOF
754
755: process the command line options
756set X `for arg in "$@"; do echo $arg; done | awk -f options.awk`
757eval "set $*"
758shift
759rm -f options.awk
760
761: set up default values
762fastread=''
763reuseval=false
764config_sh=''
765alldone=''
766error=''
767silent=''
768extractsh=''
ecfc5424 769override=''
16d20bd9 770knowitall=''
1aef975c 771rm -f optdef.sh
2304df62
AD
772
773: option parsing
774while test $# -gt 0; do
775 case "$1" in
776 -d) shift; fastread=yes;;
777 -e) shift; alldone=cont;;
778 -f)
779 shift
780 cd ..
781 if test -r "$1"; then
782 config_sh="$1"
783 else
a0d0e21e 784 echo "$me: cannot read config file $1." >&2
2304df62
AD
785 error=true
786 fi
787 cd UU
788 shift;;
789 -h) shift; error=true;;
790 -r) shift; reuseval=true;;
791 -s) shift; silent=true;;
792 -E) shift; alldone=exit;;
16d20bd9 793 -K) shift; knowitall=true;;
ecfc5424 794 -O) shift; override=true;;
2304df62 795 -S) shift; extractsh=true;;
a0d0e21e
LW
796 -D)
797 shift
798 case "$1" in
799 *=)
800 echo "$me: use '-U symbol=', not '-D symbol='." >&2
801 echo "$me: ignoring -D $1" >&2
802 ;;
ecfc5424 803 *=*) echo "$1" | \
1aef975c
AD
804 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
805 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
806 esac
807 shift
808 ;;
809 -U)
810 shift
811 case "$1" in
1aef975c 812 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
813 *=*)
814 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
815 echo "$me: ignoring -U $1" >&2
816 ;;
1aef975c 817 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
818 esac
819 shift
820 ;;
16d20bd9 821 -V) echo "$me generated by metaconfig 3.0 PL55." >&2
2304df62
AD
822 exit 0;;
823 --) break;;
a0d0e21e 824 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
825 *) break;;
826 esac
827done
828
829case "$error" in
830true)
831 cat >&2 <<EOM
16d20bd9 832Usage: $me [-dehrEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
a0d0e21e 833 [-U symbol] [-U symbol=]
2304df62
AD
834 -d : use defaults for all answers.
835 -e : go on without questioning past the production of config.sh.
836 -f : specify an alternate default configuration file.
837 -h : print this help message and exit (with an error status).
838 -r : reuse C symbols value if possible (skips costly nm extraction).
839 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
840 -D : define symbol to have some value:
841 -D symbol symbol gets the value 'define'
842 -D symbol=value symbol gets the value 'value'
2304df62 843 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 844 -K : do not use unless you know what you are doing.
ecfc5424 845 -O : let -D and -U override definitions from loaded configuration file.
2304df62 846 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
847 -U : undefine symbol:
848 -U symbol symbol gets the value 'undef'
849 -U symbol= symbol gets completely empty
2304df62
AD
850 -V : print version number and exit (with a zero status).
851EOM
852 exit 1
853 ;;
854esac
855
856exec 4>&1
857case "$silent" in
858true) exec 1>/dev/null;;
859esac
860
ecfc5424 861: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
862touch optdef.sh
863. ./optdef.sh
a0d0e21e 864
2304df62
AD
865case "$extractsh" in
866true)
867 case "$config_sh" in
868 '') config_sh='config.sh'; config='./config.sh';;
869 /*) config="$config_sh";;
870 *) config="./$config_sh";;
871 esac
872 echo " "
873 echo "Fetching answers from $config_sh..."
874 cd ..
875 . $config
1aef975c 876 test "$override" && . ./optdef.sh
2304df62
AD
877 echo " "
878 . ./UU/extract
879 rm -rf UU
880 echo "Done."
881 exit 0
882 ;;
883esac
884
885: set package name
85e6fe83 886package=perl5
1aef975c
AD
887first=`echo $package | sed -e 's/^\(.\).*/\1/'`
888last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
889case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
890ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
891*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
892esac
2304df62
AD
893
894: Eunice requires " " instead of "", can you believe it
895echo " "
896: Here we go...
897echo "Beginning of configuration questions for $package."
898
1aef975c 899trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2304df62 900
2304df62
AD
901: Some greps do not return status, grrr.
902echo "grimblepritz" >grimble
903if grep blurfldyick grimble >/dev/null 2>&1 ; then
904 contains=contains
905elif grep grimblepritz grimble >/dev/null 2>&1 ; then
906 contains=grep
907else
908 contains=contains
909fi
910rm -f grimble
911: the following should work in any shell
912case "$contains" in
913contains*)
914 echo " "
915 echo "AGH! Grep doesn't return a status. Attempting remedial action."
916 cat >contains <<'EOSS'
917grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
918EOSS
919chmod +x contains
920esac
921
922: first determine how to suppress newline on echo command
923echo " "
924echo "Checking echo to see how to suppress newlines..."
925(echo "hi there\c" ; echo " ") >.echotmp
926if $contains c .echotmp >/dev/null 2>&1 ; then
927 echo "...using -n."
928 n='-n'
929 c=''
930else
931 cat <<'EOM'
932...using \c
933EOM
934 n=''
935 c='\c'
936fi
937echo $n "The star should be here-->$c"
938echo '*'
939rm -f .echotmp
940
941: Now test for existence of everything in MANIFEST
942echo " "
943if test -f ../MANIFEST; then
944 echo "First let's make sure your kit is complete. Checking..." >&4
945 awk '$1 !~ /PACK[A-Z]+/ {print $1}' ../MANIFEST | split -50
946 rm -f missing
947 for filelist in x??; do
948 (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing)
949 done
950 if test -s missing; then
951 cat missing >&4
952 cat >&4 <<'EOM'
953
954THIS PACKAGE SEEMS TO BE INCOMPLETE.
955
956You have the option of continuing the configuration process, despite the
957distinct possibility that your kit is damaged, by typing 'y'es. If you
958do, don't blame me if something goes wrong. I advise you to type 'n'o
959and contact the author (lwall@netlabs.com).
960
961EOM
962 echo $n "Continue? [n] $c" >&4
963 read ans
964 case "$ans" in
965 y*)
966 echo "Continuing..." >&4
967 rm -f missing
968 ;;
969 *)
970 echo "ABORTING..." >&4
971 kill $$
972 ;;
973 esac
974 else
975 echo "Looks good..." >&4
976 fi
977else
978 echo "There is no MANIFEST file. I hope your kit is complete !"
979fi
980rm -f missing x??
981
982: compute the number of columns on the terminal for proper question formatting
983case "$COLUMNS" in
984'') COLUMNS='80';;
985esac
986
987: set up the echo used in my read
988myecho="case \"\$xxxm\" in
989'') echo $n \"\$rp $c\" >&4;;
990*) case \"\$rp\" in
991 '') echo $n \"[\$xxxm] $c\";;
992 *)
993 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
994 echo \"\$rp\" >&4
995 echo $n \"[\$xxxm] $c\" >&4
996 else
997 echo $n \"\$rp [\$xxxm] $c\" >&4
998 fi
999 ;;
1000 esac;;
1001esac"
1002
1003: now set up to do reads with possible shell escape and default assignment
1004cat <<EOSC >myread
1005xxxm=\$dflt
1006$myecho
1007ans='!'
1008case "\$fastread" in
1009yes) case "\$dflt" in
1010 '') ;;
1011 *) ans='';
1012 case "\$silent-\$rp" in
1013 true-) ;;
1014 *) echo " " >&4;;
1015 esac;;
1016 esac;;
1017*) case "\$silent" in
1018 true) case "\$rp" in
1019 '') ans='';;
1020 esac;;
1021 esac;;
1022esac
1023while expr "X\$ans" : "X!" >/dev/null; do
1024 read answ
1025 set x \$xxxm
1026 shift
1027 aok=''; eval "ans=\"\$answ\"" && aok=y
1028 case "\$answ" in
1029 "\$ans")
1030 case "\$ans" in
ecfc5424
AD
1031 \\&*)
1032 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1033 shift
1034 case "\$1" in
1035 -d)
1036 fastread=yes
1037 echo "(OK, I'll run with -d after this question.)"
1038 ;;
1039 -*)
1040 echo "*** Sorry, \$1 not supported yet."
1041 ;;
1042 esac
1043 $myecho
1044 ans=!
1045 ;;
2304df62
AD
1046 "!")
1047 sh 1>&4
1048 echo " "
1049 $myecho
1050 ;;
1051 !*)
1052 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1053 shift
1054 sh 1>&4 -c "\$*"
1055 echo " "
1056 $myecho
1057 ;;
1058 esac;;
1059 *)
1060 case "\$aok" in
1061 y)
1062 echo "*** Substitution done -- please confirm."
1063 xxxm="\$ans"
1064 ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
1065 xxxm="\$ans"
1066 ans=!
1067 ;;
1068 *)
1069 echo "*** Error -- try again."
1070 ans=!
1071 ;;
1072 esac
1073 $myecho
1074 ;;
1075 esac
1076 case "\$ans\$xxxm\$nostick" in
1077 '')
1078 ans=!
1079 $myecho
1080 ;;
1081 esac
1082done
1083case "\$ans" in
1084'') ans="\$xxxm";;
1085esac
1086EOSC
1087
1088: create .config dir to save info across Configure sessions
1089test -d ../.config || mkdir ../.config
1090cat >../.config/README <<EOF
1091This directory created by Configure to save information that should
1092persist across sessions.
1093
1094You may safely delete it if you wish.
1095EOF
1096
1097: general instructions
1098needman=true
1099firsttime=true
1100user=`( (logname) 2>/dev/null || whoami) 2>&1`
1101if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1102 firsttime=false
1103 echo " "
1104 rp='Would you like to see the instructions?'
1105 dflt=n
1106 . ./myread
1107 case "$ans" in
1108 [yY]*) ;;
1109 *) needman=false;;
1110 esac
1111fi
1112if $needman; then
1113 cat <<EOH
1114
1115This installation shell script will examine your system and ask you questions
a0d0e21e 1116to determine how the perl5 package should be installed. If you get
2304df62
AD
1117stuck on a question, you may use a ! shell escape to start a subshell or
1118execute a command. Many of the questions will have default answers in square
1119brackets; typing carriage return will give you the default.
1120
1121On some of the questions which ask for file or directory names you are allowed
1122to use the ~name construct to specify the login directory belonging to "name",
1123even if you don't have a shell which knows about that. Questions where this is
1124allowed will be marked "(~name ok)".
1125
1126EOH
1127 rp=''
1128 dflt='Type carriage return to continue'
1129 . ./myread
1130 cat <<'EOH'
1131
1132The prompter used in this script allows you to use shell variables and
1133backticks in your answers. You may use $1, $2, etc... to refer to the words
1134in the default answer, as if the default line was a set of arguments given to a
1135script shell. This means you may also use $* to repeat the whole default line,
1136so you do not have to re-type everything to add something to the default.
1137
1138Everytime there is a substitution, you will have to confirm. If there is an
1139error (e.g. an unmatched backtick), the default answer will remain unchanged
1140and you will be prompted again.
1141
1142If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1143the questions and use the computed defaults (or the previous answers if there
1144was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424
AD
1145You may also start interactively and then answer '& -d' at any prompt to turn
1146on the non-interactive behaviour for the remaining of the execution.
2304df62
AD
1147
1148EOH
1149 . ./myread
1150 cat <<EOH
1151
1152Much effort has been expended to ensure that this shell script will run on any
1153Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1154Configure and run it again. If you can't run Configure for some reason,
1155you'll have to generate a config.sh file by hand. Whatever problems you
1156have, let me (lwall@netlabs.com) know how I blew it.
2304df62
AD
1157
1158This installation script affects things in two ways:
1159
11601) it may do direct variable substitutions on some of the files included
1161 in this kit.
11622) it builds a config.h file for inclusion in C programs. You may edit
1163 any of these files as the need arises after running this script.
1164
1165If you make a mistake on a question, there is no easy way to back up to it
1166currently. The easiest thing to do is to edit config.sh and rerun all the SH
1167files. Configure will offer to let you do this before it runs the SH files.
1168
1169EOH
1170 dflt='Type carriage return to continue'
1171 . ./myread
1172 case "$firsttime" in
1173 true) echo $user >>../.config/instruct;;
1174 esac
1175fi
1176
1177: see if sh knows # comments
1178echo " "
1179echo "Checking your sh to see if it knows about # comments..." >&4
ecfc5424 1180if `sh -c '#' >/dev/null 2>&1`; then
2304df62
AD
1181 echo "Your sh handles # comments correctly."
1182 shsharp=true
1183 spitshell=cat
1184 echo " "
1185 echo "Okay, let's see if #! works on this system..."
a0d0e21e 1186 xcat=/bin/cat
ecfc5424 1187 test -f $xcat || xcat=/usr/bin/cat
a0d0e21e 1188 echo "#!$xcat" >try
2304df62
AD
1189 $eunicefix try
1190 chmod +x try
1191 ./try > today
1192 if test -s today; then
1193 echo "It does."
1194 sharpbang='#!'
1195 else
a0d0e21e 1196 echo "#! $xcat" > try
2304df62
AD
1197 $eunicefix try
1198 chmod +x try
1199 ./try > today
1200 if test -s today; then
1201 echo "It does."
1202 sharpbang='#! '
1203 else
1204 echo "It's just a comment."
1205 sharpbang=': use '
1206 fi
1207 fi
1208else
1209 echo "Your sh doesn't grok # comments--I will strip them later on."
1210 shsharp=false
a0d0e21e 1211 cd ..
2304df62
AD
1212 echo "exec grep -v '^[ ]*#'" >spitshell
1213 chmod +x spitshell
1214 $eunicefix spitshell
1215 spitshell=`pwd`/spitshell
a0d0e21e 1216 cd UU
2304df62
AD
1217 echo "I presume that if # doesn't work, #! won't work either!"
1218 sharpbang=': use '
1219fi
1220rm -f try today
1221
1222: figure out how to guarantee sh startup
1223echo " "
1224echo "Checking out how to guarantee sh startup..." >&4
1225case "$SYSTYPE" in
1226*bsd*|sys5*) startsh=$sharpbang"/$SYSTYPE/bin/sh";;
1227*) startsh=$sharpbang'/bin/sh';;
1228esac
1229echo "Let's see if '$startsh' works..."
1230cat >try <<EOSS
1231$startsh
1232set abc
1233test "$?abc" != 1
1234EOSS
1235
1236chmod +x try
1237$eunicefix try
1238if ./try; then
1239 echo "Yup, it does."
1240else
1241echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
1242fi
1243rm -f try
1244
1245: find out where common programs are
1246echo " "
1247echo "Locating common programs..." >&4
1248cat <<EOSC >loc
1249$startsh
1250case \$# in
12510) exit 1;;
1252esac
1253thing=\$1
1254shift
1255dflt=\$1
1256shift
1257for dir in \$*; do
1258 case "\$thing" in
1259 .)
1260 if test -d \$dir/\$thing; then
1261 echo \$dir
1262 exit 0
1263 fi
1264 ;;
1265 *)
a0d0e21e 1266 for thisthing in \$dir/\$thing; do
ecfc5424 1267 : just loop through to pick last item
a0d0e21e
LW
1268 done
1269 if test -f \$thisthing; then
1270 echo \$thisthing
2304df62
AD
1271 exit 0
1272 elif test -f \$dir/\$thing.exe; then
1273 : on Eunice apparently
1274 echo \$dir/\$thing
1275 exit 0
1276 fi
1277 ;;
1278 esac
1279done
1280echo \$dflt
1281exit 1
1282EOSC
1283chmod +x loc
1284$eunicefix loc
1285loclist="
1286awk
1287cat
ecfc5424 1288comm
2304df62
AD
1289cp
1290echo
1291expr
a0d0e21e 1292find
2304df62 1293grep
85e6fe83 1294ln
a0d0e21e 1295ls
2304df62 1296mkdir
2304df62
AD
1297rm
1298sed
1299sort
85e6fe83 1300touch
2304df62
AD
1301tr
1302uniq
1303"
1304trylist="
1305Mcc
2304df62
AD
1306byacc
1307cpp
1308csh
1309date
1310egrep
2304df62
AD
1311line
1312nroff
1313perl
1314test
1315uname
1316"
1317pth=`echo $PATH | sed -e 's/:/ /g'`
1318pth="$pth /lib /usr/lib"
1319for file in $loclist; do
1320 xxx=`./loc $file $file $pth`
1321 eval $file=$xxx
1322 eval _$file=$xxx
1323 case "$xxx" in
1324 /*)
1325 echo $file is in $xxx.
1326 ;;
1327 *)
1328 echo "I don't know where $file is. I hope it's in everyone's PATH."
1329 ;;
1330 esac
1331done
1332echo " "
1333echo "Don't worry if any of the following aren't found..."
1334say=offhand
1335for file in $trylist; do
1336 xxx=`./loc $file $file $pth`
1337 eval $file=$xxx
1338 eval _$file=$xxx
1339 case "$xxx" in
1340 /*)
1341 echo $file is in $xxx.
1342 ;;
1343 *)
1344 echo "I don't see $file out there, $say."
1345 say=either
1346 ;;
1347 esac
1348done
1349case "$egrep" in
1350egrep)
1351 echo "Substituting grep for egrep."
1352 egrep=$grep
1353 ;;
1354esac
1355case "$test" in
1356test)
1357 echo "Hopefully test is built into your sh."
1358 ;;
1359*)
ecfc5424 1360 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2304df62
AD
1361 echo "Using the test built into your sh."
1362 test=test
1363 _test=test
1364 fi
1365 ;;
1366esac
1367case "$echo" in
1368echo)
1369 echo "Hopefully echo is built into your sh."
1370 ;;
1371'') ;;
1372*)
1373 echo " "
1374echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1375 $echo $n "hi there$c" >foo1
1376 echo $n "hi there$c" >foo2
1377 if cmp foo1 foo2 >/dev/null 2>&1; then
1378 echo "They are compatible. In fact, they may be identical."
1379 else
1380 case "$n" in
1381 '-n') n='' c='\c';;
1382 *) n='-n' c='';;
1383 esac
1384 cat <<FOO
1385They are not compatible! You are probably running ksh on a non-USG system.
1386I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1387have echo built in and we may have to run some Bourne shell scripts. That
1388means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
1389
1390FOO
1391 $echo $n "The star should be here-->$c"
1392 $echo "*"
1393 fi
1394 $rm -f foo1 foo2
1395 ;;
1396esac
1397
a0d0e21e
LW
1398: determine whether symbolic links are supported
1399echo " "
1400$touch blurfl
1401if $ln -s blurfl sym > /dev/null 2>&1 ; then
1402 echo "Symbolic links are supported." >&4
1403 lns="$ln -s"
1404else
1405 echo "Symbolic links are NOT supported." >&4
1406 lns="$ln"
1407fi
1408$rm -f blurfl sym
1409
ecfc5424
AD
1410: see whether [:lower:] and [:upper:] are supported character classes
1411echo " "
1412up='[A-Z]'
1413low='[a-z]'
1414case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1415ABYZ)
1416 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1417 up='[:upper:]'
1418 low='[:lower:]'
1419 ;;
1420*)
1421 echo "Your tr only supports [a-z] and [A-Z] to convert case." >&4
1422 ;;
1423esac
1424: set up the translation script tr, must be called with ./tr of course
1425cat >tr <<EOSC
1426$startsh
1427case "\$1\$2" in
1428'[A-Z][a-z]') exec $tr '$up' '$low';;
1429'[a-z][A-Z]') exec $tr '$low' '$up';;
1430esac
1431exec $tr "\$@"
1432EOSC
1433chmod +x tr
1434$eunicefix tr
1435
2304df62
AD
1436: Try to determine whether config.sh was made on this system
1437case "$config_sh" in
1438'')
1439myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
a0d0e21e 1440myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
ecfc5424 1441 ./tr '[A-Z]' '[a-z]' | tr '\012' ' '`
1aef975c 1442newmyuname="$myuname"
2304df62 1443dflt=n
16d20bd9
AD
1444case "$knowitall" in
1445'')
1446 if test -f ../config.sh; then
1447 if $contains myuname= ../config.sh >/dev/null 2>&1; then
1448 eval "`grep myuname= ../config.sh`"
1449 fi
1450 if test "X$myuname" = "X$newmyuname"; then
1451 dflt=y
1452 fi
2304df62 1453 fi
16d20bd9
AD
1454 ;;
1455*) dflt=y;;
1456esac
2304df62
AD
1457
1458: Get old answers from old config file if Configure was run on the
1459: same system, otherwise use the hints.
1460hint=default
1461cd ..
1462if test -f config.sh; then
16d20bd9
AD
1463 echo " "
1464 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
1465 . UU/myread
1466 case "$ans" in
1467 n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
1468 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
1469 tmp_n="$n"
1470 tmp_c="$c"
2304df62
AD
1471 . ./config.sh
1472 cp config.sh UU
ecfc5424
AD
1473 n="$tmp_n"
1474 c="$tmp_c"
2304df62
AD
1475 hint=previous
1476 ;;
1477 esac
1478fi
1479if test ! -f config.sh; then
1480 $cat <<EOM
1481
1482First time through, eh? I have some defaults handy for the following systems:
1483
1484EOM
1485 cd hints; ls -C *.sh | $sed 's/\.sh/ /g' >&4
1486 dflt=''
1487 : Half the following guesses are probably wrong... If you have better
1488 : tests or hints, please send them to lwall@netlabs.com
1489 : The metaconfig authors would also appreciate a copy...
a0d0e21e 1490 $test -f /irix && osname=irix
85e6fe83
LW
1491 $test -f /xenix && osname=sco_xenix
1492 $test -f /dynix && osname=dynix
1493 $test -f /dnix && osname=dnix
a0d0e21e 1494 $test -f /unicos && osname=unicos && osvers=`$uname -r`
85e6fe83 1495 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
1496 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
1497 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
1498 $test -d /usr/apollo/bin && osname=apollo
1499 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 1500 $test -d /usr/include/minix && osname=minix
fec02dd3
AD
1501 $test -d /MachTen && osname=machten && \
1502 osvers=`/usr/etc/version | $awk '{print $2}' | \
1503 $sed -e 's/[A-Za-z]$//'`
2304df62
AD
1504 if $test -f $uname; then
1505 set X $myuname
1506 shift
1507
2304df62 1508 case "$5" in
85e6fe83 1509 fps*) osname=fps ;;
2304df62
AD
1510 mips*)
1511 case "$4" in
85e6fe83
LW
1512 umips) osname=umips ;;
1513 *) osname=mips ;;
2304df62 1514 esac;;
85e6fe83
LW
1515 [23]100) osname=mips ;;
1516 next*) osname=next ;;
1517 news*) osname=news ;;
ecfc5424
AD
1518 i386*)
1519 if $test -f /etc/kconfig; then
1520 osname=isc
a0d0e21e
LW
1521 if test "$lns" = "ln -s"; then
1522 osvers=4
1523 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
1524 osvers=3
2304df62 1525 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 1526 osvers=2
ecfc5424
AD
1527 fi
1528 fi
1529 ;;
2304df62
AD
1530 esac
1531
1532 case "$1" in
a0d0e21e
LW
1533 aix) osname=aix
1534 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
1535 case "$tmp" in
1aef975c 1536 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
1537 '<3240'|'<>3240') osvers=3.2.0 ;;
1538 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
1539 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 1540 *) osvers=$tmp;;
a0d0e21e
LW
1541 esac
1542 ;;
1543 dnix) osname=dnix
1544 osvers="$3"
1545 ;;
1546 domainos) osname=apollo
1547 osvers="$3"
1548 ;;
1549 dgux) osname=dgux
1550 osvers="$3"
1551 ;;
1552 freebsd) osname=freebsd
1553 osvers="$3" ;;
1554 genix) osname=genix ;;
1555 hp*) osname=hpux
1556 case "$3" in
1557 *.08.*) osvers=9 ;;
1558 *.09.*) osvers=9 ;;
1559 *.10.*) osvers=10 ;;
ecfc5424 1560 *) osvers="$3" ;;
a0d0e21e
LW
1561 esac
1562 ;;
1563 irix) osname=irix
1564 case "$3" in
1565 4*) osvers=4 ;;
1566 5*) osvers=5 ;;
ecfc5424 1567 *) osvers="$3" ;;
a0d0e21e
LW
1568 esac
1569 ;;
1570 linux) osname=linux
1571 case "$3" in
1572 1*) osvers=1 ;;
1573 *) osvers="$3" ;;
1574 esac
1575 ;;
1576 netbsd*) osname=netbsd
ecfc5424
AD
1577 osvers="$3"
1578 ;;
a0d0e21e
LW
1579 bsd386) osname=bsd386
1580 osvers=`$uname -r`
1581 ;;
1582 next*) osname=next ;;
1583 solaris) osname=solaris
1584 case "$3" in
1585 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 1586 *) osvers="$3" ;;
a0d0e21e
LW
1587 esac
1588 ;;
85e6fe83
LW
1589 sunos) osname=sunos
1590 case "$3" in
85e6fe83
LW
1591 5*) osname=solaris
1592 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 1593 *) osvers="$3" ;;
2304df62
AD
1594 esac
1595 ;;
a0d0e21e 1596 titanos) osname=titanos
85e6fe83 1597 case "$3" in
a0d0e21e
LW
1598 1*) osvers=1 ;;
1599 2*) osvers=2 ;;
1600 3*) osvers=3 ;;
1601 4*) osvers=4 ;;
ecfc5424 1602 *) osvers="$3" ;;
2304df62
AD
1603 esac
1604 ;;
85e6fe83 1605 ultrix) osname=ultrix
ecfc5424 1606 osvers="$3"
2304df62 1607 ;;
85e6fe83 1608 osf1) case "$5" in
fed7345c
AD
1609 alpha)
1610 osname=dec_osf
1611 osvers=`echo "$3" | sed 's/^[vt]//'`
ecfc5424
AD
1612 ;;
1613 hp*) osname=hp_osf1 ;;
1614 mips) osname=mips_osf1 ;;
85e6fe83
LW
1615 esac
1616 ;;
a0d0e21e
LW
1617 uts) osname=uts
1618 osvers="$3"
1619 ;;
85e6fe83 1620 $2) case "$osname" in
2304df62 1621 *isc*) ;;
a0d0e21e
LW
1622 *freebsd*) ;;
1623 svr*)
1624 : svr4.x or possibly later
1625 case "svr$3" in
1626 ${osname}*)
1627 osname=svr$3
1628 osvers=$4
1629 ;;
1630 esac
1631 case "$osname" in
1632 svr4.0)
1633 : Check for ESIX
1634 if test -f /stand/boot ; then
1635 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
1636 if test -n "$INITPROG" -a -f "$INITPROG"; then
1637 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
1638 if test -n "$isesix"; then
a0d0e21e
LW
1639 osname=esix4
1640 fi
1641 fi
1642 fi
1643 ;;
1644 esac
1645 ;;
2304df62 1646 *) if test -f /etc/systemid; then
a0d0e21e
LW
1647 osname=sco
1648 set `echo $3 | $sed 's/\./ /g'` $4
2304df62 1649 if $test -f sco_$1_$2_$3.sh; then
85e6fe83 1650 osvers=$1.$2.$3
2304df62 1651 elif $test -f sco_$1_$2.sh; then
85e6fe83 1652 osvers=$1.$2
2304df62 1653 elif $test -f sco_$1.sh; then
85e6fe83 1654 osvers=$1
2304df62 1655 fi
a0d0e21e
LW
1656 else
1657 case "$osname" in
1658 '') : Still unknown. Probably a generic Sys V.
1659 osname="sysv"
1660 osvers="$3"
1661 ;;
1662 esac
2304df62
AD
1663 fi
1664 ;;
1665 esac
1666 ;;
a0d0e21e
LW
1667 *) case "$osname" in
1668 '') : Still unknown. Probably a generic BSD.
1669 osname="$1"
1670 osvers="$3"
1671 ;;
1672 esac
1673 ;;
2304df62
AD
1674 esac
1675 else
1676 if test -f /vmunix -a -f news_os.sh; then
ecfc5424 1677 (what /vmunix | ../UU/tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1
2304df62 1678 if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then
85e6fe83 1679 osname=news_os
2304df62
AD
1680 fi
1681 $rm -f ../UU/kernel.what
1682 fi
1683 fi
85e6fe83 1684
a0d0e21e
LW
1685 : Now look for a hint file osname_osvers, unless one has been
1686 : specified already.
1687 case "$hintfile" in
1688 ''|' ')
ecfc5424 1689 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
a0d0e21e 1690 : Also try without trailing minor version numbers.
ecfc5424
AD
1691 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
1692 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
1693 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
1694 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
a0d0e21e
LW
1695 case "$file" in
1696 '') dflt=none ;;
1697 *) case "$osvers" in
1698 '') dflt=$file
1699 ;;
1700 *) if $test -f $file.sh ; then
1701 dflt=$file
1702 elif $test -f $xfile.sh ; then
1703 dflt=$xfile
1704 elif $test -f $xxfile.sh ; then
1705 dflt=$xxfile
1706 elif $test -f $xxxfile.sh ; then
1707 dflt=$xxxfile
1708 elif $test -f $xxxxfile.sh ; then
1709 dflt=$xxxxfile
1710 elif $test -f "${osname}.sh" ; then
1711 dflt="${osname}"
1712 else
1713 dflt=none
1714 fi
1715 ;;
1716 esac
85e6fe83
LW
1717 ;;
1718 esac
1719 ;;
a0d0e21e 1720 *)
ecfc5424 1721 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 1722 ;;
2304df62 1723 esac
1aef975c 1724
2304df62
AD
1725 $cat <<EOM
1726
1727You may give one or more space-separated answers, or "none" if appropriate.
1728If your OS version has no hints, DO NOT give a wrong version -- say "none".
1729
1730EOM
1731 rp="Which of these apply, if any?"
1732 . ../UU/myread
85e6fe83
LW
1733 tans=$ans
1734 for file in $tans; do
2304df62
AD
1735 if $test -f $file.sh; then
1736 . ./$file.sh
1737 $cat $file.sh >> ../UU/config.sh
85e6fe83 1738 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
1739 : nothing
1740 else
85e6fe83
LW
1741 : Give one chance to correct a possible typo.
1742 echo "$file.sh does not exist"
1743 dflt=$file
1744 rp="hint to use instead?"
1745 . ../UU/myread
1746 for file in $ans; do
1747 if $test -f "$file.sh"; then
1748 . ./$file.sh
1749 $cat $file.sh >> ../UU/config.sh
1750 elif $test X$ans = X -o X$ans = Xnone ; then
1751 : nothing
1752 else
1753 echo "$file.sh does not exist -- ignored."
1754 fi
1755 done
2304df62
AD
1756 fi
1757 done
85e6fe83 1758
2304df62 1759 hint=recommended
85e6fe83
LW
1760 : Remember our hint file for later.
1761 if $test -f "$file.sh" ; then
a0d0e21e 1762 hintfile="$file"
85e6fe83 1763 else
a0d0e21e 1764 hintfile=''
85e6fe83
LW
1765 fi
1766
2304df62
AD
1767 cd ..
1768fi
1769cd UU
1770;;
1771*)
1772 echo " "
1773 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
1774 tmp_n="$n"
1775 tmp_c="$c"
2304df62
AD
1776 cd ..
1777 cp $config_sh config.sh 2>/dev/null
1778 . ./config.sh
1779 cd UU
1780 cp ../config.sh .
ecfc5424
AD
1781 n="$tmp_n"
1782 c="$tmp_c"
2304df62
AD
1783 hint=previous
1784 ;;
1785esac
1aef975c
AD
1786test "$override" && . ./optdef.sh
1787myuname="$newmyuname"
2304df62
AD
1788
1789: Restore computed paths
1790for file in $loclist $trylist; do
1791 eval $file="\$_$file"
1792done
1793
85e6fe83 1794cat << EOM
a0d0e21e 1795
85e6fe83 1796Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
1797The default value is probably right if the name rings a bell. Otherwise,
1798since spelling matters for me, either accept the default or answer "none"
1799to leave it blank.
a0d0e21e 1800
85e6fe83 1801EOM
85e6fe83 1802case "$osname" in
a0d0e21e 1803 ''|' ')
85e6fe83 1804 case "$hintfile" in
a0d0e21e 1805 ''|' '|none) dflt=none ;;
ecfc5424 1806 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
1807 esac
1808 ;;
1809 *) dflt="$osname" ;;
1810esac
1811rp="Operating system name?"
1812. ./myread
1813case "$ans" in
ecfc5424
AD
1814none) osname='' ;;
1815*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 1816esac
2304df62
AD
1817: who configured the system
1818cf_time=`$date 2>&1`
a0d0e21e
LW
1819(logname > .temp) >/dev/null 2>&1
1820$test -s .temp || (whoami > .temp) >/dev/null 2>&1
1821$test -s .temp || echo unknown > .temp
1822cf_by=`$cat .temp`
1823$rm -f .temp
2304df62
AD
1824
1825: determine where manual pages are on this system
1826echo " "
1827case "$sysman" in
1828'')
a0d0e21e 1829 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2304df62
AD
1830 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
1831 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
1832 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
a0d0e21e
LW
1833 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
1834 sysman=`./loc . /usr/man/man1 $syspath`
2304df62
AD
1835 ;;
1836esac
1837if $test -d "$sysman"; then
1838 echo "System manual is in $sysman." >&4
1839else
1840 echo "Could not find manual pages in source form." >&4
1841fi
1842
1843: see what memory models we can support
1844case "$models" in
1845'')
1846 $cat >pdp11.c <<'EOP'
1847main() {
1848#ifdef pdp11
1849 exit(0);
1850#else
1851 exit(1);
1852#endif
1853}
1854EOP
1855 cc -o pdp11 pdp11.c >/dev/null 2>&1
1856 if ./pdp11 2>/dev/null; then
1857 dflt='unsplit split'
1858 else
1859 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
1860 case "$tans" in
1861 X) dflt='none';;
1862 *) if $test -d /lib/small || $test -d /usr/lib/small; then
1863 dflt='small'
1864 else
1865 dflt=''
1866 fi
1867 if $test -d /lib/medium || $test -d /usr/lib/medium; then
1868 dflt="$dflt medium"
1869 fi
1870 if $test -d /lib/large || $test -d /usr/lib/large; then
1871 dflt="$dflt large"
1872 fi
1873 if $test -d /lib/huge || $test -d /usr/lib/huge; then
1874 dflt="$dflt huge"
1875 fi
1876 esac
1877 fi;;
1878*) dflt="$models";;
1879esac
1880$cat <<EOM
1881
1882Some systems have different model sizes. On most systems they are called
1883small, medium, large, and huge. On the PDP11 they are called unsplit and
1884split. If your system doesn't support different memory models, say "none".
1885If you wish to force everything to one memory model, say "none" here and
1886put the appropriate flags later when it asks you for other cc and ld flags.
1887Venix systems may wish to put "none" and let the compiler figure things out.
1888(In the following question multiple model names should be space separated.)
1889
1890EOM
1891rp="Which memory models are supported?"
1892. ./myread
1893models="$ans"
1894
1895case "$models" in
1896none)
1897 small=''
1898 medium=''
1899 large=''
1900 huge=''
1901 unsplit=''
1902 split=''
1903 ;;
1904*split)
1905 case "$split" in
1906 '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
1907 $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
1908 dflt='-i'
1909 else
1910 dflt='none'
1911 fi;;
1912 *) dflt="$split";;
1913 esac
1914 rp="What flag indicates separate I and D space?"
1915 . ./myread
1916 tans="$ans"
1917 case "$tans" in
1918 none) tans='';;
1919 esac
1920 split="$tans"
1921 unsplit='';;
1922*large*|*small*|*medium*|*huge*)
1923 case "$models" in
1924 *large*)
1925 case "$large" in
1926 '') dflt='-Ml';;
1927 *) dflt="$large";;
1928 esac
1929 rp="What flag indicates large model?"
1930 . ./myread
1931 tans="$ans"
1932 case "$tans" in
1933 none) tans='';
1934 esac
1935 large="$tans";;
1936 *) large='';;
1937 esac
1938 case "$models" in
1939 *huge*) case "$huge" in
1940 '') dflt='-Mh';;
1941 *) dflt="$huge";;
1942 esac
1943 rp="What flag indicates huge model?"
1944 . ./myread
1945 tans="$ans"
1946 case "$tans" in
1947 none) tans='';
1948 esac
1949 huge="$tans";;
1950 *) huge="$large";;
1951 esac
1952 case "$models" in
1953 *medium*) case "$medium" in
1954 '') dflt='-Mm';;
1955 *) dflt="$medium";;
1956 esac
1957 rp="What flag indicates medium model?"
1958 . ./myread
1959 tans="$ans"
1960 case "$tans" in
1961 none) tans='';
1962 esac
1963 medium="$tans";;
1964 *) medium="$large";;
1965 esac
1966 case "$models" in
1967 *small*) case "$small" in
1968 '') dflt='none';;
1969 *) dflt="$small";;
1970 esac
1971 rp="What flag indicates small model?"
1972 . ./myread
1973 tans="$ans"
1974 case "$tans" in
1975 none) tans='';
1976 esac
1977 small="$tans";;
1978 *) small='';;
1979 esac
1980 ;;
1981*)
1982 echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
1983 ;;
1984esac
1985
1986: make some quick guesses about what we are up against
1987echo " "
1988$echo $n "Hmm... $c"
1989echo exit 1 >bsd
1990echo exit 1 >usg
1991echo exit 1 >v7
1992echo exit 1 >osf1
1993echo exit 1 >eunice
1994echo exit 1 >xenix
1995echo exit 1 >venix
ecfc5424 1996d_bsd="$undef"
2304df62
AD
1997$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
1998if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
1999then
2000 echo "Looks kind of like an OSF/1 system, but we'll see..."
2001 echo exit 0 >osf1
2002elif test `echo abc | tr a-z A-Z` = Abc ; then
2003 xxx=`./loc addbib blurfl $pth`
2004 if $test -f $xxx; then
2005 echo "Looks kind of like a USG system with BSD features, but we'll see..."
2006 echo exit 0 >bsd
2007 echo exit 0 >usg
2008 else
2009 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2010 echo "Looks kind of like an extended USG system, but we'll see..."
2011 else
2012 echo "Looks kind of like a USG system, but we'll see..."
2013 fi
2014 echo exit 0 >usg
2015 fi
2016elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2017 echo "Looks kind of like a BSD system, but we'll see..."
ecfc5424 2018 d_bsd="$define"
2304df62
AD
2019 echo exit 0 >bsd
2020else
2021 echo "Looks kind of like a Version 7 system, but we'll see..."
2022 echo exit 0 >v7
2023fi
2024case "$eunicefix" in
2025*unixtovms*)
2026 $cat <<'EOI'
2027There is, however, a strange, musty smell in the air that reminds me of
2028something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2029EOI
2030 echo exit 0 >eunice
2031 d_eunice="$define"
2032: it so happens the Eunice I know will not run shell scripts in Unix format
2033 ;;
2034*)
2035 echo " "
2036 echo "Congratulations. You aren't running Eunice."
2037 d_eunice="$undef"
2038 ;;
2039esac
2040if test -f /xenix; then
2041 echo "Actually, this looks more like a XENIX system..."
2042 echo exit 0 >xenix
2043 d_xenix="$define"
2044else
2045 echo " "
2046 echo "It's not Xenix..."
2047 d_xenix="$undef"
2048fi
2049chmod +x xenix
2050$eunicefix xenix
2051if test -f /venix; then
2052 echo "Actually, this looks more like a VENIX system..."
2053 echo exit 0 >venix
2054else
2055 echo " "
ecfc5424 2056 if ./xenix; then
2304df62
AD
2057 : null
2058 else
2059 echo "Nor is it Venix..."
2060 fi
2061fi
2062chmod +x bsd usg v7 osf1 eunice xenix venix
2063$eunicefix bsd usg v7 osf1 eunice xenix venix
2064$rm -f foo
2065
2066: see if we need a special compiler
2067echo " "
ecfc5424 2068if ./usg; then
2304df62
AD
2069 case "$cc" in
2070 '') case "$Mcc" in
2071 /*) dflt='Mcc';;
2072 *) case "$large" in
2073 -M*) dflt='cc';;
2074 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2075 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2076 dflt='cc'
2077 else
2078 dflt='cc -M'
2079 fi
2080 else
2081 dflt='cc'
2082 fi;;
2083 esac;;
2084 esac;;
2085 *) dflt="$cc";;
2086 esac
2087 $cat <<'EOM'
2088On some systems the default C compiler will not resolve multiple global
2089references that happen to have the same name. On some such systems the "Mcc"
2090command may be used to force these to be resolved. On other systems a "cc -M"
2091command is required. (Note that the -M flag on other systems indicates a
2092memory model to use!) If you have the Gnu C compiler, you might wish to use
2093that instead.
2094
2095EOM
2096 rp="What command will force resolution on this system?"
2097 . ./myread
2098 cc="$ans"
2099else
2100 case "$cc" in
2101 '') dflt=cc;;
2102 *) dflt="$cc";;
2103 esac
2104 rp="Use which C compiler?"
2105 . ./myread
2106 cc="$ans"
2107fi
ecfc5424
AD
2108echo " "
2109echo "Checking for GNU cc in disguise and/or its version number..." >&4
2304df62
AD
2110$cat >gccvers.c <<EOM
2111#include <stdio.h>
a0d0e21e 2112int main() {
2304df62 2113#ifdef __GNUC__
a0d0e21e 2114#ifdef __VERSION__
ecfc5424 2115 printf("%s\n", __VERSION__);
2304df62 2116#else
ecfc5424 2117 printf("%s\n", "1");
2304df62 2118#endif
a0d0e21e 2119#endif
ecfc5424 2120 exit(0);
2304df62
AD
2121}
2122EOM
a0d0e21e
LW
2123if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
2124 gccversion=`./gccvers`
2125 case "$gccversion" in
2126 '') echo "You are not using GNU cc." ;;
2127 *) echo "You are using GNU cc $gccversion." ;;
2128 esac
2129else
16d20bd9
AD
2130 echo " "
2131 echo "*** WHOA THERE!!! ***" >&4
2132 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
2133 case "$knowitall" in
2134 '')
2135 echo " You'd better start hunting for one and let me know about it." >&4
2136 exit 1
2137 ;;
2138 esac
a0d0e21e
LW
2139fi
2140$rm -f gccvers*
2141case "$gccversion" in
21421*) cpp=`./loc gcc-cpp $cpp $pth` ;;
2304df62 2143esac
a0d0e21e 2144
2304df62
AD
2145: decide how portable to be
2146case "$d_portable" in
2147"$define") dflt=y;;
2148*) dflt=n;;
2149esac
2150$cat <<'EOH'
2151
2152I can set things up so that your shell scripts and binaries are more portable,
2153at what may be a noticable cost in performance. In particular, if you
2154ask to be portable, the following happens:
2155
2156 1) Shell scripts will rely on the PATH variable rather than using
2157 the paths derived above.
2158 2) ~username interpretations will be done at run time rather than
2159 by Configure.
2160
2161EOH
2162rp="Do you expect to run these scripts and binaries on multiple machines?"
2163. ./myread
2164case "$ans" in
2165 y*) d_portable="$define"
2304df62
AD
2166 ;;
2167 *) d_portable="$undef" ;;
2168esac
2169
2170: set up shell script to do ~ expansion
2171cat >filexp <<EOSS
2172$startsh
2173: expand filename
2174case "\$1" in
2175 ~/*|~)
2176 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2177 ;;
2178 ~*)
2179 if $test -f /bin/csh; then
2180 /bin/csh -f -c "glob \$1"
a0d0e21e 2181 failed=\$?
2304df62
AD
2182 echo ""
2183 exit \$failed
2184 else
2185 name=\`$expr x\$1 : '..\([^/]*\)'\`
2186 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2187 if $test ! -d "\$dir"; then
2188 me=\`basename \$0\`
2189 echo "\$me: can't locate home directory for: \$name" >&2
2190 exit 1
2191 fi
2192 case "\$1" in
2193 */*)
2194 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2195 ;;
2196 *)
2197 echo \$dir
2198 ;;
2199 esac
2200 fi
2201 ;;
2202*)
2203 echo \$1
2204 ;;
2205esac
2206EOSS
2207chmod +x filexp
2208$eunicefix filexp
2209
2210: now set up to get a file name
2211cat <<'EOSC' >getfile
2212tilde=''
2213fullpath=''
2214already=''
2215skip=''
2216none_ok=''
2217exp_file=''
a0d0e21e 2218nopath_ok=''
2304df62
AD
2219orig_rp="$rp"
2220orig_dflt="$dflt"
2221
2222case "$fn" in
ecfc5424
AD
2223*\(*)
2224 expr $fn : '.*(\(.*\)).*' | tr ',' '\012' >getfile.ok
2225 fn=`echo $fn | sed 's/(.*)//'`
2226 ;;
2227esac
2228
2229case "$fn" in
a0d0e21e
LW
2230*:*)
2231 loc_file=`expr $fn : '.*:\(.*\)'`
2232 fn=`expr $fn : '\(.*\):.*'`
2233 ;;
2234esac
2235
2236case "$fn" in
2304df62
AD
2237*~*) tilde=true;;
2238esac
2239case "$fn" in
2240*/*) fullpath=true;;
2241esac
2242case "$fn" in
2243*+*) skip=true;;
2244esac
2245case "$fn" in
2246*n*) none_ok=true;;
2247esac
2248case "$fn" in
2249*e*) exp_file=true;;
2250esac
a0d0e21e
LW
2251case "$fn" in
2252*p*) nopath_ok=true;;
2253esac
2304df62
AD
2254
2255case "$fn" in
2256*f*) type='File';;
2257*d*) type='Directory';;
a0d0e21e 2258*l*) type='Locate';;
2304df62
AD
2259esac
2260
2261what="$type"
2262case "$what" in
2263Locate) what='File';;
2264esac
2265
2266case "$exp_file" in
2267'')
2268 case "$d_portable" in
2269 "$define") ;;
2270 *) exp_file=true;;
2271 esac
2272 ;;
2273esac
2274
2275cd ..
2276while test "$type"; do
2277 redo=''
2278 rp="$orig_rp"
2279 dflt="$orig_dflt"
2280 case "$tilde" in
2281 true) rp="$rp (~name ok)";;
2282 esac
2283 . UU/myread
ecfc5424
AD
2284 if test -f UU/getfile.ok && \
2285 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
2286 then
2287 value="$ans"
2288 ansexp="$ans"
2289 break
2290 fi
2304df62
AD
2291 case "$ans" in
2292 none)
2293 value=''
2294 ansexp=''
2295 case "$none_ok" in
2296 true) type='';;
2297 esac
2298 ;;
2299 *)
2300 case "$tilde" in
2301 '') value="$ans"
2302 ansexp="$ans";;
2303 *)
2304 value=`UU/filexp $ans`
2305 case $? in
2306 0)
2307 if test "$ans" != "$value"; then
ecfc5424 2308 echo "(That expands to $value on this system.)"
2304df62
AD
2309 fi
2310 ;;
2311 *) value="$ans";;
2312 esac
2313 ansexp="$value"
2314 case "$exp_file" in
2315 '') value="$ans";;
2316 esac
2317 ;;
2318 esac
2319 case "$fullpath" in
2320 true)
2321 case "$ansexp" in
2322 /*) value="$ansexp" ;;
2323 *)
2324 redo=true
2325 case "$already" in
2326 true)
2327 echo "I shall only accept a full path name, as in /bin/ls." >&4
2328 echo "Use a ! shell escape if you wish to check pathnames." >&4
2329 ;;
2330 *)
2331 echo "Please give a full path name, starting with slash." >&4
2332 case "$tilde" in
2333 true)
2334 echo "Note that using ~name is ok provided it expands well." >&4
2335 already=true
2336 ;;
2337 esac
2338 esac
2339 ;;
2340 esac
2341 ;;
2342 esac
2343 case "$redo" in
2344 '')
2345 case "$type" in
2346 File)
2347 if test -f "$ansexp"; then
2348 type=''
2349 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2350 then
2351 echo "($value is not a plain file, but that's ok.)"
2352 type=''
2353 fi
2354 ;;
2355 Directory)
2356 if test -d "$ansexp"; then
2357 type=''
2358 fi
2359 ;;
2360 Locate)
40000a8c 2361 if test -d "$ansexp"; then
a0d0e21e
LW
2362 echo "(Looking for $loc_file in directory $value.)"
2363 value="$value/$loc_file"
40000a8c 2364 ansexp="$ansexp/$loc_file"
2304df62 2365 fi
40000a8c 2366 if test -f "$ansexp"; then
2304df62
AD
2367 type=''
2368 fi
a0d0e21e
LW
2369 case "$nopath_ok" in
2370 true) case "$value" in
2371 */*) ;;
2372 *) echo "Assuming $value will be in people's path."
2373 type=''
2374 ;;
2375 esac
2376 ;;
2377 esac
2304df62
AD
2378 ;;
2379 esac
2380
2381 case "$skip" in
2382 true) type='';
2383 esac
2384
2385 case "$type" in
2386 '') ;;
2387 *)
2388 if test "$fastread" = yes; then
2389 dflt=y
2390 else
2391 dflt=n
2392 fi
2393 rp="$what $value doesn't exist. Use that name anyway?"
2394 . UU/myread
2395 dflt=''
2396 case "$ans" in
2397 y*) type='';;
2398 *) echo " ";;
2399 esac
2400 ;;
2401 esac
2402 ;;
2403 esac
2404 ;;
2405 esac
2406done
2407cd UU
2408ans="$value"
2409rp="$orig_rp"
2410dflt="$orig_dflt"
ecfc5424 2411rm -f getfile.ok
2304df62
AD
2412EOSC
2413
2414: What should the include directory be ?
2415echo " "
2416$echo $n "Hmm... $c"
a0d0e21e 2417dflt='/usr/include'
2304df62
AD
2418incpath=''
2419mips_type=''
2420if $test -f /bin/mips && /bin/mips; then
2421 echo "Looks like a MIPS system..."
2422 $cat >usr.c <<'EOCP'
2423#ifdef SYSTYPE_BSD43
2424/bsd43
2425#endif
2426EOCP
2427 if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
2428 dflt='/bsd43/usr/include'
2429 incpath='/bsd43'
2430 mips_type='BSD 4.3'
2431 else
2432 mips_type='System V'
2433 fi
2434 $rm -f usr.c usr.out
2435 echo "and you're compiling with the $mips_type compiler and libraries."
40000a8c 2436 echo "exit 0" >mips
2304df62
AD
2437else
2438 echo "Doesn't look like a MIPS system."
2439 echo "exit 1" >mips
2304df62 2440fi
40000a8c
AD
2441chmod +x mips
2442$eunicefix mips
2304df62 2443echo " "
a0d0e21e
LW
2444case "$usrinc" in
2445'') ;;
2446*) dflt="$usrinc";;
2447esac
2304df62
AD
2448fn=d/
2449rp='Where are the include files you want to use?'
2450. ./getfile
2451usrinc="$ans"
2452
a0d0e21e
LW
2453: see how we invoke the C preprocessor
2454echo " "
2455echo "Now, how can we feed standard input to your C preprocessor..." >&4
2456cat <<'EOT' >testcpp.c
2457#define ABC abc
2458#define XYZ xyz
2459ABC.XYZ
2460EOT
2461cd ..
2462echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
2463chmod 755 cppstdin
2464wrapper=`pwd`/cppstdin
2465ok='false'
2466cd UU
2304df62 2467
a0d0e21e
LW
2468if $test "X$cppstdin" != "X" && \
2469 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
2470 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2471then
2472 echo "You used to use $cppstdin $cppminus so we'll use that again."
2473 case "$cpprun" in
2474 '') echo "But let's see if we can live without a wrapper..." ;;
2475 *)
2476 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
2477 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2304df62 2478 then
a0d0e21e
LW
2479 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
2480 ok='true'
2481 else
2482 echo "(However, $cpprun $cpplast does not work, let's see...)"
2304df62
AD
2483 fi
2484 ;;
2485 esac
2304df62 2486else
a0d0e21e
LW
2487 case "$cppstdin" in
2488 '') ;;
2489 *)
2490 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
2491 ;;
2492 esac
2304df62 2493fi
2304df62 2494
a0d0e21e
LW
2495if $ok; then
2496 : nothing
2497elif echo 'Maybe "'"$cc"' -E" will work...'; \
2498 $cc -E <testcpp.c >testcpp.out 2>&1; \
2499 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2500 echo "Yup, it does."
2501 x_cpp="$cc -E"
2502 x_minus='';
2503elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
2504 $cc -E - <testcpp.c >testcpp.out 2>&1; \
2505 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2506 echo "Yup, it does."
2507 x_cpp="$cc -E"
2508 x_minus='-';
2509elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
2510 $cc -P <testcpp.c >testcpp.out 2>&1; \
2511 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2512 echo "Yipee, that works!"
2513 x_cpp="$cc -P"
2514 x_minus='';
2515elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
2516 $cc -P - <testcpp.c >testcpp.out 2>&1; \
2517 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2518 echo "At long last!"
2519 x_cpp="$cc -P"
2520 x_minus='-';
2521elif echo 'No such luck, maybe "'$cpp'" will work...'; \
2522 $cpp <testcpp.c >testcpp.out 2>&1; \
2523 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2524 echo "It works!"
2525 x_cpp="$cpp"
2526 x_minus='';
2527elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
2528 $cpp - <testcpp.c >testcpp.out 2>&1; \
2529 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2530 echo "Hooray, it works! I was beginning to wonder."
2531 x_cpp="$cpp"
2532 x_minus='-';
2533elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
2534 $wrapper <testcpp.c >testcpp.out 2>&1; \
2535 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2536 x_cpp="$wrapper"
2537 x_minus=''
2538 echo "Eureka!"
2539else
2540 dflt=''
2541 rp="No dice. I can't find a C preprocessor. Name one:"
2542 . ./myread
2543 x_cpp="$ans"
2544 x_minus=''
2545 $x_cpp <testcpp.c >testcpp.out 2>&1
2546 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2547 echo "OK, that will do." >&4
2548 else
2549echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
2550 exit 1
2551 fi
2552fi
2553
2554case "$ok" in
2555false)
2556 cppstdin="$x_cpp"
2557 cppminus="$x_minus"
2558 cpprun="$x_cpp"
2559 cpplast="$x_minus"
2560 set X $x_cpp
2561 shift
2562 case "$1" in
2563 "$cpp")
2564 echo "Perhaps can we force $cc -E using a wrapper..."
2565 if $wrapper <testcpp.c >testcpp.out 2>&1; \
2566 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2567 then
2568 echo "Yup, we can."
2569 cppstdin="$wrapper"
2570 cppminus='';
2571 else
2572 echo "Nope, we'll have to live without it..."
2573 fi
2574 ;;
2575 esac
2576 case "$cpprun" in
2577 "$wrapper")
2578 cpprun=''
2579 cpplast=''
2580 ;;
2581 esac
2582 ;;
2583esac
2584
2585case "$cppstdin" in
2586"$wrapper") ;;
2587*) $rm -f $wrapper;;
2588esac
2589$rm -f testcpp.c testcpp.out
2590
2591: determine optimize, if desired, or use for debug flag also
2592case "$optimize" in
2593' ') dflt='none';;
2594'') dflt='-O';;
2595*) dflt="$optimize";;
2596esac
2597$cat <<EOH
2598
2599Some C compilers have problems with their optimizers, by default, $package
2600compiles with the -O flag to use the optimizer. Alternately, you might want
2601to use the symbolic debugger, which uses the -g flag (on traditional Unix
2602systems). Either flag can be specified here. To use neither flag, specify
2603the word "none".
2604
2605EOH
2606rp="What optimizer/debugger flag should be used?"
2607. ./myread
2608optimize="$ans"
2609case "$optimize" in
2610'none') optimize=" ";;
2611esac
2612
2613dflt=''
2614case "$ccflags" in
2615'')
2616 case "$gccversion" in
2617 1*) dflt='-fpcc-struct-return' ;;
2618 esac
2619 case "$optimize" in
2620 *-g*) dflt="$dflt -DDEBUGGING";;
2621 esac
2622 case "$gccversion" in
2623 2*) if test -d /etc/conf/kconfig.d &&
2624 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
2625 then
2626 dflt="$dflt -posix"
2627 fi
2628 ;;
2629 esac
2630 ;;
2631esac
2632
2633case "$mips_type" in
2634*BSD*) ;;
2635'') ;;
2636*) inclwanted="$inclwanted $usrinc/bsd";;
2637esac
2638for thisincl in $inclwanted; do
2639 if $test -d $thisincl; then
2640 if $test x$thisincl != x$usrinc; then
2641 case "$dflt" in
2642 *$thisincl*);;
2643 *) dflt="$dflt -I$thisincl";;
2644 esac
2645 fi
2646 fi
2647done
2648
2649inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
2650 xxx=true;
2651elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
2652 xxx=true;
2653else
2654 xxx=false;
2655fi;
2656if $xxx; then
2657 case "$dflt" in
2658 *$2*);;
2659 *) dflt="$dflt -D$2";;
2660 esac;
2661fi'
2662
2663if ./osf1; then
2664 set signal.h __LANGUAGE_C__; eval $inctest
2665else
2666 set signal.h LANGUAGE_C; eval $inctest
2667fi
2668set signal.h NO_PROTOTYPE; eval $inctest
2669set signal.h _NO_PROTO; eval $inctest
2670
2671case "$dflt" in
2672'') dflt=none;;
2304df62 2673esac
85e6fe83
LW
2674case "$ccflags" in
2675'') ;;
2676*) dflt="$ccflags";;
2677esac
2304df62
AD
2678$cat <<EOH
2679
2680Your C compiler may want other flags. For this question you should include
2681-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
2682but you should NOT include libraries or ld flags like -lwhatever. If you
2683want $package to honor its debug switch, you should include -DDEBUGGING here.
a0d0e21e
LW
2684Your C compiler might also need additional flags, such as -D_POSIX_SOURCE,
2685-DHIDEMYMALLOC or -DCRIPPLED_CC.
2686
2304df62
AD
2687To use no flags, specify the word "none".
2688
2304df62
AD
2689EOH
2690set X $dflt
2691shift
2692dflt=${1+"$@"}
2693rp="Any additional cc flags?"
2694. ./myread
2695case "$ans" in
2696none) ccflags='';;
2697*) ccflags="$ans";;
2698esac
2699
2700: the following weeds options from ccflags that are of no interest to cpp
2701cppflags="$ccflags"
a0d0e21e
LW
2702case "$gccversion" in
27031*) cppflags="$cppflags -D__GNUC__"
2304df62
AD
2704esac
2705case "$mips_type" in
2706'');;
2707*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
2708esac
2709case "$cppflags" in
2710'');;
a0d0e21e
LW
2711*)
2712 echo " "
2713 echo "Let me guess what the preprocessor flags are..." >&4
2714 set X $cppflags
2715 shift
2304df62 2716 cppflags=''
a0d0e21e
LW
2717 $cat >cpp.c <<'EOM'
2718#define BLURFL foo
2719
2720BLURFL xx LFRULB
2721EOM
2722 previous=''
2723 for flag in $*
2304df62 2724 do
a0d0e21e
LW
2725 case "$flag" in
2726 -*) ftry="$flag";;
2727 *) ftry="$previous $flag";;
2304df62 2728 esac
a0d0e21e
LW
2729 if $cppstdin -DLFRULB=bar $ftry $cppminus <cpp.c \
2730 >cpp1.out 2>/dev/null && \
2731 $cpprun -DLFRULB=bar $ftry $cpplast <cpp.c \
2732 >cpp2.out 2>/dev/null && \
2733 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
2734 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
2735 then
2736 cppflags="$cppflags $ftry"
2737 previous=''
2738 else
2739 previous="$flag"
2740 fi
2304df62 2741 done
a0d0e21e
LW
2742 set X $cppflags
2743 shift
2744 cppflags=${1+"$@"}
2304df62 2745 case "$cppflags" in
a0d0e21e 2746 *-*) echo "They appear to be: $cppflags";;
2304df62 2747 esac
a0d0e21e 2748 $rm -f cpp.c cpp?.out
2304df62
AD
2749 ;;
2750esac
2751
2752: flags used in final linking phase
2753case "$ldflags" in
ecfc5424 2754'') if ./venix; then
2304df62
AD
2755 dflt='-i -z'
2756 else
a0d0e21e 2757 dflt=''
2304df62 2758 fi
a0d0e21e
LW
2759 case "$ccflags" in
2760 *-posix*) dflt="$dflt -posix" ;;
2761 esac
2762 case "$dflt" in
2763 '') dflt='none' ;;
2764 esac
2304df62
AD
2765 ;;
2766*) dflt="$ldflags";;
2767esac
2768echo " "
2769rp="Any additional ld flags (NOT including libraries)?"
2770. ./myread
2771case "$ans" in
2772none) ldflags='';;
2773*) ldflags="$ans";;
2774esac
2775rmlist="$rmlist pdp11"
2776
16d20bd9
AD
2777: coherency check
2778echo " "
2779echo "Checking your choice of C compiler and flags for coherency..." >&4
2780set X $cc $optimize $ccflags try.c -o try $ldflags
2781shift
2782$cat >try.msg <<EOM
2783I've tried to compile and run a simple program with:
2784
2785 $*
2786 ./try
2787
2788and I got the following output:
2789
2790EOM
2791$cat > try.c <<'EOF'
2792#include <stdio.h>
2793main() { exit(0); }
2794EOF
2795dflt=y
2796if sh -c "$cc $optimize $ccflags try.c -o try $ldflags" >>try.msg 2>&1; then
2797 if sh -c './try' >>try.msg 2>&1; then
2798 dflt=n
2799 else
2800 echo "The program compiled OK, but exited with status $?." >>try.msg
2801 rp="You have a problem. Shall I abort Configure"
2802 dflt=y
2803 fi
2804else
2805 echo "I can't compile the test program." >>try.msg
2806 rp="You have a BIG problem. Shall I abort Configure"
2807 dflt=y
2808fi
2809case "$dflt" in
2810y)
2811 $cat try.msg
2812 case "$knowitall" in
2813 '')
2814 echo "(The supplied flags might be incorrect with this C compiler.)"
2815 ;;
2816 *) dflt=n;;
2817 esac
2818 echo " "
2819 . ./myread
2820 case "$ans" in
2821 n*|N*) ;;
2822 *) echo "Ok. Stopping Configure." >&4
2823 exit 1
2824 ;;
2825 esac
2826 ;;
2827n) echo "OK, that should do.";;
2828esac
2829$rm -f try try.* core
2830
2304df62
AD
2831: Set private lib path
2832case "$plibpth" in
ecfc5424 2833'') if ./mips; then
2304df62
AD
2834 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
2835 fi;;
2836esac
a0d0e21e
LW
2837case "$libpth" in
2838' ') dlist='';;
2839'') dlist="$plibpth $glibpth";;
2840*) dlist="$libpth";;
2841esac
2842
2843: Now check and see which directories actually exist, avoiding duplicates
2844libpth=''
2845for xxx in $dlist
2304df62 2846do
a0d0e21e
LW
2847 if $test -d $xxx; then
2848 case " $libpth " in
2849 *" $xxx "*) ;;
2850 *) libpth="$libpth $xxx";;
2851 esac
2304df62
AD
2852 fi
2853done
a0d0e21e 2854$cat <<'EOM'
2304df62 2855
a0d0e21e
LW
2856Some systems have incompatible or broken versions of libraries. Among
2857the directories listed in the question below, please remove any you
2858know not to be holding relevant libraries, and add any that are needed.
2859Say "none" for none.
2860
2861EOM
2862case "$libpth" in
2863'') dflt='none';;
2864*)
2865 set X $libpth
2866 shift
2867 dflt=${1+"$@"}
2868 ;;
2869esac
2304df62
AD
2870rp="Directories to use for library searches?"
2871. ./myread
2872case "$ans" in
2873none) libpth=' ';;
2874*) libpth="$ans";;
2875esac
a0d0e21e
LW
2876
2877: compute shared library extension
2878case "$so" in
2879'')
2880 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
2881 dflt='sl'
2882 else
2883 dflt='so'
2884 fi
2885 ;;
2886*) dflt="$so";;
2887esac
ecfc5424 2888$cat <<EOM
a0d0e21e
LW
2889
2890On some systems, shared libraries may be available. Answer 'none' if
ecfc5424
AD
2891you want to suppress searching of shared libraries for the remaining
2892of this configuration.
2893
a0d0e21e
LW
2894EOM
2895rp='What is the file extension used for shared libraries?'
2896. ./myread
2897so="$ans"
2898
2304df62
AD
2899: Looking for optional libraries
2900echo " "
2901echo "Checking for optional libraries..." >&4
2902case "$libs" in
2903' '|'') dflt='';;
2904*) dflt="$libs";;
2905esac
2906case "$libswanted" in
2907'') libswanted='c_s';;
2908esac
2909for thislib in $libswanted; do
a0d0e21e
LW
2910
2911 if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then
2912 echo "Found -l$thislib (shared)."
2913 case " $dflt " in
2914 *"-l$thislib "*);;
2915 *) dflt="$dflt -l$thislib";;
2916 esac
2917 elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
2918 echo "Found -l$thislib (shared)."
2919 case " $dflt " in
2920 *"-l$thislib "*);;
2921 *) dflt="$dflt -l$thislib";;
2922 esac
2923 elif xxx=`./loc lib$thislib.a X $libpth`; $test -f "$xxx"; then
2304df62 2924 echo "Found -l$thislib."
a0d0e21e
LW
2925 case " $dflt " in
2926 *"-l$thislib "*);;
2304df62
AD
2927 *) dflt="$dflt -l$thislib";;
2928 esac
a0d0e21e
LW
2929 elif xxx=`./loc lib${thislib}_s.a X $libpth`; $test -f "$xxx"; then
2930 echo "Found -l${thislib}_s."
2931 case " $dflt " in
2932 *"-l$thislib "*);;
2933 *) dflt="$dflt -l${thislib}_s";;
2304df62 2934 esac
a0d0e21e
LW
2935 elif xxx=`./loc Slib$thislib.a X $xlibpth`; $test -f "$xxx"; then
2936 echo "Found -l$thislib."
2937 case " $dflt " in
2938 *"-l$thislib "*);;
2304df62
AD
2939 *) dflt="$dflt -l$thislib";;
2940 esac
2941 else
a0d0e21e 2942 echo "No -l$thislib."
2304df62
AD
2943 fi
2944done
2945set X $dflt
2946shift
2947dflt="$*"
2948case "$libs" in
2949'') dflt="$dflt";;
2950*) dflt="$libs";;
2951esac
2952case "$dflt" in
2953' '|'') dflt='none';;
2954esac
2955
2956$cat <<EOM
2957
2958Some versions of Unix support shared libraries, which make executables smaller
2959but make load time slightly longer.
2960
2961On some systems, mostly newer Unix System V's, the shared library is included
2962by putting the option "-lc_s" as the last thing on the cc command line when
2963linking. Other systems use shared libraries by default. There may be other
2964libraries needed to compile $package on your machine as well. If your system
2965needs the "-lc_s" option, include it here. Include any other special libraries
2966here as well. Say "none" for none.
2967EOM
2968
2969echo " "
2970rp="Any additional libraries?"
2971. ./myread
2972case "$ans" in
2973none) libs=' ';;
2974*) libs="$ans";;
2975esac
2976
2977: see if nm is to be used to determine whether a symbol is defined or not
2978case "$usenm" in
2979'')
2980 dflt=`egrep 'inlibc|csym' ../Configure | wc -l 2>/dev/null`
2981 if $test $dflt -gt 20; then
2982 dflt=y
2983 else
2984 dflt=n
2985 fi
2986 ;;
2987*)
2988 case "$usenm" in
2989 true) dflt=y;;
2990 *) dflt=n;;
2991 esac
2992 ;;
2993esac
2994$cat <<EOM
2995
2996I can use 'nm' to extract the symbols from your C libraries. This is a time
2997consuming task which may generate huge output on the disk (up to 3 megabytes)
2998but that should make the symbols extraction faster. The alternative is to skip
2999the 'nm' extraction part and to compile a small test program instead to
3000determine whether each symbol is present. If you have a fast C compiler and/or
3001if your 'nm' output cannot be parsed, this may be the best solution.
3002
3003EOM
3004rp='Shall I use nm to extract C symbols from the libraries?'
3005. ./myread
3006case "$ans" in
3007n|N) usenm=false;;
3008*) usenm=true;;
3009esac
3010
3011runnm=$usenm
3012case "$reuseval" in
3013true) runnm=false;;
3014esac
3015
3016: nm options which may be necessary
3017case "$nm_opt" in
3018'') if $test -f /mach_boot; then
3019 nm_opt=''
3020 elif $test -d /usr/ccs/lib; then
3021 nm_opt='-p'
3022 elif $test -f /dgux; then
3023 nm_opt='-p'
3024 else
3025 nm_opt=''
3026 fi;;
3027esac
3028
3029case "$runnm" in
3030true)
3031: get list of predefined functions in a handy place
3032echo " "
3033case "$libc" in
3034'') libc=unknown
3035 case "$libs" in
3036 *-lc_s*) libc=`./loc libc_s.a $libc $libpth`
3037 esac
3038 ;;
3039esac
2304df62
AD
3040libnames='';
3041case "$libs" in
3042'') ;;
3043*) for thislib in $libs; do
3044 case "$thislib" in
a0d0e21e
LW
3045 -lc|-lc_s)
3046 : Handle C library specially below.
3047 ;;
2304df62 3048 -l*)
ecfc5424 3049 thislib=`echo $thislib | $sed -e 's/^-l//'`
a0d0e21e
LW
3050 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
3051 :
3052 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
3053 :
3054 elif try=`./loc lib$thislib.a X $libpth`; $test -f "$try"; then
3055 :
3056 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
3057 :
3058 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
3059 :
3060 elif try=`./loc Slib$thislib.a X $xlibpth`; $test -f "$try"; then
3061 :
3062 else
3063 try=''
2304df62
AD
3064 fi
3065 libnames="$libnames $try"
3066 ;;
3067 *) libnames="$libnames $thislib" ;;
3068 esac
3069 done
3070 ;;
3071esac
3072xxx=normal
3073case "$libc" in
3074unknown)
a0d0e21e
LW
3075 set /usr/ccs/lib/libc.$so
3076 $test -r $1 || set /usr/lib/libc.$so
3077 $test -r $1 || set /usr/shlib/libc.$so
16d20bd9
AD
3078 $test -r $1 || \
3079 set `echo blurfl; echo /usr/lib/libc.$so.[0-9]* | \
3080 tr ' ' '\012' | egrep -v '\.[A-Za-z]*$' | $sed -e '
3081 h
3082 s/[0-9][0-9]*/0000&/g
3083 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
3084 G
3085 s/\n/ /' | \
3086 sort | $sed -e 's/^.* //'`
3087 eval set \$$#
a0d0e21e 3088 $test -r $1 || set /lib/libc.$so
2304df62 3089 $test -r $1 || set /lib/libsys_s.a
2304df62
AD
3090 ;;
3091*)
3092 set blurfl
3093 ;;
3094esac
3095if $test -r "$1"; then
3096 echo "Your (shared) C library seems to be in $1."
3097 libc="$1"
3098elif $test -r /lib/libc && $test -r /lib/clib; then
3099 echo "Your C library seems to be in both /lib/clib and /lib/libc."
3100 xxx=apollo
3101 libc='/lib/clib /lib/libc'
3102 if $test -r /lib/syslib; then
3103 echo "(Your math library is in /lib/syslib.)"
3104 libc="$libc /lib/syslib"
3105 fi
3106elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
3107 echo "Your C library seems to be in $libc, as you said before."
3108elif $test -r $incpath/usr/lib/libc.a; then
3109 libc=$incpath/usr/lib/libc.a;
3110 echo "Your C library seems to be in $libc. That's fine."
3111elif $test -r /lib/libc.a; then
3112 libc=/lib/libc.a;
3113 echo "Your C library seems to be in $libc. You're normal."
3114else
3115 if tans=`./loc libc.a blurfl/dyick $libpth`; $test -r "$tans"; then
3116 :
3117 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
3118 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
3119 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
3120 :
3121 elif tans=`./loc Slibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
3122 :
3123 elif tans=`./loc Mlibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
3124 :
3125 else
3126 tans=`./loc Llibc.a blurfl/dyick $xlibpth`
3127 fi
3128 if $test -r "$tans"; then
3129 echo "Your C library seems to be in $tans, of all places."
3130 libc=$tans
3131 else
3132 libc='blurfl'
3133 fi
3134fi
3135if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
3136 dflt="$libc"
3137 cat <<EOM
3138
3139If the guess above is wrong (which it might be if you're using a strange
3140compiler, or your machine supports multiple models), you can override it here.
3141
3142EOM
3143else
3144 dflt=''
3145 echo $libpth | tr ' ' '\012' | sort | uniq > libpath
3146 cat >&4 <<EOM
3147I can't seem to find your C library. I've looked in the following places:
3148
3149EOM
3150 $sed 's/^/ /' libpath
3151 cat <<EOM
3152
3153None of these seems to contain your C library. I need to get its name...
3154
3155EOM
3156fi
3157fn=f
3158rp='Where is your C library?'
3159. ./getfile
3160libc="$ans"
3161
3162echo " "
3163echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames
3164set X `cat libnames`
3165shift
3166xxx=files
3167case $# in 1) xxx=file; esac
3168echo "Extracting names from the following $xxx for later perusal:" >&4
3169echo " "
3170$sed 's/^/ /' libnames >&4
3171echo " "
3172$echo $n "This may take a while...$c" >&4
ecfc5424 3173
2304df62
AD
3174nm $nm_opt $* 2>/dev/null >libc.tmp
3175$echo $n ".$c"
3176$grep fprintf libc.tmp > libc.ptf
3177xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
3178xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
16d20bd9
AD
3179xxx='[ADTSIW]'
3180if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx //p'";\
2304df62
AD
3181 eval $xscan;\
3182 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3183 eval $xrun
3184elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
3185 eval $xscan;\
3186 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3187 eval $xrun
3188elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
3189 eval $xscan;\
3190 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3191 eval $xrun
3192elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
3193 eval $xscan;\
3194 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3195 eval $xrun
3196elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
3197 eval $xscan;\
3198 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3199 eval $xrun
3200elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
3201 eval $xscan;\
3202 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3203 eval $xrun
3204elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
3205 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
3206 eval $xscan;\
3207 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3208 eval $xrun
3209elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
3210 eval $xscan;\
3211 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3212 eval $xrun
3213elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
3214 eval $xscan;\
3215 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3216 eval $xrun
a0d0e21e
LW
3217elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
3218 eval $xscan;\
3219 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3220 eval $xrun
2304df62
AD
3221else
3222 nm -p $* 2>/dev/null >libc.tmp
16d20bd9
AD
3223 $grep fprintf libc.tmp > libc.ptf
3224 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
3225 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
3226 then
2304df62 3227 nm_opt='-p'
16d20bd9 3228 eval $xrun
2304df62
AD
3229 else
3230 echo " "
3231 echo "nm didn't seem to work right. Trying ar instead..." >&4
3232 com=''
3233 if ar t $libc > libc.tmp; then
3234 for thisname in $libnames; do
3235 ar t $thisname >>libc.tmp
3236 done
3237 $sed -e 's/\.o$//' < libc.tmp > libc.list
3238 echo "Ok." >&4
3239 else
3240 echo "ar didn't seem to work right." >&4
3241 echo "Maybe this is a Cray...trying bld instead..." >&4
16d20bd9
AD
3242 if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list
3243 then
2304df62
AD
3244 for thisname in $libnames; do
3245 bld t $libnames | \
3246 $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
3247 ar t $thisname >>libc.tmp
3248 done
3249 echo "Ok." >&4
3250 else
3251 echo "That didn't work either. Giving up." >&4
3252 exit 1
3253 fi
3254 fi
3255 fi
3256fi
3257nm_extract="$com"
3258if $test -f /lib/syscalls.exp; then
3259 echo " "
3260 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
3261 $sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
3262fi
3263;;
3264esac
3265$rm -f libnames libpath
3266
3267: is a C symbol defined?
3268csym='tlook=$1;
3269case "$3" in
3270-v) tf=libc.tmp; tc=""; tdc="";;
3271-a) tf=libc.tmp; tc="[0]"; tdc=[];;
3272*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
3273esac;
3274tx=yes;
3275case "$reuseval-$4" in
3276true-) ;;
3277true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
3278esac;
3279case "$tx" in
3280yes)
3281 case "$runnm" in
3282 true)
3283 if $contains $tlook $tf >/dev/null 2>&1;
3284 then tval=true;
3285 else tval=false;
3286 fi;;
3287 *)
16d20bd9 3288 echo "main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
2304df62
AD
3289 if $cc $ccflags -o t t.c $ldflags $libs >/dev/null 2>&1;
3290 then tval=true;
3291 else tval=false;
3292 fi;
3293 $rm -f t t.c;;
3294 esac;;
3295*)
3296 case "$tval" in
3297 $define) tval=true;;
3298 *) tval=false;;
3299 esac;;
3300esac;
3301eval "$2=$tval"'
3302
3303: set up the script used to warn in case of inconsistency
3304cat <<'EOSC' >whoa
3305dflt=y
3306echo " "
3307echo "*** WHOA THERE!!! ***" >&4
3308echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3309rp=" Keep the $hint value?"
3310. ./myread
3311case "$ans" in
3312y) td=$was; tu=$was;;
3313esac
3314EOSC
3315
3316: define an is-in-libc? function
3317inlibc='echo " "; td=$define; tu=$undef;
3318sym=$1; var=$2; eval "was=\$$2";
3319tx=yes;
3320case "$reuseval$was" in
3321true) ;;
3322true*) tx=no;;
3323esac;
3324case "$tx" in
3325yes)
3326 set $sym tres -f;
3327 eval $csym;
3328 case "$tres" in
3329 true)
3330 echo "$sym() found." >&4;
ecfc5424 3331 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
2304df62
AD
3332 *)
3333 echo "$sym() NOT found." >&4;
ecfc5424 3334 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
2304df62
AD
3335 esac;;
3336*)
3337 case "$was" in
3338 $define) echo "$sym() found." >&4;;
3339 *) echo "$sym() NOT found." >&4;;
3340 esac;;
3341esac'
3342
a0d0e21e 3343: see if gconvert exists
16d20bd9
AD
3344: On some SVR4 systems, gconvert is present but can not be used
3345: because it requires some other unavailable functions.
3346: Therefore, do not use the nm extraction, but use a real compile
3347: and link test instead.
3348xxx_runnm="$runnm"
3349runnm=false
a0d0e21e
LW
3350set gconvert d_gconvert
3351eval $inlibc
16d20bd9 3352runnm="$xxx_runnm"
2304df62 3353
a0d0e21e
LW
3354case "$d_gconvert" in
3355$define)
ecfc5424 3356 echo "We'll use it to convert floats into a string then." >&4
a0d0e21e
LW
3357 d_Gconvert="gconvert((x),(n),(t),(b))"
3358 ;;
3359*)
3360 : Maybe we can emulate it with gcvt.
3361 set gcvt d_gcvt
3362 eval $inlibc
2304df62 3363
a0d0e21e
LW
3364 case "$d_gcvt" in
3365 $define)
3366 : Test whether gcvt drops a trailing decimal point
ecfc5424 3367 $cat >try.c <<'EOP'
a0d0e21e 3368main() {
ecfc5424
AD
3369 char buf[64];
3370 gcvt(1.0, 8, buf);
3371 if (buf[0] != '1' || buf[1] != '\0')
3372 exit(1);
3373 gcvt(0.0, 8, buf);
3374 if (buf[0] != '0' || buf[1] != '\0')
3375 exit(1);
3376 gcvt(-1.0, 8, buf);
3377 if (buf[0] != '-' || buf[1] != '1' || buf[2] != '\0')
3378 exit(1);
3379 exit(0);
a0d0e21e
LW
3380}
3381EOP
3382 if $cc $ccflags $ldflags -o try try.c $libs > /dev/null 2>&1; then
3383 if ./try; then
3384 echo "Good, your gcvt() drops a trailing decimal point."
ecfc5424 3385 echo "We'll use it to convert floats into a string." >&4
a0d0e21e
LW
3386 d_Gconvert="gcvt((x),(n),(b))"
3387 else
3388 echo "But your gcvt() keeps a trailing decimal point".
3389 d_Gconvert=''
3390 fi
2304df62 3391 else
a0d0e21e
LW
3392 echo "Hmm. I can't compile the gcvt test program."
3393 d_Gconvert=''
2304df62 3394 fi
a0d0e21e 3395 $rm -f try.c try
2304df62
AD
3396 ;;
3397 esac
a0d0e21e
LW
3398 case "$d_Gconvert" in
3399 '')
ecfc5424 3400 echo "I'll use sprintf instead to convert floats into a string." >&4
a0d0e21e 3401 d_Gconvert='sprintf((b),"%.*g",(n),(x))'
2304df62
AD
3402 ;;
3403 esac
2304df62
AD
3404esac
3405
a0d0e21e
LW
3406: Initialize h_fcntl
3407h_fcntl=false
3408
3409: Initialize h_sysfile
3410h_sysfile=false
2304df62
AD
3411
3412: determine filename position in cpp output
3413echo " "
3414echo "Computing filename position in cpp output for #include directives..." >&4
3415echo '#include <stdio.h>' > foo.c
3416$cat >fieldn <<EOF
3417$startsh
a0d0e21e 3418$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
2304df62
AD
3419$grep '^[ ]*#.*stdio\.h' | \
3420while read cline; do
3421 pos=1
3422 set \$cline
3423 while $test \$# -gt 0; do
3424 if $test -r \`echo \$1 | $tr -d '"'\`; then
3425 echo "\$pos"
3426 exit 0
3427 fi
3428 shift
3429 pos=\`expr \$pos + 1\`
3430 done
3431done
3432EOF
3433chmod +x fieldn
3434fieldn=`./fieldn`
3435$rm -f foo.c fieldn
3436case $fieldn in
3437'') pos='???';;
34381) pos=first;;
34392) pos=second;;
34403) pos=third;;
3441*) pos="${fieldn}th";;
3442esac
3443echo "Your cpp writes the filename in the $pos field of the line."
3444
3445: locate header file
3446$cat >findhdr <<EOF
3447$startsh
3448wanted=\$1
3449name=''
3450if test -f $usrinc/\$wanted; then
3451 echo "$usrinc/\$wanted"
3452 exit 0
3453fi
3454awkprg='{ print \$$fieldn }'
3455echo "#include <\$wanted>" > foo\$\$.c
3456$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3457$grep "^[ ]*#.*\$wanted" | \
3458while read cline; do
3459 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
3460 case "\$name" in
3461 */\$wanted) echo "\$name"; exit 0;;
3462 *) name='';;
3463 esac;
3464done;
3465$rm -f foo\$\$.c;
3466case "\$name" in
3467'') exit 1;;
3468esac
3469EOF
3470chmod +x findhdr
3471
3472: access call always available on UNIX
3473set access d_access
3474eval $inlibc
3475
3476: locate the flags for 'access()'
3477case "$d_access" in
3478"$define")
3479 echo " "
3480 $cat >access.c <<'EOCP'
3481#include <sys/types.h>
3482#ifdef I_FCNTL
3483#include <fcntl.h>
3484#endif
3485#ifdef I_SYS_FILE
3486#include <sys/file.h>
3487#endif
3488#ifdef I_UNISTD
3489#include <unistd.h>
3490#endif
3491main() {
3492 exit(R_OK);
3493}
3494EOCP
3495 : check sys/file.h first, no particular reason here
3496 if $test `./findhdr sys/file.h` && \
3497 $cc $cppflags -DI_SYS_FILE access.c -o access >/dev/null 2>&1 ; then
3498 h_sysfile=true;
3499 echo "<sys/file.h> defines the *_OK access constants." >&4
3500 elif $test `./findhdr fcntl.h` && \
3501 $cc $cppflags -DI_FCNTL access.c -o access >/dev/null 2>&1 ; then
3502 h_fcntl=true;
3503 echo "<fcntl.h> defines the *_OK access constants." >&4
85e6fe83
LW
3504 elif $test `./findhdr unistd.h` && \
3505 $cc $cppflags -DI_UNISTD access.c -o access >/dev/null 2>&1 ; then
3506 echo "<unistd.h> defines the *_OK access constants." >&4
2304df62
AD
3507 else
3508 echo "I can't find the four *_OK access constants--I'll use mine." >&4
3509 fi
3510 ;;
3511esac
3512$rm -f access*
3513
a0d0e21e
LW
3514: see if alarm exists
3515set alarm d_alarm
2304df62
AD
3516eval $inlibc
3517
40000a8c
AD
3518: determine the architecture name
3519echo " "
3520if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3521 tarch=`arch`"-$osname"
3522elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3523 if uname -m > tmparch 2>&1 ; then
94b6baf5 3524 tarch=`$sed -e 's/ /_/g' -e 's/$/'"-$osname/" tmparch`
40000a8c
AD
3525 else
3526 tarch="$osname"
3527 fi
3528 $rm -f tmparch
3529else
3530 tarch="$osname"
3531fi
3532case "$myarchname" in
3533''|"$tarch") ;;
3534*)
3535 echo "(Your architecture name used to be $myarchname.)"
3536 archname=''
3537 ;;
3538esac
3539case "$archname" in
3540'') dflt="$tarch";;
3541*) dflt="$archname";;
3542esac
3543rp='What is your architecture name'
3544. ./myread
3545archname="$ans"
3546myarchname="$tarch"
3547
a0d0e21e
LW
3548: is AFS running?
3549echo " "
3550if test -d /afs; then
3551 echo "AFS may be running... I'll be extra cautious then..." >&4
3552 afs=true
3553else
3554 echo "AFS does not seem to be running..." >&4
3555 afs=false
3556fi
2304df62 3557
a0d0e21e
LW
3558: determine root of directory hierarchy where package will be installed.
3559case "$prefix" in
3560'')
3561 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3562 ;;
3563*)
3564 dflt="$prefix"
3565 ;;
3566esac
3567$cat <<EOM
2304df62 3568
a0d0e21e
LW
3569By default, $package will be installed in $dflt/bin, manual
3570pages under $dflt/man, etc..., i.e. with $dflt as prefix for
3571all installation directories. Typically set to /usr/local, but you
3572may choose /usr if you wish to install $package among your system
3573binaries. If you wish to have binaries under /bin but manual pages
3574under /usr/local/man, that's ok: you will be prompted separately
3575for each of the installation directories, the prefix being only used
1aef975c 3576to set the defaults.
a0d0e21e
LW
3577
3578EOM
3579fn=d~
3580rp='Installation prefix to use?'
3581. ./getfile
1aef975c
AD
3582oldprefix=''
3583case "$prefix" in
3584'') ;;
3585*)
3586 case "$ans" in
3587 "$prefix") ;;
3588 *) oldprefix="$prefix";;
3589 esac
3590 ;;
3591esac
a0d0e21e 3592prefix="$ans"
1aef975c
AD
3593prefixexp="$ansexp"
3594
3595: set the prefixit variable, to compute a suitable default value
3596prefixit='case "$3" in
3597""|none)
3598 case "$oldprefix" in
3599 "") eval "$1=\"\$$2\"";;
3600 *)
3601 case "$3" in
3602 "") eval "$1=";;
3603 none)
3604 eval "tp=\"\$$2\"";
3605 case "$tp" in
3606 ""|" ") eval "$1=\"\$$2\"";;
3607 *) eval "$1=";;
3608 esac;;
3609 esac;;
3610 esac;;
3611*)
3612 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3613 case "$tp" in
3614 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3615 /*-$oldprefix/*|\~*-$oldprefix/*)
3616 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3617 *) eval "$1=\"\$$2\"";;
3618 esac;;
3619esac'
a0d0e21e
LW
3620
3621: determine where private executables go
1aef975c
AD
3622set dflt privlib lib/$package
3623eval $prefixit
a0d0e21e
LW
3624$cat <<EOM
3625
3626There are some auxiliary files for $package that need to be put into a
3627private library directory that is accessible by everyone.
3628
3629EOM
3630fn=d~+
1aef975c 3631rp='Pathname where the private library files will reside?'
a0d0e21e 3632. ./getfile
1aef975c
AD
3633if $test "X$privlibexp" != "X$ansexp"; then
3634 installprivlib=''
3635fi
a0d0e21e
LW
3636privlib="$ans"
3637privlibexp="$ansexp"
3638if $afs; then
3639 $cat <<EOM
3640
3641Since you are running AFS, I need to distinguish the directory in which
3642private files reside from the directory in which they are installed (and from
3643which they are presumably copied to the former directory by occult means).
3644
3645EOM
3646 case "$installprivlib" in
3647 '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
3648 *) dflt="$installprivlib";;
3649 esac
3650 fn=de~
3651 rp='Where will private files be installed?'
3652 . ./getfile
3653 installprivlib="$ans"
3654else
3655 installprivlib="$privlibexp"
3656fi
3657
1aef975c
AD
3658: set the prefixup variable, to restore leading tilda escape
3659prefixup='case "$prefixexp" in
3660"$prefix") ;;
3661*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3662esac'
3663
a0d0e21e 3664: determine where public architecture dependent libraries go
1aef975c
AD
3665set archlib archlib
3666eval $prefixit
ecfc5424
AD
3667case "$archlib" in
3668'')
3669 case "$privlib" in
1aef975c
AD
3670 '')
3671 dflt=`./loc . "." $prefixexp/lib /usr/local/lib /usr/lib /lib`
3672 set dflt
3673 eval $prefixup
3674 ;;
ecfc5424
AD
3675 *) dflt="$privlib/$archname";;
3676 esac
3677 ;;
3678*) dflt="$archlib";;
a0d0e21e 3679esac
a0d0e21e
LW
3680cat <<EOM
3681
1aef975c 3682$spackage contains architecture-dependent library files. If you are
a0d0e21e
LW
3683sharing libraries in a heterogeneous environment, you might store
3684these files in a separate location. Otherwise, you can just include
3685them with the rest of the public library files.
3686
3687EOM
ecfc5424 3688fn=d~
a0d0e21e
LW
3689rp='Where do you want to put the public architecture-dependent libraries?'
3690. ./getfile
3691archlib="$ans"
3692archlibexp="$ansexp"
3693
3694if $afs; then
3695 $cat <<EOM
3696
3697Since you are running AFS, I need to distinguish the directory in which
3698private files reside from the directory in which they are installed (and from
3699which they are presumably copied to the former directory by occult means).
3700
3701EOM
3702 case "$installarchlib" in
3703 '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
3704 *) dflt="$installarchlib";;
3705 esac
3706 fn=de~
3707 rp='Where will architecture-dependent library files be installed?'
3708 . ./getfile
3709 installarchlib="$ans"
3710else
3711 installarchlib="$archlibexp"
3712fi
3713if $test X"$archlib" = X"$privlib"; then
3714 d_archlib="$undef"
3715else
3716 d_archlib="$define"
3717fi
3718
2304df62
AD
3719: function used to set $1 to $val
3720setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3721case "$val$was" in
ecfc5424
AD
3722$define$undef) . ./whoa; eval "$var=\$td";;
3723$undef$define) . ./whoa; eval "$var=\$tu";;
2304df62
AD
3724*) eval "$var=$val";;
3725esac'
3726
ecfc5424 3727: Look for GNU-cc style attribute checking
2304df62 3728echo " "
a0d0e21e
LW
3729echo "Checking whether your compiler can handle __attribute__ ..." >&4
3730$cat >attrib.c <<'EOCP'
1aef975c 3731#include <stdio.h>
ecfc5424 3732void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
a0d0e21e
LW
3733EOCP
3734if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
3735 if $contains 'warning' attrib.out >/dev/null 2>&1; then
ecfc5424 3736 echo "Your C compiler doesn't fully support __attribute__."
a0d0e21e
LW
3737 val="$undef"
3738 else
ecfc5424 3739 echo "Your C compiler supports __attribute__."
a0d0e21e
LW
3740 val="$define"
3741 fi
3742else
ecfc5424 3743 echo "Your C compiler doesn't seem to understand __attribute__ at all."
a0d0e21e
LW
3744 val="$undef"
3745fi
ecfc5424 3746set d_attribut
a0d0e21e
LW
3747eval $setvar
3748$rm -f attrib*
3749
3750: see if bcmp exists
3751set bcmp d_bcmp
3752eval $inlibc
3753
3754: see if bcopy exists
3755set bcopy d_bcopy
3756eval $inlibc
3757
3758: see if setpgrp exists
3759set setpgrp d_setpgrp
3760eval $inlibc
3761
3762: see which flavor of setpgrp is in use
3763case "$d_setpgrp" in
3764"$define")
3765 echo " "
3766 $cat >set.c <<EOP
3767main()
3768{
3769 if (getuid() == 0) {
3770 printf("(I see you are running Configure as super-user...)\n");
3771 setuid(1);
3772 }
3773 if (-1 == setpgrp(1, 1))
3774 exit(1);
3775 exit(0);
3776}
3777EOP
ecfc5424 3778 if $cc $ccflags -o set set.c $ldflags $libs >/dev/null 2>&1; then
a0d0e21e
LW
3779 ./set 2>/dev/null
3780 case $? in
3781 0) echo "You have to use setpgrp() instead of setpgrp(pid, pgrp)." >&4
3782 val="$undef";;
3783 *) echo "You have to use setpgrp(pid, pgrp) instead of setpgrp()." >&4
3784 val="$define";;
3785 esac
3786 else
ecfc5424 3787 if ./usg; then
a0d0e21e
LW
3788 xxx="USG one, i.e. you use setpgrp()."
3789 val="$undef"
3790 else
3791 xxx="BSD one, i.e. you use setpgrp(pid, pgrp)."
3792 val="$define"
3793 fi
3794 echo "Assuming your setpgrp is a $xxx" >&4
3795 fi
3796 ;;
3797*) val="$undef";;
3798esac
3799set d_bsdpgrp
3800eval $setvar
3801$rm -f set set.c
3802
3803: see if bzero exists
3804set bzero d_bzero
3805eval $inlibc
3806
3807: check for length of integer
3808echo " "
3809case "$intsize" in
3810'')
3811 echo "Checking to see how big your integers are..." >&4
3812 $cat >try.c <<'EOCP'
3813#include <stdio.h>
3814main()
3815{
3816 printf("%d\n", sizeof(int));
3817}
3818EOCP
3819 if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
3820 dflt=`./try`
3821 else
3822 dflt='4'
3823 echo "(I can't seem to compile the test program. Guessing...)"
3824 fi
3825 ;;
3826*)
3827 dflt="$intsize"
3828 ;;
3829esac
3830rp="What is the size of an integer (in bytes)?"
3831. ./myread
3832intsize="$ans"
3833$rm -f try.c try
3834
ecfc5424 3835: see if signal is declared as pointer to function returning int or void
a0d0e21e 3836echo " "
ecfc5424
AD
3837xxx=`./findhdr signal.h`
3838$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
3839if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
3840 echo "You have int (*signal())() instead of void." >&4
3841 val="$undef"
3842elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
3843 echo "You have void (*signal())() instead of int." >&4
3844 val="$define"
3845elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
3846 echo "You have int (*signal())() instead of void." >&4
3847 val="$undef"
a0d0e21e 3848else
ecfc5424
AD
3849 case "$d_voidsig" in
3850 '')
3851 echo "I can't determine whether signal handler returns void or int..." >&4
3852 dflt=void
3853 rp="What type does your signal handler return?"
3854 . ./myread
3855 case "$ans" in
3856 v*) val="$define";;
3857 *) val="$undef";;
3858 esac;;
3859 "$define")
3860 echo "As you already told me, signal handler returns void." >&4;;
3861 *)
3862 echo "As you already told me, signal handler returns int." >&4;;
3863 esac
3864fi
3865set d_voidsig
3866eval $setvar
3867case "$d_voidsig" in
3868"$define") signal_t="void";;
3869*) signal_t="int";;
3870esac
3871$rm -f $$.tmp
3872
3873: check for ability to cast large floats to 32-bit ints.
3874echo " "
3875echo 'Checking whether your C compiler can cast large floats to int32.' >&4
3876if $test "$intsize" -eq 4; then
3877 xxx=int
3878else
3879 xxx=long
3880fi
3881$cat >try.c <<EOCP
3882#include <sys/types.h>
3883#include <signal.h>
3884$signal_t blech() { exit(3); }
3885main()
2304df62 3886{
a0d0e21e 3887 $xxx i32;
2304df62
AD
3888 double f;
3889 int result = 0;
3890 signal(SIGFPE, blech);
3891
3892 f = (double) 0x7fffffff;
3893 f = 10 * f;
a0d0e21e 3894 i32 = ($xxx) f;
2304df62 3895
a0d0e21e 3896 if (i32 != ($xxx) f)
2304df62
AD
3897 result |= 1;
3898 exit(result);
3899}
3900EOCP
3901if $cc -o try $ccflags try.c >/dev/null 2>&1; then
3902 ./try
3903 yyy=$?
3904else
a0d0e21e 3905 echo "(I can't seem to compile the test program--assuming it can't)"
2304df62
AD
3906 yyy=1
3907fi
3908case "$yyy" in
39090) val="$define"
3910 echo "Yup, it can."
3911 ;;
3912*) val="$undef"
3913 echo "Nope, it can't."
3914 ;;
3915esac
3916set d_casti32
3917eval $setvar
85e6fe83 3918$rm -f try try.*
a0d0e21e 3919
2304df62
AD
3920: check for ability to cast negative floats to unsigned
3921echo " "
3922echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
ecfc5424
AD
3923$cat >try.c <<EOCP
3924#include <sys/types.h>
2304df62 3925#include <signal.h>
232e078e
AD
3926$signal_t blech() { exit(7); }
3927$signal_t blech_in_list() { exit(4); }
3928unsigned long dummy_long(p) unsigned long p; { return p; }
3929unsigned int dummy_int(p) unsigned int p; { return p; }
3930unsigned short dummy_short(p) unsigned short p; { return p; }
2304df62
AD
3931main()
3932{
232e078e 3933 double f = -123.;
2304df62
AD
3934 unsigned long along;
3935 unsigned int aint;
3936 unsigned short ashort;
3937 int result = 0;
3938
3939 signal(SIGFPE, blech);
3940 along = (unsigned long)f;
3941 aint = (unsigned int)f;
3942 ashort = (unsigned short)f;
3943 if (along != (unsigned long)-123)
3944 result |= 1;
3945 if (aint != (unsigned int)-123)
3946 result |= 1;
3947 if (ashort != (unsigned short)-123)
3948 result |= 1;
3949 f = (double)0x40000000;
3950 f = f + f;
3951 along = 0;
3952 along = (unsigned long)f;
3953 if (along != 0x80000000)
3954 result |= 2;
3955 f -= 1.;
3956 along = 0;
3957 along = (unsigned long)f;
3958 if (along != 0x7fffffff)
3959 result |= 1;
3960 f += 2.;
3961 along = 0;
3962 along = (unsigned long)f;
3963 if (along != 0x80000001)
3964 result |= 2;
232e078e
AD
3965 if (result)
3966 exit(result);
3967 signal(SIGFPE, blech_in_list);
3968 f = 123.;
3969 along = dummy_long((unsigned long)f);
3970 aint = dummy_int((unsigned int)f);
3971 ashort = dummy_short((unsigned short)f);
3972 if (along != (unsigned long)123)
3973 result |= 4;
3974 if (aint != (unsigned int)123)
3975 result |= 4;
3976 if (ashort != (unsigned short)123)
3977 result |= 4;
2304df62
AD
3978 exit(result);
3979
3980}
3981EOCP
3982if $cc -o try $ccflags try.c >/dev/null 2>&1; then
3983 ./try
3984 castflags=$?
3985else
ecfc5424 3986 echo "(I can't seem to compile the test program--assuming it can't)"
232e078e 3987 castflags=7
2304df62
AD
3988fi
3989case "$castflags" in
39900) val="$define"
3991 echo "Yup, it can."
3992 ;;
3993*) val="$undef"
3994 echo "Nope, it can't."
3995 ;;
3996esac
3997set d_castneg
3998eval $setvar
3999$rm -f try.*
4000
2304df62
AD
4001: see if vprintf exists
4002echo " "
4003if set vprintf val -f d_vprintf; eval $csym; $val; then
4004 echo 'vprintf() found.' >&4
4005 val="$define"
4006 $cat >vprintf.c <<'EOF'
4007#include <varargs.h>
4008
4009main() { xxx("foo"); }
4010
4011xxx(va_alist)
4012va_dcl
4013{
4014 va_list args;
4015 char buf[10];
4016
4017 va_start(args);
4018 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
4019}
4020EOF
4021 if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then
4022 echo "Your vsprintf() returns (int)." >&4
4023 val2="$undef"
4024 else
4025 echo "Your vsprintf() returns (char*)." >&4
4026 val2="$define"
4027 fi
4028else
4029 echo 'vprintf() NOT found.' >&4
4030 val="$undef"
4031 val2="$undef"
4032fi
4033set d_vprintf
4034eval $setvar
4035val=$val2
4036set d_charvspr
4037eval $setvar
4038
a0d0e21e
LW
4039: see if chown exists
4040set chown d_chown
4041eval $inlibc
4042
4043: see if chroot exists
4044set chroot d_chroot
4045eval $inlibc
4046
2304df62
AD
4047: see if chsize exists
4048set chsize d_chsize
4049eval $inlibc
4050
4051: check for const keyword
4052echo " "
4053echo 'Checking to see if your C compiler knows about "const"...' >&4
4054$cat >const.c <<'EOCP'
4055typedef struct spug { int drokk; } spug;
4056main()
4057{
4058 const char *foo;
4059 const spug y;
4060}
4061EOCP
4062if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
4063 val="$define"
4064 echo "Yup, it does."
4065else
4066 val="$undef"
4067 echo "Nope, it doesn't."
4068fi
4069set d_const
4070eval $setvar
4071
4072: see if crypt exists
4073echo " "
4074if set crypt val -f d_crypt; eval $csym; $val; then
4075 echo 'crypt() found.' >&4
4076 val="$define"
4077 cryptlib=''
4078else
4079 cryptlib=`./loc Slibcrypt.a "" $xlibpth`
4080 if $test -z "$cryptlib"; then
4081 cryptlib=`./loc Mlibcrypt.a "" $xlibpth`
4082 else
4083 cryptlib=-lcrypt
4084 fi
4085 if $test -z "$cryptlib"; then
4086 cryptlib=`./loc Llibcrypt.a "" $xlibpth`
4087 else
4088 cryptlib=-lcrypt
4089 fi
4090 if $test -z "$cryptlib"; then
4091 cryptlib=`./loc libcrypt.a "" $libpth`
4092 else
4093 cryptlib=-lcrypt
4094 fi
4095 if $test -z "$cryptlib"; then
4096 echo 'crypt() NOT found.' >&4
4097 val="$undef"
4098 else
4099 val="$define"
4100 fi
4101fi
4102set d_crypt
4103eval $setvar
4104
4105: get csh whereabouts
4106case "$csh" in
4107'csh') val="$undef" ;;
4108*) val="$define" ;;
4109esac
4110set d_csh
4111eval $setvar
1aef975c 4112full_csh=$csh
2304df62 4113
a0d0e21e
LW
4114: see if cuserid exists
4115set cuserid d_cuserid
2304df62
AD
4116eval $inlibc
4117
85e6fe83
LW
4118: define an alternate in-header-list? function
4119inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4120cont=true; xxf="echo \"<\$1> found.\" >&4";
4121case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4122*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4123esac;
4124case $# in 4) instead=instead;; *) instead="at last";; esac;
4125while $test "$cont"; do
4126 xxx=`./findhdr $1`
4127 var=$2; eval "was=\$$2";
4128 if $test "$xxx" && $test -r "$xxx";
4129 then eval $xxf;
fec02dd3 4130 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
85e6fe83
LW
4131 cont="";
4132 else eval $xxnf;
fec02dd3 4133 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
85e6fe83
LW
4134 set $yyy; shift; shift; yyy=$@;
4135 case $# in 0) cont="";;
4136 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4137 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4138 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4139 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4140 esac;
4141done;
4142while $test "$yyy";
4143do set $yyy; var=$2; eval "was=\$$2";
ecfc5424 4144 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
85e6fe83
LW
4145 set $yyy; shift; shift; yyy=$@;
4146done'
4147
a0d0e21e
LW
4148: see if this is a limits.h system
4149set limits.h i_limits
85e6fe83
LW
4150eval $inhdr
4151
a0d0e21e
LW
4152: see if this is a float.h system
4153set float.h i_float
4154eval $inhdr
4155
4156: See if number of significant digits in a double precision number is known
4157echo " "
4158$cat >dbl_dig.c <<EOM
4159#$i_limits I_LIMITS
4160#$i_float I_FLOAT
4161#ifdef I_LIMITS
4162#include <limits.h>
85e6fe83 4163#endif
a0d0e21e
LW
4164#ifdef I_FLOAT
4165#include <float.h>
4166#endif
4167#ifdef DBL_DIG
4168printf("Contains DBL_DIG");
85e6fe83 4169#endif
85e6fe83 4170EOM
a0d0e21e
LW
4171$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
4172if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
4173 echo "DBL_DIG found." >&4
4174 val="$define"
2304df62 4175else
a0d0e21e
LW
4176 echo "DBL_DIG NOT found." >&4
4177 val="$undef"
2304df62 4178fi
a0d0e21e
LW
4179$rm -f dbl_dig.?
4180set d_dbl_dig
2304df62 4181eval $setvar
2304df62 4182
a0d0e21e
LW
4183: see if difftime exists
4184set difftime d_difftime
2304df62
AD
4185eval $inlibc
4186
a0d0e21e
LW
4187: see if this is a dirent system
4188echo " "
4189if xinc=`./findhdr dirent.h`; $test "$xinc"; then
4190 val="$define"
4191 echo "<dirent.h> found." >&4
4192else
4193 val="$undef"
4194 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
4195 echo "<sys/dir.h> found." >&4