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