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