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