This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Support crypt_r(const char*,const char*, CRYPTD*).
[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#
b430fd04 23# Generated on Tue Mar 19 18:17:12 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
e723fc21 2390 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2573c5f9
JH
2391 esac
2392 fi
2393 fi
6b769f8f
RB
2394 fi
2395 $rm -f try try.*
2396 ;;
2397esac
2398EOSC
2399
2400cat <<EOS >checkcc
2401$startsh
2402EOS
2403cat <<'EOSC' >>checkcc
2404case "$cc" in
2405'') ;;
2406*) $rm -f try try.*
2407 $cat >try.c <<EOM
2408int main(int argc, char *argv[]) {
2409 return 0;
2410}
2411EOM
2412 if $cc -o try $ccflags $ldflags try.c; then
2413 :
2414 else
2573c5f9 2415 if $test X"$despair" = Xyes; then
6b769f8f
RB
2416 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2417 fi
2418 $cat >&4 <<EOM
5dd4fbdf
MB
2419You need to find a working C compiler.
2420Either (purchase and) install the C compiler supplied by your OS vendor,
2421or for a free C compiler try http://gcc.gnu.org/
2422I cannot continue any further, aborting.
2423EOM
6b769f8f 2424 exit 1
2573c5f9
JH
2425 fi
2426 $rm -f try try.*
2427 ;;
2428esac
2429EOSC
2430
a0d0e21e
LW
2431: determine whether symbolic links are supported
2432echo " "
2433$touch blurfl
2434if $ln -s blurfl sym > /dev/null 2>&1 ; then
2435 echo "Symbolic links are supported." >&4
818f00be 2436 lns="$ln -s"
a0d0e21e
LW
2437else
2438 echo "Symbolic links are NOT supported." >&4
2439 lns="$ln"
2440fi
2441$rm -f blurfl sym
2442
dafca956
JH
2443: determine whether symbolic links are supported
2444echo " "
2445case "$lns" in
18ea2752 2446*"ln"*" -s")
dafca956
JH
2447 echo "Checking how to test for symbolic links..." >&4
2448 $lns blurfl sym
4b661809 2449 if $test "X$issymlink" = X; then
2e2a97a6
JH
2450 case "$newsh" in
2451 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2452 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2453 esac
5d644a95
MB
2454 if test $? = 0; then
2455 issymlink="test -h"
2e2a97a6
JH
2456 else
2457 echo "Your builtin 'test -h' may be broken." >&4
2458 case "$test" in
2459 /*) ;;
2460 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2461 for p in $pth
2462 do
2463 if test -f "$p/$test"; then
2464 test="$p/$test"
2465 break
2466 fi
2467 done
2468 ;;
2469 esac
2470 case "$test" in
2471 /*)
2472 echo "Trying external '$test -h'." >&4
2473 issymlink="$test -h"
2474 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2475 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2476 issymlink=''
2477 fi
2478 ;;
2479 *) issymlink='' ;;
2480 esac
5d644a95
MB
2481 fi
2482 fi
4b661809 2483 if $test "X$issymlink" = X; then
dafca956 2484 if $test -L sym 2>/dev/null; then
5d644a95 2485 issymlink="$test -L"
2e2a97a6 2486 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2487 fi
2488 fi
4b661809 2489 if $test "X$issymlink" != X; then
5d644a95 2490 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2491 else
2492 echo "I do not know how you can test for symbolic links." >&4
2493 fi
2494 $rm -f blurfl sym
2495 ;;
2496*) echo "No symbolic links, so not testing for their testing..." >&4
2497 ;;
2498esac
2499echo " "
2500
2501
2502case "$mksymlinks" in
2503$define|true|[yY]*)
2504 case "$src" in
2505 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2506 exit 1
2507 ;;
4b661809 2508 *) case "$lns:$issymlink" in
f314eb9f 2509 *"ln"*" -s:"*"test -"?)
dafca956
JH
2510 echo "Creating the symbolic links..." >&4
2511 echo "(First creating the subdirectories...)" >&4
2512 cd ..
2513 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2514 read directory
2515 test -z "$directory" && break
2516 mkdir -p $directory
2517 done
2518 # Sanity check 1.
2519 if test ! -d t/base; then
2520 echo "Failed to create the subdirectories. Aborting." >&4
2521 exit 1
2522 fi
2523 echo "(Then creating the symlinks...)" >&4
2524 awk '{print $1}' $src/MANIFEST | while true; do
2525 read filename
2526 test -z "$filename" && break
2527 if test -f $filename; then
5d644a95 2528 if $issymlink $filename; then
dafca956
JH
2529 rm -f $filename
2530 fi
2531 fi
2532 if test -f $filename; then
2533 echo "$filename already exists, not symlinking."
2534 else
2535 ln -s $src/$filename $filename
2536 fi
2537 done
2538 # Sanity check 2.
a0d24b8a
JH
2539 if test ! -f t/base/lex.t; then
2540 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2541 exit 1
2542 fi
2543 cd UU
2544 ;;
2545 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2546 ;;
2547 esac
2548 ;;
2549 esac
2550 ;;
2551esac
2552
5440bc8e
JH
2553
2554case "$usecrosscompile" in
2555$define|true|[yY]*)
93bc48fa 2556 $echo "Cross-compiling..."
5440bc8e
JH
2557 croak=''
2558 case "$cc" in
2559 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2560 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2561 ar=$targetarch-ar
2562 # leave out ld, choosing it is more complex
2563 nm=$targetarch-nm
2564 ranlib=$targetarch-ranlib
93bc48fa 2565 $echo 'extern int foo;' > try.c
f8006fac 2566 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2567 shift
2568 if $test $# -gt 0; then
2569 incpth="$incpth $*"
f8006fac
JH
2570 incpth="`$echo $incpth|$sed 's/^ //'`"
2571 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2572 for i in $*; do
f8006fac 2573 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2574 if $test -d $j; then
2575 libpth="$libpth $j"
2576 fi
2577 done
f8006fac
JH
2578 libpth="`$echo $libpth|$sed 's/^ //'`"
2579 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2580 fi
2581 $rm -f try.c
5440bc8e
JH
2582 ;;
2583 esac
2584 case "$targetarch" in
93bc48fa
JH
2585 '') echo "Targetarch not defined." >&4; croak=y ;;
2586 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2587 esac
2588 case "$incpth" in
93bc48fa 2589 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2590 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2591 esac
2592 case "$libpth" in
93bc48fa 2593 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2594 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2595 esac
93bc48fa
JH
2596 case "$usrinc" in
2597 '') for i in $incpth; do
2598 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2599 usrinc=$i
2600 echo "Guessing usrinc $usrinc." >&4
2601 break
2602 fi
2603 done
2604 case "$usrinc" in
2605 '') echo "Usrinc not defined." >&4; croak=y ;;
2606 esac
2607 ;;
2608 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2609 esac
93bc48fa
JH
2610 case "$targethost" in
2611 '') echo "Targethost not defined." >&4; croak=y ;;
2612 *) echo "Using targethost $targethost." >&4
5440bc8e 2613 esac
93bc48fa
JH
2614 locincpth=' '
2615 loclibpth=' '
5440bc8e 2616 case "$croak" in
93bc48fa 2617 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2618 esac
2619 case "$src" in
2620 /*) run=$src/Cross/run
93c0359c 2621 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2622 to=$src/Cross/to
2623 from=$src/Cross/from
2624 ;;
93bc48fa 2625 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2626 run=$pwd/Cross/run
f8006fac 2627 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2628 to=$pwd/Cross/to
2629 from=$pwd/Cross/from
2630 ;;
2631 esac
2632 case "$targetrun" in
2633 '') targetrun=ssh ;;
2634 esac
2635 case "$targetto" in
2636 '') targetto=scp ;;
2637 esac
2638 case "$targetfrom" in
2639 '') targetfrom=scp ;;
2640 esac
2641 run=$run-$targetrun
2642 to=$to-$targetto
2643 from=$from-$targetfrom
93bc48fa
JH
2644 case "$targetdir" in
2645 '') targetdir=/tmp
2646 echo "Guessing targetdir $targetdir." >&4
2647 ;;
2648 esac
5440bc8e 2649 case "$targetuser" in
93bc48fa
JH
2650 '') targetuser=root
2651 echo "Guessing targetuser $targetuser." >&4
2652 ;;
5440bc8e
JH
2653 esac
2654 case "$targetfrom" in
2655 scp) q=-q ;;
2656 *) q='' ;;
2657 esac
2658 case "$targetrun" in
2659 ssh|rsh)
2660 cat >$run <<EOF
2661#!/bin/sh
93c0359c
JH
2662case "\$1" in
2663-cwd)
2664 shift
2665 cwd=\$1
2666 shift
2667 ;;
2668esac
2669case "\$cwd" in
2670'') cwd=$targetdir ;;
2671esac
5440bc8e
JH
2672exe=\$1
2673shift
93c0359c
JH
2674if $test ! -f \$exe.xok; then
2675 $to \$exe
2676 $touch \$exe.xok
2677fi
2678$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2679EOF
2680 ;;
93bc48fa 2681 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2682 exit 1
2683 ;;
2684 esac
93c0359c
JH
2685 case "$targetmkdir" in
2686 */Cross/mkdir)
2687 cat >$targetmkdir <<EOF
2688#!/bin/sh
2689$targetrun -l $targetuser $targethost "mkdir -p \$@"
2690EOF
f8006fac 2691 $chmod a+rx $targetmkdir
93c0359c
JH
2692 ;;
2693 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2694 exit 1
2695 ;;
2696 esac
5440bc8e
JH
2697 case "$targetto" in
2698 scp|rcp)
2699 cat >$to <<EOF
2700#!/bin/sh
2701for f in \$@
2702do
93c0359c
JH
2703 case "\$f" in
2704 /*)
2705 $targetmkdir \`dirname \$f\`
2706 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2707 ;;
2708 *)
2709 $targetmkdir $targetdir/\`dirname \$f\`
2710 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2711 ;;
2712 esac
5440bc8e
JH
2713done
2714exit 0
2715EOF
2716 ;;
2717 cp) cat >$to <<EOF
2718#!/bin/sh
93c0359c
JH
2719for f in \$@
2720do
2721 case "\$f" in
2722 /*)
2723 $mkdir -p $targetdir/\`dirname \$f\`
2724 $cp \$f $targetdir/\$f || exit 1
2725 ;;
2726 *)
2727 $targetmkdir $targetdir/\`dirname \$f\`
2728 $cp \$f $targetdir/\$f || exit 1
2729 ;;
2730 esac
2731done
2732exit 0
5440bc8e
JH
2733EOF
2734 ;;
93bc48fa 2735 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2736 exit 1
2737 ;;
2738 esac
2739 case "$targetfrom" in
2740 scp|rcp)
2741 cat >$from <<EOF
2742#!/bin/sh
2743for f in \$@
2744do
93c0359c 2745 $rm -f \$f
5440bc8e
JH
2746 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2747done
2748exit 0
2749EOF
2750 ;;
2751 cp) cat >$from <<EOF
2752#!/bin/sh
2753for f in \$@
2754do
93c0359c 2755 $rm -f \$f
5440bc8e
JH
2756 cp $targetdir/\$f . || exit 1
2757done
2758exit 0
2759EOF
2760 ;;
93bc48fa 2761 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2762 exit 1
2763 ;;
2764 esac
93bc48fa
JH
2765 if $test ! -f $run; then
2766 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2767 else
f8006fac 2768 $chmod a+rx $run
5440bc8e 2769 fi
93bc48fa
JH
2770 if $test ! -f $to; then
2771 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2772 else
f8006fac 2773 $chmod a+rx $to
5440bc8e 2774 fi
93bc48fa
JH
2775 if $test ! -f $from; then
2776 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2777 else
f8006fac 2778 $chmod a+rx $from
5440bc8e 2779 fi
93bc48fa 2780 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2781 exit 1
2782 fi
2783 cat >&4 <<EOF
f8006fac
JH
2784Using '$run' for remote execution,
2785and '$from' and '$to'
93bc48fa 2786for remote file transfer.
5440bc8e
JH
2787EOF
2788 ;;
2789*) run=''
2790 to=:
2791 from=:
2792 usecrosscompile='undef'
2793 targetarch=''
2794 ;;
2795esac
2796
ecfc5424
AD
2797: see whether [:lower:] and [:upper:] are supported character classes
2798echo " "
ecfc5424
AD
2799case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2800ABYZ)
2801 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2802 up='[:upper:]'
2803 low='[:lower:]'
2804 ;;
28e8609d
JH
2805*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2806 # (0xc9 and 0xd1), therefore that is a nice testing point.
2807 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2808 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2809 ij) up='[A-Z]'
2810 low='[a-z]'
2811 ;;
2812 esac
2813 fi
2814 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2815 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2816 ij) up='A-Z'
2817 low='a-z'
2818 ;;
2819 esac
2820 fi
2821 if test "X$up" = X -o "X$low" = X; then
2822 case "`echo IJ | od -x 2>/dev/null`" in
2823 *C9D1*|*c9d1*)
2824 echo "Hey, this might be EBCDIC." >&4
2825 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2826 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2827 ij) up='[A-IJ-RS-Z]'
2828 low='[a-ij-rs-z]'
2829 ;;
2830 esac
2831 fi
2832 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2833 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2834 ij) up='A-IJ-RS-Z'
2835 low='a-ij-rs-z'
2836 ;;
2837 esac
2838 fi
2839 ;;
2840 esac
2841 fi
2842esac
3eaeeeae 2843case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2844ij)
2845 echo "Using $up and $low to convert case." >&4
2846 ;;
ecfc5424 2847*)
28e8609d
JH
2848 echo "I don't know how to translate letters from upper to lower case." >&4
2849 echo "Your tr is not acting any way I know of." >&4
2850 exit 1
2851 ;;
ecfc5424
AD
2852esac
2853: set up the translation script tr, must be called with ./tr of course
2854cat >tr <<EOSC
2855$startsh
2856case "\$1\$2" in
2857'[A-Z][a-z]') exec $tr '$up' '$low';;
2858'[a-z][A-Z]') exec $tr '$low' '$up';;
2859esac
2860exec $tr "\$@"
2861EOSC
2862chmod +x tr
2863$eunicefix tr
2864
2304df62
AD
2865: Try to determine whether config.sh was made on this system
2866case "$config_sh" in
2867'')
43999f95
JH
2868myuname=`$uname -a 2>/dev/null`
2869$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2870# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2871# because the A-Z/a-z are not consecutive.
a0d0e21e 2872myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2873 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2874newmyuname="$myuname"
2304df62 2875dflt=n
16d20bd9
AD
2876case "$knowitall" in
2877'')
2878 if test -f ../config.sh; then
2879 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2880 eval "`grep myuname= ../config.sh`"
2881 fi
2882 if test "X$myuname" = "X$newmyuname"; then
2883 dflt=y
2884 fi
2304df62 2885 fi
16d20bd9
AD
2886 ;;
2887*) dflt=y;;
2888esac
2304df62
AD
2889
2890: Get old answers from old config file if Configure was run on the
2891: same system, otherwise use the hints.
2892hint=default
2893cd ..
2894if test -f config.sh; then
16d20bd9
AD
2895 echo " "
2896 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2897 . UU/myread
2898 case "$ans" in
f83701cd
AD
2899 n*|N*) echo "OK, I'll ignore it."
2900 mv config.sh config.sh.old
2901 myuname="$newmyuname"
2902 ;;
2304df62 2903 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2904 tmp_n="$n"
2905 tmp_c="$c"
85cad39c 2906 tmp_sh="$sh"
2304df62
AD
2907 . ./config.sh
2908 cp config.sh UU
ecfc5424
AD
2909 n="$tmp_n"
2910 c="$tmp_c"
85cad39c
PP
2911 : Older versions did not always set $sh. Catch re-use of such
2912 : an old config.sh.
2913 case "$sh" in
2914 '') sh="$tmp_sh" ;;
2915 esac
2304df62
AD
2916 hint=previous
2917 ;;
2918 esac
2919fi
2573c5f9 2920. ./UU/checkcc
2304df62
AD
2921if test ! -f config.sh; then
2922 $cat <<EOM
2923
4e2a5f63
AD
2924First time through, eh? I have some defaults handy for some systems
2925that need some extra help getting the Configure answers right:
2304df62
AD
2926
2927EOM
dfe9444c 2928 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2929 dflt=''
2930 : Half the following guesses are probably wrong... If you have better
7f2de2d2 2931 : tests or hints, please send them to perlbug@perl.org
2304df62 2932 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2933 $test -f /irix && osname=irix
85e6fe83
LW
2934 $test -f /xenix && osname=sco_xenix
2935 $test -f /dynix && osname=dynix
2936 $test -f /dnix && osname=dnix
5f05dabc
PP
2937 $test -f /lynx.os && osname=lynxos
2938 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2939 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2940 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2941 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2942 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2943 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2944 $test -d /usr/apollo/bin && osname=apollo
2945 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2946 $test -d /usr/include/minix && osname=minix
d54344fc 2947 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 2948 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2949 osname=machten
4633a7c4 2950 if $test -x /sbin/version; then
dfe9444c 2951 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2952 $sed -e 's/[A-Za-z]$//'`
2953 elif $test -x /usr/etc/version; then
dfe9444c 2954 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2955 $sed -e 's/[A-Za-z]$//'`
2956 else
2957 osvers="$2.$3"
2958 fi
2959 fi
aaacdc8b
GS
2960
2961 $test -f /sys/posix.dll &&
2962 $test -f /usr/bin/what &&
2963 set X `/usr/bin/what /sys/posix.dll` &&
2964 $test "$3" = UWIN &&
2965 osname=uwin &&
2966 osvers="$5"
2967
2304df62
AD
2968 if $test -f $uname; then
2969 set X $myuname
2970 shift
2971
2304df62 2972 case "$5" in
85e6fe83 2973 fps*) osname=fps ;;
2304df62
AD
2974 mips*)
2975 case "$4" in
85e6fe83
LW
2976 umips) osname=umips ;;
2977 *) osname=mips ;;
2304df62 2978 esac;;
85e6fe83
LW
2979 [23]100) osname=mips ;;
2980 next*) osname=next ;;
ecfc5424 2981 i386*)
c6912327
JH
2982 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2983 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2984 osname='sco'
2985 osvers=$tmp
2986 elif $test -f /etc/kconfig; then
ecfc5424 2987 osname=isc
bd628c73 2988 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2989 osvers=4
2990 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2991 osvers=3
2304df62 2992 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2993 osvers=2
ecfc5424
AD
2994 fi
2995 fi
2000072c 2996 tmp=''
ecfc5424 2997 ;;
c4f23d77
AD
2998 pc*)
2999 if test -n "$DJGPP"; then
3000 osname=dos
3001 osvers=djgpp
3002 fi
3003 ;;
2304df62
AD
3004 esac
3005
3006 case "$1" in
a0d0e21e
LW
3007 aix) osname=aix
3008 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3009 case "$tmp" in
1aef975c 3010 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
3011 '<3240'|'<>3240') osvers=3.2.0 ;;
3012 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3013 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3014 *) osvers=$tmp;;
a0d0e21e
LW
3015 esac
3016 ;;
aaacdc8b
GS
3017 bsd386) osname=bsd386
3018 osvers=`$uname -r`
3019 ;;
3020 cygwin*) osname=cygwin
3021 osvers="$3"
3022 ;;
23f87696
SZ
3023 *dc.osx) osname=dcosx
3024 osvers="$3"
3025 ;;
a0d0e21e
LW
3026 dnix) osname=dnix
3027 osvers="$3"
3028 ;;
3029 domainos) osname=apollo
3030 osvers="$3"
3031 ;;
3032 dgux) osname=dgux
3033 osvers="$3"
3034 ;;
760ac839 3035 dynixptx*) osname=dynixptx
e58e581d 3036 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3037 ;;
a0d0e21e
LW
3038 freebsd) osname=freebsd
3039 osvers="$3" ;;
3040 genix) osname=genix ;;
3041 hp*) osname=hpux
bfb7748a 3042 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3043 ;;
a78b0d02 3044 irix*) osname=irix
a0d0e21e
LW
3045 case "$3" in
3046 4*) osvers=4 ;;
3047 5*) osvers=5 ;;
ecfc5424 3048 *) osvers="$3" ;;
a0d0e21e
LW
3049 esac
3050 ;;
3051 linux) osname=linux
3052 case "$3" in
a0d0e21e
LW
3053 *) osvers="$3" ;;
3054 esac
3055 ;;
28e8609d
JH
3056 MiNT) osname=mint
3057 ;;
3058 netbsd*) osname=netbsd
ecfc5424
AD
3059 osvers="$3"
3060 ;;
4e81affe
MMIJG
3061 news-os) osvers="$3"
3062 case "$3" in
3063 4*) osname=newsos4 ;;
3064 *) osname=newsos ;;
3065 esac
3066 ;;
aaacdc8b 3067 next*) osname=next ;;
28bb1e2c 3068 nonstop-ux) osname=nonstopux ;;
aaacdc8b
GS
3069 POSIX-BC | posix-bc ) osname=posix-bc
3070 osvers="$3"
a0d0e21e 3071 ;;
ae3afa4e
TH
3072 powerux | power_ux | powermax_os | powermaxos | \
3073 powerunix | power_unix) osname=powerux
3074 osvers="$3"
3075 ;;
aaacdc8b
GS
3076 qnx) osname=qnx
3077 osvers="$4"
3078 ;;
a0d0e21e
LW
3079 solaris) osname=solaris
3080 case "$3" in
3081 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3082 *) osvers="$3" ;;
a0d0e21e
LW
3083 esac
3084 ;;
85e6fe83
LW
3085 sunos) osname=sunos
3086 case "$3" in
85e6fe83
LW
3087 5*) osname=solaris
3088 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3089 *) osvers="$3" ;;
2304df62
AD
3090 esac
3091 ;;
a0d0e21e 3092 titanos) osname=titanos
85e6fe83 3093 case "$3" in
a0d0e21e
LW
3094 1*) osvers=1 ;;
3095 2*) osvers=2 ;;
3096 3*) osvers=3 ;;
3097 4*) osvers=4 ;;
ecfc5424 3098 *) osvers="$3" ;;
2304df62
AD
3099 esac
3100 ;;
85e6fe83 3101 ultrix) osname=ultrix
ecfc5424 3102 osvers="$3"
2304df62 3103 ;;
28757baa 3104 osf1|mls+) case "$5" in
fed7345c
AD
3105 alpha)
3106 osname=dec_osf
2aa76180
JH
3107 osvers=`sizer -v | awk '{print $3}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3108 case "$osvers" in
3109 [1-9].[0-9]*) ;;
3110 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3111 esac
ecfc5424
AD
3112 ;;
3113 hp*) osname=hp_osf1 ;;
3114 mips) osname=mips_osf1 ;;
85e6fe83
LW
3115 esac
3116 ;;
0337d152
A
3117 unixware) osname=svr5
3118 osvers="$4"
3119 ;;
3c728e00 3120 uts) osname=uts
a0d0e21e
LW
3121 osvers="$3"
3122 ;;
3c728e00
JH
3123 vos) osvers="$3"
3124 ;;
85e6fe83 3125 $2) case "$osname" in
2304df62 3126 *isc*) ;;
a0d0e21e 3127 *freebsd*) ;;
5f05dabc 3128 svr*)
a0d0e21e
LW
3129 : svr4.x or possibly later
3130 case "svr$3" in
3131 ${osname}*)
3132 osname=svr$3
3133 osvers=$4
3134 ;;
3135 esac
3136 case "$osname" in
3137 svr4.0)
3138 : Check for ESIX
3139 if test -f /stand/boot ; then
3140 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3141 if test -n "$INITPROG" -a -f "$INITPROG"; then
3142 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3143 if test -n "$isesix"; then
a0d0e21e
LW
3144 osname=esix4
3145 fi
3146 fi
3147 fi
3148 ;;
3149 esac
3150 ;;
2304df62 3151 *) if test -f /etc/systemid; then
a0d0e21e
LW
3152 osname=sco
3153 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3154 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3155 osvers=$1.$2.$3
c4f23d77 3156 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3157 osvers=$1.$2
c4f23d77 3158 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3159 osvers=$1
2304df62 3160 fi
a0d0e21e
LW
3161 else
3162 case "$osname" in
3163 '') : Still unknown. Probably a generic Sys V.
3164 osname="sysv"
3165 osvers="$3"
3166 ;;
3167 esac
2304df62
AD
3168 fi
3169 ;;
3170 esac
3171 ;;
a0d0e21e
LW
3172 *) case "$osname" in
3173 '') : Still unknown. Probably a generic BSD.
3174 osname="$1"
3175 osvers="$3"
3176 ;;
3177 esac
3178 ;;
2304df62
AD
3179 esac
3180 else
dfe9444c
AD
3181 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3182 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3183 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3184 osname=news_os
2304df62 3185 fi
dfe9444c 3186 $rm -f UU/kernel.what
8e07c86e
AD
3187 elif test -d c:/.; then
3188 set X $myuname
3189 osname=os2
3190 osvers="$5"
2304df62
AD
3191 fi
3192 fi
85e6fe83 3193
5440bc8e
JH
3194 case "$targetarch" in
3195 '') ;;
3196 *) hostarch=$osname
3197 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3198 osvers=''
3199 ;;
3200 esac
3201
a0d0e21e
LW
3202 : Now look for a hint file osname_osvers, unless one has been
3203 : specified already.
3204 case "$hintfile" in
3205 ''|' ')
1e127011 3206 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3207 : Also try without trailing minor version numbers.
1e127011
DD
3208 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3209 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3210 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3211 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3212 case "$file" in
3213 '') dflt=none ;;
3214 *) case "$osvers" in
3215 '') dflt=$file
3216 ;;
dfe9444c 3217 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3218 dflt=$file
dfe9444c 3219 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3220 dflt=$xfile
dfe9444c 3221 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3222 dflt=$xxfile
dfe9444c 3223 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3224 dflt=$xxxfile
dfe9444c 3225 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3226 dflt=$xxxxfile
dfe9444c 3227 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3228 dflt="${osname}"
3229 else
3230 dflt=none
3231 fi
3232 ;;
3233 esac
85e6fe83
LW
3234 ;;
3235 esac
4e2a5f63
AD
3236 if $test -f Policy.sh ; then
3237 case "$dflt" in
3238 *Policy*) ;;
3239 none) dflt="Policy" ;;
3240 *) dflt="Policy $dflt" ;;
3241 esac
3242 fi
85e6fe83 3243 ;;
a0d0e21e 3244 *)
ecfc5424 3245 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3246 ;;
2304df62 3247 esac
1aef975c 3248
4e2a5f63
AD
3249 if $test -f Policy.sh ; then
3250 $cat <<EOM
3251
3252There's also a Policy hint file available, which should make the
3253site-specific (policy) questions easier to answer.
3254EOM
3255
3256 fi
3257
2304df62
AD
3258 $cat <<EOM
3259
3260You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 3261A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 3262is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
3263
3264EOM
4e2a5f63 3265
2304df62 3266 rp="Which of these apply, if any?"
dfe9444c 3267 . UU/myread
85e6fe83
LW
3268 tans=$ans
3269 for file in $tans; do
4e2a5f63
AD
3270 if $test X$file = XPolicy -a -f Policy.sh; then
3271 . Policy.sh
3272 $cat Policy.sh >> UU/config.sh
3273 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3274 . $src/hints/$file.sh
3275 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3276 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3277 : nothing
3278 else
85e6fe83
LW
3279 : Give one chance to correct a possible typo.
3280 echo "$file.sh does not exist"
3281 dflt=$file
3282 rp="hint to use instead?"
dfe9444c 3283 . UU/myread
85e6fe83 3284 for file in $ans; do
dfe9444c
AD
3285 if $test -f "$src/hints/$file.sh"; then
3286 . $src/hints/$file.sh
3287 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3288 elif $test X$ans = X -o X$ans = Xnone ; then
3289 : nothing
3290 else
3291 echo "$file.sh does not exist -- ignored."
3292 fi
3293 done
2304df62
AD
3294 fi
3295 done
85e6fe83 3296
2304df62 3297 hint=recommended
85e6fe83 3298 : Remember our hint file for later.
dfe9444c 3299 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3300 hintfile="$file"
85e6fe83 3301 else
a0d0e21e 3302 hintfile=''
85e6fe83 3303 fi
2304df62
AD
3304fi
3305cd UU
3306;;
3307*)
3308 echo " "
3309 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3310 tmp_n="$n"
3311 tmp_c="$c"
2304df62
AD
3312 cd ..
3313 cp $config_sh config.sh 2>/dev/null
a78b0d02 3314 chmod +w config.sh
2304df62
AD
3315 . ./config.sh
3316 cd UU
3317 cp ../config.sh .
ecfc5424
AD
3318 n="$tmp_n"
3319 c="$tmp_c"
2304df62
AD
3320 hint=previous
3321 ;;
3322esac
1aef975c 3323test "$override" && . ./optdef.sh
2304df62
AD
3324
3325: Restore computed paths
3326for file in $loclist $trylist; do
3327 eval $file="\$_$file"
3328done
3329
85e6fe83 3330cat << EOM
a0d0e21e 3331
85e6fe83 3332Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3333The default value is probably right if the name rings a bell. Otherwise,
3334since spelling matters for me, either accept the default or answer "none"
3335to leave it blank.
a0d0e21e 3336
85e6fe83 3337EOM
85e6fe83 3338case "$osname" in
a0d0e21e 3339 ''|' ')
85e6fe83 3340 case "$hintfile" in
a0d0e21e 3341 ''|' '|none) dflt=none ;;
ecfc5424 3342 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3343 esac
3344 ;;
3345 *) dflt="$osname" ;;
3346esac
3347rp="Operating system name?"
3348. ./myread
3349case "$ans" in
ecfc5424
AD
3350none) osname='' ;;
3351*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3352esac
8ff267be
PP
3353echo " "
3354case "$osvers" in
3355 ''|' ')
3356 case "$hintfile" in
3357 ''|' '|none) dflt=none ;;
3358 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3359 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3360 case "$dflt" in
3361 ''|' ') dflt=none ;;
3362 esac
3363 ;;
3364 esac
3365 ;;
3366 *) dflt="$osvers" ;;
3367esac
3368rp="Operating system version?"
3369. ./myread
3370case "$ans" in
3371none) osvers='' ;;
3372*) osvers="$ans" ;;
3373esac
3374
02e93a22
JH
3375
3376. ./posthint.sh
3377
2304df62 3378: who configured the system
59b83a6f 3379cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 3380cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
3381case "$cf_by" in
3382"")
8ff267be 3383 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
3384 case "$cf_by" in
3385 "") cf_by=unknown ;;
8ff267be
PP
3386 esac ;;
3387esac
2304df62 3388
b4eb6b3d
JH
3389: set up the script used to warn in case of inconsistency
3390cat <<EOS >whoa
3391$startsh
3392EOS
3393cat <<'EOSC' >>whoa
3394dflt=y
3395echo " "
3396echo "*** WHOA THERE!!! ***" >&4
3397echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3398rp=" Keep the $hint value?"
3399. ./myread
3400case "$ans" in
3401y) td=$was; tu=$was;;
3402esac
3403EOSC
3404
3405: function used to set $1 to $val
3406setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3407case "$val$was" in
3408$define$undef) . ./whoa; eval "$var=\$td";;
3409$undef$define) . ./whoa; eval "$var=\$tu";;
3410*) eval "$var=$val";;
3411esac'
3412
3413case "$usethreads" in
3414$define|true|[yY]*) dflt='y';;
3415*) dflt='n';;
3416esac
3417cat <<EOM
3418
3419Perl can be built to take advantage of threads on some systems.
3420To do so, Configure can be run with -Dusethreads.
3421
3422Note that threading is a highly experimental feature, and
3423some known race conditions still remain. If you choose to try
3424it, be very sure to not actually deploy it for production
3425purposes. README.threads has more details, and is required
3426reading if you enable threads.
3427
3428If this doesn't make any sense to you, just accept the default '$dflt'.
3429EOM
3430rp='Build a threading Perl?'
3431. ./myread
3432case "$ans" in
3433y|Y) val="$define" ;;
3434*) val="$undef" ;;
3435esac
3436set usethreads
3437eval $setvar
3438
3439case "$usethreads" in
3440$define)
3441 $cat <<EOM
3442
3443As of 5.5.640, Perl has two different internal threading implementations,
3444the 5.005 version (5005threads) and an interpreter-based version
3445(ithreads) that has one interpreter per thread. Both are very
3446experimental. This arrangement exists to help developers work out
3447which one is better.
3448
3449If you're a casual user, you probably don't want interpreter-threads
1a060de3
JH
3450at this time. But if you do, the 'threads' module allows their use,
3451and the 'Thread' module offers an interface to both 5005threads and
3452ithreads (whichever has been configured).
b4eb6b3d
JH
3453EOM
3454 : Default to ithreads unless overridden on command line or with
3455 : old config.sh
3456 dflt='y'
3457 case "$use5005threads" in
3458 $define|true|[yY]*) dflt='n';;
3459 esac
3460 case "$useithreads" in
3461 $undef|false|[nN]*) dflt='n';;
3462 esac
3463 rp='Use interpreter-based ithreads?'
3464 . ./myread
3465 case "$ans" in
3466 y|Y) val="$define" ;;
3467 *) val="$undef" ;;
3468 esac
3469 set useithreads
3470 eval $setvar
3471 : Now set use5005threads to the opposite value.
3472 case "$useithreads" in
3473 $define) val="$undef" ;;
3474 *) val="$define" ;;
3475 esac
3476 set use5005threads
3477 eval $setvar
3478 ;;
3479*)
3480 useithreads="$undef"
3481 use5005threads="$undef"
3482 ;;
3483esac
3484
c915ce7f
JH
3485case "$useithreads$use5005threads" in
3486"$define$define")
3487 $cat >&4 <<EOM
3488
3489You cannot have both the ithreads and the 5.005 threads enabled
3490at the same time. Disabling the 5.005 threads since they are
3491much less stable than the ithreads.
3492
3493EOM
3494 use5005threads="$undef"
3495 ;;
3496esac
3497
b4eb6b3d
JH
3498case "$d_oldpthreads" in
3499'') : Configure tests would be welcome here. For now, assume undef.
3500 val="$undef" ;;
3501*) val="$d_oldpthreads" ;;
3502esac
3503set d_oldpthreads
3504eval $setvar
3505
3506
3507case "$usethreads" in
3508"$define"|true|[yY]*)
3509: Look for a hint-file generated 'call-back-unit'. If the
3510: user has specified that a threading perl is to be built,
3511: we may need to set or change some other defaults.
3512 if $test -f usethreads.cbu; then
3513 echo "Your platform has some specific hints for threaded builds, using them..."
3514 . ./usethreads.cbu
3515 else
3516 $cat <<EOM
3517(Your platform doesn't have any specific hints for threaded builds.
3518 Assuming POSIX threads, then.)
3519EOM
3520 fi
3521 ;;
3522esac
3523
3524cat <<EOM
3525
3526Perl can be built so that multiple Perl interpreters can coexist
3527within the same Perl executable.
3528EOM
3529
3530case "$useithreads" in
3531$define)
3532 cat <<EOM
3533This multiple interpreter support is required for interpreter-based threads.
3534EOM
3535 val="$define"
3536 ;;
3537*) case "$usemultiplicity" in
3538 $define|true|[yY]*) dflt='y';;
3539 *) dflt='n';;
3540 esac
3541 echo " "
3542 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3543 rp='Build Perl for multiplicity?'
3544 . ./myread
3545 case "$ans" in
3546 y|Y) val="$define" ;;
3547 *) val="$undef" ;;
3548 esac
3549 ;;
3550esac
3551set usemultiplicity
3552eval $setvar
3553
96056487
JH
3554
3555case "$usemorebits" in
3556"$define"|true|[yY]*)
3557 use64bitint="$define"
3558 uselongdouble="$define"
3559 usemorebits="$define"
3560 ;;
3561*) usemorebits="$undef"
3562 ;;
3563esac
3564
e5e20432
JH
3565: make some quick guesses about what we are up against
3566echo " "
3567$echo $n "Hmm... $c"
3568echo exit 1 >bsd
3569echo exit 1 >usg
3570echo exit 1 >v7
3571echo exit 1 >osf1
3572echo exit 1 >eunice
3573echo exit 1 >xenix
3574echo exit 1 >venix
3575echo exit 1 >os2
3576d_bsd="$undef"
3577$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3578if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3579then
3580 echo "Looks kind of like an OSF/1 system, but we'll see..."
3581 echo exit 0 >osf1
381aa1ff 3582elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3583 xxx=`./loc addbib blurfl $pth`
3584 if $test -f $xxx; then
3585 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3586 echo exit 0 >bsd
3587 echo exit 0 >usg
3588 else
3589 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3590 echo "Looks kind of like an extended USG system, but we'll see..."
3591 else
3592 echo "Looks kind of like a USG system, but we'll see..."
3593 fi
3594 echo exit 0 >usg
3595 fi
3596elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3597 echo "Looks kind of like a BSD system, but we'll see..."
3598 d_bsd="$define"
3599 echo exit 0 >bsd
3600else
3601 echo "Looks kind of like a Version 7 system, but we'll see..."
3602 echo exit 0 >v7
3603fi
3604case "$eunicefix" in
3605*unixtovms*)
3606 $cat <<'EOI'
3607There is, however, a strange, musty smell in the air that reminds me of
3608something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3609EOI
3610 echo exit 0 >eunice
3611 d_eunice="$define"
3612: it so happens the Eunice I know will not run shell scripts in Unix format
3613 ;;
3614*)
3615 echo " "
3616 echo "Congratulations. You aren't running Eunice."
3617 d_eunice="$undef"
3618 ;;
3619esac
3620: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3621: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3622: semicolon as a patch separator
e5e20432
JH
3623case "$p_" in
3624:) ;;
3625*)
3626 $cat <<'EOI'
3627I have the feeling something is not exactly right, however...don't tell me...
3628lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3629(Or you may be running DOS with DJGPP.)
e5e20432
JH
3630EOI
3631 echo exit 0 >os2
3632 ;;
3633esac
3634if test -f /xenix; then
3635 echo "Actually, this looks more like a XENIX system..."
3636 echo exit 0 >xenix
3637 d_xenix="$define"
3638else
3639 echo " "
3640 echo "It's not Xenix..."
3641 d_xenix="$undef"
3642fi
3643chmod +x xenix
3644$eunicefix xenix
3645if test -f /venix; then
3646 echo "Actually, this looks more like a VENIX system..."
3647 echo exit 0 >venix
3648else
3649 echo " "
3650 if ./xenix; then
3651 : null
3652 else
3653 echo "Nor is it Venix..."
3654 fi
3655fi
3656chmod +x bsd usg v7 osf1 eunice xenix venix os2
3657$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3658$rm -f foo
3659
5869b1f1
JH
3660case "$cc" in
3661'') dflt=cc;;
3662*) dflt="$cc";;
3663esac
3664rp="Use which C compiler?"
3665. ./myread
3666cc="$ans"
6b769f8f
RB
3667
3668: See if they have not cc but they do have gcc
3669. ./trygcc
e5e20432
JH
3670: Look for a hint-file generated 'call-back-unit'. Now that the
3671: user has specified the compiler, we may need to set or change some
3672: other defaults.
3673if $test -f cc.cbu; then
3674 . ./cc.cbu
3675fi
2573c5f9 3676. ./checkcc
8a27cf78 3677
e5e20432
JH
3678echo " "
3679echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 3680$cat >try.c <<EOM
e5e20432
JH
3681#include <stdio.h>
3682int main() {
3683#ifdef __GNUC__
3684#ifdef __VERSION__
3685 printf("%s\n", __VERSION__);
3686#else
3687 printf("%s\n", "1");
3688#endif
3689#endif
3690 exit(0);
3691}
3692EOM
5440bc8e
JH
3693if $cc -o try $ccflags $ldflags try.c; then
3694 gccversion=`$run ./try`
e5e20432
JH
3695 case "$gccversion" in
3696 '') echo "You are not using GNU cc." ;;
fc68435e 3697 *) echo "You are using GNU cc $gccversion."
e723fc21 3698 ccname=gcc
fc68435e 3699 ;;
e5e20432
JH
3700 esac
3701else
3702 echo " "
3703 echo "*** WHOA THERE!!! ***" >&4
3704 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3705 case "$knowitall" in
3706 '')
3707 echo " You'd better start hunting for one and let me know about it." >&4
3708 exit 1
3709 ;;
3710 esac
3711fi
5440bc8e 3712$rm -f try try.*
e5e20432
JH
3713case "$gccversion" in
37141*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3715esac
5b463ca7
KS
3716case "$gccversion" in
3717'') gccosandvers='' ;;
10b4ebb5
JH
3718*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3719 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3720 gccshortvers=''
5b463ca7 3721 case "$gccosandvers" in
02903077
JH
3722 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3723 $osname$osvers) ;; # looking good
5b463ca7
KS
3724 $osname*) cat <<EOM >&4
3725
3726*** WHOA THERE!!! ***
3727
3728 Your gcc has not been compiled for the exact release of
3729 your operating system ($gccosandvers versus $osname$osvers).
3730
3731 In general it is a good idea to keep gcc synchronized with
3732 the operating system because otherwise serious problems
3733 may ensue when trying to compile software, like Perl.
3734
3735 I'm trying to be optimistic here, though, and will continue.
3736 If later during the configuration and build icky compilation
02903077
JH
3737 problems appear (headerfile conflicts being the most common
3738 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3739 your operating system release.
3740
3741EOM
3742 ;;
81575342 3743 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3744 esac
3745 ;;
3746esac
e723fc21
JH
3747case "$ccname" in
3748'') ccname="$cc" ;;
3749esac
e5e20432 3750
640374d0 3751
bd9b35c9
JH
3752: decide how portable to be. Allow command line overrides.
3753case "$d_portable" in
3754"$undef") ;;
3755*) d_portable="$define" ;;
104d25b7 3756esac
85ab1d1d 3757
bd9b35c9
JH
3758: set up shell script to do ~ expansion
3759cat >filexp <<EOSS
3760$startsh
3761: expand filename
3762case "\$1" in
3763 ~/*|~)
3764 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3765 ;;
3766 ~*)
3767 if $test -f /bin/csh; then
3768 /bin/csh -f -c "glob \$1"
3769 failed=\$?
3770 echo ""
3771 exit \$failed
e5e20432 3772 else
bd9b35c9
JH
3773 name=\`$expr x\$1 : '..\([^/]*\)'\`
3774 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3775 if $test ! -d "\$dir"; then
3776 me=\`basename \$0\`
3777 echo "\$me: can't locate home directory for: \$name" >&2
3778 exit 1
3779 fi
3780 case "\$1" in
3781 */*)
3782 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3783 ;;
3784 *)
3785 echo \$dir
e5e20432
JH
3786 ;;
3787 esac
3788 fi
b691c02f 3789 ;;
4633a7c4 3790*)
bd9b35c9 3791 echo \$1
2304df62
AD
3792 ;;
3793esac
4633a7c4
LW
3794EOSS
3795chmod +x filexp
3796$eunicefix filexp
2304df62
AD
3797
3798: now set up to get a file name
28757baa
PP
3799cat <<EOS >getfile
3800$startsh
3801EOS
3802cat <<'EOSC' >>getfile
2304df62
AD
3803tilde=''
3804fullpath=''
3805already=''
3806skip=''
3807none_ok=''
3808exp_file=''
a0d0e21e 3809nopath_ok=''
2304df62
AD
3810orig_rp="$rp"
3811orig_dflt="$dflt"
b233458b
JH
3812case "$gfpth" in
3813'') gfpth='.' ;;
3814esac
2304df62
AD
3815
3816case "$fn" in
ecfc5424 3817*\(*)
381aa1ff 3818 expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
3819 fn=`echo $fn | sed 's/(.*)//'`
3820 ;;
3821esac
3822
3823case "$fn" in
a0d0e21e
LW
3824*:*)
3825 loc_file=`expr $fn : '.*:\(.*\)'`
3826 fn=`expr $fn : '\(.*\):.*'`
3827 ;;
3828esac
3829
3830case "$fn" in
2304df62
AD
3831*~*) tilde=true;;
3832esac
3833case "$fn" in
3834*/*) fullpath=true;;
3835esac
3836case "$fn" in
3837*+*) skip=true;;
3838esac
3839case "$fn" in
3840*n*) none_ok=true;;
3841esac
3842case "$fn" in
3843*e*) exp_file=true;;
3844esac
a0d0e21e
LW
3845case "$fn" in
3846*p*) nopath_ok=true;;
3847esac
2304df62
AD
3848
3849case "$fn" in
3850*f*) type='File';;
3851*d*) type='Directory';;
a0d0e21e 3852*l*) type='Locate';;
2304df62
AD
3853esac
3854
3855what="$type"
3856case "$what" in
3857Locate) what='File';;
3858esac
3859
3860case "$exp_file" in
3861'')
3862 case "$d_portable" in
3863 "$define") ;;
3864 *) exp_file=true;;
3865 esac
3866 ;;
3867esac
3868
3869cd ..
3870while test "$type"; do
3871 redo=''
3872 rp="$orig_rp"
3873 dflt="$orig_dflt"
3874 case "$tilde" in
3875 true) rp="$rp (~name ok)";;
3876 esac
3877 . UU/myread
ecfc5424
AD
3878 if test -f UU/getfile.ok && \
3879 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3880 then
3881 value="$ans"
3882 ansexp="$ans"
3883 break
3884 fi
2304df62
AD
3885 case "$ans" in
3886 none)
3887 value=''
3888 ansexp=''
3889 case "$none_ok" in
3890 true) type='';;
3891 esac
3892 ;;
3893 *)
3894 case "$tilde" in
3895 '') value="$ans"
3896 ansexp="$ans";;
3897 *)
3898 value=`UU/filexp $ans`
3899 case $? in
3900 0)
3901 if test "$ans" != "$value"; then
ecfc5424 3902 echo "(That expands to $value on this system.)"
2304df62
AD
3903 fi
3904 ;;
3905 *) value="$ans";;
3906 esac
3907 ansexp="$value"
3908 case "$exp_file" in
3909 '') value="$ans";;
3910 esac
3911 ;;
3912 esac
3913 case "$fullpath" in
3914 true)
3915 case "$ansexp" in
3916 /*) value="$ansexp" ;;
23da6c43 3917 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
3918 *)
3919 redo=true
3920 case "$already" in
3921 true)
3922 echo "I shall only accept a full path name, as in /bin/ls." >&4
3923 echo "Use a ! shell escape if you wish to check pathnames." >&4
3924 ;;
3925 *)
3926 echo "Please give a full path name, starting with slash." >&4
3927 case "$tilde" in
3928 true)
3929 echo "Note that using ~name is ok provided it expands well." >&4
3930 already=true
3931 ;;
3932 esac
3933 esac
3934 ;;
3935 esac
3936 ;;
3937 esac
3938 case "$redo" in
3939 '')
3940 case "$type" in
3941 File)
b233458b
JH
3942 for fp in $gfpth; do
3943 if test "X$fp" = X.; then
3944 pf="$ansexp"
3945 else
3946 pf="$fp/$ansexp"
3947 fi
3948 if test -f "$pf"; then
3949 type=''
3950 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3951 then
3952 echo "($value is not a plain file, but that's ok.)"
3953 type=''
3954 fi
3955 if test X"$type" = X; then
3956 value="$pf"
3957 break
3958 fi
3959 done
2304df62
AD
3960 ;;
3961 Directory)
b233458b
JH
3962 for fp in $gfpth; do
3963 if test "X$fp" = X.; then
f78bfc9c
JH
3964 dir="$ans"
3965 direxp="$ansexp"
b233458b 3966 else
dd858076 3967 dir="$fp/$ansexp"
f78bfc9c 3968 direxp="$fp/$ansexp"
b233458b 3969 fi
f78bfc9c 3970 if test -d "$direxp"; then
b233458b 3971 type=''
f78bfc9c 3972 value="$dir"
b233458b
JH
3973 break
3974 fi
3975 done
2304df62
AD
3976 ;;
3977 Locate)
40000a8c 3978 if test -d "$ansexp"; then
a0d0e21e
LW
3979 echo "(Looking for $loc_file in directory $value.)"
3980 value="$value/$loc_file"