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