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