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