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