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