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