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