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