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