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