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