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