This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate perlio:
[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#
1fef16b3 23# Generated on Fri Dec 21 20:17:57 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 1111: Find the basic shell for Bourne shell scripts
1112case "$sh" in
1113'')
8ff267be 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 1135 elif test -f "$xxx.exe"; then
1136 sh="$xxx";
8ff267be 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 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 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 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 2168 echo "Substituting cp for ln."
2169 ln=$cp
2170 ;;
2171esac
a5a94ea5 2172case "$make$gmake" in
1fef16b3
JH
2173*/gmake|?:[\\/]gmake)
2174 # We can't have osname yet.
2175 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2176 # Assume that gmake, if found, is definitely GNU make
2177 # and prefer it over the system make.
2178 echo "Substituting gmake for make."
2179 make=$gmake
2180 fi
2181 ;;
2182*/make|?:[\\/]make)
a5a94ea5
JH
2183 ;;
2184*)
2185 echo "I can't find make or gmake, and my life depends on it." >&4
2186 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2187 exit 1
2188 ;;
2189esac
2304df62
AD
2190case "$test" in
2191test)
2192 echo "Hopefully test is built into your sh."
2193 ;;
2194*)
73614538 2195 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2196 echo "Using the test built into your sh."
2304df62
AD
2197 test=test
2198 _test=test
2199 fi
2200 ;;
2201esac
2202case "$echo" in
2203echo)
2204 echo "Hopefully echo is built into your sh."
2205 ;;
2206'') ;;
2207*)
2208 echo " "
2209echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2210 $echo $n "hi there$c" >foo1
2211 echo $n "hi there$c" >foo2
2212 if cmp foo1 foo2 >/dev/null 2>&1; then
2213 echo "They are compatible. In fact, they may be identical."
2214 else
2215 case "$n" in
2216 '-n') n='' c='\c';;
2217 *) n='-n' c='';;
2218 esac
2219 cat <<FOO
2220They are not compatible! You are probably running ksh on a non-USG system.
2221I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2222have echo built in and we may have to run some Bourne shell scripts. That
2223means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2224
2225FOO
2226 $echo $n "The star should be here-->$c"
2227 $echo "*"
2228 fi
2229 $rm -f foo1 foo2
2230 ;;
2231esac
2232
2573c5f9
JH
2233cat <<EOS >checkcc
2234$startsh
2235EOS
2236cat <<'EOSC' >>checkcc
2237case "$cc" in
2238'') ;;
2239*) $rm -f try try.*
2240 $cat >try.c <<EOM
2241int main(int argc, char *argv[]) {
2242 return 0;
2243}
2244EOM
e4778687 2245 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2246 :
2247 else
2248 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2249 despair=yes
2250 trygcc=yes
2251 case "$cc" in
2252 *gcc*) trygcc=no ;;
2253 esac
2254 case "`$cc -v -c try.c 2>&1`" in
2255 *gcc*) trygcc=no ;;
2256 esac
2257 if $test X"$trygcc" = Xyes; then
2258 if gcc -o try -c try.c; then
2259 echo " "
2260 echo "You seem to have a working gcc, though." >&4
2261 rp="Would you like to use it?"
2262 dflt=y
2263 if $test -f myread; then
2264 . ./myread
2265 else
2266 if $test -f UU/myread; then
2267 . ./UU/myread
2268 else
2269 echo "Cannot find myread, sorry. Aborting." >&2
2270 exit 1
2271 fi
2272 fi
2273 case "$ans" in
e723fc21 2274 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2573c5f9
JH
2275 esac
2276 fi
2277 fi
2278 if $test X"$despair" = Xyes; then
5dd4fbdf
MB
2279 $cat >&4 <<EOM
2280You need to find a working C compiler.
2281Either (purchase and) install the C compiler supplied by your OS vendor,
2282or for a free C compiler try http://gcc.gnu.org/
2283I cannot continue any further, aborting.
2284EOM
2573c5f9
JH
2285 exit 1
2286 fi
2287 fi
2288 $rm -f try try.*
2289 ;;
2290esac
2291EOSC
2292
a0d0e21e
LW
2293: determine whether symbolic links are supported
2294echo " "
2295$touch blurfl
2296if $ln -s blurfl sym > /dev/null 2>&1 ; then
2297 echo "Symbolic links are supported." >&4
2298 lns="$ln -s"
2299else
2300 echo "Symbolic links are NOT supported." >&4
2301 lns="$ln"
2302fi
2303$rm -f blurfl sym
2304
dafca956
JH
2305: determine whether symbolic links are supported
2306echo " "
2307case "$lns" in
2308*"ln -s")
2309 echo "Checking how to test for symbolic links..." >&4
2310 $lns blurfl sym
4b661809 2311 if $test "X$issymlink" = X; then
2e2a97a6
JH
2312 case "$newsh" in
2313 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2314 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2315 esac
5d644a95
MB
2316 if test $? = 0; then
2317 issymlink="test -h"
2e2a97a6
JH
2318 else
2319 echo "Your builtin 'test -h' may be broken." >&4
2320 case "$test" in
2321 /*) ;;
2322 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2323 for p in $pth
2324 do
2325 if test -f "$p/$test"; then
2326 test="$p/$test"
2327 break
2328 fi
2329 done
2330 ;;
2331 esac
2332 case "$test" in
2333 /*)
2334 echo "Trying external '$test -h'." >&4
2335 issymlink="$test -h"
2336 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2337 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2338 issymlink=''
2339 fi
2340 ;;
2341 *) issymlink='' ;;
2342 esac
5d644a95
MB
2343 fi
2344 fi
4b661809 2345 if $test "X$issymlink" = X; then
dafca956 2346 if $test -L sym 2>/dev/null; then
5d644a95 2347 issymlink="$test -L"
2e2a97a6 2348 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2349 fi
2350 fi
4b661809 2351 if $test "X$issymlink" != X; then
5d644a95 2352 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2353 else
2354 echo "I do not know how you can test for symbolic links." >&4
2355 fi
2356 $rm -f blurfl sym
2357 ;;
2358*) echo "No symbolic links, so not testing for their testing..." >&4
2359 ;;
2360esac
2361echo " "
2362
2363
2364case "$mksymlinks" in
2365$define|true|[yY]*)
2366 case "$src" in
2367 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2368 exit 1
2369 ;;
4b661809 2370 *) case "$lns:$issymlink" in
7a800fca 2371 *"ln -s:"*"test -"?)
dafca956
JH
2372 echo "Creating the symbolic links..." >&4
2373 echo "(First creating the subdirectories...)" >&4
2374 cd ..
2375 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2376 read directory
2377 test -z "$directory" && break
2378 mkdir -p $directory
2379 done
2380 # Sanity check 1.
2381 if test ! -d t/base; then
2382 echo "Failed to create the subdirectories. Aborting." >&4
2383 exit 1
2384 fi
2385 echo "(Then creating the symlinks...)" >&4
2386 awk '{print $1}' $src/MANIFEST | while true; do
2387 read filename
2388 test -z "$filename" && break
2389 if test -f $filename; then
5d644a95 2390 if $issymlink $filename; then
dafca956
JH
2391 rm -f $filename
2392 fi
2393 fi
2394 if test -f $filename; then
2395 echo "$filename already exists, not symlinking."
2396 else
2397 ln -s $src/$filename $filename
2398 fi
2399 done
2400 # Sanity check 2.
a0d24b8a
JH
2401 if test ! -f t/base/lex.t; then
2402 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2403 exit 1
2404 fi
2405 cd UU
2406 ;;
2407 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2408 ;;
2409 esac
2410 ;;
2411 esac
2412 ;;
2413esac
2414
5440bc8e
JH
2415
2416case "$usecrosscompile" in
2417$define|true|[yY]*)
93bc48fa 2418 $echo "Cross-compiling..."
5440bc8e
JH
2419 croak=''
2420 case "$cc" in
2421 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2422 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2423 ar=$targetarch-ar
2424 # leave out ld, choosing it is more complex
2425 nm=$targetarch-nm
2426 ranlib=$targetarch-ranlib
93bc48fa 2427 $echo 'extern int foo;' > try.c
f8006fac 2428 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2429 shift
2430 if $test $# -gt 0; then
2431 incpth="$incpth $*"
f8006fac
JH
2432 incpth="`$echo $incpth|$sed 's/^ //'`"
2433 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2434 for i in $*; do
f8006fac 2435 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2436 if $test -d $j; then
2437 libpth="$libpth $j"
2438 fi
2439 done
f8006fac
JH
2440 libpth="`$echo $libpth|$sed 's/^ //'`"
2441 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2442 fi
2443 $rm -f try.c
5440bc8e
JH
2444 ;;
2445 esac
2446 case "$targetarch" in
93bc48fa
JH
2447 '') echo "Targetarch not defined." >&4; croak=y ;;
2448 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2449 esac
2450 case "$incpth" in
93bc48fa 2451 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2452 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2453 esac
2454 case "$libpth" in
93bc48fa 2455 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2456 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2457 esac
93bc48fa
JH
2458 case "$usrinc" in
2459 '') for i in $incpth; do
2460 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2461 usrinc=$i
2462 echo "Guessing usrinc $usrinc." >&4
2463 break
2464 fi
2465 done
2466 case "$usrinc" in
2467 '') echo "Usrinc not defined." >&4; croak=y ;;
2468 esac
2469 ;;
2470 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2471 esac
93bc48fa
JH
2472 case "$targethost" in
2473 '') echo "Targethost not defined." >&4; croak=y ;;
2474 *) echo "Using targethost $targethost." >&4
5440bc8e 2475 esac
93bc48fa
JH
2476 locincpth=' '
2477 loclibpth=' '
5440bc8e 2478 case "$croak" in
93bc48fa 2479 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2480 esac
2481 case "$src" in
2482 /*) run=$src/Cross/run
93c0359c 2483 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2484 to=$src/Cross/to
2485 from=$src/Cross/from
2486 ;;
93bc48fa 2487 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2488 run=$pwd/Cross/run
f8006fac 2489 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2490 to=$pwd/Cross/to
2491 from=$pwd/Cross/from
2492 ;;
2493 esac
2494 case "$targetrun" in
2495 '') targetrun=ssh ;;
2496 esac
2497 case "$targetto" in
2498 '') targetto=scp ;;
2499 esac
2500 case "$targetfrom" in
2501 '') targetfrom=scp ;;
2502 esac
2503 run=$run-$targetrun
2504 to=$to-$targetto
2505 from=$from-$targetfrom
93bc48fa
JH
2506 case "$targetdir" in
2507 '') targetdir=/tmp
2508 echo "Guessing targetdir $targetdir." >&4
2509 ;;
2510 esac
5440bc8e 2511 case "$targetuser" in
93bc48fa
JH
2512 '') targetuser=root
2513 echo "Guessing targetuser $targetuser." >&4
2514 ;;
5440bc8e
JH
2515 esac
2516 case "$targetfrom" in
2517 scp) q=-q ;;
2518 *) q='' ;;
2519 esac
2520 case "$targetrun" in
2521 ssh|rsh)
2522 cat >$run <<EOF
2523#!/bin/sh
93c0359c
JH
2524case "\$1" in
2525-cwd)
2526 shift
2527 cwd=\$1
2528 shift
2529 ;;
2530esac
2531case "\$cwd" in
2532'') cwd=$targetdir ;;
2533esac
5440bc8e
JH
2534exe=\$1
2535shift
93c0359c
JH
2536if $test ! -f \$exe.xok; then
2537 $to \$exe
2538 $touch \$exe.xok
2539fi
2540$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2541EOF
2542 ;;
93bc48fa 2543 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2544 exit 1
2545 ;;
2546 esac
93c0359c
JH
2547 case "$targetmkdir" in
2548 */Cross/mkdir)
2549 cat >$targetmkdir <<EOF
2550#!/bin/sh
2551$targetrun -l $targetuser $targethost "mkdir -p \$@"
2552EOF
f8006fac 2553 $chmod a+rx $targetmkdir
93c0359c
JH
2554 ;;
2555 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2556 exit 1
2557 ;;
2558 esac
5440bc8e
JH
2559 case "$targetto" in
2560 scp|rcp)
2561 cat >$to <<EOF
2562#!/bin/sh
2563for f in \$@
2564do
93c0359c
JH
2565 case "\$f" in
2566 /*)
2567 $targetmkdir \`dirname \$f\`
2568 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2569 ;;
2570 *)
2571 $targetmkdir $targetdir/\`dirname \$f\`
2572 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2573 ;;
2574 esac
5440bc8e
JH
2575done
2576exit 0
2577EOF
2578 ;;
2579 cp) cat >$to <<EOF
2580#!/bin/sh
93c0359c
JH
2581for f in \$@
2582do
2583 case "\$f" in
2584 /*)
2585 $mkdir -p $targetdir/\`dirname \$f\`
2586 $cp \$f $targetdir/\$f || exit 1
2587 ;;
2588 *)
2589 $targetmkdir $targetdir/\`dirname \$f\`
2590 $cp \$f $targetdir/\$f || exit 1
2591 ;;
2592 esac
2593done
2594exit 0
5440bc8e
JH
2595EOF
2596 ;;
93bc48fa 2597 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2598 exit 1
2599 ;;
2600 esac
2601 case "$targetfrom" in
2602 scp|rcp)
2603 cat >$from <<EOF
2604#!/bin/sh
2605for f in \$@
2606do
93c0359c 2607 $rm -f \$f
5440bc8e
JH
2608 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2609done
2610exit 0
2611EOF
2612 ;;
2613 cp) cat >$from <<EOF
2614#!/bin/sh
2615for f in \$@
2616do
93c0359c 2617 $rm -f \$f
5440bc8e
JH
2618 cp $targetdir/\$f . || exit 1
2619done
2620exit 0
2621EOF
2622 ;;
93bc48fa 2623 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2624 exit 1
2625 ;;
2626 esac
93bc48fa
JH
2627 if $test ! -f $run; then
2628 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2629 else
f8006fac 2630 $chmod a+rx $run
5440bc8e 2631 fi
93bc48fa
JH
2632 if $test ! -f $to; then
2633 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2634 else
f8006fac 2635 $chmod a+rx $to
5440bc8e 2636 fi
93bc48fa
JH
2637 if $test ! -f $from; then
2638 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2639 else
f8006fac 2640 $chmod a+rx $from
5440bc8e 2641 fi
93bc48fa 2642 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2643 exit 1
2644 fi
2645 cat >&4 <<EOF
f8006fac
JH
2646Using '$run' for remote execution,
2647and '$from' and '$to'
93bc48fa 2648for remote file transfer.
5440bc8e
JH
2649EOF
2650 ;;
2651*) run=''
2652 to=:
2653 from=:
2654 usecrosscompile='undef'
2655 targetarch=''
2656 ;;
2657esac
2658
ecfc5424
AD
2659: see whether [:lower:] and [:upper:] are supported character classes
2660echo " "
ecfc5424
AD
2661case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2662ABYZ)
2663 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2664 up='[:upper:]'
2665 low='[:lower:]'
2666 ;;
28e8609d
JH
2667*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2668 # (0xc9 and 0xd1), therefore that is a nice testing point.
2669 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2670 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2671 ij) up='[A-Z]'
2672 low='[a-z]'
2673 ;;
2674 esac
2675 fi
2676 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2677 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2678 ij) up='A-Z'
2679 low='a-z'
2680 ;;
2681 esac
2682 fi
2683 if test "X$up" = X -o "X$low" = X; then
2684 case "`echo IJ | od -x 2>/dev/null`" in
2685 *C9D1*|*c9d1*)
2686 echo "Hey, this might be EBCDIC." >&4
2687 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2688 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2689 ij) up='[A-IJ-RS-Z]'
2690 low='[a-ij-rs-z]'
2691 ;;
2692 esac
2693 fi
2694 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2695 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2696 ij) up='A-IJ-RS-Z'
2697 low='a-ij-rs-z'
2698 ;;
2699 esac
2700 fi
2701 ;;
2702 esac
2703 fi
2704esac
3eaeeeae 2705case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2706ij)
2707 echo "Using $up and $low to convert case." >&4
2708 ;;
ecfc5424 2709*)
28e8609d
JH
2710 echo "I don't know how to translate letters from upper to lower case." >&4
2711 echo "Your tr is not acting any way I know of." >&4
2712 exit 1
2713 ;;
ecfc5424
AD
2714esac
2715: set up the translation script tr, must be called with ./tr of course
2716cat >tr <<EOSC
2717$startsh
2718case "\$1\$2" in
2719'[A-Z][a-z]') exec $tr '$up' '$low';;
2720'[a-z][A-Z]') exec $tr '$low' '$up';;
2721esac
2722exec $tr "\$@"
2723EOSC
2724chmod +x tr
2725$eunicefix tr
2726
2304df62
AD
2727: Try to determine whether config.sh was made on this system
2728case "$config_sh" in
2729'')
43999f95
JH
2730myuname=`$uname -a 2>/dev/null`
2731$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2732# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2733# because the A-Z/a-z are not consecutive.
a0d0e21e 2734myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2735 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2736newmyuname="$myuname"
2304df62 2737dflt=n
16d20bd9
AD
2738case "$knowitall" in
2739'')
2740 if test -f ../config.sh; then
2741 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2742 eval "`grep myuname= ../config.sh`"
2743 fi
2744 if test "X$myuname" = "X$newmyuname"; then
2745 dflt=y
2746 fi
2304df62 2747 fi
16d20bd9
AD
2748 ;;
2749*) dflt=y;;
2750esac
2304df62
AD
2751
2752: Get old answers from old config file if Configure was run on the
2753: same system, otherwise use the hints.
2754hint=default
2755cd ..
2756if test -f config.sh; then
16d20bd9
AD
2757 echo " "
2758 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2759 . UU/myread
2760 case "$ans" in
f83701cd
AD
2761 n*|N*) echo "OK, I'll ignore it."
2762 mv config.sh config.sh.old
2763 myuname="$newmyuname"
2764 ;;
2304df62 2765 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2766 tmp_n="$n"
2767 tmp_c="$c"
85cad39c 2768 tmp_sh="$sh"
2304df62
AD
2769 . ./config.sh
2770 cp config.sh UU
ecfc5424
AD
2771 n="$tmp_n"
2772 c="$tmp_c"
85cad39c 2773 : Older versions did not always set $sh. Catch re-use of such
2774 : an old config.sh.
2775 case "$sh" in
2776 '') sh="$tmp_sh" ;;
2777 esac
2304df62
AD
2778 hint=previous
2779 ;;
2780 esac
2781fi
2573c5f9 2782. ./UU/checkcc
2304df62
AD
2783if test ! -f config.sh; then
2784 $cat <<EOM
2785
4e2a5f63
AD
2786First time through, eh? I have some defaults handy for some systems
2787that need some extra help getting the Configure answers right:
2304df62
AD
2788
2789EOM
dfe9444c 2790 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2791 dflt=''
2792 : Half the following guesses are probably wrong... If you have better
7f2de2d2 2793 : tests or hints, please send them to perlbug@perl.org
2304df62 2794 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2795 $test -f /irix && osname=irix
85e6fe83
LW
2796 $test -f /xenix && osname=sco_xenix
2797 $test -f /dynix && osname=dynix
2798 $test -f /dnix && osname=dnix
5f05dabc 2799 $test -f /lynx.os && osname=lynxos
2800 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2801 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2802 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2803 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2804 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2805 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2806 $test -d /usr/apollo/bin && osname=apollo
2807 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2808 $test -d /usr/include/minix && osname=minix
3c728e00 2809 $test -d /system && osname=vos
e060872b 2810 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2811 osname=machten
4633a7c4 2812 if $test -x /sbin/version; then
dfe9444c 2813 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2814 $sed -e 's/[A-Za-z]$//'`
2815 elif $test -x /usr/etc/version; then
dfe9444c 2816 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2817 $sed -e 's/[A-Za-z]$//'`
2818 else
2819 osvers="$2.$3"
2820 fi
2821 fi
aaacdc8b
GS
2822
2823 $test -f /sys/posix.dll &&
2824 $test -f /usr/bin/what &&
2825 set X `/usr/bin/what /sys/posix.dll` &&
2826 $test "$3" = UWIN &&
2827 osname=uwin &&
2828 osvers="$5"
2829
2304df62
AD
2830 if $test -f $uname; then
2831 set X $myuname
2832 shift
2833
2304df62 2834 case "$5" in
85e6fe83 2835 fps*) osname=fps ;;
2304df62
AD
2836 mips*)
2837 case "$4" in
85e6fe83
LW
2838 umips) osname=umips ;;
2839 *) osname=mips ;;
2304df62 2840 esac;;
85e6fe83
LW
2841 [23]100) osname=mips ;;
2842 next*) osname=next ;;
ecfc5424 2843 i386*)
c6912327
JH
2844 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2845 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2846 osname='sco'
2847 osvers=$tmp
2848 elif $test -f /etc/kconfig; then
ecfc5424 2849 osname=isc
bd628c73 2850 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2851 osvers=4
2852 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2853 osvers=3
2304df62 2854 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2855 osvers=2
ecfc5424
AD
2856 fi
2857 fi
2000072c 2858 tmp=''
ecfc5424 2859 ;;
c4f23d77
AD
2860 pc*)
2861 if test -n "$DJGPP"; then
2862 osname=dos
2863 osvers=djgpp
2864 fi
2865 ;;
2304df62
AD
2866 esac
2867
2868 case "$1" in
a0d0e21e
LW
2869 aix) osname=aix
2870 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2871 case "$tmp" in
1aef975c 2872 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2873 '<3240'|'<>3240') osvers=3.2.0 ;;
2874 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2875 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2876 *) osvers=$tmp;;
a0d0e21e
LW
2877 esac
2878 ;;
aaacdc8b
GS
2879 bsd386) osname=bsd386
2880 osvers=`$uname -r`
2881 ;;
2882 cygwin*) osname=cygwin
2883 osvers="$3"
2884 ;;
23f87696
SZ
2885 *dc.osx) osname=dcosx
2886 osvers="$3"
2887 ;;
a0d0e21e
LW
2888 dnix) osname=dnix
2889 osvers="$3"
2890 ;;
2891 domainos) osname=apollo
2892 osvers="$3"
2893 ;;
2894 dgux) osname=dgux
2895 osvers="$3"
2896 ;;
760ac839 2897 dynixptx*) osname=dynixptx
e58e581d 2898 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2899 ;;
a0d0e21e
LW
2900 freebsd) osname=freebsd
2901 osvers="$3" ;;
2902 genix) osname=genix ;;
2903 hp*) osname=hpux
bfb7748a 2904 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2905 ;;
a78b0d02 2906 irix*) osname=irix
a0d0e21e
LW
2907 case "$3" in
2908 4*) osvers=4 ;;
2909 5*) osvers=5 ;;
ecfc5424 2910 *) osvers="$3" ;;
a0d0e21e
LW
2911 esac
2912 ;;
2913 linux) osname=linux
2914 case "$3" in
a0d0e21e
LW
2915 *) osvers="$3" ;;
2916 esac
2917 ;;
28e8609d
JH
2918 MiNT) osname=mint
2919 ;;
2920 netbsd*) osname=netbsd
ecfc5424
AD
2921 osvers="$3"
2922 ;;
4e81affe
MM
2923 news-os) osvers="$3"
2924 case "$3" in
2925 4*) osname=newsos4 ;;
2926 *) osname=newsos ;;
2927 esac
2928 ;;
aaacdc8b 2929 next*) osname=next ;;
28bb1e2c 2930 nonstop-ux) osname=nonstopux ;;
aaacdc8b
GS
2931 POSIX-BC | posix-bc ) osname=posix-bc
2932 osvers="$3"
a0d0e21e 2933 ;;
ae3afa4e
TH
2934 powerux | power_ux | powermax_os | powermaxos | \
2935 powerunix | power_unix) osname=powerux
2936 osvers="$3"
2937 ;;
aaacdc8b
GS
2938 qnx) osname=qnx
2939 osvers="$4"
2940 ;;
a0d0e21e
LW
2941 solaris) osname=solaris
2942 case "$3" in
2943 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2944 *) osvers="$3" ;;
a0d0e21e
LW
2945 esac
2946 ;;
85e6fe83
LW
2947 sunos) osname=sunos
2948 case "$3" in
85e6fe83
LW
2949 5*) osname=solaris
2950 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2951 *) osvers="$3" ;;
2304df62
AD
2952 esac
2953 ;;
a0d0e21e 2954 titanos) osname=titanos
85e6fe83 2955 case "$3" in
a0d0e21e
LW
2956 1*) osvers=1 ;;
2957 2*) osvers=2 ;;
2958 3*) osvers=3 ;;
2959 4*) osvers=4 ;;
ecfc5424 2960 *) osvers="$3" ;;
2304df62
AD
2961 esac
2962 ;;
85e6fe83 2963 ultrix) osname=ultrix
ecfc5424 2964 osvers="$3"
2304df62 2965 ;;
28757baa 2966 osf1|mls+) case "$5" in
fed7345c
AD
2967 alpha)
2968 osname=dec_osf
2aa76180
JH
2969 osvers=`sizer -v | awk '{print $3}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2970 case "$osvers" in
2971 [1-9].[0-9]*) ;;
2972 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2973 esac
ecfc5424
AD
2974 ;;
2975 hp*) osname=hp_osf1 ;;
2976 mips) osname=mips_osf1 ;;
85e6fe83
LW
2977 esac
2978 ;;
0337d152
BG
2979 unixware) osname=svr5
2980 osvers="$4"
2981 ;;
3c728e00 2982 uts) osname=uts
a0d0e21e
LW
2983 osvers="$3"
2984 ;;
3c728e00
JH
2985 vos) osvers="$3"
2986 ;;
85e6fe83 2987 $2) case "$osname" in
2304df62 2988 *isc*) ;;
a0d0e21e 2989 *freebsd*) ;;
5f05dabc 2990 svr*)
a0d0e21e
LW
2991 : svr4.x or possibly later
2992 case "svr$3" in
2993 ${osname}*)
2994 osname=svr$3
2995 osvers=$4
2996 ;;
2997 esac
2998 case "$osname" in
2999 svr4.0)
3000 : Check for ESIX
3001 if test -f /stand/boot ; then
3002 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3003 if test -n "$INITPROG" -a -f "$INITPROG"; then
3004 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3005 if test -n "$isesix"; then
a0d0e21e
LW
3006 osname=esix4
3007 fi
3008 fi
3009 fi
3010 ;;
3011 esac
3012 ;;
2304df62 3013 *) if test -f /etc/systemid; then
a0d0e21e
LW
3014 osname=sco
3015 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3016 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3017 osvers=$1.$2.$3
c4f23d77 3018 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3019 osvers=$1.$2
c4f23d77 3020 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3021 osvers=$1
2304df62 3022 fi
a0d0e21e
LW
3023 else
3024 case "$osname" in
3025 '') : Still unknown. Probably a generic Sys V.
3026 osname="sysv"
3027 osvers="$3"
3028 ;;
3029 esac
2304df62
AD
3030 fi
3031 ;;
3032 esac
3033 ;;
a0d0e21e
LW
3034 *) case "$osname" in
3035 '') : Still unknown. Probably a generic BSD.
3036 osname="$1"
3037 osvers="$3"
3038 ;;
3039 esac
3040 ;;
2304df62
AD
3041 esac
3042 else
dfe9444c
AD
3043 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3044 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3045 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3046 osname=news_os
2304df62 3047 fi
dfe9444c 3048 $rm -f UU/kernel.what
8e07c86e
AD
3049 elif test -d c:/.; then
3050 set X $myuname
3051 osname=os2
3052 osvers="$5"
2304df62
AD
3053 fi
3054 fi
85e6fe83 3055
5440bc8e
JH
3056 case "$targetarch" in
3057 '') ;;
3058 *) hostarch=$osname
3059 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3060 osvers=''
3061 ;;
3062 esac
3063
a0d0e21e
LW
3064 : Now look for a hint file osname_osvers, unless one has been
3065 : specified already.
3066 case "$hintfile" in
3067 ''|' ')
1e127011 3068 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3069 : Also try without trailing minor version numbers.
1e127011
DD
3070 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3071 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3072 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3073 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3074 case "$file" in
3075 '') dflt=none ;;
3076 *) case "$osvers" in
3077 '') dflt=$file
3078 ;;
dfe9444c 3079 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3080 dflt=$file
dfe9444c 3081 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3082 dflt=$xfile
dfe9444c 3083 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3084 dflt=$xxfile
dfe9444c 3085 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3086 dflt=$xxxfile
dfe9444c 3087 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3088 dflt=$xxxxfile
dfe9444c 3089 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3090 dflt="${osname}"
3091 else
3092 dflt=none
3093 fi
3094 ;;
3095 esac
85e6fe83
LW
3096 ;;
3097 esac
4e2a5f63
AD
3098 if $test -f Policy.sh ; then
3099 case "$dflt" in
3100 *Policy*) ;;
3101 none) dflt="Policy" ;;
3102 *) dflt="Policy $dflt" ;;
3103 esac
3104 fi
85e6fe83 3105 ;;
a0d0e21e 3106 *)
ecfc5424 3107 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3108 ;;
2304df62 3109 esac
1aef975c 3110
4e2a5f63
AD
3111 if $test -f Policy.sh ; then
3112 $cat <<EOM
3113
3114There's also a Policy hint file available, which should make the
3115site-specific (policy) questions easier to answer.
3116EOM
3117
3118 fi
3119
2304df62
AD
3120 $cat <<EOM
3121
3122You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 3123A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 3124is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
3125
3126EOM
4e2a5f63 3127
2304df62 3128 rp="Which of these apply, if any?"
dfe9444c 3129 . UU/myread
85e6fe83
LW
3130 tans=$ans
3131 for file in $tans; do
4e2a5f63
AD
3132 if $test X$file = XPolicy -a -f Policy.sh; then
3133 . Policy.sh
3134 $cat Policy.sh >> UU/config.sh
3135 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3136 . $src/hints/$file.sh
3137 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3138 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3139 : nothing
3140 else
85e6fe83
LW
3141 : Give one chance to correct a possible typo.
3142 echo "$file.sh does not exist"
3143 dflt=$file
3144 rp="hint to use instead?"
dfe9444c 3145 . UU/myread
85e6fe83 3146 for file in $ans; do
dfe9444c
AD
3147 if $test -f "$src/hints/$file.sh"; then
3148 . $src/hints/$file.sh
3149 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3150 elif $test X$ans = X -o X$ans = Xnone ; then
3151 : nothing
3152 else
3153 echo "$file.sh does not exist -- ignored."
3154 fi
3155 done
2304df62
AD
3156 fi
3157 done
85e6fe83 3158
2304df62 3159 hint=recommended
85e6fe83 3160 : Remember our hint file for later.
dfe9444c 3161 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3162 hintfile="$file"
85e6fe83 3163 else
a0d0e21e 3164 hintfile=''
85e6fe83 3165 fi
2304df62
AD
3166fi
3167cd UU
3168;;
3169*)
3170 echo " "
3171 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3172 tmp_n="$n"
3173 tmp_c="$c"
2304df62
AD
3174 cd ..
3175 cp $config_sh config.sh 2>/dev/null
a78b0d02 3176 chmod +w config.sh
2304df62
AD
3177 . ./config.sh
3178 cd UU
3179 cp ../config.sh .
ecfc5424
AD
3180 n="$tmp_n"
3181 c="$tmp_c"
2304df62
AD
3182 hint=previous
3183 ;;
3184esac
1aef975c 3185test "$override" && . ./optdef.sh
2304df62
AD
3186
3187: Restore computed paths
3188for file in $loclist $trylist; do
3189 eval $file="\$_$file"
3190done
3191
85e6fe83 3192cat << EOM
a0d0e21e 3193
85e6fe83 3194Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3195The default value is probably right if the name rings a bell. Otherwise,
3196since spelling matters for me, either accept the default or answer "none"
3197to leave it blank.
a0d0e21e 3198
85e6fe83 3199EOM
85e6fe83 3200case "$osname" in
a0d0e21e 3201 ''|' ')
85e6fe83 3202 case "$hintfile" in
a0d0e21e 3203 ''|' '|none) dflt=none ;;
ecfc5424 3204 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3205 esac
3206 ;;
3207 *) dflt="$osname" ;;
3208esac
3209rp="Operating system name?"
3210. ./myread
3211case "$ans" in
ecfc5424
AD
3212none) osname='' ;;
3213*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3214esac
8ff267be 3215echo " "
3216case "$osvers" in
3217 ''|' ')
3218 case "$hintfile" in
3219 ''|' '|none) dflt=none ;;
3220 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3221 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3222 case "$dflt" in
3223 ''|' ') dflt=none ;;
3224 esac
3225 ;;
3226 esac
3227 ;;
3228 *) dflt="$osvers" ;;
3229esac
3230rp="Operating system version?"
3231. ./myread
3232case "$ans" in
3233none) osvers='' ;;
3234*) osvers="$ans" ;;
3235esac
3236
02e93a22
JH
3237
3238. ./posthint.sh
3239
2304df62 3240: who configured the system
59b83a6f 3241cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 3242cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
3243case "$cf_by" in
3244"")
8ff267be 3245 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
3246 case "$cf_by" in
3247 "") cf_by=unknown ;;
8ff267be 3248 esac ;;
3249esac
2304df62 3250
b4eb6b3d
JH
3251: set up the script used to warn in case of inconsistency
3252cat <<EOS >whoa
3253$startsh
3254EOS
3255cat <<'EOSC' >>whoa
3256dflt=y
3257echo " "
3258echo "*** WHOA THERE!!! ***" >&4
3259echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3260rp=" Keep the $hint value?"
3261. ./myread
3262case "$ans" in
3263y) td=$was; tu=$was;;
3264esac
3265EOSC
3266
3267: function used to set $1 to $val
3268setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3269case "$val$was" in
3270$define$undef) . ./whoa; eval "$var=\$td";;
3271$undef$define) . ./whoa; eval "$var=\$tu";;
3272*) eval "$var=$val";;
3273esac'
3274
3275case "$usethreads" in
3276$define|true|[yY]*) dflt='y';;
3277*) dflt='n';;
3278esac
3279cat <<EOM
3280
3281Perl can be built to take advantage of threads on some systems.
3282To do so, Configure can be run with -Dusethreads.
3283
3284Note that threading is a highly experimental feature, and
3285some known race conditions still remain. If you choose to try
3286it, be very sure to not actually deploy it for production
3287purposes. README.threads has more details, and is required
3288reading if you enable threads.
3289
3290If this doesn't make any sense to you, just accept the default '$dflt'.
3291EOM
3292rp='Build a threading Perl?'
3293. ./myread
3294case "$ans" in
3295y|Y) val="$define" ;;
3296*) val="$undef" ;;
3297esac
3298set usethreads
3299eval $setvar
3300
3301case "$usethreads" in
3302$define)
3303 $cat <<EOM
3304
3305As of 5.5.640, Perl has two different internal threading implementations,
3306the 5.005 version (5005threads) and an interpreter-based version
3307(ithreads) that has one interpreter per thread. Both are very
3308experimental. This arrangement exists to help developers work out
3309which one is better.
3310
3311If you're a casual user, you probably don't want interpreter-threads
1a060de3
JH
3312at this time. But if you do, the 'threads' module allows their use,
3313and the 'Thread' module offers an interface to both 5005threads and
3314ithreads (whichever has been configured).
b4eb6b3d
JH
3315EOM
3316 : Default to ithreads unless overridden on command line or with
3317 : old config.sh
3318 dflt='y'
3319 case "$use5005threads" in
3320 $define|true|[yY]*) dflt='n';;
3321 esac
3322 case "$useithreads" in
3323 $undef|false|[nN]*) dflt='n';;
3324 esac
3325 rp='Use interpreter-based ithreads?'
3326 . ./myread
3327 case "$ans" in
3328 y|Y) val="$define" ;;
3329 *) val="$undef" ;;
3330 esac
3331 set useithreads
3332 eval $setvar
3333 : Now set use5005threads to the opposite value.
3334 case "$useithreads" in
3335 $define) val="$undef" ;;
3336 *) val="$define" ;;
3337 esac
3338 set use5005threads
3339 eval $setvar
3340 ;;
3341*)
3342 useithreads="$undef"
3343 use5005threads="$undef"
3344 ;;
3345esac
3346
c915ce7f
JH
3347case "$useithreads$use5005threads" in
3348"$define$define")
3349 $cat >&4 <<EOM
3350
3351You cannot have both the ithreads and the 5.005 threads enabled
3352at the same time. Disabling the 5.005 threads since they are
3353much less stable than the ithreads.
3354
3355EOM
3356 use5005threads="$undef"
3357 ;;
3358esac
3359
b4eb6b3d
JH
3360case "$d_oldpthreads" in
3361'') : Configure tests would be welcome here. For now, assume undef.
3362 val="$undef" ;;
3363*) val="$d_oldpthreads" ;;
3364esac
3365set d_oldpthreads
3366eval $setvar
3367
3368
3369case "$usethreads" in
3370"$define"|true|[yY]*)
3371: Look for a hint-file generated 'call-back-unit'. If the
3372: user has specified that a threading perl is to be built,
3373: we may need to set or change some other defaults.
3374 if $test -f usethreads.cbu; then
3375 echo "Your platform has some specific hints for threaded builds, using them..."
3376 . ./usethreads.cbu
3377 else
3378 $cat <<EOM
3379(Your platform doesn't have any specific hints for threaded builds.
3380 Assuming POSIX threads, then.)
3381EOM
3382 fi
3383 ;;
3384esac
3385
3386cat <<EOM
3387
3388Perl can be built so that multiple Perl interpreters can coexist
3389within the same Perl executable.
3390EOM
3391
3392case "$useithreads" in
3393$define)
3394 cat <<EOM
3395This multiple interpreter support is required for interpreter-based threads.
3396EOM
3397 val="$define"
3398 ;;
3399*) case "$usemultiplicity" in
3400 $define|true|[yY]*) dflt='y';;
3401 *) dflt='n';;
3402 esac
3403 echo " "
3404 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3405 rp='Build Perl for multiplicity?'
3406 . ./myread
3407 case "$ans" in
3408 y|Y) val="$define" ;;
3409 *) val="$undef" ;;
3410 esac
3411 ;;
3412esac
3413set usemultiplicity
3414eval $setvar
3415
96056487
JH
3416
3417case "$usemorebits" in
3418"$define"|true|[yY]*)
3419 use64bitint="$define"
3420 uselongdouble="$define"
3421 usemorebits="$define"
3422 ;;
3423*) usemorebits="$undef"
3424 ;;
3425esac
3426
e5e20432
JH
3427: make some quick guesses about what we are up against
3428echo " "
3429$echo $n "Hmm... $c"
3430echo exit 1 >bsd
3431echo exit 1 >usg
3432echo exit 1 >v7
3433echo exit 1 >osf1
3434echo exit 1 >eunice
3435echo exit 1 >xenix
3436echo exit 1 >venix
3437echo exit 1 >os2
3438d_bsd="$undef"
3439$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3440if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3441then
3442 echo "Looks kind of like an OSF/1 system, but we'll see..."
3443 echo exit 0 >osf1
381aa1ff 3444elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3445 xxx=`./loc addbib blurfl $pth`
3446 if $test -f $xxx; then
3447 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3448 echo exit 0 >bsd
3449 echo exit 0 >usg
3450 else
3451 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3452 echo "Looks kind of like an extended USG system, but we'll see..."
3453 else
3454 echo "Looks kind of like a USG system, but we'll see..."
3455 fi
3456 echo exit 0 >usg
3457 fi
3458elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3459 echo "Looks kind of like a BSD system, but we'll see..."
3460 d_bsd="$define"
3461 echo exit 0 >bsd
3462else
3463 echo "Looks kind of like a Version 7 system, but we'll see..."
3464 echo exit 0 >v7
3465fi
3466case "$eunicefix" in
3467*unixtovms*)
3468 $cat <<'EOI'
3469There is, however, a strange, musty smell in the air that reminds me of
3470something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3471EOI
3472 echo exit 0 >eunice
3473 d_eunice="$define"
3474: it so happens the Eunice I know will not run shell scripts in Unix format
3475 ;;
3476*)
3477 echo " "
3478 echo "Congratulations. You aren't running Eunice."
3479 d_eunice="$undef"
3480 ;;
3481esac
3482: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3483: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3484: semicolon as a patch separator
e5e20432
JH
3485case "$p_" in
3486:) ;;
3487*)
3488 $cat <<'EOI'
3489I have the feeling something is not exactly right, however...don't tell me...
3490lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3491(Or you may be running DOS with DJGPP.)
e5e20432
JH
3492EOI
3493 echo exit 0 >os2
3494 ;;
3495esac
3496if test -f /xenix; then
3497 echo "Actually, this looks more like a XENIX system..."
3498 echo exit 0 >xenix
3499 d_xenix="$define"
3500else
3501 echo " "
3502 echo "It's not Xenix..."
3503 d_xenix="$undef"
3504fi
3505chmod +x xenix
3506$eunicefix xenix
3507if test -f /venix; then
3508 echo "Actually, this looks more like a VENIX system..."
3509 echo exit 0 >venix
3510else
3511 echo " "
3512 if ./xenix; then
3513 : null
3514 else
3515 echo "Nor is it Venix..."
3516 fi
3517fi
3518chmod +x bsd usg v7 osf1 eunice xenix venix os2
3519$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3520$rm -f foo
3521
5869b1f1
JH
3522case "$cc" in
3523'') dflt=cc;;
3524*) dflt="$cc";;
3525esac
3526rp="Use which C compiler?"
3527. ./myread
3528cc="$ans"
e5e20432
JH
3529: Look for a hint-file generated 'call-back-unit'. Now that the
3530: user has specified the compiler, we may need to set or change some
3531: other defaults.
3532if $test -f cc.cbu; then
3533 . ./cc.cbu
3534fi
2573c5f9 3535. ./checkcc
8a27cf78 3536
e5e20432
JH
3537echo " "
3538echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 3539$cat >try.c <<EOM
e5e20432
JH
3540#include <stdio.h>
3541int main() {
3542#ifdef __GNUC__
3543#ifdef __VERSION__
3544 printf("%s\n", __VERSION__);
3545#else
3546 printf("%s\n", "1");
3547#endif
3548#endif
3549 exit(0);
3550}
3551EOM
5440bc8e
JH
3552if $cc -o try $ccflags $ldflags try.c; then
3553 gccversion=`$run ./try`
e5e20432
JH
3554 case "$gccversion" in
3555 '') echo "You are not using GNU cc." ;;
fc68435e 3556 *) echo "You are using GNU cc $gccversion."
e723fc21 3557 ccname=gcc
fc68435e 3558 ;;
e5e20432
JH
3559 esac
3560else
3561 echo " "
3562 echo "*** WHOA THERE!!! ***" >&4
3563 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3564 case "$knowitall" in
3565 '')
3566 echo " You'd better start hunting for one and let me know about it." >&4
3567 exit 1
3568 ;;
3569 esac
3570fi
5440bc8e 3571$rm -f try try.*
e5e20432
JH
3572case "$gccversion" in
35731*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3574esac
5b463ca7
KS
3575case "$gccversion" in
3576'') gccosandvers='' ;;
10b4ebb5
JH
3577*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3578 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3579 gccshortvers=''
5b463ca7 3580 case "$gccosandvers" in
02903077
JH
3581 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3582 $osname$osvers) ;; # looking good
5b463ca7
KS
3583 $osname*) cat <<EOM >&4
3584
3585*** WHOA THERE!!! ***
3586
3587 Your gcc has not been compiled for the exact release of
3588 your operating system ($gccosandvers versus $osname$osvers).
3589
3590 In general it is a good idea to keep gcc synchronized with
3591 the operating system because otherwise serious problems
3592 may ensue when trying to compile software, like Perl.
3593
3594 I'm trying to be optimistic here, though, and will continue.
3595 If later during the configuration and build icky compilation
02903077
JH
3596 problems appear (headerfile conflicts being the most common
3597 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3598 your operating system release.
3599
3600EOM
3601 ;;
81575342 3602 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3603 esac
3604 ;;
3605esac
e723fc21
JH
3606case "$ccname" in
3607'') ccname="$cc" ;;
3608esac
e5e20432 3609
640374d0 3610
bd9b35c9
JH
3611: decide how portable to be. Allow command line overrides.
3612case "$d_portable" in
3613"$undef") ;;
3614*) d_portable="$define" ;;
104d25b7 3615esac
85ab1d1d 3616
bd9b35c9
JH
3617: set up shell script to do ~ expansion
3618cat >filexp <<EOSS
3619$startsh
3620: expand filename
3621case "\$1" in
3622 ~/*|~)
3623 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3624 ;;
3625 ~*)
3626 if $test -f /bin/csh; then
3627 /bin/csh -f -c "glob \$1"
3628 failed=\$?
3629 echo ""
3630 exit \$failed
e5e20432 3631 else
bd9b35c9
JH
3632 name=\`$expr x\$1 : '..\([^/]*\)'\`
3633 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3634 if $test ! -d "\$dir"; then
3635 me=\`basename \$0\`
3636 echo "\$me: can't locate home directory for: \$name" >&2
3637 exit 1
3638 fi
3639 case "\$1" in
3640 */*)
3641 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3642 ;;
3643 *)
3644 echo \$dir
e5e20432
JH
3645 ;;
3646 esac
3647 fi
b691c02f 3648 ;;
4633a7c4 3649*)
bd9b35c9 3650 echo \$1
2304df62
AD
3651 ;;
3652esac
4633a7c4
LW
3653EOSS
3654chmod +x filexp
3655$eunicefix filexp
2304df62
AD
3656
3657: now set up to get a file name
28757baa 3658cat <<EOS >getfile
3659$startsh
3660EOS
3661cat <<'EOSC' >>getfile
2304df62
AD
3662tilde=''
3663fullpath=''
3664already=''
3665skip=''
3666none_ok=''
3667exp_file=''
a0d0e21e 3668nopath_ok=''
2304df62
AD
3669orig_rp="$rp"
3670orig_dflt="$dflt"
b233458b
JH
3671case "$gfpth" in
3672'') gfpth='.' ;;
3673esac
2304df62
AD
3674
3675case "$fn" in
ecfc5424 3676*\(*)
381aa1ff 3677 expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
3678 fn=`echo $fn | sed 's/(.*)//'`
3679 ;;
3680esac
3681
3682case "$fn" in
a0d0e21e
LW
3683*:*)
3684 loc_file=`expr $fn : '.*:\(.*\)'`
3685 fn=`expr $fn : '\(.*\):.*'`
3686 ;;
3687esac
3688
3689case "$fn" in
2304df62
AD
3690*~*) tilde=true;;
3691esac
3692case "$fn" in
3693*/*) fullpath=true;;
3694esac
3695case "$fn" in
3696*+*) skip=true;;
3697esac
3698case "$fn" in
3699*n*) none_ok=true;;
3700esac
3701case "$fn" in
3702*e*) exp_file=true;;
3703esac
a0d0e21e
LW
3704case "$fn" in
3705*p*) nopath_ok=true;;
3706esac
2304df62
AD
3707
3708case "$fn" in
3709*f*) type='File';;
3710*d*) type='Directory';;
a0d0e21e 3711*l*) type='Locate';;
2304df62
AD
3712esac
3713
3714what="$type"
3715case "$what" in
3716Locate) what='File';;
3717esac
3718
3719case "$exp_file" in
3720'')
3721 case "$d_portable" in
3722 "$define") ;;
3723 *) exp_file=true;;
3724 esac
3725 ;;
3726esac
3727
3728cd ..
3729while test "$type"; do
3730 redo=''
3731 rp="$orig_rp"
3732 dflt="$orig_dflt"
3733 case "$tilde" in
3734 true) rp="$rp (~name ok)";;
3735 esac
3736 . UU/myread
ecfc5424
AD
3737 if test -f UU/getfile.ok && \
3738 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3739 then
3740 value="$ans"
3741 ansexp="$ans"
3742 break
3743 fi
2304df62
AD
3744 case "$ans" in
3745 none)
3746 value=''
3747 ansexp=''
3748 case "$none_ok" in
3749 true) type='';;
3750 esac
3751 ;;
3752 *)
3753 case "$tilde" in
3754 '') value="$ans"
3755 ansexp="$ans";;
3756 *)
3757 value=`UU/filexp $ans`
3758 case $? in
3759 0)
3760 if test "$ans" != "$value"; then
ecfc5424 3761 echo "(That expands to $value on this system.)"
2304df62
AD
3762 fi
3763 ;;
3764 *) value="$ans";;
3765 esac
3766 ansexp="$value"
3767 case "$exp_file" in
3768 '') value="$ans";;
3769 esac
3770 ;;
3771 esac
3772 case "$fullpath" in
3773 true)
3774 case "$ansexp" in
3775 /*) value="$ansexp" ;;
23da6c43 3776 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
3777 *)
3778 redo=true
3779 case "$already" in
3780 true)
3781 echo "I shall only accept a full path name, as in /bin/ls." >&4
3782 echo "Use a ! shell escape if you wish to check pathnames." >&4
3783 ;;
3784 *)
3785 echo "Please give a full path name, starting with slash." >&4
3786 case "$tilde" in
3787 true)
3788 echo "Note that using ~name is ok provided it expands well." >&4
3789 already=true
3790 ;;
3791 esac
3792 esac
3793 ;;
3794 esac
3795 ;;
3796 esac
3797 case "$redo" in
3798 '')
3799 case "$type" in
3800 File)
b233458b
JH
3801 for fp in $gfpth; do
3802 if test "X$fp" = X.; then
3803 pf="$ansexp"
3804 else
3805 pf="$fp/$ansexp"
3806 fi
3807 if test -f "$pf"; then
3808 type=''
3809 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3810 then
3811 echo "($value is not a plain file, but that's ok.)"
3812 type=''
3813 fi
3814 if test X"$type" = X; then
3815 value="$pf"
3816 break
3817 fi
3818 done
2304df62
AD
3819 ;;
3820 Directory)
b233458b
JH
3821 for fp in $gfpth; do
3822 if test "X$fp" = X.; then
f78bfc9c
JH
3823 dir="$ans"
3824 direxp="$ansexp"
b233458b 3825 else
dd858076 3826 dir="$fp/$ansexp"
f78bfc9c 3827 direxp="$fp/$ansexp"
b233458b 3828 fi
f78bfc9c 3829 if test -d "$direxp"; then
b233458b 3830 type=''
f78bfc9c 3831 value="$dir"
b233458b
JH
3832 break
3833 fi
3834 done
2304df62
AD
3835 ;;
3836 Locate)
40000a8c 3837 if test -d "$ansexp"; then
a0d0e21e
LW
3838 echo "(Looking for $loc_file in directory $value.)"
3839 value="$value/$loc_file"
40000a8c 3840 ansexp="$ansexp/$loc_file"
2304df62 3841 fi
40000a8c 3842 if test -f "$ansexp"; then
2304df62
AD
3843 type=''
3844 fi
a0d0e21e
LW
3845 case "$nopath_ok" in
3846 true) case "$value" in
3847 */*) ;;
3848 *) echo "Assuming $value will be in people's path."
3849 type=''
3850 ;;
3851 esac
3852 ;;
3853 esac
2304df62
AD
3854 ;;
3855 esac
3856
3857 case "$skip" in
3858 true) type='';
3859 esac
3860
3861 case "$type" in
3862 '') ;;
3863 *)
3864 if test "$fastread" = yes; then
3865 dflt=y
3866 else
3867 dflt=n
3868 fi
3869 rp="$what $value doesn't exist. Use that name anyway?"
3870 . UU/myread
3871 dflt=''
3872 case "$ans" in
3873 y*) type='';;
3874 *) echo " ";;
3875 esac
3876 ;;
3877 esac
3878 ;;
3879 esac
3880 ;;
3881 esac
3882done
3883cd UU
3884ans="$value"
3885rp="$orig_rp"
3886dflt="$orig_dflt"
ecfc5424 3887rm -f getfile.ok
b233458b 3888test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3889EOSC
3890
bd9b35c9
JH
3891: What should the include directory be ?
3892echo " "
3893$echo $n "Hmm... $c"
3894dflt='/usr/include'
3895incpath=''
3896mips_type=''
3897if $test -f /bin/mips && /bin/mips; then
3898 echo "Looks like a MIPS system..."
3899 $cat >usr.c <<'EOCP'
3900#ifdef SYSTYPE_BSD43
3901/bsd43
3902#endif
3903EOCP
8a27cf78 3904 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
3905 dflt='/bsd43/usr/include'
3906 incpath='/bsd43'
3907 mips_type='BSD 4.3'
3908 else
3909 mips_type='System V'
3910 fi
3911 $rm -f usr.c usr.out
3912 echo "and you're compiling with the $mips_type compiler and libraries."
3913 xxx_prompt=y
3914 echo "exit 0" >mips
3915else
3916 echo "Doesn't look like a MIPS system."
3917 xxx_prompt=n
3918 echo "exit 1" >mips
3919fi
3920chmod +x mips
3921$eunicefix mips
3922case "$usrinc" in
3923'') ;;
3924*) dflt="$usrinc";;
3925esac
3926case "$xxx_prompt" in
3927y) fn=d/
3928 echo " "
3929 rp='Where are the include files you want to use?'
3930 . ./getfile
3931 usrinc="$ans"
8e07c86e 3932 ;;
bd9b35c9 3933*) usrinc="$dflt"
8e07c86e
AD
3934 ;;
3935esac
2304df62 3936
96056487
JH
3937: see how we invoke the C preprocessor
3938echo " "
3939echo "Now, how can we feed standard input to your C preprocessor..." >&4
3940cat <<'EOT' >testcpp.c
3941#define ABC abc
3942#define XYZ xyz
3943ABC.XYZ
3944EOT
3945cd ..
3946if test ! -f cppstdin; then
3947 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3948 # AIX cc -E doesn't show the absolute headerfile
3949 # locations but we'll cheat by using the -M flag.
3950 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
3951 else
3952 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3953 fi
3954else
3955 echo "Keeping your $hint cppstdin wrapper."
3956fi
3957chmod 755 cppstdin
3958wrapper=`pwd`/cppstdin
3959ok='false'
3960cd UU
3961
3962if $test "X$cppstdin" != "X" && \
3963 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3964 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3965then
3966 echo "You used to use $cppstdin $cppminus so we'll use that again."
3967 case "$cpprun" in
3968 '') echo "But let's see if we can live without a wrapper..." ;;
3969 *)
3970 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3971 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3972 then
3973 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3974 ok='true'
3975 else
3976 echo "(However, $cpprun $cpplast does not work, let's see...)"
3977 fi
3978 ;;
3979 esac
3980else
3981 case "$cppstdin" in
3982 '') ;;
3983 *)
3984 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3985 ;;
3986 esac
3987fi
3988
3989if $ok; then
3990 : nothing
3991elif echo 'Maybe "'"$cc"' -E" will work...'; \
3992 $cc -E <testcpp.c >testcpp.out 2>&1; \
3993 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3994 echo "Yup, it does."
3995 x_cpp="$cc -E"
3996 x_minus='';
3997elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3998 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3999 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4000 echo "Yup, it does."
4001 x_cpp="$cc -E"
4002 x_minus='-';
4003elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4004 $cc -P <testcpp.c >testcpp.out 2>&1; \
4005 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4006 echo "Yipee, that works!"
4007 x_cpp="$cc -P"
4008 x_minus='';
4009elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4010 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4011 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4012 echo "At long last!"
4013 x_cpp="$cc -P"
4014 x_minus='-';
4015elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4016 $cpp <testcpp.c >testcpp.out 2>&1; \
4017 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4018 echo "It works!"
4019 x_cpp="$cpp"
4020 x_minus='';
4021elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4022 $cpp - <testcpp.c >testcpp.out 2>&1; \
4023 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4024 echo "Hooray, it works! I was beginning to wonder."
4025 x_cpp="$cpp"
4026 x_minus='-';
4027elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4028 $wrapper <testcpp.c >testcpp.out 2>&1; \
4029 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4030 x_cpp="$wrapper"
4031 x_minus=''
4032 echo "Eureka!"
4033else
4034 dflt=''
4035 rp="No dice. I can't find a C preprocessor. Name one:"
4036 . ./myread
4037 x_cpp="$ans"
4038 x_minus=''
4039 $x_cpp <testcpp.c >testcpp.out 2>&1
4040 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4041 echo "OK, that will do." >&4
4042 else
4043echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4044 exit 1
4045 fi
4046fi
4047
4048case "$ok" in
4049false)
4050 cppstdin="$x_cpp"
4051 cppminus="$x_minus"
4052 cpprun="$x_cpp"
4053 cpplast="$x_minus"
4054 set X $x_cpp
4055 shift
4056 case "$1" in
4057 "$cpp&quo