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