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