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