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