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