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