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