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