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