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