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