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