This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_ncmp() and pp_scmp() should return numeric values, not booleans.
[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#
caf85fe8 23# Generated on Tue Mar 13 05:21:04 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
PP
1048: Find the basic shell for Bourne shell scripts
1049case "$sh" in
1050'')
8ff267be
PP
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
PP
1068 break
1069 elif test -f "$xxx.exe"; then
1070 sh="$xxx";
8ff267be
PP
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
PP
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
PP
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
PP
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
6adc6a45
JH
1807 If you *still* want to build perl, you can answer 'y' now,
1808 or pass -Dusedevel to Configure.
1809
0107c034
JH
1810EOH
1811 rp='Do you really want to continue?'
1812 dflt='n'
1813 . ./myread
1814 case "$ans" in
8feeef0e
JH
1815 [yY]) echo >&4 "Okay, continuing."
1816 usedevel="$define" ;;
0107c034
JH
1817 *) echo >&4 "Okay, bye."
1818 exit 1
1819 ;;
1820 esac
1821 ;;
1822 esac
1823 ;;
1824esac
8feeef0e
JH
1825case "$usedevel" in
1826$define|true|[yY]*)
1827 case "$versiononly" in
1828 '') versiononly="$define" ;;
1829 esac
1830 case "$installusrbinperl" in
1831 '') installusrbinperl="$undef" ;;
1832 esac
1833 ;;
1834esac
0107c034 1835
2304df62
AD
1836: general instructions
1837needman=true
1838firsttime=true
760ac839 1839user=`(logname) 2>/dev/null`
dfe9444c
AD
1840case "$user" in
1841'') user=`whoami 2>&1`;;
760ac839 1842esac
2304df62
AD
1843if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1844 firsttime=false
1845 echo " "
1846 rp='Would you like to see the instructions?'
1847 dflt=n
1848 . ./myread
1849 case "$ans" in
1850 [yY]*) ;;
1851 *) needman=false;;
1852 esac
1853fi
1854if $needman; then
1855 cat <<EOH
4e2a5f63 1856
2304df62 1857This installation shell script will examine your system and ask you questions
a0d0e21e 1858to determine how the perl5 package should be installed. If you get
2304df62
AD
1859stuck on a question, you may use a ! shell escape to start a subshell or
1860execute a command. Many of the questions will have default answers in square
1861brackets; typing carriage return will give you the default.
1862
1863On some of the questions which ask for file or directory names you are allowed
1864to use the ~name construct to specify the login directory belonging to "name",
1865even if you don't have a shell which knows about that. Questions where this is
1866allowed will be marked "(~name ok)".
1867
1868EOH
1869 rp=''
1870 dflt='Type carriage return to continue'
1871 . ./myread
1872 cat <<'EOH'
1873
1874The prompter used in this script allows you to use shell variables and
1875backticks in your answers. You may use $1, $2, etc... to refer to the words
1876in the default answer, as if the default line was a set of arguments given to a
1877script shell. This means you may also use $* to repeat the whole default line,
1878so you do not have to re-type everything to add something to the default.
1879
1880Everytime there is a substitution, you will have to confirm. If there is an
1881error (e.g. an unmatched backtick), the default answer will remain unchanged
1882and you will be prompted again.
1883
1884If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1885the questions and use the computed defaults (or the previous answers if there
1886was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1887You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1888on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1889
1890EOH
1891 . ./myread
1892 cat <<EOH
1893
1894Much effort has been expended to ensure that this shell script will run on any
1895Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1896Configure and run it again. If you can't run Configure for some reason,
1897you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 1898have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
1899
1900This installation script affects things in two ways:
1901
19021) it may do direct variable substitutions on some of the files included
1903 in this kit.
19042) it builds a config.h file for inclusion in C programs. You may edit
1905 any of these files as the need arises after running this script.
1906
1907If you make a mistake on a question, there is no easy way to back up to it
1908currently. The easiest thing to do is to edit config.sh and rerun all the SH
1909files. Configure will offer to let you do this before it runs the SH files.
1910
1911EOH
1912 dflt='Type carriage return to continue'
1913 . ./myread
1914 case "$firsttime" in
1915 true) echo $user >>../.config/instruct;;
1916 esac
1917fi
1918
2304df62
AD
1919: find out where common programs are
1920echo " "
1921echo "Locating common programs..." >&4
1922cat <<EOSC >loc
1923$startsh
1924case \$# in
19250) exit 1;;
1926esac
1927thing=\$1
1928shift
1929dflt=\$1
1930shift
1931for dir in \$*; do
1932 case "\$thing" in
1933 .)
1934 if test -d \$dir/\$thing; then
1935 echo \$dir
1936 exit 0
1937 fi
1938 ;;
1939 *)
a0d0e21e 1940 for thisthing in \$dir/\$thing; do
ecfc5424 1941 : just loop through to pick last item
a0d0e21e 1942 done
25f94b33 1943 if test -f \$thisthing; then
a0d0e21e 1944 echo \$thisthing
2304df62
AD
1945 exit 0
1946 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
1947 if test -n "$DJGPP"; then
1948 echo \$dir/\$thing.exe
1949 else
1950 : on Eunice apparently
1951 echo \$dir/\$thing
1952 fi
2304df62
AD
1953 exit 0
1954 fi
1955 ;;
1956 esac
1957done
1958echo \$dflt
1959exit 1
1960EOSC
1961chmod +x loc
1962$eunicefix loc
1963loclist="
1964awk
1965cat
b4eb6b3d
JH
1966comm
1967cp
2304df62
AD
1968echo
1969expr
1970grep
a0d0e21e 1971ls
dfe9444c 1972make
b4eb6b3d 1973mkdir
2304df62
AD
1974rm
1975sed
b4eb6b3d 1976sort
85e6fe83 1977touch
2304df62 1978tr
b4eb6b3d 1979uniq
2304df62
AD
1980"
1981trylist="
1982Mcc
dfe9444c 1983ar
3659ebf1 1984bison
b4eb6b3d 1985byacc
2304df62 1986cpp
b4eb6b3d 1987csh
2304df62
AD
1988date
1989egrep
8ff267be 1990gzip
b4eb6b3d 1991less
8ff267be 1992ln
b4eb6b3d 1993more
693762b4 1994nm
b4eb6b3d
JH
1995nroff
1996pg
2304df62
AD
1997test
1998uname
8ff267be 1999zip
2304df62 2000"
8e07c86e 2001pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2002pth="$pth /lib /usr/lib"
2003for file in $loclist; do
dfe9444c
AD
2004 eval xxx=\$$file
2005 case "$xxx" in
2006 /*|?:[\\/]*)
2007 if test -f "$xxx"; then
2008 : ok
2009 else
2010 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2011 xxx=`./loc $file $file $pth`
2012 fi
2013 ;;
2014 '') xxx=`./loc $file $file $pth`;;
2015 *) xxx=`./loc $xxx $xxx $pth`;;
2016 esac
2304df62
AD
2017 eval $file=$xxx
2018 eval _$file=$xxx
2019 case "$xxx" in
2020 /*)
2021 echo $file is in $xxx.
2022 ;;
8e07c86e
AD
2023 ?:[\\/]*)
2024 echo $file is in $xxx.
2025 ;;
2304df62 2026 *)
25f94b33
AD
2027 echo "I don't know where '$file' is, and my life depends on it." >&4
2028 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2029 exit 1
2304df62
AD
2030 ;;
2031 esac
2032done
2033echo " "
2034echo "Don't worry if any of the following aren't found..."
2035say=offhand
2036for file in $trylist; do
dfe9444c
AD
2037 eval xxx=\$$file
2038 case "$xxx" in
2039 /*|?:[\\/]*)
2040 if test -f "$xxx"; then
2041 : ok
2042 else
2043 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2044 xxx=`./loc $file $file $pth`
2045 fi
2046 ;;
2047 '') xxx=`./loc $file $file $pth`;;
2048 *) xxx=`./loc $xxx $xxx $pth`;;
2049 esac
2304df62
AD
2050 eval $file=$xxx
2051 eval _$file=$xxx
2052 case "$xxx" in
2053 /*)
2054 echo $file is in $xxx.
2055 ;;
8e07c86e
AD
2056 ?:[\\/]*)
2057 echo $file is in $xxx.
2058 ;;
2304df62
AD
2059 *)
2060 echo "I don't see $file out there, $say."
2061 say=either
2062 ;;
2063 esac
2064done
2065case "$egrep" in
2066egrep)
2067 echo "Substituting grep for egrep."
2068 egrep=$grep
2069 ;;
2070esac
8ff267be
PP
2071case "$ln" in
2072ln)
2073 echo "Substituting cp for ln."
2074 ln=$cp
2075 ;;
2076esac
2304df62
AD
2077case "$test" in
2078test)
2079 echo "Hopefully test is built into your sh."
2080 ;;
2081*)
73614538 2082 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2083 echo "Using the test built into your sh."
2304df62
AD
2084 test=test
2085 _test=test
2086 fi
2087 ;;
2088esac
2089case "$echo" in
2090echo)
2091 echo "Hopefully echo is built into your sh."
2092 ;;
2093'') ;;
2094*)
2095 echo " "
2096echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2097 $echo $n "hi there$c" >foo1
2098 echo $n "hi there$c" >foo2
2099 if cmp foo1 foo2 >/dev/null 2>&1; then
2100 echo "They are compatible. In fact, they may be identical."
2101 else
2102 case "$n" in
2103 '-n') n='' c='\c';;
2104 *) n='-n' c='';;
2105 esac
2106 cat <<FOO
2107They are not compatible! You are probably running ksh on a non-USG system.
2108I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2109have echo built in and we may have to run some Bourne shell scripts. That
2110means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2111
2112FOO
2113 $echo $n "The star should be here-->$c"
2114 $echo "*"
2115 fi
2116 $rm -f foo1 foo2
2117 ;;
2118esac
2119
2573c5f9
JH
2120cat <<EOS >checkcc
2121$startsh
2122EOS
2123cat <<'EOSC' >>checkcc
2124case "$cc" in
2125'') ;;
2126*) $rm -f try try.*
2127 $cat >try.c <<EOM
2128int main(int argc, char *argv[]) {
2129 return 0;
2130}
2131EOM
7a282f6d 2132 if $cc -o try $ccflags try.c; then
2573c5f9
JH
2133 :
2134 else
2135 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2136 despair=yes
2137 trygcc=yes
2138 case "$cc" in
2139 *gcc*) trygcc=no ;;
2140 esac
2141 case "`$cc -v -c try.c 2>&1`" in
2142 *gcc*) trygcc=no ;;
2143 esac
2144 if $test X"$trygcc" = Xyes; then
2145 if gcc -o try -c try.c; then
2146 echo " "
2147 echo "You seem to have a working gcc, though." >&4
2148 rp="Would you like to use it?"
2149 dflt=y
2150 if $test -f myread; then
2151 . ./myread
2152 else
2153 if $test -f UU/myread; then
2154 . ./UU/myread
2155 else
2156 echo "Cannot find myread, sorry. Aborting." >&2
2157 exit 1
2158 fi
2159 fi
2160 case "$ans" in
e723fc21 2161 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2573c5f9
JH
2162 esac
2163 fi
2164 fi
2165 if $test X"$despair" = Xyes; then
5dd4fbdf
MB
2166 $cat >&4 <<EOM
2167You need to find a working C compiler.
2168Either (purchase and) install the C compiler supplied by your OS vendor,
2169or for a free C compiler try http://gcc.gnu.org/
2170I cannot continue any further, aborting.
2171EOM
2573c5f9
JH
2172 exit 1
2173 fi
2174 fi
2175 $rm -f try try.*
2176 ;;
2177esac
2178EOSC
2179
a0d0e21e
LW
2180: determine whether symbolic links are supported
2181echo " "
2182$touch blurfl
2183if $ln -s blurfl sym > /dev/null 2>&1 ; then
2184 echo "Symbolic links are supported." >&4
2185 lns="$ln -s"
2186else
2187 echo "Symbolic links are NOT supported." >&4
2188 lns="$ln"
2189fi
2190$rm -f blurfl sym
2191
dafca956
JH
2192: determine whether symbolic links are supported
2193echo " "
2194case "$lns" in
2195*"ln -s")
2196 echo "Checking how to test for symbolic links..." >&4
2197 $lns blurfl sym
4b661809 2198 if $test "X$issymlink" = X; then
73614538 2199 sh -c "PATH= test -h sym" >/dev/null 2>&1
5d644a95
MB
2200 if test $? = 0; then
2201 issymlink="test -h"
2202 fi
2203 fi
2204 if $test "X$issymlink" = X; then
73614538 2205 if $test -h >/dev/null 2>&1; then
5d644a95
MB
2206 issymlink="$test -h"
2207 echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2208 fi
dafca956 2209 fi
4b661809 2210 if $test "X$issymlink" = X; then
dafca956 2211 if $test -L sym 2>/dev/null; then
5d644a95 2212 issymlink="$test -L"
dafca956
JH
2213 fi
2214 fi
4b661809 2215 if $test "X$issymlink" != X; then
5d644a95 2216 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2217 else
2218 echo "I do not know how you can test for symbolic links." >&4
2219 fi
2220 $rm -f blurfl sym
2221 ;;
2222*) echo "No symbolic links, so not testing for their testing..." >&4
2223 ;;
2224esac
2225echo " "
2226
2227
2228case "$mksymlinks" in
2229$define|true|[yY]*)
2230 case "$src" in
2231 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2232 exit 1
2233 ;;
4b661809 2234 *) case "$lns:$issymlink" in
7a800fca 2235 *"ln -s:"*"test -"?)
dafca956
JH
2236 echo "Creating the symbolic links..." >&4
2237 echo "(First creating the subdirectories...)" >&4
2238 cd ..
2239 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2240 read directory
2241 test -z "$directory" && break
2242 mkdir -p $directory
2243 done
2244 # Sanity check 1.
2245 if test ! -d t/base; then
2246 echo "Failed to create the subdirectories. Aborting." >&4
2247 exit 1
2248 fi
2249 echo "(Then creating the symlinks...)" >&4
2250 awk '{print $1}' $src/MANIFEST | while true; do
2251 read filename
2252 test -z "$filename" && break
2253 if test -f $filename; then
5d644a95 2254 if $issymlink $filename; then
dafca956
JH
2255 rm -f $filename
2256 fi
2257 fi
2258 if test -f $filename; then
2259 echo "$filename already exists, not symlinking."
2260 else
2261 ln -s $src/$filename $filename
2262 fi
2263 done
2264 # Sanity check 2.
2265 if test ! -f t/base/commonsense.t; then
2266 echo "Failed to create the symlinks. Aborting." >&4
2267 exit 1
2268 fi
2269 cd UU
2270 ;;
2271 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2272 ;;
2273 esac
2274 ;;
2275 esac
2276 ;;
2277esac
2278
ecfc5424
AD
2279: see whether [:lower:] and [:upper:] are supported character classes
2280echo " "
ecfc5424
AD
2281case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2282ABYZ)
2283 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2284 up='[:upper:]'
2285 low='[:lower:]'
2286 ;;
28e8609d
JH
2287*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2288 # (0xc9 and 0xd1), therefore that is a nice testing point.
2289 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2290 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2291 ij) up='[A-Z]'
2292 low='[a-z]'
2293 ;;
2294 esac
2295 fi
2296 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2297 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2298 ij) up='A-Z'
2299 low='a-z'
2300 ;;
2301 esac
2302 fi
2303 if test "X$up" = X -o "X$low" = X; then
2304 case "`echo IJ | od -x 2>/dev/null`" in
2305 *C9D1*|*c9d1*)
2306 echo "Hey, this might be EBCDIC." >&4
2307 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2308 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2309 ij) up='[A-IJ-RS-Z]'
2310 low='[a-ij-rs-z]'
2311 ;;
2312 esac
2313 fi
2314 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2315 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2316 ij) up='A-IJ-RS-Z'
2317 low='a-ij-rs-z'
2318 ;;
2319 esac
2320 fi
2321 ;;
2322 esac
2323 fi
2324esac
3eaeeeae 2325case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2326ij)
2327 echo "Using $up and $low to convert case." >&4
2328 ;;
ecfc5424 2329*)
28e8609d
JH
2330 echo "I don't know how to translate letters from upper to lower case." >&4
2331 echo "Your tr is not acting any way I know of." >&4
2332 exit 1
2333 ;;
ecfc5424
AD
2334esac
2335: set up the translation script tr, must be called with ./tr of course
2336cat >tr <<EOSC
2337$startsh
2338case "\$1\$2" in
2339'[A-Z][a-z]') exec $tr '$up' '$low';;
2340'[a-z][A-Z]') exec $tr '$low' '$up';;
2341esac
2342exec $tr "\$@"
2343EOSC
2344chmod +x tr
2345$eunicefix tr
2346
2304df62
AD
2347: Try to determine whether config.sh was made on this system
2348case "$config_sh" in
2349'')
43999f95
JH
2350myuname=`$uname -a 2>/dev/null`
2351$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2352# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2353# because the A-Z/a-z are not consecutive.
a0d0e21e 2354myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2355 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2356newmyuname="$myuname"
2304df62 2357dflt=n
16d20bd9
AD
2358case "$knowitall" in
2359'')
2360 if test -f ../config.sh; then
2361 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2362 eval "`grep myuname= ../config.sh`"
2363 fi
2364 if test "X$myuname" = "X$newmyuname"; then
2365 dflt=y
2366 fi
2304df62 2367 fi
16d20bd9
AD
2368 ;;
2369*) dflt=y;;
2370esac
2304df62
AD
2371
2372: Get old answers from old config file if Configure was run on the
2373: same system, otherwise use the hints.
2374hint=default
2375cd ..
2376if test -f config.sh; then
16d20bd9
AD
2377 echo " "
2378 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2379 . UU/myread
2380 case "$ans" in
f83701cd
AD
2381 n*|N*) echo "OK, I'll ignore it."
2382 mv config.sh config.sh.old
2383 myuname="$newmyuname"
2384 ;;
2304df62 2385 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2386 tmp_n="$n"
2387 tmp_c="$c"
85cad39c 2388 tmp_sh="$sh"
2304df62
AD
2389 . ./config.sh
2390 cp config.sh UU
ecfc5424
AD
2391 n="$tmp_n"
2392 c="$tmp_c"
85cad39c
PP
2393 : Older versions did not always set $sh. Catch re-use of such
2394 : an old config.sh.
2395 case "$sh" in
2396 '') sh="$tmp_sh" ;;
2397 esac
2304df62
AD
2398 hint=previous
2399 ;;
2400 esac
2401fi
2573c5f9 2402. ./UU/checkcc
2304df62
AD
2403if test ! -f config.sh; then
2404 $cat <<EOM
2405
4e2a5f63
AD
2406First time through, eh? I have some defaults handy for some systems
2407that need some extra help getting the Configure answers right:
2304df62
AD
2408
2409EOM
dfe9444c 2410 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2411 dflt=''
2412 : Half the following guesses are probably wrong... If you have better
7f2de2d2 2413 : tests or hints, please send them to perlbug@perl.org
2304df62 2414 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2415 $test -f /irix && osname=irix
85e6fe83
LW
2416 $test -f /xenix && osname=sco_xenix
2417 $test -f /dynix && osname=dynix
2418 $test -f /dnix && osname=dnix
5f05dabc
PP
2419 $test -f /lynx.os && osname=lynxos
2420 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2421 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2422 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2423 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2424 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2425 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2426 $test -d /usr/apollo/bin && osname=apollo
2427 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2428 $test -d /usr/include/minix && osname=minix
e060872b 2429 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2430 osname=machten
4633a7c4 2431 if $test -x /sbin/version; then
dfe9444c 2432 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2433 $sed -e 's/[A-Za-z]$//'`
2434 elif $test -x /usr/etc/version; then
dfe9444c 2435 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2436 $sed -e 's/[A-Za-z]$//'`
2437 else
2438 osvers="$2.$3"
2439 fi
2440 fi
aaacdc8b
GS
2441
2442 $test -f /sys/posix.dll &&
2443 $test -f /usr/bin/what &&
2444 set X `/usr/bin/what /sys/posix.dll` &&
2445 $test "$3" = UWIN &&
2446 osname=uwin &&
2447 osvers="$5"
2448
2304df62
AD
2449 if $test -f $uname; then
2450 set X $myuname
2451 shift
2452
2304df62 2453 case "$5" in
85e6fe83 2454 fps*) osname=fps ;;
2304df62
AD
2455 mips*)
2456 case "$4" in
85e6fe83
LW
2457 umips) osname=umips ;;
2458 *) osname=mips ;;
2304df62 2459 esac;;
85e6fe83
LW
2460 [23]100) osname=mips ;;
2461 next*) osname=next ;;
ecfc5424 2462 i386*)
c6912327
JH
2463 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2464 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2465 osname='sco'
2466 osvers=$tmp
2467 elif $test -f /etc/kconfig; then
ecfc5424 2468 osname=isc
bd628c73 2469 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2470 osvers=4
2471 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2472 osvers=3
2304df62 2473 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2474 osvers=2
ecfc5424
AD
2475 fi
2476 fi
2000072c 2477 tmp=''
ecfc5424 2478 ;;
c4f23d77
AD
2479 pc*)
2480 if test -n "$DJGPP"; then
2481 osname=dos
2482 osvers=djgpp
2483 fi
2484 ;;
2304df62
AD
2485 esac
2486
2487 case "$1" in
a0d0e21e
LW
2488 aix) osname=aix
2489 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2490 case "$tmp" in
1aef975c 2491 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2492 '<3240'|'<>3240') osvers=3.2.0 ;;
2493 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2494 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2495 *) osvers=$tmp;;
a0d0e21e
LW
2496 esac
2497 ;;
aaacdc8b
GS
2498 bsd386) osname=bsd386
2499 osvers=`$uname -r`
2500 ;;
2501 cygwin*) osname=cygwin
2502 osvers="$3"
2503 ;;
23f87696
SZ
2504 *dc.osx) osname=dcosx
2505 osvers="$3"
2506 ;;
a0d0e21e
LW
2507 dnix) osname=dnix
2508 osvers="$3"
2509 ;;
2510 domainos) osname=apollo
2511 osvers="$3"
2512 ;;
2513 dgux) osname=dgux
2514 osvers="$3"
2515 ;;
760ac839 2516 dynixptx*) osname=dynixptx
e58e581d 2517 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2518 ;;
a0d0e21e
LW
2519 freebsd) osname=freebsd
2520 osvers="$3" ;;
2521 genix) osname=genix ;;
2522 hp*) osname=hpux
bfb7748a 2523 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2524 ;;
a78b0d02 2525 irix*) osname=irix
a0d0e21e
LW
2526 case "$3" in
2527 4*) osvers=4 ;;
2528 5*) osvers=5 ;;
ecfc5424 2529 *) osvers="$3" ;;
a0d0e21e
LW
2530 esac
2531 ;;
2532 linux) osname=linux
2533 case "$3" in
a0d0e21e
LW
2534 *) osvers="$3" ;;
2535 esac
2536 ;;
28e8609d
JH
2537 MiNT) osname=mint
2538 ;;
2539 netbsd*) osname=netbsd
ecfc5424
AD
2540 osvers="$3"
2541 ;;
4e81affe
MMIJG
2542 news-os) osvers="$3"
2543 case "$3" in
2544 4*) osname=newsos4 ;;
2545 *) osname=newsos ;;
2546 esac
2547 ;;
aaacdc8b 2548 next*) osname=next ;;
28bb1e2c 2549 nonstop-ux) osname=nonstopux ;;
aaacdc8b
GS
2550 POSIX-BC | posix-bc ) osname=posix-bc
2551 osvers="$3"
a0d0e21e 2552 ;;
ae3afa4e
TH
2553 powerux | power_ux | powermax_os | powermaxos | \
2554 powerunix | power_unix) osname=powerux
2555 osvers="$3"
2556 ;;
aaacdc8b
GS
2557 qnx) osname=qnx
2558 osvers="$4"
2559 ;;
a0d0e21e
LW
2560 solaris) osname=solaris
2561 case "$3" in
2562 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2563 *) osvers="$3" ;;
a0d0e21e
LW
2564 esac
2565 ;;
85e6fe83
LW
2566 sunos) osname=sunos
2567 case "$3" in
85e6fe83
LW
2568 5*) osname=solaris
2569 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2570 *) osvers="$3" ;;
2304df62
AD
2571 esac
2572 ;;
a0d0e21e 2573 titanos) osname=titanos
85e6fe83 2574 case "$3" in
a0d0e21e
LW
2575 1*) osvers=1 ;;
2576 2*) osvers=2 ;;
2577 3*) osvers=3 ;;
2578 4*) osvers=4 ;;
ecfc5424 2579 *) osvers="$3" ;;
2304df62
AD
2580 esac
2581 ;;
85e6fe83 2582 ultrix) osname=ultrix
ecfc5424 2583 osvers="$3"
2304df62 2584 ;;
28757baa 2585 osf1|mls+) case "$5" in
fed7345c
AD
2586 alpha)
2587 osname=dec_osf
2aa76180
JH
2588 osvers=`sizer -v | awk '{print $3}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2589 case "$osvers" in
2590 [1-9].[0-9]*) ;;
2591 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2592 esac
ecfc5424
AD
2593 ;;
2594 hp*) osname=hp_osf1 ;;
2595 mips) osname=mips_osf1 ;;
85e6fe83
LW
2596 esac
2597 ;;
0337d152
A
2598 unixware) osname=svr5
2599 osvers="$4"
2600 ;;
2601 uts) osname=uts
a0d0e21e
LW
2602 osvers="$3"
2603 ;;
85e6fe83 2604 $2) case "$osname" in
2304df62 2605 *isc*) ;;
a0d0e21e 2606 *freebsd*) ;;
5f05dabc 2607 svr*)
a0d0e21e
LW
2608 : svr4.x or possibly later
2609 case "svr$3" in
2610 ${osname}*)
2611 osname=svr$3
2612 osvers=$4
2613 ;;
2614 esac
2615 case "$osname" in
2616 svr4.0)
2617 : Check for ESIX
2618 if test -f /stand/boot ; then
2619 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2620 if test -n "$INITPROG" -a -f "$INITPROG"; then
2621 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2622 if test -n "$isesix"; then
a0d0e21e
LW
2623 osname=esix4
2624 fi
2625 fi
2626 fi
2627 ;;
2628 esac
2629 ;;
2304df62 2630 *) if test -f /etc/systemid; then
a0d0e21e
LW
2631 osname=sco
2632 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2633 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2634 osvers=$1.$2.$3
c4f23d77 2635 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2636 osvers=$1.$2
c4f23d77 2637 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2638 osvers=$1
2304df62 2639 fi
a0d0e21e
LW
2640 else
2641 case "$osname" in
2642 '') : Still unknown. Probably a generic Sys V.
2643 osname="sysv"
2644 osvers="$3"
2645 ;;
2646 esac
2304df62
AD
2647 fi
2648 ;;
2649 esac
2650 ;;
a0d0e21e
LW
2651 *) case "$osname" in
2652 '') : Still unknown. Probably a generic BSD.
2653 osname="$1"
2654 osvers="$3"
2655 ;;
2656 esac
2657 ;;
2304df62
AD
2658 esac
2659 else
dfe9444c
AD
2660 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2661 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2662 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2663 osname=news_os
2304df62 2664 fi
dfe9444c 2665 $rm -f UU/kernel.what
8e07c86e
AD
2666 elif test -d c:/.; then
2667 set X $myuname
2668 osname=os2
2669 osvers="$5"
2304df62
AD
2670 fi
2671 fi
85e6fe83 2672
a0d0e21e
LW
2673 : Now look for a hint file osname_osvers, unless one has been
2674 : specified already.
2675 case "$hintfile" in
2676 ''|' ')
1e127011 2677 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 2678 : Also try without trailing minor version numbers.
1e127011
DD
2679 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2680 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2681 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2682 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
2683 case "$file" in
2684 '') dflt=none ;;
2685 *) case "$osvers" in
2686 '') dflt=$file
2687 ;;
dfe9444c 2688 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 2689 dflt=$file
dfe9444c 2690 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 2691 dflt=$xfile
dfe9444c 2692 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 2693 dflt=$xxfile
dfe9444c 2694 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 2695 dflt=$xxxfile
dfe9444c 2696 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 2697 dflt=$xxxxfile
dfe9444c 2698 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
2699 dflt="${osname}"
2700 else
2701 dflt=none
2702 fi
2703 ;;
2704 esac
85e6fe83
LW
2705 ;;
2706 esac
4e2a5f63
AD
2707 if $test -f Policy.sh ; then
2708 case "$dflt" in
2709 *Policy*) ;;
2710 none) dflt="Policy" ;;
2711 *) dflt="Policy $dflt" ;;
2712 esac
2713 fi
85e6fe83 2714 ;;
a0d0e21e 2715 *)
ecfc5424 2716 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 2717 ;;
2304df62 2718 esac
1aef975c 2719
4e2a5f63
AD
2720 if $test -f Policy.sh ; then
2721 $cat <<EOM
2722
2723There's also a Policy hint file available, which should make the
2724site-specific (policy) questions easier to answer.
2725EOM
2726
2727 fi
2728
2304df62
AD
2729 $cat <<EOM
2730
2731You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 2732A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 2733is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
2734
2735EOM
4e2a5f63 2736
2304df62 2737 rp="Which of these apply, if any?"
dfe9444c 2738 . UU/myread
85e6fe83
LW
2739 tans=$ans
2740 for file in $tans; do
4e2a5f63
AD
2741 if $test X$file = XPolicy -a -f Policy.sh; then
2742 . Policy.sh
2743 $cat Policy.sh >> UU/config.sh
2744 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
2745 . $src/hints/$file.sh
2746 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83 2747 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
2748 : nothing
2749 else
85e6fe83
LW
2750 : Give one chance to correct a possible typo.
2751 echo "$file.sh does not exist"
2752 dflt=$file
2753 rp="hint to use instead?"
dfe9444c 2754 . UU/myread
85e6fe83 2755 for file in $ans; do
dfe9444c
AD
2756 if $test -f "$src/hints/$file.sh"; then
2757 . $src/hints/$file.sh
2758 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
2759 elif $test X$ans = X -o X$ans = Xnone ; then
2760 : nothing
2761 else
2762 echo "$file.sh does not exist -- ignored."
2763 fi
2764 done
2304df62
AD
2765 fi
2766 done
85e6fe83 2767
2304df62 2768 hint=recommended
85e6fe83 2769 : Remember our hint file for later.
dfe9444c 2770 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 2771 hintfile="$file"
85e6fe83 2772 else
a0d0e21e 2773 hintfile=''
85e6fe83 2774 fi
2304df62
AD
2775fi
2776cd UU
2777;;
2778*)
2779 echo " "
2780 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
2781 tmp_n="$n"
2782 tmp_c="$c"
2304df62
AD
2783 cd ..
2784 cp $config_sh config.sh 2>/dev/null
a78b0d02 2785 chmod +w config.sh
2304df62
AD
2786 . ./config.sh
2787 cd UU
2788 cp ../config.sh .
ecfc5424
AD
2789 n="$tmp_n"
2790 c="$tmp_c"
2304df62
AD
2791 hint=previous
2792 ;;
2793esac
1aef975c 2794test "$override" && . ./optdef.sh
2304df62
AD
2795
2796: Restore computed paths
2797for file in $loclist $trylist; do
2798 eval $file="\$_$file"
2799done
2800
85e6fe83 2801cat << EOM
a0d0e21e 2802
85e6fe83 2803Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
2804The default value is probably right if the name rings a bell. Otherwise,
2805since spelling matters for me, either accept the default or answer "none"
2806to leave it blank.
a0d0e21e 2807
85e6fe83 2808EOM
85e6fe83 2809case "$osname" in
a0d0e21e 2810 ''|' ')
85e6fe83 2811 case "$hintfile" in
a0d0e21e 2812 ''|' '|none) dflt=none ;;
ecfc5424 2813 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
2814 esac
2815 ;;
2816 *) dflt="$osname" ;;
2817esac
2818rp="Operating system name?"
2819. ./myread
2820case "$ans" in
ecfc5424
AD
2821none) osname='' ;;
2822*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 2823esac
8ff267be
PP
2824echo " "
2825case "$osvers" in
2826 ''|' ')
2827 case "$hintfile" in
2828 ''|' '|none) dflt=none ;;
2829 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2830 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2831 case "$dflt" in
2832 ''|' ') dflt=none ;;
2833 esac
2834 ;;
2835 esac
2836 ;;
2837 *) dflt="$osvers" ;;
2838esac
2839rp="Operating system version?"
2840. ./myread
2841case "$ans" in
2842none) osvers='' ;;
2843*) osvers="$ans" ;;
2844esac
2845
02e93a22
JH
2846
2847. ./posthint.sh
2848
2304df62 2849: who configured the system
59b83a6f 2850cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 2851cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
2852case "$cf_by" in
2853"")
8ff267be 2854 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
2855 case "$cf_by" in
2856 "") cf_by=unknown ;;
8ff267be
PP
2857 esac ;;
2858esac
2304df62 2859
b4eb6b3d
JH
2860: set up the script used to warn in case of inconsistency
2861cat <<EOS >whoa
2862$startsh
2863EOS
2864cat <<'EOSC' >>whoa
2865dflt=y
2866echo " "
2867echo "*** WHOA THERE!!! ***" >&4
2868echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2869rp=" Keep the $hint value?"
2870. ./myread
2871case "$ans" in
2872y) td=$was; tu=$was;;
2873esac
2874EOSC
2875
2876: function used to set $1 to $val
2877setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2878case "$val$was" in
2879$define$undef) . ./whoa; eval "$var=\$td";;
2880$undef$define) . ./whoa; eval "$var=\$tu";;
2881*) eval "$var=$val";;
2882esac'
2883
2884case "$usethreads" in
2885$define|true|[yY]*) dflt='y';;
2886*) dflt='n';;
2887esac
2888cat <<EOM
2889
2890Perl can be built to take advantage of threads on some systems.
2891To do so, Configure can be run with -Dusethreads.
2892
2893Note that threading is a highly experimental feature, and
2894some known race conditions still remain. If you choose to try
2895it, be very sure to not actually deploy it for production
2896purposes. README.threads has more details, and is required
2897reading if you enable threads.
2898
2899If this doesn't make any sense to you, just accept the default '$dflt'.
2900EOM
2901rp='Build a threading Perl?'
2902. ./myread
2903case "$ans" in
2904y|Y) val="$define" ;;
2905*) val="$undef" ;;
2906esac
2907set usethreads
2908eval $setvar
2909
2910case "$usethreads" in
2911$define)
2912 $cat <<EOM
2913
2914As of 5.5.640, Perl has two different internal threading implementations,
2915the 5.005 version (5005threads) and an interpreter-based version
2916(ithreads) that has one interpreter per thread. Both are very
2917experimental. This arrangement exists to help developers work out
2918which one is better.
2919
2920If you're a casual user, you probably don't want interpreter-threads
2921at this time. There doesn't yet exist a way to create threads from
2922within Perl in this model, i.e., "use Thread;" will NOT work.
2923EOM
2924 : Default to ithreads unless overridden on command line or with
2925 : old config.sh
2926 dflt='y'
2927 case "$use5005threads" in
2928 $define|true|[yY]*) dflt='n';;
2929 esac
2930 case "$useithreads" in
2931 $undef|false|[nN]*) dflt='n';;
2932 esac
2933 rp='Use interpreter-based ithreads?'
2934 . ./myread
2935 case "$ans" in
2936 y|Y) val="$define" ;;
2937 *) val="$undef" ;;
2938 esac
2939 set useithreads
2940 eval $setvar
2941 : Now set use5005threads to the opposite value.
2942 case "$useithreads" in
2943 $define) val="$undef" ;;
2944 *) val="$define" ;;
2945 esac
2946 set use5005threads
2947 eval $setvar
2948 ;;
2949*)
2950 useithreads="$undef"
2951 use5005threads="$undef"
2952 ;;
2953esac
2954
c915ce7f
JH
2955case "$useithreads$use5005threads" in
2956"$define$define")
2957 $cat >&4 <<EOM
2958
2959You cannot have both the ithreads and the 5.005 threads enabled
2960at the same time. Disabling the 5.005 threads since they are
2961much less stable than the ithreads.
2962
2963EOM
2964 use5005threads="$undef"
2965 ;;
2966esac
2967
b4eb6b3d
JH
2968case "$d_oldpthreads" in
2969'') : Configure tests would be welcome here. For now, assume undef.
2970 val="$undef" ;;
2971*) val="$d_oldpthreads" ;;
2972esac
2973set d_oldpthreads
2974eval $setvar
2975
2976
2977case "$usethreads" in
2978"$define"|true|[yY]*)
2979: Look for a hint-file generated 'call-back-unit'. If the
2980: user has specified that a threading perl is to be built,
2981: we may need to set or change some other defaults.
2982 if $test -f usethreads.cbu; then
2983 echo "Your platform has some specific hints for threaded builds, using them..."
2984 . ./usethreads.cbu
2985 else
2986 $cat <<EOM
2987(Your platform doesn't have any specific hints for threaded builds.
2988 Assuming POSIX threads, then.)
2989EOM
2990 fi
2991 ;;
2992esac
2993
2994cat <<EOM
2995
2996Perl can be built so that multiple Perl interpreters can coexist
2997within the same Perl executable.
2998EOM
2999
3000case "$useithreads" in
3001$define)
3002 cat <<EOM
3003This multiple interpreter support is required for interpreter-based threads.
3004EOM
3005 val="$define"
3006 ;;
3007*) case "$usemultiplicity" in
3008 $define|true|[yY]*) dflt='y';;
3009 *) dflt='n';;
3010 esac
3011 echo " "
3012 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3013 rp='Build Perl for multiplicity?'
3014 . ./myread
3015 case "$ans" in
3016 y|Y) val="$define" ;;
3017 *) val="$undef" ;;
3018 esac
3019 ;;
3020esac
3021set usemultiplicity
3022eval $setvar
3023
e5e20432
JH
3024: make some quick guesses about what we are up against
3025echo " "
3026$echo $n "Hmm... $c"
3027echo exit 1 >bsd
3028echo exit 1 >usg
3029echo exit 1 >v7
3030echo exit 1 >osf1
3031echo exit 1 >eunice
3032echo exit 1 >xenix
3033echo exit 1 >venix
3034echo exit 1 >os2
3035d_bsd="$undef"
3036$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3037if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3038then
3039 echo "Looks kind of like an OSF/1 system, but we'll see..."
3040 echo exit 0 >osf1
381aa1ff 3041elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3042 xxx=`./loc addbib blurfl $pth`
3043 if $test -f $xxx; then
3044 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3045 echo exit 0 >bsd
3046 echo exit 0 >usg
3047 else
3048 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3049 echo "Looks kind of like an extended USG system, but we'll see..."
3050 else
3051 echo "Looks kind of like a USG system, but we'll see..."
3052 fi
3053 echo exit 0 >usg
3054 fi
3055elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3056 echo "Looks kind of like a BSD system, but we'll see..."
3057 d_bsd="$define"
3058 echo exit 0 >bsd
3059else
3060 echo "Looks kind of like a Version 7 system, but we'll see..."
3061 echo exit 0 >v7
3062fi
3063case "$eunicefix" in
3064*unixtovms*)
3065 $cat <<'EOI'
3066There is, however, a strange, musty smell in the air that reminds me of
3067something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3068EOI
3069 echo exit 0 >eunice
3070 d_eunice="$define"
3071: it so happens the Eunice I know will not run shell scripts in Unix format
3072 ;;
3073*)
3074 echo " "
3075 echo "Congratulations. You aren't running Eunice."
3076 d_eunice="$undef"
3077 ;;
3078esac
3079: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3080: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3081: semicolon as a patch separator
e5e20432
JH
3082case "$p_" in
3083:) ;;
3084*)
3085 $cat <<'EOI'
3086I have the feeling something is not exactly right, however...don't tell me...
3087lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3088(Or you may be running DOS with DJGPP.)
e5e20432
JH
3089EOI
3090 echo exit 0 >os2
3091 ;;
3092esac
3093if test -f /xenix; then
3094 echo "Actually, this looks more like a XENIX system..."
3095 echo exit 0 >xenix
3096 d_xenix="$define"
3097else
3098 echo " "
3099 echo "It's not Xenix..."
3100 d_xenix="$undef"
3101fi
3102chmod +x xenix
3103$eunicefix xenix
3104if test -f /venix; then
3105 echo "Actually, this looks more like a VENIX system..."
3106 echo exit 0 >venix
3107else
3108 echo " "
3109 if ./xenix; then
3110 : null
3111 else
3112 echo "Nor is it Venix..."
3113 fi
3114fi
3115chmod +x bsd usg v7 osf1 eunice xenix venix os2
3116$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3117$rm -f foo
3118
5869b1f1
JH
3119case "$cc" in
3120'') dflt=cc;;
3121*) dflt="$cc";;
3122esac
3123rp="Use which C compiler?"
3124. ./myread
3125cc="$ans"
e5e20432
JH
3126: Look for a hint-file generated 'call-back-unit'. Now that the
3127: user has specified the compiler, we may need to set or change some
3128: other defaults.
3129if $test -f cc.cbu; then
3130 . ./cc.cbu
3131fi
2573c5f9 3132. ./checkcc
8a27cf78 3133
e5e20432
JH
3134echo " "
3135echo "Checking for GNU cc in disguise and/or its version number..." >&4
3136$cat >gccvers.c <<EOM
3137#include <stdio.h>
3138int main() {
3139#ifdef __GNUC__
3140#ifdef __VERSION__
3141 printf("%s\n", __VERSION__);
3142#else
3143 printf("%s\n", "1");
3144#endif
3145#endif
3146 exit(0);
3147}
3148EOM
2d967e39 3149if $cc -o gccvers $ccflags $ldflags gccvers.c; then
e5e20432
JH
3150 gccversion=`./gccvers`
3151 case "$gccversion" in
3152 '') echo "You are not using GNU cc." ;;
fc68435e 3153 *) echo "You are using GNU cc $gccversion."
e723fc21 3154 ccname=gcc
fc68435e 3155 ;;
e5e20432
JH
3156 esac
3157else
3158 echo " "
3159 echo "*** WHOA THERE!!! ***" >&4
3160 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3161 case "$knowitall" in
3162 '')
3163 echo " You'd better start hunting for one and let me know about it." >&4
3164 exit 1
3165 ;;
3166 esac
3167fi
3168$rm -f gccvers*
3169case "$gccversion" in
31701*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3171esac
5b463ca7
KS
3172case "$gccversion" in
3173'') gccosandvers='' ;;
10b4ebb5
JH
3174*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3175 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3176 gccshortvers=''
5b463ca7 3177 case "$gccosandvers" in
02903077
JH
3178 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3179 $osname$osvers) ;; # looking good
5b463ca7
KS
3180 $osname*) cat <<EOM >&4
3181
3182*** WHOA THERE!!! ***
3183
3184 Your gcc has not been compiled for the exact release of
3185 your operating system ($gccosandvers versus $osname$osvers).
3186
3187 In general it is a good idea to keep gcc synchronized with
3188 the operating system because otherwise serious problems
3189 may ensue when trying to compile software, like Perl.
3190
3191 I'm trying to be optimistic here, though, and will continue.
3192 If later during the configuration and build icky compilation
02903077
JH
3193 problems appear (headerfile conflicts being the most common
3194 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3195 your operating system release.
3196
3197EOM
3198 ;;
81575342 3199 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3200 esac
3201 ;;
3202esac
e723fc21
JH
3203case "$ccname" in
3204'') ccname="$cc" ;;
3205esac
e5e20432 3206
8a27cf78
JH
3207: see how we invoke the C preprocessor
3208echo " "
3209echo "Now, how can we feed standard input to your C preprocessor..." >&4
3210cat <<'EOT' >testcpp.c
3211#define ABC abc
3212#define XYZ xyz
3213ABC.XYZ
3214EOT
3215cd ..
3216if test ! -f cppstdin; then
3217 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3218 # AIX cc -E doesn't show the absolute headerfile
3219 # locations but we'll cheat by using the -M flag.
3220 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
3221 else
3222 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3223 fi
3224else
3225 echo "Keeping your $hint cppstdin wrapper."
3226fi
3227chmod 755 cppstdin
3228wrapper=`pwd`/cppstdin
3229ok='false'
3230cd UU
3231
3232if $test "X$cppstdin" != "X" && \
3233 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3234 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3235then
3236 echo "You used to use $cppstdin $cppminus so we'll use that again."
3237 case "$cpprun" in
3238 '') echo "But let's see if we can live without a wrapper..." ;;
3239 *)
3240 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3241 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3242 then
3243 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3244 ok='true'
3245 else
3246 echo "(However, $cpprun $cpplast does not work, let's see...)"
3247 fi
3248 ;;
3249 esac
3250else
3251 case "$cppstdin" in
3252 '') ;;
3253 *)
3254 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3255 ;;
3256 esac
3257fi
3258
3259if $ok; then
3260 : nothing
3261elif echo 'Maybe "'"$cc"' -E" will work...'; \
3262 $cc -E <testcpp.c >testcpp.out 2>&1; \
3263 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3264 echo "Yup, it does."
3265 x_cpp="$cc -E"
3266 x_minus='';
3267elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3268 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3269 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3270 echo "Yup, it does."
3271 x_cpp="$cc -E"
3272 x_minus='-';
3273elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3274 $cc -P <testcpp.c >testcpp.out 2>&1; \
3275 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3276 echo "Yipee, that works!"
3277 x_cpp="$cc -P"
3278 x_minus='';
3279elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3280 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3281 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3282 echo "At long last!"
3283 x_cpp="$cc -P"
3284 x_minus='-';
3285elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3286 $cpp <testcpp.c >testcpp.out 2>&1; \
3287 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3288 echo "It works!"
3289 x_cpp="$cpp"
3290 x_minus='';
3291elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3292 $cpp - <testcpp.c >testcpp.out 2>&1; \
3293 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3294 echo "Hooray, it works! I was beginning to wonder."
3295 x_cpp="$cpp"
3296 x_minus='-';
3297elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3298 $wrapper <testcpp.c >testcpp.out 2>&1; \
3299 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3300 x_cpp="$wrapper"
3301 x_minus=''
3302 echo "Eureka!"
3303else
3304 dflt=''
3305 rp="No dice. I can't find a C preprocessor. Name one:"
3306 . ./myread
3307 x_cpp="$ans"
3308 x_minus=''
3309 $x_cpp <testcpp.c >testcpp.out 2>&1
3310 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3311 echo "OK, that will do." >&4
3312 else
3313echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3314 exit 1
3315 fi
3316fi
3317
3318case "$ok" in
3319false)
3320 cppstdin="$x_cpp"
3321 cppminus="$x_minus"
3322 cpprun="$x_cpp"
3323 cpplast="$x_minus"
3324 set X $x_cpp
3325 shift
3326 case "$1" in
3327 "$cpp")
3328 echo "Perhaps can we force $cc -E using a wrapper..."
3329 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3330 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3331 then
3332 echo "Yup, we can."
3333 cppstdin="$wrapper"
3334 cppminus='';
3335 else
3336 echo "Nope, we'll have to live without it..."
3337 fi
3338 ;;
3339 esac
3340 case "$cpprun" in
3341 "$wrapper")
3342 cpprun=''
3343 cpplast=''
3344 ;;
3345 esac
3346 ;;
3347esac
3348
3349case "$cppstdin" in
3350"$wrapper"|'cppstdin') ;;
3351*) $rm -f $wrapper;;
3352esac
3353$rm -f testcpp.c testcpp.out
3354
bd9b35c9
JH
3355: decide how portable to be. Allow command line overrides.
3356case "$d_portable" in
3357"$undef") ;;
3358*) d_portable="$define" ;;
104d25b7 3359esac
85ab1d1d 3360
bd9b35c9
JH
3361: set up shell script to do ~ expansion
3362cat >filexp <<EOSS
3363$startsh
3364: expand filename
3365case "\$1" in
3366 ~/*|~)
3367 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3368 ;;
3369 ~*)
3370 if $test -f /bin/csh; then
3371 /bin/csh -f -c "glob \$1"
3372 failed=\$?
3373 echo ""
3374 exit \$failed
e5e20432 3375 else
bd9b35c9
JH
3376 name=\`$expr x\$1 : '..\([^/]*\)'\`
3377 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3378 if $test ! -d "\$dir"; then
3379 me=\`basename \$0\`
3380 echo "\$me: can't locate home directory for: \$name" >&2
3381 exit 1
3382 fi
3383 case "\$1" in
3384 */*)
3385 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3386 ;;
3387 *)
3388 echo \$dir
e5e20432
JH
3389 ;;
3390 esac
3391 fi
b691c02f 3392 ;;
4633a7c4 3393*)
bd9b35c9 3394 echo \$1
2304df62
AD
3395 ;;
3396esac
4633a7c4
LW
3397EOSS
3398chmod +x filexp
3399$eunicefix filexp
2304df62
AD
3400
3401: now set up to get a file name
28757baa
PP
3402cat <<EOS >getfile
3403$startsh
3404EOS
3405cat <<'EOSC' >>getfile
2304df62
AD
3406tilde=''
3407fullpath=''
3408already=''
3409skip=''
3410none_ok=''
3411exp_file=''
a0d0e21e 3412nopath_ok=''
2304df62
AD
3413orig_rp="$rp"
3414orig_dflt="$dflt"
b233458b
JH
3415case "$gfpth" in
3416'') gfpth='.' ;;
3417esac
2304df62
AD
3418
3419case "$fn" in
ecfc5424 3420*\(*)
381aa1ff 3421 expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
3422 fn=`echo $fn | sed 's/(.*)//'`
3423 ;;
3424esac
3425
3426case "$fn" in
a0d0e21e
LW
3427*:*)
3428 loc_file=`expr $fn : '.*:\(.*\)'`
3429 fn=`expr $fn : '\(.*\):.*'`
3430 ;;
3431esac
3432
3433case "$fn" in
2304df62
AD
3434*~*) tilde=true;;
3435esac
3436case "$fn" in
3437*/*) fullpath=true;;
3438esac
3439case "$fn" in
3440*+*) skip=true;;
3441esac
3442case "$fn" in
3443*n*) none_ok=true;;
3444esac
3445case "$fn" in
3446*e*) exp_file=true;;
3447esac
a0d0e21e
LW
3448case "$fn" in
3449*p*) nopath_ok=true;;
3450esac
2304df62
AD
3451
3452case "$fn" in
3453*f*) type='File';;
3454*d*) type='Directory';;
a0d0e21e 3455*l*) type='Locate';;
2304df62
AD
3456esac
3457
3458what="$type"
3459case "$what" in
3460Locate) what='File';;
3461esac
3462
3463case "$exp_file" in
3464'')
3465 case "$d_portable" in
3466 "$define") ;;
3467 *) exp_file=true;;
3468 esac
3469 ;;
3470esac
3471
3472cd ..
3473while test "$type"; do
3474 redo=''
3475 rp="$orig_rp"
3476 dflt="$orig_dflt"
3477 case "$tilde" in
3478 true) rp="$rp (~name ok)";;
3479 esac
3480 . UU/myread
ecfc5424
AD
3481 if test -f UU/getfile.ok && \
3482 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3483 then
3484 value="$ans"
3485 ansexp="$ans"
3486 break
3487 fi
2304df62
AD
3488 case "$ans" in
3489 none)
3490 value=''
3491 ansexp=''
3492 case "$none_ok" in
3493 true) type='';;
3494 esac
3495 ;;
3496 *)
3497 case "$tilde" in
3498 '') value="$ans"
3499 ansexp="$ans";;
3500 *)
3501 value=`UU/filexp $ans`
3502 case $? in
3503 0)
3504 if test "$ans" != "$value"; then
ecfc5424 3505 echo "(That expands to $value on this system.)"
2304df62
AD
3506 fi
3507 ;;
3508 *) value="$ans";;
3509 esac
3510 ansexp="$value"
3511 case "$exp_file" in
3512 '') value="$ans";;
3513 esac
3514 ;;
3515 esac
3516 case "$fullpath" in
3517 true)
3518 case "$ansexp" in
3519 /*) value="$ansexp" ;;
23da6c43 3520 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
3521 *)
3522 redo=true
3523 case "$already" in
3524 true)
3525 echo "I shall only accept a full path name, as in /bin/ls." >&4
3526 echo "Use a ! shell escape if you wish to check pathnames." >&4
3527 ;;
3528 *)
3529 echo "Please give a full path name, starting with slash." >&4
3530 case "$tilde" in
3531 true)
3532 echo "Note that using ~name is ok provided it expands well." >&4
3533 already=true
3534 ;;
3535 esac
3536 esac
3537 ;;
3538 esac
3539 ;;
3540 esac
3541 case "$redo" in
3542 '')
3543 case "$type" in
3544 File)
b233458b
JH
3545 for fp in $gfpth; do
3546 if test "X$fp" = X.; then
3547 pf="$ansexp"
3548 else
3549 pf="$fp/$ansexp"
3550 fi
3551 if test -f "$pf"; then
3552 type=''
3553 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3554 then
3555 echo "($value is not a plain file, but that's ok.)"
3556 type=''
3557 fi
3558 if test X"$type" = X; then
3559 value="$pf"
3560 break
3561 fi
3562 done
2304df62
AD
3563 ;;
3564 Directory)
b233458b
JH
3565 for fp in $gfpth; do
3566 if test "X$fp" = X.; then
f78bfc9c
JH
3567 dir="$ans"
3568 direxp="$ansexp"
b233458b 3569 else
dd858076 3570 dir="$fp/$ansexp"
f78bfc9c 3571 direxp="$fp/$ansexp"
b233458b 3572 fi
f78bfc9c 3573 if test -d "$direxp"; then
b233458b 3574 type=''
f78bfc9c 3575 value="$dir"
b233458b
JH
3576 break
3577 fi
3578 done
2304df62
AD
3579 ;;
3580 Locate)
40000a8c 3581 if test -d "$ansexp"; then
a0d0e21e
LW
3582 echo "(Looking for $loc_file in directory $value.)"
3583 value="$value/$loc_file"
40000a8c 3584 ansexp="$ansexp/$loc_file"
2304df62 3585 fi
40000a8c 3586 if test -f "$ansexp"; then
2304df62
AD
3587 type=''
3588 fi
a0d0e21e
LW
3589 case "$nopath_ok" in
3590 true) case "$value" in
3591 */*) ;;
3592 *) echo "Assuming $value will be in people's path."
3593 type=''
3594 ;;
3595 esac
3596 ;;
3597 esac
2304df62
AD
3598 ;;
3599 esac
3600
3601 case "$skip" in
3602 true) type='';
3603 esac
3604
3605 case "$type" in
3606 '') ;;
3607 *)
3608 if test "$fastread" = yes; then
3609 dflt=y
3610 else
3611 dflt=n
3612 fi
3613 rp="$what $value doesn't exist. Use that name anyway?"
3614 . UU/myread
3615 dflt=''
3616 case "$ans" in
3617 y*) type='';;
3618 *) echo " ";;
3619 esac
3620 ;;
3621 esac
3622 ;;
3623 esac
3624 ;;
3625 esac
3626done
3627cd UU
3628ans="$value"
3629rp="$orig_rp"
3630dflt="$orig_dflt"
ecfc5424 3631rm -f getfile.ok
b233458b 3632test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3633EOSC
3634
bd9b35c9
JH
3635: What should the include directory be ?
3636echo " "
3637$echo $n "Hmm... $c"
3638dflt='/usr/include'
3639incpath=''
3640mips_type=''
3641if $test -f /bin/mips && /bin/mips; then
3642 echo "Looks like a MIPS system..."
3643 $cat >usr.c <<'EOCP'
3644#ifdef SYSTYPE_BSD43
3645/bsd43
3646#endif
3647EOCP
8a27cf78 3648 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
3649 dflt='/bsd43/usr/include'
3650 incpath='/bsd43'
3651 mips_type='BSD 4.3'
3652 else
3653 mips_type='System V'
3654 fi
3655 $rm -f usr.c usr.out
3656 echo "and you're compiling with the $mips_type compiler and libraries."
3657 xxx_prompt=y
3658 echo "exit 0" >mips
3659else
3660 echo "Doesn't look like a MIPS system."
3661 xxx_prompt=n
3662 echo "exit 1" >mips
3663fi
3664chmod +x mips
3665$eunicefix mips
3666case "$usrinc" in
3667'') ;;
3668*) dflt="$usrinc";;
3669esac
3670case "$xxx_prompt" in
3671y) fn=d/
3672 echo " "
3673 rp='Where are the include files you want to use?'
3674 . ./getfile
3675 usrinc="$ans"
8e07c86e 3676 ;;
bd9b35c9 3677*) usrinc="$dflt"
8e07c86e
AD
3678 ;;
3679esac
2304df62 3680
bd9b35c9
JH
3681: Set private lib path
3682case "$plibpth" in
3683'') if ./mips; then
3684 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3685 fi;;
3686esac
3687case "$libpth" in
3688' ') dlist='';;
3689'') dlist="$loclibpth $plibpth $glibpth";;
3690*) dlist="$libpth";;
3691esac
3692
3693: Now check and see which directories actually exist, avoiding duplicates
3694libpth=''
3695for xxx in $dlist
3696do
3697 if $test -d $xxx; then
3698 case " $libpth " in
3699 *" $xxx "*) ;;
3700 *) libpth="$libpth $xxx";;
3701 esac
3702 fi
3703done
3704$cat <<'EOM'
3705
3706Some systems have incompatible or broken versions of libraries. Among
3707the directories listed in the question below, please remove any you
3708know not to be holding relevant libraries, and add any that are needed.
3709Say "none" for none.
8e07c86e
AD
3710
3711EOM
bd9b35c9
JH
3712case "$libpth" in
3713'') dflt='none';;
8e07c86e 3714*)
bd9b35c9
JH
3715 set X $libpth
3716 shift
3717 dflt=${1+"$@"}
8e07c86e 3718 ;;
a0d0e21e 3719esac
bd9b35c9
JH
3720rp="Directories to use for library searches?"
3721. ./myread
3722case "$ans" in
3723none) libpth=' ';;
3724*) libpth="$ans";;
3725esac
a0d0e21e 3726
bd9b35c9
JH
3727: compute shared library extension
3728case "$so" in
3729'')
3730 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3731 dflt='sl'
dd4e71fd 3732 else
bd9b35c9 3733 dflt='so'
dd4e71fd
JH
3734 fi
3735 ;;
bd9b35c9 3736*) dflt="$so";;
dd4e71fd 3737esac
dd4e71fd
JH
3738$cat <<EOM
3739
bd9b35c9 3740On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 3741you want to suppress searching of shared libraries for the remainder
bd9b35c9 3742of this configuration.
dd4e71fd
JH
3743
3744EOM
bd9b35c9
JH
3745rp='What is the file extension used for shared libraries?'
3746. ./myread
3747so="$ans"
dd4e71fd 3748
bd9b35c9
JH
3749: Define several unixisms.
3750: Hints files or command line option can be used to override them.
3751: The convoluted testing is in case hints files set either the old
3752: or the new name.
3753case "$_exe" in
3754'') case "$exe_ext" in
3755 '') ;;
3756 *) _exe="$exe_ext" ;;
dd4e71fd 3757 esac
bd9b35c9 3758 ;;
bfb7748a 3759esac
bd9b35c9
JH
3760case "$_a" in
3761'') case "$lib_ext" in
3762 '') _a='.a';;
3763 *) _a="$lib_ext" ;;
dd4e71fd
JH
3764 esac
3765 ;;
dd4e71fd 3766esac
bd9b35c9
JH
3767case "$_o" in
3768'') case "$obj_ext" in
3769 '') _o='.o';;
3770 *) _o="$obj_ext";;
3771 esac
3772 ;;
3773esac
3774case "$p_" in
3775'') case "$path_sep" in
3776 '') p_=':';;
3777 *) p_="$path_sep";;
3778 esac
3779 ;;
3780esac
3781exe_ext=$_exe
3782lib_ext=$_a
3783obj_ext=$_o
3784path_sep=$p_
dd4e71fd 3785
b4eb6b3d
JH
3786: Which makefile gets called first. This is used by make depend.
3787case "$firstmakefile" in
3788'') firstmakefile='makefile';;
4633a7c4 3789esac
4633a7c4 3790
0f0995ae
JH
3791case "$usesocks" in
3792$define|true|[yY]*) dflt='y';;
3793*) dflt='n';;
3794esac
bd9b35c9 3795cat <<EOM
4633a7c4 3796
bd9b35c9 3797Perl can be built to use the SOCKS proxy protocol library. To do so,
cf829ab0
JH
3798Configure must be run with -Dusesocks. If you use SOCKS you also need
3799to use the PerlIO abstraction layer, this will be implicitly selected.
4633a7c4 3800
0f0995ae 3801If this doesn't make any sense to you, just accept the default '$dflt'.
bd9b35c9 3802EOM
bd9b35c9
JH
3803rp='Build Perl for SOCKS?'
3804. ./myread
3805case "$ans" in
3806y|Y) val="$define" ;;
3807*) val="$undef" ;;
3808esac
3809set usesocks
3810eval $setvar
3811
cf829ab0
JH
3812case "$usesocks" in
3813$define|true|[yY]*) useperlio="$define";;
3814esac
3815
bd9b35c9
JH
3816: Looking for optional libraries
3817echo " "
3818echo "Checking for optional libraries..." >&4
3819case "$libs" in
3820' '|'') dflt='';;
3821*) dflt="$libs";;
3822esac
3823case "$libswanted" in
3824'') libswanted='c_s';;
3825esac
3826case "$usesocks" in
923fc586 3827"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 3828esac
68435ea7
JH
3829libsfound=''
3830libsfiles=''
3831libsdirs=''
13b3f787
JH
3832libspath=''
3833for thisdir in $libpth $xlibpth; do
3834 test -d $thisdir && libspath="$libspath $thisdir"
3835done
bd9b35c9 3836for thislib in $libswanted; do
13b3f787 3837 for thisdir in $libspath; do
f7dd4e7f
JH
3838 xxx=''
3839 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3840 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3841 $test -f "$xxx" && eval $libscheck
3842 $test -f "$xxx" && libstyle=shared
3843 fi
3844 if test ! -f "$xxx"; then
3845 xxx=$thisdir/lib$thislib.$so
3846 $test -f "$xxx" && eval $libscheck
3847 $test -f "$xxx" && libstyle=shared
3848 fi
3849 if test ! -f "$xxx"; then
3850 xxx=$thisdir/lib$thislib$_a
3851 $test -f "$xxx" && eval $libscheck
3852 $test -f "$xxx" && libstyle=static
3853 fi
3854 if test ! -f "$xxx"; then
3855 xxx=$thisdir/$thislib$_a
3856 $test -f "$xxx" && eval $libscheck
3857 $test -f "$xxx" && libstyle=static
3858 fi
3859 if test ! -f "$xxx"; then
3860 xxx=$thisdir/lib${thislib}_s$_a
3861 $test -f "$xxx" && eval $libscheck
3862 $test -f "$xxx" && libstyle=static
09ea5ba9 3863 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
3864 fi
3865 if test ! -f "$xxx"; then
3866 xxx=$thisdir/Slib$thislib$_a
3867 $test -f "$xxx" && eval $libscheck
3868 $test -f "$xxx" && libstyle=static
3869 fi
3870 if $test -f "$xxx"; then
43999f95 3871 case "$libstyle" in
f7dd4e7f
JH
3872 shared) echo "Found -l$thislib (shared)." ;;
3873 static) echo "Found -l$thislib." ;;
3874 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 3875 esac
bd9b35c9
JH
3876 case " $dflt " in
3877 *"-l$thislib "*);;
f7dd4e7f 3878 *) dflt="$dflt -l$thislib"
43999f95
JH
3879 libsfound="$libsfound $xxx"
3880 yyy=`basename $xxx`
3881 libsfiles="$libsfiles $yyy"
1e127011 3882 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
3883 case " $libsdirs " in
3884 *" $yyy "*) ;;
3885 *) libsdirs="$libsdirs $yyy" ;;
3886 esac
3887 ;;
bd9b35c9 3888 esac
f7dd4e7f
JH
3889 break
3890 fi
3891 done
3892 if $test ! -f "$xxx"; then
3893 echo "No -l$thislib."
bd9b35c9
JH
3894 fi
3895done
3896set X $dflt
3897shift
3898dflt="$*"
3899case "$libs" in
3900'') dflt="$dflt";;
3901*) dflt="$libs";;
3902esac
3903case "$dflt" in
3904' '|'') dflt='none';;
3905esac
4633a7c4 3906
bd9b35c9 3907$cat <<EOM
4633a7c4 3908
bd9b35c9
JH
3909In order to compile $package on your machine, a number of libraries
3910are usually needed. Include any other special libraries here as well.
3911Say "none" for none. The default list is almost always right.
8e07c86e 3912EOM
8e07c86e 3913
bd9b35c9
JH
3914echo " "
3915rp="What libraries to use?"
3916. ./myread
3917case "$ans" in
3918none) libs=' ';;
3919*) libs="$ans";;
3920esac
d71b2b6b 3921
bd9b35c9
JH
3922: determine optimization, if desired, or use for debug flag also
3923case "$optimize" in
3924' '|$undef) dflt='none';;
3925'') dflt='-O';;
3926*) dflt="$optimize";;
3927esac
3928$cat <<EOH
d71b2b6b 3929
bd9b35c9
JH
3930By default, $package compiles with the -O flag to use the optimizer.
3931Alternately, you might want to use the symbolic debugger, which uses
3932the -g flag (on traditional Unix systems). Either flag can be
3933specified here. To use neither flag, specify the word "none".
d71b2b6b 3934
bd9b35c9
JH
3935EOH
3936rp="What optimizer/debugger flag should be used?"
3937. ./myread
3938optimize="$ans"
3939case "$optimize" in
3940'none') optimize=" ";;
3941esac
3942
3943dflt=''
3944: We will not override a previous value, but we might want to
3945: augment a hint file
3946case "$hint" in
3947default|recommended)
3948 case "$gccversion" in
3949 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 3950 esac
bd9b35c9
JH
3951 case "$optimize" in
3952 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 3953 esac
bd9b35c9
JH
3954 case "$gccversion" in
3955 2*) if test -d /etc/conf/kconfig.d &&
3956 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3957 then
3958 dflt="$dflt -posix"
3959 fi
f0d04425 3960 ;;
bd9b35c9
JH
3961 esac
3962 case "$gccversion" in
3963 1*) ;;
3964 2.[0-8]*) ;;
3965 ?*) echo " "
3966 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3967 echo 'int main(void) { return 0; }' > gcctest.c
3968 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3969 echo "Yes, it does." 2>&1
3970 case "$ccflags" in
3971 *strict-aliasing*)
3972 echo "Leaving current flags $ccflags alone." 2>&1
3973 ;;
3974 *) dflt="$dflt -fno-strict-aliasing" ;;
3975 esac
3976 else
3977 echo "Nope, it doesn't, but that's ok." 2>&1
3978 fi
f0d04425 3979 ;;
e5e20432
JH
3980 esac
3981 ;;
3982esac
3983
bd9b35c9
JH
3984case "$mips_type" in
3985*BSD*|'') inclwanted="$locincpth $usrinc";;
3986*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3987esac
3988for thisincl in $inclwanted; do
3989 if $test -d $thisincl; then
3990 if $test x$thisincl != x$usrinc; then
3991 case "$dflt" in
422af00a
LC
3992 *" -I$thisincl "*);;
3993 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
3994 esac
3995 fi
3996 fi
3997done
40a7a20a 3998
bd9b35c9
JH
3999inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4000 xxx=true;
4001elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4002 xxx=true;
4003else
4004 xxx=false;
4005fi;
4006if $xxx; then
4007 case "$dflt" in
4008 *$2*);;
4009 *) dflt="$dflt -D$2";;
4010 esac;
4011fi'
40a7a20a 4012
bd9b35c9 4013set signal.h LANGUAGE_C; eval $inctest
40a7a20a 4014
bd9b35c9
JH
4015case "$usesocks" in
4016$define)
4017 ccflags="$ccflags -DSOCKS"
4018 ;;
4019esac
40a7a20a 4020
bd9b35c9
JH
4021case "$hint" in
4022default|recommended) dflt="$ccflags $dflt" ;;
4023*) dflt="$ccflags";;
4024esac
40a7a20a 4025
bd9b35c9
JH
4026case "$dflt" in
4027''|' ') dflt=none;;
4028esac
422af00a 4029
bd9b35c9 4030$cat <<EOH
40a7a20a 4031
bd9b35c9
JH
4032Your C compiler may want other flags. For this question you should include
4033-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4034but you should NOT include libraries or ld flags like -lwhatever. If you
4035want $package to honor its debug switch, you should include -DDEBUGGING here.
4036Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 4037
bd9b35c9 4038To use no flags, specify the word "none".
40a7a20a 4039
bd9b35c9
JH
4040EOH
4041set X $dflt
4042shift
4043dflt=${1+"$@"}
4044rp="Any additional cc flags?"
4045. ./myread
4046case "$ans" in
4047none) ccflags='';;
4048*) ccflags="$ans";;
4049esac
8e07c86e 4050
bd9b35c9
JH
4051: the following weeds options from ccflags that are of no interest to cpp
4052cppflags="$ccflags"
4053case "$gccversion" in
40541*) cppflags="$cppflags -D__GNUC__"
4633a7c4 4055esac
bd9b35c9
JH
4056case "$mips_type" in
4057'');;
4058*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4059esac
4060case "$cppflags" in
4061'');;
4062*)
4063 echo " "
4064 echo "Let me guess what the preprocessor flags are..." >&4
4065 set X $cppflags
4066 shift
4067 cppflags=''
4068 $cat >cpp.c <<'EOM'
4069#define BLURFL foo
8e07c86e 4070
bd9b35c9
JH
4071BLURFL xx LFRULB
4072EOM
4073 previous=''
4074 for flag in $*
4075 do
4076 case "$flag" in
4077 -*) ftry="$flag";;
4078 *) ftry="$previous $flag";;
4079 esac
4080 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4081 >cpp1.out 2>/dev/null && \
4082 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4083 >cpp2.out 2>/dev/null && \
4084 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4085 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4086 then
4087 cppflags="$cppflags $ftry"
4088 previous=''
4089 else
4090 previous="$flag"
4091 fi
4092 done
4093 set X $cppflags
4094 shift
4095 cppflags=${1+"$@"}
4096 case "$cppflags" in
4097 *-*) echo "They appear to be: $cppflags";;
4098 esac
4099 $rm -f cpp.c cpp?.out
2afac517
PP
4100 ;;
4101esac
8e07c86e 4102
bd9b35c9
JH
4103: flags used in final linking phase
4104case "$ldflags" in
4105'') if ./venix; then
4106 dflt='-i -z'
10a23457 4107 else
bd9b35c9 4108 dflt=''
10a23457 4109 fi
bd9b35c9
JH
4110 case "$ccflags" in
4111 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 4112 esac
bd9b35c9
JH
4113 ;;
4114*) dflt="$ldflags";;
4115esac
4116
4117: Try to guess additional flags to pick up local libraries.
4118for thislibdir in $libpth; do
4119 case " $loclibpth " in
4120 *" $thislibdir "*)
4121 case "$dflt " in
4122 *"-L$thislibdir "*) ;;
4123 *) dflt="$dflt -L$thislibdir" ;;
4124 esac
c4f23d77
AD