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