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