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