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