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