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