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