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