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