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