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