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