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