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