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