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