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