This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
New command syntax for 'x' command
[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#
18ea2752 23# Generated on Mon Feb 11 17:45:48 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
JH
1047fi
1048
b4eb6b3d 1049i_whoami=''
a33c94aa
JH
1050ccname=''
1051ccversion=''
1052perllibs=''
1053: set useposix=false in your hint file to disable the POSIX extension.
1054useposix=true
1055: set useopcode=false in your hint file to disable the Opcode extension.
1056useopcode=true
1057: Trailing extension. Override this in a hint file, if needed.
a33c94aa
JH
1058: Extra object files, if any, needed on this platform.
1059archobjs=''
1060archname=''
ff935051
JH
1061: Possible local include directories to search.
1062: Set locincpth to "" in a hint file to defeat local include searches.
1063locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1064locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1065:
1066: no include file wanted by default
1067inclwanted=''
1068
b4eb6b3d 1069groupstype=''
64615a5e 1070libnames=''
732c9516
JH
1071: change the next line if compiling for Xenix/286 on Xenix/386
1072xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1073: Possible local library directories to search.
1074loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1075loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1076
1077: general looking path for locating libraries
5869b1f1 1078glibpth="/lib /usr/lib $xlibpth"
732c9516 1079glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1080test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1081test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1082
1083: Private path used by Configure to find libraries. Its value
1084: is prepended to libpth. This variable takes care of special
1085: machines, like the mips. Usually, it should be empty.
1086plibpth=''
1087
1cfa4ec7
GS
1088: default library list
1089libswanted=''
921b2963 1090: some systems want to use only the non-versioned libso:s
1cfa4ec7 1091ignore_versioned_solibs=''
b4eb6b3d
JH
1092archname64=''
1093ccflags_uselargefiles=''
1094ldflags_uselargefiles=''
1095libswanted_uselargefiles=''
1096: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1097: set usesocks on the Configure command line to enable socks.
b4eb6b3d 1098: set usethreads on the Configure command line to enable threads.
cd040c5e 1099usereentrant='undef'
a33c94aa
JH
1100: full support for void wanted by default
1101defvoidused=15
1102
ecfc5424 1103: List of libraries we want.
693762b4 1104: If anyone needs -lnet, put it in a hint file.
997d70a2 1105libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
69e84d1d 1106libswanted="$libswanted dld ld sun m c cposix posix"
f1066039 1107libswanted="$libswanted ndir dir crypt sec"
e61ecf27 1108libswanted="$libswanted ucb bsd BSD PW x util"
1aef975c 1109: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1110: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1111glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1112glibpth="/usr/shlib $glibpth"
1113: Do not use vfork unless overridden by a hint file.
1114usevfork=false
1115
8ff267be
PP
1116: Find the basic shell for Bourne shell scripts
1117case "$sh" in
1118'')
8ff267be
PP
1119 case "$SYSTYPE" in
1120 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1121 *) xxx='/bin/sh';;
1122 esac
1123 if test -f "$xxx"; then
1124 sh="$xxx"
1125 else
1126 : Build up a list and do a single loop so we can 'break' out.
1127 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1128 for xxx in sh bash ksh pdksh ash; do
1129 for p in $pth; do
1130 try="$try ${p}/${xxx}"
1131 done
1132 done
1133 for xxx in $try; do
1134 if test -f "$xxx"; then
1135 sh="$xxx";
8ff267be 1136 break
a5a94ea5
JH
1137 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1138 sh="$xxx";
1139 break
8ff267be
PP
1140 elif test -f "$xxx.exe"; then
1141 sh="$xxx";
8ff267be
PP
1142 break
1143 fi
1144 done
1145 fi
1146 ;;
1147esac
1148
1149case "$sh" in
a33c94aa 1150'') cat >&2 <<EOM
8ff267be 1151$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1152
8ff267be 1153Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1154Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1155we'll try to straighten this all out.
8ff267be
PP
1156EOM
1157 exit 1
1158 ;;
1159esac
1160
760ac839 1161: see if sh knows # comments
73614538 1162if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1163 shsharp=true
1164 spitshell=cat
760ac839 1165 xcat=/bin/cat
a931254c
JH
1166 test -f $xcat$_exe || xcat=/usr/bin/cat
1167 if test ! -f $xcat$_exe; then
4bdb8fb5 1168 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1169 if test -f $p/cat$_exe; then
1deb0a86 1170 xcat=$p/cat
3c728e00
JH
1171 break
1172 fi
1173 done
1deb0a86
JH
1174 if test ! -f $xcat$_exe; then
1175 echo "Can't find cat anywhere!"
3c728e00
JH
1176 exit 1
1177 fi
1178 fi
5440bc8e
JH
1179 echo "#!$xcat" >sharp
1180 $eunicefix sharp
1181 chmod +x sharp
1182 ./sharp > today
760ac839 1183 if test -s today; then
760ac839
LW
1184 sharpbang='#!'
1185 else
5440bc8e
JH
1186 echo "#! $xcat" > sharp
1187 $eunicefix sharp
1188 chmod +x sharp
1189 ./sharp > today
760ac839 1190 if test -s today; then
760ac839
LW
1191 sharpbang='#! '
1192 else
760ac839
LW
1193 sharpbang=': use '
1194 fi
1195 fi
1196else
dfe9444c 1197 echo " "
8ff267be 1198 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1199 shsharp=false
1200 cd ..
1201 echo "exec grep -v '^[ ]*#'" >spitshell
1202 chmod +x spitshell
1203 $eunicefix spitshell
1204 spitshell=`pwd`/spitshell
1205 cd UU
1206 echo "I presume that if # doesn't work, #! won't work either!"
1207 sharpbang=': use '
1208fi
5440bc8e 1209rm -f sharp today
760ac839
LW
1210
1211: figure out how to guarantee sh startup
8ff267be
PP
1212case "$startsh" in
1213'') startsh=${sharpbang}${sh} ;;
1214*)
760ac839 1215esac
5440bc8e 1216cat >sharp <<EOSS
760ac839
LW
1217$startsh
1218set abc
1219test "$?abc" != 1
1220EOSS
1221
5440bc8e
JH
1222chmod +x sharp
1223$eunicefix sharp
1224if ./sharp; then
8ff267be 1225 : echo "Yup, it does."
760ac839 1226else
dfe9444c
AD
1227 echo "Hmm... '$startsh' does not guarantee sh startup..."
1228 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1229fi
5440bc8e 1230rm -f sharp
760ac839 1231
aebf16e7
AD
1232
1233: Save command line options in file UU/cmdline.opt for later use in
1234: generating config.sh.
1235cat > cmdline.opt <<EOSH
1236# Configure command line arguments.
1237config_arg0='$0'
1238config_args='$*'
1239config_argc=$#
1240EOSH
1241argn=1
ee45ea83
IZ
1242args_exp=''
1243args_sep=''
aebf16e7
AD
1244for arg in "$@"; do
1245 cat >>cmdline.opt <<EOSH
1246config_arg$argn='$arg'
1247EOSH
ee45ea83
IZ
1248 # Extreme backslashitis: replace each ' by '"'"'
1249 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1250$arg
1251EOC
1252 arg_exp=`cat cmdl.opt`
1253 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1254 argn=`expr $argn + 1`
ee45ea83 1255 args_sep=' '
aebf16e7 1256done
ee45ea83
IZ
1257# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1258# used by ./hints/os2.sh
1259rm -f cmdl.opt
aebf16e7 1260
2304df62
AD
1261: produce awk script to parse command line options
1262cat >options.awk <<'EOF'
1263BEGIN {
02e93a22 1264 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1265
1266 len = length(optstr);
1267 for (i = 1; i <= len; i++) {
1268 c = substr(optstr, i, 1);
1269 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1270 if (a == ":") {
1271 arg[c] = 1;
1272 i++;
1273 }
1274 opt[c] = 1;
1275 }
1276}
1277{
1278 expect = 0;
1279 str = $0;
1280 if (substr(str, 1, 1) != "-") {
1281 printf("'%s'\n", str);
1282 next;
1283 }
1284 len = length($0);
1285 for (i = 2; i <= len; i++) {
1286 c = substr(str, i, 1);
1287 if (!opt[c]) {
1288 printf("-%s\n", substr(str, i));
1289 next;
1290 }
1291 printf("-%s\n", c);
1292 if (arg[c]) {
1293 if (i < len)
1294 printf("'%s'\n", substr(str, i + 1));
1295 else
1296 expect = 1;
1297 next;
1298 }
1299 }
1300}
1301END {
1302 if (expect)
1303 print "?";
1304}
1305EOF
1306
1307: process the command line options
4633a7c4
LW
1308set X `for arg in "$@"; do echo "X$arg"; done |
1309 sed -e s/X// | awk -f options.awk`
2304df62
AD
1310eval "set $*"
1311shift
1312rm -f options.awk
1313
1314: set up default values
1315fastread=''
1316reuseval=false
1317config_sh=''
1318alldone=''
1319error=''
1320silent=''
1321extractsh=''
ecfc5424 1322override=''
16d20bd9 1323knowitall=''
02e93a22 1324rm -f optdef.sh posthint.sh
28757baa
PP
1325cat >optdef.sh <<EOS
1326$startsh
1327EOS
2304df62 1328
dfe9444c 1329
2304df62
AD
1330: option parsing
1331while test $# -gt 0; do
1332 case "$1" in
1333 -d) shift; fastread=yes;;
1334 -e) shift; alldone=cont;;
1335 -f)
1336 shift
1337 cd ..
1338 if test -r "$1"; then
1339 config_sh="$1"
1340 else
a0d0e21e 1341 echo "$me: cannot read config file $1." >&2
2304df62
AD
1342 error=true
1343 fi
1344 cd UU
1345 shift;;
1346 -h) shift; error=true;;
1347 -r) shift; reuseval=true;;
dfe9444c 1348 -s) shift; silent=true; realsilent=true;;
2304df62 1349 -E) shift; alldone=exit;;
16d20bd9 1350 -K) shift; knowitall=true;;
ecfc5424 1351 -O) shift; override=true;;
dfe9444c 1352 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1353 -D)
1354 shift
1355 case "$1" in
1356 *=)
1357 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1358 echo "$me: ignoring -D $1" >&2
1359 ;;
ecfc5424 1360 *=*) echo "$1" | \
1aef975c
AD
1361 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1362 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1363 esac
1364 shift
1365 ;;
1366 -U)
1367 shift
1368 case "$1" in
1aef975c 1369 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1370 *=*)
1371 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1372 echo "$me: ignoring -U $1" >&2
1373 ;;
1aef975c 1374 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1375 esac
1376 shift
1377 ;;
02e93a22
JH
1378 -A)
1379 shift
1380 xxx=''
1381 yyy="$1"
02e93a22 1382 zzz=''
5f83a3e9 1383 uuu=undef
02e93a22 1384 case "$yyy" in
5f83a3e9
JH
1385 *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1386 case "$zzz" in
1387 *:*) zzz='' ;;
1388 *) xxx=append
1389 zzz=" "`echo $yyy|sed 's!^[^=]*=!!'`
1390 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1391 esac
1392 ;;
1393 esac
1394 case "$xxx" in
1395 '') case "$yyy" in
1396 *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1397 yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1398 zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1399 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1400 *) xxx=`echo $yyy|sed 's!:.*!!'`
1401 yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1402 esac
1403 ;;
1404 esac
02e93a22
JH
1405 case "$xxx" in
1406 append)
5f83a3e9 1407 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1408 clear)
5f83a3e9 1409 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1410 define)
1411 case "$zzz" in
1412 '') zzz=define ;;
1413 esac
5f83a3e9 1414 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1415 eval)
5f83a3e9 1416 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1417 prepend)
5f83a3e9 1418 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1419 undef)
1420 case "$zzz" in
1421 '') zzz="$uuu" ;;
1422 esac
5f83a3e9
JH
1423 echo "$yyy=$zzz" >> posthint.sh ;;
1424 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1425 esac
bde6b06b 1426 shift
02e93a22 1427 ;;
dfe9444c 1428 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1429 exit 0;;
2304df62 1430 --) break;;
a0d0e21e 1431 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1432 *) break;;
1433 esac
1434done
1435
1436case "$error" in
1437true)
1438 cat >&2 <<EOM
2afac517 1439Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1440 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1441 -d : use defaults for all answers.
1442 -e : go on without questioning past the production of config.sh.
1443 -f : specify an alternate default configuration file.
1444 -h : print this help message and exit (with an error status).
1445 -r : reuse C symbols value if possible (skips costly nm extraction).
1446 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1447 -D : define symbol to have some value:
1448 -D symbol symbol gets the value 'define'
1449 -D symbol=value symbol gets the value 'value'
2304df62 1450 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1451 -K : do not use unless you know what you are doing.
ecfc5424 1452 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1453 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1454 -U : undefine symbol:
1455 -U symbol symbol gets the value 'undef'
1456 -U symbol= symbol gets completely empty
02e93a22 1457 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1458 -A symbol=value append " "value to symbol
02e93a22
JH
1459 -A append:symbol=value append value to symbol
1460 -A define:symbol=value define symbol to have value
02e93a22
JH
1461 -A clear:symbol define symbol to be ''
1462 -A define:symbol define symbol to be 'define'
1463 -A eval:symbol=value define symbol to be eval of value
1464 -A prepend:symbol=value prepend value to symbol
1465 -A undef:symbol define symbol to be 'undef'
1466 -A undef:symbol= define symbol to be ''
2304df62
AD
1467 -V : print version number and exit (with a zero status).
1468EOM
1469 exit 1
1470 ;;
1471esac
1472
dfe9444c
AD
1473: Sanity checks
1474case "$fastread$alldone" in
1475yescont|yesexit) ;;
1476*)
aaeb8e51
GS
1477 case "$extractsh" in
1478 true) ;;
1479 *)
1480 if test ! -t 0; then
1481 echo "Say 'sh Configure', not 'sh <Configure'"
1482 exit 1
1483 fi
1484 ;;
1485 esac
dfe9444c
AD
1486 ;;
1487esac
1488
2304df62
AD
1489exec 4>&1
1490case "$silent" in
1491true) exec 1>/dev/null;;
1492esac
1493
ecfc5424 1494: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1495touch optdef.sh
1496. ./optdef.sh
02e93a22
JH
1497: create the posthint manipulation script and leave the file out there...
1498touch posthint.sh
a0d0e21e 1499
2304df62 1500: set package name
85e6fe83 1501package=perl5
b4eb6b3d
JH
1502first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1503last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1504case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1505ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1506*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1507esac
2304df62 1508
2304df62
AD
1509: Some greps do not return status, grrr.
1510echo "grimblepritz" >grimble
1511if grep blurfldyick grimble >/dev/null 2>&1 ; then
1512 contains=contains
1513elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1514 contains=grep
1515else
1516 contains=contains
1517fi
1518rm -f grimble
1519: the following should work in any shell
1520case "$contains" in
1521contains*)
1522 echo " "
1523 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1524 cat >contains <<'EOSS'
1525grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1526EOSS
1527chmod +x contains
1528esac
1529
dfe9444c
AD
1530: Find the path to the source tree
1531case "$src" in
1532'') case "$0" in
b233458b
JH
1533 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1534 case "$src" in
1535 /*) ;;
8504afb7 1536 .) ;;
b233458b
JH
1537 *) src=`cd ../$src && pwd` ;;
1538 esac
1539 ;;
dfe9444c
AD
1540 *) src='.';;
1541 esac;;
1542esac
1543case "$src" in
1544'') src=/
1545 rsrc=/
1546 ;;
1547/*) rsrc="$src";;
1548*) rsrc="../$src";;
1549esac
1550if test -f $rsrc/Configure && \
1551 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1552then
1553 : found it, so we are ok.
1554else
1555 rsrc=''
1556 for src in . .. ../.. ../../.. ../../../..; do
1557 if test -f ../$src/Configure && \
1558 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1559 then
1560 rsrc=../$src
1561 break
1562 fi
1563 done
1564fi
1565case "$rsrc" in
1566'')
1567 cat <<EOM >&4
1568
1569Sorry, I can't seem to locate the source dir for $package. Please start
1570Configure with an explicit path -- i.e. /some/path/Configure.
1571
1572EOM
1573 exit 1
1574 ;;
1575../.) rsrc='..';;
1576*)
1577 echo " "
1578 echo "Sources for $package found in \"$src\"." >&4
1579 ;;
1580esac
1581
1582: script used to extract .SH files with variable substitutions
1583cat >extract <<'EOS'
a02608de 1584PERL_CONFIG_SH=true
dfe9444c 1585echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1586if test -f MANIFEST; then
1587 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1588else
1589 echo "(Looking for .SH files under the source directory.)"
6904989c 1590 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1591fi
1592shift
1593case $# in
6904989c 15940) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1595esac
6904989c 1596if test ! -f "$src/$1"; then
dfe9444c
AD
1597 shift
1598fi
1599mkdir_p='
1600name=$1;
1601create="";
1602while test $name; do
1603 if test ! -d "$name"; then
1604 create="$name $create";
1605 name=`echo $name | sed -e "s|^[^/]*$||"`;
1606 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1607 else
1608 name="";
1609 fi;
1610done;
1611for file in $create; do
1612 mkdir $file;
1613done
1614'
1615for file in $*; do
1616 case "$src" in
1617 ".")
1618 case "$file" in
1619 */*)
1620 dir=`expr X$file : 'X\(.*\)/'`
1621 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1622 (cd "$dir" && . ./$file)
dfe9444c
AD
1623 ;;
1624 *)
1625 . ./$file
1626 ;;
1627 esac
1628 ;;
1629 *)
1630 case "$file" in
1631 */*)
1632 dir=`expr X$file : 'X\(.*\)/'`
1633 file=`expr X$file : 'X.*/\(.*\)'`
1634 (set x $dir; shift; eval $mkdir_p)
6904989c 1635 sh <"$src/$dir/$file"
dfe9444c
AD
1636 ;;
1637 *)
6904989c 1638 sh <"$src/$file"
dfe9444c
AD
1639 ;;
1640 esac
1641 ;;
1642 esac
1643done
6904989c 1644if test -f "$src/config_h.SH"; then
dfe9444c
AD
1645 if test ! -f config.h; then
1646 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1647 . "$src/config_h.SH"
dfe9444c
AD
1648 fi
1649fi
1650EOS
1651
1652: extract files and exit if asked to do so
1653case "$extractsh" in
1654true)
1655 case "$realsilent" in
1656 true) ;;
1657 *) exec 1>&4;;
1658 esac
1659 case "$config_sh" in
1660 '') config_sh='config.sh';;
1661 esac
1662 echo " "
1663 echo "Fetching answers from $config_sh..."
1664 cd ..
1665 . $config_sh
1666 test "$override" && . ./optdef.sh
1667 echo " "
1668 . UU/extract
1669 rm -rf UU
24ccb310 1670 echo "Extraction done."
dfe9444c
AD
1671 exit 0
1672 ;;
1673esac
1674
1675: Eunice requires " " instead of "", can you believe it
1676echo " "
1677: Here we go...
1678echo "Beginning of configuration questions for $package."
1679
1680trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1681
2304df62
AD
1682: first determine how to suppress newline on echo command
1683echo " "
1684echo "Checking echo to see how to suppress newlines..."
1685(echo "hi there\c" ; echo " ") >.echotmp
1686if $contains c .echotmp >/dev/null 2>&1 ; then
1687 echo "...using -n."
1688 n='-n'
1689 c=''
1690else
1691 cat <<'EOM'
1692...using \c
1693EOM
1694 n=''
1695 c='\c'
1696fi
1697echo $n "The star should be here-->$c"
1698echo '*'
1699rm -f .echotmp
1700
1701: Now test for existence of everything in MANIFEST
1702echo " "
6904989c 1703if test -f "$rsrc/MANIFEST"; then
2304df62 1704 echo "First let's make sure your kit is complete. Checking..." >&4
6904989c 1705 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | split -50
2304df62 1706 rm -f missing
dfe9444c 1707 tmppwd=`pwd`
2304df62 1708 for filelist in x??; do
6904989c 1709 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1710 done
1711 if test -s missing; then
1712 cat missing >&4
1713 cat >&4 <<'EOM'
1714
1715THIS PACKAGE SEEMS TO BE INCOMPLETE.
1716
1717You have the option of continuing the configuration process, despite the
1718distinct possibility that your kit is damaged, by typing 'y'es. If you
1719do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1720and contact the author (perlbug@perl.org).
2304df62
AD
1721
1722EOM
1723 echo $n "Continue? [n] $c" >&4
1724 read ans
1725 case "$ans" in
1726 y*)
1727 echo "Continuing..." >&4
1728 rm -f missing
1729 ;;
1730 *)
1731 echo "ABORTING..." >&4
1732 kill $$
1733 ;;
1734 esac
1735 else
dfe9444c 1736 echo "Looks good..."
2304df62
AD
1737 fi
1738else
1739 echo "There is no MANIFEST file. I hope your kit is complete !"
1740fi
1741rm -f missing x??
1742
5ff3f7a4
GS
1743echo " "
1744: Find the appropriate value for a newline for tr
1745if test -n "$DJGPP"; then
1746 trnl='\012'
1747fi
1748if test X"$trnl" = X; then
1749 case "`echo foo|tr '\n' x 2>/dev/null`" in
1750 foox) trnl='\n' ;;
1751 esac
1752fi
1753if test X"$trnl" = X; then
1754 case "`echo foo|tr '\012' x 2>/dev/null`" in
1755 foox) trnl='\012' ;;
1756 esac
1757fi
1758if test X"$trnl" = X; then
1759 cat <<EOM >&2
1760
1761$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1762
1763EOM
1764 exit 1
1765fi
1766
2304df62
AD
1767: compute the number of columns on the terminal for proper question formatting
1768case "$COLUMNS" in
1769'') COLUMNS='80';;
1770esac
1771
1772: set up the echo used in my read
1773myecho="case \"\$xxxm\" in
1774'') echo $n \"\$rp $c\" >&4;;
1775*) case \"\$rp\" in
1776 '') echo $n \"[\$xxxm] $c\";;
1777 *)
1778 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1779 echo \"\$rp\" >&4
1780 echo $n \"[\$xxxm] $c\" >&4
1781 else
1782 echo $n \"\$rp [\$xxxm] $c\" >&4
1783 fi
1784 ;;
1785 esac;;
1786esac"
1787
1788: now set up to do reads with possible shell escape and default assignment
1789cat <<EOSC >myread
28757baa 1790$startsh
2304df62
AD
1791xxxm=\$dflt
1792$myecho
1793ans='!'
1794case "\$fastread" in
1795yes) case "\$dflt" in
1796 '') ;;
1797 *) ans='';
1798 case "\$silent-\$rp" in
1799 true-) ;;
1800 *) echo " " >&4;;
1801 esac;;
1802 esac;;
1803*) case "\$silent" in
1804 true) case "\$rp" in
1805 '') ans='';;
1806 esac;;
1807 esac;;
1808esac
1809while expr "X\$ans" : "X!" >/dev/null; do
1810 read answ
1811 set x \$xxxm
1812 shift
dfe9444c 1813 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1814 case "\$answ" in
dfe9444c
AD
1815 "!")
1816 sh 1>&4
1817 echo " "
1818 $myecho
1819 ;;
1820 !*)
1821 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1822 shift
1823 sh 1>&4 -c "\$*"
1824 echo " "
1825 $myecho
1826 ;;
2304df62
AD
1827 "\$ans")
1828 case "\$ans" in
ecfc5424
AD
1829 \\&*)
1830 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1831 shift
1832 case "\$1" in
1833 -d)
1834 fastread=yes
40a7a20a 1835 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1836 ;;
1837 -*)
40a7a20a 1838 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1839 ;;
1840 esac
1841 $myecho
1842 ans=!
1843 ;;
2304df62
AD
1844 esac;;
1845 *)
1846 case "\$aok" in
1847 y)
1848 echo "*** Substitution done -- please confirm."
1849 xxxm="\$ans"
c9795ab7 1850 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1851 xxxm="\$ans"
1852 ans=!
1853 ;;
1854 *)
1855 echo "*** Error -- try again."
1856 ans=!
1857 ;;
1858 esac
1859 $myecho
1860 ;;
1861 esac
1862 case "\$ans\$xxxm\$nostick" in
1863 '')
1864 ans=!
1865 $myecho
1866 ;;
1867 esac
1868done
1869case "\$ans" in
1870'') ans="\$xxxm";;
1871esac
1872EOSC
1873
1874: create .config dir to save info across Configure sessions
1875test -d ../.config || mkdir ../.config
1876cat >../.config/README <<EOF
1877This directory created by Configure to save information that should
dfe9444c 1878persist across sessions for $package.
2304df62
AD
1879
1880You may safely delete it if you wish.
1881EOF
1882
9507cadf 1883xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 1884case "$usedevel" in
0107c034 1885$define|true|[yY]*) ;;
9507cadf 1886*) case "$xversion" in
0107c034
JH
1887 *[13579])
1888 cat >&4 <<EOH
1889*** WHOA THERE!!! ***
1890
1891 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
1892 The version of this $package distribution is $xversion, that is, odd,
1893 (as opposed to even) and that signifies a development release.
3d5d58b1 1894 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
1895
1896 Do ***NOT*** install this into production use.
1897 Data corruption and crashes are possible.
1898
1899 It is most seriously suggested that you do not continue any further
1900 unless you want to help in developing and debugging Perl.
1901
6adc6a45
JH
1902 If you *still* want to build perl, you can answer 'y' now,
1903 or pass -Dusedevel to Configure.
1904
0107c034
JH
1905EOH
1906 rp='Do you really want to continue?'
1907 dflt='n'
1908 . ./myread
1909 case "$ans" in
8feeef0e
JH
1910 [yY]) echo >&4 "Okay, continuing."
1911 usedevel="$define" ;;
0107c034
JH
1912 *) echo >&4 "Okay, bye."
1913 exit 1
1914 ;;
1915 esac
1916 ;;
1917 esac
1918 ;;
1919esac
8feeef0e
JH
1920case "$usedevel" in
1921$define|true|[yY]*)
1922 case "$versiononly" in
1923 '') versiononly="$define" ;;
1924 esac
1925 case "$installusrbinperl" in
1926 '') installusrbinperl="$undef" ;;
1927 esac
1928 ;;
1929esac
0107c034 1930
2304df62
AD
1931: general instructions
1932needman=true
1933firsttime=true
760ac839 1934user=`(logname) 2>/dev/null`
dfe9444c
AD
1935case "$user" in
1936'') user=`whoami 2>&1`;;
760ac839 1937esac
2304df62
AD
1938if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1939 firsttime=false
1940 echo " "
1941 rp='Would you like to see the instructions?'
1942 dflt=n
1943 . ./myread
1944 case "$ans" in
1945 [yY]*) ;;
1946 *) needman=false;;
1947 esac
1948fi
1949if $needman; then
1950 cat <<EOH
4e2a5f63 1951
2304df62 1952This installation shell script will examine your system and ask you questions
a0d0e21e 1953to determine how the perl5 package should be installed. If you get
2304df62
AD
1954stuck on a question, you may use a ! shell escape to start a subshell or
1955execute a command. Many of the questions will have default answers in square
1956brackets; typing carriage return will give you the default.
1957
1958On some of the questions which ask for file or directory names you are allowed
1959to use the ~name construct to specify the login directory belonging to "name",
1960even if you don't have a shell which knows about that. Questions where this is
1961allowed will be marked "(~name ok)".
1962
1963EOH
1964 rp=''
1965 dflt='Type carriage return to continue'
1966 . ./myread
1967 cat <<'EOH'
1968
1969The prompter used in this script allows you to use shell variables and
1970backticks in your answers. You may use $1, $2, etc... to refer to the words
1971in the default answer, as if the default line was a set of arguments given to a
1972script shell. This means you may also use $* to repeat the whole default line,
1973so you do not have to re-type everything to add something to the default.
1974
1975Everytime there is a substitution, you will have to confirm. If there is an
1976error (e.g. an unmatched backtick), the default answer will remain unchanged
1977and you will be prompted again.
1978
1979If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1980the questions and use the computed defaults (or the previous answers if there
1981was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1982You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1983on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1984
1985EOH
1986 . ./myread
1987 cat <<EOH
1988
1989Much effort has been expended to ensure that this shell script will run on any
1990Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1991Configure and run it again. If you can't run Configure for some reason,
1992you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 1993have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
1994
1995This installation script affects things in two ways:
1996
19971) it may do direct variable substitutions on some of the files included
1998 in this kit.
19992) it builds a config.h file for inclusion in C programs. You may edit
2000 any of these files as the need arises after running this script.
2001
2002If you make a mistake on a question, there is no easy way to back up to it
2003currently. The easiest thing to do is to edit config.sh and rerun all the SH
2004files. Configure will offer to let you do this before it runs the SH files.
2005
2006EOH
2007 dflt='Type carriage return to continue'
2008 . ./myread
2009 case "$firsttime" in
2010 true) echo $user >>../.config/instruct;;
2011 esac
2012fi
2013
2304df62
AD
2014: find out where common programs are
2015echo " "
2016echo "Locating common programs..." >&4
2017cat <<EOSC >loc
2018$startsh
2019case \$# in
20200) exit 1;;
2021esac
2022thing=\$1
2023shift
2024dflt=\$1
2025shift
2026for dir in \$*; do
2027 case "\$thing" in
2028 .)
2029 if test -d \$dir/\$thing; then
2030 echo \$dir
2031 exit 0
2032 fi
2033 ;;
2034 *)
a0d0e21e 2035 for thisthing in \$dir/\$thing; do
ecfc5424 2036 : just loop through to pick last item
a0d0e21e 2037 done
25f94b33 2038 if test -f \$thisthing; then
a0d0e21e 2039 echo \$thisthing
2304df62 2040 exit 0
a5a94ea5
JH
2041 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2042 echo \$thisthing
2043 exit 0
2304df62 2044 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2045 if test -n "$DJGPP"; then
2046 echo \$dir/\$thing.exe
2047 else
2048 : on Eunice apparently
2049 echo \$dir/\$thing
2050 fi
2304df62
AD
2051 exit 0
2052 fi
2053 ;;
2054 esac
2055done
2056echo \$dflt
2057exit 1
2058EOSC
2059chmod +x loc
2060$eunicefix loc
2061loclist="
2062awk
2063cat
f8006fac 2064chmod
b4eb6b3d
JH
2065comm
2066cp
2304df62
AD
2067echo
2068expr
2069grep
a0d0e21e 2070ls
b4eb6b3d 2071mkdir
2304df62
AD
2072rm
2073sed
b4eb6b3d 2074sort
85e6fe83 2075touch
2304df62 2076tr
b4eb6b3d 2077uniq
2304df62
AD
2078"
2079trylist="
2080Mcc
dfe9444c 2081ar
3659ebf1 2082bison
b4eb6b3d 2083byacc
2304df62 2084cpp
b4eb6b3d 2085csh
2304df62
AD
2086date
2087egrep
1fef16b3 2088gmake
8ff267be 2089gzip
b4eb6b3d 2090less
8ff267be 2091ln
3c728e00 2092make
b4eb6b3d 2093more
693762b4 2094nm
b4eb6b3d
JH
2095nroff
2096pg
2304df62
AD
2097test
2098uname
8ff267be 2099zip
2304df62 2100"
8e07c86e 2101pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2102pth="$pth /lib /usr/lib"
2103for file in $loclist; do
dfe9444c
AD
2104 eval xxx=\$$file
2105 case "$xxx" in
2106 /*|?:[\\/]*)
2107 if test -f "$xxx"; then
2108 : ok
2109 else
2110 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2111 xxx=`./loc $file $file $pth`
2112 fi
2113 ;;
2114 '') xxx=`./loc $file $file $pth`;;
2115 *) xxx=`./loc $xxx $xxx $pth`;;
2116 esac
a5a94ea5 2117 eval $file=$xxx$_exe
2304df62
AD
2118 eval _$file=$xxx
2119 case "$xxx" in
2120 /*)
2121 echo $file is in $xxx.
2122 ;;
8e07c86e
AD
2123 ?:[\\/]*)
2124 echo $file is in $xxx.
2125 ;;
2304df62 2126 *)
25f94b33
AD
2127 echo "I don't know where '$file' is, and my life depends on it." >&4
2128 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2129 exit 1
2304df62
AD
2130 ;;
2131 esac
2132done
2133echo " "
2134echo "Don't worry if any of the following aren't found..."
2135say=offhand
2136for file in $trylist; do
dfe9444c
AD
2137 eval xxx=\$$file
2138 case "$xxx" in
2139 /*|?:[\\/]*)
2140 if test -f "$xxx"; then
2141 : ok
2142 else
2143 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2144 xxx=`./loc $file $file $pth`
2145 fi
2146 ;;
2147 '') xxx=`./loc $file $file $pth`;;
2148 *) xxx=`./loc $xxx $xxx $pth`;;
2149 esac
306a8474 2150 eval $file=$xxx$_exe
2304df62
AD
2151 eval _$file=$xxx
2152 case "$xxx" in
2153 /*)
2154 echo $file is in $xxx.
2155 ;;
8e07c86e
AD
2156 ?:[\\/]*)
2157 echo $file is in $xxx.
2158 ;;
2304df62
AD
2159 *)
2160 echo "I don't see $file out there, $say."
2161 say=either
2162 ;;
2163 esac
2164done
2165case "$egrep" in
1fef16b3 2166egrep)
2304df62
AD
2167 echo "Substituting grep for egrep."
2168 egrep=$grep
868439a2 2169 _egrep=$grep
2304df62
AD
2170 ;;
2171esac
8ff267be 2172case "$ln" in
1fef16b3 2173ln)
8ff267be
PP
2174 echo "Substituting cp for ln."
2175 ln=$cp
868439a2 2176 _ln=$cp
8ff267be
PP
2177 ;;
2178esac
2e26f1d5
JH
2179case "$make" in
2180make)
2181 case "$gmake" in
2182 gmake)
2183 echo "I can't find make or gmake, and my life depends on it." >&4
2184 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2185 exit 1
2186 ;;
2187 esac
2188 ;;
2189esac
2190case "$gmake" in
2191gmake) ;;
2192*) # We can't have osname yet.
1fef16b3
JH
2193 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2194 # Assume that gmake, if found, is definitely GNU make
2195 # and prefer it over the system make.
2196 echo "Substituting gmake for make."
2197 make=$gmake
868439a2 2198 _make=$gmake
1fef16b3
JH
2199 fi
2200 ;;
a5a94ea5 2201esac
2304df62
AD
2202case "$test" in
2203test)
2204 echo "Hopefully test is built into your sh."
2205 ;;
2206*)
73614538 2207 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2208 echo "Using the test built into your sh."
2304df62
AD
2209 test=test
2210 _test=test
2211 fi
2212 ;;
2213esac
2214case "$echo" in
2215echo)
2216 echo "Hopefully echo is built into your sh."
2217 ;;
2218'') ;;
2219*)
2220 echo " "
2221echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2222 $echo $n "hi there$c" >foo1
2223 echo $n "hi there$c" >foo2
2224 if cmp foo1 foo2 >/dev/null 2>&1; then
2225 echo "They are compatible. In fact, they may be identical."
2226 else
2227 case "$n" in
2228 '-n') n='' c='\c';;
2229 *) n='-n' c='';;
2230 esac
2231 cat <<FOO
2232They are not compatible! You are probably running ksh on a non-USG system.
2233I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2234have echo built in and we may have to run some Bourne shell scripts. That
2235means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2236
2237FOO
2238 $echo $n "The star should be here-->$c"
2239 $echo "*"
2240 fi
2241 $rm -f foo1 foo2
2242 ;;
2243esac
2244
2573c5f9
JH
2245cat <<EOS >checkcc
2246$startsh
2247EOS
2248cat <<'EOSC' >>checkcc
2249case "$cc" in
2250'') ;;
2251*) $rm -f try try.*
2252 $cat >try.c <<EOM
2253int main(int argc, char *argv[]) {
2254 return 0;
2255}
2256EOM
e4778687 2257 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2258 :
2259 else
2260 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2261 despair=yes
2262 trygcc=yes
2263 case "$cc" in
2264 *gcc*) trygcc=no ;;
2265 esac
2266 case "`$cc -v -c try.c 2>&1`" in
2267 *gcc*) trygcc=no ;;
2268 esac
2269 if $test X"$trygcc" = Xyes; then
2270 if gcc -o try -c try.c; then
2271 echo " "
2272 echo "You seem to have a working gcc, though." >&4
2273 rp="Would you like to use it?"
2274 dflt=y
2275 if $test -f myread; then
2276 . ./myread
2277 else
2278 if $test -f UU/myread; then
2279 . ./UU/myread
2280 else
2281 echo "Cannot find myread, sorry. Aborting." >&2
2282 exit 1
2283 fi
2284 fi
2285 case "$ans" in
e723fc21 2286 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2573c5f9
JH
2287 esac
2288 fi
2289 fi
2290 if $test X"$despair" = Xyes; then
5dd4fbdf
MB
2291 $cat >&4 <<EOM
2292You need to find a working C compiler.
2293Either (purchase and) install the C compiler supplied by your OS vendor,
2294or for a free C compiler try http://gcc.gnu.org/
2295I cannot continue any further, aborting.
2296EOM
2573c5f9
JH
2297 exit 1
2298 fi
2299 fi
2300 $rm -f try try.*
2301 ;;
2302esac
2303EOSC
2304
a0d0e21e
LW
2305: determine whether symbolic links are supported
2306echo " "
2307$touch blurfl
2308if $ln -s blurfl sym > /dev/null 2>&1 ; then
2309 echo "Symbolic links are supported." >&4
18ea2752 2310 lns="$ln$_exe -s"
a0d0e21e
LW
2311else
2312 echo "Symbolic links are NOT supported." >&4
2313 lns="$ln"
2314fi
2315$rm -f blurfl sym
2316
dafca956
JH
2317: determine whether symbolic links are supported
2318echo " "
2319case "$lns" in
18ea2752 2320*"ln"*" -s")
dafca956
JH
2321 echo "Checking how to test for symbolic links..." >&4
2322 $lns blurfl sym
4b661809 2323 if $test "X$issymlink" = X; then
2e2a97a6
JH
2324 case "$newsh" in
2325 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2326 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2327 esac
5d644a95
MB
2328 if test $? = 0; then
2329 issymlink="test -h"
2e2a97a6
JH
2330 else
2331 echo "Your builtin 'test -h' may be broken." >&4
2332 case "$test" in
2333 /*) ;;
2334 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2335 for p in $pth
2336 do
2337 if test -f "$p/$test"; then
2338 test="$p/$test"
2339 break
2340 fi
2341 done
2342 ;;
2343 esac
2344 case "$test" in
2345 /*)
2346 echo "Trying external '$test -h'." >&4
2347 issymlink="$test -h"
2348 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2349 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2350 issymlink=''
2351 fi
2352 ;;
2353 *) issymlink='' ;;
2354 esac
5d644a95
MB
2355 fi
2356 fi
4b661809 2357 if $test "X$issymlink" = X; then
dafca956 2358 if $test -L sym 2>/dev/null; then
5d644a95 2359 issymlink="$test -L"
2e2a97a6 2360 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2361 fi
2362 fi
4b661809 2363 if $test "X$issymlink" != X; then
5d644a95 2364 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2365 else
2366 echo "I do not know how you can test for symbolic links." >&4
2367 fi
2368 $rm -f blurfl sym
2369 ;;
2370*) echo "No symbolic links, so not testing for their testing..." >&4
2371 ;;
2372esac
2373echo " "
2374
2375
2376case "$mksymlinks" in
2377$define|true|[yY]*)
2378 case "$src" in
2379 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2380 exit 1
2381 ;;
4b661809 2382 *) case "$lns:$issymlink" in
7a800fca 2383 *"ln -s:"*"test -"?)
dafca956
JH
2384 echo "Creating the symbolic links..." >&4
2385 echo "(First creating the subdirectories...)" >&4
2386 cd ..
2387 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2388 read directory
2389 test -z "$directory" && break
2390 mkdir -p $directory
2391 done
2392 # Sanity check 1.
2393 if test ! -d t/base; then
2394 echo "Failed to create the subdirectories. Aborting." >&4
2395 exit 1
2396 fi
2397 echo "(Then creating the symlinks...)" >&4
2398 awk '{print $1}' $src/MANIFEST | while true; do
2399 read filename
2400 test -z "$filename" && break
2401 if test -f $filename; then
5d644a95 2402 if $issymlink $filename; then
dafca956
JH
2403 rm -f $filename
2404 fi
2405 fi
2406 if test -f $filename; then
2407 echo "$filename already exists, not symlinking."
2408 else
2409 ln -s $src/$filename $filename
2410 fi
2411 done
2412 # Sanity check 2.
a0d24b8a
JH
2413 if test ! -f t/base/lex.t; then
2414 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2415 exit 1
2416 fi
2417 cd UU
2418 ;;
2419 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2420 ;;
2421 esac
2422 ;;
2423 esac
2424 ;;
2425esac
2426
5440bc8e
JH
2427
2428case "$usecrosscompile" in
2429$define|true|[yY]*)
93bc48fa 2430 $echo "Cross-compiling..."
5440bc8e
JH
2431 croak=''
2432 case "$cc" in
2433 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2434 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2435 ar=$targetarch-ar
2436 # leave out ld, choosing it is more complex
2437 nm=$targetarch-nm
2438 ranlib=$targetarch-ranlib
93bc48fa 2439 $echo 'extern int foo;' > try.c
f8006fac 2440 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2441 shift
2442 if $test $# -gt 0; then
2443 incpth="$incpth $*"
f8006fac
JH
2444 incpth="`$echo $incpth|$sed 's/^ //'`"
2445 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2446 for i in $*; do
f8006fac 2447 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2448 if $test -d $j; then
2449 libpth="$libpth $j"
2450 fi
2451 done
f8006fac
JH
2452 libpth="`$echo $libpth|$sed 's/^ //'`"
2453 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2454 fi
2455 $rm -f try.c
5440bc8e
JH
2456 ;;
2457 esac
2458 case "$targetarch" in
93bc48fa
JH
2459 '') echo "Targetarch not defined." >&4; croak=y ;;
2460 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2461 esac
2462 case "$incpth" in
93bc48fa 2463 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2464 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2465 esac
2466 case "$libpth" in
93bc48fa 2467 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2468 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2469 esac
93bc48fa
JH
2470 case "$usrinc" in
2471 '') for i in $incpth; do
2472 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2473 usrinc=$i
2474 echo "Guessing usrinc $usrinc." >&4
2475 break
2476 fi
2477 done
2478 case "$usrinc" in
2479 '') echo "Usrinc not defined." >&4; croak=y ;;
2480 esac
2481 ;;
2482 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2483 esac
93bc48fa
JH
2484 case "$targethost" in
2485 '') echo "Targethost not defined." >&4; croak=y ;;
2486 *) echo "Using targethost $targethost." >&4
5440bc8e 2487 esac
93bc48fa
JH
2488 locincpth=' '
2489 loclibpth=' '
5440bc8e 2490 case "$croak" in
93bc48fa 2491 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2492 esac
2493 case "$src" in
2494 /*) run=$src/Cross/run
93c0359c 2495 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2496 to=$src/Cross/to
2497 from=$src/Cross/from
2498 ;;
93bc48fa 2499 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2500 run=$pwd/Cross/run
f8006fac 2501 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2502 to=$pwd/Cross/to
2503 from=$pwd/Cross/from
2504 ;;
2505 esac
2506 case "$targetrun" in
2507 '') targetrun=ssh ;;
2508 esac
2509 case "$targetto" in
2510 '') targetto=scp ;;
2511 esac
2512 case "$targetfrom" in
2513 '') targetfrom=scp ;;
2514 esac
2515 run=$run-$targetrun
2516 to=$to-$targetto
2517 from=$from-$targetfrom
93bc48fa
JH
2518 case "$targetdir" in
2519 '') targetdir=/tmp
2520 echo "Guessing targetdir $targetdir." >&4
2521 ;;
2522 esac
5440bc8e 2523 case "$targetuser" in
93bc48fa
JH
2524 '') targetuser=root
2525 echo "Guessing targetuser $targetuser." >&4
2526 ;;
5440bc8e
JH
2527 esac
2528 case "$targetfrom" in
2529 scp) q=-q ;;
2530 *) q='' ;;
2531 esac
2532 case "$targetrun" in
2533 ssh|rsh)
2534 cat >$run <<EOF
2535#!/bin/sh
93c0359c
JH
2536case "\$1" in
2537-cwd)
2538 shift
2539 cwd=\$1
2540 shift
2541 ;;
2542esac
2543case "\$cwd" in
2544'') cwd=$targetdir ;;
2545esac
5440bc8e
JH
2546exe=\$1
2547shift
93c0359c
JH
2548if $test ! -f \$exe.xok; then
2549 $to \$exe
2550 $touch \$exe.xok
2551fi
2552$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2553EOF
2554 ;;
93bc48fa 2555 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2556 exit 1
2557 ;;
2558 esac
93c0359c
JH
2559 case "$targetmkdir" in
2560 */Cross/mkdir)
2561 cat >$targetmkdir <<EOF
2562#!/bin/sh
2563$targetrun -l $targetuser $targethost "mkdir -p \$@"
2564EOF
f8006fac 2565 $chmod a+rx $targetmkdir
93c0359c
JH
2566 ;;
2567 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2568 exit 1
2569 ;;
2570 esac
5440bc8e
JH
2571 case "$targetto" in
2572 scp|rcp)
2573 cat >$to <<EOF
2574#!/bin/sh
2575for f in \$@
2576do
93c0359c
JH
2577 case "\$f" in
2578 /*)
2579 $targetmkdir \`dirname \$f\`
2580 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2581 ;;
2582 *)
2583 $targetmkdir $targetdir/\`dirname \$f\`
2584 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2585 ;;
2586 esac
5440bc8e
JH
2587done
2588exit 0
2589EOF
2590 ;;
2591 cp) cat >$to <<EOF
2592#!/bin/sh
93c0359c
JH
2593for f in \$@
2594do
2595 case "\$f" in
2596 /*)
2597 $mkdir -p $targetdir/\`dirname \$f\`
2598 $cp \$f $targetdir/\$f || exit 1
2599 ;;
2600 *)
2601 $targetmkdir $targetdir/\`dirname \$f\`
2602 $cp \$f $targetdir/\$f || exit 1
2603 ;;
2604 esac
2605done
2606exit 0
5440bc8e
JH
2607EOF
2608 ;;
93bc48fa 2609 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2610 exit 1
2611 ;;
2612 esac
2613 case "$targetfrom" in
2614 scp|rcp)
2615 cat >$from <<EOF
2616#!/bin/sh
2617for f in \$@
2618do
93c0359c 2619 $rm -f \$f
5440bc8e
JH
2620 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2621done
2622exit 0
2623EOF
2624 ;;
2625 cp) cat >$from <<EOF
2626#!/bin/sh
2627for f in \$@
2628do
93c0359c 2629 $rm -f \$f
5440bc8e
JH
2630 cp $targetdir/\$f . || exit 1
2631done
2632exit 0
2633EOF
2634 ;;
93bc48fa 2635 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2636 exit 1
2637 ;;
2638 esac
93bc48fa
JH
2639 if $test ! -f $run; then
2640 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2641 else
f8006fac 2642 $chmod a+rx $run
5440bc8e 2643 fi
93bc48fa
JH
2644 if $test ! -f $to; then
2645 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2646 else
f8006fac 2647 $chmod a+rx $to
5440bc8e 2648 fi
93bc48fa
JH
2649 if $test ! -f $from; then
2650 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2651 else
f8006fac 2652 $chmod a+rx $from
5440bc8e 2653 fi
93bc48fa 2654 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2655 exit 1
2656 fi
2657 cat >&4 <<EOF
f8006fac
JH
2658Using '$run' for remote execution,
2659and '$from' and '$to'
93bc48fa 2660for remote file transfer.
5440bc8e
JH
2661EOF
2662 ;;
2663*) run=''
2664 to=:
2665 from=:
2666 usecrosscompile='undef'
2667 targetarch=''
2668 ;;
2669esac
2670
ecfc5424
AD
2671: see whether [:lower:] and [:upper:] are supported character classes
2672echo " "
ecfc5424
AD
2673case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2674ABYZ)
2675 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2676 up='[:upper:]'
2677 low='[:lower:]'
2678 ;;
28e8609d
JH
2679*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2680 # (0xc9 and 0xd1), therefore that is a nice testing point.
2681 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2682 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2683 ij) up='[A-Z]'
2684 low='[a-z]'
2685 ;;
2686 esac
2687 fi
2688 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2689 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2690 ij) up='A-Z'
2691 low='a-z'
2692 ;;
2693 esac
2694 fi
2695 if test "X$up" = X -o "X$low" = X; then
2696 case "`echo IJ | od -x 2>/dev/null`" in
2697 *C9D1*|*c9d1*)
2698 echo "Hey, this might be EBCDIC." >&4
2699 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2700 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2701 ij) up='[A-IJ-RS-Z]'
2702 low='[a-ij-rs-z]'
2703 ;;
2704 esac
2705 fi
2706 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2707 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2708 ij) up='A-IJ-RS-Z'
2709 low='a-ij-rs-z'
2710 ;;
2711 esac
2712 fi
2713 ;;
2714 esac
2715 fi
2716esac
3eaeeeae 2717case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2718ij)
2719 echo "Using $up and $low to convert case." >&4
2720 ;;
ecfc5424 2721*)
28e8609d
JH
2722 echo "I don't know how to translate letters from upper to lower case." >&4
2723 echo "Your tr is not acting any way I know of." >&4
2724 exit 1
2725 ;;
ecfc5424
AD
2726esac
2727: set up the translation script tr, must be called with ./tr of course
2728cat >tr <<EOSC
2729$startsh
2730case "\$1\$2" in
2731'[A-Z][a-z]') exec $tr '$up' '$low';;
2732'[a-z][A-Z]') exec $tr '$low' '$up';;
2733esac
2734exec $tr "\$@"
2735EOSC
2736chmod +x tr
2737$eunicefix tr
2738
2304df62
AD
2739: Try to determine whether config.sh was made on this system
2740case "$config_sh" in
2741'')
43999f95
JH
2742myuname=`$uname -a 2>/dev/null`
2743$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2744# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2745# because the A-Z/a-z are not consecutive.
a0d0e21e 2746myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2747 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2748newmyuname="$myuname"
2304df62 2749dflt=n
16d20bd9
AD
2750case "$knowitall" in
2751'')
2752 if test -f ../config.sh; then
2753 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2754 eval "`grep myuname= ../config.sh`"
2755 fi
2756 if test "X$myuname" = "X$newmyuname"; then
2757 dflt=y
2758 fi
2304df62 2759 fi
16d20bd9
AD
2760 ;;
2761*) dflt=y;;
2762esac
2304df62
AD
2763
2764: Get old answers from old config file if Configure was run on the
2765: same system, otherwise use the hints.
2766hint=default
2767cd ..
2768if test -f config.sh; then
16d20bd9
AD
2769 echo " "
2770 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2771 . UU/myread
2772 case "$ans" in
f83701cd
AD
2773 n*|N*) echo "OK, I'll ignore it."
2774 mv config.sh config.sh.old
2775 myuname="$newmyuname"
2776 ;;
2304df62 2777 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2778 tmp_n="$n"
2779 tmp_c="$c"
85cad39c 2780 tmp_sh="$sh"
2304df62
AD
2781 . ./config.sh
2782 cp config.sh UU
ecfc5424
AD
2783 n="$tmp_n"
2784 c="$tmp_c"
85cad39c
PP
2785 : Older versions did not always set $sh. Catch re-use of such
2786 : an old config.sh.
2787 case "$sh" in
2788 '') sh="$tmp_sh" ;;
2789 esac
2304df62
AD
2790 hint=previous
2791 ;;
2792 esac
2793fi
2573c5f9 2794. ./UU/checkcc
2304df62
AD
2795if test ! -f config.sh; then
2796 $cat <<EOM
2797
4e2a5f63
AD
2798First time through, eh? I have some defaults handy for some systems
2799that need some extra help getting the Configure answers right:
2304df62
AD
2800
2801EOM
dfe9444c 2802 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2803 dflt=''
2804 : Half the following guesses are probably wrong... If you have better
7f2de2d2 2805 : tests or hints, please send them to perlbug@perl.org
2304df62 2806 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2807 $test -f /irix && osname=irix
85e6fe83
LW
2808 $test -f /xenix && osname=sco_xenix
2809 $test -f /dynix && osname=dynix
2810 $test -f /dnix && osname=dnix
5f05dabc
PP
2811 $test -f /lynx.os && osname=lynxos
2812 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2813 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2814 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2815 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2816 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2817 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2818 $test -d /usr/apollo/bin && osname=apollo
2819 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2820 $test -d /usr/include/minix && osname=minix
d54344fc 2821 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 2822 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2823 osname=machten
4633a7c4 2824 if $test -x /sbin/version; then
dfe9444c 2825 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2826 $sed -e 's/[A-Za-z]$//'`
2827 elif $test -x /usr/etc/version; then
dfe9444c 2828 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2829 $sed -e 's/[A-Za-z]$//'`
2830 else
2831 osvers="$2.$3"
2832 fi
2833 fi
aaacdc8b
GS
2834
2835 $test -f /sys/posix.dll &&
2836 $test -f /usr/bin/what &&
2837 set X `/usr/bin/what /sys/posix.dll` &&
2838 $test "$3" = UWIN &&
2839 osname=uwin &&
2840 osvers="$5"
2841
2304df62
AD
2842 if $test -f $uname; then
2843 set X $myuname
2844 shift
2845
2304df62 2846 case "$5" in
85e6fe83 2847 fps*) osname=fps ;;
2304df62
AD
2848 mips*)
2849 case "$4" in
85e6fe83
LW
2850 umips) osname=umips ;;
2851 *) osname=mips ;;
2304df62 2852 esac;;
85e6fe83
LW
2853 [23]100) osname=mips ;;
2854 next*) osname=next ;;
ecfc5424 2855 i386*)
c6912327
JH
2856 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2857 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2858 osname='sco'
2859 osvers=$tmp
2860 elif $test -f /etc/kconfig; then
ecfc5424 2861 osname=isc
bd628c73 2862 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2863 osvers=4
2864 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2865 osvers=3
2304df62 2866 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2867 osvers=2
ecfc5424
AD
2868 fi
2869 fi
2000072c 2870 tmp=''
ecfc5424 2871 ;;
c4f23d77
AD
2872 pc*)
2873 if test -n "$DJGPP"; then
2874 osname=dos
2875 osvers=djgpp
2876 fi
2877 ;;
2304df62
AD
2878 esac
2879
2880 case "$1" in
a0d0e21e
LW
2881 aix) osname=aix
2882 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2883 case "$tmp" in
1aef975c 2884 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2885 '<3240'|'<>3240') osvers=3.2.0 ;;
2886 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2887 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2888 *) osvers=$tmp;;
a0d0e21e
LW
2889 esac
2890 ;;
aaacdc8b
GS
2891 bsd386) osname=bsd386
2892 osvers=`$uname -r`
2893 ;;
2894 cygwin*) osname=cygwin
2895 osvers="$3"
2896 ;;
23f87696
SZ
2897 *dc.osx) osname=dcosx
2898 osvers="$3"
2899 ;;
a0d0e21e
LW
2900 dnix) osname=dnix
2901 osvers="$3"
2902 ;;
2903 domainos) osname=apollo
2904 osvers="$3"
2905 ;;
2906 dgux) osname=dgux
2907 osvers="$3"
2908 ;;
760ac839 2909 dynixptx*) osname=dynixptx
e58e581d 2910 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2911 ;;
a0d0e21e
LW
2912 freebsd) osname=freebsd
2913 osvers="$3" ;;
2914 genix) osname=genix ;;
2915 hp*) osname=hpux
bfb7748a 2916 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2917 ;;
a78b0d02 2918 irix*) osname=irix
a0d0e21e
LW
2919 case "$3" in
2920 4*) osvers=4 ;;
2921 5*) osvers=5 ;;
ecfc5424 2922 *) osvers="$3" ;;
a0d0e21e
LW
2923 esac
2924 ;;
2925 linux) osname=linux
2926 case "$3" in
a0d0e21e
LW
2927 *) osvers="$3" ;;
2928 esac
2929 ;;
28e8609d
JH
2930 MiNT) osname=mint
2931 ;;
2932 netbsd*) osname=netbsd
ecfc5424
AD
2933 osvers="$3"
2934 ;;
4e81affe
MMIJG
2935 news-os) osvers="$3"
2936 case "$3" in
2937 4*) osname=newsos4 ;;
2938 *) osname=newsos ;;
2939 esac
2940 ;;
aaacdc8b 2941 next*) osname=next ;;
28bb1e2c 2942 nonstop-ux) osname=nonstopux ;;
aaacdc8b
GS
2943 POSIX-BC | posix-bc ) osname=posix-bc
2944 osvers="$3"
a0d0e21e 2945 ;;
ae3afa4e
TH
2946 powerux | power_ux | powermax_os | powermaxos | \
2947 powerunix | power_unix) osname=powerux
2948 osvers="$3"
2949 ;;
aaacdc8b
GS
2950 qnx) osname=qnx
2951 osvers="$4"
2952 ;;
a0d0e21e
LW
2953 solaris) osname=solaris
2954 case "$3" in
2955 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2956 *) osvers="$3" ;;
a0d0e21e
LW
2957 esac
2958 ;;
85e6fe83
LW
2959 sunos) osname=sunos
2960 case "$3" in
85e6fe83
LW
2961 5*) osname=solaris
2962 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2963 *) osvers="$3" ;;
2304df62
AD
2964 esac
2965 ;;
a0d0e21e 2966 titanos) osname=titanos
85e6fe83 2967 case "$3" in
a0d0e21e
LW
2968 1*) osvers=1 ;;
2969 2*) osvers=2 ;;
2970 3*) osvers=3 ;;
2971 4*) osvers=4 ;;
ecfc5424 2972 *) osvers="$3" ;;
2304df62
AD
2973 esac
2974 ;;
85e6fe83 2975 ultrix) osname=ultrix
ecfc5424 2976 osvers="$3"
2304df62 2977 ;;
28757baa 2978 osf1|mls+) case "$5" in
fed7345c
AD
2979 alpha)
2980 osname=dec_osf
2aa76180
JH
2981 osvers=`sizer -v | awk '{print $3}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2982 case "$osvers" in
2983 [1-9].[0-9]*) ;;
2984 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2985 esac
ecfc5424
AD
2986 ;;
2987 hp*) osname=hp_osf1 ;;
2988 mips) osname=mips_osf1 ;;
85e6fe83
LW
2989 esac
2990 ;;
0337d152
A
2991 unixware) osname=svr5
2992 osvers="$4"
2993 ;;
3c728e00 2994 uts) osname=uts
a0d0e21e
LW
2995 osvers="$3"
2996 ;;
3c728e00
JH
2997 vos) osvers="$3"
2998 ;;
85e6fe83 2999 $2) case "$osname" in
2304df62 3000 *isc*) ;;
a0d0e21e 3001 *freebsd*) ;;
5f05dabc 3002 svr*)
a0d0e21e
LW
3003 : svr4.x or possibly later
3004 case "svr$3" in
3005 ${osname}*)
3006 osname=svr$3
3007 osvers=$4
3008 ;;
3009 esac
3010 case "$osname" in
3011 svr4.0)
3012 : Check for ESIX
3013 if test -f /stand/boot ; then
3014 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3015 if test -n "$INITPROG" -a -f "$INITPROG"; then
3016 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3017 if test -n "$isesix"; then
a0d0e21e
LW
3018 osname=esix4
3019 fi
3020 fi
3021 fi
3022 ;;
3023 esac
3024 ;;
2304df62 3025 *) if test -f /etc/systemid; then
a0d0e21e
LW
3026 osname=sco
3027 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3028 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3029 osvers=$1.$2.$3
c4f23d77 3030 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3031 osvers=$1.$2
c4f23d77 3032 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3033 osvers=$1
2304df62 3034 fi
a0d0e21e
LW
3035 else
3036 case "$osname" in
3037 '') : Still unknown. Probably a generic Sys V.
3038 osname="sysv"
3039 osvers="$3"
3040 ;;
3041 esac
2304df62
AD
3042 fi
3043 ;;
3044 esac
3045 ;;
a0d0e21e
LW
3046 *) case "$osname" in
3047 '') : Still unknown. Probably a generic BSD.
3048 osname="$1"
3049 osvers="$3"
3050 ;;
3051 esac
3052 ;;
2304df62
AD
3053 esac
3054 else
dfe9444c
AD
3055 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3056 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3057 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3058 osname=news_os
2304df62 3059 fi
dfe9444c 3060 $rm -f UU/kernel.what
8e07c86e
AD
3061 elif test -d c:/.; then
3062 set X $myuname
3063 osname=os2
3064 osvers="$5"
2304df62
AD
3065 fi
3066 fi
85e6fe83 3067
5440bc8e
JH
3068 case "$targetarch" in
3069 '') ;;
3070 *) hostarch=$osname
3071 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3072 osvers=''
3073 ;;
3074 esac
3075
a0d0e21e
LW
3076 : Now look for a hint file osname_osvers, unless one has been
3077 : specified already.
3078 case "$hintfile" in
3079 ''|' ')
1e127011 3080 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3081 : Also try without trailing minor version numbers.
1e127011
DD
3082 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3083 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3084 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3085 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3086 case "$file" in
3087 '') dflt=none ;;
3088 *) case "$osvers" in
3089 '') dflt=$file
3090 ;;
dfe9444c 3091 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3092 dflt=$file
dfe9444c 3093 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3094 dflt=$xfile
dfe9444c 3095 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3096 dflt=$xxfile
dfe9444c 3097 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3098 dflt=$xxxfile
dfe9444c 3099 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3100 dflt=$xxxxfile
dfe9444c 3101 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3102 dflt="${osname}"
3103 else
3104 dflt=none
3105 fi
3106 ;;
3107 esac
85e6fe83
LW
3108 ;;
3109 esac
4e2a5f63
AD
3110 if $test -f Policy.sh ; then
3111 case "$dflt" in
3112 *Policy*) ;;
3113 none) dflt="Policy" ;;
3114 *) dflt="Policy $dflt" ;;
3115 esac
3116 fi
85e6fe83 3117 ;;
a0d0e21e 3118 *)
ecfc5424 3119 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3120 ;;
2304df62 3121 esac
1aef975c 3122
4e2a5f63
AD
3123 if $test -f Policy.sh ; then
3124 $cat <<EOM
3125
3126There's also a Policy hint file available, which should make the
3127site-specific (policy) questions easier to answer.
3128EOM
3129
3130 fi
3131
2304df62
AD
3132 $cat <<EOM
3133
3134You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 3135A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 3136is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
3137
3138EOM
4e2a5f63 3139
2304df62 3140 rp="Which of these apply, if any?"
dfe9444c 3141 . UU/myread
85e6fe83
LW
3142 tans=$ans
3143 for file in $tans; do
4e2a5f63
AD
3144 if $test X$file = XPolicy -a -f Policy.sh; then
3145 . Policy.sh
3146 $cat Policy.sh >> UU/config.sh
3147 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3148 . $src/hints/$file.sh
3149 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3150 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3151 : nothing
3152 else
85e6fe83
LW
3153 : Give one chance to correct a possible typo.
3154 echo "$file.sh does not exist"
3155 dflt=$file
3156 rp="hint to use instead?"
dfe9444c 3157 . UU/myread
85e6fe83 3158 for file in $ans; do
dfe9444c
AD
3159 if $test -f "$src/hints/$file.sh"; then
3160 . $src/hints/$file.sh
3161 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3162 elif $test X$ans = X -o X$ans = Xnone ; then
3163 : nothing
3164 else
3165 echo "$file.sh does not exist -- ignored."
3166 fi
3167 done
2304df62
AD
3168 fi
3169 done
85e6fe83 3170
2304df62 3171 hint=recommended
85e6fe83 3172 : Remember our hint file for later.
dfe9444c 3173 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3174 hintfile="$file"
85e6fe83 3175 else
a0d0e21e 3176 hintfile=''
85e6fe83 3177 fi
2304df62
AD
3178fi
3179cd UU
3180;;
3181*)
3182 echo " "
3183 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3184 tmp_n="$n"
3185 tmp_c="$c"
2304df62
AD
3186 cd ..
3187 cp $config_sh config.sh 2>/dev/null
a78b0d02 3188 chmod +w config.sh
2304df62
AD
3189 . ./config.sh
3190 cd UU
3191 cp ../config.sh .
ecfc5424
AD
3192 n="$tmp_n"
3193 c="$tmp_c"
2304df62
AD
3194 hint=previous
3195 ;;
3196esac
1aef975c 3197test "$override" && . ./optdef.sh
2304df62
AD
3198
3199: Restore computed paths
3200for file in $loclist $trylist; do
3201 eval $file="\$_$file"
3202done
3203
85e6fe83 3204cat << EOM
a0d0e21e 3205
85e6fe83 3206Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3207The default value is probably right if the name rings a bell. Otherwise,
3208since spelling matters for me, either accept the default or answer "none"
3209to leave it blank.
a0d0e21e 3210
85e6fe83 3211EOM
85e6fe83 3212case "$osname" in
a0d0e21e 3213 ''|' ')
85e6fe83 3214 case "$hintfile" in
a0d0e21e 3215 ''|' '|none) dflt=none ;;
ecfc5424 3216 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3217 esac
3218 ;;
3219 *) dflt="$osname" ;;
3220esac
3221rp="Operating system name?"
3222. ./myread
3223case "$ans" in
ecfc5424
AD
3224none) osname='' ;;
3225*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3226esac
8ff267be
PP
3227echo " "
3228case "$osvers" in
3229 ''|' ')
3230 case "$hintfile" in
3231 ''|' '|none) dflt=none ;;
3232 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3233 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3234 case "$dflt" in
3235 ''|' ') dflt=none ;;
3236 esac
3237 ;;
3238 esac
3239 ;;
3240 *) dflt="$osvers" ;;
3241esac
3242rp="Operating system version?"
3243. ./myread
3244case "$ans" in
3245none) osvers='' ;;
3246*) osvers="$ans" ;;
3247esac
3248
02e93a22
JH
3249
3250. ./posthint.sh
3251
2304df62 3252: who configured the system
59b83a6f 3253cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 3254cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
3255case "$cf_by" in
3256"")
8ff267be 3257 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
3258 case "$cf_by" in
3259 "") cf_by=unknown ;;
8ff267be
PP
3260 esac ;;
3261esac
2304df62 3262
b4eb6b3d
JH
3263: set up the script used to warn in case of inconsistency
3264cat <<EOS >whoa
3265$startsh
3266EOS
3267cat <<'EOSC' >>whoa
3268dflt=y
3269echo " "
3270echo "*** WHOA THERE!!! ***" >&4
3271echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3272rp=" Keep the $hint value?"
3273. ./myread
3274case "$ans" in
3275y) td=$was; tu=$was;;
3276esac
3277EOSC
3278
3279: function used to set $1 to $val
3280setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3281case "$val$was" in
3282$define$undef) . ./whoa; eval "$var=\$td";;
3283$undef$define) . ./whoa; eval "$var=\$tu";;
3284*) eval "$var=$val";;
3285esac'
3286
3287case "$usethreads" in
3288$define|true|[yY]*) dflt='y';;
3289*) dflt='n';;
3290esac
3291cat <<EOM
3292
3293Perl can be built to take advantage of threads on some systems.
3294To do so, Configure can be run with -Dusethreads.
3295
3296Note that threading is a highly experimental feature, and
3297some known race conditions still remain. If you choose to try
3298it, be very sure to not actually deploy it for production
3299purposes. README.threads has more details, and is required
3300reading if you enable threads.
3301
3302If this doesn't make any sense to you, just accept the default '$dflt'.
3303EOM
3304rp='Build a threading Perl?'
3305. ./myread
3306case "$ans" in
3307y|Y) val="$define" ;;
3308*) val="$undef" ;;
3309esac
3310set usethreads
3311eval $setvar
3312
3313case "$usethreads" in
3314$define)
3315 $cat <<EOM
3316
3317As of 5.5.640, Perl has two different internal threading implementations,
3318the 5.005 version (5005threads) and an interpreter-based version
3319(ithreads) that has one interpreter per thread. Both are very
3320experimental. This arrangement exists to help developers work out
3321which one is better.
3322
3323If you're a casual user, you probably don't want interpreter-threads
1a060de3
JH
3324at this time. But if you do, the 'threads' module allows their use,
3325and the 'Thread' module offers an interface to both 5005threads and
3326ithreads (whichever has been configured).
b4eb6b3d
JH
3327EOM
3328 : Default to ithreads unless overridden on command line or with
3329 : old config.sh
3330 dflt='y'
3331 case "$use5005threads" in
3332 $define|true|[yY]*) dflt='n';;
3333 esac
3334 case "$useithreads" in
3335 $undef|false|[nN]*) dflt='n';;
3336 esac
3337 rp='Use interpreter-based ithreads?'
3338 . ./myread
3339 case "$ans" in
3340 y|Y) val="$define" ;;
3341 *) val="$undef" ;;
3342 esac
3343 set useithreads
3344 eval $setvar
3345 : Now set use5005threads to the opposite value.
3346 case "$useithreads" in
3347 $define) val="$undef" ;;
3348 *) val="$define" ;;
3349 esac
3350 set use5005threads
3351 eval $setvar
3352 ;;
3353*)
3354 useithreads="$undef"
3355 use5005threads="$undef"
3356 ;;
3357esac
3358
c915ce7f
JH
3359case "$useithreads$use5005threads" in
3360"$define$define")
3361 $cat >&4 <<EOM
3362
3363You cannot have both the ithreads and the 5.005 threads enabled
3364at the same time. Disabling the 5.005 threads since they are
3365much less stable than the ithreads.
3366
3367EOM
3368 use5005threads="$undef"
3369 ;;
3370esac
3371
b4eb6b3d
JH
3372case "$d_oldpthreads" in
3373'') : Configure tests would be welcome here. For now, assume undef.
3374 val="$undef" ;;
3375*) val="$d_oldpthreads" ;;
3376esac
3377set d_oldpthreads
3378eval $setvar
3379
3380
3381case "$usethreads" in
3382"$define"|true|[yY]*)
3383: Look for a hint-file generated 'call-back-unit'. If the
3384: user has specified that a threading perl is to be built,
3385: we may need to set or change some other defaults.
3386 if $test -f usethreads.cbu; then
3387 echo "Your platform has some specific hints for threaded builds, using them..."
3388 . ./usethreads.cbu
3389 else
3390 $cat <<EOM
3391(Your platform doesn't have any specific hints for threaded builds.
3392 Assuming POSIX threads, then.)
3393EOM
3394 fi
3395 ;;
3396esac
3397
3398cat <<EOM
3399
3400Perl can be built so that multiple Perl interpreters can coexist
3401within the same Perl executable.
3402EOM
3403
3404case "$useithreads" in
3405$define)
3406 cat <<EOM
3407This multiple interpreter support is required for interpreter-based threads.
3408EOM
3409 val="$define"
3410 ;;
3411*) case "$usemultiplicity" in
3412 $define|true|[yY]*) dflt='y';;
3413 *) dflt='n';;
3414 esac
3415 echo " "
3416 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3417 rp='Build Perl for multiplicity?'
3418 . ./myread
3419 case "$ans" in
3420 y|Y) val="$define" ;;
3421 *) val="$undef" ;;
3422 esac
3423 ;;
3424esac
3425set usemultiplicity
3426eval $setvar
3427
96056487
JH
3428
3429case "$usemorebits" in
3430"$define"|true|[yY]*)
3431 use64bitint="$define"
3432 uselongdouble="$define"
3433 usemorebits="$define"
3434 ;;
3435*) usemorebits="$undef"
3436 ;;
3437esac
3438
e5e20432
JH
3439: make some quick guesses about what we are up against
3440echo " "
3441$echo $n "Hmm... $c"
3442echo exit 1 >bsd
3443echo exit 1 >usg
3444echo exit 1 >v7
3445echo exit 1 >osf1
3446echo exit 1 >eunice
3447echo exit 1 >xenix
3448echo exit 1 >venix
3449echo exit 1 >os2
3450d_bsd="$undef"
3451$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3452if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3453then
3454 echo "Looks kind of like an OSF/1 system, but we'll see..."
3455 echo exit 0 >osf1
381aa1ff 3456elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3457 xxx=`./loc addbib blurfl $pth`
3458 if $test -f $xxx; then
3459 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3460 echo exit 0 >bsd
3461 echo exit 0 >usg
3462 else
3463 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3464 echo "Looks kind of like an extended USG system, but we'll see..."
3465 else
3466 echo "Looks kind of like a USG system, but we'll see..."
3467 fi
3468 echo exit 0 >usg
3469 fi
3470elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3471 echo "Looks kind of like a BSD system, but we'll see..."
3472 d_bsd="$define"
3473 echo exit 0 >bsd
3474else
3475 echo "Looks kind of like a Version 7 system, but we'll see..."
3476 echo exit 0 >v7
3477fi
3478case "$eunicefix" in
3479*unixtovms*)
3480 $cat <<'EOI'
3481There is, however, a strange, musty smell in the air that reminds me of
3482something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3483EOI
3484 echo exit 0 >eunice
3485 d_eunice="$define"
3486: it so happens the Eunice I know will not run shell scripts in Unix format
3487 ;;
3488*)
3489 echo " "
3490 echo "Congratulations. You aren't running Eunice."
3491 d_eunice="$undef"
3492 ;;
3493esac
3494: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3495: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3496: semicolon as a patch separator
e5e20432
JH
3497case "$p_" in
3498:) ;;
3499*)
3500 $cat <<'EOI'
3501I have the feeling something is not exactly right, however...don't tell me...
3502lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3503(Or you may be running DOS with DJGPP.)
e5e20432
JH
3504EOI
3505 echo exit 0 >os2
3506 ;;
3507esac
3508if test -f /xenix; then
3509 echo "Actually, this looks more like a XENIX system..."
3510 echo exit 0 >xenix
3511 d_xenix="$define"
3512else
3513 echo " "
3514 echo "It's not Xenix..."
3515 d_xenix="$undef"
3516fi
3517chmod +x xenix
3518$eunicefix xenix
3519if test -f /venix; then
3520 echo "Actually, this looks more like a VENIX system..."
3521 echo exit 0 >venix
3522else
3523 echo " "
3524 if ./xenix; then
3525 : null
3526 else
3527 echo "Nor is it Venix..."
3528 fi
3529fi
3530chmod +x bsd usg v7 osf1 eunice xenix venix os2
3531$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3532$rm -f foo
3533
5869b1f1
JH
3534case "$cc" in
3535'') dflt=cc;;
3536*) dflt="$cc";;
3537esac
3538rp="Use which C compiler?"
3539. ./myread
3540cc="$ans"
e5e20432
JH
3541: Look for a hint-file generated 'call-back-unit'. Now that the
3542: user has specified the compiler, we may need to set or change some
3543: other defaults.
3544if $test -f cc.cbu; then
3545 . ./cc.cbu
3546fi
2573c5f9 3547. ./checkcc
8a27cf78 3548
e5e20432
JH
3549echo " "
3550echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 3551$cat >try.c <<EOM
e5e20432
JH
3552#include <stdio.h>
3553int main() {
3554#ifdef __GNUC__
3555#ifdef __VERSION__
3556 printf("%s\n", __VERSION__);
3557#else
3558 printf("%s\n", "1");
3559#endif
3560#endif
3561 exit(0);
3562}
3563EOM
5440bc8e
JH
3564if $cc -o try $ccflags $ldflags try.c; then
3565 gccversion=`$run ./try`
e5e20432
JH
3566 case "$gccversion" in
3567 '') echo "You are not using GNU cc." ;;
fc68435e 3568 *) echo "You are using GNU cc $gccversion."
e723fc21 3569 ccname=gcc
fc68435e 3570 ;;
e5e20432
JH
3571 esac
3572else
3573 echo " "
3574 echo "*** WHOA THERE!!! ***" >&4
3575 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3576 case "$knowitall" in
3577 '')
3578 echo " You'd better start hunting for one and let me know about it." >&4
3579 exit 1
3580 ;;
3581 esac
3582fi
5440bc8e 3583$rm -f try try.*
e5e20432
JH
3584case "$gccversion" in
35851*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3586esac
5b463ca7
KS
3587case "$gccversion" in
3588'') gccosandvers='' ;;
10b4ebb5
JH
3589*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3590 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3591 gccshortvers=''
5b463ca7 3592 case "$gccosandvers" in
02903077
JH
3593 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3594 $osname$osvers) ;; # looking good
5b463ca7
KS
3595 $osname*) cat <<EOM >&4
3596
3597*** WHOA THERE!!! ***
3598
3599 Your gcc has not been compiled for the exact release of
3600 your operating system ($gccosandvers versus $osname$osvers).
3601
3602 In general it is a good idea to keep gcc synchronized with
3603 the operating system because otherwise serious problems
3604 may ensue when trying to compile software, like Perl.
3605
3606 I'm trying to be optimistic here, though, and will continue.
3607 If later during the configuration and build icky compilation
02903077
JH
3608 problems appear (headerfile conflicts being the most common
3609 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3610 your operating system release.
3611
3612EOM
3613 ;;
81575342 3614 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3615 esac
3616 ;;
3617esac
e723fc21
JH
3618case "$ccname" in
3619'') ccname="$cc" ;;
3620esac
e5e20432 3621
640374d0 3622
bd9b35c9
JH
3623: decide how portable to be. Allow command line overrides.
3624case "$d_portable" in
3625"$undef") ;;
3626*) d_portable="$define" ;;
104d25b7 3627esac
85ab1d1d 3628
bd9b35c9
JH
3629: set up shell script to do ~ expansion
3630cat >filexp <<EOSS
3631$startsh
3632: expand filename
3633case "\$1" in
3634 ~/*|~)
3635 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3636 ;;
3637 ~*)
3638 if $test -f /bin/csh; then
3639 /bin/csh -f -c "glob \$1"
3640 failed=\$?
3641 echo ""
3642 exit \$failed
e5e20432 3643 else
bd9b35c9
JH
3644 name=\`$expr x\$1 : '..\([^/]*\)'\`
3645 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3646 if $test ! -d "\$dir"; then
3647 me=\`basename \$0\`
3648 echo "\$me: can't locate home directory for: \$name" >&2
3649 exit 1
3650 fi
3651 case "\$1" in
3652 */*)
3653 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3654 ;;
3655 *)
3656 echo \$dir
e5e20432
JH
3657 ;;
3658 esac
3659 fi
b691c02f 3660 ;;
4633a7c4 3661*)
bd9b35c9 3662 echo \$1
2304df62
AD
3663 ;;
3664esac
4633a7c4
LW
3665EOSS
3666chmod +x filexp
3667$eunicefix filexp
2304df62
AD
3668
3669: now set up to get a file name
28757baa
PP
3670cat <<EOS >getfile
3671$startsh
3672EOS
3673cat <<'EOSC' >>getfile
2304df62
AD
3674tilde=''
3675fullpath=''
3676already=''
3677skip=''
3678none_ok=''
3679exp_file=''
a0d0e21e 3680nopath_ok=''
2304df62
AD
3681orig_rp="$rp"
3682orig_dflt="$dflt"
b233458b
JH
3683case "$gfpth" in
3684'') gfpth='.' ;;
3685esac
2304df62
AD
3686
3687case "$fn" in
ecfc5424 3688*\(*)
381aa1ff 3689 expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
3690 fn=`echo $fn | sed 's/(.*)//'`
3691 ;;
3692esac
3693
3694case "$fn" in
a0d0e21e
LW
3695*:*)
3696 loc_file=`expr $fn : '.*:\(.*\)'`
3697 fn=`expr $fn : '\(.*\):.*'`
3698 ;;
3699esac
3700
3701case "$fn" in
2304df62
AD
3702*~*) tilde=true;;
3703esac
3704case "$fn" in
3705*/*) fullpath=true;;
3706esac
3707case "$fn" in
3708*+*) skip=true;;
3709esac
3710case "$fn" in
3711*n*) none_ok=true;;
3712esac
3713case "$fn" in
3714*e*) exp_file=true;;
3715esac
a0d0e21e
LW
3716case "$fn" in
3717*p*) nopath_ok=true;;
3718esac
2304df62
AD
3719
3720case "$fn" in
3721*f*) type='File';;
3722*d*) type='Directory';;
a0d0e21e 3723*l*) type='Locate';;
2304df62
AD
3724esac
3725
3726what="$type"
3727case "$what" in
3728Locate) what='File';;
3729esac
3730
3731case "$exp_file" in
3732'')
3733 case "$d_portable" in
3734 "$define") ;;
3735 *) exp_file=true;;
3736 esac
3737 ;;
3738esac
3739
3740cd ..
3741while test "$type"; do
3742 redo=''
3743 rp="$orig_rp"
3744 dflt="$orig_dflt"
3745 case "$tilde" in
3746 true) rp="$rp (~name ok)";;
3747 esac
3748 . UU/myread
ecfc5424
AD
3749 if test -f UU/getfile.ok && \
3750 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3751 then
3752 value="$ans"
3753 ansexp="$ans"
3754 break
3755 fi
2304df62
AD
3756 case "$ans" in
3757 none)
3758 value=''
3759 ansexp=''
3760 case "$none_ok" in
3761 true) type='';;
3762 esac
3763 ;;
3764 *)
3765 case "$tilde" in
3766 '') value="$ans"
3767 ansexp="$ans";;
3768 *)
3769 value=`UU/filexp $ans`
3770 case $? in
3771 0)
3772 if test "$ans" != "$value"; then
ecfc5424 3773 echo "(That expands to $value on this system.)"
2304df62
AD
3774 fi
3775 ;;
3776 *) value="$ans";;
3777 esac
3778 ansexp="$value"
3779 case "$exp_file" in
3780 '') value="$ans";;
3781 esac
3782 ;;
3783 esac
3784 case "$fullpath" in
3785 true)
3786 case "$ansexp" in
3787 /*) value="$ansexp" ;;
23da6c43 3788 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
3789 *)
3790 redo=true
3791 case "$already" in
3792 true)
3793 echo "I shall only accept a full path name, as in /bin/ls." >&4
3794 echo "Use a ! shell escape if you wish to check pathnames." >&4
3795 ;;
3796 *)
3797 echo "Please give a full path name, starting with slash." >&4
3798 case "$tilde" in
3799 true)
3800 echo "Note that using ~name is ok provided it expands well." >&4
3801 already=true
3802 ;;
3803 esac
3804 esac
3805 ;;
3806 esac
3807 ;;
3808 esac
3809 case "$redo" in
3810 '')
3811 case "$type" in
3812 File)
b233458b
JH
3813 for fp in $gfpth; do
3814 if test "X$fp" = X.; then
3815 pf="$ansexp"
3816 else
3817 pf="$fp/$ansexp"
3818 fi
3819 if test -f "$pf"; then
3820 type=''
3821 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3822 then
3823 echo "($value is not a plain file, but that's ok.)"
3824 type=''
3825 fi
3826 if test X"$type" = X; then
3827 value="$pf"
3828 break
3829 fi
3830 done
2304df62
AD
3831 ;;
3832 Directory)
b233458b
JH
3833 for fp in $gfpth; do
3834 if test "X$fp" = X.; then
f78bfc9c
JH
3835 dir="$ans"
3836 direxp="$ansexp"
b233458b 3837 else
dd858076 3838 dir="$fp/$ansexp"
f78bfc9c 3839 direxp="$fp/$ansexp"
b233458b 3840 fi
f78bfc9c 3841 if test -d "$direxp"; then
b233458b 3842 type=''
f78bfc9c 3843 value="$dir"
b233458b
JH
3844 break
3845 fi
3846 done
2304df62
AD
3847 ;;
3848 Locate)
40000a8c 3849 if test -d "$ansexp"; then
a0d0e21e
LW
3850 echo "(Looking for $loc_file in directory $value.)"
3851 value="$value/$loc_file"
40000a8c 3852 ansexp="$ansexp/$loc_file"
2304df62 3853 fi
40000a8c 3854 if test -f "$ansexp"; then
2304df62
AD
3855 type=''
3856 fi
a0d0e21e
LW
3857 case "$nopath_ok" in
3858 true) case "$value" in
3859 */*) ;;
3860 *) echo "Assuming $value will be in people's path."
3861 type=''
3862 ;;
3863 esac
3864 ;;
3865 esac
2304df62
AD
3866 ;;
3867 esac
3868
3869 case "$skip" in
3870 true) type='';
3871 esac
3872
3873 case "$type" in
3874 '') ;;
3875 *)
3876 if test "$fastread" = yes; then
3877 dflt=y
3878 else
3879 dflt=n
3880 fi
3881 rp="$what $value doesn't exist. Use that name anyway?"
3882 . UU/myread
3883 dflt=''
3884 case "$ans" in
3885 y*) type='';;
3886 *) echo " ";;
3887 esac
3888 ;;
3889 esac
3890 ;;
3891 esac
3892 ;;
3893 esac
3894done
3895cd UU
3896ans="$value"
3897rp="$orig_rp"
3898dflt="$orig_dflt"
ecfc5424 3899rm -f getfile.ok
b233458b 3900test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3901EOSC
3902
bd9b35c9
JH
3903: What should the include directory be ?
3904echo " "
3905$echo $n "Hmm... $c"
3906dflt='/usr/include'
3907incpath=''
3908mips_type=''
3909if $test -f /bin/mips && /bin/mips; then
3910 echo "Looks like a MIPS system..."
3911 $cat >usr.c <<'EOCP'
3912#ifdef SYSTYPE_BSD43
3913/bsd43
3914#endif
3915EOCP
8a27cf78 3916 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
3917 dflt='/bsd43/usr/include'
3918 incpath='/bsd43'
3919 mips_type='BSD 4.3'
3920 else
3921 mips_type='System V'
3922 fi
3923 $rm -f usr.c usr.out
3924 echo "and you're compiling with the $mips_type compiler and libraries."
3925 xxx_prompt=y
3926 echo "exit 0" >mips
3927else
3928 echo "Doesn't look like a MIPS system."
3929 xxx_prompt=n
3930 echo "exit 1" >mips
3931fi
3932chmod +x mips
3933$eunicefix mips
3934case "$usrinc" in
3935'') ;;
3936*) dflt="$usrinc";;
3937esac
3938case "$xxx_prompt" in
3939y) fn=d/
3940 echo " "
3941 rp='Where are the include files you want to use?'
3942 . ./getfile
3943 usrinc="$ans"
8e07c86e 3944 ;;
bd9b35c9 3945*) usrinc="$dflt"
8e07c86e
AD
3946 ;;
3947esac
2304df62 3948
96056487
JH
3949: see how we invoke the C preprocessor
3950echo " "
3951echo "Now, how can we feed standard input to your C preprocessor..." >&4
3952cat <<'EOT' >testcpp.c
3953#define ABC abc
3954#define XYZ xyz
3955ABC.XYZ
3956EOT
3957cd ..
3958if test ! -f cppstdin; then
3959 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3960 # AIX cc -E doesn't show the absolute headerfile
3961 # locations but we'll cheat by using the -M flag.
3962 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
3963 else
3964 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3965 fi
3966else
3967 echo "Keeping your $hint cppstdin wrapper."
3968fi
3969chmod 755 cppstdin
3970wrapper=`pwd`/cppstdin
3971ok='false'
3972cd UU
3973
3974if $test "X$cppstdin" != "X" && \
3975 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3976 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3977then
3978 echo "You used to use $cppstdin $cppminus so we'll use that again."
3979 case "$cpprun" in
3980 '') echo "But let's see if we can live without a wrapper..." ;;
3981 *)
3982 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3983 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3984 then
3985 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3986 ok='true'
3987 else
3988 echo "(However, $cpprun $cpplast does not work, let's see...)"
3989 fi
3990 ;;
3991 esac
3992else
3993 case "$cppstdin" in
3994 '') ;;
3995 *)
3996 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3997 ;;
3998 esac
3999fi
4000
4001if $ok; then
4002 : nothing
4003elif echo 'Maybe "'"$cc"' -E" will work...'; \
4004 $cc -E <testcpp.c >testcpp.out 2>&1; \
4005 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4006 echo "Yup, it does."
4007 x_cpp="$cc -E"
4008 x_minus='';
4009elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4010 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4011 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4012 echo "Yup, it does."
4013 x_cpp="$cc -E"
4014 x_minus='-';
4015elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4016 $cc -P <testcpp.c >testcpp.out 2>&1; \
4017 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4018 echo "Yipee, that works!"
4019 x_cpp="$cc -P"
4020 x_minus='';
4021elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4022 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4023 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4024 echo "At long last!"
4025 x_cpp="$cc -P"
4026 x_minus='-';
4027elif echo 'No such luck, maybe "'$cpp'" will work...'; \