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