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