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