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