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