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