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